Example usage for com.vaadin.ui VerticalLayout addStyleName

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

Introduction

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

Prototype

@Override
    public void addStyleName(String style) 

Source Link

Usage

From source file:com.selzlein.lojavirtual.vaadin.page.SettingsView.java

License:Open Source License

private VerticalLayout createSubstitutionSection() {
    VerticalLayout substitution = new VerticalLayout();
    substitution.addStyleName("l-substitutes");
    substitution.setSpacing(true);/*from   w ww  . j  av  a2 s.  c o  m*/
    substitution.setSizeFull();

    Label substitutionHeader = new Label("<h2>" + ui.getMessage("settings.substitutionSection") + "</h2>",
            ContentMode.HTML);
    substitution.addComponent(substitutionHeader);

    Label substitutionHelp = new Label(ui.getMessage("settings.substitutionHelp"));
    substitutionHelp.setStyleName("form-help");
    substitution.addComponent(substitutionHelp);

    this.substitutionActive = new CheckBox(ui.getMessage("settings.substitutionActive"));
    substitutionActive.addStyleName("ui-spacing");
    substitutionActive.setValue(user.isSubstitutionActive());
    substitution.addComponent(substitutionActive);

    //substitutes
    selectedPersons = user.getDirectSubstitutes();
    this.substitutes = new OptionGroup(ui.getMessage("settings.substitutes"));
    refreshSubstitutes("");

    TextField substituteFilter = new TextField(ui.getMessage("action.filter"));
    substituteFilter.addValueChangeListener(new ValueChangeListener() {

        private static final long serialVersionUID = 1L;

        @Override
        public void valueChange(ValueChangeEvent event) {
            substitutes.removeAllItems();
            refreshSubstitutes(event.getProperty().getValue().toString());
        }
    });
    substitution.addComponent(substituteFilter);
    Panel substitutesPanel = new Panel();
    substitutesPanel.addStyleName("l-border-none");
    substitutesPanel.setSizeFull();
    substitutesPanel.setContent(substitutes);
    substitution.addComponent(substitutesPanel);
    substitution.setExpandRatio(substitutesPanel, 2);

    return substitution;
}

From source file:com.skysql.manager.ui.components.ScriptingProgressLayout.java

License:Open Source License

/**
 * Builds the progress./*from   w ww  .  ja va  2 s . c  o m*/
 *
 * @param taskRecord the task record
 * @param command the command
 * @param steps the steps
 */
public void buildProgress(TaskRecord taskRecord, String command, String steps) {

    VaadinSession session = getSession();
    if (session == null) {
        session = VaadinSession.getCurrent();
    }

    if (observerMode) {
        // String userName = Users.getUserNames().get(taskRecord.getUser());
        String userID = taskRecord.getUserID();
        UserInfo userInfo = (UserInfo) session.getAttribute(UserInfo.class);
        DateConversion dateConversion = session.getAttribute(DateConversion.class);
        setTitle(command + " was started on " + dateConversion.adjust(taskRecord.getStart()) + " by " + userID);
    } else {
        setTitle(command);
    }

    String[] stepIDs;
    try {
        stepIDs = steps.split(",");
    } catch (NullPointerException npe) {
        stepIDs = new String[] {};
    }
    totalSteps = stepIDs.length;
    primitives = new String[totalSteps];
    taskImages = new Embedded[totalSteps];

    // add steps icons
    progressIconsLayout.removeAllComponents();
    for (int index = 0; index < totalSteps; index++) {
        String stepID = stepIDs[index].trim();
        String description = Steps.getDescription(stepID);

        VerticalLayout stepLayout = new VerticalLayout();
        progressIconsLayout.addComponent(stepLayout);
        stepLayout.addStyleName("stepIcons");
        Label name = new Label(stepID);
        stepLayout.addComponent(name);
        stepLayout.setComponentAlignment(name, Alignment.MIDDLE_CENTER);
        Embedded image = new Embedded(null, new ThemeResource("img/scripting/pending.png"));
        image.setImmediate(true);
        image.setDescription(description);
        stepLayout.addComponent(image);
        primitives[index] = stepID;
        taskImages[index] = image;

    }

    setProgress("");

}

From source file:com.skysql.manager.ui.LoginView.java

License:Open Source License

/**
 * Instantiates a new login view./*w  w  w. j  a va2 s  .  c o m*/
 *
 * @param aboutRecord the about record
 */
