Java Code Examples for com.vaadin.ui.VerticalLayout#setStyleName()

The following examples show how to use com.vaadin.ui.VerticalLayout#setStyleName() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DemoUI.java    From gantt with Apache License 2.0 6 votes vote down vote up
@Override
protected void init(VaadinRequest request) {
    ganttListener = null;
    createGantt();

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

    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.setMargin(false);
    layout.setSizeFull();
    layout.addComponent(menu);
    layout.addComponent(controls);
    layout.addComponent(wrapper);
    layout.setExpandRatio(wrapper, 1);

    setContent(layout);
}
 
Example 2
Source File: UploadDropAreaLayout.java    From hawkbit with Eclipse Public License 1.0 6 votes vote down vote up
private VerticalLayout createDropAreaLayout() {
    final VerticalLayout dropAreaLayout = new VerticalLayout();
    final Label dropHereLabel = new Label(i18n.getMessage(UIMessageIdProvider.LABEL_DROP_AREA_UPLOAD));
    dropHereLabel.setWidth(null);

    final Label dropIcon = new Label(FontAwesome.ARROW_DOWN.getHtml(), ContentMode.HTML);
    dropIcon.addStyleName("drop-icon");
    dropIcon.setWidth(null);

    dropAreaLayout.addComponent(dropIcon);
    dropAreaLayout.setComponentAlignment(dropIcon, Alignment.TOP_CENTER);
    dropAreaLayout.addComponent(dropHereLabel);
    dropAreaLayout.setComponentAlignment(dropHereLabel, Alignment.TOP_CENTER);

    uploadButtonLayout.setWidth(null);
    uploadButtonLayout.addStyleName("upload-button");
    dropAreaLayout.addComponent(uploadButtonLayout);
    dropAreaLayout.setComponentAlignment(uploadButtonLayout, Alignment.BOTTOM_CENTER);

    dropAreaLayout.setSizeFull();
    dropAreaLayout.setStyleName("upload-drop-area-layout-info");
    dropAreaLayout.setSpacing(false);
    return dropAreaLayout;
}
 
Example 3
Source File: GroupsLegendLayout.java    From hawkbit with Eclipse Public License 1.0 6 votes vote down vote up
private void init() {

        totalTargetsLabel = createTotalTargetsLabel();
        unassignedTargetsLabel = createUnassignedTargetsLabel();
        loadingLabel = createLoadingLabel();
        loadingLabel.setVisible(false);

        groupsLegend = new VerticalLayout();
        groupsLegend.setStyleName("groups-legend");

        addComponent(totalTargetsLabel);
        addComponent(loadingLabel);
        addComponent(unassignedTargetsLabel);
        addComponent(groupsLegend);
        for (int i = 0; i < MAX_GROUPS_TO_BE_DISPLAYED; i++) {
            groupsLegend.addComponent(createGroupTargetsLabel());
        }
        groupsLegend.addComponent(createToBeContinuedLabel());

    }
 
Example 4
Source File: FilterManagementView.java    From hawkbit with Eclipse Public License 1.0 6 votes vote down vote up
private void buildFilterDetailOrCreateView() {
    removeAllComponents();
    final VerticalLayout tableHeaderLayout = new VerticalLayout();
    tableHeaderLayout.setSizeFull();
    tableHeaderLayout.setSpacing(false);
    tableHeaderLayout.setMargin(false);
    tableHeaderLayout.setStyleName("table-layout");
    tableHeaderLayout.addComponent(createNewFilterHeader);
    tableHeaderLayout.setComponentAlignment(createNewFilterHeader, Alignment.TOP_CENTER);
    tableHeaderLayout.addComponent(createNewFilterTable);
    tableHeaderLayout.setComponentAlignment(createNewFilterTable, Alignment.TOP_CENTER);
    tableHeaderLayout.setExpandRatio(createNewFilterTable, 1.0F);

    addComponent(tableHeaderLayout);
    setComponentAlignment(tableHeaderLayout, Alignment.TOP_CENTER);
    setExpandRatio(tableHeaderLayout, 1.0F);

    final HorizontalLayout targetsCountmessageLabelLayout = addTargetFilterMessageLabel();
    addComponent(targetsCountmessageLabelLayout);
    setComponentAlignment(targetsCountmessageLabelLayout, Alignment.BOTTOM_CENTER);

}
 
