com.esri.adf.web.faces.component
Class MapControl

java.lang.Object
  extended by javax.faces.component.UIComponent
      extended by javax.faces.component.UIComponentBase
          extended by javax.faces.component.UICommand
              extended by com.esri.adf.web.faces.component.MapControl
All Implemented Interfaces:
EventListener, javax.faces.component.ActionSource, javax.faces.component.ActionSource2, javax.faces.component.StateHolder, javax.faces.event.ActionListener, javax.faces.event.FacesListener

public class MapControl
extends javax.faces.component.UICommand
implements javax.faces.event.ActionListener

The map control provides the display functionality of a map document served using GIS Server. Using the map control, you can navigate the map, for example, ZoomIn, ZoomOut, Pan etc.
The MapControl works with WebMap object. The MapRenderer class renders the control to the appropriate markup, and the MapTag class exposes the control as a JSP custom tag named map. In addition, events are exposed through MapEvent, and various map tool actions can be performed on the control.


Field Summary
static String COMPONENT_FAMILY
          The standard component family for this component.
static String COMPONENT_TYPE
          The standard component type for this component.
static String DEFAULT_XSL_FILE_NAME
          The name of the XSL file used to render this control by default.
 
Fields inherited from class javax.faces.component.UIComponent
bindings
 
Constructor Summary
MapControl()
          Initializes the MapControl.
 
Method Summary
 ToolItem getActiveTool()
          Returns the tool item for the active tool.
 String getFamily()
          Returns the family of this control.
 int getHeight()
          Returns the height of the control.
protected  javax.faces.render.Renderer getRenderer(javax.faces.context.FacesContext context)
          Returns a design-time renderer if the component is used in an IDE.
 String getStyle()
          Returns the style attributes of toolbar control.
 String getStyleClass()
          Returns the file name where the CSS style attributes are defined.
 ToolItemCollection getToolItemCollection()
          Returns the tool item collection.
 WebMap getWebMap()
          Returns the WebMap object associated with this control.
 WebScaleBar getWebScaleBar()
           
 int getWidth()
          Returns the width of the control.
 URL getXslUrl()
          Returns the URL of the XSL file used to render the control.
 boolean isInit()
          Returns an indicator whether this control is initialized.
 boolean isShowCoordinateTracker()
          Indicates whether the control should display the coordinate tracker.
 boolean isShowNavigator()
          Indicates whether the control should display the navigator.
 boolean isShowZoomSlider()
          Indicates whether the control should display the zoom slider.
 void processAction(javax.faces.event.ActionEvent event)
          Processes an action fired by this control.
 void processDecodes(javax.faces.context.FacesContext facesContext)
           
 void processUpdates(javax.faces.context.FacesContext facesContext)
           
 MapEvent queueMapEvent(javax.faces.context.FacesContext facesContext)
          Set the event arguments passed by the client and queues the action event.
 void restoreState(javax.faces.context.FacesContext facesContext, Object state)
          Restores the state of the control.
 Object saveState(javax.faces.context.FacesContext facesContext)
          Saves the state of this control.
 void setActiveTool(String toolKey)
          Sets the active tool for this control.
 void setActiveTool(ToolItem activeTool)
          Sets the active tool for this control.
 void setHeight(int height)
          Sets the height of the control.
 void setId(String id)
           
 void setInit(boolean init)
          Sets an indicator whether to initialize the control.
 void setShowCoordinateTracker(boolean showCoordinateTracker)
          Sets whether the control should display the coordinate tracker or not.
 void setShowNavigator(boolean showNavigator)
          Sets whether the control should display the navigator or not.
 void setShowZoomSlider(boolean showZoomSlider)
          Sets whether the control should display the zoom slider or not.
 void setStyle(String style)
          Sets the default style for the toolbar control.
 void setStyleClass(String styleClass)
          Sets the CSS class name where the CSS style attributes are defined.
 void setValueExpression(String name, javax.el.ValueExpression binding)
          Sets the value binding.
 void setWidth(int width)
          Sets the width of the control.
 void setXslUrl(URL xslUrl)
          Sets the URL of the XSL file used to render the control.
 
