diff options
Diffstat (limited to 'src/com/itmill/toolkit/demo/ModalWindow.java')
-rw-r--r-- | src/com/itmill/toolkit/demo/ModalWindow.java | 125 |
1 files changed, 64 insertions, 61 deletions
diff --git a/src/com/itmill/toolkit/demo/ModalWindow.java b/src/com/itmill/toolkit/demo/ModalWindow.java index 8b27faa011..6ba1cf9a1f 100644 --- a/src/com/itmill/toolkit/demo/ModalWindow.java +++ b/src/com/itmill/toolkit/demo/ModalWindow.java @@ -1,7 +1,10 @@ package com.itmill.toolkit.demo; import com.itmill.toolkit.event.Action; -import com.itmill.toolkit.ui.*; +import com.itmill.toolkit.ui.Button; +import com.itmill.toolkit.ui.Label; +import com.itmill.toolkit.ui.TextField; +import com.itmill.toolkit.ui.Window; import com.itmill.toolkit.ui.Button.ClickEvent; import com.itmill.toolkit.ui.Button.ClickListener; @@ -16,64 +19,64 @@ import com.itmill.toolkit.ui.Button.ClickListener; * @see com.itmill.toolkit.ui.Label */ public class ModalWindow extends com.itmill.toolkit.Application implements - Action.Handler, ClickListener { - - private Window test; - - public void init() { - - // Create main window - Window main = new Window("ModalWindow demo"); - setMainWindow(main); - main.addComponent(new Label("ModalWindow demo")); - - // Main window textfield - TextField f = new TextField(); - f.setTabIndex(1); - main.addComponent(f); - - // Main window button - Button b = new Button("Button on main window"); - b.addListener(this); - b.setTabIndex(2); - main.addComponent(b); - - // Modal window - test = new Window("Modal window"); - test.setStyle("modal"); - this.addWindow(test); - test.addComponent(new Label( - "You have to close this window before accessing others.")); - - // Textfield for modal window - f = new TextField(); - f.setTabIndex(4); - test.addComponent(f); - f.focus(); - - // Modal window button - b = new Button("Button on modal window"); - b.setTabIndex(3); - b.addListener(this); - test.addComponent(b); - - } - - public Action[] getActions(Object target, Object sender) { - Action actionA = new Action("Action A for " + target.toString()); - Action actionB = new Action("Action B for " + target.toString()); - Action[] actions = new Action[] { actionA, actionB }; - return actions; - } - - public void handleAction(Action action, Object sender, Object target) { - this.test.addComponent(new Label(action.getCaption() + " clicked on " - + target)); - - } - - public void buttonClick(ClickEvent event) { - this.test.addComponent(new Label("Clicked " + event)); - - } + Action.Handler, ClickListener { + + private Window test; + + public void init() { + + // Create main window + Window main = new Window("ModalWindow demo"); + setMainWindow(main); + main.addComponent(new Label("ModalWindow demo")); + + // Main window textfield + TextField f = new TextField(); + f.setTabIndex(1); + main.addComponent(f); + + // Main window button + Button b = new Button("Button on main window"); + b.addListener(this); + b.setTabIndex(2); + main.addComponent(b); + + // Modal window + test = new Window("Modal window"); + test.setStyle("modal"); + addWindow(test); + test.addComponent(new Label( + "You have to close this window before accessing others.")); + + // Textfield for modal window + f = new TextField(); + f.setTabIndex(4); + test.addComponent(f); + f.focus(); + + // Modal window button + b = new Button("Button on modal window"); + b.setTabIndex(3); + b.addListener(this); + test.addComponent(b); + + } + + public Action[] getActions(Object target, Object sender) { + Action actionA = new Action("Action A for " + target.toString()); + Action actionB = new Action("Action B for " + target.toString()); + Action[] actions = new Action[] { actionA, actionB }; + return actions; + } + + public void handleAction(Action action, Object sender, Object target) { + test.addComponent(new Label(action.getCaption() + " clicked on " + + target)); + + } + + public void buttonClick(ClickEvent event) { + test.addComponent(new Label("Clicked " + event)); + + } } |