Search in sources :

Example 6 with TabSheet

use of com.vaadin.ui.TabSheet in project opennms by OpenNMS.

the class TopologyUI method getTabSheet.

/**
 * Gets a {@link TabSheet} view for all widgets in this manager.
 *
 * @return TabSheet
 */
private Component getTabSheet(WidgetManager manager, WidgetContext widgetContext) {
    // Use an absolute layout for the bottom panel
    AbsoluteLayout bottomLayout = new AbsoluteLayout();
    bottomLayout.setSizeFull();
    tabSheet = new TabSheet();
    tabSheet.setSizeFull();
    for (IViewContribution viewContrib : manager.getWidgets()) {
        // Create a new view instance
        final Component view = viewContrib.getView(m_applicationContext, widgetContext);
        try {
            m_graphContainer.getSelectionManager().addSelectionListener((SelectionListener) view);
        } catch (ClassCastException e) {
        }
        try {
            ((SelectionNotifier) view).addSelectionListener(m_graphContainer.getSelectionManager());
        } catch (ClassCastException e) {
        }
        try {
            m_graphContainer.addChangeListener((GraphContainer.ChangeListener) view);
        } catch (ClassCastException e) {
        }
        // Icon can be null
        tabSheet.addTab(view, viewContrib.getTitle(), viewContrib.getIcon());
        // components to the tab bar
        try {
            Component[] extras = ((HasExtraComponents) view).getExtraComponents();
            if (extras != null && extras.length > 0) {
                // For any extra controls, add a horizontal layout that will float
                // on top of the right side of the tab panel
                final HorizontalLayout extraControls = new HorizontalLayout();
                extraControls.setHeight(32, Unit.PIXELS);
                extraControls.setSpacing(true);
                // Add the extra controls to the layout
                for (Component component : extras) {
                    extraControls.addComponent(component);
                    extraControls.setComponentAlignment(component, Alignment.MIDDLE_RIGHT);
                }
                // Add a TabSheet.SelectedTabChangeListener to show or hide the extra controls
                tabSheet.addSelectedTabChangeListener(new SelectedTabChangeListener() {

                    private static final long serialVersionUID = 6370347645872323830L;

                    @Override
                    public void selectedTabChange(SelectedTabChangeEvent event) {
                        final TabSheet source = (TabSheet) event.getSource();
                        if (source == tabSheet) {
                            // If the first tab was selected...
                            if (source.getSelectedTab() == view) {
                                extraControls.setVisible(true);
                            } else {
                                extraControls.setVisible(false);
                            }
                        }
                    }
                });
                // Place the extra controls on the absolute layout
                bottomLayout.addComponent(extraControls, "top:0px;right:5px;z-index:100");
            }
        } catch (ClassCastException e) {
        }
        view.setSizeFull();
    }
    // Add the tabsheet to the layout
    bottomLayout.addComponent(tabSheet, "top: 0; left: 0; bottom: 0; right: 0;");
    return bottomLayout;
}
Also used : HasExtraComponents(org.opennms.features.topology.api.HasExtraComponents) AbsoluteLayout(com.vaadin.ui.AbsoluteLayout) HorizontalLayout(com.vaadin.ui.HorizontalLayout) GraphContainer(org.opennms.features.topology.api.GraphContainer) SelectionNotifier(org.opennms.features.topology.api.SelectionNotifier) SelectedTabChangeEvent(com.vaadin.ui.TabSheet.SelectedTabChangeEvent) TabSheet(com.vaadin.ui.TabSheet) IViewContribution(org.opennms.features.topology.api.IViewContribution) SelectedTabChangeListener(com.vaadin.ui.TabSheet.SelectedTabChangeListener) LayoutHintComponent(org.opennms.features.topology.app.internal.ui.LayoutHintComponent) BreadcrumbComponent(org.opennms.features.topology.app.internal.ui.breadcrumbs.BreadcrumbComponent) Component(com.vaadin.ui.Component)