public LoginView() {

    setSizeFull();
    setMargin(true);
    setSpacing(true);
    addStyleName("loginView");

    VerticalLayout logoLayout = new VerticalLayout();
    addComponent(logoLayout);
    setComponentAlignment(logoLayout, Alignment.BOTTOM_CENTER);
    setExpandRatio(logoLayout, 1.0f);

    Embedded logo = new Embedded(null, new ThemeResource("img/loginlogo.png"));
    logoLayout.addComponent(logo);
    logoLayout.setComponentAlignment(logo, Alignment.BOTTOM_CENTER);

    Label releaseInfo = new Label("Version " + ManagerUI.GUI_RELEASE);
    releaseInfo.setSizeUndefined();
    releaseInfo.addStyleName("releaseInfo");
    logoLayout.addComponent(releaseInfo);
    logoLayout.setComponentAlignment(releaseInfo, Alignment.TOP_CENTER);

    VerticalLayout spacer = new VerticalLayout();
    spacer.setHeight("20px");
    logoLayout.addComponent(spacer);

    VerticalLayout loginBox = new VerticalLayout();
    loginBox.addStyleName("loginBox");
    loginBox.setSizeUndefined();
    loginBox.setMargin(true);
    loginBox.setSpacing(true);
    addComponent(loginBox);
    setComponentAlignment(loginBox, Alignment.MIDDLE_CENTER);

    VerticalLayout loginFormLayout = new VerticalLayout();
    loginFormLayout.addStyleName("loginForm");
    loginFormLayout.setMargin(true);
    loginFormLayout.setSpacing(true);
    loginBox.addComponent(loginFormLayout);

    // userName.focus();
    userName.setStyleName("loginControl");
    userName.setInputPrompt("Username");
    userName.setImmediate(true);
    userName.addValueChangeListener(new ValueChangeListener() {
        private static final long serialVersionUID = 0x4C656F6E6172646FL;

        public void valueChange(ValueChangeEvent event) {
            password.focus();
            login.setClickShortcut(KeyCode.ENTER);
        }
    });
    loginFormLayout.addComponent(userName);
    loginFormLayout.setComponentAlignment(userName, Alignment.MIDDLE_CENTER);

    // spacer
    loginFormLayout.addComponent(new Label(""));

    password.setStyleName("loginControl");
    password.setInputPrompt("Password");
    password.setImmediate(true);
    password.addValueChangeListener(new ValueChangeListener() {
        private static final long serialVersionUID = 0x4C656F6E6172646FL;

        public void valueChange(ValueChangeEvent event) {
            login.focus();
        }
    });
    loginFormLayout.addComponent(password);
    loginFormLayout.setComponentAlignment(password, Alignment.MIDDLE_CENTER);

    // spacer
    loginFormLayout.addComponent(new Label(" "));

    login.setStyleName("loginControl");
    login.setEnabled(false);

    loginFormLayout.addComponent(login);
    loginFormLayout.setComponentAlignment(login, Alignment.BOTTOM_CENTER);

    VerticalLayout filler = new VerticalLayout();
    addComponent(filler);
    setExpandRatio(filler, 1.0f);

    preload();

}

From source file:com.skysql.manager.ui.OverviewPanel.java

License:Open Source License

/**
 * Instantiates a new overview panel.//from   www.j av a2s  . c o  m
 */
