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:nz.co.senanque.workflowui.FieldGroupWizard.java

License:Apache License

@PostConstruct
public void init() {
    main = new VerticalLayout();
    setContent(main);/* ww  w .  j  ava2  s.  c o  m*/
    setModal(true);
    this.setWidth(getWindowWidth());
    this.setHeight(getWindowHeight());

    tabSheet = new TabSheet();

    formPanel = new VerticalLayout();
    tabSheet.addTab(formPanel, m_messageSourceAccessor.getMessage("formwizard.form"));
    processPanel = new VerticalLayout();
    tabSheet.addTab(processPanel, m_messageSourceAccessor.getMessage("formwizard.process"));
    auditPanel = new VerticalLayout();
    tabSheet.addTab(auditPanel, m_messageSourceAccessor.getMessage("formwizard.audit"));
    main.addComponent(tabSheet);
}

From source file:org.accelerators.activiti.admin.ui.MainView.java

License:Open Source License

public MainView(AdminApp application) {

    // Set application
    this.app = application;

    // Setup main layout
    setStyleName(Reindeer.LAYOUT_WHITE);
    setMargin(false);/*from ww w.j  a  v a  2s.  co m*/
    setSpacing(false);
    setSizeFull();

    // Add header
    GridLayout header = new GridLayout(2, 1);
    header.setWidth("100%");
    header.setHeight("34px");
    addComponent(header);

    // Add header styles
    header.addStyleName(Consts.HEADER);
    header.addStyleName("header");
    header.setSpacing(true);

    // Add title to header
    GridLayout logoGrid = new GridLayout(1, 1);
    header.addComponent(logoGrid, 0, 0);
    header.setComponentAlignment(logoGrid, Alignment.MIDDLE_LEFT);

    Embedded logoImage = new Embedded(null, new ThemeResource("img/header-logo.png"));
    logoImage.setType(Embedded.TYPE_IMAGE);
    logoImage.addStyleName("header-image");
    logoGrid.addComponent(logoImage, 0, 0);
    logoGrid.setComponentAlignment(logoImage, Alignment.MIDDLE_CENTER);

    // Add logout button to header
    GridLayout logoutGrid = new GridLayout(2, 1);
    Label userLabel = new Label("Signed in as: " + app.getUser().toString());
    userLabel.addStyleName("user");
    logout.setStyleName(Reindeer.BUTTON_LINK);
    logout.addStyleName("logout");
    logoutGrid.addComponent(userLabel, 0, 0);
    logoutGrid.addComponent(logout, 1, 0);
    header.addComponent(logoutGrid, 1, 0);
    header.setComponentAlignment(logoutGrid, Alignment.TOP_RIGHT);

    // Create tab sheet
    TabSheet tabs = new TabSheet();
    tabs.setSizeFull();

    // Add tab styles
    tabs.addStyleName(Reindeer.TABSHEET_BORDERLESS);
    tabs.addStyleName(Reindeer.LAYOUT_WHITE);

    // Add task view tab
    tabs.addTab(new UserTab(app));
    tabs.addTab(new GroupTab(app));

    // Add tab sheet to layout
    addComponent(tabs);
    setExpandRatio(tabs, 1.0F);

    // Add footer text
    Label footerText = new Label(app.getMessage(Messages.Footer));
    footerText.setSizeUndefined();
    footerText.setStyleName(Reindeer.LABEL_SMALL);
    addComponent(footerText);
    setComponentAlignment(footerText, Alignment.BOTTOM_CENTER);

}

From source file:org.activiti.administrator.ui.MainView.java

License:Apache License