Example 7 with TabSheet

use of com.vaadin.ui.TabSheet in project opennms by OpenNMS.

the class NodeMapsApplication method getTabSheet.

/**
 * Gets a {@link TabSheet} view for all widgets in this manager.
 *
 * @return TabSheet
 */
private Component getTabSheet() {
    // Use an absolute layout for the bottom panel
    AbsoluteLayout bottomLayout = new AbsoluteLayout();
    bottomLayout.setSizeFull();
    final TabSheet tabSheet = new TabSheet();
    tabSheet.setSizeFull();
    for (final SelectionAwareTable view : new SelectionAwareTable[] { m_alarmTable, m_nodeTable }) {
        // Icon can be null
        tabSheet.addTab(view, (view == m_alarmTable ? "Alarms" : "Nodes"), null);
        // components to the tab bar
        try {
            final Component[] extras = ((HasExtraComponents) view).getExtraComponents();
            if (extras != null && extras.length > 0) {
                // For any extra controls, add a horizontal layout that will float
                // on top of the right side of the tab panel
                final HorizontalLayout extraControls = new HorizontalLayout();
                extraControls.setHeight(32, Unit.PIXELS);
                extraControls.setSpacing(true);
                // Add the extra controls to the layout
                for (final Component component : extras) {
                    extraControls.addComponent(component);
                    extraControls.setComponentAlignment(component, Alignment.MIDDLE_RIGHT);
                }
                // Add a TabSheet.SelectedTabChangeListener to show or hide the extra controls
                tabSheet.addSelectedTabChangeListener(new SelectedTabChangeListener() {

                    @Override
                    public void selectedTabChange(final SelectedTabChangeEvent event) {
                        final TabSheet source = (TabSheet) event.getSource();
                        if (source == tabSheet) {
                            // If the first tab was selected...
                            if (source.getSelectedTab() == view) {
                                extraControls.setVisible(true);
                            } else {
                                extraControls.setVisible(false);
                            }
                        }
                    }
                });
                // Place the extra controls on the absolute layout
                bottomLayout.addComponent(extraControls, "top:0px;right:5px;z-index:100");
            }
        } catch (ClassCastException e) {
        }
        view.setSizeFull();
    }
    // Add the tabsheet to the layout
    bottomLayout.addComponent(tabSheet, "top: 0; left: 0; bottom: 0; right: 0;");
    return bottomLayout;
}
Also used : HasExtraComponents(org.opennms.features.topology.api.HasExtraComponents) SelectedTabChangeEvent(com.vaadin.ui.TabSheet.SelectedTabChangeEvent) SelectionAwareTable(org.opennms.features.topology.api.browsers.SelectionAwareTable) TabSheet(com.vaadin.ui.TabSheet) SelectedTabChangeListener(com.vaadin.ui.TabSheet.SelectedTabChangeListener) Component(com.vaadin.ui.Component) AbsoluteLayout(com.vaadin.ui.AbsoluteLayout) HorizontalLayout(com.vaadin.ui.HorizontalLayout)

Example 8 with TabSheet

use of com.vaadin.ui.TabSheet in project charts by vaadin.

the class ChartWithLazyDrilldownInTabSheet method getChart.

/**
 * Test UI for #483.
 *
 * To reproduce issue:
 * <ul>
 * <li>Click on IE</li>
 * <li>Change to second tab</li>
 * <li>Change to first tab</li>
 * <li>Click on opera</li>
 * </ul>
 */
@Override
protected Component getChart() {
    TabSheet tabs = new TabSheet();
    tabs.setSizeFull();
    Chart chart = (Chart) new ColumnWithNativeLazyDrilldown().getChart();
    tabs.addTab(chart, "First tab with chart");
    Label label = new Label("second tab content");
    tabs.addTab(label, "Other tab");
    return tabs;
}
Also used : TabSheet(com.vaadin.ui.TabSheet) Label(com.vaadin.ui.Label) Chart(com.vaadin.addon.charts.Chart)

