Example usage for com.vaadin.ui TabSheet addTab

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

Introduction

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

Prototype

public Tab addTab(Component component, int position) 

Source Link

Document

Adds a new tab into TabSheet.

Usage

From source file:org.ikasan.dashboard.ui.topology.window.ErrorOccurrenceViewWindow.java

License:BSD License

protected Panel createErrorOccurrenceDetailsPanel() {
    Panel errorOccurrenceDetailsPanel = new Panel();

    GridLayout layout = new GridLayout(2, 6);
    layout.setSizeFull();/*from  www  . j a va2s . c  o  m*/
    layout.setSpacing(true);
    layout.setColumnExpandRatio(0, 0.25f);
    layout.setColumnExpandRatio(1, 0.75f);

    Label errorOccurrenceDetailsLabel = new Label("Error Occurence Details");
    errorOccurrenceDetailsLabel.setStyleName(ValoTheme.LABEL_HUGE);
    layout.addComponent(errorOccurrenceDetailsLabel);

    Label label = new Label("Module Name:");
    label.setSizeUndefined();
    layout.addComponent(label, 0, 1);
    layout.setComponentAlignment(label, Alignment.MIDDLE_RIGHT);

    TextField tf1 = new TextField();
    tf1.setValue(this.errorOccurrence.getModuleName());
    tf1.setReadOnly(true);
    tf1.setWidth("80%");
    layout.addComponent(tf1, 1, 1);

    label = new Label("Flow Name:");
    label.setSizeUndefined();
    layout.addComponent(label, 0, 2);
    layout.setComponentAlignment(label, Alignment.MIDDLE_RIGHT);

    TextField tf2 = new TextField();
    tf2.setValue(this.errorOccurrence.getFlowName());
    tf2.setReadOnly(true);
    tf2.setWidth("80%");
    layout.addComponent(tf2, 1, 2);

    label = new Label("Component Name:");
    label.setSizeUndefined();
    layout.addComponent(label, 0, 3);
    layout.setComponentAlignment(label, Alignment.MIDDLE_RIGHT);

    TextField tf3 = new TextField();
    tf3.setValue(this.errorOccurrence.getFlowElementName());
    tf3.setReadOnly(true);
    tf3.setWidth("80%");
    layout.addComponent(tf3, 1, 3);

    label = new Label("Date/Time:");
    label.setSizeUndefined();
    layout.addComponent(label, 0, 4);
    layout.setComponentAlignment(label, Alignment.MIDDLE_RIGHT);

    TextField tf4 = new TextField();
    tf4.setValue(new Date(this.errorOccurrence.getTimestamp()).toString());
    tf4.setReadOnly(true);
    tf4.setWidth("80%");
    layout.addComponent(tf4, 1, 4);

    label = new Label("Error Message:");
    label.setSizeUndefined();
    layout.addComponent(label, 0, 5);
    layout.setComponentAlignment(label, Alignment.TOP_RIGHT);

    TextArea tf5 = new TextArea();
    tf5.setValue(this.errorOccurrence.getErrorMessage());
    tf5.setReadOnly(true);
    tf5.setWidth("80%");
    tf5.setRows(3);
    layout.addComponent(tf5, 1, 5);

    GridLayout wrapperLayout = new GridLayout(1, 4);
    wrapperLayout.setMargin(true);
    wrapperLayout.setWidth("100%");

    TabSheet tabsheet = new TabSheet();
    tabsheet.setSizeFull();

    AceEditor editor = new AceEditor();
    //      editor.setCaption("Error Details");
    editor.setValue(this.errorOccurrence.getErrorDetail());
    editor.setReadOnly(true);
    editor.setMode(AceMode.xml);
    editor.setTheme(AceTheme.eclipse);
    editor.setHeight(470, Unit.PIXELS);
    editor.setWidth("100%");

    AceEditor eventEditor = new AceEditor();
    //      eventEditor.setCaption("Event Payload");

    if (this.errorOccurrence.getEvent() != null) {
        eventEditor.setValue(new String((byte[]) this.errorOccurrence.getEvent()));
    }

    eventEditor.setReadOnly(true);
    eventEditor.setMode(AceMode.java);
    eventEditor.setTheme(AceTheme.eclipse);
    eventEditor.setHeight(470, Unit.PIXELS);
    eventEditor.setWidth("100%");

    HorizontalLayout formLayout = new HorizontalLayout();
    formLayout.setWidth("100%");
    formLayout.setHeight(230, Unit.PIXELS);
    formLayout.addComponent(layout);
    wrapperLayout.addComponent(formLayout, 0, 0);

    //      VerticalSplitPanel vSplitPanel = new VerticalSplitPanel();
    //      vSplitPanel.setWidth("100%");
    //      vSplitPanel.setHeight(800, Unit.PIXELS);
    //      vSplitPanel.addStyleName(ValoTheme.SPLITPANEL_LARGE);

    HorizontalLayout h1 = new HorizontalLayout();
    h1.setSizeFull();
    h1.setMargin(true);
    h1.addComponent(eventEditor);
    //      vSplitPanel.setFirstComponent(h1);

    HorizontalLayout h2 = new HorizontalLayout();
    h2.setSizeFull();
    h2.setMargin(true);
    h2.addComponent(editor);
    //      vSplitPanel.setSecondComponent(h2);

    tabsheet.addTab(h2, "Error Details");
    tabsheet.addTab(h1, "Event Payload");

    wrapperLayout.addComponent(tabsheet, 0, 1);

    errorOccurrenceDetailsPanel.setContent(wrapperLayout);
    return errorOccurrenceDetailsPanel;
}

