public static String VALUE_ON = "on";
public static String VALUE_OFF = "off";
+ private boolean useDefaultOnCreate = false;
private boolean defaultOnCreate = false;
+ private boolean disableOnCreate = false;
private boolean titleLabelMouseEnable = true;
- private boolean defulatIfEmpty = true;
+ private boolean defaultIfEmpty = true;
public CheckSubViewItem(LabelViewItem parentItem, Composite comp, Item template, boolean isOdd) {
this.parentItem = parentItem;
protected void parseOption(List<Option> optionList) {
for (Option option : optionList) {
if (option.getName().equals(OptionType.DEFAULT_ON_CREATE.getName())) {
+ useDefaultOnCreate = true;
if(option.getValue().equals(VALUE_ON)) {
defaultOnCreate = true;
}
}
if (option.getName().equals(OptionType.DEFAULT_IF_EMPTY.getName())) {
if(option.getValue().equals(VALUE_OFF)) {
- defulatIfEmpty = false;
+ defaultIfEmpty = false;
}
}
+ if (option.getName().equals(OptionType.DISABLE_ON_CREATE.getName())) {
+ disableOnCreate = true;
+ }
}
}
ImageResources.CHECKBOX_OFF.getImage(), // off normal
ImageResources.CHECKBOX_OFF.getImage(),
ImageResources.CHECKBOX_OFF.getImage(),
-// ImageResources.CHECKBOX_OFF.getImage()); // disable
+// ImageResources.CHECKBOX_OFF_DIS.getImage(), // disable
ImageResources.CHECKBOX_ON_DIS.getImage()); // disable
modifyCheckBox.addSelectionListener(new SelectionListener() {
@Override
public boolean settingModifyItem(VMPropertyValue value) {
- if (parentItem.isCreateMode() && defaultOnCreate) {
- newValue = oldValue = true;
- modifyCheckBox.setSelection(false);
+
+ // Set value.
+ if (parentItem.isCreateMode() && useDefaultOnCreate) {
+ newValue = oldValue = defaultOnCreate;
+ } else {
+ String onOffVal = value.getAdvancedOptionSubValue(parentItem.getName(), name).toLowerCase();
+ newValue = oldValue = checkOnOff(onOffVal);
+ }
+
+ // Set enable/disable
+ if (parentItem.isCreateMode() && disableOnCreate) {
modifyCheckBox.setEnabled(false);
titleLabelMouseEnable = false;
- return false;
- }
- modifyCheckBox.setEnabled(true);
- String onOffVal = value.getAdvancedOptionSubValue(parentItem.getName(), name).toLowerCase();
- if (checkOnOff(onOffVal)) {
- newValue = oldValue = true;
- modifyCheckBox.setSelection(false);
} else {
- newValue = oldValue = false;
- modifyCheckBox.setSelection(true);
+ modifyCheckBox.setEnabled(true);
+ titleLabelMouseEnable = true;
}
- titleLabelMouseEnable = true;
+
+ // Set checkbox state.
+ modifyCheckBox.setSelection( newValue ? false : true); // false is checked.
return false;
}
} else if (onOffVal.equals(VALUE_OFF)) {
return false;
} else if (onOffVal.isEmpty()){
- return defulatIfEmpty;
+ return defaultIfEmpty;
} else {
return false;
}