Example usage for com.vaadin.ui VerticalLayout setStyleName

List of usage examples for com.vaadin.ui VerticalLayout setStyleName

Introduction

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

Prototype

@Override
    public void setStyleName(String style) 

Source Link

Usage

From source file:org.processbase.ui.bpm.identity.MetadataWindow.java

License:Open Source License

public void initUI() {
    try {// w w w  .  j av a  2  s . c  o  m
        if (metadata == null) {
            setCaption(ProcessbaseApplication.getCurrent().getPbMessages().getString("newMetadata"));
        } else {
            setCaption(ProcessbaseApplication.getCurrent().getPbMessages().getString("metadata"));
        }
        setModal(true);
        VerticalLayout layout = (VerticalLayout) this.getContent();
        layout.setMargin(true);
        layout.setSpacing(true);
        layout.setStyleName(Reindeer.LAYOUT_WHITE);

        cancelBtn = new Button(ProcessbaseApplication.getCurrent().getPbMessages().getString("btnCancel"),
                this);
        applyBtn = new Button(ProcessbaseApplication.getCurrent().getPbMessages().getString("btnSave"), this);
        metadataName = new TextField(
                ProcessbaseApplication.getCurrent().getPbMessages().getString("metadataName"));
        metadataLabel = new TextField(
                ProcessbaseApplication.getCurrent().getPbMessages().getString("metadataLabel"));

        metadataName.setWidth("270px");
        addComponent(metadataName);
        metadataLabel.setWidth("270px");
        addComponent(metadataLabel);

        if (metadata != null) {
            metadataName.setValue(metadata.getName());
            metadataLabel.setValue(metadata.getLabel());
        }

        buttons.addButton(applyBtn);
        buttons.setComponentAlignment(applyBtn, Alignment.MIDDLE_RIGHT);
        buttons.setExpandRatio(applyBtn, 1);
        buttons.addButton(cancelBtn);
        buttons.setComponentAlignment(cancelBtn, Alignment.MIDDLE_RIGHT);
        buttons.setMargin(false);
        buttons.setHeight("30px");
        buttons.setWidth("100%");
        addComponent(buttons);
        setWidth("300px");
        setResizable(false);
    } catch (Exception ex) {
        ex.printStackTrace();
        showError(ex.getMessage());
    }
}

From source file:org.processbase.ui.bpm.identity.RoleWindow.java

License:Open Source License

public void initUI() {
    try {//from  w w w .  java2 s.  c  o  m
        if (role == null) {
            setCaption(ProcessbaseApplication.getCurrent().getPbMessages().getString("newRole"));
        } else {
            setCaption(ProcessbaseApplication.getCurrent().getPbMessages().getString("role"));
        }
        setModal(true);
        VerticalLayout layout = (VerticalLayout) this.getContent();
        layout.setMargin(true);
        layout.setSpacing(true);
        layout.setStyleName(Reindeer.LAYOUT_WHITE);

        cancelBtn = new Button(ProcessbaseApplication.getCurrent().getPbMessages().getString("btnCancel"),
                this);
        applyBtn = new Button(ProcessbaseApplication.getCurrent().getPbMessages().getString("btnSave"), this);
        roleName = new TextField(ProcessbaseApplication.getCurrent().getPbMessages().getString("roleName"));
        roleLabel = new TextField(ProcessbaseApplication.getCurrent().getPbMessages().getString("roleLabel"));
        roleDescription = new TextArea(
                ProcessbaseApplication.getCurrent().getPbMessages().getString("roleDescription"));

        roleName.setWidth("270px");
        addComponent(roleName);
        roleLabel.setWidth("270px");
        addComponent(roleLabel);
        roleDescription.setWidth("270px");
        addComponent(roleDescription);

        if (role != null) {
            roleName.setValue(role.getName());
            roleLabel.setValue(role.getLabel());
            roleDescription.setValue(role.getDescription());
        }

        buttons.addButton(applyBtn);
        buttons.setComponentAlignment(applyBtn, Alignment.MIDDLE_RIGHT);
        buttons.setExpandRatio(applyBtn, 1);
        buttons.addButton(cancelBtn);
        buttons.setComponentAlignment(cancelBtn, Alignment.MIDDLE_RIGHT);
        buttons.setMargin(false);
        buttons.setHeight("30px");
        buttons.setWidth("100%");
        addComponent(buttons);
        setWidth("310px");
        setResizable(false);
    } catch (Exception ex) {
        ex.printStackTrace();
        showError(ex.getMessage());
    }
}

