Example usage for com.vaadin.ui TabSheet TabSheet

List of usage examples for com.vaadin.ui TabSheet TabSheet

Introduction

In this page you can find the example usage for com.vaadin.ui TabSheet TabSheet.

Prototype

public TabSheet() 

Source Link

Document

Constructs a new TabSheet.

Usage

From source file:org.opennms.features.topology.app.internal.TopologyWidgetTestApplication.java

License:Open Source License

/**
 * Gets a {@link TabSheet} view for all widgets in this manager.
 * /*  ww  w. j a  v  a  2  s .c  o m*/
 * @return TabSheet
 */
private TabSheet getTabSheet(WidgetManager manager, WidgetContext widgetContext) {
    TabSheet tabSheet = new TabSheet();
    tabSheet.setSizeFull();

    for (IViewContribution viewContrib : manager.getWidgets()) {
        // Create a new view instance
        Component view = viewContrib.getView(widgetContext);
        try {
            m_selectionManager.addSelectionListener((SelectionListener) view);
        } catch (ClassCastException e) {
        }
        try {
            ((SelectionNotifier) view).addSelectionListener(m_selectionManager);
        } catch (ClassCastException e) {
        }
        if (viewContrib.getIcon() != null) {
            tabSheet.addTab(view, viewContrib.getTitle(), viewContrib.getIcon());
        } else {
            tabSheet.addTab(view, viewContrib.getTitle());
        }
        view.setSizeFull();
    }

    return tabSheet;
}

From source file:org.opennms.features.topology.netutils.internal.EventsAlarmsWindow.java

License:Open Source License

/**
 * The EventsAlarmsWindow method constructs a sub-window instance which can be added to a
 * main window. The sub-window contains two embedded browsers which are directed at the Events
 * and Alarms page of the selected node//from  www . j  av a 2  s. c o m
 * @param node Selected node
 * @param width Width of main window
 * @param height Height of main window
 * @throws MalformedURLException
 */
public EventsAlarmsWindow(final Node node, final URL eventsURL, final URL alarmsURL)
        throws MalformedURLException {
    super("Events & Alarms" + makeLabel(node));
    eventsBrowser = new Embedded("", new ExternalResource(eventsURL));
    eventsBrowser.setSizeFull();
    alarmsBrowser = new Embedded("", new ExternalResource(alarmsURL));
    alarmsBrowser.setSizeFull();

    setImmediate(true);
    setResizable(false);

    /*Adds the two browsers to separate tabs in a tabsheet layout*/
    m_tabSheet = new TabSheet();
    m_tabSheet.setSizeFull();
    m_tabSheet.addTab(eventsBrowser, "Events");
    m_tabSheet.addTab(alarmsBrowser, "Alarms");

    /*Adds tabsheet component to the main layout of the sub-window*/
    VerticalLayout layout = new VerticalLayout();
    layout.addComponent(m_tabSheet);
    layout.setSizeFull();
    setContent(layout);

}

From source file:org.opennms.features.vaadin.config.SnmpCollectionAdminApplication.java

License:Open Source License

@Override
public void init(VaadinRequest request) {
    if (dataCollectionDao == null)
        throw new RuntimeException("dataCollectionDao cannot be null.");

    TabSheet tabs = new TabSheet();
    tabs.addStyleName("light");
    tabs.setSizeFull();/*from w w  w .j  a  v  a  2  s .c  om*/
    tabs.addTab(new SnmpCollectionPanel(dataCollectionDao, new SimpleLogger()));
    tabs.addTab(new DataCollectionGroupAdminPanel(dataCollectionDao));

    setContent(tabs);
}

From source file:org.opennms.features.vaadin.datacollection.DataCollectionGroupPanel.java

License:Open Source License

/**
 * Instantiates a new data collection group panel.
 *
 * @param dataCollectionConfigDao the OpenNMS Data Collection Configuration DAO
 * @param group the data collection group object
 * @param logger the logger object/*ww w  . j a  v a 2  s  .c o  m*/
 * @param existingFile the existing file
 */
