Java Code Examples for com.google.gwt.user.client.ui.TabPanel#add()

The following examples show how to use com.google.gwt.user.client.ui.TabPanel#add() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CoreQueueEditor.java    From core with GNU Lesser General Public License v2.1 5 votes vote down vote up
public Widget asWidget() {
    LayoutPanel layout = new LayoutPanel();

    VerticalPanel panel = new VerticalPanel();
    panel.setStyleName("rhs-content-panel");

    ScrollPanel scroll = new ScrollPanel(panel);
    layout.add(scroll);
    layout.setWidgetTopHeight(scroll, 0, Style.Unit.PX, 100, Style.Unit.PCT);

    serverName = new HTML("Replace me");
    serverName.setStyleName("content-header-label");

    panel.add(serverName);
    panel.add(new ContentDescription("Configuration for core queues."));

    TabPanel bottomLayout = new TabPanel();
    bottomLayout.addStyleName("default-tabpanel");
    bottomLayout.addStyleName("master_detail-detail");

    queueList = new CoreQueueList(presenter);
    bottomLayout.add(queueList.asWidget(), "Queues");

    bottomLayout.selectTab(0);

    panel.add(bottomLayout);

    return layout;
}
 
Example 2
Source File: JMSEditor.java    From core with GNU Lesser General Public License v2.1 5 votes vote down vote up
public Widget asWidget() {
    LayoutPanel layout = new LayoutPanel();

    VerticalPanel panel = new VerticalPanel();
    panel.setStyleName("rhs-content-panel");

    ScrollPanel scroll = new ScrollPanel(panel);
    layout.add(scroll);
    layout.setWidgetTopHeight(scroll, 0, Style.Unit.PX, 100, Style.Unit.PCT);

    serverName = new HTML("Replace me");
    serverName.setStyleName("content-header-label");

    panel.add(serverName);
    panel.add(new ContentDescription("Configuration for JMS queues and topics."));

    TabPanel bottomLayout = new TabPanel();
    bottomLayout.addStyleName("default-tabpanel");
    bottomLayout.addStyleName("master_detail-detail");

    queueList = new JMSQueueList(presenter);
    bottomLayout.add(queueList.asWidget(), "Queues");

    topicList = new JMSTopicList(presenter);
    bottomLayout.add(topicList.asWidget(), "Topics");

    bottomLayout.selectTab(0);

    panel.add(bottomLayout);

    return layout;
}
 
Example 3
Source File: HelpDialog.java    From circuitjs1 with GNU General Public License v2.0 4 votes vote down vote up
HelpDialog() {
	super();
	vp = new VerticalPanel();
	setWidget(vp);
	setText(sim.LS("Help"));

	TabPanel tp = new TabPanel();
	vp.add(tp);
	String tab1Title = "EN";
	String tab2Title = "RU";
	String tab3Title = "PL";
	String tab4Title = "DE";
	String tab5Title = "DA";

	      //create tabs 
	tp.add(vpEN = new VerticalPanel(), tab1Title);
	vpEN.setWidth("500px");
	vpEN.add(new HTML("<iframe style=\"border:0;\" src=\"help/EN.html\" width=\"500\" height=\"400\" scrolling=\"auto\" frameborder=\"1\"></iframe>"));
	
	tp.add(vpRU = new VerticalPanel(), tab2Title);
	vpRU.setWidth("500px");
	vpRU.add(new HTML("<iframe style=\"border:0;\" src=\"help/RU.html\" width=\"500\" height=\"400\" scrolling=\"auto\" frameborder=\"1\"></iframe>"));

	tp.add(vpPL = new VerticalPanel(), tab3Title);
	vpPL.setWidth("500px");
	vpPL.add(new HTML("<iframe style=\"border:0;\" src=\"help/PL.html\" width=\"500\" height=\"400\" scrolling=\"auto\" frameborder=\"1\"></iframe>"));

	tp.add(vpDE = new VerticalPanel(), tab4Title);
	vpDE.setWidth("500px");
	vpDE.add(new HTML("<iframe style=\"border:0;\" src=\"help/DE.html\" width=\"500\" height=\"400\" scrolling=\"auto\" frameborder=\"1\"></iframe>"));

	tp.add(vpDA = new VerticalPanel(), tab5Title);
	vpDA.setWidth("500px");
	vpDA.add(new HTML("<iframe style=\"border:0;\" src=\"help/DA.html\" width=\"500\" height=\"400\" scrolling=\"auto\" frameborder=\"1\"></iframe>"));
	
	HorizontalPanel hp = new HorizontalPanel();
	hp.setWidth("100%");
	hp.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
	hp.setStyleName("topSpace");
	
	//select first tab
	tp.selectTab(0);

	//set width if tabpanel
	tp.setWidth("500");
	
	vp.add(hp);
	hp.add(okButton = new Button("OK"));
	okButton.addClickHandler(new ClickHandler() {
		public void onClick(ClickEvent event) {
			closeDialog();
		}
	});
	center();
	show();
}
 
