Example usage for com.vaadin.ui HorizontalLayout HorizontalLayout

List of usage examples for com.vaadin.ui HorizontalLayout HorizontalLayout

Introduction

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

Prototype

public HorizontalLayout() 

Source Link

Document

Constructs an empty HorizontalLayout.

Usage

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

License:Apache License

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

    getMinistryRankingMenuItemFactory().createMinistryRankingMenuBar(menuBar);

    final String pageId = getPageId(parameters);

    final HorizontalLayout chartLayout = new HorizontalLayout();
    chartLayout.setSizeFull();

    chartDataManager.createChartPanel(chartLayout, dataSeriesFactory.createMinistryChartTimeSeriesCurrent(),
            "Current Ministies, by headcount");
    panelContent.addComponent(chartLayout);

    panel.setCaption(CHARTS + parameters);

    getPageActionEventHelper().createPageEvent(ViewAction.VISIT_MINISTRY_RANKING_VIEW,
            ApplicationEventGroup.USER, NAME, parameters, pageId);

    return panelContent;

}

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

License:Apache License

@Secured({ "ROLE_ANONYMOUS", "ROLE_USER", "ROLE_ADMIN" })
@Override/*from  www .  java2s.c  om*/
public Layout createContent(final String parameters, final MenuBar menuBar, final Panel panel) {
    final VerticalLayout panelContent = createPanelContent();

    getMinistryRankingMenuItemFactory().createMinistryRankingMenuBar(menuBar);

    final String pageId = getPageId(parameters);

    final HorizontalLayout chartLayout = new HorizontalLayout();
    chartLayout.setSizeFull();

    chartDataManager.createChartPanel(chartLayout,
            dataSeriesFactory.createChartTimeSeriesCurrentGovernmentByParty(), "Current Parties, headcount");

    panelContent.addComponent(chartLayout);

    panel.setCaption(CHARTS + parameters);

    getPageActionEventHelper().createPageEvent(ViewAction.VISIT_MINISTRY_RANKING_VIEW,
            ApplicationEventGroup.USER, NAME, parameters, pageId);

    return panelContent;

}

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

License:Apache License

@Secured({ "ROLE_ANONYMOUS", "ROLE_USER", "ROLE_ADMIN" })
@Override//from w  w w . j a va 2s. co m
public Layout createContent(final String parameters, final MenuBar menuBar, final Panel panel) {
    final VerticalLayout panelContent = createPanelContent();

    final String pageId = getPageId(parameters);

    getPartyRankingMenuItemFactory().createPartyRankingMenuBar(menuBar);
    final HorizontalLayout chartLayout = new HorizontalLayout();
    chartLayout.setSizeFull();

    chartDataManager.createChartPanel(chartLayout, dataSeriesFactory.createPartyChartTimeSeriesAll(), "All");

    panelContent.addComponent(chartLayout);

    panel.setCaption(CHARTS + parameters);

    getPageActionEventHelper().createPageEvent(ViewAction.VISIT_PARTY_RANKING_VIEW, ApplicationEventGroup.USER,
            NAME, parameters, pageId);

    return panelContent;

}

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

License:Apache License

@Secured({ "ROLE_ANONYMOUS", "ROLE_USER", "ROLE_ADMIN" })
@Override//from  w w  w . j  av a  2s .c  o  m
public Layout createContent(final String parameters, final MenuBar menuBar, final Panel panel) {
    final VerticalLayout panelContent = createPanelContent();

    final String pageId = getPageId(parameters);

    getPartyRankingMenuItemFactory().createPartyRankingMenuBar(menuBar);
    final HorizontalLayout chartLayout = new HorizontalLayout();
    chartLayout.setSizeFull();

    chartDataManager.createChartPanel(chartLayout,
            dataSeriesFactory.createChartTimeSeriesCurrentCommitteeByParty(), "Current Committee");

    panelContent.addComponent(chartLayout);

    panel.setCaption(CHARTS + parameters);

    getPageActionEventHelper().createPageEvent(ViewAction.VISIT_PARTY_RANKING_VIEW, ApplicationEventGroup.USER,
            NAME, parameters, pageId);

    return panelContent;

}

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

