I'm trying to implement custom renderer to display device aging in different colors.
For example:
0-10 years > green
10-15 years > yellow
15+ years > red
My feature has installed date attribute which we use to calculate its age.
I've tried using ClassBreaksRenderer but its returning wrong color for age when we show the feature on map, when we test getSymbol(feature) method it returns correct color. I don't know if its a bug or I'm doing something wrong.
So I've implemented my own renderer by extending BaseRenderer but its getSymbol(feature) method is not called. Only getType() is called.
Here's the source code of my custom renderer:
<SPAN class="keyword token">import</SPAN> com<SPAN class="punctuation token">.</SPAN>esri<SPAN class="punctuation token">.</SPAN>core<SPAN class="punctuation token">.</SPAN>geometry<SPAN class="punctuation token">.</SPAN>Geometry<SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">import</SPAN> com<SPAN class="punctuation token">.</SPAN>esri<SPAN class="punctuation token">.</SPAN>core<SPAN class="punctuation token">.</SPAN>map<SPAN class="punctuation token">.</SPAN>Feature<SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">import</SPAN> com<SPAN class="punctuation token">.</SPAN>esri<SPAN class="punctuation token">.</SPAN>core<SPAN class="punctuation token">.</SPAN>renderer<SPAN class="punctuation token">.</SPAN>BaseRenderer<SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">import</SPAN> com<SPAN class="punctuation token">.</SPAN>esri<SPAN class="punctuation token">.</SPAN>core<SPAN class="punctuation token">.</SPAN>symbol<SPAN class="punctuation token">.</SPAN>SimpleFillSymbol<SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">import</SPAN> com<SPAN class="punctuation token">.</SPAN>esri<SPAN class="punctuation token">.</SPAN>core<SPAN class="punctuation token">.</SPAN>symbol<SPAN class="punctuation token">.</SPAN>SimpleLineSymbol<SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">import</SPAN> com<SPAN class="punctuation token">.</SPAN>esri<SPAN class="punctuation token">.</SPAN>core<SPAN class="punctuation token">.</SPAN>symbol<SPAN class="punctuation token">.</SPAN>SimpleMarkerSymbol<SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">import</SPAN> com<SPAN class="punctuation token">.</SPAN>esri<SPAN class="punctuation token">.</SPAN>core<SPAN class="punctuation token">.</SPAN>symbol<SPAN class="punctuation token">.</SPAN>Symbol<SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">import</SPAN> java<SPAN class="punctuation token">.</SPAN>awt<SPAN class="punctuation token">.</SPAN>Color<SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">import</SPAN> java<SPAN class="punctuation token">.</SPAN>util<SPAN class="punctuation token">.</SPAN>Date<SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">import</SPAN> java<SPAN class="punctuation token">.</SPAN>util<SPAN class="punctuation token">.</SPAN>TreeMap<SPAN class="punctuation token">;</SPAN>
<SPAN class="comment token">/**
*
* @author MethoD
*/</SPAN>
<SPAN class="keyword token">public</SPAN> <SPAN class="keyword token">class</SPAN> <SPAN class="token class-name">DeviceAgingRenderer</SPAN> <SPAN class="keyword token">extends</SPAN> <SPAN class="token class-name">BaseRenderer</SPAN> <SPAN class="punctuation token">{</SPAN>
<SPAN class="keyword token">private</SPAN> <SPAN class="keyword token">final</SPAN> String attribute<SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">private</SPAN> <SPAN class="keyword token">final</SPAN> Geometry<SPAN class="punctuation token">.</SPAN>Type geometryType<SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">private</SPAN> <SPAN class="keyword token">final</SPAN> TreeMap<SPAN class="operator token"><</SPAN>Integer<SPAN class="punctuation token">,</SPAN> Color<SPAN class="operator token">></SPAN> ageToColorMap<SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">public</SPAN> <SPAN class="token function">DeviceAgingRenderer</SPAN><SPAN class="punctuation token">(</SPAN>String attribute<SPAN class="punctuation token">,</SPAN> Geometry<SPAN class="punctuation token">.</SPAN>Type geometryType<SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">{</SPAN>
<SPAN class="keyword token">this</SPAN><SPAN class="punctuation token">.</SPAN>attribute <SPAN class="operator token">=</SPAN> attribute<SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">this</SPAN><SPAN class="punctuation token">.</SPAN>geometryType <SPAN class="operator token">=</SPAN> geometryType<SPAN class="punctuation token">;</SPAN>
<SPAN class="comment token">//this.ageToColorMap = ageToColorMap;</SPAN>
ageToColorMap <SPAN class="operator token">=</SPAN> <SPAN class="keyword token">new</SPAN> <SPAN class="token class-name">TreeMap</SPAN><SPAN class="operator token"><</SPAN><SPAN class="operator token">></SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
ageToColorMap<SPAN class="punctuation token">.</SPAN><SPAN class="token function">put</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="operator token">-</SPAN><SPAN class="number token">1</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="keyword token">new</SPAN> <SPAN class="token class-name">Color</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="number token">30</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="number token">109</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="number token">237</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="comment token">// no data > blue</SPAN>
ageToColorMap<SPAN class="punctuation token">.</SPAN><SPAN class="token function">put</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="number token">0</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="keyword token">new</SPAN> <SPAN class="token class-name">Color</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="number token">22</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="number token">183</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="number token">22</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="comment token">// 0-10 > green</SPAN>
ageToColorMap<SPAN class="punctuation token">.</SPAN><SPAN class="token function">put</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="number token">10</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="keyword token">new</SPAN> <SPAN class="token class-name">Color</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="number token">244</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="number token">156</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="number token">4</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="comment token">// 10-15 > yellow</SPAN>
ageToColorMap<SPAN class="punctuation token">.</SPAN><SPAN class="token function">put</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="number token">15</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="keyword token">new</SPAN> <SPAN class="token class-name">Color</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="number token">224</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="number token">30</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="number token">13</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="comment token">// 15+ red</SPAN>
<SPAN class="punctuation token">}</SPAN>
@Override
<SPAN class="keyword token">protected</SPAN> String <SPAN class="token function">getType</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">{</SPAN>
<SPAN class="keyword token">return</SPAN> <SPAN class="string token">"deviceAging"</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="punctuation token">}</SPAN>
@Override
<SPAN class="keyword token">public</SPAN> Symbol <SPAN class="token function">getSymbol</SPAN><SPAN class="punctuation token">(</SPAN>Feature feature<SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">{</SPAN>
System<SPAN class="punctuation token">.</SPAN>out<SPAN class="punctuation token">.</SPAN><SPAN class="token function">println</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="string token">"feature: "</SPAN> <SPAN class="operator token">+</SPAN> feature<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="comment token">// not prninted and not called</SPAN>
<SPAN class="keyword token">int</SPAN> age <SPAN class="operator token">=</SPAN> <SPAN class="operator token">-</SPAN><SPAN class="number token">1</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">if</SPAN> <SPAN class="punctuation token">(</SPAN>feature<SPAN class="punctuation token">.</SPAN><SPAN class="token function">getAttributeValue</SPAN><SPAN class="punctuation token">(</SPAN>attribute<SPAN class="punctuation token">)</SPAN> <SPAN class="operator token">!=</SPAN> null<SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">{</SPAN>
Long timestamp <SPAN class="operator token">=</SPAN> <SPAN class="punctuation token">(</SPAN>Long<SPAN class="punctuation token">)</SPAN> feature<SPAN class="punctuation token">.</SPAN><SPAN class="token function">getAttributeValue</SPAN><SPAN class="punctuation token">(</SPAN>attribute<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
age <SPAN class="operator token">=</SPAN> <SPAN class="token function">getDiffYears</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="keyword token">new</SPAN> <SPAN class="token class-name">Date</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="keyword token">new</SPAN> <SPAN class="token class-name">Date</SPAN><SPAN class="punctuation token">(</SPAN>timestamp<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="punctuation token">}</SPAN>
Color color <SPAN class="operator token">=</SPAN> ageToColorMap<SPAN class="punctuation token">.</SPAN><SPAN class="token function">floorEntry</SPAN><SPAN class="punctuation token">(</SPAN>age<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">.</SPAN><SPAN class="token function">getValue</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">switch</SPAN> <SPAN class="punctuation token">(</SPAN>geometryType<SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">{</SPAN>
<SPAN class="keyword token">case</SPAN> POLYLINE<SPAN class="operator token">:</SPAN>
<SPAN class="keyword token">case</SPAN> LINE<SPAN class="operator token">:</SPAN>
<SPAN class="keyword token">return</SPAN> <SPAN class="keyword token">new</SPAN> <SPAN class="token class-name">SimpleLineSymbol</SPAN><SPAN class="punctuation token">(</SPAN>color<SPAN class="punctuation token">,</SPAN> <SPAN class="number token">2</SPAN><SPAN class="punctuation token">,</SPAN> SimpleLineSymbol<SPAN class="punctuation token">.</SPAN>Style<SPAN class="punctuation token">.</SPAN>SOLID<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">case</SPAN> POLYGON<SPAN class="operator token">:</SPAN>
<SPAN class="keyword token">case</SPAN> ENVELOPE<SPAN class="operator token">:</SPAN>
<SPAN class="keyword token">return</SPAN> <SPAN class="keyword token">new</SPAN> <SPAN class="token class-name">SimpleFillSymbol</SPAN><SPAN class="punctuation token">(</SPAN>color<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">case</SPAN> MULTIPOINT<SPAN class="operator token">:</SPAN>
<SPAN class="keyword token">case</SPAN> POINT<SPAN class="operator token">:</SPAN>
<SPAN class="keyword token">default</SPAN><SPAN class="operator token">:</SPAN>
<SPAN class="keyword token">return</SPAN> <SPAN class="keyword token">new</SPAN> <SPAN class="token class-name">SimpleMarkerSymbol</SPAN><SPAN class="punctuation token">(</SPAN>color<SPAN class="punctuation token">,</SPAN> <SPAN class="number token">5</SPAN><SPAN class="punctuation token">,</SPAN> SimpleMarkerSymbol<SPAN class="punctuation token">.</SPAN>Style<SPAN class="punctuation token">.</SPAN>CIRCLE<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="punctuation token">}</SPAN>
<SPAN class="punctuation token">}</SPAN>
<SPAN class="keyword token">public</SPAN> <SPAN class="keyword token">static</SPAN> <SPAN class="keyword token">int</SPAN> <SPAN class="token function">getDiffYears</SPAN><SPAN class="punctuation token">(</SPAN>Date end<SPAN class="punctuation token">,</SPAN> Date start<SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">{</SPAN>
Calendar c_start <SPAN class="operator token">=</SPAN> <SPAN class="token function">getCalendar</SPAN><SPAN class="punctuation token">(</SPAN>start<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
Calendar c_end <SPAN class="operator token">=</SPAN> <SPAN class="token function">getCalendar</SPAN><SPAN class="punctuation token">(</SPAN>end<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">int</SPAN> diff <SPAN class="operator token">=</SPAN> c_end<SPAN class="punctuation token">.</SPAN><SPAN class="token function">get</SPAN><SPAN class="punctuation token">(</SPAN>Calendar<SPAN class="punctuation token">.</SPAN>YEAR<SPAN class="punctuation token">)</SPAN> <SPAN class="operator token">-</SPAN> c_start<SPAN class="punctuation token">.</SPAN><SPAN class="token function">get</SPAN><SPAN class="punctuation token">(</SPAN>Calendar<SPAN class="punctuation token">.</SPAN>YEAR<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">if</SPAN> <SPAN class="punctuation token">(</SPAN>c_start<SPAN class="punctuation token">.</SPAN><SPAN class="token function">get</SPAN><SPAN class="punctuation token">(</SPAN>Calendar<SPAN class="punctuation token">.</SPAN>MONTH<SPAN class="punctuation token">)</SPAN> <SPAN class="operator token">></SPAN> c_end<SPAN class="punctuation token">.</SPAN><SPAN class="token function">get</SPAN><SPAN class="punctuation token">(</SPAN>Calendar<SPAN class="punctuation token">.</SPAN>MONTH<SPAN class="punctuation token">)</SPAN>
<SPAN class="operator token">||</SPAN> <SPAN class="punctuation token">(</SPAN>c_start<SPAN class="punctuation token">.</SPAN><SPAN class="token function">get</SPAN><SPAN class="punctuation token">(</SPAN>Calendar<SPAN class="punctuation token">.</SPAN>MONTH<SPAN class="punctuation token">)</SPAN> <SPAN class="operator token">==</SPAN> c_end<SPAN class="punctuation token">.</SPAN><SPAN class="token function">get</SPAN><SPAN class="punctuation token">(</SPAN>Calendar<SPAN class="punctuation token">.</SPAN>MONTH<SPAN class="punctuation token">)</SPAN> <SPAN class="operator token">&&</SPAN> c_start<SPAN class="punctuation token">.</SPAN><SPAN class="token function">get</SPAN><SPAN class="punctuation token">(</SPAN>Calendar<SPAN class="punctuation token">.</SPAN>DATE<SPAN class="punctuation token">)</SPAN> <SPAN class="operator token">></SPAN> c_end<SPAN class="punctuation token">.</SPAN><SPAN class="token function">get</SPAN><SPAN class="punctuation token">(</SPAN>Calendar<SPAN class="punctuation token">.</SPAN>DATE<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">{</SPAN>
diff<SPAN class="operator token">--</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="punctuation token">}</SPAN>
<SPAN class="keyword token">return</SPAN> diff<SPAN class="punctuation token">;</SPAN>
<SPAN class="punctuation token">}</SPAN>
<SPAN class="punctuation token">}</SPAN>
<SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
I'm adding my renderer as following.
<SPAN class="keyword token">final</SPAN> GeodatabaseFeatureServiceTable fsTable <SPAN class="operator token">=</SPAN> <SPAN class="keyword token">new</SPAN> <SPAN class="token class-name">GeodatabaseFeatureServiceTable</SPAN><SPAN class="punctuation token">(</SPAN>layerData<SPAN class="punctuation token">.</SPAN><SPAN class="token function">getFullUrl</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">,</SPAN> arcgisSdkConfigurator<SPAN class="punctuation token">.</SPAN><SPAN class="token function">getUserCredentials</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">,</SPAN> layerData<SPAN class="punctuation token">.</SPAN><SPAN class="token function">getLayerIndex</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
fsTable<SPAN class="punctuation token">.</SPAN><SPAN class="token function">initialize</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="keyword token">new</SPAN> <SPAN class="token class-name">CallbackListener</SPAN><SPAN class="operator token"><</SPAN>GeodatabaseFeatureServiceTable<SPAN class="punctuation token">.</SPAN>Status<SPAN class="operator token">></SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">{</SPAN>
@Override
<SPAN class="keyword token">public</SPAN> <SPAN class="keyword token">void</SPAN> <SPAN class="token function">onCallback</SPAN><SPAN class="punctuation token">(</SPAN>GeodatabaseFeatureServiceTable<SPAN class="punctuation token">.</SPAN>Status status<SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">{</SPAN>
<SPAN class="keyword token">if</SPAN> <SPAN class="punctuation token">(</SPAN>status <SPAN class="operator token">==</SPAN> GeodatabaseFeatureServiceTable<SPAN class="punctuation token">.</SPAN>Status<SPAN class="punctuation token">.</SPAN>INITIALIZED<SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">{</SPAN>
<SPAN class="comment token">// prepare out fields</SPAN>
List<SPAN class="operator token"><</SPAN>String<SPAN class="operator token">></SPAN> attributeList <SPAN class="operator token">=</SPAN> AstFeatureNameUtil<SPAN class="punctuation token">.</SPAN><SPAN class="token function">extractAttributeList</SPAN><SPAN class="punctuation token">(</SPAN>layerData<SPAN class="punctuation token">.</SPAN><SPAN class="token function">getIdentifierPattern</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
attributeList<SPAN class="punctuation token">.</SPAN><SPAN class="token function">add</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="string token">"InstallationDate"</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
String<SPAN class="punctuation token">[</SPAN><SPAN class="punctuation token">]</SPAN> attributes <SPAN class="operator token">=</SPAN> <SPAN class="keyword token">new</SPAN> <SPAN class="token class-name">String</SPAN><SPAN class="punctuation token">[</SPAN>attributeList<SPAN class="punctuation token">.</SPAN><SPAN class="token function">size</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">;</SPAN>
attributeList<SPAN class="punctuation token">.</SPAN><SPAN class="token function">toArray</SPAN><SPAN class="punctuation token">(</SPAN>attributes<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
fsTable<SPAN class="punctuation token">.</SPAN><SPAN class="token function">setOutFields</SPAN><SPAN class="punctuation token">(</SPAN>attributes<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">final</SPAN> FeatureLayer featureLayer <SPAN class="operator token">=</SPAN> <SPAN class="keyword token">new</SPAN> <SPAN class="token class-name">FeatureLayer</SPAN><SPAN class="punctuation token">(</SPAN>fsTable<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
featureLayer<SPAN class="punctuation token">.</SPAN><SPAN class="token function">initializeAsync</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="comment token">// need?</SPAN>
featureLayer<SPAN class="punctuation token">.</SPAN><SPAN class="token function">addLayerInitializeCompleteListener</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="keyword token">new</SPAN> <SPAN class="token class-name">LayerInitializeCompleteListener</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">{</SPAN>
@Override
<SPAN class="keyword token">public</SPAN> <SPAN class="keyword token">void</SPAN> <SPAN class="token function">layerInitializeComplete</SPAN><SPAN class="punctuation token">(</SPAN>LayerInitializeCompleteEvent lice<SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">{</SPAN>
<SPAN class="comment token">//LOGGER.log(Level.INFO, "Found features: {0} - {1}", new Object[]{layerData.getLayerId(), fsTable.getNumberOfFeatures()});</SPAN>
<SPAN class="comment token">//LOGGER.log(Level.INFO, "Layer initialized: {0}", lice.getID());</SPAN>
DeviceAgingRenderer renderer <SPAN class="operator token">=</SPAN> <SPAN class="keyword token">new</SPAN> <SPAN class="token class-name">DeviceAgingRenderer</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="string token">"InstallationDate"</SPAN><SPAN class="punctuation token">,</SPAN> featureLayer<SPAN class="punctuation token">.</SPAN><SPAN class="token function">getGeometryType</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="comment token">//LOGGER.log(Level.INFO, "Renderer: {0}", renderer);</SPAN>
featureLayer<SPAN class="punctuation token">.</SPAN><SPAN class="token function">setRenderer</SPAN><SPAN class="punctuation token">(</SPAN>renderer<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
jMap<SPAN class="punctuation token">.</SPAN><SPAN class="token function">getLayers</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">.</SPAN><SPAN class="token function">add</SPAN><SPAN class="punctuation token">(</SPAN>featureLayer<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
jMap<SPAN class="punctuation token">.</SPAN><SPAN class="token function">addMapOverlay</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="keyword token">new</SPAN> <SPAN class="token class-name">DeviceAgingFeatureMapOverlay</SPAN><SPAN class="punctuation token">(</SPAN>jMap<SPAN class="punctuation token">,</SPAN> featureLayer<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
jLayerTree<SPAN class="punctuation token">.</SPAN><SPAN class="token function">refresh</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="punctuation token">}</SPAN>
<SPAN class="punctuation token">}</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="punctuation token">}</SPAN>
<SPAN class="punctuation token">}</SPAN>
@Override
<SPAN class="keyword token">public</SPAN> <SPAN class="keyword token">void</SPAN> <SPAN class="token function">onError</SPAN><SPAN class="punctuation token">(</SPAN>Throwable e<SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">{</SPAN>
LOGGER<SPAN class="punctuation token">.</SPAN><SPAN class="token function">log</SPAN><SPAN class="punctuation token">(</SPAN>Level<SPAN class="punctuation token">.</SPAN>SEVERE<SPAN class="punctuation token">,</SPAN> null<SPAN class="punctuation token">,</SPAN> e<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="token function">makeBusy</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="token boolean">false</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="punctuation token">}</SPAN>
<SPAN class="punctuation token">}</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>