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:gov.osti.doecode.RepositoryForm.java

/**
 * Create a basic form UI for editing software metadata information.
 * //from w  ww . j  av a2s . c  om
 * @param ui link to the MyUI parent UI
 */
public RepositoryForm(MyUI ui) {
    this.ui = ui;

    setSizeUndefined();

    agentGrid.setColumns("firstName", "lastName", "email");
    agentGrid.setHeightMode(HeightMode.ROW);
    agentGrid.setHeightByRows(8);

    idGrid.setColumns("relationType", "identifierType", "value");
    idGrid.setHeightMode(HeightMode.ROW);
    idGrid.setHeightByRows(8);

    idForm = new IdentifierForm(this);
    agentForm = new AgentForm(this);

    TabSheet tabs = new TabSheet();
    tabs.addStyleName(ValoTheme.TABSHEET_FRAMED);
    tabs.addStyleName(ValoTheme.TABSHEET_PADDED_TABBAR);

    addComponent(tabs);

    HorizontalLayout main = new HorizontalLayout();
    main.setSpacing(true);
    main.setMargin(true);

    FormLayout left = new FormLayout();
    FormLayout right = new FormLayout();

    countryCode.addItems(countryCodes);

    left.addComponents(url, loadButton, name, openSource, siteOwnershipCode, acronym, doi, countryCode);
    right.addComponents(keywords, rights, license, operatingSystem, siteAccessionNumber, otherRequirements);

    loadButton.addClickListener(e -> {
        try {
            SoftwareRepository repo = Reader.loadRepository("doecode");

            setSoftwareRepository(repo);

        } catch (IOException ex) {
            setComponentError(new UserError("Unable to load: " + ex.getMessage()));
        }
    });

    main.addComponents(left, right);

    tabs.addTab(main, "Metadata");

    Button agentAddButton = new Button("New");
    agentAddButton.setStyleName(BaseTheme.BUTTON_LINK);
    agentAddButton.setIcon(FontAwesome.PLUS);

    agentAddButton.addClickListener(e -> {
        agentForm.setAgent(new Agent());
    });

    VerticalLayout innerAgent = new VerticalLayout(agentAddButton, agentGrid);
    innerAgent.setSizeUndefined();
    HorizontalLayout agentLayout = new HorizontalLayout(innerAgent, agentForm);
    agentLayout.setSpacing(true);
    agentLayout.setMargin(true);

    tabs.addTab(agentLayout, "Agents");

    Button idAddButton = new Button("New");
    idAddButton.setIcon(FontAwesome.PLUS);
    idAddButton.setStyleName(BaseTheme.BUTTON_LINK);
    idAddButton.setSizeUndefined();

    idAddButton.addClickListener(e -> {
        idForm.setIdentifier(new Identifier());
    });

    VerticalLayout innerId = new VerticalLayout(idAddButton, idGrid);
    HorizontalLayout idTab = new HorizontalLayout(innerId, idForm);
    idTab.setSpacing(true);
    idTab.setMargin(true);

    tabs.addTab(idTab, "Identifiers");

    agentGrid.addSelectionListener(e -> {
        if (!e.getSelected().isEmpty()) {
            Agent agent = (Agent) e.getSelected().iterator().next();
            agentForm.setAgent(agent);
            System.out.println("Selected " + agent.getFirstName());
        }
    });
    idGrid.addSelectionListener(e -> {
        if (!e.getSelected().isEmpty()) {
            Identifier identifier = (Identifier) e.getSelected().iterator().next();
            idForm.setIdentifier(identifier);
        }
    });

}

From source file:info.magnolia.ui.admincentral.shellapp.favorites.FavoritesForm.java

License:Open Source License

