Example usage for com.google.gwt.user.client.ui HorizontalPanel setSpacing

List of usage examples for com.google.gwt.user.client.ui HorizontalPanel setSpacing

Introduction

In this page you can find the example usage for com.google.gwt.user.client.ui HorizontalPanel setSpacing.

Prototype

public void setSpacing(int spacing) 

Source Link

Document

Sets the amount of spacing between this panel's cells.

Usage

From source file:com.googlecode.hmvc4gwt.example.hmvcblog.frontend.bloglist.client.bloglist.BloglistController.java

License:Open Source License

public void initView() {

    Label labelTitle = new Label(I18N.constants.labelBloglistTitle());
    getView().setLabelTitle(labelTitle);

    AbsolutePanel absolutePanelContainer = new AbsolutePanel();
    absolutePanelContainer.setStylePrimaryName("blogList");
    getView().setAbsolutePanelContainer(absolutePanelContainer);

    Hyperlink hyperlinkLogin = new Hyperlink(I18N.constants.linkLogin(), HistoryToken.login);
    getView().setHyperlinkLogin(hyperlinkLogin);

    Hyperlink hyperlinkRegister = new Hyperlink(I18N.constants.linkRegister(), HistoryToken.register);
    getView().setHyperlinkLogin(hyperlinkRegister);

    HorizontalPanel horizontalPanelLoginRegister = new HorizontalPanel();
    horizontalPanelLoginRegister.setSpacing(3);
    horizontalPanelLoginRegister.setStylePrimaryName("panelLoginRegister");
    horizontalPanelLoginRegister.add(hyperlinkLogin);
    horizontalPanelLoginRegister.add(hyperlinkRegister);
    getView().setHorizontalPanelLoginRegister(horizontalPanelLoginRegister);

    Label labelHostedBlogs = new Label();
    labelHostedBlogs.setStylePrimaryName("labelHostedBlogs");
    getView().setLabelHostedBlogs(labelHostedBlogs);

    VerticalPanel verticalPanelBloglist = new VerticalPanel();
    getView().setVerticalPanelBloglist(verticalPanelBloglist);

    /*/*w w  w.  j  a  va  2  s  . c  o m*/
     * build view
     */
    absolutePanelContainer.add(horizontalPanelLoginRegister);
    absolutePanelContainer.add(labelHostedBlogs);
    absolutePanelContainer.add(verticalPanelBloglist);

}

From source file:com.googlecode.hmvc4gwt.example.hmvcblog.frontend.dashboard.client.dashboard.DashboardController.java

License:Open Source License

public void initView() {

    AbsolutePanel absolutePanelContainer = new AbsolutePanel();
    getView().setAbsolutePanelContainer(absolutePanelContainer);

    Label labelTitle = new Label(I18N.constants.labelDashboard());
    getView().setLabelTitle(labelTitle);

    Hyperlink hyperlinkEditUserData = new Hyperlink(I18N.constants.linkEditUserData(),
            HistoryToken.editUserdata);/*from w w w . j  av  a 2  s.com*/
    getView().setEditUserData(hyperlinkEditUserData);

    Hyperlink hyperlinkLogout = new Hyperlink(I18N.constants.linkLogout(), HistoryToken.logout);
    getView().setLogout(hyperlinkLogout);

    FlexTable flexTableBloglist = new FlexTable();
    flexTableBloglist.setStylePrimaryName("tableBlogList");
    getView().setFlexTableBlogList(flexTableBloglist);

    Label labelBloglist = new Label(I18N.constants.labelUserBlogList());
    getView().setLabelBloglist(labelBloglist);

    Hyperlink hyperlinkAddBlog = new Hyperlink(I18N.constants.labelAddBlog(), HistoryToken.addBlog);
    getView().setHyperlinkAddBlog(hyperlinkAddBlog);

    HorizontalPanel horizontalPanel = new HorizontalPanel();
    horizontalPanel.setStylePrimaryName("panelMenu");
    horizontalPanel.setSpacing(3);
    horizontalPanel.add(getView().getEditUserData());
    horizontalPanel.add(getView().getLogout());

    absolutePanelContainer.add(horizontalPanel);
    absolutePanelContainer.add(flexTableBloglist);
    absolutePanelContainer.add(hyperlinkAddBlog);

}