License:Apache License

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

    final String pageId = getPageId(parameters);

    getPartyRankingMenuItemFactory().createPartyRankingMenuBar(menuBar);
    final HorizontalLayout chartLayout = new HorizontalLayout();
    chartLayout.setSizeFull();

    chartDataManager.createChartPanel(chartLayout,
            dataSeriesFactory.createChartTimeSeriesCurrentGovernmentByParty(), "Current Government");

    panelContent.addComponent(chartLayout);

    panel.setCaption(CHARTS + parameters);

    getPageActionEventHelper().createPageEvent(ViewAction.VISIT_PARTY_RANKING_VIEW, ApplicationEventGroup.USER,
            NAME, parameters, pageId);

    return panelContent;

}

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

License:Apache License

@Secured({ "ROLE_ANONYMOUS", "ROLE_USER", "ROLE_ADMIN" })
@Override//from  ww  w .  j a  va 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);

    getPartyRankingMenuItemFactory().createPartyRankingMenuBar(menuBar);
    final HorizontalLayout chartLayout = new HorizontalLayout();
    chartLayout.setSizeFull();

    chartDataManager.createChartPanel(chartLayout, dataSeriesFactory.createPartyChartTimeSeriesCurrent(),
            "Current");

    panelContent.addComponent(chartLayout);

    panel.setCaption(CHARTS + parameters);

    getPageActionEventHelper().createPageEvent(ViewAction.VISIT_PARTY_RANKING_VIEW, ApplicationEventGroup.USER,
            NAME, parameters, pageId);

    return panelContent;

}

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

License:Apache License

/**
 * Creates the overview content.//from  w w  w. j a v  a  2 s  .  c o  m
 *
 * @param panelContent
 *            the panel content
 * @param personData
 *            the person data
 * @param viewRiksdagenPolitician
 *            the view riksdagen politician
 * @param pageId
 */
private void createOverviewContent(final VerticalLayout panelContent, final PersonData personData,
        final ViewRiksdagenPolitician viewRiksdagenPolitician, final String pageId) {
    LabelFactory.createHeader2Label(panelContent, OVERVIEW);

    final VerticalLayout overviewLayout = new VerticalLayout();
    overviewLayout.setSizeFull();

    panelContent.addComponent(overviewLayout);
    panelContent.setExpandRatio(overviewLayout, ContentRatio.LARGE_FORM);

    getPoliticianMenuItemFactory().createOverviewPage(overviewLayout, pageId);

    final Link createPoliticianPageLink = getPageLinkFactory().createPoliticianPageLink(personData);
    panelContent.addComponent(createPoliticianPageLink);

    final Image image = new Image("",
            new ExternalResource(personData.getImageUrl192().replace("http://", "https://")));

    final HorizontalLayout horizontalLayout = new HorizontalLayout();
    horizontalLayout.setSizeFull();

    panelContent.addComponent(horizontalLayout);

    horizontalLayout.addComponent(image);

    getFormFactory().addFormPanelTextFields(horizontalLayout, new BeanItem<>(viewRiksdagenPolitician),
            ViewRiksdagenPolitician.class,
            Arrays.asList(new String[] { "firstName", "lastName", "gender", "bornYear", "party", "active",
                    "firstAssignmentDate", "lastAssignmentDate", "currentAssignments",
                    "currentMinistryAssignments", "currentSpeakerAssignments", "currentCommitteeAssignments",
                    "currentPartyAssignments", "totalMinistryAssignments", "totalCommitteeAssignments",
                    "totalSpeakerAssignments", "totalPartyAssignments", "totalAssignments", "totalDaysServed",
                    "activeEu", "totalDaysServedEu", "activeGovernment", "totalDaysServedGovernment",
                    "activeSpeaker", "totalDaysServedSpeaker", "activeCommittee", "totalDaysServedCommittee",
                    "activeParliament", "totalDaysServedParliament", "activeParty", "totalDaysServedParty" }));

    getGridFactory().createBasicBeanItemGrid(panelContent,
            new BeanItemContainer<>(DetailData.class, personData.getPersonDetailData().getDetailList()),
            "Detail", new String[] { "code", "detail" }, new String[] { "hjid", "intressentId", "detailType" },
            null, null, null);

    panelContent.setExpandRatio(createPoliticianPageLink, ContentRatio.SMALL);
    panelContent.setExpandRatio(horizontalLayout, ContentRatio.GRID);

}