private void init() {
    addStyleName("favorites-form");
    final VerticalLayout favoriteForm = new VerticalLayout();
    favoriteEntryForm = new InternalFavoriteEntryForm();
    favoriteGroupForm = new InternalFavoriteGroupForm();

    tabsheet = new TabSheet();
    tabsheet.addStyleName("favorites-tabs");
    tabsheet.addTab(favoriteEntryForm, i18n.translate("favorites.form.favorite.add"));
    tabsheet.addTab(favoriteGroupForm, i18n.translate("favorites.form.group.add"));

    tabsheet.addSelectedTabChangeListener(new SelectedTabChangeListener() {

        @Override//from www . j  a  v a2s  .co  m
        public void selectedTabChange(SelectedTabChangeEvent event) {
            if (event.getTabSheet().getSelectedTab() instanceof InternalFavoriteEntryForm) {
                favoriteGroupForm.removeEnterKeyShortcutListener();
                favoriteEntryForm.addEnterKeyShortcutListener();
            } else {
                favoriteEntryForm.removeEnterKeyShortcutListener();
                favoriteGroupForm.addEnterKeyShortcutListener();
            }
        }
    });

    final CssLayout header = new CssLayout();
    header.addStyleName("dialog-header");
    header.setSizeFull();
    header.addLayoutClickListener(new LayoutClickListener() {
        @Override
        public void layoutClick(LayoutClickEvent event) {
            // change the visibility of the group- and favorite-items
            if (event.getClickedComponent() == editIcon || event.getChildComponent() == editLabel) {
                if (!listener.hasItems() || listener.itemsAreEditable()) {
                    listener.setToInitialState();
                } else {
                    listener.setItemsEditable(true);
                }
            } else {
                // just open || close the FavoritesForm
                if (isOpen()) {
                    close();
                } else {
                    open();
                }
            }
        }
    });

    // add
    final Label addNewIcon = new Label();
    addNewIcon.setSizeUndefined();
    addNewIcon.addStyleName("icon");
    addNewIcon.addStyleName("icon-add-fav");
    final Label addNewLabel = new Label(i18n.translate("favorites.form.add"));
    addNewLabel.setSizeUndefined();
    addNewLabel.addStyleName("title");

    // edit
    editIcon = new Label();
    editIcon.setSizeUndefined();
    editIcon.addStyleName(EDIT_ACTION_STYLENAME);
    editIcon.addStyleName("icon");
    editIcon.addStyleName("icon-edit");

    editLabel = new Label(i18n.translate("favorites.form.favorite.edit"));
    editLabel.setSizeUndefined();
    editLabel.addStyleName("title");
    editLabel.addStyleName(EDIT_ACTION_STYLENAME);

    // arrow
    arrowIcon = new Label();
    arrowIcon.setSizeUndefined();
    arrowIcon.addStyleName("icon");
    arrowIcon.addStyleName("arrow");
    arrowIcon.addStyleName("icon-arrow2_n");

    // assemble
    header.addComponent(addNewIcon);
    header.addComponent(addNewLabel);
    header.addComponent(editIcon);
    header.addComponent(editLabel);
    header.addComponent(arrowIcon);
    favoriteForm.addComponent(header);
    favoriteForm.addComponent(tabsheet);

    // form is closed initially
    close();
    setCompositionRoot(favoriteForm);
}

From source file:io.subutai.plugin.accumulo.ui.AccumuloComponent.java

public AccumuloComponent(ExecutorService executorService, Accumulo accumulo, Hadoop hadoop, Zookeeper zookeeper,
        Tracker tracker, EnvironmentManager environmentManager) throws NamingException {

    setSizeFull();/* w  w w.j  ava2s . c o m*/

    VerticalLayout verticalLayout = new VerticalLayout();
    verticalLayout.setSpacing(true);
    verticalLayout.setSizeFull();

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

    final Manager manager = new Manager(executorService, accumulo, hadoop, zookeeper, tracker,
            environmentManager);
    Wizard wizard = new Wizard(executorService, accumulo, hadoop, zookeeper, tracker, environmentManager);
    sheet.addTab(wizard.getContent(), "Install");
    sheet.getTab(0).setId("AccumuloInstallTab");
    sheet.addTab(manager.getContent(), "Manage");
    sheet.getTab(1).setId("AccumuloManageTab");
    sheet.addSelectedTabChangeListener(new TabSheet.SelectedTabChangeListener() {
        @Override
        public void selectedTabChange(TabSheet.SelectedTabChangeEvent event) {
            TabSheet tabsheet = event.getTabSheet();
            String caption = tabsheet.getTab(event.getTabSheet().getSelectedTab()).getCaption();
            if (caption.equals("Manage")) {
                manager.refreshClustersInfo();
            }
        }
    });
    verticalLayout.addComponent(sheet);
    setCompositionRoot(verticalLayout);
    manager.refreshClustersInfo();
}

