use of com.sldeditor.ui.detail.config.base.GroupConfigInterface in project sldeditor by robward-scisys.
the class GraphicPanelFieldManager method add.
/**
* Adds an existing GraphicPanelFieldManager to this one.
*
* @param fieldConfigManager the field config manager
*/
public void add(GraphicPanelFieldManager fieldConfigManager) {
if (fieldConfigManager != null) {
Map<FieldIdEnum, FieldConfigBase> componentMapToAdd = fieldConfigManager.fieldConfigMap.get(fieldConfigManager.panelId);
Map<FieldIdEnum, FieldConfigBase> componentMap = this.fieldConfigMap.get(fieldConfigManager.panelId);
if (componentMap == null) {
Map<FieldIdEnum, FieldConfigBase> value = fieldConfigManager.fieldConfigMap.get(fieldConfigManager.panelId);
this.fieldConfigMap.put(fieldConfigManager.panelId, value);
} else {
for (FieldIdEnum fieldId : componentMapToAdd.keySet()) {
FieldConfigBase dataToAdd = componentMapToAdd.get(fieldId);
componentMap.put(fieldId, dataToAdd);
}
}
// Add groups
Map<GroupIdEnum, GroupConfigInterface> groupMapToAdd = fieldConfigManager.groupMap.get(fieldConfigManager.panelId);
Map<GroupIdEnum, GroupConfigInterface> thisGroupMap = this.groupMap.get(fieldConfigManager.panelId);
if (thisGroupMap == null) {
Map<GroupIdEnum, GroupConfigInterface> value = fieldConfigManager.groupMap.get(fieldConfigManager.panelId);
this.groupMap.put(fieldConfigManager.panelId, value);
} else {
for (GroupIdEnum groupId : groupMapToAdd.keySet()) {
GroupConfigInterface dataToAdd = groupMapToAdd.get(groupId);
thisGroupMap.put(groupId, dataToAdd);
}
}
}
}
use of com.sldeditor.ui.detail.config.base.GroupConfigInterface in project sldeditor by robward-scisys.
the class PointFillDetails method setSymbolTypeVisibility.
/**
* Sets the symbol type visibility.
*
* @param panelId the panel id
* @param selectedItem the selected item
*/
private void setSymbolTypeVisibility(Class<?> panelId, String selectedItem) {
Map<GroupIdEnum, Boolean> groupList = fieldEnableState.getGroupIdList(panelId.getName(), selectedItem);
for (GroupIdEnum groupId : groupList.keySet()) {
boolean groupEnabled = groupList.get(groupId);
GroupConfigInterface groupConfig = fieldConfigManager.getGroup(this.getClass(), groupId);
if (groupConfig != null) {
groupConfig.setGroupStateOverride(groupEnabled);
} else {
ConsoleManager.getInstance().error(this, "Failed to find group : " + groupId.toString());
}
}
Map<FieldIdEnum, Boolean> fieldList = fieldEnableState.getFieldIdList(panelId.getName(), selectedItem);
for (FieldIdEnum fieldId : fieldList.keySet()) {
boolean fieldEnabled = fieldList.get(fieldId);
FieldConfigBase fieldConfig = fieldConfigManager.get(fieldId);
if (fieldConfig != null) {
CurrentFieldState fieldState = fieldConfig.getFieldState();
fieldState.setFieldEnabled(fieldEnabled);
fieldConfig.setFieldState(fieldState);
} else {
ConsoleManager.getInstance().error(this, "Failed to find field : " + fieldId.toString());
}
}
}
use of com.sldeditor.ui.detail.config.base.GroupConfigInterface in project sldeditor by robward-scisys.
the class PolygonFillDetails method getGraphicFill.
/**
* Gets the graphic fill.
*
* @return the graphic fill
*/
private GraphicFill getGraphicFill() {
GroupConfigInterface fillGroup = getGroup(GroupIdEnum.FILL);
boolean hasFill = fillGroup.isPanelEnabled();
GroupConfigInterface strokeGroup = getGroup(GroupIdEnum.STROKE);
boolean hasStroke = (strokeGroup == null) ? false : strokeGroup.isPanelEnabled();
Expression opacity = null;
Expression size = fieldConfigVisitor.getExpression(FieldIdEnum.SIZE);
Expression rotation = fieldConfigVisitor.getExpression(FieldIdEnum.ANGLE);
Expression symbolType = fieldConfigVisitor.getExpression(FieldIdEnum.SYMBOL_TYPE);
//
// Anchor point
//
AnchorPoint anchorPoint = null;
GroupConfigInterface anchorPointPanel = getGroup(GroupIdEnum.ANCHORPOINT);
if (anchorPointPanel.isPanelEnabled()) {
anchorPoint = (AnchorPoint) getStyleFactory().anchorPoint(fieldConfigVisitor.getExpression(FieldIdEnum.ANCHOR_POINT_H), fieldConfigVisitor.getExpression(FieldIdEnum.ANCHOR_POINT_V));
// default so it doesn't appear in the SLD
if (DetailsUtilities.isSame(defaultAnchorPoint, anchorPoint)) {
anchorPoint = null;
}
}
//
// Displacement
//
Displacement displacement = null;
GroupConfigInterface displacementPanel = getGroup(GroupIdEnum.DISPLACEMENT);
if (displacementPanel.isPanelEnabled()) {
displacement = getStyleFactory().displacement(fieldConfigVisitor.getExpression(FieldIdEnum.DISPLACEMENT_X), fieldConfigVisitor.getExpression(FieldIdEnum.DISPLACEMENT_Y));
// it doesn't appear in the SLD
if (DetailsUtilities.isSame(defaultDisplacement, displacement)) {
displacement = null;
}
}
List<GraphicalSymbol> symbols = symbolTypeFactory.getValue(this.fieldConfigManager, symbolType, hasFill, hasStroke, selectedFillPanelId);
GraphicFill graphicFill = getStyleFactory().graphicFill(symbols, opacity, size, rotation, anchorPoint, displacement);
return graphicFill;
}
use of com.sldeditor.ui.detail.config.base.GroupConfigInterface in project sldeditor by robward-scisys.
the class RuleDetails method populateScaleRange.
/**
* Populate scale range.
*
* @param enabled the enabled
*/
private void populateScaleRange(boolean enabled) {
GroupConfigInterface group = getGroup(GroupIdEnum.SCALE);
group.enable(enabled);
}
use of com.sldeditor.ui.detail.config.base.GroupConfigInterface in project sldeditor by robward-scisys.
the class ReadPanelConfig method read.
/**
* Read configuration file and store the configuration in the object.
*
* @param panelId the panel id
* @param resourceString the resource string
* @return true, if successful
*/
public boolean read(Class<?> panelId, String resourceString) {
groupList = new ArrayList<GroupConfigInterface>();
PanelConfig panelConfig = (PanelConfig) ParseXML.parseUIFile(resourceString, SCHEMA_RESOURCE, PanelConfig.class);
if (panelConfig == null) {
return false;
}
Class<?> localisationClass = ReadPanelConfig.class;
if (panelConfig.getLocalisation() != null) {
try {
localisationClass = Class.forName(panelConfig.getLocalisation());
} catch (ClassNotFoundException e) {
ConsoleManager.getInstance().exception(ReadPanelConfig.class, e);
}
}
panelTitle = getLocalisedText(localisationClass, panelConfig.getPanelTitle());
vendorOptionVersion = getVendorOptionVersion(panelConfig);
for (Object groupObj : panelConfig.getGroupOrMultiOptionGroup()) {
if (groupObj instanceof XMLGroupConfig) {
GroupConfig groupConfig = parseGroup(localisationClass, panelId, (XMLGroupConfig) groupObj);
groupList.add(groupConfig);
} else if (groupObj instanceof XMLMultiOptionGroup) {
MultiOptionGroup groupConfig = parseMultiOptionGroup(localisationClass, panelId, (XMLMultiOptionGroup) groupObj);
groupList.add(groupConfig);
}
}
return true;
}
Aggregations