From source file:com.gs.fw.common.mithra.ui.gwt.client.MithraCacheUi.java

License:Apache License

public void onModuleLoad() {
    mithraManagerLocation = Window.Location.getParameter("mithraManagerLocation");

    images = (Images) GWT.create(Images.class);
    asyncService = MithraCacheUiRemoteService.App.getInstance();
    mainPanel.setWidth("100%");
    mainPanel.setSpacing(2);//from w ww  . j a  v  a 2 s.c  o  m
    RootPanel.get().add(mainPanel);
    HorizontalPanel panel = new HorizontalPanel();
    panel.setSpacing(5);
    panel.add(filterTextBox);

    RolloverButton filterButton = new RolloverButton("Filter", images.filterOn(), images.filterOff());
    filterButton.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent sender) {
            filter();
        }
    });
    panel.add(filterButton);
    RolloverButton refreshButton = new RolloverButton("Refresh", images.refreshOn(), images.refreshOff());
    refreshButton.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent sender) {
            refresh();
        }
    });
    panel.add(refreshButton);

    String header = "Mithra Cache Control";
    if (mithraManagerLocation != null && !mithraManagerLocation.isEmpty()) {
        header = header + " @ " + mithraManagerLocation;
    }
    mainPanel.add(new Header(header));
    mainPanel.add(panel);
    mainPanel.setCellHorizontalAlignment(refreshButton, HasHorizontalAlignment.ALIGN_CENTER);
    //        mainPanel.add(new Label("Mithra Cache Control"));
    mainPanel.add(new Header("JVM Memory"));

    jvmPanel.setSpacing(5);
    mainPanel.add(jvmPanel);

    partiallyCachedPanel = new ControllerPanel(true, this);
    mainPanel.add(partiallyCachedPanel);

    fullyCachedPanel = new ControllerPanel(false, this);
    mainPanel.add(fullyCachedPanel);
    refresh();
}

From source file:com.gwtext.sample.showcase2.client.dd.BasicDDSample.java

License:Open Source License

public Panel getViewPanel() {
    if (panel == null) {
        panel = new Panel();

        HorizontalPanel horizontalPanel = new HorizontalPanel();
        horizontalPanel.setSpacing(15);

        Panel draggable = new Panel();
        draggable.setTitle("Draggable");
        draggable.setBorder(true);//from   w w w . j a  v  a2 s.c  o  m
        draggable.setWidth(200);
        draggable.setCollapsible(true);
        draggable.setHtml(SampleData.getShortBogusMarkup());

        Panel proxy = new Panel();
        proxy.setTitle("Draggable with Proxy");
        proxy.setBorder(true);
        proxy.setWidth(200);
        proxy.setCollapsible(true);
        proxy.setHtml(SampleData.getShortBogusMarkup());

        DD dd = new DD(draggable);
        DD ddProxy = new DDProxy(proxy);

        horizontalPanel.add(draggable);
        horizontalPanel.add(proxy);

        panel.add(horizontalPanel);
    }

    return panel;
}

From source file:com.gwtext.sample.showcase2.client.dd.BasicOnTopSample.java

License:Open Source License