From source file:com.haulmont.cuba.web.app.folders.CubaFoldersPane.java

License:Apache License

protected Component addFoldersLabel(AbstractLayout layout, Label label) {
    HorizontalLayout l = new HorizontalLayout();
    l.setMargin(new MarginInfo(false, true, false, true));
    l.addComponent(label);// www  .j  a v  a2 s .c o  m
    l.setWidth("100%");
    layout.addComponent(l);
    return l;
}

From source file:com.haulmont.cuba.web.app.folders.FolderEditWindow.java

License:Apache License

public FolderEditWindow(boolean adding, Folder folder, Presentations presentations, Runnable commitHandler) {
    this.folder = folder;
    this.commitHandler = commitHandler;

    messages = AppBeans.get(Messages.NAME);
    messagesPack = AppConfig.getMessagesPack();
    userSessionSource = AppBeans.get(UserSessionSource.NAME);
    Configuration configuration = AppBeans.get(Configuration.NAME);
    clientConfig = configuration.getConfig(ClientConfig.class);

    setCaption(adding ? getMessage("folders.folderEditWindow.adding") : getMessage("folders.folderEditWindow"));

    ThemeConstants theme = App.getInstance().getThemeConstants();
    setWidthUndefined();//w  w  w. j ava 2 s . c o m
    setResizable(false);

    int[] modifiers = { ShortcutAction.ModifierKey.CTRL };
    addAction(new ShortcutListener("commit", com.vaadin.event.ShortcutAction.KeyCode.ENTER, modifiers) {
        @Override
        public void handleAction(Object sender, Object target) {
            commit();
        }
    });

    layout = new VerticalLayout();
    layout.setWidthUndefined();
    layout.setSpacing(true);

    setContent(layout);
    setModal(true);
    center();

    String fieldWidth = theme.get("cuba.web.FolderEditWindow.field.width");

    nameField = new TextField();
    nameField.setRequired(true);
    nameField.setCaption(getMessage("folders.folderEditWindow.nameField"));
    nameField.setWidth(fieldWidth);
    nameField.setValue(folder.getName());
    nameField.focus();
    layout.addComponent(nameField);

    tabNameField = new TextField();
    tabNameField.setCaption(getMessage("folders.folderEditWindow.tabNameField"));
    tabNameField.setWidth(fieldWidth);
    tabNameField.setValue(StringUtils.trimToEmpty(folder.getTabName()));
    layout.addComponent(tabNameField);

    parentSelect = new ComboBox();
    parentSelect.setCaption(getMessage("folders.folderEditWindow.parentSelect"));
    parentSelect.setWidth(fieldWidth);
    parentSelect.setNullSelectionAllowed(true);
    fillParentSelect();
    parentSelect.setValue(folder.getParent());
    layout.addComponent(parentSelect);

    if (folder instanceof SearchFolder) {
        if (presentations != null) {
            presentation = new ComboBox();
            presentation.setCaption(getMessage("folders.folderEditWindow.presentation"));
            presentation.setWidth(fieldWidth);
            presentation.setNullSelectionAllowed(true);
            fillPresentations(presentations);
            presentation.setValue(((SearchFolder) folder).getPresentation());
            layout.addComponent(presentation);
        } else if (((SearchFolder) folder).getPresentation() != null) {
            selectedPresentationField = new TextField();
            selectedPresentationField.setWidth(fieldWidth);
            selectedPresentationField.setCaption(getMessage("folders.folderEditWindow.presentation"));
            selectedPresentationField.setValue(((SearchFolder) folder).getPresentation().getName());
            selectedPresentationField.setEnabled(false);
            layout.addComponent(selectedPresentationField);
        }
    }

    sortOrderField = new TextField();
    sortOrderField.setCaption(getMessage("folders.folderEditWindow.sortOrder"));
    sortOrderField.setWidth(fieldWidth);
    sortOrderField.setValue(folder.getSortOrder() == null ? "" : folder.getSortOrder().toString());
    layout.addComponent(sortOrderField);

    if (userSessionSource.getUserSession().isSpecificPermitted("cuba.gui.searchFolder.global")
            && folder instanceof SearchFolder && BooleanUtils.isNotTrue(((SearchFolder) folder).getIsSet())) {
        globalCb = new CubaCheckBox(getMessage("folders.folderEditWindow.global"));
        globalCb.setValue(((SearchFolder) folder).getUser() == null);
        layout.addComponent(globalCb);
    }

    applyDefaultCb = new CubaCheckBox(getMessage("folders.folderEditWindow.applyDefault"));
    applyDefaultCb.setValue(BooleanUtils.isTrue(((AbstractSearchFolder) folder).getApplyDefault()));
    applyDefaultCb.setVisible(clientConfig.getGenericFilterManualApplyRequired()
            && folder instanceof SearchFolder && BooleanUtils.isNotTrue(((SearchFolder) folder).getIsSet()));
    layout.addComponent(applyDefaultCb);

    HorizontalLayout buttonsLayout = new HorizontalLayout();
    buttonsLayout.setMargin(new MarginInfo(true, false, false, false));
    buttonsLayout.setSpacing(true);
    layout.addComponent(buttonsLayout);

    okBtn = new CubaButton(getMessage("actions.Ok"));
    okBtn.setIcon(WebComponentsHelper.getIcon("icons/ok.png"));
    okBtn.addStyleName(WebButton.ICON_STYLE);

    initButtonOkListener();
    buttonsLayout.addComponent(okBtn);

    cancelBtn = new CubaButton(getMessage("actions.Cancel"));
    cancelBtn.setIcon(WebComponentsHelper.getIcon("icons/cancel.png"));
    cancelBtn.addStyleName(WebButton.ICON_STYLE);
    cancelBtn.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            close();
        }
    });
    buttonsLayout.addComponent(cancelBtn);

    if (AppUI.getCurrent().isTestMode()) {
        setCubaId("folderEditWindow");

        nameField.setCubaId("nameField");
        tabNameField.setCubaId("tabNameField");
        parentSelect.setCubaId("parentSelect");
        if (presentation != null) {
            presentation.setCubaId("presentationSelect");
        }
        sortOrderField.setCubaId("sortOrderField");
        if (selectedPresentationField != null) {
            selectedPresentationField.setCubaId("selectedPresentationField");
        }
        if (globalCb != null) {
            globalCb.setCubaId("globalCb");
        }
        applyDefaultCb.setCubaId("applyDefaultCb");
        okBtn.setCubaId("okBtn");
        cancelBtn.setCubaId("cancelBtn");
    }
}

