import eu.etaxonomy.taxeditor.model.ImageResources;
import eu.etaxonomy.taxeditor.preference.Resources;
import eu.etaxonomy.taxeditor.store.StoreUtil;
-import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
/**
* When the button is pressed, this textfield may be edited.
private final Text text_cache;
private final Button button_toggle;
-
private boolean state;
private final Set<SelectionListener> selectionListener = new HashSet<SelectionListener>();
private final Label label;
private final Composite container;
+ //TODO for RL
+ public void setVisible(boolean b) {
+ text_cache.setVisible(b);
+ button_toggle.setVisible(b);
+ label.setVisible(b);
+ container.setVisible(b);
+ }
+
+
/**
* <p>Constructor for ToggleableTextElement.</p>
*
*
* @param state a boolean.
*/
- public void setState(boolean state) {
+ private void setState(boolean state) {
if(state){
button_toggle.setImage(ImageResources.getImage(ImageResources.LOCK_OPEN_ICON));
}
else{
button_toggle.setImage(ImageResources.getImage(ImageResources.LOCK_ICON));
}
+ text_cache.setEnabled(state);
this.state = state;
- setEnabled(state);
}
/** {@inheritDoc} */
@Override
public void setEnabled(boolean enabled) {
text_cache.setEnabled(enabled);
+ button_toggle.setEnabled(enabled);
+ button_toggle.setGrayed(enabled);
+ button_toggle.setSelection(enabled);
String symbolicName = enabled ? Resources.COLOR_FONT_DEFAULT : Resources.COLOR_TEXT_DISABLED;
text_cache.setForeground(StoreUtil.getColor(symbolicName));
- button_toggle.setSelection(enabled);
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.ui.element.IEnableableFormElement#isEnabled()
+ */
+ @Override
+ public boolean isEnabled() {
+ return text_cache.isEnabled();
}
/**