public DataCollectionGroupPanel(final DataCollectionConfigDao dataCollectionConfigDao,
        final DatacollectionGroup group, final Logger logger, final File existingFile) {
    this.existingFile = existingFile;

    setCaption("Data Collection");
    addStyleName("light");

    // Data Collection Group - Main Fields

    groupName.setPropertyDataSource(new ObjectProperty<String>(group.getName()));
    groupName.setNullSettingAllowed(false);
    groupName.setImmediate(true);
    if (isExistingGroup()) { // If we allow to rename an existing group, we should modify the SNMP Collection as well
        groupName.setEnabled(false);
    }

    boolean mibGroupEditable = !(isExistingGroup() && ResourceTypeUtils.isStoreByGroup());
    resourceTypes = new ResourceTypePanel(dataCollectionConfigDao, group, logger);
    groups = new GroupPanel(dataCollectionConfigDao, group, logger, mibGroupEditable);
    systemDefs = new SystemDefPanel(dataCollectionConfigDao, group, logger);

    // Button Toolbar

    final HorizontalLayout toolbar = new HorizontalLayout();
    toolbar.addComponent(new Button("Save Data Collection File", new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            processDataCollection(dataCollectionConfigDao, logger);
        }
    }));
    toolbar.addComponent(new Button("Cancel", new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            cancel();
            logger.info("Data collection processing has been canceled");
        }
    }));

    // Tab Panel

    final TabSheet tabs = new TabSheet();
    tabs.addStyleName("light");
    tabs.setSizeFull();
    tabs.addTab(resourceTypes, "Resource Types");
    tabs.addTab(groups, "MIB Groups");
    tabs.addTab(systemDefs, "System Definitions");

    // Main Layout

    final VerticalLayout mainLayout = new VerticalLayout();
    mainLayout.setSpacing(true);
    mainLayout.setMargin(true);
    mainLayout.addComponent(toolbar);
    mainLayout.addComponent(groupName);
    mainLayout.addComponent(tabs);
    mainLayout.setComponentAlignment(toolbar, Alignment.MIDDLE_RIGHT);
    setContent(mainLayout);
}

From source file:org.opennms.features.vaadin.nodemaps.internal.NodeMapsApplication.java

License:Open Source License

/**
 * Gets a {@link TabSheet} view for all widgets in this manager.
 * //from ww  w .j ava 2s.  c o  m
 * @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);

        // If the component supports the HasExtraComponents interface, then add the extra 
        // 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) {
                            // Bizarrely enough, getSelectedTab() returns the contained
                            // Component, not the Tab itself.
                            //
                            // 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;
}

From source file:org.ow2.sirocco.cloudmanager.MachineDetailView.java

License:Open Source License

public MachineDetailView(final MachineView machineView) {
    this.machineView = machineView;
    this.setSizeFull();
    this.setSpacing(true);
    this.setMargin(true);
    this.addStyleName("detailmargins");
    this.setVisible(false);
    this.title = new Label();
    this.title.setStyleName("detailTitle");
    this.addComponent(this.title);
    TabSheet tabSheet = new TabSheet();
    tabSheet.setSizeFull();/* w  ww  . jav  a 2  s .  c o  m*/

    VerticalLayout attributeTab = new VerticalLayout();
    attributeTab.setSizeFull();
    this.attributeTable = new Table();
    attributeTab.addComponent(this.attributeTable);
    this.attributeTable.setColumnHeaderMode(Table.ColumnHeaderMode.HIDDEN);
    this.attributeTable.setSizeFull();
    this.attributeTable.setPageLength(0);
    this.attributeTable.setSelectable(false);
    this.attributeTable.addContainerProperty("attribute", String.class, null);
    this.attributeTable.addContainerProperty("value", String.class, null);
    this.attributeTable.addContainerProperty("edit", Button.class, null);
    this.attributeTable.setColumnWidth("edit", 400);

    tabSheet.addTab(attributeTab, "Attributes");

    this.metadataView = new MetadataView(this);

    tabSheet.addTab(this.metadataView, "Metadata");
    this.addComponent(tabSheet);
    this.setExpandRatio(tabSheet, 1.0f);
}