From source file:jcaster_vaadin.Gui2.java

License:Open Source License

@AutoGenerated
private TabSheet buildTabSheet_1() {
    // common part: create layout
    tabSheet_1 = new TabSheet();
    tabSheet_1.setWidth("100.0%");
    tabSheet_1.setHeight("100.0%");
    tabSheet_1.setImmediate(true);//from w w w. j  a va 2s  . c o m

    // generalPanel
    generalPanel = buildGeneralPanel();
    tabSheet_1.addTab(generalPanel, "General settings", null);

    // videoPanel
    videoPanel = buildVideoPanel();
    tabSheet_1.addTab(videoPanel, "Video settings", null);

    // audioPanel
    audioPanel = buildAudioPanel();
    tabSheet_1.addTab(audioPanel, "Audio settings", null);

    return tabSheet_1;
}

From source file:jp.primecloud.auto.ui.MainView.java

License:Open Source License

@Override
public void attach() {
    setSizeFull();//from   w w  w .  j a v a 2  s  . c o m
    addStyleName("mycloud-panel");
    setMargin(false);
    setSpacing(false);

    // ???
    topBar = new TopBar(this);
    addComponent(topBar);

    // ???
    CssLayout topLayout = new CssLayout();
    topLayout.setWidth("100%");
    topLayout.setHeight("28px");
    topLayout.addStyleName("mycloud-name");
    topLayout.setMargin(true);
    addComponent(topLayout);

    // myCloud??
    myCloudField = new TextField();
    myCloudField.setWidth("80%");
    myCloudField.addStyleName("mycloud-label");
    myCloudField.setEnabled(false);
    myCloudField.setReadOnly(true);
    topLayout.addComponent(myCloudField);

    // Reload
    reloadButton = new Button(ViewProperties.getCaption("button.reload"));
    reloadButton.setDescription(ViewProperties.getCaption("description.reload"));
    reloadButton.addStyleName("sync-button");
    reloadButton.addStyleName("borderless");
    reloadButton.setIcon(Icons.SYNC.resource());
    reloadButton.setEnabled(false);
    reloadButton.addListener(new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            refresh();
        }
    });
    topLayout.addComponent(reloadButton);

    // myCloud
    VerticalLayout mainLayout = new VerticalLayout();
    mainLayout.setSizeFull();
    mainLayout.setSpacing(false);
    mainLayout.setMargin(false);

    Panel mainPanel = new Panel(mainLayout);
    mainPanel.setSizeFull();
    mainPanel.addStyleName(Reindeer.PANEL_LIGHT);
    addComponent(mainPanel);
    setExpandRatio(mainPanel, 100);

    // 
    tab = new TabSheet();
    tab.setSizeFull();
    tab.setEnabled(false);
    tab.addStyleName(Reindeer.TABSHEET_BORDERLESS);
    mainLayout.addComponent(tab);
    mainLayout.setExpandRatio(tab, 100);

    // 
    String enableService = Config.getProperty("ui.enableService");
    if (enableService == null || BooleanUtils.toBoolean(enableService)) {
        servicePanel = new ServicePanel(this);
        tab.addTab(servicePanel, ViewProperties.getCaption("tab.service"), Icons.SERVICETAB.resource());
    }

    // ?
    serverPanel = new ServerPanel(this);
    tab.addTab(serverPanel, ViewProperties.getCaption("tab.server"), Icons.SERVERTAB.resource());

    // ?
    String enableLoadBalancer = Config.getProperty("ui.enableLoadBalancer");
    if (enableLoadBalancer == null || BooleanUtils.toBoolean(enableLoadBalancer)) {
        loadBalancerPanel = new LoadBalancerPanel(this);
        tab.addTab(loadBalancerPanel, ViewProperties.getCaption("tab.loadbalancer"),
                Icons.LOADBALANCER_TAB.resource());
    }

    // ???????
    tab.addListener(new SelectedTabChangeListener() {
        @Override
        public void selectedTabChange(SelectedTabChangeEvent event) {
            MainView.this.selectedTabChange(event);
        }
    });

    // ?
    Refresher timer = new Refresher();
    timer.setRefreshInterval(15 * 1000); //(msec)
    timer.addListener(new Refresher.RefreshListener() {
        @Override
        public void refresh(Refresher source) {
            if (needsRefresh()) {
                refreshTableOnly();
            }
        }
    });
    mainLayout.addComponent(timer);

    // ?
    showLogin();
}