Example 5
Source File: WebDialogs.java    From cuba with Apache License 2.0 5 votes vote down vote up
public MessageDialogBuilderImpl() {
    window = new CubaWindow();

    window.setModal(true);
    window.setResizable(false);

    layout = new VerticalLayout();
    layout.setStyleName("c-app-message-dialog");
    layout.setMargin(false);
    layout.setSpacing(true);

    messageLabel = new CubaLabel();
    messageLabel.setStyleName("c-app-message-dialog-text");
    messageLabel.setWidth(100, Sizeable.Unit.PERCENTAGE);

    DialogAction action = new DialogAction(DialogAction.Type.OK);
    okButton = createButton(action);
    okButton.setClickHandler(me -> {
        try {
            action.actionPerform(ui.getTopLevelWindow());
        } finally {
            ui.removeWindow(window);
        }
    });

    layout.addComponent(messageLabel);

    layout.addComponent(okButton);
    layout.setComponentAlignment(okButton, Alignment.BOTTOM_RIGHT);

    window.setContent(layout);

    ThemeConstants theme = ui.getApp().getThemeConstants();
    window.setWidth(theme.get("cuba.web.WebWindowManager.messageDialog.width"));
}
 
Example 6
Source File: LoadBalancerDescServer.java    From primecloud-controller with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void attach() {
    setCaption(ViewProperties.getCaption("table.loadBalancerDetailInfo"));
    setHeight("100%");
    setStyleName("loadbalancer-desc-basic-panel");

    VerticalLayout layout = (VerticalLayout) getContent();
    layout.setStyleName("loadbalancer-desc-basic-panel");
    layout.setMargin(true);
}
 
Example 7
Source File: AbstractPageModContentFactoryImpl.java    From cia with Apache License 2.0 5 votes vote down vote up
/**
 * Creates the panel content.
 *
 * @return the vertical layout
 */
protected final VerticalLayout createPanelContent() {
	final VerticalLayout panelContent = new VerticalLayout();
	panelContent.setMargin(true);
	panelContent.setWidth(100, Unit.PERCENTAGE);
	panelContent.setHeight(100, Unit.PERCENTAGE);
	panelContent.setStyleName("Header");
	return panelContent;
}
 
Example 8
Source File: AbstractTableLayout.java    From hawkbit with Eclipse Public License 1.0 5 votes vote down vote up
private void buildLayout() {
    setSizeFull();
    setSpacing(true);
    setMargin(false);
    setStyleName("group");
    final VerticalLayout tableHeaderLayout = new VerticalLayout();
    tableHeaderLayout.setSizeFull();
    tableHeaderLayout.setSpacing(false);
    tableHeaderLayout.setMargin(false);

    tableHeaderLayout.setStyleName("table-layout");
    tableHeaderLayout.addComponent(tableHeader);

    tableHeaderLayout.setComponentAlignment(tableHeader, Alignment.TOP_CENTER);
    if (isShortCutKeysRequired()) {
        final Panel tablePanel = new Panel();
        tablePanel.setStyleName("table-panel");
        tablePanel.setHeight(100.0F, Unit.PERCENTAGE);
        tablePanel.setContent(table);
        tablePanel.addActionHandler(getShortCutKeysHandler(i18n));
        tablePanel.addStyleName(ValoTheme.PANEL_BORDERLESS);
        tableHeaderLayout.addComponent(tablePanel);
        tableHeaderLayout.setComponentAlignment(tablePanel, Alignment.TOP_CENTER);
        tableHeaderLayout.setExpandRatio(tablePanel, 1.0F);
    } else {
        tableHeaderLayout.addComponent(table);
        tableHeaderLayout.setComponentAlignment(table, Alignment.TOP_CENTER);
        tableHeaderLayout.setExpandRatio(table, 1.0F);
    }

    addComponent(tableHeaderLayout);
    addComponent(detailsLayout);
    setComponentAlignment(tableHeaderLayout, Alignment.TOP_CENTER);
    setComponentAlignment(detailsLayout, Alignment.TOP_CENTER);
    setExpandRatio(tableHeaderLayout, 1.0F);
}
 