public MainView(AdminApp application) {

    // Set application
    this.app = application;

    // Setup main layout
    setStyleName(Reindeer.LAYOUT_WHITE);
    setMargin(false);/*from ww w  .ja  va 2s.  c o m*/
    setSpacing(false);
    setSizeFull();

    // Create tab sheet
    TabSheet tabs = new TabSheet();
    tabs.setSizeFull();

    // Add tab styles
    tabs.addStyleName(Reindeer.TABSHEET_BORDERLESS);
    tabs.addStyleName(Reindeer.LAYOUT_WHITE);

    // Add task view tab
    tabs.addTab(new UserTab(app));
    tabs.addTab(new GroupTab(app));

    // Add tab sheet to layout
    addComponent(tabs);
    setExpandRatio(tabs, 1.0F);

    // Add footer text
    Label footerText = new Label(app.getMessage(Messages.Footer));
    footerText.setSizeUndefined();
    footerText.setStyleName(Reindeer.LABEL_SMALL);
    footerText.addStyleName("footer");
    addComponent(footerText);
    setComponentAlignment(footerText, Alignment.BOTTOM_CENTER);

}

From source file:org.apache.ace.webui.vaadin.EditWindow.java

License:Apache License

/**
 * @param object//w ww.j  a v a 2 s.  c  o m
 * @param factories
 */
protected void initDialog(final NamedObject object, List<UIExtensionFactory> factories) {
    VerticalLayout fields = new VerticalLayout();
    fields.setSpacing(true);
    fields.addComponent(m_name);
    fields.addComponent(m_description);

    TabSheet tabs = new TabSheet();
    tabs.setHeight("350px");
    tabs.setWidth("100%");
    tabs.setVisible(!factories.isEmpty());

    Map<String, Object> context = new HashMap<>();
    context.put("object", object);
    populateContext(context);

    for (UIExtensionFactory factory : factories) {
        try {
            tabs.addTab(factory.create(context));
        } catch (Throwable ex) {
            // We ignore extension factories that throw exceptions
            // TODO: log this or something
            ex.printStackTrace();
        }
    }

    Button okButton = new Button("Ok", new Button.ClickListener() {
        public void buttonClick(ClickEvent event) {
            try {
                onOk((String) m_name.getValue(), (String) m_description.getValue());
                close();
            } catch (Exception e) {
                handleError(e);
            }
        }
    });
    // Allow enter to be used to close this dialog with enter directly...
    okButton.setClickShortcut(KeyCode.ENTER);
    okButton.addStyleName("primary");

    Button cancelButton = new Button("Cancel", new Button.ClickListener() {
        public void buttonClick(ClickEvent event) {
            close();
        }
    });
    cancelButton.setClickShortcut(KeyCode.ESCAPE);

    HorizontalLayout buttonBar = new HorizontalLayout();
    buttonBar.setSpacing(true);
    buttonBar.addComponent(okButton);
    buttonBar.addComponent(cancelButton);

    VerticalLayout layout = (VerticalLayout) getContent();
    layout.setMargin(true);
    layout.setSpacing(true);
    layout.addComponent(fields);
    layout.addComponent(tabs);
    layout.addComponent(buttonBar);

    // The components added to the window are actually added to the window's
    // layout; you can use either. Alignments are set using the layout
    layout.setComponentAlignment(buttonBar, Alignment.BOTTOM_RIGHT);

    m_name.focus();
}

From source file:org.apache.openaz.xacml.admin.components.PolicyWorkspace.java

License:Apache License

@AutoGenerated
private VerticalLayout buildVerticalLayoutRightPanel() {
    // common part: create layout
    verticalLayoutRightPanel = new VerticalLayout();
    verticalLayoutRightPanel.setImmediate(false);
    verticalLayoutRightPanel.setWidth("100.0%");
    verticalLayoutRightPanel.setHeight("-1px");
    verticalLayoutRightPanel.setMargin(true);
    verticalLayoutRightPanel.setSpacing(true);

    // horizontalLayoutRightToolbar
    horizontalLayoutRightToolbar = buildHorizontalLayoutRightToolbar();
    verticalLayoutRightPanel.addComponent(horizontalLayoutRightToolbar);

    // tabSheet//from w  w  w . j  a va 2  s  .  co m
    tabSheet = new TabSheet();
    tabSheet.setImmediate(true);
    tabSheet.setWidth("100.0%");
    tabSheet.setHeight("-1px");
    verticalLayoutRightPanel.addComponent(tabSheet);
    verticalLayoutRightPanel.setExpandRatio(tabSheet, 1.0f);

    return verticalLayoutRightPanel;
}

