[kune-commits] r768 - sandbox4/src/main/java/org/op/client

vjrj vjrj at ourproject.org
Wed May 14 03:29:12 CEST 2008


Author: vjrj
Date: 2008-05-14 03:29:09 +0200 (Wed, 14 May 2008)
New Revision: 768

Modified:
   sandbox4/src/main/java/org/op/client/Sandbox.java
Log:


Modified: sandbox4/src/main/java/org/op/client/Sandbox.java
===================================================================
--- sandbox4/src/main/java/org/op/client/Sandbox.java	2008-05-14 01:10:19 UTC (rev 767)
+++ sandbox4/src/main/java/org/op/client/Sandbox.java	2008-05-14 01:29:09 UTC (rev 768)
@@ -1,33 +1,185 @@
 package org.op.client;
 
+import org.op.client.DefaultBorderLayout.Position;
+
 import com.extjs.gxt.ui.client.Style.HorizontalAlignment;
+import com.extjs.gxt.ui.client.Style.Scroll;
 import com.extjs.gxt.ui.client.widget.Button;
+import com.extjs.gxt.ui.client.widget.TabItem;
+import com.extjs.gxt.ui.client.widget.TabPanel;
 import com.extjs.gxt.ui.client.widget.Viewport;
-import com.extjs.gxt.ui.client.widget.form.FormPanel;
 import com.extjs.gxt.ui.client.widget.form.TextField;
 import com.extjs.gxt.ui.client.widget.layout.FillLayout;
+import com.extjs.gxt.ui.client.widget.layout.FitLayout;
 import com.extjs.gxt.ui.client.widget.tips.ToolTipConfig;
 import com.google.gwt.core.client.EntryPoint;
+import com.google.gwt.user.client.Command;
+import com.google.gwt.user.client.Window;
+import com.google.gwt.user.client.ui.Composite;
+import com.google.gwt.user.client.ui.Label;
+import com.google.gwt.user.client.ui.MenuBar;
 import com.google.gwt.user.client.ui.RootPanel;
 