public Panel getViewPanel() {
    if (panel == null) {
        panel = new Panel();
        HorizontalPanel horizontalPanel = new HorizontalPanel();
        horizontalPanel.setSpacing(15);

        Panel panel1 = new Panel();
        panel1.setTitle("Panel1");
        panel1.setBorder(true);//from w w  w.ja  v  a  2s.c om
        panel1.setBodyStyle("background-color:#6D739A");
        panel1.setWidth(200);
        panel1.setHtml(SampleData.getShortBogusMarkup());

        Panel panel2 = new Panel();
        panel2.setTitle("Panel2");
        panel2.setBodyStyle("background-color:#566F4E");
        panel2.setBorder(true);
        panel2.setWidth(200);
        panel2.setHtml(SampleData.getShortBogusMarkup());

        Panel panel3 = new Panel();
        panel3.setTitle("Panel3");
        panel3.setBodyStyle("background-color:#7E5B60");
        panel3.setBorder(true);
        panel3.setWidth(200);
        panel3.setHtml(SampleData.getShortBogusMarkup());

        DD dd1 = new DDOnTop(panel1);
        DD dd2 = new DDOnTop(panel2);
        DD dd3 = new DDOnTop(panel3);

        horizontalPanel.add(panel1);
        horizontalPanel.add(panel2);
        horizontalPanel.add(panel3);

        panel.add(horizontalPanel);
    }

    return panel;
}

From source file:com.gwtext.sample.showcase2.client.panel.PanelsSample.java

License:Open Source License

public Panel getViewPanel() {
    if (panel == null) {
        panel = new Panel();

        HorizontalPanel horizontalPanel = new HorizontalPanel();
        horizontalPanel.setSpacing(15);

        Panel collapsiblePanel = new Panel();
        collapsiblePanel.setTitle("Collapsible Panel");
        collapsiblePanel.setWidth(200);/*from  w  w  w.  j a va 2 s .c o  m*/
        collapsiblePanel.setCollapsible(true);
        collapsiblePanel.setHtml(SampleData.getShortBogusMarkup());

        Panel iconPanel = new Panel();
        iconPanel.setTitle("Icon Panel");
        iconPanel.setIconCls("paste-icon");
        iconPanel.setWidth(200);
        iconPanel.setHtml(SampleData.getShortBogusMarkup());
        iconPanel.setShadow(true);

        HorizontalPanel horizontalPanel2 = new HorizontalPanel();
        horizontalPanel2.setSpacing(15);

        Panel draggablePanel = new Panel();
        draggablePanel.setTitle("Draggable Panel");
        draggablePanel.setDraggable(true);
        draggablePanel.setWidth(200);
        draggablePanel.setHtml(SampleData.getShortBogusMarkup());
        draggablePanel.setShadow(true);
        DD dd = new DD(draggablePanel);

        Panel toolsPanel = new Panel();
        toolsPanel.setTitle("Tools Panel");
        toolsPanel.setIconCls("paste-icon");
        toolsPanel.setWidth(200);
        toolsPanel.setHtml(SampleData.getShortBogusMarkup());
        toolsPanel.setShadow(true);
        toolsPanel.addTool(new Tool(Tool.GEAR, new Function() {
            public void execute() {
                MessageBox.alert("Settings", "The Settings tool was clicked");
            }
        }, "Settings"));
        toolsPanel.addTool(new Tool(Tool.SEARCH, new Function() {
            public void execute() {
                MessageBox.alert("Search", "The Search tool was clicked");
            }
        }, "Search"));

        Panel windowPanel = new Panel();
        windowPanel.setHtml(SampleData.getShortBogusMarkup());
        windowPanel.setShadow(true);

        final Window window = new Window();
        window.setTitle("Window Panel");
        window.setIconCls("paste-icon");
        window.setMaximizable(true);
        window.setResizable(true);
        window.setLayout(new FitLayout());
        window.setWidth(200);
        window.setModal(false);

        window.addTool(new Tool(Tool.REFRESH, new Function() {
            public void execute() {
                MessageBox.alert("Refresh", "The Refresh tool was clicked");
            }
        }, "Refresh"));
        window.addTool(new Tool(Tool.PIN, new Function() {
            public void execute() {
                MessageBox.alert("Pin", "The Pin tool was clicked");
            }
        }, "Pin"));
        window.add(windowPanel);

        Button button = new Button("Show Window Panel", new ButtonListenerAdapter() {
            public void onClick(Button button, EventObject e) {
                window.show();
            }
        });

        window.setAnimateTarget(button.getId());

        HorizontalPanel horizontalPanel3 = new HorizontalPanel();
        horizontalPanel3.setSpacing(15);
        HorizontalPanel horizontalPanel4 = new HorizontalPanel();
        horizontalPanel4.setSpacing(15);

        SyntaxHighlightPanel shPanelXml = new SyntaxHighlightPanel(getXmlData(),
                SyntaxHighlightPanel.SYNTAX_XML);
        shPanelXml.setWidth(400);
        shPanelXml.setTitle("SyntaxHighlightPanel XML");
        shPanelXml.setShadow(true);
        SyntaxHighlightPanel shPanelJava = new SyntaxHighlightPanel(getJavaData(),
                SyntaxHighlightPanel.SYNTAX_JAVA);
        shPanelJava.setWidth(400);
        shPanelJava.setTitle("SyntaxHighlightPanel Java");
        shPanelJava.setShadow(true);
        shPanelJava.setShowGutter(false);
        shPanelJava.setShowControls(false);
        shPanelJava.setShowColumns(false);
        shPanelJava.setBorder(true);

        horizontalPanel.add(collapsiblePanel);
        horizontalPanel.add(toolsPanel);
        horizontalPanel2.add(draggablePanel);
        horizontalPanel2.add(button);
        horizontalPanel3.add(shPanelXml);
        horizontalPanel4.add(shPanelJava);

        Panel verticalPanel = new Panel();
        verticalPanel.setLayout(new VerticalLayout(15));
        verticalPanel.add(horizontalPanel);
        verticalPanel.add(horizontalPanel2);
        verticalPanel.add(horizontalPanel3);
        verticalPanel.add(horizontalPanel4);

        panel.add(verticalPanel);
    }
    return panel;
}

