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:com.morevaadin.vaadin7.html.HtmlIntegrationRoot.java

License:Apache License

@Override
protected void init(WrappedRequest request) {

    getPage().setTitle("HTML JavaScript integration examples");

    HorizontalLayout layout = new HorizontalLayout();

    layout.setSizeFull();//w  w w .  java 2 s.  c  om

    setContent(layout);

    TabSheet tabsheet = new TabSheet();

    layout.addComponent(tabsheet);

    tabsheet.addTab(new BasicHtmlIntegrationView()).setCaption("Basic HTML");
    tabsheet.addTab(new ConfigurableHtmlIntegrationView()).setCaption("Configurable HTML");
    tabsheet.addTab(new JavascriptIntegrationView()).setCaption("Javascript");
}

From source file:com.mycollab.module.project.view.UserDashboardViewImpl.java

License:Open Source License

public UserDashboardViewImpl() {
    this.withMargin(false).withFullWidth();

    prjService = AppContextUtil.getSpringBean(ProjectService.class);
    prjKeys = prjService.getProjectKeysUserInvolved(UserUIContext.getUsername(), MyCollabUI.getAccountId());

    tabSheet = new TabSheet();
    tabSheet.addTab(buildDashboardComp(), UserUIContext.getMessage(GenericI18Enum.VIEW_DASHBOARD),
            FontAwesome.DASHBOARD);/*from   w  w  w .j  a v  a  2s  .  c o  m*/
    tabSheet.addTab(buildProjectListComp(), UserUIContext.getMessage(ProjectI18nEnum.LIST),
            FontAwesome.BUILDING_O);
    tabSheet.addTab(buildFollowingTicketComp(), UserUIContext.getMessage(ProjectCommonI18nEnum.VIEW_FAVORITES),
            FontAwesome.EYE);
    if (!SiteConfiguration.isCommunityEdition()) {
        tabSheet.addTab(buildCalendarComp(), UserUIContext.getMessage(ProjectCommonI18nEnum.VIEW_CALENDAR),
                FontAwesome.CALENDAR);
    }

    //        tabSheet.addTab(buildSettingComp(), "Settings", FontAwesome.COG);

    tabSheet.addSelectedTabChangeListener(selectedTabChangeEvent -> {
        CssLayout comp = (CssLayout) tabSheet.getSelectedTab();
        comp.removeAllComponents();
        int tabIndex = tabSheet.getTabPosition(tabSheet.getTab(comp));
        if (tabIndex == 0) {
            UserProjectDashboardPresenter userProjectDashboardPresenter = PresenterResolver
                    .getPresenterAndInitView(UserProjectDashboardPresenter.class);
            userProjectDashboardPresenter.onGo(comp, null);
        } else if (tabIndex == 2) {
            FollowingTicketPresenter followingTicketPresenter = PresenterResolver
                    .getPresenterAndInitView(FollowingTicketPresenter.class);
            followingTicketPresenter.onGo(comp, null);
        } else if (tabIndex == 4) {
            SettingPresenter settingPresenter = PresenterResolver.getPresenter(SettingPresenter.class);
            settingPresenter.onGo(comp, null);
        } else if (tabIndex == 3) {
            ICalendarDashboardPresenter calendarPresenter = PresenterResolver
                    .getPresenterAndInitView(ICalendarDashboardPresenter.class);
            calendarPresenter.go(comp, null);
        } else if (tabIndex == 1) {
            ProjectListPresenter projectListPresenter = PresenterResolver
                    .getPresenterAndInitView(ProjectListPresenter.class);
            projectListPresenter.onGo(comp, null);
        }
    });

    this.with(setupHeader(), tabSheet).expand(tabSheet);
}

From source file:com.ocs.dynamo.ui.composite.form.ModelBasedEditForm.java

License:Apache License

/**
 * Constructs the main layout of the screen
 * /*from  w  ww .  j  a v a2 s . c o m*/
 * @param entityModel
 * @return
 */
