Changeset 5253
- Timestamp:
- 08/25/08 08:50:11 (3 months ago)
- Location:
- trunk/src/com/itmill/toolkit
- Files:
-
- 2 modified
-
tests/tickets/Ticket677.java (modified) (4 diffs)
-
ui/Form.java (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/com/itmill/toolkit/tests/tickets/Ticket677.java
r5252 r5253 3 3 import com.itmill.toolkit.Application; 4 4 import com.itmill.toolkit.ui.Button; 5 import com.itmill.toolkit.ui.DateField; 6 import com.itmill.toolkit.ui.Form; 5 7 import com.itmill.toolkit.ui.GridLayout; 6 8 import com.itmill.toolkit.ui.Label; … … 14 16 public class Ticket677 extends Application { 15 17 18 private static final Object P1 = new Object(); 19 private static final Object P2 = new Object(); 20 private static final Object P3 = new Object(); 21 16 22 private Panel panel; 23 private Form form; 17 24 18 25 public void init() { … … 26 33 27 34 private void createUI(GridLayout layout) { 28 panel = new Panel("panel caption"); 29 layout.addComponent(panel); 35 createPanel(layout); 36 createForm(layout); 37 30 38 layout.addComponent(new Button("Enable", new ClickListener() { 31 39 32 40 public void buttonClick(ClickEvent event) { 33 41 panel.setEnabled(true); 42 form.setEnabled(true); 34 43 } 35 44 … … 40 49 public void buttonClick(ClickEvent event) { 41 50 panel.setEnabled(false); 51 form.setEnabled(false); 42 52 } 43 53 44 54 })); 55 56 } 57 58 private void createForm(GridLayout layout) { 59 form = new Form(); 60 form.addField(P1, new TextField()); 61 form.addField(P2, new DateField()); 62 form.addField(P3, new DateField()); 63 64 layout.addComponent(form); 65 } 66 67 private void createPanel(GridLayout layout) { 68 panel = new Panel("panel caption"); 69 layout.addComponent(panel); 45 70 46 71 panel.addComponent(new Label("Label 1")); -
trunk/src/com/itmill/toolkit/ui/Form.java
r5107 r5253 235 235 * 236 236 * @param makeVisible 237 * If true (default), validation is made visible when commit() is 238 * called. If false, the visibility is left as it is. 237 * If true (default), validation is made visible when 238 * commit() is called. If false, the visibility is left as it 239 * is. 239 240 */ 240 241 public void setValidationVisibleOnCommit(boolean makeVisible) { … … 245 246 * Is validation made automatically visible on commit? 246 247 * 247 * See setValidationVisibleOnCommit().248 * See setValidationVisibleOnCommit(). 248 249 * 249 250 * @return true if validation is made automatically visible on commit. … … 252 253 return validationVisibleOnCommit; 253 254 } 254 255 255 256 /* 256 257 * Commit changes to the data source Don't add a JavaDoc comment here, we … … 1075 1076 } 1076 1077 1078 public void setEnabled(boolean enabled) { 1079 super.setEnabled(enabled); 1080 1081 updateComponentDisabledState(!enabled); 1082 } 1083 1084 public void setDisabledByContainer(boolean disabledByContainer) { 1085 super.setDisabledByContainer(disabledByContainer); 1086 1087 updateComponentDisabledState(disabledByContainer); 1088 } 1089 1090 private void updateComponentDisabledState(boolean disabled) { 1091 // Update the disabledByContainer state for all subcomponents 1092 for (Iterator i = fields.values().iterator(); i.hasNext();) { 1093 Component c = (Component) i.next(); 1094 if (c instanceof AbstractComponent) { 1095 ((AbstractComponent) c).setDisabledByContainer(disabled); 1096 } 1097 } 1098 1099 } 1100 1077 1101 }