public OverviewPanel() {

    HorizontalLayout overviewContainer = new HorizontalLayout();
    overviewContainer.addStyleName("overviewPanel");
    overviewContainer.setWidth("100%");
    setContent(overviewContainer);

    systemInfo = VaadinSession.getCurrent().getAttribute(SystemInfo.class);
    systemRecord = systemInfo.getCurrentSystem();
    systemLayout = new SystemLayout(systemRecord);
    overviewContainer.addComponent(systemLayout);

    VerticalLayout nodesSlot = new VerticalLayout();
    nodesSlot.addStyleName("nodesSlot");
    nodesSlot.setMargin(new MarginInfo(false, false, false, false));
    overviewContainer.addComponent(nodesSlot);
    overviewContainer.setExpandRatio(nodesSlot, 1.0f);

    final HorizontalLayout nodesHeader = new HorizontalLayout();
    nodesHeader.setStyleName("panelHeaderLayout");
    nodesHeader.setWidth("100%");
    nodesSlot.addComponent(nodesHeader);
    nodesLabel = new Label(" ");
    nodesLabel.setSizeUndefined();
    nodesHeader.addComponent(nodesLabel);
    nodesHeader.setComponentAlignment(nodesLabel, Alignment.MIDDLE_CENTER);
    nodesHeader.setExpandRatio(nodesLabel, 1.0f);

    final HorizontalLayout buttonsLayout = new HorizontalLayout();
    buttonsLayout.setSpacing(true);
    buttonsLayout.setMargin(new MarginInfo(false, true, false, false));
    nodesHeader.addComponent(buttonsLayout);
    nodesHeader.setComponentAlignment(buttonsLayout, Alignment.MIDDLE_RIGHT);

    addSystemButton = new Button("Add System...");
    addSystemButton.setDescription("Add System");
    addSystemButton.setVisible(false);
    buttonsLayout.addComponent(addSystemButton);
    addSystemButton.addClickListener(new Button.ClickListener() {

        public void buttonClick(ClickEvent event) {
            new SystemDialog(null, null);
        }
    });

    addNodeButton = new Button("Add Node...");
    addNodeButton.setDescription("Add Node to the current System");
    addNodeButton.setVisible(false);
    buttonsLayout.addComponent(addNodeButton);
    addNodeButton.addClickListener(new Button.ClickListener() {

        public void buttonClick(ClickEvent event) {
            new NodeDialog(null, null);
        }
    });

    final Button editButton = new Button("Edit");
    editButton.setDescription("Enter Editing mode");
    final Button saveButton = new Button("Done");
    saveButton.setDescription("Exit Editing mode");
    buttonsLayout.addComponent(editButton);

    editButton.addClickListener(new Button.ClickListener() {

        public void buttonClick(ClickEvent event) {
            buttonsLayout.replaceComponent(editButton, saveButton);
            isEditable = true;
            systemLayout.setEditable(true);
            nodesLayout.setEditable(true);
            nodesHeader.setStyleName("panelHeaderLayout-editable");
            if (systemRecord != null && !SystemInfo.SYSTEM_ROOT.equals(systemRecord.getID())) {
                addNodeButton.setVisible(true);
            } else {
                addSystemButton.setVisible(true);
            }
            if (systemRecord == null || (systemRecord != null && systemRecord.getNodes().length == 0)) {
                nodesLayout.placeholderLayout(null);
            }
        }
    });

    saveButton.addClickListener(new Button.ClickListener() {

        public void buttonClick(ClickEvent event) {
            buttonsLayout.replaceComponent(saveButton, editButton);
            isEditable = false;
            systemLayout.setEditable(false);
            nodesLayout.setEditable(false);
            nodesHeader.setStyleName("panelHeaderLayout");
            if (systemRecord != null && systemRecord.getNodes().length == 0) {
                nodesLayout.placeholderLayout(null);
            }
            addNodeButton.setVisible(false);
            addSystemButton.setVisible(false);
        }
    });

    Panel panel = new Panel();
    panel.setHeight(PANEL_HEIGHT, Unit.PIXELS);
    panel.addStyleName(Runo.PANEL_LIGHT);
    nodesSlot.addComponent(panel);

    nodesLayout = new NodesLayout(systemRecord);
    nodesLayout.addStyleName("nodesLayout");
    nodesLayout.setWidth("100%");
    panel.setContent(nodesLayout);

}

From source file:com.skysql.manager.ui.PanelTools.java

License:Open Source License

/**
 * Instantiates a new panel tools.//  w  ww .j  a  va  2s . c o  m
 */
PanelTools() {

    // thisTab.setSizeFull();
    // thisTab.setWidth(Sizeable.SIZE_UNDEFINED, 0); // Default
    setHeight("200px");
    setSpacing(true);

    // External Tools Vertical Module
    SystemInfo systemInfo = getSession().getAttribute(SystemInfo.class);
    LinkedHashMap<String, String> properties = systemInfo.getCurrentSystem().getProperties();
    if (properties != null) {
        VerticalLayout externalsLayout = new VerticalLayout();
        externalsLayout.setWidth("150px");
        externalsLayout.addStyleName("externalsLayout");
        externalsLayout.setSpacing(true);

        String EIP = properties.get(SystemInfo.PROPERTY_EIP);
        String MONyog = properties.get(SystemInfo.PROPERTY_MONYOG);
        if (EIP != null && MONyog != null) {
            String url = "http://" + EIP + MONyog;
            monyogLink = new Link("MONyog", new ExternalResource(url));
            monyogLink.setTargetName("_blank");
            monyogLink.setDescription("Open MONyog for the whole system");
            monyogLink.setIcon(new ThemeResource("img/externalLink.png"));
            monyogLink.addStyleName("icon-after-caption");
            externalsLayout.addComponent(monyogLink);
            externalsLayout.setComponentAlignment(monyogLink, Alignment.BOTTOM_CENTER);
        }

        phpUrl = properties.get(SystemInfo.PROPERTY_PHPMYADMIN);
        if (phpUrl != null) {
            phpLink = new Link("phpMyAdmin", null);
            phpLink.setTargetName("_blank");
            phpLink.setDescription("Open phpMyAdmin for the selected node");
            phpLink.setIcon(new ThemeResource("img/externalLink.png"));
            phpLink.addStyleName("icon-after-caption");
            externalsLayout.addComponent(phpLink);
            externalsLayout.setComponentAlignment(phpLink, Alignment.BOTTOM_CENTER);
        }

        addComponent(externalsLayout);
        setComponentAlignment(externalsLayout, Alignment.MIDDLE_CENTER);

    }

    {
        Label spacer = new Label();
        spacer.setWidth("40px");
        addComponent(spacer);
    }

    // Scripting layout placeholder
    VerticalLayout placeholderLayout = new VerticalLayout();
    placeholderLayout.addStyleName("placeholderLayout");
    placeholderLayout.setSizeUndefined();

    Label placeholderLabel = new Label("Links to external tools");
    placeholderLabel.addStyleName("instructions");
    placeholderLayout.addComponent(placeholderLabel);

    addComponent(placeholderLayout);
    setComponentAlignment(placeholderLayout, Alignment.MIDDLE_CENTER);

}