From source file:org.ow2.sirocco.cloudmanager.MachineImageDetailView.java

License:Open Source License

public MachineImageDetailView(final MachineImageView machineImageView) {
    this.machineImageView = machineImageView;
    this.setSizeFull();
    this.setSpacing(true);
    this.setMargin(true);
    this.addStyleName("detailmargins");
    this.setVisible(false);
    this.title = new Label();
    this.title.setStyleName("detailTitle");
    this.addComponent(this.title);
    TabSheet tabSheet = new TabSheet();
    tabSheet.setSizeFull();/*  w  w  w .  j  a v  a  2  s .co m*/

    VerticalLayout attributeTab = new VerticalLayout();
    attributeTab.setSizeFull();
    this.attributeTable = new Table();
    attributeTab.addComponent(this.attributeTable);
    this.attributeTable.setColumnHeaderMode(Table.ColumnHeaderMode.HIDDEN);
    this.attributeTable.setSizeFull();
    this.attributeTable.setPageLength(0);
    this.attributeTable.setSelectable(false);
    this.attributeTable.addContainerProperty("attribute", String.class, null);
    this.attributeTable.addContainerProperty("value", String.class, null);
    this.attributeTable.addContainerProperty("edit", Button.class, null);
    this.attributeTable.setColumnWidth("edit", 400);

    tabSheet.addTab(attributeTab, "Attributes");

    this.metadataView = new MetadataView(this);

    tabSheet.addTab(this.metadataView, "Metadata");
    this.addComponent(tabSheet);
    this.setExpandRatio(tabSheet, 1.0f);
}

From source file:org.ow2.sirocco.cloudmanager.ProviderAccountDetailView.java

License:Open Source License

public ProviderAccountDetailView(final CloudProviderView providerView) {
    this.providerView = providerView;
    this.setSizeFull();
    this.setSpacing(true);
    this.setMargin(true);
    this.addStyleName("detailmargins");
    this.setVisible(false);
    this.title = new Label();
    this.title.setStyleName("detailTitle");
    this.addComponent(this.title);
    TabSheet tabSheet = new TabSheet();
    tabSheet.setSizeFull();/*from  w ww.j  a  v a2s.  c  o m*/

    VerticalLayout attributeTab = new VerticalLayout();
    attributeTab.setSizeFull();
    this.attributeTable = new Table();
    attributeTab.addComponent(this.attributeTable);
    this.attributeTable.setColumnHeaderMode(Table.ColumnHeaderMode.HIDDEN);
    this.attributeTable.setSizeFull();
    this.attributeTable.setPageLength(0);
    this.attributeTable.setSelectable(false);
    this.attributeTable.addContainerProperty("attribute", String.class, null);
    this.attributeTable.addContainerProperty("value", String.class, null);
    this.attributeTable.addContainerProperty("edit", Button.class, null);
    this.attributeTable.setColumnWidth("edit", 400);

    tabSheet.addTab(attributeTab, "Attributes");

    this.metadataView = new MetadataView(this);

    tabSheet.addTab(this.metadataView, "Metadata");
    this.addComponent(tabSheet);
    this.setExpandRatio(tabSheet, 1.0f);
}

From source file:org.ow2.sirocco.cloudmanager.SecurityGroupDetailView.java

License:Open Source License

