com.esri.adf.web.data.renderer
Class WebUniqueValueRenderer

java.lang.Object
  extended by com.esri.adf.web.data.renderer.WebUniqueValueRenderer
All Implemented Interfaces:
WebActiveRenderer, WebRenderer, Serializable

public class WebUniqueValueRenderer
extends Object
implements WebActiveRenderer

WebUniqueValueRenderer is a renderer that is used for rendering features differently depending on the values of three fields. The fields must be of type String. The values of the fields set on a are concatenated and than compared to the concatenation of the tree corresponding fields of a feature.

  For example,
    WebUniqueValueRenderer wuvr = new WebUniqueValueRenderer();
    wuvr.setDefaultSymbol(defaultMarkerSymbol);
    wuvr.setDefaultLabel("Default Label");
    wuvr.setField1("TYPE");
    wuvr.setField2(null);
    wuvr.setField3(null);
    wuvr.setFieldDelimiter(null);
    
    ArrayList<WebUniqueValueInfo> infos = new ArrayList<WebUniqueValueInfo>(5);
    
    WebSimpleMarkerSymbol redMS = new WebSimpleMarkerSymbol();
    redMS.setColor("255,0,0");
    redMS.setWidth(15);
    redMS.setMarkerType(WebSimpleMarkerSymbol.CIRCLE);
    WebUniqueValueInfo uvi = new WebUniqueValueInfo("Red Color", "Red Color", "1", redMS);
    infos.add(uvi);
    
    WebSimpleMarkerSymbol greenMS = new WebSimpleMarkerSymbol();
    greenMS.setColor("0,255,0");
    greenMS.setWidth(25);
    greenMS.setMarkerType(WebSimpleMarkerSymbol.CIRCLE);
    uvi = new WebUniqueValueInfo("Green Color", "Green Color", "2", greenMS);
    infos.add(uvi);
    
    wuvr.setUniquValueInfos(infos);
 
When features of a GraphicsLayer are rendered using an instance of WebUniqueValueRenderer shown above, all the features with the value "1" in the "TYPE" field are shown in red color, while those with the value "2" are shown in green color.

See Also:
Serialized Form

Constructor Summary
WebUniqueValueRenderer()
           
 
Method Summary
 void addValues(List<? extends String> values)
           
 void clearValues()
           
 String getDefaultLabel()
          Returnds the default label.
 WebSymbol getDefaultSymbol()
          Returns the default symbol.
 String getField1()
          Returns the name of the first field.
 String getField2()
          Returns the name of the second field.
 String getField3()
          Returns the name of the third field.
 String getFieldDelimiter()
          Returns the field delimiter.
 String getType()
          Returns the type of the renderer as "Unique Value Renderer"
 List<WebUniqueValueInfo> getUniqueValueInfos()
          Returns the list of UniqueValueInfos.
 void render(List<? extends WebGeometry> geometries, WebElementConverter converter)
          Applies the rendering strategy of this renderer to the passed geometries.
 void setDefaultLabel(String defaultLabel)
          Sets the default label.
 void setDefaultSymbol(WebSymbol defaultSymbol)
          Sets the default symbol.
 void setField1(String field1)
          Sets the name of the first field.
 void setField2(String field2)
          Sets the name of the second field.
 void setField3(String field3)
          Sets the name of the third field.
 void setFieldDelimiter(String fieldDelimiter)
          Sets the field delimiter.
 void setUniqueValueInfos(List<? extends WebUniqueValueInfo> uniqueValueInfos)
          Sets the list of UniqueValueInfos.
 void setUniquValueInfos(List<? extends WebUniqueValueInfo> uniqueValueInfos)
          Deprecated. replaced by setUniqueValueInfos(List)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WebUniqueValueRenderer

public WebUniqueValueRenderer()
Method Detail

getType

public String getType()
Returns the type of the renderer as "Unique Value Renderer"

Specified by:
getType in interface WebRenderer
Returns:
the string representation of renderer type

setUniqueValueInfos

public void setUniqueValueInfos(List<? extends WebUniqueValueInfo> uniqueValueInfos)
Sets the list of UniqueValueInfos.

Parameters:
uniqueValueInfos - the list of UniqueValueInfos

getUniqueValueInfos

public List<WebUniqueValueInfo> getUniqueValueInfos()
Returns the list of UniqueValueInfos.

Returns:
the list of UniqueValueInfos

setDefaultLabel

public void setDefaultLabel(String defaultLabel)
Sets the default label.

Parameters:
defaultLabel - the default label to be used in TOC

getDefaultLabel

public String getDefaultLabel()
Returnds the default label.

Returns:
the default label

setDefaultSymbol

public void setDefaultSymbol(WebSymbol defaultSymbol)
Sets the default symbol.

Parameters:
defaultSymbol - the default symbol

getDefaultSymbol

public WebSymbol getDefaultSymbol()
Returns the default symbol.

Returns:
the default symbol

setField1

public void setField1(String field1)
Sets the name of the first field.

Parameters:
field1 - the name of the first field

getField1

public String getField1()
Returns the name of the first field.

Returns:
the name of the first field

setField2

public void setField2(String field2)
Sets the name of the second field.

Parameters:
field2 - the name of the first field

getField2

public String getField2()
Returns the name of the second field.

Returns:
the name of the second field

setField3

public void setField3(String field3)
Sets the name of the third field.

Parameters:
field3 - the name of the first field

getField3

public String getField3()
Returns the name of the third field.

Returns:
the name of the third field

setFieldDelimiter

public void setFieldDelimiter(String fieldDelimiter)
Sets the field delimiter.

Parameters:
fieldDelimiter - the field delimiter

getFieldDelimiter

public String getFieldDelimiter()
Returns the field delimiter.

Returns:
a field delimiter

setUniquValueInfos

@Deprecated
public void setUniquValueInfos(List<? extends WebUniqueValueInfo> uniqueValueInfos)
Deprecated. replaced by setUniqueValueInfos(List)


clearValues

public void clearValues()

addValues

public void addValues(List<? extends String> values)

render

public void render(List<? extends WebGeometry> geometries,
                   WebElementConverter converter)
            throws Exception
Description copied from interface: WebActiveRenderer
Applies the rendering strategy of this renderer to the passed geometries.

Specified by:
render in interface WebActiveRenderer
Parameters:
geometries - a list of geometries to be rendered
converter - a converter to be used for rendering geometries
Throws:
Exception - is thrown if something goes wrong