use of com.sldeditor.ui.detail.config.FieldConfigBase in project sldeditor by robward-scisys.
the class GraphicPanelFieldManager method getData.
/**
* Gets the data.
*
* @param requestedPanelId the requested panel id
* @param requestedField the requested field
* @return the data
*/
public FieldConfigBase getData(Class<?> requestedPanelId, FieldIdEnum requestedField) {
FieldConfigBase retVal = null;
Map<FieldIdEnum, FieldConfigBase> panelMap = fieldConfigMap.get(requestedPanelId);
if (panelMap != null) {
retVal = panelMap.get(requestedField);
}
return retVal;
}
use of com.sldeditor.ui.detail.config.FieldConfigBase 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.FieldConfigBase in project sldeditor by robward-scisys.
the class PointFillDetails method optionSelected.
/**
* Option selected.
*
* @param fieldPanelId the field panel id
* @param selectedItem the selected item
*/
@Override
public void optionSelected(Class<?> fieldPanelId, String selectedItem) {
setSymbolTypeVisibility(fieldPanelId, selectedItem);
selectedFillPanelId = fieldPanelId;
FieldConfigBase fieldConfig = fieldConfigManager.get(FieldIdEnum.SIZE);
if (fieldConfig.isEnabled()) {
Expression expression = fieldConfig.getExpression();
if (expression instanceof LiteralExpressionImpl) {
LiteralExpressionImpl l = (LiteralExpressionImpl) expression;
Double d = (Double) l.getValue();
if (d <= 0.0) {
fieldConfigVisitor.populateField(FieldIdEnum.SIZE, getFilterFactory().literal(1));
}
}
}
dataHasChanged();
}
use of com.sldeditor.ui.detail.config.FieldConfigBase in project sldeditor by robward-scisys.
the class RuleDetails method createFilter.
/**
* Creates the filter.
*
* @return the j panel
*/
private void createFilter() {
FieldIdEnum filterFieldId = FieldIdEnum.FILTER;
FieldConfigBase fieldConfig = fieldConfigManager.get(filterFieldId);
if (fieldConfig != null) {
FieldPanel fieldPanel = fieldConfig.getPanel();
JButton btnEditFilter = new JButton(Localisation.getString(RuleDetails.class, "RuleDetails.edit"));
btnEditFilter.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
editFilter(filterFieldId);
}
});
btnEditFilter.setBounds(WIDGET_X_START + WIDGET_EXTENDED_WIDTH, 0, WIDGET_BUTTON_WIDTH, WIDGET_HEIGHT);
fieldPanel.add(btnEditFilter);
JButton btnClearFilter = new JButton(Localisation.getString(RuleDetails.class, "RuleDetails.clear"));
btnClearFilter.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
clearFilter(filterFieldId);
}
});
int x = btnEditFilter.getX() + btnEditFilter.getWidth() + 5;
btnClearFilter.setBounds(x, 0, WIDGET_BUTTON_WIDTH, WIDGET_HEIGHT);
fieldPanel.add(btnClearFilter);
}
}
use of com.sldeditor.ui.detail.config.FieldConfigBase in project sldeditor by robward-scisys.
the class StandardPanel method getStandardData.
/**
* Gets the standard data.
*
* @return the standard data
*/
protected StandardData getStandardData() {
StandardData standardData = new StandardData();
if (fieldConfigVisitor.getFieldConfig(FieldIdEnum.NAME) != null) {
standardData.name = fieldConfigVisitor.getText(FieldIdEnum.NAME);
}
if ((fieldConfigVisitor.getFieldConfig(FieldIdEnum.TITLE) != null) && (fieldConfigVisitor.getFieldConfig(FieldIdEnum.DESCRIPTION) != null)) {
InternationalString titleString = Text.text(fieldConfigVisitor.getText(FieldIdEnum.TITLE));
InternationalString descriptionString = Text.text(fieldConfigVisitor.getText(FieldIdEnum.DESCRIPTION));
standardData.description = (Description) getStyleFactory().description(titleString, descriptionString);
}
FieldConfigBase uomFieldConfig = fieldConfigManager.get(FieldIdEnum.UOM);
if (uomFieldConfig != null) {
Expression uomExpression = fieldConfigVisitor.getExpression(FieldIdEnum.UOM);
String uomString = "";
if (uomExpression instanceof LiteralExpressionImpl) {
uomString = (String) ((LiteralExpressionImpl) uomExpression).getValue();
} else {
if (uomExpression != null) {
ConsoleManager.getInstance().error(this, Localisation.getString(StandardPanel.class, "StandardPanel.unsupportedUOM") + uomExpression.getClass().getName());
}
}
standardData.unit = UnitsOfMeasure.getInstance().convert(uomString);
}
return standardData;
}
Aggregations