2323import org .vast .ows .sos .SOSServiceCapabilities ;
2424import com .vaadin .data .Property ;
2525import com .vaadin .server .ExternalResource ;
26+ import com .vaadin .shared .ui .label .ContentMode ;
2627import com .vaadin .ui .HorizontalLayout ;
2728import com .vaadin .ui .Label ;
2829import com .vaadin .ui .Link ;
4344public class SOSAdminPanel extends DefaultModulePanel <SOSService > implements IModuleAdminPanel <SOSService >
4445{
4546 private static final long serialVersionUID = -5196033911134749125L ;
46- protected static final String PROP_ENDPOINT = "endPoint" ;
47+ private static final String PROP_ENDPOINT = "endPoint" ;
48+ private static final String LINK_TARGET = "osh-sos" ;
4749
4850
4951 @ SuppressWarnings ("serial" )
@@ -53,12 +55,12 @@ public LinkItem(String label, String linkText, String href)
5355 {
5456 setSpacing (true );
5557 addComponent (new Label (label + ":" ));
56- addComponent (new Link (linkText , new ExternalResource (href ), "osh-sos" , 0 , 0 , null ));
58+ addComponent (new Link (linkText , new ExternalResource (href ), LINK_TARGET , 0 , 0 , null ));
5759 }
5860
5961 public void addLinkItem (String linkText , String href )
6062 {
61- addComponent (new Link (linkText , new ExternalResource (href ), "osh-sos" , 0 , 0 , null ));
63+ addComponent (new Link (linkText , new ExternalResource (href ), LINK_TARGET , 0 , 0 , null ));
6264 }
6365 }
6466
@@ -92,7 +94,7 @@ public void build(final MyBeanItem<ModuleConfig> beanItem, final SOSService modu
9294 // link to capabilities
9395 baseUrl += "?service=SOS&version=2.0&request=" ;
9496 String href = baseUrl + "GetCapabilities" ;
95- Link link = new Link ("Service Capabilities" , new ExternalResource (href ), "osh-sos" , 0 , 0 , null );
97+ Link link = new Link ("Service Capabilities" , new ExternalResource (href ), LINK_TARGET , 0 , 0 , null );
9698 link .setWidthUndefined ();
9799 addComponent (link );
98100
@@ -122,22 +124,33 @@ public void build(final MyBeanItem<ModuleConfig> beanItem, final SOSService modu
122124 //linkItem.addLinkItem("JSON", href);
123125 tabLayout .addComponent (linkItem );
124126
125- // result template
126- href = baseUrl + "GetResultTemplate&offering=" + offering .getIdentifier () +
127- "&observedProperty=" + offering .getObservableProperties ().iterator ().next ();
128- linkItem = new LinkItem ("Record Description" , "XML" , href );
129- href += "&responseFormat=" + OWSUtils .JSON_MIME_TYPE ;
130- linkItem .addLinkItem ("JSON" , href );
131- tabLayout .addComponent (linkItem );
132-
133- // latest obs
134- href = baseUrl + "GetResult&offering=" + offering .getIdentifier () +
135- "&observedProperty=" + offering .getObservableProperties ().iterator ().next () +
136- "&temporalFilter=phenomenonTime,now" ;
137- linkItem = new LinkItem ("Latest Measurements" , "RAW" , href );
138- href += "&responseFormat=" + OWSUtils .JSON_MIME_TYPE ;
139- linkItem .addLinkItem ("JSON" , href );
140- tabLayout .addComponent (linkItem );
127+ for (String obs : offering .getObservableProperties ())
128+ {
129+ // spacer
130+ Label spacer = new Label ();
131+ spacer .setStyleName (STYLE_SPACER );
132+ spacer .setHeight (10 , Unit .PIXELS );
133+ tabLayout .addComponent (spacer );
134+
135+ // observable name
136+ String label = obs .substring (obs .lastIndexOf ('/' )+1 );
137+ tabLayout .addComponent (new Label ("<b>" +label +"</b>" , ContentMode .HTML ));
138+
139+ // result template
140+ href = baseUrl + "GetResultTemplate&offering=" + offering .getIdentifier () + "&observedProperty=" + obs ;
141+ linkItem = new LinkItem ("Record Description" , "XML" , href );
142+ href += "&responseFormat=" + OWSUtils .JSON_MIME_TYPE ;
143+ linkItem .addLinkItem ("JSON" , href );
144+ tabLayout .addComponent (linkItem );
145+
146+ // latest obs
147+ href = baseUrl + "GetResult&offering=" + offering .getIdentifier () + "&observedProperty=" + obs +
148+ "&temporalFilter=phenomenonTime,now" ;
149+ linkItem = new LinkItem ("Latest Measurements" , "RAW" , href );
150+ href += "&responseFormat=" + OWSUtils .JSON_MIME_TYPE ;
151+ linkItem .addLinkItem ("JSON" , href );
152+ tabLayout .addComponent (linkItem );
153+ }
141154 }
142155 }
143156 }
0 commit comments