Example 9
Source File: AbstractGridComponentLayout.java    From hawkbit with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Layouts header, grid and optional footer.
 */
protected void buildLayout() {
    setSizeFull();
    setSpacing(true);
    setMargin(false);
    setStyleName("group");
    final VerticalLayout gridHeaderLayout = new VerticalLayout();
    gridHeaderLayout.setSizeFull();
    gridHeaderLayout.setSpacing(false);
    gridHeaderLayout.setMargin(false);

    gridHeaderLayout.setStyleName("table-layout");
    gridHeaderLayout.addComponent(gridHeader);

    gridHeaderLayout.setComponentAlignment(gridHeader, Alignment.TOP_CENTER);
    gridHeaderLayout.addComponent(grid);
    gridHeaderLayout.setComponentAlignment(grid, Alignment.TOP_CENTER);
    gridHeaderLayout.setExpandRatio(grid, 1.0F);

    addComponent(gridHeaderLayout);
    setComponentAlignment(gridHeaderLayout, Alignment.TOP_CENTER);
    setExpandRatio(gridHeaderLayout, 1.0F);
    if (hasFooterSupport()) {
        final Layout footerLayout = getFooterSupport().createFooterMessageComponent();
        addComponent(footerLayout);
        setComponentAlignment(footerLayout, Alignment.BOTTOM_CENTER);
    }

}
 
Example 10
Source File: FilterManagementView.java    From hawkbit with Eclipse Public License 1.0 5 votes vote down vote up
private void viewListView() {
    removeAllComponents();
    final VerticalLayout tableListViewLayout = new VerticalLayout();
    tableListViewLayout.setSizeFull();
    tableListViewLayout.setSpacing(false);
    tableListViewLayout.setMargin(false);
    tableListViewLayout.setStyleName("table-layout");
    tableListViewLayout.addComponent(targetFilterHeader);
    tableListViewLayout.setComponentAlignment(targetFilterHeader, Alignment.TOP_CENTER);
    tableListViewLayout.addComponent(targetFilterTable);
    tableListViewLayout.setComponentAlignment(targetFilterTable, Alignment.TOP_CENTER);
    tableListViewLayout.setExpandRatio(targetFilterTable, 1.0F);
    addComponent(tableListViewLayout);
}
 
Example 11
Source File: WebDialogs.java    From cuba with Apache License 2.0 5 votes vote down vote up
public OptionDialogBuilderImpl() {
    window = new CubaWindow();

    window.setModal(true);
    window.setClosable(false);
    window.setResizable(false);

    messageLabel = new CubaLabel();
    messageLabel.setWidth(100, Sizeable.Unit.PERCENTAGE);

    layout = new VerticalLayout();
    layout.setStyleName("c-app-option-dialog");
    layout.setMargin(false);
    layout.setSpacing(true);

    buttonsContainer = new HorizontalLayout();
    buttonsContainer.setMargin(false);
    buttonsContainer.setSpacing(true);

    layout.addComponent(messageLabel);
    layout.addComponent(buttonsContainer);

    layout.setExpandRatio(messageLabel, 1);
    layout.setComponentAlignment(buttonsContainer, Alignment.BOTTOM_RIGHT);

    window.setContent(layout);

    ThemeConstants theme = ui.getApp().getThemeConstants();
    window.setWidth(theme.get("cuba.web.WebWindowManager.optionDialog.width"));
}
 