Example 4
Source File: GalleryList.java    From appinventor-extensions with Apache License 2.0 4 votes vote down vote up
/**
 * Creates a new GalleryList
 */
public GalleryList() {

  gallery = GalleryClient.getInstance();
  gallery.addListener(this);
  galleryGF = new GalleryGuiFactory();

  selectedApps = new ArrayList<GalleryApp>();

  // Initialize UI
  galleryGUI = new FlowPanel();
  galleryGUI.addStyleName("gallery");
  appTabs = new TabPanel();
  appRecent = new FlowPanel();
  appFeatured = new FlowPanel();
  appPopular = new FlowPanel();
  appSearch = new FlowPanel();
  appTutorial = new FlowPanel();
  appRecentContent = new FlowPanel();
  appFeaturedContent = new FlowPanel();
  appPopularContent = new FlowPanel();
  appSearchContent = new FlowPanel();
  appTutorialContent = new FlowPanel();
  searchText = new TextBox();

  // HTML segment for gallery typeface
  HTML headerExtra = new HTML(
      "<link href='http://fonts.googleapis.com/css?" +
      "family=Roboto:400,300,100' rel='stylesheet' type='text/css'>");
  galleryGUI.add(headerExtra);

  // Add content to panels
  appFeaturedTab = new GalleryAppTab(appFeatured, appFeaturedContent, REQUEST_FEATURED);
  appRecentTab = new GalleryAppTab(appRecent, appRecentContent, REQUEST_RECENT);
  appSearchTab = new GalleryAppTab(appSearch, appSearchContent, REQUEST_SEARCH);
  appPopularTab = new GalleryAppTab(appPopular, appPopularContent, REQUEST_MOSTLIKED);
  appTutorialTab = new GalleryAppTab(appTutorial, appTutorialContent, REQUEST_TUTORIAL);
  // don't think we need because in regular addgallerytab below

  // Add panels to main tabPanel
  appTabs.add(appRecent, "Recent");
  appTabs.add(appTutorial,"Tutorials");
  appTabs.add(appFeatured, "Featured");
  appTabs.add(appPopular, "Popular");
  appTabs.add(appSearch, "Search");
  appTabs.selectTab(0);
  appTabs.addStyleName("gallery-app-tabs");
  galleryGUI.add(appTabs);

  // Initialize top-level GUI
  VerticalPanel panel = new VerticalPanel();
  panel.setWidth("100%");
  panel.add(galleryGUI);

  initWidget(panel);
}
 
Example 5
Source File: ConnectorList.java    From core with GNU Lesser General Public License v2.1 4 votes vote down vote up
@SuppressWarnings("unchecked")
Widget asWidget() {
    serverName = new ContentHeaderLabel();

    table = new DefaultCellTable<>(10, ActivemqConnector::getName);
    DefaultPager pager = new DefaultPager();
    pager.setDisplay(table);

    provider = new ListDataProvider<>();
    provider.addDataDisplay(table);

    Column<ActivemqConnector, String> name = new Column<ActivemqConnector, String>(new TextCell()) {
        @Override
        public String getValue(ActivemqConnector object) {
            return object.getName();
        }
    };

    table.addColumn(name, "Name");

    ToolStrip tools = new ToolStrip();
    tools.addToolButtonRight(
            new ToolButton(Console.CONSTANTS.common_label_add(),
                    clickEvent -> presenter.launchNewConnectorWizard(type)));

    tools.addToolButtonRight(
            new ToolButton(Console.CONSTANTS.common_label_remove(), clickEvent -> Feedback.confirm(
                    Console.MESSAGES.deleteTitle("Connector"),
                    Console.MESSAGES.deleteConfirm("Connector " + getSelectedEntity().getSocketBinding()),
                    isConfirmed -> {
                        if (isConfirmed) {
                            presenter.onDeleteConnector(getSelectedEntity());
                        }
                    })));

    connectorForm = new ConnectorForm(presenter, new FormToolStrip.FormCallback<ActivemqConnector>() {
        @Override
        public void onSave(Map<String, Object> changeset) {
            presenter.onSaveConnector(getSelectedEntity(), changeset);
        }

        @Override
        public void onDelete(ActivemqConnector entity) {}
    }, type);

    properties = new PropertyEditor(presenter, true);

    VerticalPanel layout = new VerticalPanel();
    layout.add(tools);
    layout.add(table);
    layout.add(pager);

    connectorForm.getForm().bind(table);

    TabPanel tabs = new TabPanel();
    tabs.setStyleName("default-tabpanel");
    tabs.getElement().setAttribute("style", "margin-top:15px;");
    tabs.addStyleName("master_detail-detail");

    tabs.add(connectorForm.asWidget(), Console.CONSTANTS.common_label_details());
    tabs.add(properties.asWidget(), Console.CONSTANTS.common_label_properties());

    layout.add(tabs);
    tabs.selectTab(0);

    table.getSelectionModel().addSelectionChangeHandler(selectionChangeEvent -> {
        List<PropertyRecord> props = getSelectedEntity().getParameter();
        String tokens = getSelectedEntity().getType().getResource() + "_#_" + getSelectedEntity().getName();
        properties.setProperties(tokens, props);
    });

    return layout;
}
 
