Example usage for com.google.gwt.user.client.ui TabPanel selectTab

List of usage examples for com.google.gwt.user.client.ui TabPanel selectTab

Introduction

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

Prototype

public void selectTab(int index) 

Source Link

Document

Programmatically selects the specified tab and fires events.

Usage

From source file:com.xpn.xwiki.cbdf.client.CBDF.java

License:Open Source License

/**
* This method creates a Pop-up to display the color chooser and the opacity slider
 * @param isFill   boolean that represents if it's the fill color pop-up or the stroke color pop-up
 *///from w w w.j  a va  2s .com
private void showPopupColorFill(final boolean isFill) {

    final PopupPanel popupColor = new PopupPanel(true);
    popupColor.addStyleName("color_Pop-up");

    TabPanel tabPanel = new TabPanel();
    VerticalPanel colPanel = new VerticalPanel();
    colPanel.setSpacing(5);

    final ColorChooser colorChooser = new ColorChooser();

    colPanel.add(colorChooser);

    tabPanel.add(colPanel, new Label("Color"));

    ChangeListener colorChange = new ChangeListener() {
        public void onChange(Widget sender) {
            String color = colorChooser.getColor();
            Color colorSelected = Color.getColor(color);
            if (isFill) {
                currentFillColor = colorSelected;
                DOM.setStyleAttribute(fill.getElement(), "backgroundColor", color);
                currentFillColor.setAlpha(fillOpacity.getValue());
                if (curr_obj != null) {
                    curr_obj.uSetFillColor(currentFillColor);
                }
            } else {
                currentStrokeColor = colorSelected;
                DOM.setStyleAttribute(stroke.getElement(), "backgroundColor", color);
                currentStrokeColor.setAlpha(strokeOpacity.getValue());

                /** Mudar para grupos **/
                if (curr_obj != null) {
                    curr_obj.uSetStroke(currentStrokeColor, currentStrokeSize.getValue());
                }
            }
        }
    };
    colorChooser.addChangeListener(colorChange);

    if (isFill) {
        tabPanel.add(this.fillOpacity, new Label("Opacity"));
    } else {
        tabPanel.add(this.strokeOpacity, new Label("Opacity"));
    }

    tabPanel.selectTab(0);
    popupColor.add(tabPanel);
    popupColor.setPopupPosition(this.fill.getAbsoluteLeft(), this.stroke.getAbsoluteTop());
    popupColor.show();
}

From source file:de.lilawelt.zmachine.client.FileSelector.java

License:Open Source License

public FileSelector(String suggestedName, String saveData, AsyncCallback<String> callback, boolean save) {
    super(false); // do not auto-hide if user clicks outside
    Log.debug("FileSelector for save");

    GearsAdapterImpl g = GearsAdapter.get();
    Log.debug("Created Gears Interface");
    ServerAdapter p = new ServerAdapter();

    if (callback == null)
        Log.debug("null callback in FileSelector 2");

    FileSelectorImpl gearsSelector = new FileSelectorImpl(suggestedName, saveData, callback, g, save, this);
    Log.debug("Created Gears FileSelectorImpl");
    FileSelectorImpl phpSelector = new FileSelectorImpl(suggestedName, saveData, callback, p, save, this);

    TabPanel choices = new TabPanel();
    choices.add(phpSelector, "Server");
    choices.add(gearsSelector, "Local");
    choices.selectTab(0);
    Log.debug("Created TabPabel");

    setWidget(choices);//from  w w  w  . j  a v a  2s  . c o m
}

From source file:gwtquery.plugins.enhance.client.gwt.TabPanelWidgetFactory.java

License:Apache License

public TabPanel create(Element e) {
    TabPanel tabPanel = new TabPanel();

    GQuery tabs = $(options.getTabSelector(), e);
    GQuery titles = $(options.getTitleSelector(), e);

    for (int i = 0; i < tabs.length(); i++) {
        GQuery tab = tabs.eq(i);/*from   w w w. ja va2 s.  c o  m*/
        GQuery title = titles.eq(i);

        Widget tabWidget = tab.widget();
        if (tabWidget == null) {
            tabWidget = new WidgetsHtmlPanel(tab.get(0));
        }

        tabPanel.add(tabWidget, title.get(0) != null ? title.text() : "Tab " + (i + 1));

    }
    if (tabs.length() > 0) {
        tabPanel.selectTab(0);
    }

    WidgetsUtils.replaceOrAppend(e, tabPanel);
    return tabPanel;
}

