use of com.scriptographer.adm.ToggleItem in project scriptographer by scriptographer.
the class AdmComponentProxy method getValue.
public Object getValue() {
if (item == null)
return component.getDefaultValue();
switch(component.getType()) {
case STRING:
case TEXT:
return ((TextValueItem) item).getText();
case BUTTON:
return ((Button) item).getText();
case NUMBER:
return ((ValueItem) item).getValue();
case SLIDER:
double value = ((ValueItem) item).getValue() / factor;
Double inc = component.getIncrement();
if (inc != null) {
double pre = value;
value = Math.round(value / inc) * inc;
if (pre != value)
((ValueItem) item).setValue((float) (value * factor));
}
return value;
case BOOLEAN:
return ((ToggleItem) item).isChecked();
case LIST:
ListEntry selected = ((PopupList) item).getSelectedEntry();
if (selected != null)
return component.getOption(selected.getIndex());
break;
case COLOR:
return ((ColorButton) item).getColor();
case FONT:
return ((FontPopupList) item).getFontWeight();
}
return null;
}
Aggregations