Example 12
Source File: AbbreviatedCellClickListener.java    From cuba with Apache License 2.0 4 votes vote down vote up
@SuppressWarnings("unchecked")
@Override
public void onClick(Entity item, String columnId) {
    Table.Column column = table.getColumn(columnId);
    MetaProperty metaProperty;
    String value;
    if (DynamicAttributesUtils.isDynamicAttribute(columnId)) {
        metaProperty = dynamicAttributesTools.getMetaPropertyPath(item.getMetaClass(), columnId).getMetaProperty();
        value = dynamicAttributesTools.getDynamicAttributeValueAsString(metaProperty, item.getValueEx(columnId));
    } else {
        value = item.getValueEx(columnId);
    }
    if (column.getMaxTextLength() != null) {
        boolean isMultiLineCell = StringUtils.contains(value, "\n");
        if (value == null || (value.length() <= column.getMaxTextLength() + MAX_TEXT_LENGTH_GAP
                && !isMultiLineCell)) {
            // todo artamonov if we click with CTRL and Table is multiselect then we lose previous selected items
            if (!table.getSelected().contains(item)) {
                table.setSelected(item);
            }
            // do not show popup view
            return;
        }
    }

    VerticalLayout layout = new VerticalLayout();
    layout.setMargin(false);
    layout.setSpacing(false);
    layout.setWidthUndefined();
    layout.setStyleName("c-table-view-textcut");

    CubaTextArea textArea = new CubaTextArea();
    textArea.setValue(Strings.nullToEmpty(value));
    textArea.setReadOnly(true);

    CubaResizableTextAreaWrapper content = new CubaResizableTextAreaWrapper(textArea);
    content.setResizableDirection(ResizeDirection.BOTH);

    // todo implement injection for ThemeConstains in components
    ThemeConstants theme = App.getInstance().getThemeConstants();
    if (theme != null) {
        content.setWidth(theme.get("cuba.web.Table.abbreviatedPopupWidth"));
        content.setHeight(theme.get("cuba.web.Table.abbreviatedPopupHeight"));
    } else {
        content.setWidth("320px");
        content.setHeight("200px");
    }

    layout.addComponent(content);

    table.withUnwrapped(CubaEnhancedTable.class, enhancedTable -> {
        enhancedTable.showCustomPopup(layout);
        enhancedTable.setCustomPopupAutoClose(false);
    });
}
 
Example 13
Source File: WebAbstractActionsHolderComponent.java    From cuba with Apache License 2.0 4 votes vote down vote up
protected WebAbstractActionsHolderComponent() {
    contextMenuPopup = new VerticalLayout();
    contextMenuPopup.setSpacing(false);
    contextMenuPopup.setMargin(false);

    contextMenuPopup.setSizeUndefined();
    contextMenuPopup.setStyleName("c-cm-container");

    shortcutsDelegate = new ShortcutsDelegate<ShortcutListener>() {
        @Override
        protected ShortcutListener attachShortcut(String actionId, KeyCombination keyCombination) {
            ShortcutListener shortcut =
                    new ShortcutListenerDelegate(actionId, keyCombination.getKey().getCode(),
                            KeyCombination.Modifier.codes(keyCombination.getModifiers())
                    ).withHandler((sender, target) -> {
                        if (target == component) {
                            Action action = getAction(actionId);
                            if (action != null && action.isEnabled() && action.isVisible()) {
                                action.actionPerform(WebAbstractActionsHolderComponent.this);
                            }
                        }
                    });

            component.addShortcutListener(shortcut);
            return shortcut;
        }

        @Override
        protected void detachShortcut(Action action, ShortcutListener shortcutDescriptor) {
            component.removeShortcutListener(shortcutDescriptor);
        }

        @Override
        protected Collection<Action> getActions() {
            return WebAbstractActionsHolderComponent.this.getActions();
        }
    };

    AppUI ui = AppUI.getCurrent();
    if (ui != null && ui.isTestMode()) {
        contextMenuPopup.setCubaId("cubaContextMenu");
    }
}
 