protected VerticalLayout buildMainLayout(EntityModel<T> entityModel) {
    VerticalLayout layout = new VerticalLayout();

    titleLabels.put(isViewMode(), constructTitleLabel());

    // horizontal layout that contains title label and buttons

    titleBars.put(isViewMode(), new DefaultHorizontalLayout(false, true, true));
    titleBars.get(isViewMode()).addComponent(titleLabels.get(isViewMode()));

    HorizontalLayout buttonBar = constructButtonBar();
    buttonBar.setSizeUndefined();
    titleBars.get(isViewMode()).addComponent(buttonBar);
    layout.addComponent(titleBars.get(isViewMode()));

    Layout form = null;
    if (entityModel.usesDefaultGroupOnly()) {
        form = new FormLayout();
    } else {
        form = new DefaultVerticalLayout(false, true);
    }

    // in case of vertical layout (the default), don't use the entire screen
    if (ScreenMode.VERTICAL.equals(getFormOptions().getScreenMode())) {
        form.setStyleName(DynamoConstants.CSS_CLASS_HALFSCREEN);
    }

    int count = 0;
    if (!entityModel.usesDefaultGroupOnly()) {
        // display the attributes in groups

        TabSheet tabSheet = null;
        boolean tabs = AttributeGroupMode.TABSHEET.equals(getFormOptions().getAttributeGroupMode());
        if (tabs) {
            tabSheet = new TabSheet();
            form.addComponent(tabSheet);
        }

        if (getParentGroupHeaders() != null && getParentGroupHeaders().length > 0) {
            // extra layer of grouping
            for (String parentGroupHeader : getParentGroupHeaders()) {
                Layout innerForm = constructAttributeGroupLayout(form, tabs, tabSheet, parentGroupHeader,
                        false);

                // add a tab sheet on the inner level if needed
                TabSheet innerTabSheet = null;
                boolean innerTabs = !tabs;
                if (innerTabs) {
                    innerTabSheet = new TabSheet();
                    innerForm.addComponent(innerTabSheet);
                }

                // add all appropriate inner groups
                int tempCount = processParentHeaderGroup(parentGroupHeader, innerForm, innerTabs, innerTabSheet,
                        count);
                count += tempCount;
            }
        } else {
            // just one layer of attribute groups
            for (String attributeGroup : entityModel.getAttributeGroups()) {
                if (entityModel.isAttributeGroupVisible(attributeGroup, viewMode)) {
                    Layout innerForm = constructAttributeGroupLayout(form, tabs, tabSheet,
                            getAttributeGroupCaption(attributeGroup), true);

                    for (AttributeModel attributeModel : entityModel
                            .getAttributeModelsForGroup(attributeGroup)) {
                        addField(innerForm, entityModel, attributeModel, count);
                        count++;
                    }
                }
            }
        }
    } else {
        // iterate over the attributes and add them to the form (without any
        // grouping)
        for (AttributeModel attributeModel : entityModel.getAttributeModels()) {
            addField(form, entityModel, attributeModel, count);
            count++;
        }
    }

    layout.addComponent(form);

    if (firstField != null) {
        firstField.focus();
    }

    buttonBar = constructButtonBar();
    buttonBar.setSizeUndefined();
    layout.addComponent(buttonBar);
    checkSaveButtonState();

    return layout;
}

From source file:com.ocs.dynamo.ui.composite.layout.LazyTabLayout.java

License:Apache License

@Override
public void build() {
    Panel panel = new Panel();
    panel.setCaptionAsHtml(true);//w ww. ja va  2  s. c  om
    panel.setCaption(createTitle());

    VerticalLayout main = new DefaultVerticalLayout(true, true);
    panel.setContent(main);

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

    main.addComponent(tabs);
    setupLazySheet(tabs);
    setCompositionRoot(panel);
}

From source file:com.oodrive.nuage.webui.VvrManagerUi.java

License:Apache License

/**
 * Initialize VVRs representation.//from w  w w  .  j a va2s. c o m
 * 
 * @param jmxHandler
 */
private final void initVvrManagerUi(final JmxHandler jmxHandler) {

    // Create Model for vvrManager
    vvrManagerModel = jmxHandler.createVvrManagerModel();

    // Vvr representation
    vvrsTabsheet = new TabSheet();
    vvrManagerLayout.addComponent(vvrsTabsheet);

    // Sheet 0 create new VVR
    final VerticalLayout lastLayout = new VerticalLayout();
    lastLayout.setWidth("100%");
    lastLayout.setHeight(lastLayoutHeight);
    vvrsTabsheet.addTab(lastLayout, "+");

    // Add a sheet for each vvr
    final Set<UUID> vvrUuidList = vvrManagerModel.getVvrs();
    for (final UUID vvrUuid : vvrUuidList) {
        addVvr(vvrUuid);
    }

    // Window to create a new vvr (display on the last tabsheet)
    final VvrCreateWindow createWindow = new VvrCreateWindow(new PostProcessing() {
        @Override
        public void execute() {
            // After creation select the first tab
            vvrsTabsheet.setSelectedTab(0);
        }
    });

    vvrsTabsheet.addSelectedTabChangeListener(new TabSheet.SelectedTabChangeListener() {
        @Override
        public void selectedTabChange(final SelectedTabChangeEvent event) {
            final TabSheet tabsheet = event.getTabSheet();
            final String caption = tabsheet.getTab(tabsheet.getSelectedTab()).getCaption();

            if (caption.equals("+")) {
                createWindow.add(vvrManagerModel);
            } else {
                // Remove window if another tab is selected
                createWindow.remove();
            }
        }
    });

    // If no other tab, display creation window (+ tab can not be selected)
    if (vvrUuidList.isEmpty()) {
        createWindow.add(vvrManagerModel);
    }
}