From source file:org.processbase.ui.bpm.identity.SyncUsersWindow.java

License:Open Source License

public void initUI() {
    try {/*from   w w  w  .j  a v a2 s  .  c  o m*/
        setCaption(ProcessbaseApplication.getCurrent().getPbMessages().getString("syncUsers"));
        setModal(true);
        VerticalLayout layout = (VerticalLayout) this.getContent();
        layout.setMargin(true);
        layout.setSpacing(true);
        layout.setStyleName(Reindeer.LAYOUT_WHITE);
        layout.addComponent(table);

        closeBtn = new Button(ProcessbaseApplication.getCurrent().getPbMessages().getString("btnClose"), this);
        buttons.addButton(closeBtn);
        buttons.setComponentAlignment(closeBtn, Alignment.MIDDLE_RIGHT);
        buttons.setMargin(false);
        buttons.setHeight("30px");
        buttons.setWidth("100%");
        addComponent(buttons);
        setWidth("70%");
        //            setHeight("70%");
        setResizable(false);

        table.addContainerProperty("username", String.class, null,
                ProcessbaseApplication.getCurrent().getPbMessages().getString("tableCaptionUsername"), null,
                null);
        table.addContainerProperty("lastname", String.class, null,
                ProcessbaseApplication.getCurrent().getPbMessages().getString("tableCaptionLastname"), null,
                null);
        table.addContainerProperty("firstname", String.class, null,
                ProcessbaseApplication.getCurrent().getPbMessages().getString("tableCaptionFirstname"), null,
                null);
        table.addContainerProperty("liferayStatus", String.class, null,
                ProcessbaseApplication.getCurrent().getPbMessages().getString("tableCaptionLiferayStatus"),
                null, null);
        table.addContainerProperty("bonitaStatus", String.class, null,
                ProcessbaseApplication.getCurrent().getPbMessages().getString("tableCaptionBonitaStatus"), null,
                null);
        //        table.addContainerProperty("state", String.class, null, PbPortlet.getCurrent().messages.getString("tableCaptionState"), null, null);
        table.addContainerProperty("actions", TableLinkButton.class, null,
                ProcessbaseApplication.getCurrent().getPbMessages().getString("tableCaptionActions"), null,
                null);
        table.setColumnWidth("actions", 50);
        table.setSelectable(false);
        table.setImmediate(true);
        table.setWidth("100%");
        table.setPageLength(15);
        refreshTable();
    } catch (Exception ex) {
        ex.printStackTrace();
        showError(ex.getMessage());
    }
}

From source file:org.processbase.ui.bpm.identity.UserWindow.java

License:Open Source License

