use of com.sldeditor.ui.iface.UpdateSymbolInterface in project sldeditor by robward-scisys.
the class ExpressionSubPanel method displayExpression.
/**
* Display expression.
*
* @param node the node
*/
private void displayExpression(ExpressionNode node) {
if (panelLiteral.getComponentCount() == 2) {
panelLiteral.remove(1);
}
if (node == null) {
return;
}
fieldConfig = PanelField.getField(ExpressionPanelv2.class, "ExpressionSubPanel.value", node.getType());
if (fieldConfig != null) {
fieldConfig.createUI();
fieldConfig.addDataChangedListener(new UpdateSymbolInterface() {
@Override
public void dataChanged(FieldIdEnum changedField) {
buttonGroup.setSelected(rdbtnLiteral.getModel(), true);
updateButtonState(true);
}
});
panelLiteral.add(fieldConfig.getPanel());
// Reset the fields
dataSourceAttributePanel.setAttribute(null);
functionPanel.setFunction(null);
dataSourceAttributePanel.setDataType(node.getType());
Expression expression = node.getExpression();
if (expression instanceof AttributeExpressionImpl) {
dataSourceAttributePanel.setAttribute(expression);
buttonGroup.setSelected(rdbtnAttribute.getModel(), true);
} else if (expression instanceof EnvFunction) {
envVarField.setEnvironmentVariable(expression);
buttonGroup.setSelected(rdbtnEnvVar.getModel(), true);
} else if (expression instanceof FunctionExpressionImpl) {
functionPanel.setFunction(expression);
buttonGroup.setSelected(rdbtnFunction.getModel(), true);
} else {
fieldConfig.populate(expression);
buttonGroup.setSelected(rdbtnLiteral.getModel(), true);
}
}
Dimension boxSize = box.getPreferredSize();
setPreferredSize(boxSize);
revalidate();
}
use of com.sldeditor.ui.iface.UpdateSymbolInterface in project sldeditor by robward-scisys.
the class LiteralPanel method displayLiteral.
/**
* Display literal value.
*
* @param node the node
*/
private void displayLiteral(ExpressionNode node) {
if (node == null) {
return;
}
if (fieldConfig != null) {
remove(fieldConfig.getPanel());
}
fieldConfig = PanelField.getField(ExpressionPanelv2.class, "LiteralPanel.value", node.getType());
if (fieldConfig != null) {
fieldConfig.createUI();
fieldConfig.addDataChangedListener(new UpdateSymbolInterface() {
@Override
public void dataChanged(FieldIdEnum changedField) {
updateButtonState(true);
}
});
add(fieldConfig.getPanel(), BorderLayout.NORTH);
fieldConfig.populate(node.getExpression());
}
revalidate();
}
Aggregations