From source file:com.openhris.employee.EmployeeInformationUI.java

public ComponentContainer employeeInformationWindow() {
    TabSheet ts = new TabSheet();
    ts.setSizeFull();//from   ww  w.j av a 2 s  .c  om
    ts.addStyleName("bar");

    VerticalLayout vlayout = new VerticalLayout();
    vlayout.setCaption("Personal Information");
    vlayout.addComponent(employeePersonalInformation);
    vlayout.setComponentAlignment(employeePersonalInformation, Alignment.MIDDLE_LEFT);
    ts.addComponent(vlayout);

    vlayout = new VerticalLayout();
    vlayout.setCaption("Address");
    vlayout.addComponent(employeeAddress);
    ts.addComponent(vlayout);

    vlayout = new VerticalLayout();
    vlayout.setCaption("Character Reference");
    vlayout.addComponent(characterReference);
    ts.addComponent(vlayout);

    vlayout = new VerticalLayout();
    vlayout.setCaption("Dependent(s)");
    //   vlayout.addComponent(employeePersonalInformation);
    ts.addComponent(vlayout);

    vlayout = new VerticalLayout();
    vlayout.setCaption("Educational Background");
    //   vlayout.addComponent(employeePersonalInformation);
    ts.addComponent(vlayout);

    vlayout = new VerticalLayout();
    vlayout.setCaption("Post Employment Info");
    vlayout.addComponent(postEmploymentInfomation);
    ts.addComponent(vlayout);

    vlayout = new VerticalLayout();
    vlayout.setCaption("Work History");
    //   vlayout.addComponent(employeePersonalInformation);
    ts.addComponent(vlayout);

    vlayout = new VerticalLayout();
    vlayout.setCaption("Salary Information");
    vlayout.addComponent(employeeSalaryInformation);
    ts.addComponent(vlayout);

    vlayout = new VerticalLayout();
    vlayout.setCaption("Allowance Information");
    vlayout.addComponent(employeeAllowanceInformation);
    ts.addComponent(vlayout);

    vlayout = new VerticalLayout();
    vlayout.setCaption("Other Information");
    vlayout.addComponent(otherInformation);
    ts.addComponent(vlayout);

    return ts;
}

From source file:com.openhris.payroll.AdjustmentWindow.java

