Package org.gwtoolbox.widget.client.panel.layout.tab

Examples of org.gwtoolbox.widget.client.panel.layout.tab.TabSpec


    public void reset() {
        tabs.clear();
        tabs.setShowDefaultContextMenu(true);
        tabs.setHideTabBarWithSingleTab(false);
        TabSpec tab1 = new TabSpec("tab1", "Tab 1", null, new HTML("This tab has a custom context menu!!!"), false);
        tab1.setMenuBuilder(new MenuBuilder() {
            public void build(Menu menu) {
                menu.addItem("Custom Action", new Command() {
                    public void execute() {
                        Window.alert("Custom Action was clicked");
                    }
                });
            }
        });
        tabs.addTab(tab1);
        tabs.addTab("Tab 2", new HTML("Tab 2 Content"));
        tabs.addTab("Tab 3", new HTML("Tab 3 Content"));
        final TabSpec tab4 = new TabSpec("tab4", "Tab 4", null, new HTML("Tab 4 Content"), true);
        tabs.addTab(tab4);
        Button button = new Button("Add Tab 4");
        button.addClickHandler(new ClickHandler() {
            public void onClick(ClickEvent event) {
                tabs.addTab(tab4, 3);
            }
        });
        FlowPanel content5 = new FlowPanel();
        content5.add(button);

        button = new Button("Highlight 3");
        button.addClickHandler(new ClickHandler() {
            public void onClick(ClickEvent event) {
                tabs.setTabHightlighted("Tab 3", true);
            }
        });
        content5.add(button);

        button = new Button("Rename 6", new ClickHandler() {
            public void onClick(ClickEvent event) {
                tabs.renameTab("tab6", "Tab 6 *");
            }
        });
        content5.add(button);

        tabs.addTab("Tab 5", content5);
        TabSpec tab6 = new TabSpec("tab6", "Tab 6", null, new HTML("Tab 6 Content"), true);
        tabs.addTab(tab6);

    }
View Full Code Here


                if (sample == null) {
                    return;
                }
                sample.reset();
                if (tabs.getTabIndex(sample.getName()) < 0) {
                    TabSpec ts = new TabSpec(sample.getName())
                            .setClosable(true)
                            .setText(sample.getName())
                            .setContent(sample.getContentWidget());

                    tabs.addTab(ts);
View Full Code Here

    public SimpleTabPanelSamplePane() {

        final SimpleTabPanel panel = new SimpleTabPanel(true);

        panel.addTab(new TabSpec("tab1", "Tab 1", null, new Label("Tab 1 content"), true));

        ScrollPanel content2 = new ScrollPanel(createContent(createVeryLongText(), "#CCFFCC"));
        content2.setSize("100%", "100%");
        panel.addTab("Tab 2", content2);

        SimpleHorizontalSplitPanel hsp = new SimpleHorizontalSplitPanel();
        hsp.setLeftWidget(new Label("Left"));
        hsp.setRightWidget(new Label("Right"));
        hsp.setSplitPosition("25%");
        hsp.setSize("100%", "100%");
        panel.addTab("Tab 3", hsp);

        TabSpec tab4 = new TabSpec("tab4", "Tab 4", null, new Label("Confent for Tab 4"), false).setMenuBuilder(new MenuBuilder() {
            public void build(Menu menu) {
                CheckMenuItem item = new CheckMenuItem("Disable", !panel.isTabEnabled("tab4"));
                item.addListener(new MenuItemSelectionListener() {
                    public void selectionChanged(SelectionMenuItem item) {
                        panel.setTabEnabled("tab4", !item.isSelected());
                    }
                });
                menu.addItem(item);
            }
        });
        panel.addTab(tab4);
//        panel.addTab("Tab 4", new Label("Content 4"));
        panel.addTab("Tab 5", new Label("Content 5"));
        panel.addTab("Tab 6", new Label("Content 6"));
        panel.setSelectedTab("Tab 3");

        panel.setWidth("100%");
//        panel.setHeight("500px");
        panel.setHeight("100%");
        DOM.setStyleAttribute(panel.getElement(), "borderBottom", "1px solid blue");

        HorizontalPanel hp = new HorizontalPanel();

        SimpleButton button = new SimpleButton("Remove Tab 1", new ClickHandler() {
            public void onClick(ClickEvent event) {
                panel.removeTab("Tab 1");
            }
        });
        hp.add(button);

        addGap(hp, "10px");

        button = new SimpleButton("Clear Tabs", new ClickHandler() {
            public void onClick(ClickEvent event) {
                panel.clear();
            }
        });
        hp.add(button);

        addGap(hp, "10px");

        button = new SimpleButton("Add Tab...", new ClickHandler() {
            public void onClick(ClickEvent event) {
                String tabName = Window.prompt("Enter the tab name", "");
                if (tabName != null) {
                    TabSpec tabSpec = new TabSpec(tabName, tabName, null, new Label("This is the content of '" + tabName + "'"), true);
                    panel.addTab(tabSpec);
                }
            }
        });
        hp.add(button);
View Full Code Here

        TabLayout tabs = new TabLayout();
        tabs.setHideTabBarWithSingleTab(false);
        tabs.addTab("Buttons", panel);
        tabs.addTab("Tab1", new HTML("Tab1 Content"));
//        tabs.addTab("Tab2", new CenterLayout(new HTML("Tab2 Content")));
        tabs.addTab(new TabSpec("contentPanel", "Content Panel", null, cp, true));
//        tabs.add(new HTML("Tab2 Content"), "Tab2");
//        tabs.add(new HTML("Tab3 Content"), "Tab3");
//        tabs.add(new HTML("Tab4 Content"), "Tab4");
//        tabs.add(new HTML("Tab5 Content"), "Tab5");
//        tabs.add(new HTML("Tab6 Content"), "Tab6");
View Full Code Here

    public void addTab(String text, Widget content) {
        addTab(text, text, content);
    }

    public void addTab(String id, String text, Widget content) {
        addTab(new TabSpec(id, text, null, content, false));
    }
View Full Code Here

    public void add(String text, boolean closable) {
        add(text, text, closable);
    }

    public void add(String id, String text, boolean closable) {
        TabSpec spec = new TabSpec(id).setText(text).setClosable(closable);
        addTab(spec);
    }
View Full Code Here

TOP

Related Classes of org.gwtoolbox.widget.client.panel.layout.tab.TabSpec

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.