public void initUI() {
    try {//  w ww . j  a va  2  s  .c om
        if (user == null) {
            setCaption(ProcessbaseApplication.getCurrent().getPbMessages().getString("newUser"));
        } else {
            setCaption(ProcessbaseApplication.getCurrent().getPbMessages().getString("user"));
        }
        setModal(true);
        VerticalLayout layout = (VerticalLayout) this.getContent();
        layout.setMargin(true);
        layout.setSpacing(true);
        layout.setStyleName(Reindeer.LAYOUT_WHITE);
        layout.setSizeFull();

        addBtn = new Button(ProcessbaseApplication.getCurrent().getPbMessages().getString("btnAdd"), this);
        closeBtn = new Button(ProcessbaseApplication.getCurrent().getPbMessages().getString("btnClose"), this);
        saveBtn = new Button(ProcessbaseApplication.getCurrent().getPbMessages().getString("btnSave"), this);
        userFirstName = new TextField(
                ProcessbaseApplication.getCurrent().getPbMessages().getString("userFirstName"));
        userLastName = new TextField(
                ProcessbaseApplication.getCurrent().getPbMessages().getString("userLastName"));
        userName = new TextField(ProcessbaseApplication.getCurrent().getPbMessages().getString("userName"));
        userEmail = new TextField(ProcessbaseApplication.getCurrent().getPbMessages().getString("userEmail"));
        userJobTitle = new TextField(
                ProcessbaseApplication.getCurrent().getPbMessages().getString("userJobTitle"));
        password = new PasswordField(ProcessbaseApplication.getCurrent().getPbMessages().getString("password"));

        // prepare user information
        userInfofmation.setMargin(true);
        userInfofmation.setSpacing(true);
        userName.setWidth("270px");
        userInfofmation.addComponent(userName);
        password.setWidth("270px");
        userInfofmation.addComponent(password);
        userFirstName.setWidth("270px");
        userInfofmation.addComponent(userFirstName);
        userLastName.setWidth("270px");
        userInfofmation.addComponent(userLastName);
        userEmail.setWidth("270px");
        userInfofmation.addComponent(userEmail);
        userJobTitle.setWidth("270px");
        userInfofmation.addComponent(userJobTitle);

        // prepare user membership
        userMembership.setMargin(true);
        userMembership.setSpacing(true);
        userMembership.setSizeFull();
        prepareTableMembership();
        userMembership.addComponent(tableMembership);

        // prepare user metadata
        userMetadata.setMargin(true);
        userMetadata.setSpacing(true);
        userMetadata.setSizeFull();
        prepareTableMetadata();
        userMetadata.addComponent(tableMetadata);

        // prepare tabSheet
        tabSheet.addTab(userInfofmation,
                ProcessbaseApplication.getCurrent().getPbMessages().getString("userInfofmation"), null);
        tabSheet.addTab(userMembership,
                ProcessbaseApplication.getCurrent().getPbMessages().getString("userMembership"), null);
        tabSheet.addTab(userMetadata,
                ProcessbaseApplication.getCurrent().getPbMessages().getString("userMetadata"), null);
        tabSheet.addListener((TabSheet.SelectedTabChangeListener) this);
        tabSheet.setImmediate(true);
        tabSheet.setSizeFull();
        layout.addComponent(tabSheet);
        layout.setExpandRatio(tabSheet, 1);

        addBtn.setVisible(false);
        buttons.addButton(addBtn);
        buttons.setComponentAlignment(addBtn, Alignment.MIDDLE_RIGHT);
        buttons.addButton(saveBtn);
        buttons.setComponentAlignment(saveBtn, Alignment.MIDDLE_RIGHT);
        buttons.setExpandRatio(saveBtn, 1);
        buttons.addButton(closeBtn);
        buttons.setComponentAlignment(closeBtn, Alignment.MIDDLE_RIGHT);
        buttons.setMargin(false);
        buttons.setHeight("30px");
        buttons.setWidth("100%");
        addComponent(buttons);

        if (user != null) {
            userFirstName.setValue(user.getFirstName());
            userLastName.setValue(user.getLastName());
            userName.setValue(user.getUsername());
            userEmail.setValue(
                    user.getProfessionalContactInfo() != null ? user.getProfessionalContactInfo().getEmail()
                            : "");
            userJobTitle.setValue(user.getJobTitle());
            password.setValue(user.getPassword());
            refreshTableMembership();
            refreshTableMetadata();
            userName.setReadOnly(true);
        }
        setWidth("800px");
        setHeight("500px");
        setResizable(false);
        setModal(true);
    } catch (Exception ex) {
        ex.printStackTrace();
        showError(ex.getMessage());
    }
}

From source file:org.ripla.web.demo.config.views.LoginConfigView.java

License:Open Source License

/**
 * LoginConfigView constructor.//from   www . j  a va  2s. c o  m
 * 
 * @param inLoginConfig
 * @param inController
 *            {@link LoginConfigController}
 * @param inEnabled
 *            boolean <code>true</code> if login configuration is enabled
 */