Example 9 with TabSheet

use of com.vaadin.ui.TabSheet in project cia by Hack23.

the class AbstractPageModContentFactoryImpl method createPageVisitHistory.

/**
 * Creates the page visit history.
 *
 * @param pageName
 *            the page name
 * @param pageId
 *            the page id
 * @param panelContent
 *            the panel content
 */
protected final void createPageVisitHistory(final String pageName, final String pageId, final VerticalLayout panelContent) {
    final TabSheet tabsheet = new TabSheet();
    tabsheet.setWidth(100, Unit.PERCENTAGE);
    tabsheet.setHeight(100, Unit.PERCENTAGE);
    panelContent.addComponent(tabsheet);
    panelContent.setExpandRatio(tabsheet, ContentRatio.LARGE);
    final HorizontalLayout tabContentPageItemRankHistory = new HorizontalLayout();
    tabContentPageItemRankHistory.setWidth(100, Unit.PERCENTAGE);
    tabContentPageItemRankHistory.setHeight(100, Unit.PERCENTAGE);
    final Tab tabPageItemRankHistory = tabsheet.addTab(tabContentPageItemRankHistory);
    tabPageItemRankHistory.setCaption(CURRENT_PAGE_VISIT_HISTORY);
    adminChartDataManager.createApplicationActionEventPageElementDailySummaryChart(tabContentPageItemRankHistory, pageName, pageId);
    final HorizontalLayout tabContentPageModeSummary = new HorizontalLayout();
    tabContentPageModeSummary.setWidth(100, Unit.PERCENTAGE);
    tabContentPageModeSummary.setHeight(100, Unit.PERCENTAGE);
    final Tab tabPageModeSummary = tabsheet.addTab(tabContentPageModeSummary);
    tabPageModeSummary.setCaption(GENERAL_PAGE_MODE_PAGE_VISIT);
    adminChartDataManager.createApplicationActionEventPageModeDailySummaryChart(tabContentPageModeSummary, pageName);
}
Also used : Tab(com.vaadin.ui.TabSheet.Tab) TabSheet(com.vaadin.ui.TabSheet) HorizontalLayout(com.vaadin.ui.HorizontalLayout)

Example 10 with TabSheet

use of com.vaadin.ui.TabSheet in project charts by vaadin.

the class ChartsDemoUI method init.