From source file:com.gwtextux.sample.showcase2.client.widgets.ImageDDSample.java

License:Open Source License

public Panel getViewPanel() {
    if (panel == null) {
        panel = new Panel();

        HorizontalPanel horizontalPanel = new HorizontalPanel();
        horizontalPanel.setSpacing(15);

        Image myImage = new Image("myImageid", "images/gwt-ext-logo.png");
        myImage.addListener(new ImageListenerAdapter() {
            public void onClick(Image image, EventObject e) {
                log(EVENT, "Image1" + " clicked.");
            }/*from   www. j av a2  s  .  c  om*/

            public void onMouseOut(Image image, EventObject e) {
                log(EVENT, "Image1" + " mouse out.");
            }

            public void onMouseOver(Image image, EventObject e) {
                log(EVENT, "Image1" + " mouse over.");
            }
        });
        Menu menu = new Menu();
        Item item1 = new Item("Copy this fine Image");
        menu.addItem(item1);
        myImage.setContextMenu(menu);

        Panel draggable = new Panel();
        draggable.setBorder(true);
        draggable.setCollapsible(false);
        draggable.add(myImage);

        Image myImage2 = new Image("myImageid2", "images/gwt-ext-logo.png");
        Panel proxy = new Panel();
        proxy.setBorder(true);
        proxy.setCollapsible(false);
        proxy.add(myImage2);
        myImage2.addListener(new ImageListenerAdapter() {
            public void onClick(Image image, EventObject e) {
                log(EVENT, "Image2" + " clicked.");
            }

            public void onMouseOut(Image image, EventObject e) {
                log(EVENT, "Image2" + " mouse out.");
            }

            public void onMouseOver(Image image, EventObject e) {
                log(EVENT, "Image2" + " mouse over.");
            }
        });
        Menu menu2 = new Menu();
        Item item2 = new Item("Another fine Context Menu");
        menu2.addItem(item2);
        myImage2.setContextMenu(menu2);

        DD dd = new DD(draggable);
        DD ddProxy = new DDProxy(proxy);

        horizontalPanel.add(draggable);
        horizontalPanel.add(proxy);

        panel.add(horizontalPanel);
    }

    return panel;
}

