Revision 44985 trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.symbology/org.gvsig.symbology.lib/org.gvsig.symbology.lib.impl/src/main/java/org/gvsig/symbology/fmap/mapcontext/rendering/legend/impl/VectorialUniqueValueLegend.java
VectorialUniqueValueLegend.java | ||
---|---|---|
30 | 30 |
import java.util.List; |
31 | 31 |
import java.util.Map; |
32 | 32 |
import java.util.Map.Entry; |
33 |
import java.util.Objects; |
|
33 | 34 |
import java.util.TreeMap; |
34 | 35 |
import java.util.logging.Level; |
35 | 36 |
import org.apache.commons.lang3.ObjectUtils; |
... | ... | |
129 | 130 |
if (key == null) { |
130 | 131 |
resul = nullValueSymbol; |
131 | 132 |
nullValueSymbol = symbol; |
132 |
} |
|
133 |
else { |
|
133 |
} else { |
|
134 |
int[] dataTypes = this.getClassifyingFieldTypes(); |
|
135 |
if(dataTypes==null){ |
|
136 |
throw new IllegalStateException("Classifying field types must be assigned before adding symbol"); |
|
137 |
} |
|
138 |
try { |
|
139 |
DataTypeUtils.coerce(dataTypes[0], key); |
|
140 |
} catch (CoercionException ex) { |
|
141 |
throw new IllegalArgumentException(""+dataTypes[0]+" type key expected but received "+Objects.toString(key, "NULL"), ex); |
|
142 |
} |
|
134 | 143 |
resul = (ISymbol) symbols.put(key, symbol); |
135 | 144 |
|
136 | 145 |
if (resul != null) { |
137 |
LOG.error("Error: la clave " + key + " ya exist?a. Resul = "
|
|
146 |
LOG.warn("Warning: the " + key + " key already existed. Resul = "
|
|
138 | 147 |
+ resul); |
139 |
LOG.warn("symbol nuevo:" + symbol.getDescription()
|
|
140 |
+ " Sviejo= " + resul.getDescription());
|
|
148 |
LOG.warn("new symbol :" + symbol.getDescription()
|
|
149 |
+ " old symbol = " + resul.getDescription());
|
|
141 | 150 |
} else { |
142 | 151 |
keys.add(key); |
143 | 152 |
} |
... | ... | |
425 | 434 |
new Comparator<Object>() { |
426 | 435 |
public int compare(Object o1, Object o2) { |
427 | 436 |
if (convert.getValue() == null) { |
428 |
convert.setValue(ToolsLocator.getDataTypesManager().getCoercion(getClassifyingFieldTypes()[0])); |
|
437 |
int [] classifyingFieldTypes = getClassifyingFieldTypes(); |
|
438 |
if(classifyingFieldTypes == null){ |
|
439 |
throw new RuntimeException("Symbols are being added to the legend before assigning classifying fields"); |
|
440 |
} |
|
441 |
convert.setValue(ToolsLocator.getDataTypesManager().getCoercion(classifyingFieldTypes[0])); |
|
429 | 442 |
} |
430 | 443 |
try { |
431 | 444 |
return ObjectUtils.compare((Comparable) (convert.getValue().coerce(o1)), (Comparable) (convert.getValue().coerce(o2))); |
Also available in: Unified diff