+/**
+ * Entry point classes define <code>onModuleLoad()</code>.
+ */
 public class Sandbox implements EntryPoint {
+
+    class LabelWrapper extends Label implements View {
+        public LabelWrapper(final String text) {
+            super(text);
+        }
+    }
+
+    class MenuBarWrapper extends Composite implements View {
+        public MenuBarWrapper() {
+
+            // Make a command that we will execute from all leaves.
+            Command cmd = new Command() {
+                public void execute() {
+                    Window.alert("You selected a menu item!");
+                }
+            };
+
+            // Make some sub-menus that we will cascade from the top menu.
+            MenuBar fooMenu = new MenuBar(true);
+            fooMenu.addItem("the", cmd);
+            fooMenu.addItem("foo", cmd);
+            fooMenu.addItem("menu", cmd);
+
+            MenuBar barMenu = new MenuBar(true);
+            barMenu.addItem("the", cmd);
+            barMenu.addItem("bar", cmd);
+            barMenu.addItem("menu", cmd);
+
+            MenuBar bazMenu = new MenuBar(true);
+            bazMenu.addItem("the", cmd);
+            bazMenu.addItem("baz", cmd);
+            bazMenu.addItem("menu", cmd);
+
+            // Make a new menu bar, adding a few cascading menus to it.
+            MenuBar menu = new MenuBar();
+            menu.addItem("foo", fooMenu);
+            menu.addItem("bar", barMenu);
+            menu.addItem("baz", bazMenu);
+            initWidget(menu);
+        }
+    }
+
+    private BasicDialogForm dialog;
+    private BasicDialogExtended dialog3;
+
+    /**
+     * This is the entry point method.
+     */
     public void onModuleLoad() {
-        Viewport viewport = new Viewport();
-        viewport.setLayout(new FillLayout(5));
+        Viewport vp = new Viewport();
+        // Test fit vs fill layout
+        vp.setLayout(new FillLayout(4));
+        Workspace wk = new Workspace();
+        vp.add(wk.getPanel());
+        vp.layout();
+        RootPanel.get().add(vp);
+        wk.getEntityWorkspace().addItemToContentTopBar(new MenuBarWrapper());
+        wk.getEntityWorkspace().setContainer(new LabelWrapper("Container"));
+        wk.getEntityWorkspace().setContent(new LabelWrapper("Content"));
+        wk.getEntityWorkspace().setBottom(new LabelWrapper("Bottom"));
+        wk.getEntityWorkspace().setTitle(new LabelWrapper("Title 2"));
+        wk.getEntityWorkspace().setSubtitle(new LabelWrapper("Subtitle"));
+        wk.getSiteBar().addView(new LabelWrapper("sitebar-right"));
 
-        FormPanel form = new FormPanel();
-        form.setHeading("Form title");
-        form.setToolTip(new ToolTipConfig("form title tip", "form text tip"));
-        form.setButtonAlign(HorizontalAlignment.LEFT);
-        TextField field = new TextField();
-        field.setFieldLabel("Some label");
-        field.setToolTip(new ToolTipConfig("field title", "field text tip"));
-        form.add(field);
-        Button button = new Button("Ok");
-        button.setToolTip(new ToolTipConfig("button title", "button text tip"));
-        form.addButton(button);
-        viewport.add(form);
+        dialog = new BasicDialogForm("Test dialog", false, Scroll.AUTO, 380, 200, null, "Join", "Cancel",
+                new BasicDialogListener() {
+                    public void onCancelButtonClick() {
+                        dialog.hide();
+                    }
 
-        RootPanel.get().add(viewport);
+                    public void onFirstButtonClick() {
+                        dialog.hide();
+                    }
+                });
+
+        TextField jid = new TextField();
+        jid.setMessageTarget("tooltip");
+        jid.setToolTip(new ToolTipConfig("Information", "Prints the current document"));
+        jid.setFieldLabel("Jabber id");
+        dialog.addField(jid);
+        dialog.show();
+
+        BasicDialog dialog2 = new BasicDialog("Hellooooo", false);
+        dialog2.add(new Label("Lorem ipsum dolor sit amet, consectetuer adipiscing elit. "
+                + "Donec vitae eros. Nunc sit amet neque. Ut id dui. Integer viverra feugiat sem."));
+        dialog2.show();
+
+        dialog3 = new BasicDialogExtended("Dialog extended", false, Scroll.NONE, 300, 200, "", "Yes", "No",
+                new BasicDialogListener() {
+
+                    public void onCancelButtonClick() {
+                        dialog3.hide();
+                    }
+
+                    public void onFirstButtonClick() {
+                        dialog3.hide();
+                    }
+                });
+        dialog3.add(new Label("Lorem ipsum dolor sit amet, consectetuer adipiscing elit. "
+                + "Donec vitae eros. Nunc sit amet neque. Ut id dui. Integer viverra feugiat sem."));
+        dialog3.show();
+
+        BasicDialog chatDialog = new BasicDialog("Emite chat", false, Scroll.NONE, 600, 415, 300, 300);
+        chatDialog.setMaximizable(true);
+        // chatDialog.setBodyBorder(false);
+        chatDialog.setBorder(false);
+        // chatDialog.setBorders(false);
+        chatDialog.setLayout(new FitLayout());
+        Button sendBtn = new Button("Send");
+        sendBtn.setToolTip("send");
+        chatDialog.addButton(sendBtn);
+        chatDialog.setButtonAlign(HorizontalAlignment.LEFT);
+        DefaultBorderLayout chatPanel = new DefaultBorderLayout();
+        DefaultPanel east = new DefaultPanel("Users");
+        DefaultPanel south = new DefaultPanel();
+        DefaultPanel north = new DefaultPanel();
+        chatPanel.createTopBar(south);
+        chatPanel.createTopBar(north);
+        chatPanel.createBottomBar(east);
+        chatPanel.createTopBar(north);
+        chatPanel.add(north, Position.NORTH, false, false, 22);
+        TabPanel centerPanel = new TabPanel();
+        TabItem item1 = new TabItem("Chat1");
+        item1.setIconStyle("icon1");
+        item1.setLayout(new FitLayout());
+        ToolTipConfig tipConfig = new ToolTipConfig("fulano at kk.com");
+        item1.setToolTip(tipConfig);
+        // item.getHeader().setToolTip("Test"); (in beta3)
+        TabItem item2 = new TabItem("Chat1");
+        item2.setIconStyle("icon1");
+        item2.setLayout(new FitLayout());
+        centerPanel.add(item1);
+        centerPanel.add(item2);
+        chatPanel.add(centerPanel, Position.CENTER);
+        chatPanel.add(east, Position.EAST, false, true, 150);
+        chatPanel.add(south, Position.SOUTH, true, false, 75);
+        chatDialog.add(chatPanel.getPanel());
+        chatDialog.show();
+        chatDialog.layout();
+        item1.setIconStyle("icon2");
+        item1.setText("<span ext:qtip=\"kk\" style=\"icon2\">chat1</span>");
+        item1.layout(true);
+        // chatDialog.renderIfNeeded();
+
+        // BasicDialog chatDialog2 = new BasicDialog("Layout sample", false,
+        // Scroll.NONE, 600, 415, 300, 300);
+        // chatDialog2.setLayout(new FitLayout());
+        // TestBorderLayout testBL = new TestBorderLayout();
+        // chatDialog2.add(testBL);
+        // chatDialog2.show();
+        // chatDialog2.layout();
+        //
+        // vp.add(chatPanel.getPanel());
+        // vp.layout();
+        // RootPanel.get().add(vp);
+
+        // wk.getEntityWorkspace().setContent(chatPanel.getPanel());//
     }
 }




More information about the kune-commits mailing list