Example usage for com.vaadin.ui Panel addStyleName

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

Introduction

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

Prototype

@Override
    public void addStyleName(String style) 

Source Link

Usage

From source file:com.m4gik.views.component.LibraryScreen.java

/**
 * This method builds library screen. This method overrides an existing
 * method./*from w w  w.  j  av a 2 s  .  c  om*/
 * 
 * @see com.m4gik.views.component.ViewScreen#build()
 */
@Override
public Layout build() {
    HorizontalLayout root = new HorizontalLayout();
    root.setSizeFull();
    root.setCaption("Media Library");
    root.setHeight("200%");
    root.setWidth("100%");

    this.content = new VerticalLayout();
    content.setSizeFull();
    root.addComponent(content);

    final GridLayout grid = new GridLayout(4, 1);
    Panel top = new Panel("Music Collection", grid);
    top.setSizeFull();
    top.addStyleName(Runo.PANEL_LIGHT);
    grid.setWidth("100%");
    grid.setMargin(true);
    grid.addStyleName(Runo.LAYOUT_DARKER);
    content.addComponent(top);
    content.setExpandRatio(top, 1);

    grid.addLayoutClickListener(new LayoutClickListener() {

        private static final long serialVersionUID = -1864555729437118182L;

        @Override
        public void layoutClick(LayoutClickEvent event) {
            for (Iterator<Component> it = grid.iterator(); it.hasNext();) {
                Component c = it.next();
                c.removeStyleName(Runo.CSSLAYOUT_SELECTABLE_SELECTED);

            }

            if (event.getChildComponent() != null) {
                event.getChildComponent().addStyleName(Runo.CSSLAYOUT_SELECTABLE_SELECTED);
            }
        }
    });

    buildAudioLibrary(grid, null);

    return root;

}

From source file:com.m4gik.views.component.LicenseScreen.java

/**
 * Method builds license layout with texts.
 * // w  w  w  .  j a  v  a 2 s.  co  m
 * @return The VerticalLayout with texts.
 * 
 * @see com.m4gik.views.component.ViewScreen#build()
 */
@Override
public Layout build() {
    VerticalLayout layout = new VerticalLayout();
    layout.setSizeFull();
    layout.setCaption("Welcome");

    Panel welcome = new Panel("License");
    welcome.setSizeFull();
    welcome.addStyleName(Runo.PANEL_LIGHT);
    layout.addComponent(welcome);
    layout.setExpandRatio(welcome, 1);

    CssLayout margin = new CssLayout();
    // margin.setMargin(true);
    margin.setWidth("100%");
    welcome.setContent(margin);

    Label title = new Label("Music player");
    title.addStyleName(Runo.LABEL_H1);
    // margin.addComponent(title);

    HorizontalLayout texts = new HorizontalLayout();
    texts.setSpacing(true);
    texts.setWidth("100%");
    margin.addComponent(texts);

    addText(texts,
            "<h3>Everything You Need Is Here</h3>" + "<p>Everything you see inside this application...</p>",
            null);
    addText(texts,
            "<h3>Everything You Need Is Here</h3>" + "<p>Everything you see inside this application...</p>",
            null);
    addText(texts,
            "<h3>Everything You Need Is Here</h3>" + "<p>Everything you see inside this application...</p>",
            null);

    layout.addComponent(new Label("<hr />", Label.CONTENT_XHTML));

    return layout;
}

From source file:com.naoset.framework.frontend.view.window.DialogWindow.java

private Panel buildBodyWrapper() {
    Panel bodyWrapper = new Panel();
    bodyWrapper.setSizeFull();//w w  w  . j a  va2 s .  c  o  m
    bodyWrapper.addStyleName(ValoTheme.PANEL_BORDERLESS);
    bodyWrapper.addStyleName("scroll-divider");
    return bodyWrapper;
}

From source file:com.naoset.framework.frontend.view.window.Window.java

public Window(Component component) {
    mySelf = this;
    this.body = component;

    //addStyleName("moviedetailswindow");
    Responsive.makeResponsive(this);

    setCaption(body.getCaption());//from ww  w.j ava 2 s  .  com
    center();
    setCloseShortcut(ShortcutAction.KeyCode.ESCAPE, null);
    setResizable(false);
    setClosable(false);
    setHeight(90.0f, Unit.PERCENTAGE);

    VerticalLayout layout = new VerticalLayout();
    layout.setSizeFull();
    setContent(layout);

    Panel bodyWrapper = new Panel(body);
    bodyWrapper.setSizeFull();
    bodyWrapper.addStyleName(ValoTheme.PANEL_BORDERLESS);
    bodyWrapper.addStyleName("scroll-divider");
    layout.addComponent(bodyWrapper);
    layout.setExpandRatio(bodyWrapper, 1f);

    footer = buildFooter();
    layout.addComponent(footer);
}

From source file:com.save.global.ErrorLoggedNotification.java