From source file:com.gwttest.client.Demo.java

License:Open Source License

public void onModuleLoad() {
    final ChartWidget chart = new ChartWidget();

    HorizontalPanel hp = new HorizontalPanel();
    hp.setSpacing(10);

    VerticalPanel vp = new VerticalPanel();
    vp.setSpacing(20);/*from  w  w w  .  j ava 2  s .c  o  m*/
    // add home page
    HTML homeText = new HTML("<h2>Welcome to OFCGWT</h2>"
            + "<i>....the OpenFlashChart GWT Library</i></br></br>"
            + "This demonstration site will showcase the many different types of charts that can be inserted into a GWT application.");
    vp.add(homeText);
    vp.setCellHeight(homeText, "100");

    createPopupDialog();
    Button popup = new Button("Show 2nd Chart in Dialog");
    popup.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            popupDb.center();
            popupDb.show();
        }
    });
    vp.add(popup);

    Button image = new Button("Show Image of Chart");
    image.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {

            ImageServiceAsync imgService = (ImageServiceAsync) GWT.create(ImageService.class);
            ServiceDefTarget target = (ServiceDefTarget) imgService;
            target.setServiceEntryPoint(GWT.getHostPageBaseURL() + "ImageService");

            imgService.getImageToken(chart.getImageData(), new AsyncCallback<String>() {
                public void onFailure(Throwable caught) {
                }

                public void onSuccess(String result) {
                    createImageDialog(GWT.getHostPageBaseURL() + "image?var=img_" + result);
                }
            });
        }
    });
    vp.add(image);

    vp.add(new HTML("Update Speed <i>(0-off, 4-max)</i>"));
    final SliderBar slider = new SliderBar(0.0, 4.0);
    slider.setStepSize(1.0);
    slider.setCurrentValue(1.0);
    slider.setNumTicks(4);
    slider.setNumLabels(4);
    slider.setWidth("100%");
    vp.add(slider);

    hp.add(vp);
    hp.setCellWidth(vp, "300");

    // add chart
    VerticalPanel vp2 = new VerticalPanel();
    DecoratorPanel dp = new DecoratorPanel();
    SimplePanel chartPanel = new SimplePanel();
    chartPanel.setStylePrimaryName("chartPanel");
    chart.setSize("500", "400");
    chart.setChartData(getPieChartData());
    chartPanel.add(chart);
    dp.add(chartPanel);
    vp2.add(dp);
    vp2.add(new HTML("Chart's JSON data:"));
    ta = new TextArea();
    ta.setWidth("400");
    ta.setHeight("100");
    ta.setText(chart.getJsonData());
    vp2.add(ta);
    hp.add(vp2);

    VerticalPanel chartlist = new VerticalPanel();
    chartlist.setSpacing(5);
    Command cmd = new Command() {
        public void execute() {
            chart.setChartData(getPieChartData());
            ta.setText(chart.getJsonData());
        }
    };
    RadioButton rb = createRadioButton("PieChart - No Labels", cmd);
    updateCmd = cmd;
    rb.setValue(true);
    chartlist.add(rb);

    chartlist.add(createRadioButton("PieChart - Animate", new Command() {
        public void execute() {
            chart.setChartData(getAniPieChartData());
            ta.setText(chart.getJsonData());
        }
    }));

    chartlist.add(createRadioButton("BarChart - Transparent", new Command() {
        public void execute() {
            chart.setChartData(getBarChartTransparentData());
            ta.setText(chart.getJsonData());
        }
    }));

    chartlist.add(createRadioButton("BarChart - Glass", new Command() {
        public void execute() {
            chart.setChartData(getBarChartGlassData());
            ta.setText(chart.getJsonData());
        }
    }));

    chartlist.add(createRadioButton("3DBarChart + Line", new Command() {
        public void execute() {
            chart.setChartData(get3DBarLineChartData());
            ta.setText(chart.getJsonData());
        }
    }));

    chartlist.add(createRadioButton("CylinderChart", new Command() {
        public void execute() {
            chart.setChartData(getCylinderChartData());
            ta.setText(chart.getJsonData());
        }
    }));

    chartlist.add(createRadioButton("CylinderChart - RoundGlass", new Command() {
        public void execute() {
            chart.setChartData(getCylinderChartGlassData());
            ta.setText(chart.getJsonData());
        }
    }));

    chartlist.add(createRadioButton("LineChart - 3 Dot Types", new Command() {
        public void execute() {
            chart.setChartData(getLineChartData());
            ta.setText(chart.getJsonData());
        }
    }));

    chartlist.add(createRadioButton("ScatterChart - Star Dot", new Command() {
        public void execute() {
            chart.setChartData(getScatterPointChartData());
            ta.setText(chart.getJsonData());
        }
    }));

    chartlist.add(createRadioButton("ScatterChart - Line", new Command() {
        public void execute() {
            chart.setChartData(getScatterLineChartData());
            ta.setText(chart.getJsonData());
        }
    }));

    chartlist.add(createRadioButton("RadarChart", new Command() {
        public void execute() {
            chart.setChartData(getRadarChartData());
            ta.setText(chart.getJsonData());
        }
    }));

    chartlist.add(createRadioButton("Horizontal-BarChart", new Command() {
        public void execute() {
            chart.setChartData(getHorizBarChartData());
            ta.setText(chart.getJsonData());
        }
    }));

    chartlist.add(createRadioButton("AreaChart - Hollow", new Command() {
        public void execute() {
            chart.setChartData(getAreaHollowChartData());
            ta.setText(chart.getJsonData());
        }
    }));

    chartlist.add(createRadioButton("AreaChart - Line", new Command() {
        public void execute() {
            chart.setChartData(getAreaLineChartData());
            ta.setText(chart.getJsonData());
        }
    }));

    chartlist.add(createRadioButton("SketchChart", new Command() {
        public void execute() {
            chart.setChartData(getSketchChartData());
            ta.setText(chart.getJsonData());
        }
    }));

    chartlist.add(createRadioButton("StackChart", new Command() {
        public void execute() {
            chart.setChartData(getStackChartData());
            ta.setText(chart.getJsonData());
        }
    }));

    chartlist.add(createRadioButton("HorizontalStackChart", new Command() {
        public void execute() {
            chart.setChartData(getHorizontalStackChartData());
            ta.setText(chart.getJsonData());
        }
    }));

    hp.add(chartlist);
    hp.setCellWidth(chartlist, "300");

    RootPanel.get().add(hp);

    final Timer updater = new Timer() {
        public void run() {
            updateCmd.execute();
        }
    };
    updater.scheduleRepeating(3000);

    slider.addChangeListener(new ChangeListener() {
        public void onChange(Widget sender) {
            switch ((int) (slider.getCurrentValue())) {
            case 0:
                updater.cancel();
                break;

            case 1:
                updater.scheduleRepeating(3000);
                break;

            case 2:
                updater.scheduleRepeating(1000);
                break;

            case 3:
                updater.scheduleRepeating(200);
                break;

            case 4:
                updater.scheduleRepeating(50);
                break;
            }
        }
    });
}