@Override
protected void init(VaadinRequest request) {
    initGATracker();
    tabSheet = new TabSheet();
    tabSheet.addSelectedTabChangeListener(new TabSheet.SelectedTabChangeListener() {

        @Override
        public void selectedTabChange(TabSheet.SelectedTabChangeEvent event) {
            com.vaadin.ui.JavaScript.eval("setTimeout(function(){prettyPrint();},300);");
        }
    });
    tabSheet.setSizeFull();
    tabSheet.addStyleName(ValoTheme.TABSHEET_PADDED_TABBAR);
    Link homepage = new Link("Home page", new ExternalResource("https://vaadin.com/add-ons/charts"));
    Link javadoc = new Link("JavaDoc", new ExternalResource("http://demo.vaadin.com/javadoc/com.vaadin/vaadin-charts/" + getVersion() + "/"));
    Link manual = new Link("Manual", new ExternalResource("https://vaadin.com/docs/-/part/charts/charts-overview.html"));
    Label version = new Label("Version " + getVersion());
    version.addStyleName("version");
    HorizontalLayout links = new HorizontalLayout(homepage, javadoc, manual);
    links.setSpacing(true);
    links.addStyleName("links");
    final HorizontalSplitPanel horizontalSplitPanel = new HorizontalSplitPanel();
    horizontalSplitPanel.setSecondComponent(tabSheet);
    horizontalSplitPanel.setSplitPosition(300, Unit.PIXELS);
    horizontalSplitPanel.addStyleName("main-layout");
    ChartOptions.get().setTheme(new ValoLightTheme());
    themeSelector = new ComboBox("Charts Theme:");
    themeSelector.addStyleName("theme-selector");
    themeSelector.addStyleName(ValoTheme.COMBOBOX_SMALL);
    themeSelector.setTextInputAllowed(false);
    com.vaadin.addon.charts.model.style.Theme defaultTheme = new ValoLightTheme();
    Map<com.vaadin.addon.charts.model.style.Theme, String> mapThemes = new HashMap<>();
    com.vaadin.addon.charts.model.style.Theme[] themes = new com.vaadin.addon.charts.model.style.Theme[] { defaultTheme, new ValoDarkTheme(), new VaadinTheme(), new HighChartsDefaultTheme(), new GridTheme(), new GrayTheme(), new SkiesTheme() };
    mapThemes.put(themes[0], "Valo Light");
    mapThemes.put(themes[1], "Valo Dark");
    mapThemes.put(themes[2], "Vaadin");
    mapThemes.put(themes[3], "HighCharts");
    mapThemes.put(themes[4], "Grid");
    mapThemes.put(themes[5], "Gray");
    mapThemes.put(themes[6], "Skies");
    themeSelector.setEmptySelectionAllowed(false);
    themeSelector.setItems(themes);
    themeSelector.setSelectedItem(defaultTheme);
    themeSelector.setItemCaptionGenerator(mapThemes::get);
    themeSelector.addSelectionListener(e -> {
        ChartOptions.get().setTheme(e.getValue());
    });
    final HierarchicalContainer container = getContainer();
    VerticalLayout content = new VerticalLayout();
    content.setSpacing(true);
    content.setMargin(false);
    Label logo = new Label("Vaadin Charts");
    logo.setWidth("100%");
    logo.addStyleName("h3");
    logo.addStyleName("logo");
    TextField filterField = new TextField();
    filterField.setPlaceholder("Filter examples");
    filterField.setIcon(FontAwesome.SEARCH);
    filterField.addStyleName("filter");
    filterField.setWidth("100%");
    filterField.addValueChangeListener(e -> {
        container.removeAllContainerFilters();
        String text = e.getValue();
        if (text != null && !text.isEmpty()) {
            expandForFiltering();
            container.addContainerFilter("searchName", text, true, false);
        } else {
            restoreExpandedStates();
        }
    });
    tree = new Tree();
    tree.setImmediate(true);
    tree.setContainerDataSource(container);
    tree.setItemCaptionPropertyId("displayName");
    tree.setNullSelectionAllowed(false);
    tree.setWidth("100%");
    tree.addValueChangeListener(new Property.ValueChangeListener() {

        @Override
        public void valueChange(Property.ValueChangeEvent event) {
            Object value = event.getProperty().getValue();
            if (value instanceof Class) {
                updateTabSheet((Class) value);
            } else {
                tree.expandItemsRecursively(value);
            }
        }
    });
    Button feedback = new Button("Got feedback?", FontAwesome.COMMENTING_O);
    feedback.addStyleName("feedback-button");
    feedback.addStyleName(ValoTheme.BUTTON_PRIMARY);
    feedback.addStyleName(ValoTheme.BUTTON_TINY);
    feedback.addClickListener(e -> {
        getUI().addWindow(new FeedbackForm());
    });
    content.addComponents(logo, links, feedback, filterField, tree, version);
    content.setComponentAlignment(feedback, Alignment.MIDDLE_CENTER);
    horizontalSplitPanel.setFirstComponent(content);
    selectItem();
    Page.getCurrent().addUriFragmentChangedListener(new Page.UriFragmentChangedListener() {

        @Override
        public void uriFragmentChanged(Page.UriFragmentChangedEvent event) {
            selectItem();
        }
    });
    setContent(new CssLayout() {

        {
            setSizeFull();
            addComponent(horizontalSplitPanel);
            addComponent(themeSelector);
        }
    });
    if (tracker != null) {
        tracker.trackPageview("/charts");
    }
}
Also used : SkiesTheme(com.vaadin.addon.charts.themes.SkiesTheme) HighChartsDefaultTheme(com.vaadin.addon.charts.themes.HighChartsDefaultTheme) ValoLightTheme(com.vaadin.addon.charts.themes.ValoLightTheme) HashMap(java.util.HashMap) Label(com.vaadin.ui.Label) VaadinTheme(com.vaadin.addon.charts.themes.VaadinTheme) Page(com.vaadin.server.Page) GrayTheme(com.vaadin.addon.charts.themes.GrayTheme) HorizontalLayout(com.vaadin.ui.HorizontalLayout) ValoDarkTheme(com.vaadin.addon.charts.themes.ValoDarkTheme) CssLayout(com.vaadin.ui.CssLayout) Button(com.vaadin.ui.Button) VerticalLayout(com.vaadin.ui.VerticalLayout) TextField(com.vaadin.ui.TextField) Tree(com.vaadin.v7.ui.Tree) Property(com.vaadin.v7.data.Property) ComboBox(com.vaadin.ui.ComboBox) GridTheme(com.vaadin.addon.charts.themes.GridTheme) ExternalResource(com.vaadin.server.ExternalResource) TabSheet(com.vaadin.ui.TabSheet) HorizontalSplitPanel(com.vaadin.ui.HorizontalSplitPanel) ValoLightTheme(com.vaadin.addon.charts.themes.ValoLightTheme) ValoDarkTheme(com.vaadin.addon.charts.themes.ValoDarkTheme) ValoTheme(com.vaadin.ui.themes.ValoTheme) Theme(com.vaadin.annotations.Theme) GrayTheme(com.vaadin.addon.charts.themes.GrayTheme) VaadinTheme(com.vaadin.addon.charts.themes.VaadinTheme) GridTheme(com.vaadin.addon.charts.themes.GridTheme) HighChartsDefaultTheme(com.vaadin.addon.charts.themes.HighChartsDefaultTheme) SkiesTheme(com.vaadin.addon.charts.themes.SkiesTheme) HierarchicalContainer(com.vaadin.v7.data.util.HierarchicalContainer) Link(com.vaadin.ui.Link)