From source file:com.haulmont.cuba.web.exception.ExceptionDialog.java

License:Apache License

public ExceptionDialog(Throwable throwable, @Nullable String caption, @Nullable String message) {
    final AppUI ui = AppUI.getCurrent();

    String closeShortcut = clientConfig.getCloseShortcut();
    KeyCombination closeCombination = KeyCombination.create(closeShortcut);

    com.vaadin.event.ShortcutAction closeShortcutAction = new com.vaadin.event.ShortcutAction(
            "closeShortcutAction", closeCombination.getKey().getCode(),
            KeyCombination.Modifier.codes(closeCombination.getModifiers()));

    addActionHandler(new com.vaadin.event.Action.Handler() {
        @Override/*from   ww w.  j a  v  a 2 s .  co m*/
        public com.vaadin.event.Action[] getActions(Object target, Object sender) {
            return new com.vaadin.event.Action[] { closeShortcutAction };
        }

        @Override
        public void handleAction(com.vaadin.event.Action action, Object sender, Object target) {
            if (Objects.equals(action, closeShortcutAction)) {
                close();
            }
        }
    });

    setCaption(caption != null ? caption : messages.getMainMessage("exceptionDialog.caption"));

    ThemeConstants theme = ui.getApp().getThemeConstants();
    setWidth(theme.get("cuba.web.ExceptionDialog.width"));
    center();

    final String text = message != null ? message : getText(throwable);
    Throwable exception = removeRemoteException(throwable);
    final String stackTrace = getStackTrace(exception);

    mainLayout = new VerticalLayout();
    mainLayout.setSpacing(true);

    TextArea textArea = new TextArea();
    textArea.setHeight(theme.get("cuba.web.ExceptionDialog.textArea.height"));
    textArea.setWidth(100, Unit.PERCENTAGE);

    boolean showExceptionDetails = userSessionSource.getUserSession() != null
            && security.isSpecificPermitted("cuba.gui.showExceptionDetails");

    if (showExceptionDetails) {
        textArea.setValue(text);
    } else {
        textArea.setValue(messages.getMainMessage("exceptionDialog.contactAdmin"));
    }
    textArea.setReadOnly(true);

    mainLayout.addComponent(textArea);

    HorizontalLayout buttonsLayout = new HorizontalLayout();
    buttonsLayout.setSpacing(true);
    buttonsLayout.setWidth("100%");
    mainLayout.addComponent(buttonsLayout);

    Button closeButton = new CubaButton(messages.getMainMessage("exceptionDialog.closeBtn"));
    closeButton.addClickListener((Button.ClickListener) event -> this.close());
    buttonsLayout.addComponent(closeButton);

    showStackTraceButton = new CubaButton(messages.getMainMessage("exceptionDialog.showStackTrace"));
    showStackTraceButton
            .addClickListener((Button.ClickListener) event -> setStackTraceVisible(!isStackTraceVisible));
    buttonsLayout.addComponent(showStackTraceButton);
    showStackTraceButton.setVisible(showExceptionDetails);

    Label spacer = new Label();
    buttonsLayout.addComponent(spacer);
    buttonsLayout.setExpandRatio(spacer, 1);

    String cubaLogContentClass = "c-exception-dialog-log-content";
    String cubaCopyLogContentClass = cubaLogContentClass + "-" + UUID.randomUUID();

    if (browserSupportCopy()) {
        copyButton = new CubaButton(messages.getMainMessage("exceptionDialog.copyStackTrace"));
        copyButton.setVisible(false);
        CubaCopyButtonExtension copyExtension = CubaCopyButtonExtension.copyWith(copyButton,
                cubaCopyLogContentClass);
        copyExtension
                .addCopyListener(
                        event -> Notification.show(
                                messages.getMainMessage(event.isSuccess() ? "exceptionDialog.copingSuccessful"
                                        : "exceptionDialog.copingFailed"),
                                Notification.Type.TRAY_NOTIFICATION));
        buttonsLayout.addComponent(copyButton);
    }

    if (userSessionSource.getUserSession() != null) {
        if (!StringUtils.isBlank(clientConfig.getSupportEmail())) {
            Button reportButton = new CubaButton(messages.getMainMessage("exceptionDialog.reportBtn"));
            reportButton.addClickListener((Button.ClickListener) event -> {
                sendSupportEmail(text, stackTrace);
                reportButton.setEnabled(false);
            });
            buttonsLayout.addComponent(reportButton);

            if (ui.isTestMode()) {
                reportButton.setCubaId("errorReportButton");
            }
        }
    }

    Button logoutButton = new CubaButton(messages.getMainMessage("exceptionDialog.logout"));
    logoutButton.addClickListener((Button.ClickListener) event -> logoutPrompt());
    buttonsLayout.addComponent(logoutButton);

    stackTraceTextArea = new TextArea();
    stackTraceTextArea.setSizeFull();
    stackTraceTextArea.setWordwrap(false);
    stackTraceTextArea.setValue(stackTrace);
    stackTraceTextArea.setStyleName(cubaLogContentClass);
    stackTraceTextArea.addStyleName(cubaCopyLogContentClass);
    stackTraceTextArea.setReadOnly(true);

    setContent(mainLayout);
    setResizable(false);

    if (ui.isTestMode()) {
        setId(ui.getTestIdManager().getTestId("exceptionDialog"));
        setCubaId("exceptionDialog");

        closeButton.setCubaId("closeButton");
        if (copyButton != null) {
            copyButton.setCubaId("copyStackTraceButton");
        }
        showStackTraceButton.setCubaId("showStackTraceButton");
        stackTraceTextArea.setCubaId("stackTraceTextArea");
        logoutButton.setCubaId("logoutButton");
    }
}