From source file:com.gwttest.client.Events.java

License:Open Source License

public void onModuleLoad() {
    SimplePanel main = new SimplePanel();
    main.setHeight("100%");
    main.setWidth("100%");

    HorizontalPanel hp = new HorizontalPanel();
    hp.setSpacing(10);

    VerticalPanel vp = new VerticalPanel();
    // add home page
    HTML homeText = new HTML(
            "<h2>Welcome to OFCGWT</h2>" + "<i>....the OpenFlashChart GWT Library</i></br></br>"
                    + "This demonstration showcases the events \"onClick\" feature with a drill-down effect.");
    vp.add(homeText);/*from   w  ww .j  ava2 s.co  m*/
    vp.setCellHeight(homeText, "300");

    hp.add(vp);
    hp.setCellWidth(vp, "300");

    // add chart
    DecoratorPanel dp = new DecoratorPanel();
    SimplePanel pieSp = new SimplePanel();
    chart = new ChartWidget();
    chart.setSize("400", "300");
    pieSp.add(chart);
    dp.add(pieSp);
    hp.add(dp);

    VerticalPanel chartlist = new VerticalPanel();
    chartlist.setSpacing(5);

    resetBut = new Button("Reset", new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            chart.setChartData(getPieChartLayer1());
        }
    });
    chartlist.add(chartLabel);
    chartlist.add(resetBut);

    ChartData cd = getPieChartLayer1();
    chart.setChartData(cd);

    hp.add(chartlist);
    hp.setCellWidth(chartlist, "300");

    RootPanel.get().add(hp);
}