Aggregations

TabSheet (com.vaadin.ui.TabSheet)14 HorizontalLayout (com.vaadin.ui.HorizontalLayout)7 VerticalLayout (com.vaadin.ui.VerticalLayout)5 Button (com.vaadin.ui.Button)3 Component (com.vaadin.ui.Component)3 AbsoluteLayout (com.vaadin.ui.AbsoluteLayout)2 ClickListener (com.vaadin.ui.Button.ClickListener)2 Label (com.vaadin.ui.Label)2 SelectedTabChangeEvent (com.vaadin.ui.TabSheet.SelectedTabChangeEvent)2 SelectedTabChangeListener (com.vaadin.ui.TabSheet.SelectedTabChangeListener)2 Tab (com.vaadin.ui.TabSheet.Tab)2 HashMap (java.util.HashMap)2 HasExtraComponents (org.opennms.features.topology.api.HasExtraComponents)2 FormHelper (au.com.vaadinutils.crud.FormHelper)1 CKEditorEmailField (au.com.vaadinutils.fields.CKEditorEmailField)1 OutputFormat (au.com.vaadinutils.jasper.JasperManager.OutputFormat)1 ReportEmailScheduleEntity (au.com.vaadinutils.jasper.scheduler.entities.ReportEmailScheduleEntity)1 ReportEmailSender (au.com.vaadinutils.jasper.scheduler.entities.ReportEmailSender)1 TopVerticalLayout (au.com.vaadinutils.layout.TopVerticalLayout)1 RiksdagenVoteDataBallotEmbeddedId (com.hack23.cia.model.internal.application.data.committee.impl.RiksdagenVoteDataBallotEmbeddedId)1