edu.nrao.sss.webapp.faces.component
Class GraphicalSelectorUIComponent
java.lang.Object
javax.faces.component.UIComponent
javax.faces.component.UIComponentBase
javax.faces.component.UIOutput
javax.faces.component.UIInput
edu.nrao.sss.webapp.faces.component.GraphicalSelectorUIComponent
- All Implemented Interfaces:
- EditableValueHolder, StateHolder, ValueHolder
public class GraphicalSelectorUIComponent
- extends UIInput
Renders a component that allows a user to select a set of rectangles.
These rectangles will be arranged with absolute positioning inside a div
that can be styled with css. A typical usage may be to set the width,
height, and background image of the div and position the rectangles over
pertinent areas of the image. Selecting a rectangle would denote selecting
the object under that rectangle in the image.
The positions of the rectangles are determined by an xml configuration
file. Currently that file must contain all configurations that this
component will be used for. The file must be at the root of the class path
and be named graphicalSelector.cfg.xml
. The simple schema for
these files is below:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<!-- Restricts names to being alphanumeric (with underscores). no spaces, min length 1 -->
<xs:simpleType name="nameType">
<xs:restriction base="xs:string">
<xs:pattern value="[a-zA-Z0-9_]+"/>
</xs:restriction>
</xs:simpleType>
<xs:complexType name="regionType">
<xs:attribute name="name" type="nameType" use="required"/>
<xs:attribute name="x" type="xs:int" use="required"/>
<xs:attribute name="y" type="xs:int" use="required"/>
<xs:attribute name="width" type="xs:int" use="required"/>
<xs:attribute name="height" type="xs:int" use="required"/>
</xs:complexType>
<xs:element name="selector-configuration">
<xs:complexType>
<xs:sequence>
<xs:element name="region-map" minOccurs="1" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="region" type="regionType" minOccurs="1" maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute name="name" type="nameType" use="required"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
Methods inherited from class javax.faces.component.UIInput |
addValidator, addValueChangeListener, broadcast, compareValues, getConvertedValue, getFamily, getSubmittedValue, getValidator, getValidators, getValueChangeListener, getValueChangeListeners, isImmediate, isLocalValueSet, isRequired, isValid, processDecodes, processUpdates, processValidators, removeValidator, removeValueChangeListener, setImmediate, setLocalValueSet, setRequired, setSubmittedValue, setValid, setValidator, setValue, setValueChangeListener, updateModel, validate, validateValue |
Methods inherited from class javax.faces.component.UIComponentBase |
addFacesListener, findComponent, getAttributes, getChildCount, getChildren, getClientId, getFacesContext, getFacesListeners, getFacet, getFacets, getFacetsAndChildren, getId, getParent, getRenderer, getRendererType, getRendersChildren, getValueBinding, isRendered, isTransient, processRestoreState, processSaveState, queueEvent, removeFacesListener, restoreAttachedState, saveAttachedState, setId, setParent, setRendered, setRendererType, setTransient, setValueBinding |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
GraphicalSelectorUIComponent
public GraphicalSelectorUIComponent()
encodeBegin
public void encodeBegin(FacesContext context)
throws IOException
- renders a div containing div's and hidden input fields for each defined
rectangle in the chosen map. If map is null, no rectangles are rendered.
We also render javascript to highlight and select each rectangle.
- Overrides:
encodeBegin
in class UIComponentBase
- Throws:
IOException
encodeEnd
public void encodeEnd(FacesContext context)
throws IOException
- Overridden to be empty.
- Overrides:
encodeEnd
in class UIComponentBase
- Throws:
IOException
encodeChildren
public void encodeChildren(FacesContext context)
throws IOException
- Overridden to be empty.
- Overrides:
encodeChildren
in class UIComponentBase
- Throws:
IOException
decode
public void decode(FacesContext context)
- Overrides:
decode
in class UIInput
getMap
public String getMap()
setMap
public void setMap(String map)
saveState
public Object saveState(FacesContext context)
- Specified by:
saveState
in interface StateHolder
- Overrides:
saveState
in class UIInput
restoreState
public void restoreState(FacesContext context,
Object state)
- Specified by:
restoreState
in interface StateHolder
- Overrides:
restoreState
in class UIInput
getConverter
public Converter getConverter()
- Overridden to provide an appropriate CSV to List converter for our value.
- Specified by:
getConverter
in interface ValueHolder
- Overrides:
getConverter
in class UIOutput
Copyright © 2009. All Rights Reserved.