From source file:org.apache.openaz.xacml.admin.XacmlAdminConsole.java

License:Apache License

@AutoGenerated
private VerticalLayout buildMainLayout() {
    // common part: create layout
    mainLayout = new VerticalLayout();
    mainLayout.setImmediate(false);/*from   w  w w.  j a v a2s . c om*/
    mainLayout.setWidth("100%");
    mainLayout.setHeight("100%");
    mainLayout.setMargin(true);

    // top-level component properties
    setWidth("100.0%");
    setHeight("100.0%");

    // horizontalLayout_1
    horizontalLayout_1 = buildHorizontalLayout_1();
    mainLayout.addComponent(horizontalLayout_1);

    // tabSheet
    tabSheet = new TabSheet();
    tabSheet.setImmediate(false);
    tabSheet.setWidth("100.0%");
    tabSheet.setHeight("100.0%");
    mainLayout.addComponent(tabSheet);
    mainLayout.setExpandRatio(tabSheet, 1.0f);

    // labelCopyright
    labelCopyright = new Label();
    labelCopyright.setImmediate(false);
    labelCopyright.setWidth("-1px");
    labelCopyright.setHeight("40px");
    labelCopyright.setValue(
            "<center>Copyright &copy; 2015 The Apache Software Foundation, Licensed under the Apache License, Version 2.0.</center>");
    mainLayout.addComponent(labelCopyright);
    mainLayout.setComponentAlignment(labelCopyright, new Alignment(48));

    return mainLayout;
}

From source file:org.apache.tamaya.ui.views.ConfigView.java

License:Apache License

public ConfigView() {
    Label caption = new Label("Raw Configuration");
    Label description = new Label(
            "This view shows the overall <b>raw</b> configuration configArea. Dependening on your access rights you"
                    + "may see partial or masked data. Similarly configuration can be <i>read-only</i> or <i>mutable</i>.",
            ContentMode.HTML);/*from   w ww . ja  va 2s .c  om*/
    TabSheet tabPane = new TabSheet();
    tabPane.setHeight("100%");
    tabPane.setWidth("100%");
    tabPane.addTab(createConfigTab(), "Configuration");
    tabPane.addTab(createEnvTab(), "Environment Properties");
    tabPane.addTab(createSysPropsTab(), "System Properties");
    tabPane.addTab(createRuntimeTab(), "Runtime Properties");
    addComponents(caption, description, tabPane);
    caption.addStyleName(UIConstants.LABEL_HUGE);
    description.addStyleName(UIConstants.LABEL_LARGE);
}

From source file:org.apache.usergrid.chop.webapp.view.main.MainView.java

License:Apache License

private VerticalLayout addTabSheet() {
    VerticalLayout tabLayout = new VerticalLayout();
    TabSheet tabSheet = new TabSheet();
    tabSheet.setHeight("100%");

    tabSheetManager = new TabSheetManager(tabSheet);
    tabLayout.addComponent(tabSheet);/*from  w  w w  .ja  v  a  2 s .  c o  m*/

    return tabLayout;
}

From source file:org.asi.ui.custom.demo.ExtFilteringTableDemo.java

private void loadTables() {
    TabSheet tabsheet = new TabSheet();
    addComponent(tabsheet);//  w ww .j  a v  a 2  s .c  o m

    tabsheet.addTab(loadExtFilterTable(), "Ext Filter Table");
    tabsheet.addTab(loadFreezeFilterTreeTable(), "Freeze Filter Tree Table");
    tabsheet.addTab(loadPagedFilterTable(), "Paged Filter Table");
    tabsheet.addTab(loadFreezePagedFilterTable(), "Freeze Paged Filter Table");
}

From source file:org.azrul.langkuik.framework.webgui.BeanView.java

