]> source.dussan.org Git - vaadin-framework.git/commitdiff
Deleted examples which were renamed.
authorJani Laakso <jani.laakso@itmill.com>
Wed, 4 Apr 2007 10:14:23 +0000 (10:14 +0000)
committerJani Laakso <jani.laakso@itmill.com>
Wed, 4 Apr 2007 10:14:23 +0000 (10:14 +0000)
svn changeset:1137/svn branch:trunk

src/com/itmill/toolkit/demo/Login.java [deleted file]
src/com/itmill/toolkit/demo/ObjectPropertyDemo.java [deleted file]
src/com/itmill/toolkit/demo/Shortcut.java [deleted file]

diff --git a/src/com/itmill/toolkit/demo/Login.java b/src/com/itmill/toolkit/demo/Login.java
deleted file mode 100644 (file)
index 32dac25..0000000
+++ /dev/null
@@ -1,143 +0,0 @@
-package com.itmill.toolkit.demo;
-
-import com.itmill.toolkit.Application;
-import com.itmill.toolkit.data.Property;
-import com.itmill.toolkit.ui.*;
-
-/**
- * <p>
- * Example application demonstrating simple user login. This example is from
- * MillStone 3.1.1 examples section. Upgrading from 3.1.1 to 4.0.0 was done by
- * updating imports, also setTheme("corporate") call was added to application
- * init method. 
- * </p>
- * 
- * @since 3.1.1
- * @author IT Mill Ltd.
- */
-public class Login extends Application implements Property.ValueChangeListener {
-
-       /* Menu for navigating inside the application. */
-       private Tree menu = new Tree();
-
-       /* Contents of the website */
-       private String[][] pages = { { "Welcome", "Welcome to our website..." },
-                       { "Products", "Public product information." },
-                       { "Contact", "Public contact information." },
-                       { "CRM", "CRM Database requiring login." },
-                       { "Intranet", "Internal information database." } };
-
-       /* Application layout */
-       private GridLayout layout = new GridLayout(2, 1);
-
-       /* Initialize the application */
-       public void init() {
-
-               // set the application to use Corporate -theme
-               setTheme("corporate");
-
-               // Create the main window of the application
-               Window main = new Window("Login example", layout);
-               setMainWindow(main);
-
-               // Add menu and loginbox to the application
-               OrderedLayout l = new OrderedLayout();
-               layout.addComponent(l, 0, 0);
-               l.addComponent(menu);
-               l.addComponent(new LoginBox());
-
-               // Setup menu
-               menu.setStyle("menu");
-               menu.addListener(this);
-               menu.setImmediate(true);
-               addToMenu(new String[] { "Welcome", "Products", "Contact" });
-       }
-
-       // Overriding usetUser method is a simple way of updating application
-       // privileges when the user is changed
-       public void setUser(Object user) {
-               super.setUser(user);
-               if (user != null)
-                       addToMenu(new String[] { "CRM", "Intranet" });
-       }
-
-       public void addToMenu(String[] items) {
-               for (int i = 0; i < items.length; i++) {
-                       menu.addItem(items[i]);
-                       menu.setChildrenAllowed(items[i], false);
-               }
-               if (menu.getValue() == null)
-                       menu.setValue(items[0]);
-       }
-
-       // Handle menu selection and update visible page
-       public void valueChange(Property.ValueChangeEvent event) {
-               layout.removeComponent(1, 0);
-               String title = (String) menu.getValue();
-               for (int i = 0; i < pages.length; i++)
-                       if (pages[i][0].equals(title)) {
-                               Panel p = new Panel(pages[i][0]);
-                               p.addComponent(new Label(pages[i][1]));
-                               p.setStyle("strong");
-                               layout.addComponent(p, 1, 0);
-                       }
-       }
-
-       // Simple loginbox component for the application
-       public class LoginBox extends CustomComponent implements
-                       Application.UserChangeListener {
-
-               // The components this loginbox is composed of
-               private TextField loginName = new TextField("Name");
-
-               private Button loginButton = new Button("Enter", this, "login");
-
-               private Panel loginPanel = new Panel("Login");
-
-               private Panel statusPanel = new Panel();
-
-               private Button logoutButton = new Button("Logout", Login.this, "close");
-
-               private Label statusLabel = new Label();
-
-               // Initialize login component
-               public LoginBox() {
-
-                       // Initialize the component
-                       loginPanel.addComponent(loginName);
-                       loginPanel.addComponent(loginButton);
-                       loginPanel.setStyle("strong");
-                       loginName.setColumns(8);
-                       statusPanel.addComponent(statusLabel);
-                       statusPanel.addComponent(logoutButton);
-
-                       // Set the status of the loginbox and show correct components
-                       updateStatus();
-
-                       // Listen application user change events
-                       Login.this.addListener(this);
-               }
-
-               // Login into application
-               public void login() {
-                       String name = (String) loginName.getValue();
-                       if (name != null && name.length() > 0)
-                               setUser(name);
-                       loginName.setValue("");
-               }
-
-               // Update login status on application user change events
-               public void applicationUserChanged(Application.UserChangeEvent event) {
-                       updateStatus();
-               }
-
-               // Update login status of the component by exposing correct components
-               private void updateStatus() {
-                       statusLabel.setValue("User: " + getUser());
-                       if (getUser() != null)
-                               setCompositionRoot(statusPanel);
-                       else
-                               setCompositionRoot(loginPanel);
-               }
-       }
-}
diff --git a/src/com/itmill/toolkit/demo/ObjectPropertyDemo.java b/src/com/itmill/toolkit/demo/ObjectPropertyDemo.java
deleted file mode 100644 (file)
index 59b0ff0..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-package com.itmill.toolkit.demo;
-
-import com.itmill.toolkit.data.util.ObjectProperty;
-import com.itmill.toolkit.ui.*;
-
-public class ObjectPropertyDemo extends com.itmill.toolkit.Application {
-
-       private TextField floatTextField = null;
-       
-       private Label floatLabel = new Label();
-
-       private Float floatObject = new Float(1.0f);
-
-       private ObjectProperty floatObjectProperty = null;
-
-       private Button storeButton = new Button("Set", this,
-                       "storeButtonClickedEvent");
-
-       private Button commitButton = new Button("Commit", this,
-                       "commitButtonClickedEvent");
-
-       private Button discardButton = new Button("Commit", this,
-                       "discardButtonClickedEvent");
-
-       public void init() {
-
-               Window main = new Window("Test window");
-               setMainWindow(main);
-
-               setTheme("corporate");
-
-               // Textfield that uses ObjectProperty
-               floatObjectProperty = new ObjectProperty(floatObject);
-               floatTextField = new TextField("floatTextField (uses ObjectProperty)", floatObjectProperty);
-               floatObjectProperty.setReadOnly(false);
-               // needed because of bug in variable change handling?
-               // change textfield value and unfocus it to change textfields value
-               // succesfully
-               floatTextField.setImmediate(true);
-               floatTextField.setInvalidCommitted(true);
-               
-               floatLabel.setCaption("floatObject value");
-
-               main.addComponent(floatTextField);
-               main.addComponent(storeButton);
-               main.addComponent(commitButton);
-               main.addComponent(discardButton);
-               main.addComponent(floatLabel);
-       }
-
-       public void storeButtonClickedEvent() {
-               printValues();
-       }
-
-       public void commitButtonClickedEvent() {
-               floatTextField.commit();
-               printValues();
-       }
-
-       public void discardButtonClickedEvent() {
-               floatTextField.discard();
-               printValues();
-       }
-
-       private void printValues() {
-               System.out.println("textField.getValue()=" + floatTextField.getValue());
-               System.out.println("floatValue=" + floatObject);
-               floatLabel.setValue(floatObject);
-       }
-
-}
diff --git a/src/com/itmill/toolkit/demo/Shortcut.java b/src/com/itmill/toolkit/demo/Shortcut.java
deleted file mode 100644 (file)
index 32dda20..0000000
+++ /dev/null
@@ -1,130 +0,0 @@
-package com.itmill.toolkit.demo;
-
-import com.itmill.toolkit.event.Action;
-import com.itmill.toolkit.event.ShortcutAction;
-import com.itmill.toolkit.event.Action.Handler;
-import com.itmill.toolkit.ui.*;
-
-public class Shortcut extends com.itmill.toolkit.Application implements Handler {
-       Window main;
-
-       Button a;
-
-       Button b;
-
-       Button c;
-
-       Button close;
-
-       Button d;
-
-       private AbstractField f;
-
-       public void init() {
-
-               /*
-                * - Create new window for the application - Give the window a visible
-                * title - Set the window to be the main window of the application
-                */
-               main = new Window("Hello window");
-               setMainWindow(main);
-
-               // set the application to use Corporate -theme
-               setTheme("corporate");
-
-               /*
-                * - Create a label with the classic text - Add the label to the main
-                * window
-                */
-               main
-                               .addComponent(new Label(
-                                               "This is a test program for shortcut actions<br />"
-                                                               + "<b>Note:</b> if events do not work, <b>set focus to Textfield first!</b>",
-                                               Label.CONTENT_XHTML));
-               main
-                               .addComponent(new Label(
-                                               "ESC restarts program, alt-A hits A button, ctrl-B hits B button, ctrl-shift-C hits C"));
-
-               // Restart button
-               close = new Button("restart", this, "close");
-               close.addActionHandler(this);
-               main.addComponent(close);
-
-               a = new Button("Button A", this, "buttonAHandler");
-               a.addActionHandler(this);
-
-               b = new Button("Button B", this, "buttonBHandler");
-               b.addActionHandler(this);
-
-               c = new Button("Button C", this, "buttonCHandler");
-               c.addActionHandler(this);
-
-               f = new TextField("Textfield");
-
-               main.addComponent(a);
-               main.addComponent(b);
-               main.addComponent(c);
-               main.addComponent(f);
-
-               d = new Button("Click to focus button B", this, "setFocusB");
-               main.addComponent(d);
-               d = new Button("Click to focus Textfield", this, "setFocusF");
-               main.addComponent(d);
-               f.focus();
-       }
-
-       public void setFocusB() {
-               b.focus();
-       }
-
-       public void setFocusF() {
-               f.focus();
-       }
-
-       public Action[] getActions(Object target, Object sender) {
-               Action[] actions = new Action[1];
-               if (sender == b) {
-                       actions[0] = (Action) (new ShortcutAction("Button b action",
-                                       ShortcutAction.KeyCode.B,
-                                       new int[] { ShortcutAction.ModifierKey.CTRL }));
-
-               } else if (sender == c) {
-                       actions[0] = (Action) new ShortcutAction("Button c action",
-                                       ShortcutAction.KeyCode.C, new int[] {
-                                                       ShortcutAction.ModifierKey.CTRL,
-                                                       ShortcutAction.ModifierKey.SHIFT });
-               } else if (sender == a) {
-                       actions[0] = (Action) new ShortcutAction("Button a action",
-                                       ShortcutAction.KeyCode.A,
-                                       new int[] { ShortcutAction.ModifierKey.ALT });
-               } else {
-                       // restart button
-                       actions[0] = new ShortcutAction("Restart ",
-                                       ShortcutAction.KeyCode.ESCAPE, null);
-               }
-               return actions;
-       }
-
-       public void handleAction(Action action, Object sender, Object target) {
-               if (target == a)
-                       this.buttonAHandler();
-               if (target == b)
-                       this.buttonBHandler();
-               if (target == c)
-                       this.buttonCHandler();
-               if (target == close)
-                       this.close();
-       }
-
-       public void buttonAHandler() {
-               main.addComponent(new Label("Button A handler fired"));
-       }
-
-       public void buttonBHandler() {
-               main.addComponent(new Label("Button B handler fired"));
-       }
-
-       public void buttonCHandler() {
-               main.addComponent(new Label("Button C handler fired"));
-       }
-}