public LoginConfigView(final boolean inLoginConfig, final LoginConfigController inController,
        final boolean inEnabled) {
    super();
    final IMessages lMessages = Activator.getMessages();
    final VerticalLayout lLayout = new VerticalLayout();
    setCompositionRoot(lLayout);
    lLayout.setStyleName("demo-view"); //$NON-NLS-1$
    lLayout.addComponent(new Label(String.format(RiplaViewHelper.TMPL_TITLE, "demo-pagetitle", //$NON-NLS-1$
            lMessages.getMessage("config.login.page.title")), ContentMode.HTML)); //$NON-NLS-1$

    lLayout.addComponent(new Label(lMessages.getMessage("view.login.remark"), ContentMode.HTML)); //$NON-NLS-1$
    if (!inEnabled) {
        lLayout.addComponent(new Label(lMessages.getMessage("view.login.disabled"), ContentMode.HTML)); //$NON-NLS-1$
    }

    final CheckBox lCheckbox = new CheckBox(lMessages.getMessage("view.login.chk.label")); //$NON-NLS-1$
    lCheckbox.setValue(inLoginConfig);
    lCheckbox.setEnabled(inEnabled);
    lCheckbox.focus();
    lLayout.addComponent(lCheckbox);

    final Button lSave = new Button(lMessages.getMessage("config.view.button.save")); //$NON-NLS-1$
    lSave.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(final ClickEvent inEvent) {
            inController.saveChange(lCheckbox.getValue());
        }
    });
    lSave.setEnabled(inEnabled);
    lSave.setClickShortcut(KeyCode.ENTER);
    lLayout.addComponent(lSave);
}

From source file:org.ripla.web.demo.config.views.SkinConfigurationView.java

License:Open Source License

/**
 * @param inSkinSelectController/*from   ww  w  . j  av a  2 s  . co  m*/
 */
public SkinConfigurationView(final SkinSelectController inController) {
    super();

    final IMessages lMessages = Activator.getMessages();
    final VerticalLayout lLayout = new VerticalLayout();
    setCompositionRoot(lLayout);
    lLayout.setStyleName("demo-view"); //$NON-NLS-1$
    lLayout.addComponent(new Label(String.format(RiplaViewHelper.TMPL_TITLE, "demo-pagetitle", //$NON-NLS-1$
            lMessages.getMessage("config.skin.page.title")), ContentMode.HTML)); //$NON-NLS-1$

    skinSelect = new ComboBox(null, SkinConfigRegistry.INSTANCE.getSkins());
    skinSelect.setNullSelectionAllowed(false);
    skinSelect.setNewItemsAllowed(false);
    skinSelect.setWidth(230, Unit.PIXELS);
    skinSelect.focus();
    lLayout.addComponent(skinSelect);

    final Button lSave = new Button(lMessages.getMessage("config.view.button.save")); //$NON-NLS-1$
    lSave.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(final Button.ClickEvent inEvent) {
            inController.save((SkinBean) skinSelect.getValue());
        }
    });
    lSave.setClickShortcut(KeyCode.ENTER);
    lLayout.addComponent(lSave);
}

From source file:org.ripla.web.demo.widgets.views.AbstractWidgetsView.java

License:Open Source License

protected VerticalLayout initLayout(final IMessages inMessages) {
    final VerticalLayout outLayout = new VerticalLayout();
    setCompositionRoot(outLayout);//from  w  w  w .  j  a  va  2 s  .co  m
    outLayout.setStyleName("demo-view"); //$NON-NLS-1$
    return outLayout;
}

From source file:org.ripla.web.internal.menu.ContextMenuManager.java

License:Open Source License

/**
 * Method to render the context menu./*w  w w.  j ava 2s .c  o  m*/
 * 
 * @param inMenuSetName
 *            String the fully qualified ID of the context menu
 * @param inUser
 *            {@link User} the user instance, might be evaluated to check
 *            the conditions
 * @param inAuthorization
 *            {@link Authorization} the authorization instance, will be
 *            evaluate to check the conditions
 * @param inParameters
 *            {@link ParameterObject} the generic parameter object with
 *            parameters that could be evaluated to check the conditions
 * @param inControllerClass
 *            Class&lt;? extends IPluggable> the active controller class
 * @return {@link Component} the component that displays the rendered
 *         context menu
 */
