diff options
Diffstat (limited to 'src/com/itmill/toolkit/ui/AbstractComponent.java')
-rw-r--r-- | src/com/itmill/toolkit/ui/AbstractComponent.java | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/src/com/itmill/toolkit/ui/AbstractComponent.java b/src/com/itmill/toolkit/ui/AbstractComponent.java index 634f58dbac..0aa9d74fdf 100644 --- a/src/com/itmill/toolkit/ui/AbstractComponent.java +++ b/src/com/itmill/toolkit/ui/AbstractComponent.java @@ -58,11 +58,16 @@ public abstract class AbstractComponent implements Component, MethodEventSource private Resource icon; /** - * Is the component enable (its normal usage is allowed). + * Is the component enabled (its normal usage is allowed). */ private boolean enabled = true; /** + * Has the component been disabled by the container + */ + private boolean disabledByContainer = false; + + /** * Is the component visible (it is rendered). */ private boolean visible = true; @@ -306,7 +311,7 @@ public abstract class AbstractComponent implements Component, MethodEventSource * here, we use the default documentation from implemented interface. */ public boolean isEnabled() { - return enabled && isVisible(); + return enabled && !disabledByContainer && isVisible(); } /* @@ -320,6 +325,21 @@ public abstract class AbstractComponent implements Component, MethodEventSource } } + /** + * Enable or disable the component by the container. Normally used to + * disable the component when the container is disabled without altering the + * actual enabled state of the component. + * + * @param disabledByContainer + * Should the component be disabled + */ + public void setDisabledByContainer(boolean disabledByContainer) { + if (disabledByContainer != this.disabledByContainer) { + this.disabledByContainer = disabledByContainer; + requestRepaint(); + } + } + /* * Tests if the component is in the immediate mode. Don't add a JavaDoc * comment here, we use the default documentation from implemented |