@Override
public void enter(final ViewChangeListener.ViewChangeEvent vcevent) {
    setCurrentView(vcevent.getViewName());
    //reset form/*www. j  av a2  s .c o  m*/
    this.removeAllComponents();

    //determine user details
    UserDetails userDetails = null;
    Authentication auth = SecurityContextHolder.getContext().getAuthentication();
    if (!(auth instanceof AnonymousAuthenticationToken)) {
        userDetails = (UserDetails) auth.getPrincipal();
    } else {
        return;
    }

    final Set<String> currentUserRoles = new HashSet<>();
    for (GrantedAuthority grantedAuth : userDetails.getAuthorities()) {
        currentUserRoles.add(grantedAuth.getAuthority());
    }

    //determine entity rights 
    EntityRight entityRight = null;

    EntityUserMap[] entityUserMaps = ((WebEntity) currentBean.getClass().getAnnotation(WebEntity.class))
            .userMap();
    for (EntityUserMap e : entityUserMaps) {
        if (currentUserRoles.contains(e.role()) || ("*").equals(e.role())) {
            entityRight = e.right();
            break;
        }
    }
    if (entityRight == null) { //if entityRight=EntityRight.NONE, still allow to go through because field level might be accessible
        //Not accessible
        return;
    }

    //create bean utils
    final BeanUtils beanUtils = new BeanUtils();

    //rebuild pageParameter.getBreadcrumb()
    BreadCrumbBuilder.buildBreadCrumb(vcevent.getNavigator(), pageParameter.getBreadcrumb(),
            pageParameter.getHistory());

    //rebuild components
    if (currentBean == null) {
        return;
    }

    //refresh current item
    C newBean = dao.refresh(currentBean);
    if (newBean != null) {
        currentBean = newBean;
    }

    final BeanFieldGroup fieldGroup = new BeanFieldGroup(currentBean.getClass());
    fieldGroup.setItemDataSource(currentBean);
    final FormLayout form = new FormLayout();
    Map<String, Map<Integer, FieldContainer>> groups = beanUtils.createGroupsFromBean(currentBean.getClass());

    //render form according to tab
    if (groups.size() == 1) {
        createForm(entityRight, currentUserRoles, groups, fieldGroup, pageParameter.getCustomTypeDaos(),
                vcevent.getNavigator(), form);
    } else {
        TabSheet tabSheet = new TabSheet();
        for (String group : groups.keySet()) {
            if (("All").equals(group)) {
                createForm(entityRight, currentUserRoles, groups, group, fieldGroup,
                        pageParameter.getCustomTypeDaos(), vcevent.getNavigator(), form);
            } else {
                FormLayout tab = new FormLayout();
                createForm(entityRight, currentUserRoles, groups, group, fieldGroup,
                        pageParameter.getCustomTypeDaos(), vcevent.getNavigator(), tab);
                tabSheet.addTab(tab, group);

            }
        }
        form.addComponent(tabSheet);
    }

    //Navigation and actions
    HorizontalLayout navButtons = new HorizontalLayout();
    navButtons.setSpacing(true);

    Button saveAndBackBtn = new Button("Save and back", new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            try {
                fieldGroup.commit();
                currentBean = (C) fieldGroup.getItemDataSource().getBean();
                currentBean = saveBean(currentBean, parentBean, beanUtils, currentUserRoles);
                if (!pageParameter.getHistory().isEmpty()) {
                    String currentView = pageParameter.getHistory().pop().getViewHandle();
                    String lastView = pageParameter.getHistory().peek().getViewHandle();
                    vcevent.getNavigator().removeView(currentView);
                    vcevent.getNavigator().navigateTo(lastView);
                }
            } catch (FieldGroup.CommitException ex) {
                handleFieldsError(fieldGroup);
            }
        }

    });
    navButtons.addComponent(saveAndBackBtn);
    saveAndBackBtn.setId(saveAndBackBtn.getCaption());

    form.addComponent(navButtons);
    form.setMargin(new MarginInfo(true));
    this.addComponent(form);
}