From source file:kn.uni.gis.ui.GameApplication.java

License:Apache License

private Window createGameWindow() {

    tabsheet = new TabSheet();
    tabsheet.setImmediate(true);/*from  ww  w .  j  av  a2  s  . c  o  m*/
    tabsheet.setCloseHandler(new CloseHandler() {
        @Override
        public void onTabClose(TabSheet tabsheet, Component tabContent) {

            Game game = ((GameComposite) tabContent).getGame();

            GameComposite remove = gameMap.remove(game);

            // closes the game and the running thread!
            remove.getLayer().handleApplicationClosedEvent(new ApplicationClosedEvent());

            eventBus.unregister(remove);
            eventBus.unregister(remove.getLayer());

            map.removeLayer(remove.getLayer());

            tabsheet.removeComponent(tabContent);

            if (gameMap.isEmpty()) {
                pi.setVisible(false);
            }
        }
    });

    final Window mywindow = new Window("Games");
    mywindow.setPositionX(0);
    mywindow.setPositionY(0);
    mywindow.setHeight("50%");
    mywindow.setWidth("25%");
    VerticalLayout layout = new VerticalLayout();
    HorizontalLayout lay = new HorizontalLayout();

    final Button button_1 = new Button();
    button_1.setCaption("Open Game");
    button_1.setWidth("-1px");
    button_1.setHeight("-1px");

    button_1.addListener(new ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            final String id = textField_1.getValue().toString();

            if (id.length() < 5) {
                window.showNotification("id must have at least 5 characters", Notification.TYPE_ERROR_MESSAGE);
            } else {
                String sql = String.format("select player_id,player_name,min(timestamp),max(timestamp) from %s"
                        + " where id LIKE ? group by player_id, player_name", GisResource.FOX_HUNTER);

                final Game game = new Game(id);
                final PreparedStatement statement = geoUtil.getConn()
                        .prepareStatement("select poly_geom,timestamp from " + GisResource.FOX_HUNTER
                                + " where id LIKE ? and player_id=? and timestamp > ? order by timestamp LIMIT "
                                + MAX_STATES_IN_MEM);

                try {
                    geoUtil.getConn().executeSafeQuery(sql, new DoWithin() {

                        @Override
                        public void doIt(ResultSet executeQuery) throws SQLException {

                            while (executeQuery.next()) {
                                if (statement == null) {

                                }
                                String playerId = executeQuery.getString(1);
                                Timestamp min = executeQuery.getTimestamp(3);
                                Timestamp max = executeQuery.getTimestamp(4);
                                game.addPlayer(playerId, executeQuery.getString(2), min, max,
                                        new TimingIterator(geoUtil, id, playerId, min.getTime(), statement));
                            }
                        }
                    }, id + "%");
                } catch (SQLException e) {
                    LOGGER.info("error on sql!", e);

                }

                game.finish(statement);

                if (!!!gameMap.containsKey(game)) {
                    if (game.getStates().size() == 0) {
                        window.showNotification("game not found!");
                    } else {
                        LOGGER.info("received game info: {},{} ", game.getId(), game.getStates().size());

                        GameVectorLayer gameVectorLayer = new GameVectorLayer(GameApplication.this, eventBus,
                                game, createColorMap(game));

                        final GameComposite gameComposite = new GameComposite(GameApplication.this, game,
                                gameVectorLayer, eventBus);

                        eventBus.register(gameComposite);
                        eventBus.register(gameVectorLayer);

                        map.addLayer(gameVectorLayer);
                        gameMap.put(game, gameComposite);

                        // Add the component to the tab sheet as a new tab.
                        Tab addTab = tabsheet.addTab(gameComposite);
                        addTab.setCaption(game.getId().substring(0, 5));
                        addTab.setClosable(true);

                        pi.setVisible(true);
                        // pl.get
                        PlayerState playerState = game.getStates().get(game.getFox()).peek();
                        map.zoomToExtent(new Bounds(CPOINT_TO_POINT.apply(playerState.getPoint())));
                    }
                }
            }
        }

        private Map<Player, Integer> createColorMap(Game game) {
            Function<Double, Double> scale = HardTasks.scale(0, game.getStates().size());

            ImmutableMap.Builder<Player, Integer> builder = ImmutableMap.builder();

            int i = 0;

            for (Player play : game.getStates().keySet()) {
                builder.put(play, getColor(scale.apply((double) i++)));
            }

            return builder.build();
        }

        private Integer getColor(double dob) {

            int toReturn = 0;
            toReturn = toReturn | 255 - (int) Math.round(255 * dob);
            toReturn = toReturn | (int) ((Math.round(255 * dob)) << 16);
            return toReturn;
            // return (int) (10000 + 35000 * dob + 5000 * dob + 1000 * dob +
            // 5 * dob);
        }

    });

    Button button_2 = new Button();
    button_2.setCaption("All seeing Hunter");
    button_2.setImmediate(false);
    button_2.setWidth("-1px");
    button_2.setHeight("-1px");
    button_2.addListener(new ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            if (adminWindow == null) {
                adminWindow = new AdminWindow(password, geoUtil, new ItemClickListener() {
                    @Override
                    public void itemClick(ItemClickEvent event) {

                        textField_1.setValue(event.getItemId().toString());
                        mywindow.bringToFront();
                        button_1.focus();
                    }
                });
                window.addWindow(adminWindow);
                adminWindow.setWidth("30%");
                adminWindow.setHeight("40%");
                adminWindow.addListener(new CloseListener() {
                    @Override
                    public void windowClose(CloseEvent e) {
                        adminWindow = null;
                    }
                });
            }
        }
    });

    lay.addComponent(button_1);
    textField_1 = new TextField();
    textField_1.setImmediate(false);
    textField_1.setWidth("-1px");
    textField_1.setHeight("-1px");
    lay.addComponent(textField_1);
    lay.addComponent(button_2);
    lay.addComponent(pi);

    lay.setComponentAlignment(pi, Alignment.TOP_RIGHT);

    layout.addComponent(lay);
    layout.addComponent(tabsheet);

    mywindow.addComponent(layout);
    mywindow.setClosable(false);

    /* Add the window inside the main window. */
    return mywindow;
}