From source file:org.lunifera.example.vaadin.databinding.DatabindingDemoUI.java

License:Apache License

@Override
protected void init(VaadinRequest request) {

    VaadinObservables.getRealm(getUI());

    CssLayout layout = new CssLayout();
    layout.setSizeFull();/*from w w  w  .j  av a 2s . c om*/
    setContent(layout);

    TabSheet tabsheet = new TabSheet();
    tabsheet.setSizeFull();
    tabsheet.addTab(new ValueBindings(), "Value bindings");
    tabsheet.addTab(new SelectionBindings(), "Selection bindings");
    tabsheet.addTab(new LocaleBindings(), "Locales combo");
    try {
        tabsheet.addTab(new ECViewVerticalLayout(), "ECView Vertical");
        tabsheet.addTab(new ECViewHorizontalLayout(), "ECView Horizontal");
        tabsheet.addTab(new ECViewGridLayout(), "ECView Gridlayout");
        tabsheet.addTab(new ECViewTabSheet(), "ECView Tabsheet");
        tabsheet.addTab(new ECViewDatabinding(), "ECView Bindings");
    } catch (ContextException e) {
        e.printStackTrace();
    }
    layout.addComponent(tabsheet);
}

From source file:org.lunifera.example.vaadin.ecview.ECViewDemoUI.java

License:Apache License

@Override
protected void init(VaadinRequest request) {
    setStyleName(Reindeer.LAYOUT_BLACK);

    VaadinObservables.getRealm(getUI());

    CssLayout layout = new CssLayout();
    layout.setSizeFull();//  w ww  . j  a v a  2  s .  com
    setContent(layout);

    TabSheet tabsheet = new TabSheet();
    tabsheet.setSizeFull();
    try {
        // tabsheet.addTab(new ECViewVerticalLayout(), "ECView Vertical");
        // tabsheet.addTab(new ECViewHorizontalLayout(),
        // "ECView Horizontal");
        // tabsheet.addTab(new ECViewGridLayout(), "ECView Gridlayout");
        // tabsheet.addTab(new ECViewTabSheet(), "ECView Tabsheet");
        // tabsheet.addTab(new ECViewDatabinding(), "ECView Bindings");
        // tabsheet.addTab(new ECViewEntityGenerator(),
        // "ECView Entity Generator");
        // tabsheet.addTab(new ECViewDtoGenerator(),
        // "ECView Dto Generator");
        tabsheet.addTab(new ECViewMasterDetail(), "ECView Master Detail");
    } catch (ContextException e) {
        e.printStackTrace();
    }
    layout.addComponent(tabsheet);
}

From source file:org.lunifera.examples.runtime.web.ecp.uimodel.presentation.vaadin.UiModelDemoUI.java

License:Open Source License

@Override
public void init(VaadinRequest request) {
    VerticalLayout content = new VerticalLayout();
    content.setMargin(true);/*w w  w.  j  a v  a 2s.c  o m*/
    content.setSizeFull();

    TabSheet sheet = new TabSheet();
    sheet.setSizeFull();
    content.addComponent(sheet);
    setContent(content);

    // add all examples
    //
    sheet.addTab(new GridLayoutFactory().createComponent(), "GridLayout");
    sheet.addTab(new HorizontalLayoutFactory().createComponent(), "HorizontalLayout");
    sheet.addTab(new VerticalLayoutFactory().createComponent(), "VerticalLayout");
}

From source file:org.lunifera.runtime.web.ecview.presentation.vaadin.internal.TabPresentation.java

License:Open Source License

@Override
public Component createWidget(Object parent) {
    TabSheet tabSheet = (TabSheet) parent;

    YTab yTab = (YTab) getModel();/*w w  w. ja va 2s  .  co m*/
    @SuppressWarnings("restriction")
    IEmbeddableEditpart childEditpart = ElementEditpart.getEditpart(yTab.getEmbeddable());

    CssLayout childLayout = new CssLayout();
    if (childEditpart == null) {
        tab = tabSheet.addTab(childLayout, "content missing");
        return childLayout;
    }
    IWidgetPresentation<Component> childPresentation = childEditpart.getPresentation();

    Component childContent = childPresentation.createWidget(childLayout);
    childLayout.addComponent(childContent);

    tab = tabSheet.addTab(childLayout);
    if (modelAccess.isLabelValid()) {
        tab.setCaption(modelAccess.getLabel());
    }

    return null;
}

From source file:org.openeos.services.ui.vaadin.internal.OpenWindowCommand.java

License:Apache License

@Override
public void menuSelected(MenuItem selectedItem) {
    if (windowComponent == null)
        windowComponent = windowFactory.createWindowComponent(window, application);
    final TabSheet tabSheet = application.getConcreteApplication().getMainTabSheet();
    tabSheet.addListener(new ComponentContainer.ComponentDetachListener() {

        private static final long serialVersionUID = 1L;

        @Override// w w  w  .j  a  v a  2s  .  c o m
        public void componentDetachedFromContainer(ComponentDetachEvent event) {
            if (event.getDetachedComponent() == windowComponent) {
                windowComponent = null;
                tabSheet.removeListener(this);
            }
        }
    });
    Tab tab = tabSheet.addTab(windowComponent, window.getName());
    tab.setClosable(true);
    tab.setDescription(window.getDescription());
    tabSheet.setSelectedTab(tab);
}

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/*from www .jav  a 2 s .c  om*/
 * @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.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();//from   w ww .  j  av  a 2 s. com

    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  ww  . j a  v a2 s  . c  om

    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 w w  .jav a 2s. 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);
}