public Component renderContextMenu(final String inMenuSetName, final User inUser,
        final Authorization inAuthorization, final ParameterObject inParameters,
        final Class<? extends IPluggable> inControllerClass) {
    final VerticalLayout outContextMenu = new VerticalLayout();
    outContextMenu.setMargin(true);
    outContextMenu.setStyleName("ripla-contextmenu"); //$NON-NLS-1$

    final ContextMenuSet lContextMenuSet = contextMenus.get(inMenuSetName);
    if (lContextMenuSet == null) {
        return outContextMenu;
    }

    for (final ContextMenuItem lItem : lContextMenuSet.getContextMenuItems()) {
        if (lItem.checkConditions(inUser, inAuthorization, inParameters)) {
            final Button lContextMenuLink = new Button(lItem.getCaption()); // NOPMD
            lContextMenuLink.setStyleName(BaseTheme.BUTTON_LINK);
            lContextMenuLink.addStyleName("ripla-contextmenu-item");
            lContextMenuLink.setSizeUndefined();
            final Class<? extends IPluggable> lControllerClass = lItem.getControllerClass();
            if (lControllerClass.equals(inControllerClass)) {
                lContextMenuLink.addStyleName("active");
            }
            lContextMenuLink.addClickListener(new ContextMenuListener( // NOPMD
                    lControllerClass));
            outContextMenu.addComponent(lContextMenuLink);
        }
    }

    return outContextMenu;
}

From source file:org.ripla.web.RiplaApplication.java

License:Open Source License

private boolean initializeLayout(final IAppConfiguration inConfiguration) {
    setStyleName("ripla-window"); //$NON-NLS-1$

    requestHandler = setRequestHandler();
    SkinRegistry.INSTANCE.setDefaultSkin(inConfiguration.getDftSkinID());
    final ISkin lSkin = SkinRegistry.INSTANCE.getActiveSkin();

    final VerticalLayout lLayout = new VerticalLayout();
    lLayout.setSizeFull();/*from   www . j  av  a2s  . com*/
    lLayout.setStyleName("ripla-main");
    setContent(lLayout);

    bodyView = createBody();
    lLayout.addComponent(bodyView);
    lLayout.setExpandRatio(bodyView, 1);

    if (!beforeLogin(this)) {
        return false;
    }

    if (inConfiguration.getLoginAuthenticator() == null) {
        bodyView.addComponent(createBodyView(lSkin));
    } else {
        bodyView.addComponent(createLoginView(inConfiguration, lSkin));
    }

    if (lSkin.hasFooter()) {
        final Component lFooter = lSkin.getFooter();
        lLayout.addComponent(lFooter);
        lLayout.setExpandRatio(lFooter, 0);
    }
    return true;
}

From source file:org.ripla.web.RiplaApplication.java

License:Open Source License

/**
 * Creates the application's login view.<br />
 * Subclasses may override.//from w  w w  .j a  va  2 s  . com
 * 
 * @param inConfiguration
 *            {@link IAppConfiguration} the application's configuration
 *            object
 * @param inSkin
 *            {@link ISkin} the actual application skin
 * @return {@link Component} the application's login view
 */
private Component createLoginView(final IAppConfiguration inConfiguration, final ISkin inSkin) {
    final VerticalLayout out = new VerticalLayout();
    out.setStyleName("ripla-body");
    out.setSizeFull();

    if (inSkin.hasHeader()) {
        final Component lHeader = inSkin.getHeader(inConfiguration.getAppName());
        out.addComponent(lHeader);
        out.setExpandRatio(lHeader, 0);
    }

    final RiplaLogin lLogin = new RiplaLogin(inConfiguration, this, UseCaseRegistry.INSTANCE.getUserAdmin());
    out.addComponent(lLogin);
    out.setExpandRatio(lLogin, 1);
    return out;
}