Example 14
Source File: NoUserSessionHandler.java    From cuba with Apache License 2.0 4 votes vote down vote up
protected void showNoUserSessionDialog(AppUI ui) {
    Messages messages = beanLocator.get(Messages.class);

    Connection connection = ui.getApp().getConnection();
    //noinspection ConstantConditions
    Locale locale = connection.getSession().getLocale();

    Window dialog = new NoUserSessionExceptionDialog();
    dialog.setStyleName("c-nousersession-dialog");
    dialog.setCaption(messages.getMainMessage("dialogs.Information", locale));
    dialog.setClosable(false);
    dialog.setResizable(false);
    dialog.setModal(true);

    CubaLabel messageLab = new CubaLabel();
    messageLab.setWidthUndefined();
    messageLab.setValue(messages.getMainMessage("noUserSession.message", locale));

    VerticalLayout layout = new VerticalLayout();
    layout.setSpacing(true);
    layout.setMargin(false);
    layout.setWidthUndefined();
    layout.setStyleName("c-nousersession-dialog-layout");
    layout.setSpacing(true);
    dialog.setContent(layout);

    CubaButton reloginBtn = new CubaButton();
    reloginBtn.addStyleName(WebButton.PRIMARY_ACTION_STYLENAME);
    reloginBtn.addClickListener(event -> relogin());
    reloginBtn.setCaption(messages.getMainMessage(Type.OK.getMsgKey()));

    String iconName = beanLocator.get(Icons.class)
            .get(Type.OK.getIconKey());
    reloginBtn.setIcon(beanLocator.get(IconResolver.class)
            .getIconResource(iconName));

    ClientConfig clientConfig = beanLocator.get(Configuration.class)
            .getConfig(ClientConfig.class);
    setClickShortcut(reloginBtn, clientConfig.getCommitShortcut());

    reloginBtn.focus();

    layout.addComponent(messageLab);
    layout.addComponent(reloginBtn);

    layout.setComponentAlignment(reloginBtn, Alignment.BOTTOM_RIGHT);

    ui.addWindow(dialog);

    dialog.center();

    if (ui.isTestMode()) {
        dialog.setCubaId("optionDialog");
        reloginBtn.setCubaId("reloginBtn");
    }

    if (ui.isPerformanceTestMode()) {
        dialog.setId(ui.getTestIdManager().getTestId("optionDialog"));
        reloginBtn.setId(ui.getTestIdManager().getTestId("reloginBtn"));
    }
}
 