From source file:io.pelle.mango.client.gwt.modules.property.PropertyModuleUI.java

License:Open Source License

public PropertyModuleUI(PropertyModule module) {
    super(module, PropertyModule.UI_MODULE_ID);

    title = new HTML(MangoClientWeb.getInstance().getMessages().properties());
    title.addStyleName(GwtStyles.TITLE);
    container.add(title);//from   w  ww  .  j  a  v  a 2 s .c  om

    TabPanel categories = new TabPanel();
    categories.setWidth("70%");

    for (IPropertyCategory category : getModule().getRootCategory().getCategories()) {
        FlowPanel categoryPanel = new FlowPanel();
        categoryPanel.getElement().getStyle().setMarginTop(1, Unit.EM);
        categories.add(categoryPanel, category.getName());
        createProperties(categoryPanel, category);
    }

    if (categories.getWidgetCount() > 0) {
        categories.selectTab(0);
        container.add(categories);
    }
}

From source file:net.officefloor.demo.stocks.client.StockGraphWidget.java

License:Open Source License

/**
 * Initiate.//from   www. j a v  a 2  s .  c om
 * 
 * @param historyPeriod
 *            Time in milliseconds to display history of prices.
 * @param redrawPeriod
 *            Time in milliseconds to allow before complete redraw of the
 *            graph.
 * @param width
 *            Width.
 * @param height
 *            Height.
 * @param stocks
 *            {@link Stock} instances to graph.
 */
public StockGraphWidget(final long historyPeriod, final long redrawPeriod, final String width,
        final String height, Stock... stocks) {

    // Create sorted copy of stocks
    final Stock[] orderedStocks = new Stock[stocks.length];
    for (int i = 0; i < orderedStocks.length; i++) {
        orderedStocks[i] = stocks[i];
    }
    Arrays.sort(orderedStocks, new Comparator<Stock>() {
        @Override
        public int compare(Stock a, Stock b) {
            return String.CASE_INSENSITIVE_ORDER.compare(a.getName(), b.getName());
        }
    });

    // Load the chart visualisation
    Runnable loadGraph = new Runnable() {
        @Override
        public void run() {

            // Provide tab panel for graphs
            TabPanel tab = new TabPanel();
            tab.setWidth(width);
            tab.getTabBar().setWidth(width);
            tab.getDeckPanel().setWidth(width);
            StockGraphWidget.this.add(tab);

            // Load each graph onto a tab
            final StockGraph[] graphs = new StockGraph[orderedStocks.length];
            for (int i = 0; i < orderedStocks.length; i++) {
                Stock stock = orderedStocks[i];

                // Create the stock graph
                StockGraph graph = new StockGraph(stock, historyPeriod, redrawPeriod, width, height);
                graphs[i] = graph;

                // Add the stock graph
                tab.add(graph.getChart(), stock.getName());
            }

            // Provide the selection handler
            tab.addSelectionHandler(new SelectionHandler<Integer>() {
                @Override
                public void onSelection(SelectionEvent<Integer> event) {

                    // Unselect all graphs
                    for (StockGraph graph : graphs) {
                        graph.setSelected(false);
                    }

                    // Select the graph for the tab
                    Integer tabIndex = event.getSelectedItem();
                    graphs[tabIndex.intValue()].setSelected(true);
                }
            });

            // Display first tab selected (also sets up graph)
            tab.selectTab(0);
        }
    };
    VisualizationUtils.loadVisualizationApi(loadGraph, AnnotatedTimeLine.PACKAGE);
}

From source file:org.datacleaner.monitor.dashboard.widgets.CustomizeTimelineHandler.java

License:Open Source License