public SecurityGroupDetailView(final SecurityGroupView securityGroupView) {
    this.securityGroupView = securityGroupView;
    this.setSizeFull();
    this.setSpacing(true);
    this.setMargin(true);
    this.addStyleName("detailmargins");
    this.setVisible(false);
    this.title = new Label();
    this.title.setStyleName("detailTitle");
    this.addComponent(this.title);
    TabSheet tabSheet = new TabSheet();
    tabSheet.setSizeFull();//from   w  w w . j  av a 2  s .  c o m

    VerticalLayout attributeTab = new VerticalLayout();
    attributeTab.setSizeFull();
    this.attributeTable = new Table();
    attributeTab.addComponent(this.attributeTable);
    this.attributeTable.setColumnHeaderMode(Table.ColumnHeaderMode.HIDDEN);
    this.attributeTable.setSizeFull();
    this.attributeTable.setPageLength(0);
    this.attributeTable.setSelectable(false);
    this.attributeTable.addContainerProperty("attribute", String.class, null);
    this.attributeTable.addContainerProperty("value", String.class, null);
    this.attributeTable.addContainerProperty("edit", Button.class, null);
    this.attributeTable.setColumnWidth("edit", 400);

    tabSheet.addTab(attributeTab, "Attributes");

    this.ruleView = new SecurityGroupRuleView();
    tabSheet.addTab(this.ruleView, "Rules");
    this.addComponent(tabSheet);
    this.setExpandRatio(tabSheet, 1.0f);
}

From source file:org.processbase.ui.servlet.MainWindow.java

License:Open Source License

public void initUI() {
    try {//from  ww  w. jav  a 2 s  .c  o m
        defineAccess();
        mainLayout = (VerticalLayout) getContent();
        mainLayout.removeAllComponents();
        mainLayout.setMargin(true);
        mainLayout.setSizeFull();
        mainLayout.addComponent(getHeader());
        tabs = new TabSheet();
        tabs.setSizeFull();
        mainLayout.addComponent(tabs);
        mainLayout.addComponent(tabs);
        mainLayout.setExpandRatio(tabs, 1);

        // prepare tabs

        prepareTabs();

        //            if (accessSet.contains("tasklist")) {
        //                consolePanel = new TaskListPanel();
        //                tabs.addTab(consolePanel, ProcessbaseApplication.getCurrent().getMessages().getString("bpmTasklist"), null);
        //            }
        //            if (accessSet.contains("bpm")) {
        //                bpmConfigurationPanel = new BPMConfigurationPanel();
        //                tabs.addTab(bpmConfigurationPanel, ProcessbaseApplication.getCurrent().getMessages().getString("bpmAdmin"), null);
        //            }
        //            if (accessSet.contains("identity")) {
        //                identityPanel = new IdentityPanel();
        //                tabs.addTab(identityPanel, ProcessbaseApplication.getCurrent().getMessages().getString("bpmIdentity"), null);
        //            }
        //            if (accessSet.contains("bam")) {
        //                bamConfigurationPanel = new BAMConfigurationPanel();
        //                tabs.addTab(bamConfigurationPanel, ProcessbaseApplication.getCurrent().getMessages().getString("bamAdmin"), null);
        //            }
        //            if (accessSet.contains("monitoring")) {
        //                bpmMonitoringPanel = new BPMMonitoringPanel();
        //                tabs.addTab(bpmMonitoringPanel, ProcessbaseApplication.getCurrent().getMessages().getString("bpmMonitoring"), null);
        //            }
        //            if (accessSet.contains("development")) {
        //                developmentPanel = new DevelopmentPanel();
        //                tabs.addTab(developmentPanel, ProcessbaseApplication.getCurrent().getMessages().getString("bpmDevelopment"), null);
        //            }
        //
        //            if (tabs.getSelectedTab() != null && tabs.getSelectedTab() instanceof PbPanel) {
        //                PbPanel first = (PbPanel) tabs.getSelectedTab();
        //                first.initUI();
        //                first.setInitialized(true);
        //                first.setSizeFull();
        //            }

        tabs.addListener((SelectedTabChangeListener) this);
        tabs.setImmediate(true);
    } catch (Exception ex) {
        ex.printStackTrace();
    }
}