Search in sources :

Example 6 with CurrentFieldState

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());
}
Also used : CurrentFieldState(com.sldeditor.ui.detail.config.base.CurrentFieldState) Test(org.junit.Test)

Example 7 with CurrentFieldState

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());
        }
    }
}
Also used : FieldConfigBase(com.sldeditor.ui.detail.config.FieldConfigBase) CurrentFieldState(com.sldeditor.ui.detail.config.base.CurrentFieldState) GroupConfigInterface(com.sldeditor.ui.detail.config.base.GroupConfigInterface) FieldIdEnum(com.sldeditor.common.xml.ui.FieldIdEnum) GroupIdEnum(com.sldeditor.common.xml.ui.GroupIdEnum)

Aggregations

CurrentFieldState (com.sldeditor.ui.detail.config.base.CurrentFieldState)7 FieldConfigBase (com.sldeditor.ui.detail.config.FieldConfigBase)5 FieldIdEnum (com.sldeditor.common.xml.ui.FieldIdEnum)4 GroupIdEnum (com.sldeditor.common.xml.ui.GroupIdEnum)4 GroupConfigInterface (com.sldeditor.ui.detail.config.base.GroupConfigInterface)4 Test (org.junit.Test)1