use of com.sldeditor.filter.v2.function.namefilter.FunctionNameFilterRaster in project sldeditor by robward-scisys.
the class FunctionField method setDataType.
/**
* Sets the field data types.
*
* @param fieldType the new data type
* @param isRasterSymbol the is raster symbol
*/
public void setDataType(Class<?> fieldType, boolean isRasterSymbol) {
functionNameMap.clear();
List<FunctionNameFilterInterface> functionNameFilterList = new ArrayList<FunctionNameFilterInterface>();
if (isRasterSymbol) {
functionNameFilterList.add(new FunctionNameFilterRaster());
} else {
functionNameFilterList.add(new FunctionNameFilterAll());
}
List<FunctionName> functionNameList = functionNameMgr.getFunctionNameList(fieldType, functionNameFilterList);
for (FunctionName functionName : functionNameList) {
String functionNameString = functionName.getName();
functionNameMap.put(functionNameString, functionName);
}
populateFunctionComboBox();
}
use of com.sldeditor.filter.v2.function.namefilter.FunctionNameFilterRaster in project sldeditor by robward-scisys.
the class FunctionManagerTest method testGetFunctionNameList2.
/**
* Test method for
* {@link com.sldeditor.filter.v2.function.FunctionManager#getFunctionNameList(java.lang.Class)}.
* Testing FunctionNameFilterRaster
*/
@Test
public void testGetFunctionNameList2() {
Class<?> returnType = FunctionManager.getInstance().getFunctionType(null);
assertNull(returnType);
List<FunctionName> functionNameList = FunctionManager.getInstance().getFunctionNameList(Object.class, null);
FunctionName propertyFunction = null;
FunctionName idFunction = null;
FunctionName areaFunction = null;
FunctionName ceilFunction = null;
for (FunctionName functionName : functionNameList) {
if (functionName.getName().compareTo("property") == 0) {
propertyFunction = functionName;
} else if (functionName.getName().compareTo("id") == 0) {
idFunction = functionName;
} else if (functionName.getName().compareTo("Area") == 0) {
areaFunction = functionName;
} else if (functionName.getName().compareTo("ceil") == 0) {
ceilFunction = functionName;
}
}
assertNotNull(propertyFunction);
assertNotNull(areaFunction);
assertNotNull(ceilFunction);
assertNotNull(idFunction);
List<FunctionNameFilterInterface> functionNameFilterList = new ArrayList<FunctionNameFilterInterface>();
FunctionNameFilterRaster rasterFilter = new FunctionNameFilterRaster();
rasterFilter.accept(null);
functionNameFilterList.add(rasterFilter);
List<FunctionName> rasterFunctionNameList = FunctionManager.getInstance().getFunctionNameList(Object.class, functionNameFilterList);
assertFalse(rasterFunctionNameList.contains(propertyFunction));
assertFalse(rasterFunctionNameList.contains(areaFunction));
assertFalse(rasterFunctionNameList.contains(idFunction));
assertTrue(rasterFunctionNameList.contains(ceilFunction));
}
Aggregations