Methods inherited from class javax.faces.component.UICommand
addActionListener, broadcast, getAction, getActionExpression, getActionListener, getActionListeners, getValue, isImmediate, queueEvent, removeActionListener, setAction, setActionExpression, setActionListener, setImmediate, setValue
 
Methods inherited from class javax.faces.component.UIComponentBase
addFacesListener, decode, encodeBegin, encodeChildren, encodeEnd, findComponent, getAttributes, getChildCount, getChildren, getClientId, getFacesContext, getFacesListeners, getFacet, getFacetCount, getFacets, getFacetsAndChildren, getId, getParent, getRendererType, getRendersChildren, getValueBinding, invokeOnComponent, isRendered, isTransient, processRestoreState, processSaveState, processValidators, removeFacesListener, restoreAttachedState, saveAttachedState, setParent, setRendered, setRendererType, setTransient, setValueBinding
 
Methods inherited from class javax.faces.component.UIComponent
encodeAll, getContainerClientId, getValueExpression
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COMPONENT_FAMILY

public static final String COMPONENT_FAMILY
The standard component family for this component.

See Also:
Constant Field Values

COMPONENT_TYPE

public static final String COMPONENT_TYPE
The standard component type for this component.

See Also:
Constant Field Values

DEFAULT_XSL_FILE_NAME

public static final String DEFAULT_XSL_FILE_NAME
The name of the XSL file used to render this control by default.

See Also:
Constant Field Values
Constructor Detail

MapControl

public MapControl()
Initializes the MapControl. The renderer type is set and the control is registered as an ActionListener.

Method Detail

setId

public void setId(String id)
Overrides:
setId in class javax.faces.component.UIComponentBase

processDecodes

public void processDecodes(javax.faces.context.FacesContext facesContext)
Overrides:
processDecodes in class javax.faces.component.UIComponentBase

getFamily

public String getFamily()
Returns the family of this control.

Overrides:
getFamily in class javax.faces.component.UICommand
Returns:
String- the COMPONENT_FAMILY

getRenderer

protected javax.faces.render.Renderer getRenderer(javax.faces.context.FacesContext context)
Returns a design-time renderer if the component is used in an IDE.

Overrides:
getRenderer in class javax.faces.component.UIComponentBase
Parameters:
context - the FacesContext
Returns:
Renderer- the renderer object

processAction

public void processAction(javax.faces.event.ActionEvent event)
                   throws javax.faces.event.AbortProcessingException
Processes an action fired by this control. The map control delegates processing of this action to the active tool's MapToolAction class.

Specified by:
processAction in interface javax.faces.event.ActionListener
Parameters:
event - the ActionEvent
Throws:
javax.faces.event.AbortProcessingException - if the action can not be processed

queueMapEvent

public MapEvent queueMapEvent(javax.faces.context.FacesContext facesContext)
Set the event arguments passed by the client and queues the action event. A new MapEvent is created and populated with the event arguments containing the WebContext, the active tool and the ClientActionArgs needed for that tool.

Parameters:
facesContext - the FacesContext
Returns:
MapEventArgs- the map event arguments

setActiveTool

public void setActiveTool(String toolKey)
Sets the active tool for this control.

Parameters:
toolKey - the tool key, for example, "ZoomIn"

getWebMap

public WebMap getWebMap()
Returns the WebMap object associated with this control.

Returns:
WebMap- the WebMap

getWebScaleBar

public WebScaleBar getWebScaleBar()

getToolItemCollection

public ToolItemCollection getToolItemCollection()
Returns the tool item collection.

Returns:
ToolItemCollection- the collection of tools

setActiveTool

public void setActiveTool(ToolItem activeTool)
Sets the active tool for this control.

Parameters:
activeTool - the active ToolItem

getActiveTool