From source file:com.wintindustries.pfserver.interfaces.view.dashboard.LoginView.java

private Component buildLoginForm() {
    final VerticalLayout loginPanel = new VerticalLayout();
    loginPanel.setSizeUndefined();/* w  w  w.  j  av  a  2s  . c  o  m*/
    loginPanel.setSpacing(true);
    Responsive.makeResponsive(loginPanel);
    loginPanel.addStyleName("login-panel");

    loginPanel.addComponent(buildLabels());
    loginPanel.addComponent(buildFields());
    loginPanel.addComponent(new CheckBox("Remember me", true));
    return loginPanel;
}

From source file:de.fatalix.bookery.view.admin.AdminView.java

License:Open Source License

public HorizontalLayout createUserManagement() {
    userManagementLayout = new HorizontalLayout();
    userManagementLayout.addStyleName("wrapping");
    userManagementLayout.setSpacing(true);
    userManagementLayout.setMargin(true);

    Label label = new Label("Add new user...");
    label.setSizeUndefined();//from   w  w w.  j  a v a2s.c o m
    label.addStyleName(ValoTheme.LABEL_LARGE);
    VerticalLayout emptyLayout = new VerticalLayout(label);
    emptyLayout.addStyleName("dashed-border");
    emptyLayout.setWidth(380, Unit.PIXELS);
    emptyLayout.setHeight(220, Unit.PIXELS);
    emptyLayout.setComponentAlignment(label, Alignment.MIDDLE_CENTER);
    emptyLayout.addLayoutClickListener(new LayoutEvents.LayoutClickListener() {

        @Override
        public void layoutClick(LayoutEvents.LayoutClickEvent event) {
            AppUser appUser = presenter.createNewUser();
            AppUserCard appUserCard = appUserCardInstances.get();
            appUserCard.loadAppUser(appUser);
            appUserCard.addAppUserCardListener(AdminView.this);
            userManagementLayout.addComponent(appUserCard, userManagementLayout.getComponentCount() - 1);
        }
    });
    userManagementLayout.addComponent(emptyLayout);
    return userManagementLayout;
}

From source file:de.fatalix.bookery.view.admin.BatchJobsLayout.java

private Layout createEmptyLayout() {
    Label label = new Label("Add new job...");
    label.setSizeUndefined();/* ww w . j ava2 s  .  c o m*/
    label.addStyleName(ValoTheme.LABEL_LARGE);

    VerticalLayout emptyLayout = new VerticalLayout(label);
    emptyLayout.addStyleName("dashed-border");
    emptyLayout.setWidth(380, Unit.PIXELS);
    emptyLayout.setHeight(220, Unit.PIXELS);
    emptyLayout.setComponentAlignment(label, Alignment.MIDDLE_CENTER);
    emptyLayout.addLayoutClickListener(new LayoutEvents.LayoutClickListener() {

        @Override
        public void layoutClick(LayoutEvents.LayoutClickEvent event) {
            BatchJobConfiguration jobConfig = presenter.createBatchJob();
            BatchJobCard batchJobCard = batchJobCardInstances.get();
            batchJobCard.load(jobConfig);
            batchJobCard.addBatchJobCardListener(BatchJobsLayout.this);
            batchJobLayout.addComponent(batchJobCard, batchJobLayout.getComponentCount() - 1);
        }
    });
    return emptyLayout;
}

From source file:de.fatalix.bookery.view.common.BookSearchLayout.java

