...
Code Block |
---|
| xml |
---|
| xml |
---|
title | Example, all be it incomplete, showing some client configurations |
---|
linenumbers | true |
---|
|
<?xml version="1.0" encoding="UTF-8"?>
<config xmlns="urn:com.cohga.server.config#1.0" xmlns:client="urn:com.cohga.html.client#1.0">
<client:config id="test1">
<view id="com.cohga.html.client.map.mapView">
<extents>
<initial minx="327098" miny="5811358" maxx="351971" maxy="5827675"/>
<full minx="327098" miny="5811358" maxx="351971" maxy="5827675"/>
</extents>
</view>
</client:config>
<client:config id="test2">
<view id="com.cohga.html.client.map.mapView">
<extents>
<initial minx="327098" miny="5811358" maxx="351971" maxy="5827675"/>
<full minx="327098" miny="5811358" maxx="351971" maxy="5827675"/>
</extents>
</view>
</client:config>
<client:config id="test3">
<view id="com.cohga.html.client.map.mapView">
<extents>
<initial minx="327098" miny="5811358" maxx="351971" maxy="5827675"/>
<full minx="327098" miny="5811358" maxx="351971" maxy="5827675"/>
</extents>
</view>
</client:config>
</config>
|
To create a new snippet for the extents in the above sample we would extract the part of the configuration we want to make common, like this:
Code Block |
---|
| xml |
---|
| xml |
---|
title | Common extents extracted into a snippet with the id 'defaults' |
---|
linenumbers | true |
---|
|
...
<client:extents id="defaults">
<initial minx="327098" miny="5811358" maxx="351971" maxy="5827675"/>
<full minx="327098" miny="5811358" maxx="351971" maxy="5827675"/>
</client:extents>
... |
This would create a new snippet, called defaults
of type extents
. The id, defaults
in the above example, isn't important and we can use anything that makes sense here (it's just used to refer to a specific snippet later when we want to use it). The type, extents
in the above example, is important however and must be the same as the target tag that we're actually creating the snippet for, and it's the combination of the id and type that's used later on to include the snippet within a client configuration.
...
Code Block |
---|
| xml |
---|
| xml |
---|
title | Referencing the new snippet |
---|
linenumbers | true |
---|
|
<extents ref="defaults"/>
|
...
Code Block |
---|
| xml |
---|
| xml |
---|
2 | Example configurations altered to use a snippet |
---|
linenumbers | true |
---|
|
<?xml version="1.0" encoding="UTF-8"?>
<config xmlns="urn:com.cohga.server.config#1.0" xmlns:client="urn:com.cohga.html.client#1.0">
<client:extents id="defaults">
<initial minx="327098" miny="5811358" maxx="351971" maxy="5827675"/>
<full minx="327098" miny="5811358" maxx="351971" maxy="5827675"/>
</client:extents>
<client:config id="test1">
<view id="com.cohga.html.client.map.mapView">
<extents ref="defaults"/>
</view>
</client:config>
<client:config id="test2">
<view id="com.cohga.html.client.map.mapView">
<extents ref="defaults"/>
</view>
</client:config>
<client:config id="test3">
<view id="com.cohga.html.client.map.mapView">
<extents ref="defaults"/>
</view>
</client:config>
</config>
|
Refining snippets
...
Code Block |
---|
| xml |
---|
| xml |
---|
title | Altering included snippets |
---|
linenumbers | true |
---|
|
<?xml version="1.0" encoding="UTF-8"?>
<config xmlns="urn:com.cohga.server.config#1.0" xmlns:client="urn:com.cohga.html.client#1.0">
<client:extents id="defaults">
<initial minx="327098" miny="5811358" maxx="351971" maxy="5827675"/>
<full minx="327098" miny="5811358" maxx="351971" maxy="5827675"/>
</client:extents>
<client:config id="test1">
<view id="com.cohga.html.client.map.mapView">
<extents ref="defaults"/>
</view>
</client:config>
<client:config id="test2">
<view id="com.cohga.html.client.map.mapView">
<extents ref="defaults">
<initial minx="327000" miny="5811000" maxx="330000" maxy="5813000"/>
</extents>
</view>
</client:config>
<client:config id="test3">
<view id="com.cohga.html.client.map.mapView">
<extents ref="defaults">
<limit minx="327098" miny="5811358" maxx="351971" maxy="5827675"/>
</extents>
</view>
</client:config>
</config>
|
this would be the equivalent of
Code Block |
---|
| xml |
---|
| xml |
---|
title | Altered example shown not using snippets |
---|
linenumbers | true |
---|
|
<?xml version="1.0" encoding="UTF-8"?>
<config xmlns="urn:com.cohga.server.config#1.0" xmlns:client="urn:com.cohga.html.client#1.0">
<client:config id="test1">
<view id="com.cohga.html.client.map.mapView">
<extents>
<initial minx="327098" miny="5811358" maxx="351971" maxy="5827675"/>
<full minx="327098" miny="5811358" maxx="351971" maxy="5827675"/>
</extents>
</view>
</client:config>
<client:config id="test2">
<view id="com.cohga.html.client.map.mapView">
<extents>
<initial minx="327000" miny="5811000" maxx="330000" maxy="5813000"/>
<full minx="327098" miny="5811358" maxx="351971" maxy="5827675"/>
</extents>
</view>
</client:config>
<client:config id="test3">
<view id="com.cohga.html.client.map.mapView">
<extents>
<initial minx="327098" miny="5811358" maxx="351971" maxy="5827675"/>
<full minx="327098" miny="5811358" maxx="351971" maxy="5827675"/>
<limit minx="327098" miny="5811358" maxx="351971" maxy="5827675"/>
</extents>
</view>
</client:config>
</config>
|
Note |
---|
One thing you can't currently do is to remove a sub-tag from a snippet via the reference. |
...