Example 15
Source File: MismatchedUserSessionHandler.java    From cuba with Apache License 2.0 4 votes vote down vote up
protected void showMismatchedSessionDialog(AppUI ui) {
    Messages messages = beanLocator.get(Messages.class);

    Connection connection = ui.getApp().getConnection();
    //noinspection ConstantConditions
    Locale locale = connection.getSession().getLocale();

    Window dialog = new MismatchedUserSessionExceptionDialog();
    dialog.setStyleName("c-sessionchanged-dialog");
    dialog.setCaption(messages.getMainMessage("dialogs.Information", locale));
    dialog.setClosable(false);
    dialog.setResizable(false);
    dialog.setModal(true);

    CubaLabel messageLab = new CubaLabel();
    messageLab.setWidthUndefined();
    messageLab.setValue(messages.getMainMessage("sessionChangedMsg", locale));

    VerticalLayout layout = new VerticalLayout();
    layout.setSpacing(true);
    layout.setMargin(false);
    layout.setWidthUndefined();
    layout.setStyleName("c-sessionchanged-dialog-layout");
    layout.setSpacing(true);
    dialog.setContent(layout);

    CubaButton reloginBtn = new CubaButton();
    reloginBtn.addStyleName(WebButton.PRIMARY_ACTION_STYLENAME);
    reloginBtn.setCaption(messages.getMainMessage(DialogAction.Type.OK.getMsgKey(), locale));
    reloginBtn.addClickListener(event ->
            ui.getApp().recreateUi(ui));

    String iconName = beanLocator.get(Icons.class)
            .get(DialogAction.Type.OK.getIconKey());
    reloginBtn.setIcon(beanLocator.get(IconResolver.class)
            .getIconResource(iconName));

    ClientConfig clientConfig = beanLocator.get(Configuration.class)
            .getConfig(ClientConfig.class);
    setClickShortcut(reloginBtn, clientConfig.getCommitShortcut());

    reloginBtn.focus();

    layout.addComponent(messageLab);
    layout.addComponent(reloginBtn);

    layout.setComponentAlignment(reloginBtn, Alignment.BOTTOM_RIGHT);

    ui.addWindow(dialog);

    dialog.center();

    if (ui.isTestMode()) {
        dialog.setCubaId("optionDialog");
        reloginBtn.setCubaId("reloginBtn");
    }

    if (ui.isPerformanceTestMode()) {
        dialog.setId(ui.getTestIdManager().getTestId("optionDialog"));
        reloginBtn.setId(ui.getTestIdManager().getTestId("reloginBtn"));
    }
}
 
Example 16
Source File: OldLoginView.java    From gazpachoquest with GNU General Public License v3.0 4 votes vote down vote up
public OldLoginView() {
    setSizeFull();

    // Language bar in the top-right corner for selecting
    // invitation interface language
    final HorizontalLayout languageBar = new HorizontalLayout();
    languageBar.setHeight("50px");
    // addComponent(languageBar);
    // setComponentAlignment(languageBar, Alignment.TOP_RIGHT);

    // Allow selecting a language. We are in a constructor of a
    // CustomComponent, so preselecting the current
    // language of the application can not be done before
    // this (and the selection) component are attached to
    // the application.
    final ComboBox languageSelector = new ComboBox("Select a language") {
        @Override
        public void attach() {
            super.attach();
            // setValue(getLocale());
        }
    };

    // for (int i=0; i<locales.length; i++) {
    String locale = "es";
    languageSelector.addItem(locale);
    languageSelector.setItemCaption(locale, "espaƱol");

    // Automatically select the current locale
    // if (locales[i].equals(getLocale()))
    languageSelector.setValue(locale);

    // }

    // Create the invitation input field
    invitationTextField = new TextField("Invitation key:");
    invitationTextField.setWidth("300px");
    invitationTextField.setRequired(true);
    invitationTextField.setInputPrompt("Your questionnair invitation key (eg. 12345678)");
    invitationTextField.setInvalidAllowed(false);

    // Create login button
    enterButton = new Button("Enter", this);

    // Add both to a panel
    VerticalLayout fields = new VerticalLayout(languageSelector, invitationTextField, enterButton);
    fields.setCaption("Please enter your invitation key to access the questionnair");
    fields.setSpacing(true);
    fields.setMargin(new MarginInfo(true, true, true, false));
    fields.setSizeUndefined();

    // The view root layout
    VerticalLayout viewLayout = new VerticalLayout(fields);
    viewLayout.setSizeFull();
    viewLayout.setComponentAlignment(fields, Alignment.MIDDLE_CENTER);
    viewLayout.setStyleName(Reindeer.LAYOUT_BLUE);
    setCompositionRoot(viewLayout);
}
 
Example 17
Source File: AbstractHawkbitLoginUI.java    From hawkbit with Eclipse Public License 1.0 3 votes vote down vote up
private VerticalLayout buildContent() {
    final VerticalLayout rootLayout = new VerticalLayout();
    rootLayout.setSizeFull();
    rootLayout.setStyleName("main-content");

    rootLayout.addComponent(buildHeader());

    addLoginForm(rootLayout);

    addFooter(rootLayout);

    return rootLayout;
}