Class AbstractControl
- java.lang.Object
-
- org.wicketstuff.openlayers.api.control.AbstractControl
-
- All Implemented Interfaces:
Serializable,IClusterable,IJavascriptComponent
- Direct Known Subclasses:
Control,GetFeature,SelectFeatureControl,WMSGetFeatureInfo
public class AbstractControl extends Object implements IJavascriptComponent
- Author:
- Michael O'Cleirigh Provides a base class for the IJavascriptControl interface that provides a default implementation for the javascript initialization and removal methods.
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractControl(String name, boolean externalizable)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetId()Note: currently the naming of a component is related to the concrete class i.e. a WMS layer would be 'wms' + getId() like: 'wms123456'.StringgetJSadd(IOpenLayersMap map)protected StringgetJSadd(IOpenLayersMap map, String parameterString)Calls map.addControl() for the generated initialization javascript using the parameterString if present.protected StringgetJSadd(IOpenLayersMap map, String javascriptClassName, String parameterString)protected StringgetJSadd(IOpenLayersMap map, String javascriptClassName, Map<String,String> parameters)protected StringgetJSadd(IOpenLayersMap map, Map<String,String> parameters)A convenience wrapper togetJSadd(IOpenLayersMap, String)that builds the parameter string from the parameter map and then invokes the method.protected StringgetJSinvoke(IOpenLayersMap map, String invocation)A helper similiar to OpenLayersMap.getJSInvoke except instead of just getting the map context we get this control context from the root.StringgetJSremove(IOpenLayersMap map)JavaScriptResourceReference[]getJSResourceReferences()In some cases a javascript component will provide its own javascript resource.List<Layer>getLayerList()voidregisterJavascriptEvent(IOpenLayersMap map, String event, IModel<String> eventHandlingJavascriptModel)Allows javascript to be wired into events on this control.voidsetLayerList(List<Layer> layerList)
-
-
-
Constructor Detail
-
AbstractControl
protected AbstractControl(String name, boolean externalizable)
-
-
Method Detail
-
getJSadd
protected String getJSadd(IOpenLayersMap map, Map<String,String> parameters)
A convenience wrapper togetJSadd(IOpenLayersMap, String)that builds the parameter string from the parameter map and then invokes the method.- Parameters:
map-parameters-- Returns:
- the initialization javascript that adds this control to the map using the parameters if given.
-
getJSadd
protected String getJSadd(IOpenLayersMap map, String javascriptClassName, Map<String,String> parameters)
-
getJSadd
protected String getJSadd(IOpenLayersMap map, String parameterString)
Calls map.addControl() for the generated initialization javascript using the parameterString if present.- Parameters:
map-parameterString- contains comma separated list of parameters- Returns:
-
getJSadd
protected String getJSadd(IOpenLayersMap map, String javascriptClassName, String parameterString)
- Parameters:
map- the openlayers map java binding.javascriptClassName- the name of the javascript class being invoked.parameterString- the constructor parameters if any.- Returns:
- the javascript to invoke the map.addControl() method containing the initialized constructor for the control type.
-
getJSadd
public String getJSadd(IOpenLayersMap map)
- Specified by:
getJSaddin interfaceIJavascriptComponent- Returns:
- the rendered javascript to add this component to the map
-
getJSremove
public String getJSremove(IOpenLayersMap map)
- Specified by:
getJSremovein interfaceIJavascriptComponent- Returns:
- the rendered javascript to remove this component from the map.
-
getId
public String getId()
Description copied from interface:IJavascriptComponentNote: currently the naming of a component is related to the concrete class i.e. a WMS layer would be 'wms' + getId() like: 'wms123456'. The id returned here is the number part not the layer identifier part.- Specified by:
getIdin interfaceIJavascriptComponent- Returns:
- the unique id for this component. Used for naming purposes.
-
registerJavascriptEvent
public void registerJavascriptEvent(IOpenLayersMap map, String event, IModel<String> eventHandlingJavascriptModel)
Allows javascript to be wired into events on this control. The name of the event object in scope for the model value is 'evt'.control.events.register("featureselected", this, function(evt) { modelValue <-- this is the content from the model. });
Note: This is not the method to use if you want to use ajax and have wicket to the event processing.
- Parameters:
map- the map object that the control is bound to (will be bound to).event- the name of the OpenLayersEventeventHandlingJavascriptModel- an IModelthat provides the javascript text to be registered on the event.
-
getJSResourceReferences
public JavaScriptResourceReference[] getJSResourceReferences()
Description copied from interface:IJavascriptComponentIn some cases a javascript component will provide its own javascript resource. This is used by the map to add in the references.- Specified by:
getJSResourceReferencesin interfaceIJavascriptComponent- Returns:
-
getJSinvoke
protected String getJSinvoke(IOpenLayersMap map, String invocation)
A helper similiar to OpenLayersMap.getJSInvoke except instead of just getting the map context we get this control context from the root.- Parameters:
map-invocation-- Returns:
-
-