private Widget createPopupContent() {
    _customizeMetricsPanel = new CustomizeMetricsPanel(_service, _timelinePanel.getTenantIdentifier(),
            _timelinePanel.getTimelineDefinition()) {
        @Override/*w  ww .j  a  v  a2s .co m*/
        protected void onMetricsLoaded() {
            super.onMetricsLoaded();
            _popup.center();
        }
    };
    _customizeChartOptionsPanel = new CustomizeChartOptionsPanel(
            _timelinePanel.getTimelineDefinition().getChartOptions());

    final TabPanel tabPanel = new TabPanel();
    tabPanel.add(_customizeMetricsPanel, "Metrics");
    tabPanel.add(_customizeChartOptionsPanel, "Chart options");
    tabPanel.selectTab(0);

    return tabPanel;
}

From source file:org.dataconservancy.dcs.access.client.model.JsEvent.java

License:Apache License

public static void display(Panel panel, JsArray<JsEvent> array) {
    if (array.length() == 1) {
        Widget w = array.get(0).display();
        w.setStylePrimaryName("Entity");
        panel.add(w);//from w  ww.  jav  a2s . co m
        return;
    }

    TabPanel tabs = new DecoratedTabPanel();
    tabs.setAnimationEnabled(true);

    for (int i = 0; i < array.length(); i++) {
        JsEvent event = array.get(i);

        tabs.add(event.display(), event.getEventType());
    }

    if (array.length() > 0) {
        tabs.selectTab(0);
    }

    panel.add(tabs);
}

From source file:org.dataconservancy.dcs.access.client.model.JsFile.java

License:Apache License

public static void display(Panel panel, JsArray<JsFile> array) {
    if (array.length() == 1) {
        Widget w = array.get(0).display();
        w.setStylePrimaryName("Entity");
        panel.add(w);/*from  w w  w  .  ja v  a2  s  .c  om*/
        return;
    }

    TabPanel tabs = new DecoratedTabPanel();
    ScrollPanel top = new ScrollPanel(tabs);
    top.setStylePrimaryName("Entity");

    tabs.setAnimationEnabled(true);

    for (int i = 0; i < array.length(); i++) {
        JsFile file = array.get(i);

        tabs.add(file.display(), file.getName());
    }

    if (array.length() > 0) {
        tabs.selectTab(0);
    }

    panel.add(top);
}

From source file:org.dataconservancy.dcs.access.client.model.JsManifestation.java

License:Apache License

public static void display(Panel panel, JsArray<JsManifestation> array) {
    if (array.length() == 1) {
        Widget w = array.get(0).display();
        w.setStylePrimaryName("Entity");
        panel.add(w);//from   w ww  .  j a va 2 s.  co  m
        return;
    }

    TabPanel tabs = new DecoratedTabPanel();
    ScrollPanel top = new ScrollPanel(tabs);
    top.setStylePrimaryName("Entity");
    tabs.setAnimationEnabled(true);

    for (int i = 0; i < array.length(); i++) {
        JsManifestation man = array.get(i);

        tabs.add(man.display(), man.summary());
    }

    if (array.length() > 0) {
        tabs.selectTab(0);
    }

    panel.add(top);
}

From source file:org.dataconservancy.dcs.access.client.ui.UploadCollectionDialog.java

License:Apache License

public UploadCollectionDialog(final TabPanel files, final TabPanel dus, final List<String> fileids,
        final List<String> duids, final List<String> colids, String fileUploadUrl) {

    for (int i = 0; i < 3; i++) {
        files.setVisible(true);//from   w w w.ja v a 2  s. c  om
        String id = nextFileId();
        fileids.add(id);
        files.add(new FileEditor(id, "test", "test"), id);
        files.selectTab(files.getWidgetCount() - 1);
    }
    for (int i = 0; i < 3; i++) {
        dus.setVisible(true);
        String id = nextDeliverableUnitId();
        duids.add(id);
        dus.add(new DeliverableUnitEditor(id, fileids, duids, colids, null), id);
        dus.selectTab(dus.getWidgetCount() - 1);
    }
}