From source file:life.qbic.components.qOfferManager.java

License:Open Source License

private void init() {

    DBManager.setCredentials();/*from ww w .j  a v a  2s .  c  om*/
    DBManager.getDatabaseInstance();
    db = Database.Instance;
    managerTabs = new TabSheet();

    /*    System.out.println(ft.format(dNow) + "  INFO  Offer Manager accessed! - User: "
            + LiferayAndVaadinUtils.getUser().getScreenName());*/

    managerTabs.addStyleName(ValoTheme.TABSHEET_FRAMED);
    managerTabs.addStyleName(ValoTheme.TABSHEET_EQUAL_WIDTH_TABS);

    final GridLayout gridLayout = new GridLayout(6, 6);
    gridLayout.setMargin(true);
    gridLayout.setSpacing(true);

    try {

        managerTabs.addTab(createOfferGeneratorTab(), "Offer Generator");
        managerTabs.addTab(createOfferManagerTab(), "Offer Manager");
        managerTabs.addTab(createPackageManagerTab(), "Package Manager");

        managerTabs.setSelectedTab(1); // show the offer manager first, since this will probably be mostly in use

        // TODO: make this more elegant
        // if one changes the tab e.g. from the offer manager to the package manager, creates a new package and goes
        // back to the offer manager tab, the package won't be updated -> workaround:
        // since the selected offer in the offer manager grid won't requery the database for the information needed, we
        // deselect the current offer (if any has been selected), so the user has to select the offer again -> information
        // for the database is queried again and e.g. the newly created packages are shown properly)
        managerTabs.addSelectedTabChangeListener((TabSheet.SelectedTabChangeListener) event -> {
            OfferManagerTab.getOfferManagerGrid().deselectAll();
            OfferManagerTab.getDetailsLayout().removeAllComponents();
        });

    } catch (SQLException e1) {
        e1.printStackTrace();
    }

    try {
        gridLayout.addComponent(managerTabs, 0, 1, 5, 1);
    } catch (OverlapsException | OutOfBoundsException e) {
        e.printStackTrace();
    }

    gridLayout.setSizeFull();
    setCompositionRoot(gridLayout);
}

