diff options
Diffstat (limited to 'src/com/itmill/toolkit/demo/features/FeatureFrameWindow.java')
-rw-r--r-- | src/com/itmill/toolkit/demo/features/FeatureFrameWindow.java | 104 |
1 files changed, 51 insertions, 53 deletions
diff --git a/src/com/itmill/toolkit/demo/features/FeatureFrameWindow.java b/src/com/itmill/toolkit/demo/features/FeatureFrameWindow.java index 5b0e742f64..2e68ae38f2 100644 --- a/src/com/itmill/toolkit/demo/features/FeatureFrameWindow.java +++ b/src/com/itmill/toolkit/demo/features/FeatureFrameWindow.java @@ -1,30 +1,30 @@ /* ************************************************************************* - IT Mill Toolkit + IT Mill Toolkit - Development of Browser User Interfaces Made Easy + Development of Browser User Interfaces Made Easy - Copyright (C) 2000-2006 IT Mill Ltd - - ************************************************************************* + Copyright (C) 2000-2006 IT Mill Ltd + + ************************************************************************* - This product is distributed under commercial license that can be found - from the product package on license.pdf. Use of this product might - require purchasing a commercial license from IT Mill Ltd. For guidelines - on usage, see licensing-guidelines.html + This product is distributed under commercial license that can be found + from the product package on license.pdf. Use of this product might + require purchasing a commercial license from IT Mill Ltd. For guidelines + on usage, see licensing-guidelines.html - ************************************************************************* - - For more information, contact: - - IT Mill Ltd phone: +358 2 4802 7180 - Ruukinkatu 2-4 fax: +358 2 4802 7181 - 20540, Turku email: info@itmill.com - Finland company www: www.itmill.com - - Primary source for information and releases: www.itmill.com + ************************************************************************* + + For more information, contact: + + IT Mill Ltd phone: +358 2 4802 7180 + Ruukinkatu 2-4 fax: +358 2 4802 7181 + 20540, Turku email: info@itmill.com + Finland company www: www.itmill.com + + Primary source for information and releases: www.itmill.com - ********************************************************************** */ + ********************************************************************** */ package com.itmill.toolkit.demo.features; @@ -34,63 +34,61 @@ import java.util.List; import com.itmill.toolkit.ui.*; import com.itmill.toolkit.ui.Button.ClickEvent; -public class FeatureFrameWindow - extends Feature - implements Button.ClickListener { +public class FeatureFrameWindow extends Feature implements Button.ClickListener { private Button addButton = new Button("Add to application", this, "addWin"); - private Button removeButton = - new Button("Remove from application", this, "delWin"); + + private Button removeButton = new Button("Remove from application", this, + "delWin"); + private FrameWindow demoWindow; + private HashMap windowToFramesetMap = new HashMap(); + private int count = 0; protected Component getDemoComponent() { OrderedLayout l = new OrderedLayout(); demoWindow = new FrameWindow("Feature Test Window"); - demoWindow.getFrameset().newFrame( - createFrame(demoWindow.getFrameset())); + demoWindow.getFrameset() + .newFrame(createFrame(demoWindow.getFrameset())); // Example panel Panel show = new Panel("Test Window Control"); - ((OrderedLayout) show.getLayout()).setOrientation( - OrderedLayout.ORIENTATION_HORIZONTAL); + ((OrderedLayout) show.getLayout()) + .setOrientation(OrderedLayout.ORIENTATION_HORIZONTAL); show.addComponent(addButton); show.addComponent(removeButton); updateWinStatus(); l.addComponent(show); // Properties - PropertyPanel p = new PropertyPanel(demoWindow); - p.dependsOn(addButton); - p.dependsOn(removeButton); - Form ap = - p.createBeanPropertySet( - new String[] { "width", "height", "name", "border", "theme" }); - ap.replaceWithSelect( - "border", - new Object[] { + propertyPanel = new PropertyPanel(demoWindow); + propertyPanel.dependsOn(addButton); + propertyPanel.dependsOn(removeButton); + Form ap = propertyPanel.createBeanPropertySet(new String[] { "width", + "height", "name", "border", "theme" }); + ap.replaceWithSelect("border", new Object[] { new Integer(Window.BORDER_DEFAULT), new Integer(Window.BORDER_NONE), - new Integer(Window.BORDER_MINIMAL)}, - new Object[] { "Default", "None", "Minimal" }); + new Integer(Window.BORDER_MINIMAL) }, new Object[] { "Default", + "None", "Minimal" }); - p.addProperties("FrameWindow Properties", ap); - l.addComponent(p); + propertyPanel.addProperties("FrameWindow Properties", ap); return l; } protected String getDescriptionXHTML() { return "<p>This component implements a window that contains a hierarchical set of frames. " - + "Each frame can contain a web-page, window or a set of frames that divides the space " - + "horizontally or vertically.</p>"; + + "Each frame can contain a web-page, window or a set of frames that divides the space " + + "horizontally or vertically.</p>"; } protected String getExampleSrc() { return "FrameWindow f = new FrameWindow(\"Frame example\");\n" - + "f.getFrameset().newFrame(window);\n" - + "f.getFrameset().newFrame(resource,\"targetName\");\n"; + + "f.getFrameset().newFrame(window);\n" + + "f.getFrameset().newFrame(resource,\"targetName\");\n"; } protected String getImage() { @@ -125,10 +123,10 @@ public class FeatureFrameWindow if (event.getButton().getCaption().equals("Remove")) { Window w = event.getButton().getWindow(); - FrameWindow.Frameset fs = - (FrameWindow.Frameset) windowToFramesetMap.get(w); + FrameWindow.Frameset fs = (FrameWindow.Frameset) windowToFramesetMap + .get(w); if (fs == demoWindow.getFrameset() && fs.size() <= 1) { - // Do not remove the last frame + // Do not remove the last frame } else if (fs.size() > 1) { fs.removeFrame(fs.getFrame(w.getName())); windowToFramesetMap.remove(w); @@ -143,8 +141,8 @@ public class FeatureFrameWindow if (event.getButton().getCaption().equals("Split")) { Window w = event.getButton().getWindow(); - FrameWindow.Frameset fs = - (FrameWindow.Frameset) windowToFramesetMap.get(w); + FrameWindow.Frameset fs = (FrameWindow.Frameset) windowToFramesetMap + .get(w); int index = 0; List l = fs.getFrames(); while (index < l.size() && fs.getFrame(index).getWindow() != w) @@ -161,8 +159,8 @@ public class FeatureFrameWindow private Window createFrame(FrameWindow.Frameset fs) { Window w = new Window(); - w.addComponent( - new Label("<b>Frame: " + (++count) + "</b>", Label.CONTENT_UIDL)); + w.addComponent(new Label("<b>Frame: " + (++count) + "</b>", + Label.CONTENT_UIDL)); w.addComponent(new Button("Split", this)); w.addComponent(new Button("Remove", this)); windowToFramesetMap.put(w, fs); |