public ToolItem getActiveTool()
Returns the tool item for the active tool.

Returns:
ToolItem- the active ToolItem

setInit

public void setInit(boolean init)
Sets an indicator whether to initialize the control.

Parameters:
init - if true, initialize the control

isInit

public boolean isInit()
Returns an indicator whether this control is initialized.

Returns:
boolean- if true, the control is initialized

setValueExpression

public void setValueExpression(String name,
                               javax.el.ValueExpression binding)
Sets the value binding. For the "value" attribute, checks if it is an instance of WebMap or not. If not, the method throws an ADFException. For all other cases, the method calls super.setValueBinding()

Overrides:
setValueExpression in class javax.faces.component.UIComponent
Parameters:
name - the name of the attribute or property for which to set a ValueBinding
binding - the ValueBinding to set. If null, removes any currently set ValueBinding.

setWidth

public void setWidth(int width)
Sets the width of the control.

Parameters:
width - the width in pixels

getWidth

public int getWidth()
Returns the width of the control.

Returns:
int- the width in pixels

setHeight

public void setHeight(int height)
Sets the height of the control.

Parameters:
height - the height in pixels

getHeight

public int getHeight()
Returns the height of the control.

Returns:
int- the height in pixels

setXslUrl

public void setXslUrl(URL xslUrl)
Sets the URL of the XSL file used to render the control.

Parameters:
xslUrl - the URL of the XSL file

getXslUrl

public URL getXslUrl()
Returns the URL of the XSL file used to render the control.

Returns:
URL- the URL object

getStyle

public String getStyle()
Returns the style attributes of toolbar control.

Returns:
String- the style attributes

setStyle

public void setStyle(String style)
Sets the default style for the toolbar control.

Parameters:
style - the default style for the toolbar control

getStyleClass

public String getStyleClass()
Returns the file name where the CSS style attributes are defined.

Returns:
String- the CSS class

setStyleClass

public void setStyleClass(String styleClass)
Sets the CSS class name where the CSS style attributes are defined.

Parameters:
styleClass - the CSS class

isShowZoomSlider

public boolean isShowZoomSlider()
Indicates whether the control should display the zoom slider.

Returns:
boolean- if true, shows the zoom slider

setShowZoomSlider

public void setShowZoomSlider(boolean showZoomSlider)
Sets whether the control should display the zoom slider or not.

Parameters:
showZoomSlider - if true, shows the zoom slider

isShowNavigator

public boolean isShowNavigator()
Indicates whether the control should display the navigator.

Returns:
boolean- if true, shows the navigator

setShowNavigator

public void setShowNavigator(boolean showNavigator)
Sets whether the control should display the navigator or not.

Parameters:
showNavigator - if true, shows the navigator

isShowCoordinateTracker

public boolean isShowCoordinateTracker()
Indicates whether the control should display the coordinate tracker.

Returns:
boolean- if true, shows the coordinate tracker

setShowCoordinateTracker

public void setShowCoordinateTracker(boolean showCoordinateTracker)
Sets whether the control should display the coordinate tracker or not.

Parameters:
showCoordinateTracker - if true, shows the coordinate tracker

saveState

public Object saveState(javax.faces.context.FacesContext facesContext)
Saves the state of this control.

Specified by:
saveState in interface javax.faces.component.StateHolder
Overrides:
saveState in class javax.faces.component.UICommand
Parameters:
facesContext - the associated FacesContext
Returns:
Object- the object to be saved

restoreState

public void restoreState(javax.faces.context.FacesContext facesContext,
                         Object state)
Restores the state of the control.

Specified by:
restoreState in interface javax.faces.component.StateHolder
Overrides:
restoreState in class javax.faces.component.UICommand
Parameters:
facesContext - the associated FacesContext
state - the object to restore the state of the control from

processUpdates

public void processUpdates(javax.faces.context.FacesContext facesContext)
Overrides:
processUpdates in class javax.faces.component.UIComponentBase