.i-disabled {
opacity: 0.3;
filter: Alpha(opacity=30);
-}
+}\r
+.i-disabled .i-disabled {\r
+ opacity: 1.0;\r
+}\r
.i-required-field-indicator {
padding-left:2px;
color: red;
opacity: 0.3;
filter: Alpha(opacity=30);
}
+.i-disabled .i-disabled {
+ opacity: 1.0;
+}
.i-required-field-indicator {
padding-left:2px;
color: red;
innerLayout1.setSpacing(true);\r
panel.addComponent(innerLayout1);\r
\r
- innerLayout1.addComponent(new TextField(\r
- "TextField inside orderedLayout"));\r
- innerLayout1.addComponent(new Button("Button inside orderedLayout"));\r
+ TextField tf = new TextField("TextField inside orderedLayout");\r
+ tf.setImmediate(true);\r
+ innerLayout1.addComponent(tf);\r
+ innerLayout1.addComponent(new Button("Button inside orderedLayout",\r
+ new ClickListener() {\r
+\r
+ @Override\r
+ public void buttonClick(ClickEvent event) {\r
+ System.out.println("Clicked "\r
+ + event.getButton().getCaption());\r
+ }\r
+\r
+ }));\r
innerLayout1.addComponent(new Label("Label inside orderedLayout"));\r
\r
panel.addComponent(new Label("Label 2"));\r
\r
GridLayout innerLayout2 = new GridLayout(3, 3);\r
innerLayout2.setSpacing(true);\r
- innerLayout2.addComponent(new TextField("TextField inside gridLayout"));\r
+ tf = new TextField("TextField inside gridLayout");\r
+ tf.setImmediate(true);\r
+ innerLayout2.addComponent(tf);\r
innerLayout2.addComponent(new Button("Button inside gridLayout"));\r
innerLayout2.addComponent(new Label("Label inside gridLayout"));\r
panel.addComponent(innerLayout2);\r
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).
*/
* here, we use the default documentation from implemented interface.
*/
public boolean isEnabled() {
- return enabled && isVisible();
+ return enabled && !disabledByContainer && isVisible();
}
/*
}
}
+ /**
+ * 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
}
}
-}
+ public void setEnabled(boolean enabled) {
+ super.setEnabled(enabled);
+
+ updateComponentDisabledState(!enabled);
+ }
+
+ public void setDisabledByContainer(boolean disabledByContainer) {
+ super.setDisabledByContainer(disabledByContainer);
+
+ updateComponentDisabledState(disabledByContainer);
+ }
+
+ private void updateComponentDisabledState(boolean disabled) {
+ // Update the disabledByContainer state for all subcomponents
+ for (Iterator i = getComponentIterator(); i.hasNext();) {
+ Component c = (Component) i.next();
+ if (c instanceof AbstractComponent) {
+ ((AbstractComponent) c).setDisabledByContainer(disabled);
+ }
+ }
+
+ }
+
+}
\ No newline at end of file