Example usage for com.vaadin.ui TabSheet setWidth

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

Introduction

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

Prototype

@Override
    public void setWidth(float width, Unit unit) 

Source Link

Usage

From source file:cb_server.SettingsWindow.java

License:Open Source License

private void fillContent() {

    if (Settingscontent != null) {
        content.removeComponent(Settingscontent);
        Settingscontent = null;/*  ww w .ja va  2  s .c  o m*/
    }

    Settingscontent = new VerticalLayout();
    content.addComponent(Settingscontent);

    InetAddress addr;
    QRCode code = null;
    try {
        addr = InetAddress.getLocalHost();

        //Getting IPAddress of localhost - getHostAddress return IP Address
        // in textual format
        String ipAddress = addr.getHostAddress();

        ipAddress = "";
        // Network Interfaces nach IPv4 Adressen durchsuchen
        try {
            Enumeration<NetworkInterface> nets = NetworkInterface.getNetworkInterfaces();
            for (NetworkInterface netint : Collections.list(nets)) {
                Enumeration<InetAddress> inetAddresses = netint.getInetAddresses();
                for (InetAddress inetAddress : Collections.list(inetAddresses)) {
                    if (inetAddress.isLoopbackAddress())
                        continue;
                    if (inetAddress instanceof Inet4Address) {
                        System.out.println("InetAddress: " + inetAddress);
                        if (ipAddress.length() > 0) {
                            ipAddress += ";";
                        }
                        ipAddress += inetAddress;
                    }
                }
            }

        } catch (SocketException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

        code = new QRCode();
        code.setWidth(150, Unit.PIXELS);
        code.setHeight(150, Unit.PIXELS);
        code.setValue(ipAddress);

    } catch (UnknownHostException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

    TabSheet tabSheet = new TabSheet();
    tabSheet.setWidth(100, Unit.PERCENTAGE);
    tabSheet.setHeight(100, Unit.PERCENTAGE);
    Settingscontent.addComponent(tabSheet);

    VerticalLayout lay = new VerticalLayout();

    // add Lang Spinner

    langSpinner = new ComboBox();
    langSpinner.setCaption("select Lang");

    for (Lang lang : Translation.GetLangs(SettingsClass.LanguagePath.getValue())) {
        langSpinner.addItem(lang.Name);
        langSpinner.setItemCaption(lang.Name, lang.Name);
    }

    langSpinner.setValue(Translation.getLangId());
    langSpinner.setNullSelectionAllowed(false);
    lay.addComponent(langSpinner);

    lay.addComponent(code);
    SettingsLinearLayoutPanel info = new SettingsLinearLayoutPanel();

    info.setContent(lay, 400);

    tabSheet.addTab(info, "Info");

    // Categorie List zusammen stellen

    if (Categorys == null) {
        Categorys = new ArrayList<SettingCategory>();
    }

    Categorys.clear();
    SettingCategory[] tmp = SettingCategory.values();
    for (SettingCategory item : tmp) {
        if (item != SettingCategory.Button) {
            Categorys.add(item);
        }

    }

    Iterator<SettingCategory> iteratorCat = Categorys.iterator();
    if (iteratorCat != null && iteratorCat.hasNext()) {

        ArrayList<SettingBase<?>> SortedSettingList = new ArrayList<SettingBase<?>>();

        for (Iterator<SettingBase<?>> it = Config.settings.iterator(); it.hasNext();) {
            SettingBase<?> setting = it.next();

            if (setting.getModus() != SettingModus.Never
                    && (setting.getUsage() == SettingUsage.ALL || setting.getUsage() == SettingUsage.CBS)) {
                SortedSettingList.add(setting);
            }
        }

        do {
            int position = 0;

            SettingCategory cat = iteratorCat.next();

            // add Cat eintrge

            lay = new VerticalLayout();
            int entryCount = 0;

            if (cat == SettingCategory.Login) {
                final Component view = getLogInButton(position++);
                lay.addComponent(view);
            }

            // int layoutHeight = 0;
            for (Iterator<SettingBase<?>> it = SortedSettingList.iterator(); it.hasNext();) {
                SettingBase<?> settingItem = it.next();
                if (settingItem.getCategory().name().equals(cat.name())) {

                    if ((settingItem.getModus() == SettingModus.Normal)
                            && (settingItem.getModus() != SettingModus.Never)) {

                        final Component view = getView(settingItem, position++);

                        if (view == null)
                            continue;

                        lay.addComponent(view);
                        entryCount++;
                        Config.settings.indexOf(settingItem);

                    }

                }
            }

            if (entryCount > 0) {

                SettingsLinearLayoutPanel catPanel = new SettingsLinearLayoutPanel();

                catPanel.setContent(lay, 400);

                tabSheet.addTab(catPanel, cat.name());

                //               addControlToLinearLayout(lay, 100);

            }

        } while (iteratorCat.hasNext());

    }

}

From source file:com.hack23.cia.web.impl.ui.application.views.common.pagemode.AbstractPageModContentFactoryImpl.java

License:Apache License

/**
 * Creates the page visit history./*w w w .j  ava2  s . co  m*/
 *
 * @param pageName
 *            the page name
 * @param pageId
 *            the page id
 * @param panelContent
 *            the panel content
 */
protected final void createPageVisitHistory(final String pageName, final String pageId,
        final VerticalLayout panelContent) {

    final TabSheet tabsheet = new TabSheet();
    tabsheet.setWidth(100, Unit.PERCENTAGE);
    tabsheet.setHeight(100, Unit.PERCENTAGE);

    panelContent.addComponent(tabsheet);
    panelContent.setExpandRatio(tabsheet, ContentRatio.LARGE);

    final HorizontalLayout tabContentPageItemRankHistory = new HorizontalLayout();
    tabContentPageItemRankHistory.setWidth(100, Unit.PERCENTAGE);
    tabContentPageItemRankHistory.setHeight(100, Unit.PERCENTAGE);
    final Tab tabPageItemRankHistory = tabsheet.addTab(tabContentPageItemRankHistory);

    tabPageItemRankHistory.setCaption(CURRENT_PAGE_VISIT_HISTORY);
    adminChartDataManager.createApplicationActionEventPageElementDailySummaryChart(
            tabContentPageItemRankHistory, pageName, pageId);

    final HorizontalLayout tabContentPageModeSummary = new HorizontalLayout();
    tabContentPageModeSummary.setWidth(100, Unit.PERCENTAGE);
    tabContentPageModeSummary.setHeight(100, Unit.PERCENTAGE);
    final Tab tabPageModeSummary = tabsheet.addTab(tabContentPageModeSummary);
    tabPageModeSummary.setCaption(GENERAL_PAGE_MODE_PAGE_VISIT);

    adminChartDataManager.createApplicationActionEventPageModeDailySummaryChart(tabContentPageModeSummary,
            pageName);

}

From source file:com.hack23.cia.web.impl.ui.application.views.user.ballot.pagemode.BallotChartsPageModContentFactoryImpl.java

License:Apache License

@Secured({ "ROLE_ANONYMOUS", "ROLE_USER", "ROLE_ADMIN" })
@Override/*w ww .ja  v  a 2  s  .  c  om*/
public Layout createContent(final String parameters, final MenuBar menuBar, final Panel panel) {
    final VerticalLayout panelContent = createPanelContent();

    final String pageId = getPageId(parameters);

    final DataContainer<ViewRiksdagenVoteDataBallotSummary, RiksdagenVoteDataBallotEmbeddedId> dataContainer = getApplicationManager()
            .getDataContainer(ViewRiksdagenVoteDataBallotSummary.class);

    final DataContainer<ViewRiksdagenVoteDataBallotPartySummary, RiksdagenVoteDataBallotPartyEmbeddedId> dataPartyContainer = getApplicationManager()
            .getDataContainer(ViewRiksdagenVoteDataBallotPartySummary.class);

    final List<ViewRiksdagenVoteDataBallotSummary> ballots = dataContainer.findListByEmbeddedProperty(
            ViewRiksdagenVoteDataBallotSummary.class, ViewRiksdagenVoteDataBallotSummary_.embeddedId,
            RiksdagenVoteDataBallotEmbeddedId.class, RiksdagenVoteDataBallotEmbeddedId_.ballotId, pageId);

    final List<ViewRiksdagenVoteDataBallotPartySummary> partyBallotList = dataPartyContainer
            .findListByEmbeddedProperty(ViewRiksdagenVoteDataBallotPartySummary.class,
                    ViewRiksdagenVoteDataBallotPartySummary_.embeddedId,
                    RiksdagenVoteDataBallotPartyEmbeddedId.class,
                    RiksdagenVoteDataBallotPartyEmbeddedId_.ballotId, pageId);

    if (!ballots.isEmpty()) {
        getBallotMenuItemFactory().createBallotMenuBar(menuBar, pageId);

        LabelFactory.createHeader2Label(panelContent, CHARTS);

        final TabSheet tabsheet = new TabSheet();
        tabsheet.setWidth(100, Unit.PERCENTAGE);
        tabsheet.setHeight(100, Unit.PERCENTAGE);

        panelContent.addComponent(tabsheet);
        panelContent.setExpandRatio(tabsheet, ContentRatio.LARGE);

        Collections.sort(ballots,
                (Comparator<ViewRiksdagenVoteDataBallotSummary>) (o1,
                        o2) -> (o1.getEmbeddedId().getIssue() + o2.getEmbeddedId().getConcern())
                                .compareTo(o1.getEmbeddedId().getIssue() + o2.getEmbeddedId().getConcern()));

        for (final ViewRiksdagenVoteDataBallotSummary viewRiksdagenVoteDataBallotSummary : ballots) {
            final HorizontalLayout tabContent = new HorizontalLayout();
            tabContent.setWidth(100, Unit.PERCENTAGE);
            tabContent.setHeight(100, Unit.PERCENTAGE);
            final Tab tab = tabsheet.addTab(tabContent);

            ballotChartDataManager.createChart(tab, tabContent, viewRiksdagenVoteDataBallotSummary);
        }

        final Map<String, List<ViewRiksdagenVoteDataBallotPartySummary>> concernIssuePartyBallotSummaryMap = createIssueConcernMap(
                partyBallotList);

        for (final List<ViewRiksdagenVoteDataBallotPartySummary> partyBallotSummaryList : concernIssuePartyBallotSummaryMap
                .values()) {
            final HorizontalLayout tabContent = new HorizontalLayout();
            tabContent.setWidth(100, Unit.PERCENTAGE);
            tabContent.setHeight(100, Unit.PERCENTAGE);
            final Tab tab = tabsheet.addTab(tabContent);

            ballotChartDataManager.createChart(tab, tabContent, partyBallotSummaryList);
        }

        panel.setCaption(BALLOT + pageId);
        getPageActionEventHelper().createPageEvent(ViewAction.VISIT_BALLOT_VIEW, ApplicationEventGroup.USER,
                NAME, parameters, pageId);
    }
    return panelContent;

}

From source file:cz.zcu.pia.social.network.frontend.views.ViewProfile.java

/**
 * PostConstruct//w ww  . j  a va2  s .  co m
 */
@PostConstruct
@Override
public void postConstruct() {
    super.postConstruct();
    if (!securityHelper.isAuthenticated()) {
        ((MyUI) UI.getCurrent().getUI()).getNavigator().navigateTo(ViewHome.NAME);
    }
    TabSheet tabsheet = new TabSheet();
    tabsheet.setWidth(COMPONENT_WIDTH, Unit.PIXELS);
    tabsheet.addTab(friends, msgs.getMessage("view.profile.tab.friends"));
    tabsheet.addTab(profile, msgs.getMessage("view.profile.tab.profile"));
    this.getContentWrapper().addComponent(tabsheet);
    //this.getContentWrapper().addComponent();

}

From source file:org.eclipse.hawkbit.ui.rollout.rollout.AddUpdateRolloutWindowLayout.java

License:Open Source License

private TabSheet createGroupDefinitionTabs() {
    final TabSheet tabSheet = new TabSheet();
    tabSheet.setId(UIComponentIdProvider.ROLLOUT_GROUPS);
    tabSheet.setWidth(850, Unit.PIXELS);
    tabSheet.setHeight(300, Unit.PIXELS);
    tabSheet.setStyleName(SPUIStyleDefinitions.ROLLOUT_GROUPS);

    final TabSheet.Tab simpleTab = tabSheet.addTab(createSimpleGroupDefinitionTab(),
            i18n.getMessage("caption.rollout.tabs.simple"));
    simpleTab.setId(UIComponentIdProvider.ROLLOUT_SIMPLE_TAB);

    final TabSheet.Tab advancedTab = tabSheet.addTab(defineGroupsLayout,
            i18n.getMessage("caption.rollout.tabs.advanced"));
    advancedTab.setId(UIComponentIdProvider.ROLLOUT_ADVANCED_TAB);

    tabSheet.addSelectedTabChangeListener(event -> validateGroups());

    return tabSheet;
}