License:Open Source License

private VerticalLayout createSearchResultLayout() {
    resultText = new Label(" 0 Ergebnisse gefunden");
    resultText.addStyleName(ValoTheme.LABEL_BOLD);
    resultLayout = new HorizontalLayout();
    resultLayout.setSpacing(true);//from  w w w . jav  a  2  s .  c  om
    resultLayout.addStyleName("wrapping");
    showMore = new Button("show more", new Button.ClickListener() {

        @Override
        public void buttonClick(Button.ClickEvent event) {
            searchBooks(query, false);

        }
    });
    showMore.setWidth(100, Unit.PERCENTAGE);
    showMore.addStyleName(ValoTheme.BUTTON_HUGE);
    showMore.addStyleName(ValoTheme.BUTTON_FRIENDLY);
    VerticalLayout root = new VerticalLayout();
    root.addStyleName("bookery-view");
    root.setSpacing(true);
    root.setMargin(true);
    root.addComponents(resultText, resultLayout, showMore);
    return root;
}

From source file:de.fatalix.bookery.view.common.BookSearchLayout.java

License:Open Source License

private VerticalLayout createBookCoverLayout(final BookEntry bookEntry) {
    Image image = new Image();
    image.setDescription(bookEntry.getTitle() + " von " + bookEntry.getAuthor());
    image.setHeight("200px");
    image.setWidth("130px");
    image.setImmediate(true);//from   w w  w .j a v  a2  s.c  o  m
    if (bookEntry.getThumbnail() != null) {
        StreamResource.StreamSource source = new ByteStreamResource(bookEntry.getThumbnail());
        image.setSource(new StreamResource(source, bookEntry.getId() + "_thumb.png"));
    } else if (bookEntry.getCover() != null) {
        StreamResource.StreamSource source = new ByteStreamResource(bookEntry.getCover());
        image.setSource(new StreamResource(source, bookEntry.getId() + ".png"));
    }

    final MButton watchListButton = new MButton()
            .withIcon(presenter.isOnWatchList(bookEntry, SecurityUtils.getSubject().getPrincipal().toString())
                    ? FontAwesome.STAR
                    : FontAwesome.STAR_O)
            .withStyleName(ValoTheme.BUTTON_LINK);
    watchListButton.addStyleName("quick-action");

    watchListButton.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            watchListButton.setIcon(presenter.addRemoveFromWatchList(bookEntry,
                    SecurityUtils.getSubject().getPrincipal().toString()) ? FontAwesome.STAR
                            : FontAwesome.STAR_O);
        }
    });

    final MButton likeButton = new MButton().withCaption("" + bookEntry.getLikes())
            .withIcon(FontAwesome.THUMBS_O_UP).withStyleName(ValoTheme.BUTTON_LINK);
    likeButton.addStyleName("quick-action");

    likeButton.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            try {
                BookEntry updatedBook = presenter.updateLike(bookEntry,
                        SecurityUtils.getSubject().getPrincipal().toString());
                bookEntry.setLikes(updatedBook.getLikes());
                bookEntry.setLikedby(updatedBook.getLikedby());
                likeButton.setCaption("" + bookEntry.getLikes());
            } catch (SolrServerException | IOException ex) {
                java.util.logging.Logger.getLogger(BookSearchLayout.class.getName()).log(Level.SEVERE, null,
                        ex);
            }

        }
    });
    final MButton downloadsButton = new MButton().withCaption("" + bookEntry.getDownloads())
            .withIcon(FontAwesome.DOWNLOAD).withStyleName(ValoTheme.BUTTON_LINK);
    downloadsButton.addStyleName("quick-action");
    HorizontalLayout quickActionLayout = new HorizontalLayout(watchListButton, likeButton, downloadsButton);
    quickActionLayout.addStyleName("quick-action-layout");

    VerticalLayout result = new VerticalLayout(image, quickActionLayout);
    //result.setHeight("210px");
    //result.setWidth("140px");
    result.addStyleName("pointer-cursor");
    result.addStyleName("book-card");
    result.setComponentAlignment(image, Alignment.MIDDLE_CENTER);

    result.addLayoutClickListener(new LayoutEvents.LayoutClickListener() {

        @Override
        public void layoutClick(LayoutEvents.LayoutClickEvent event) {
            bookDetailLayout.loadData(bookEntry);
            bookDetailLayout.setLayoutVisible(true);
            //BookDetailDialog dialogInstance = bookDetail.get();
            //dialogInstance.loadData(bookEntry);
            //UI.getCurrent().addWindow(dialogInstance);
        }
    });
    return result;
}