summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJani Laakso <jani.laakso@itmill.com>2007-04-24 12:42:35 +0000
committerJani Laakso <jani.laakso@itmill.com>2007-04-24 12:42:35 +0000
commitf31172e04de7b485414525411076d8e22e223e6b (patch)
treeade1bf062fbe83d90e94f63a0ad05d5c3588de7b
parent3810818a86ea77f3405fa975480cb847bd4a6a13 (diff)
downloadvaadin-framework-f31172e04de7b485414525411076d8e22e223e6b.tar.gz
vaadin-framework-f31172e04de7b485414525411076d8e22e223e6b.zip
Refixed #641, #642 properly. Major issues with Windowing on FeatureBrowser.
svn changeset:1316/svn branch:trunk
-rw-r--r--src/com/itmill/toolkit/demo/features/FeatureWindow.java45
-rw-r--r--src/com/itmill/toolkit/demo/features/PropertyPanel.java34
2 files changed, 56 insertions, 23 deletions
diff --git a/src/com/itmill/toolkit/demo/features/FeatureWindow.java b/src/com/itmill/toolkit/demo/features/FeatureWindow.java
index 2e2192e718..a5ee871f41 100644
--- a/src/com/itmill/toolkit/demo/features/FeatureWindow.java
+++ b/src/com/itmill/toolkit/demo/features/FeatureWindow.java
@@ -50,10 +50,15 @@ public class FeatureWindow extends Feature implements Window.CloseListener {
OrderedLayout layoutUpper = new OrderedLayout();
OrderedLayout layoutLower = new OrderedLayout();
+ demoWindow = new Window("Feature Test Window");
+ demoWindow.addListener(this);
+ demoWindow.setWidth(400);
+ demoWindow.setHeight(200);
+ demoWindow.setTheme("default");
+
layoutUpper.addComponent(addButton);
layoutUpper.addComponent(removeButton);
- createDemoWindow();
updateWinStatus();
// Properties
@@ -61,14 +66,20 @@ public class FeatureWindow extends Feature implements Window.CloseListener {
propertyPanel.dependsOn(addButton);
propertyPanel.dependsOn(removeButton);
windowProperties = propertyPanel.createBeanPropertySet(new String[] {
- "width", "height", "name", "border", "theme", "scrollable",
- "scrollOffsetX", "scrollOffsetY" });
+ "width", "height", "name", "theme", "border", "scrollable", });
windowProperties.replaceWithSelect("border", new Object[] {
new Integer(Window.BORDER_DEFAULT),
new Integer(Window.BORDER_NONE),
new Integer(Window.BORDER_MINIMAL) }, new Object[] { "Default",
"None", "Minimal" });
+ // Disabled, not applicable for default theme
+ windowProperties.getField("border").setEnabled(false);
+
propertyPanel.addProperties("Window Properties", windowProperties);
+ windowProperties.getField("width").setDescription(
+ "Minimum width is 100");
+ windowProperties.getField("height").setDescription(
+ "Minimum height is 100");
setJavadocURL("ui/Window.html");
@@ -99,25 +110,14 @@ public class FeatureWindow extends Feature implements Window.CloseListener {
return "Window";
}
- private void createDemoWindow() {
- demoWindow = new Window("Feature Test Window");
- demoWindow.addListener(this);
- // Set window default properties
- demoWindow.setWidth(500);
- demoWindow.setHeight(200);
- demoWindow.setVisible(true);
- demoWindow.setEnabled(true);
- demoWindow.setBorder(Window.BORDER_DEFAULT);
- demoWindow.setReadOnly(false);
- demoWindow.setImmediate(false);
- demoWindow.setIcon(null);
- demoWindow.setComponentError(null);
- demoWindow.setDescription("This is an example description.");
- }
-
public void addWin() {
+
+ propertyPanel.commit();
+
getApplication().addWindow(demoWindow);
+
demoWindow.removeAllComponents();
+
demoWindow
.addComponent(new Label(
"<br /><br />This is a new window created by <em>Add to "
@@ -125,13 +125,18 @@ public class FeatureWindow extends Feature implements Window.CloseListener {
+ " close this window or select <em>Remove from"
+ " application</em> from the Feature Browser window.",
Label.CONTENT_XHTML));
+ // prevent user to change window name tag (after window is created)
+ windowProperties.getField("name").setEnabled(false);
+ windowProperties.getField("name").setReadOnly(true);
demoWindow.setVisible(true);
updateWinStatus();
}
public void delWin() {
getApplication().removeWindow(demoWindow);
- createDemoWindow();
+ // allow user to change window name tag (before window is created)
+ windowProperties.getField("name").setEnabled(true);
+ windowProperties.getField("name").setReadOnly(false);
updateWinStatus();
}
diff --git a/src/com/itmill/toolkit/demo/features/PropertyPanel.java b/src/com/itmill/toolkit/demo/features/PropertyPanel.java
index 7bd4fff4ff..9484a0c46d 100644
--- a/src/com/itmill/toolkit/demo/features/PropertyPanel.java
+++ b/src/com/itmill/toolkit/demo/features/PropertyPanel.java
@@ -104,6 +104,7 @@ public class PropertyPanel extends Panel implements Button.ClickListener,
allProperties.setColumnHeaderMode(Table.COLUMN_HEADER_MODE_ID);
allProperties.setPageLength(0);
updatePropertyList();
+
}
/** Add a formful of properties to property panel */
@@ -120,6 +121,8 @@ public class PropertyPanel extends Panel implements Button.ClickListener,
setButton.dependsOn(properties);
discardButton.dependsOn(properties);
properties.setWriteThrough(false);
+ // TODO change this to false, and test it is suitable for FeatureBrowser
+ // demo
properties.setReadThrough(true);
// Maintain property lists
@@ -265,6 +268,15 @@ public class PropertyPanel extends Panel implements Button.ClickListener,
// Add created fields to property panel
addProperties("Component Basics", set);
+
+ // Customization for Window component
+ if (objectToConfigure instanceof Window) {
+ disableField(set.getField("enabled"), new Boolean(true));
+ disableField(set.getField("visible"), new Boolean(true));
+ disableField(set.getField("componentError"));
+ disableField(set.getField("icon"));
+
+ }
}
/** Add properties for selecting */
@@ -299,7 +311,8 @@ public class PropertyPanel extends Panel implements Button.ClickListener,
/** Field special properties */
private void addFieldProperties() {
- // TODO verify that bug #211 is fixed
+ // TODO bug #211 states that setFocus works only for Button and
+ // Textfield UI components
Form set = new Form(new GridLayout(COLUMNS, 1));
set.addField("focus", new Button("Focus", objectToConfigure, "focus"));
set.getField("focus").setDescription(
@@ -423,8 +436,7 @@ public class PropertyPanel extends Panel implements Button.ClickListener,
}
// Commit all changed on all forms
if (event.getButton() == setButton) {
- for (Iterator i = forms.iterator(); i.hasNext();)
- ((Form) i.next()).commit();
+ commit();
}
// Discard all changed on all forms
@@ -476,4 +488,20 @@ public class PropertyPanel extends Panel implements Button.ClickListener,
public Table getAllProperties() {
return allProperties;
}
+
+ protected void commit() {
+ for (Iterator i = forms.iterator(); i.hasNext();)
+ ((Form) i.next()).commit();
+ }
+
+ private void disableField(Field field) {
+ field.setEnabled(false);
+ field.setReadOnly(true);
+ }
+
+ private void disableField(Field field, Object value) {
+ field.setValue(value);
+ disableField(field);
+ }
+
}