From source file:net.sourceforge.javydreamercsw.validation.manager.web.admin.AdminScreenProvider.java

License:Apache License

public AdminScreenProvider() {
    adminSheet = new TabSheet();
}

From source file:nl.kpmg.lcm.ui.view.metadata.MetadataCreateWindow.java

License:Apache License

private void init() {
    tabsheet = new TabSheet();

    sectionPanel = initSectionPanel();/*  ww w  . j  a  v a 2  s. co m*/
    tabsheet.addTab(sectionPanel, "Section view");

    rawPanel = initRawPanel();
    tabsheet.addTab(rawPanel, "Raw view");
    tabsheet.addSelectedTabChangeListener((event) -> {
        if (event.getTabSheet().getSelectedTab() == rawPanel) {
            try {
                updateRawView();
            } catch (Property.ReadOnlyException | IOException ex) {
                Notification.show("Unable to merge metadata sections. Raw metadata is not updated!");
            }
        } else if (event.getTabSheet().getSelectedTab() == sectionPanel) {
            updateSectionView();
        }
    });

    this.setWidth(PANEL_WIDTH);
    this.setModal(true);

    FormLayout mainPanel = new FormLayout();
    mainPanel.addComponent(tabsheet);

    saveButton = new Button("Save");
    saveButton.addClickListener(this);
    mainPanel.addComponent(saveButton);

    this.setContent(mainPanel);
}

From source file:nl.kpmg.lcm.ui.view.metadata.MetadataEditWindow.java

License:Apache License

private void init() {
    Layout viewPanel = initViewPanel();/*from w  w  w . jav a  2 s.  c o  m*/
    Layout rawPanel = initRawPanel();
    Layout adminPanel = initAdministrationPanel();

    TabSheet tabsheet = new TabSheet();
    tabsheet.addTab(viewPanel, "View");
    tabsheet.addTab(rawPanel, "Raw");
    tabsheet.addTab(adminPanel, "Administration");

    this.setWidth(PANEL_SIZE);
    this.setHeight(PANEL_HEIGHT);
    this.setModal(true);
    this.setContent(tabsheet);
}