Example 6
Source File: AcceptorList.java    From core with GNU Lesser General Public License v2.1 4 votes vote down vote up
@SuppressWarnings("unchecked")
Widget asWidget() {
    serverName = new ContentHeaderLabel();
    table = new DefaultCellTable<>(10, ActivemqAcceptor::getName);
    DefaultPager pager = new DefaultPager();
    pager.setDisplay(table);

    provider = new ListDataProvider<>();
    provider.addDataDisplay(table);

    Column<ActivemqAcceptor, String> name = new Column<ActivemqAcceptor, String>(new TextCell()) {
        @Override
        public String getValue(ActivemqAcceptor object) {
            return object.getName();
        }
    };
    table.addColumn(name, "Name");

    ToolStrip tools = new ToolStrip();
    tools.addToolButtonRight(
            new ToolButton(Console.CONSTANTS.common_label_add(),
                    clickEvent -> presenter.launchNewAcceptorWizard(type)));

    tools.addToolButtonRight(
            new ToolButton(Console.CONSTANTS.common_label_remove(), clickEvent -> Feedback.confirm(
                    Console.MESSAGES.deleteTitle("Acceptor"),
                    Console.MESSAGES.deleteConfirm("Acceptor " + getSelectedEntity().getSocketBinding()),
                    isConfirmed -> {
                        if (isConfirmed) {
                            presenter.onDeleteAcceptor(getSelectedEntity());
                        }
                    })));

    acceptorForm = new AcceptorForm(presenter, new FormToolStrip.FormCallback<ActivemqAcceptor>() {
        @Override
        public void onSave(Map<String, Object> changeset) {
            presenter.onSaveAcceptor(getSelectedEntity(), changeset);
        }

        @Override
        public void onDelete(ActivemqAcceptor entity) {}
    }, type);

    properties = new PropertyEditor(presenter, true);

    VerticalPanel layout = new VerticalPanel();
    layout.add(tools);
    layout.add(table);
    layout.add(pager);

    acceptorForm.getForm().bind(table);

    TabPanel tabs = new TabPanel();
    tabs.setStyleName("default-tabpanel");
    tabs.addStyleName("master_detail-detail");
    tabs.getElement().setAttribute("style", "margin-top:15px;");

    tabs.add(acceptorForm.asWidget(), Console.CONSTANTS.common_label_details());
    tabs.add(properties.asWidget(), Console.CONSTANTS.common_label_properties());

    layout.add(tabs);
    tabs.selectTab(0);

    table.getSelectionModel().addSelectionChangeHandler(selectionChangeEvent -> {
        List<PropertyRecord> props = getSelectedEntity().getParameter();
        String tokens = getSelectedEntity().getType().getResource() + "_#_" + getSelectedEntity().getName();
        properties.setProperties(tokens, props);
    });

    return layout;
}
 