public static void showWarningLoggedOnWindow(String warning, String className) {
    VerticalLayout v = new VerticalLayout();
    v.setSizeFull();/*www.ja  va 2 s  .  co  m*/
    v.setMargin(true);

    Window sub = new Window("WARNING MESSAGE!");
    sub.setWidth("500px");
    if (sub.getParent() == null) {
        UI.getCurrent().addWindow(sub);
    }
    sub.setModal(true);

    Panel panel = new Panel();
    panel.setSizeFull();
    panel.addStyleName(ValoTheme.PANEL_BORDERLESS);
    panel.setContent(new Label(warning + " on \n" + className, ContentMode.HTML));
    panel.getContent().setHeightUndefined();
    v.addComponent(panel);

    sub.setContent(v);
    sub.getContent().setHeightUndefined();
}

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

License:Open Source License

private void createView() {
    ui = (LspsUI) getUI();/*www  . j av  a2s.  c o m*/
    user = ui.getUser().getPerson();
    userRights = user.getRights();

    setTitle(ui.getMessage(TITLE));

    Panel panel = new Panel();
    panel.addStyleName("l-border-none");
    setContent(panel);

    VerticalLayout layout = new VerticalLayout();
    layout.addStyleName("l-settings");
    layout.setSizeFull();
    layout.setSpacing(true);
    layout.setMargin(true);
    panel.setContent(layout);

    //user data and settings will be laid out next to each other
    HorizontalLayout topSection = new HorizontalLayout();
    topSection.setSpacing(true);
    topSection.setWidth("100%");
    layout.addComponent(topSection);

    VerticalLayout userData = createUserDataSection(ui, user);
    topSection.addComponent(userData);
    topSection.setExpandRatio(userData, 1);

    Label spacer = new Label();
    spacer.setWidth("20px");
    topSection.addComponent(spacer);

    VerticalLayout settings = createSettingsSection(ui);
    topSection.addComponent(settings);
    topSection.setExpandRatio(settings, 1);

    //substitution section
    VerticalLayout substitution = createSubstitutionSection();
    layout.addComponent(substitution);
    layout.setExpandRatio(substitution, 2);

    //buttons
    HorizontalLayout buttons = new HorizontalLayout();
    buttons.setSpacing(true);
    Button saveButton = new Button(ui.getMessage("action.save"), new ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            if (save()) {
                if (requestReload) {
                    JavaScript.getCurrent().execute("window.location.reload()");
                } else {
                    close();
                }
            }
        }
    });
    saveButton.setData(BUTTON_TYPE_SAVE);
    buttons.addComponent(saveButton);
    Button cancelButton = new Button(ui.getMessage("action.cancel"), new ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            close();
        }
    });
    buttons.addComponent(cancelButton);
    layout.addComponent(buttons);
}

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);/*w w w .j a va 2  s  .  co 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.OverviewPanel.java

License:Open Source License

/**
 * Instantiates a new overview panel./*  w w  w.  j  a  v a  2  s  . 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.tapas.evidence.utility.UIUtils.java

License:Apache License

public static void clearBorder(final Panel panel) {
    panel.addStyleName(Runo.PANEL_LIGHT);
}

From source file:de.fatalix.bookery.view.login.LoginView.java

License:Open Source License

private Component buildLoginForm() {
    FormLayout loginForm = new FormLayout();

    loginForm.addStyleName("login-form");
    loginForm.setSizeUndefined();//w w  w  .  j a  v a  2  s  .  co  m
    loginForm.setMargin(false);

    loginForm.addComponent(username = new TextField("Username", "admin"));
    username.setWidth(15, Unit.EM);
    loginForm.addComponent(password = new PasswordField("Password"));
    password.setWidth(15, Unit.EM);
    password.setDescription("");

    CssLayout buttons = new CssLayout();
    buttons.setStyleName("buttons");
    loginForm.addComponent(buttons);
    login = new Button("login");
    buttons.addComponent(login);
    login.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            try {
                presenter.doLogin(username.getValue(), password.getValue());
            } catch (AuthenticationException ex) {
                LoginView.this.showNotification(
                        new Notification("Wrong login", Notification.Type.ERROR_MESSAGE),
                        ValoTheme.NOTIFICATION_FAILURE);
            } finally {
                login.setEnabled(true);
            }
        }
    });
    login.addStyleName(ValoTheme.BUTTON_FRIENDLY);

    buttons.addComponent(forgotPassword = new Button("Forgot password?"));
    forgotPassword.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            showNotification(new Notification("Hint: Ask me", Notification.Type.HUMANIZED_MESSAGE),
                    ValoTheme.NOTIFICATION_SUCCESS);
        }
    });
    forgotPassword.addStyleName(ValoTheme.BUTTON_LINK);
    Panel loginPanel = new Panel(loginForm);
    loginPanel.setWidthUndefined();
    loginPanel.addStyleName(ValoTheme.PANEL_BORDERLESS);
    loginPanel.addAction(new ShortcutListener("commit", ShortcutAction.KeyCode.ENTER, null) {
        @Override
        public void handleAction(Object sender, Object target) {
            try {
                presenter.doLogin(username.getValue(), password.getValue());
            } catch (AuthenticationException ex) {
                LoginView.this.showNotification(
                        new Notification("Wrong login", Notification.Type.ERROR_MESSAGE),
                        ValoTheme.NOTIFICATION_FAILURE);
            }
        }
    });
    return loginPanel;
}