From source file:com.jcommerce.gwt.client.panels.goods.NewGoods.java

License:Apache License

protected void onRender(Element parent, int index) {
    super.onRender(parent, index);

    contentPanelGeneral.createPanel(IGoods.NAME, Resources.constants.Goods_name(), new TextBox());
    contentPanelGeneral.createPanel(IGoods.SN, Resources.constants.Goods_SN(), new TextBox());

    contentPanelGeneral.createPanel(IGoods.BRAND, Resources.constants.Goods_brand(), g_list);

    MultiValueSelector mselector = new MultiValueSelector();
    mselector.setBean(ModelNames.CATEGORY);
    mselector.setCaption("Select Category");
    mselector.setMessage("Select Category");
    contentPanelGeneral.createPanel(IGoods.CATEGORIES, Resources.constants.Goods_category(), mselector);
    contentPanelGeneral.createPanel(IGoods.SHOPPRICE, Resources.constants.Goods_shopPrice(), new TextBox());
    contentPanelGeneral.createPanel(IGoods.MARKETPRICE, Resources.constants.Goods_marketPrice(), new TextBox());
    contentPanelGeneral.createPanel(IGoods.GIVEINTEGRAL, Resources.constants.Goods_giveIntegral(),
            new TextBox());
    contentPanelGeneral.createPanel(IGoods.INTEGRAL, Resources.constants.Goods_integral(), new TextBox());

    contentPanelGeneral.createPanel(IGoods.PROMOTEPRICE, Resources.constants.Goods_promotePrice(),
            new TextBox());
    final FileUploader imageUpload = new FileUploader();
    imageUpload.addAllowedTypes(new String[] { ".jpg", ".gif" });
    contentPanelGeneral.createPanel(IGoods.IMAGE, Resources.constants.Goods_image(), imageUpload);
    final FileUploader thumbUpload = new FileUploader();
    thumbUpload.addAllowedTypes(new String[] { ".jpg", ".gif" });
    contentPanelGeneral.createPanel(IGoods.THUMB, Resources.constants.Goods_thumb(), thumbUpload);

    contentPanelOther.createPanel(IGoods.WEIGHT, Resources.constants.Goods_weight(), new TextBox());
    contentPanelOther.createPanel(IGoods.NUMBER, Resources.constants.Goods_number(), new TextBox());
    contentPanelOther.createPanel(IGoods.WARNNUMBER, Resources.constants.Goods_warnNumber(), new TextBox());
    contentPanelOther.createPanel(IGoods.HOTSOLD, Resources.constants.Goods_hotsold(), new CheckBox());
    contentPanelOther.createPanel(IGoods.NEWADDED, Resources.constants.Goods_newAdded(), new CheckBox());
    contentPanelOther.createPanel(IGoods.BESTSOLD, Resources.constants.Goods_bestSold(), new CheckBox());
    contentPanelOther.createPanel(IGoods.BRIEF, Resources.constants.Goods_brief(), new TextArea());
    contentPanelOther.createPanel(IGoods.SELLERNOTE, Resources.constants.Goods_sellerNote(), new TextArea());

    HorizontalPanel panel = new HorizontalPanel();
    panel.setSpacing(10);
    btnOK.setText("");
    btnCancel.setText("?");
    panel.add(btnOK);/*w w w  .j a va 2  s  .  c o m*/
    panel.add(btnCancel);

    // Create a tab panel
    DecoratedTabPanel tabPanel = new DecoratedTabPanel();
    tabPanel.setWidth("100%");
    tabPanel.setAnimationEnabled(true);

    // Add a home tab      

    tabPanel.add(contentPanelGeneral, Resources.constants.NewGoods_tabGeneral());

    // Create the text area and toolbar
    RichTextArea area = new RichTextArea();
    area.setSize("100%", "14em");
    RichTextToolbar toolbar = new RichTextToolbar(area);
    toolbar.setWidth("100%");

    //Add the components to a panel
    Grid grid = new Grid(2, 1);
    grid.setStyleName("cw-RichText");
    grid.setWidget(0, 0, toolbar);
    grid.setWidget(1, 0, area);

    // Add a detail tab   
    HTML properties2 = new HTML("properites");
    tabPanel.add(grid, Resources.constants.NewGoods_tabDetail());

    // Add a other tab        
    tabPanel.add(contentPanelOther, Resources.constants.NewGoods_tabOther());

    // Add a Properties tab
    tabPanel.add(attrPanel, Resources.constants.NewGoods_tabProperty());

    // Add a Pictures tab
    tabPanel.add(galleryPanel, Resources.constants.NewGoods_tabGallery());

    // Add a Connet other goods tab
    HTML conngoods = new HTML("connect goods");
    tabPanel.add(conngoods, Resources.constants.NewGoods_tabLink());

    // Add a Accessories tab
    HTML accessories = new HTML("accessories");
    tabPanel.add(accessories, Resources.constants.NewGoods_tabAccessories());

    // Add a Connet articles tab
    HTML articles = new HTML("articles");
    tabPanel.add(articles, Resources.constants.NewGoods_tabArticle());

    // Return the content
    tabPanel.selectTab(0);
    tabPanel.ensureDebugId("cwTabPanel");
    add(tabPanel);
    add(panel);
    createList();
    btnOK.addClickListener(new ClickListener() {
        public void onClick(Widget sender) {
            if (!imageUpload.submit()) {
                return;
            }
            if (!thumbUpload.submit()) {
                return;
            }

            new WaitService(new WaitService.Job() {
                public boolean isReady() {
                    return imageUpload.isFinish() && thumbUpload.isFinish();
                }

                public void run() {
                    Date currentTime = new Date();
                    Timestamp nowTime = new Timestamp(currentTime.getTime());
                    Map<String, Object> argsLeft = contentPanelGeneral.getValues();
                    Map<String, Object> argsRight = contentPanelOther.getValues();
                    Map<String, Object> argsAttrs = attrPanel.getValues();

                    argsLeft.putAll(argsRight);
                    argsLeft.putAll(argsAttrs);
                    argsLeft.put("addTime", nowTime);//addTime information
                    if (editting) {
                        new UpdateService().updateBean(goodsId, new BeanObject(ModelNames.GOODS, argsLeft),
                                null);
                        editting = false;
                        iShop.getInstance().displayGoodsList();
                        Info.display("?", "???.");
                    } else {
                        new CreateService().createBean(new BeanObject(ModelNames.GOODS, argsLeft), null);
                        iShop.getInstance().displayGoodsList();
                        Info.display("?", "??.");
                    }
                }
            });
        }
    });

    btnCancel.addClickListener(new ClickListener() {
        public void onClick(Widget sender) {
            contentPanelGeneral.clearValues();
            contentPanelOther.clearValues();
            attrPanel.updateValues(null);
        }
    });
}