use of com.sldeditor.ui.detail.config.base.CurrentFieldState in project sldeditor by robward-scisys.
the class CurrentFieldStateTest method testGetFieldEnabledState.
/**
* Test method for {@link com.sldeditor.ui.detail.config.base.CurrentFieldState#getFieldEnabledState()}.
*/
@Test
public void testGetFieldEnabledState() {
CurrentFieldState obj = new CurrentFieldState();
assertTrue(obj.isGroupEnabled());
assertTrue(obj.isGroupSelected());
assertTrue(obj.isFieldEnabled());
// Test group enabled
obj.setGroupEnabled(false);
obj.setGroupSelected(false);
obj.setFieldEnabled(false);
assertFalse(obj.getFieldEnabledState());
obj.setGroupEnabled(true);
obj.setGroupSelected(false);
obj.setFieldEnabled(false);
assertFalse(obj.getFieldEnabledState());
// Group selected
obj.setGroupSelected(false);
obj.setFieldEnabled(true);
assertFalse(obj.getFieldEnabledState());
obj.setGroupSelected(true);
assertTrue(obj.getFieldEnabledState());
obj.setFieldEnabled(false);
assertFalse(obj.getFieldEnabledState());
}
use of com.sldeditor.ui.detail.config.base.CurrentFieldState in project sldeditor by robward-scisys.
the class PolygonFillDetails 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());
}
}
}
Aggregations