public AdjustmentWindow(int payrollId, double amountToBeReceive, double amountReceived, double adjustment) {
    this.payrollId = payrollId;
    this.amountToBeReceive = amountToBeReceive;
    this.amountReceived = amountReceived;
    this.adjustment = adjustment;

    setCaption("ADJUSTMENTS");
    setWidth("400px");

    TabSheet ts = new TabSheet();
    ts.addStyleName("bar");

    VerticalLayout vlayout = new VerticalLayout();
    vlayout.setMargin(true);/*ww  w.j a  va 2s  .  c o m*/
    vlayout.setSpacing(true);
    vlayout.setCaption("Post Adjustments");

    final TextField amount = new TextField("Amount: ");
    amount.setWidth("100%");
    vlayout.addComponent(amount);

    final TextField remarks = new TextField("Remarks");
    remarks.setWidth("100%");
    vlayout.addComponent(remarks);

    Button saveAdjustments = new Button("POST ADJUSTMENTS");
    saveAdjustments.setWidth("100%");
    saveAdjustments.addListener(new Button.ClickListener() {

        @Override
        public void buttonClick(Button.ClickEvent event) {
            if (amount.getValue() == null || amount.getValue().toString().trim().isEmpty()) {
                getWindow().showNotification("Enter Amount for adjustment.",
                        Window.Notification.TYPE_WARNING_MESSAGE);
                return;
            } else {
                if (!utilities.checkInputIfDouble(amount.getValue().toString().trim())) {
                    getWindow().showNotification("Enter a numeric value for amount.",
                            Window.Notification.TYPE_ERROR_MESSAGE);
                    return;
                }
            }

            if (remarks.getValue() == null || remarks.getValue().toString().trim().isEmpty()) {
                getWindow().showNotification("Add remarks for adjustment.",
                        Window.Notification.TYPE_ERROR_MESSAGE);
                return;
            }

            double amountForAdjustment = utilities.convertStringToDouble(amount.getValue().toString().trim());
            String remarksForAdjustment = remarks.getValue().toString().trim().toLowerCase();
            boolean result = payrollService.insertAdjustmentToPayroll(getPayrollId(), getAmountToBeReceive(),
                    getAmountReceived(), amountForAdjustment, remarksForAdjustment);
            if (result) {
                adjustmentTable();
                close();
                getWindow().showNotification("Successfully added adjustment.",
                        Window.Notification.TYPE_HUMANIZED_MESSAGE);
            }
        }
    });
    vlayout.addComponent(saveAdjustments);

    ts.addComponent(vlayout);

    vlayout = new VerticalLayout();
    vlayout.setMargin(true);
    vlayout.setSpacing(true);
    vlayout.setCaption("Adjustments Table");

    Label label = new Label("Remarks: Click ID Column to delete Adjustment");
    vlayout.addComponent(label);

    vlayout.addComponent(adjustmentTable());

    Button closeBtn = new Button("CLOSE");
    closeBtn.setWidth("100%");
    closeBtn.addListener(closeBtnListener);
    vlayout.addComponent(closeBtn);

    ts.addComponent(vlayout);
    addComponent(ts);
}

From source file:com.pms.component.ganttchart.DemoUI.java

License:Apache License

public Component init() {
    ganttListener = null;// w  w  w  .  j  a v a 2s. co  m
    createGantt();

    MenuBar menu = controlsMenuBar();
    Panel controls = createControls();

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

    Component wrapper = UriFragmentWrapperFactory.wrapByUriFragment(UI.getCurrent().getPage().getUriFragment(),
            gantt);
    if (wrapper instanceof GanttListener) {
        ganttListener = (GanttListener) wrapper;
    }

    final VerticalLayout layout = new VerticalLayout();
    layout.setStyleName("demoContentLayout");
    layout.setSizeFull();
    layout.addComponent(menu);
    layout.addComponent(controls);
    layout.addComponent(wrapper);
    layout.setExpandRatio(wrapper, 1);

    return layout;
}

From source file:com.pms.component.ganttchart.GanttChart.java

License:Apache License

public Component init(Project project) {
    ganttListener = null;/*from www .  j a v  a  2s  .  c  o  m*/
    createGantt(project);

    MenuBar menu = controlsMenuBar();
    Panel controls = createControls();

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

    Component wrapper = UriFragmentWrapperFactory.wrapByUriFragment(UI.getCurrent().getPage().getUriFragment(),
            gantt);
    if (wrapper instanceof GanttListener) {
        ganttListener = (GanttListener) wrapper;
    }

    final VerticalLayout layout = new VerticalLayout();
    layout.setStyleName("demoContentLayout");
    layout.setSizeFull();
    //layout.addComponent(menu);
    layout.addComponent(controls);
    layout.addComponent(wrapper);
    layout.setExpandRatio(wrapper, 1);

    return layout;
}

From source file:com.pms.component.ganttchart.scheduletask.TaskGanntChart.java

License:Apache License

public Component init(Project project) {

    this.project = project;

    ganttListener = null;/*  w  ww  .j  av  a  2  s .c  o m*/
    createGantt(project);

    MenuBar menu = controlsMenuBar();
    Panel controls = createControls();

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

    /*  Component wrapper = UriFragmentWrapperFactory.wrapByUriFragment(UI
        .getCurrent().getPage().getUriFragment(), gantt);
    if (wrapper instanceof GanttListener) {
    ganttListener = (GanttListener) wrapper;
    }*/

    //to show table
    Component wrapper = UriFragmentWrapperFactory.wrapByUriFragment("table", gantt);
    if (wrapper instanceof GanttListener) {
        ganttListener = (GanttListener) wrapper;
    }

    final VerticalLayout layout = new VerticalLayout();
    layout.setStyleName("demoContentLayout");
    layout.setSizeFull();
    //layout.addComponent(menu);
    layout.addComponent(controls);
    layout.addComponent(wrapper);
    layout.setExpandRatio(wrapper, 1);

    controls.setVisible(false);

    return layout;
}