Example 7
Source File: OneToOneLayout.java    From core with GNU Lesser General Public License v2.1 4 votes vote down vote up
public Widget build() {

        layout  = new LayoutPanel();
        layout.setStyleName("fill-layout");

        FakeTabPanel titleBar = null;
        if(!isPlain) {
            titleBar = new FakeTabPanel(title);
            layout.add(titleBar);
        }

        if(this.toolStrip !=null)
        {
            layout.add(toolStrip);
        }

        VerticalPanel panel = new VerticalPanel();
        panel.setStyleName("rhs-content-panel");

        ScrollPanel scroll = new ScrollPanel(panel);
        layout.add(scroll);

        // titlebar offset, if exists
        int offset = isPlain ? 0 : 40;

        if(toolStrip!=null)
        {
            if(!isPlain) layout.setWidgetTopHeight(titleBar, 0, Style.Unit.PX, 40, Style.Unit.PX);
            layout.setWidgetTopHeight(toolStrip, offset, Style.Unit.PX, 30, Style.Unit.PX);
            layout.setWidgetTopHeight(scroll, offset+30, Style.Unit.PX, 100, Style.Unit.PCT);
        }
        else
        {
            if(!isPlain) layout.setWidgetTopHeight(titleBar, 0, Style.Unit.PX, 40, Style.Unit.PX);
            layout.setWidgetTopHeight(scroll, offset, Style.Unit.PX, 100, Style.Unit.PCT);
        }


        if(null==headlineWidget)
        {
            panel.add(new ContentHeaderLabel(headline));
        }
        else
        {
            panel.add(headlineWidget);
        }

        panel.add(contentDescription);

        if(master!=null)
        {
            if(master.title!=null && !master.title.isEmpty())
                panel.add(new ContentGroupLabel(master.title));

            if(masterTools!=null) panel.add(masterTools);

            master.widget.getElement().setAttribute("role", "application");
            panel.add(master.widget);
        }

        // -----

        if(detail!=null)
        {
            detail.widget.getElement().addClassName("master_detail-detail");
            if(detail.title!=null && !detail.title.isEmpty())
                panel.add(new ContentGroupLabel(detail.title));
            panel.add(detail.widget);
            detail.widget.getElement().addClassName("fill-layout-width");
            detail.widget.getElement().setAttribute("role", "application");
        }
        else if(details.size()>0)
        {
            TabPanel tabs = new TabPanel();
            tabs.setStyleName("default-tabpanel");
            tabs.addStyleName("master_detail-detail");
            tabs.getElement().setAttribute("style", "margin-top:15px;");

            for(NamedWidget item : details)
            {
                tabs.add(item.widget, item.title);
                item.widget.getElement().addClassName("fill-layout-width");
                item.widget.getElement().setAttribute("role", "application");
            }

            panel.add(tabs);

            if(!details.isEmpty())
                tabs.selectTab(0);

        }

        //layout.getElement().setAttribute("style", "border:1px solid red");
        return layout;
    }
 
Example 8
Source File: ChoiceStrategy.java    From core with GNU Lesser General Public License v2.1 4 votes vote down vote up
private TabPanelContract createDefaultTabPanel(InteractionUnit interactionUnit, EventBus eventBus) {
    final TabPanel tabPanel = new TabPanel();
    tabPanel.setStyleName("default-tabpanel");

    tabPanel.addBeforeSelectionHandler(new NavigationHandler(interactionUnit, childUnits, tabPanel));

    /*tabPanel.addAttachHandler(new AttachEvent.Handler() {
        @Override
        public void onAttachOrDetach(AttachEvent attachEvent) {

            if(attachEvent.isAttached() && tabPanel.getWidgetCount()>0)
                tabPanel.selectTab(0);
        }
    });*/


    // activation listener
    eventBus.addHandler(SystemEvent.TYPE,
            new ChildActivationHandler<TabPanel>(tabPanel, childUnits, new ChildUnitCommand<TabPanel>() {
                @Override
                public void execute(TabPanel parent, int key) {
                    // TODO: this doesn't really work (rendering bugs) ...
                    parent.selectTab(key, false);
                    parent.getDeckPanel().showWidget(key); // workaround
                }
            })
    );

    TabPanelContract tabPanelContract = new TabPanelContract() {
        @Override
        public void add(InteractionUnit unit, Widget widget) {
            tabPanel.add(widget, unit.getLabel());

            // register tab2index mapping
            childUnits.put(tabPanel.getWidgetCount() - 1, unit.getId());
        }

        @Override
        public Widget as() {
            return tabPanel;
        }
    };

    // complement model

    getInteractionUnit().setOutputs(NAVIGATION);
    getInteractionUnit().setInputs(ACTIVATION);


    return tabPanelContract;
}
 
Example 9
Source File: JMSEditor.java    From core with GNU Lesser General Public License v2.1 3 votes vote down vote up
public Widget asWidget() {

        LayoutPanel layout = new LayoutPanel();

        VerticalPanel panel = new VerticalPanel();
        panel.setStyleName("rhs-content-panel");

        ScrollPanel scroll = new ScrollPanel(panel);
        layout.add(scroll);

        layout.setWidgetTopHeight(scroll, 0, Style.Unit.PX, 100, Style.Unit.PCT);

        // ---

        serverName = new HTML("Replace me");
        serverName.setStyleName("content-header-label");

        panel.add(serverName);
        panel.add(new ContentDescription("Queue and Topic destinations."));

        // ----

        TabPanel bottomLayout = new TabPanel();
        bottomLayout.addStyleName("default-tabpanel");
        bottomLayout.addStyleName("master_detail-detail");

        queueList = new QueueList(presenter);
        bottomLayout.add(queueList.asWidget(),"Queues");

        topicList = new TopicList(presenter);
        bottomLayout.add(topicList.asWidget(),"Topics");

        bottomLayout.selectTab(0);

        panel.add(bottomLayout);

        return layout;
    }