Example usage for com.vaadin.ui.themes ValoTheme BUTTON_PRIMARY

List of usage examples for com.vaadin.ui.themes ValoTheme BUTTON_PRIMARY

Introduction

In this page you can find the example usage for com.vaadin.ui.themes ValoTheme BUTTON_PRIMARY.

Prototype

String BUTTON_PRIMARY

To view the source code for com.vaadin.ui.themes ValoTheme BUTTON_PRIMARY.

Click Source Link

Document

Primary action button (e.g.

Usage

From source file:com.hybridbpm.ui.component.bpm.window.FormConfigureWindow.java

License:Apache License

public FormConfigureWindow(Module module) {
    this.module = module;
    formModel = HybridbpmCoreUtil.jsonToObject(module.getModel(), FormModel.class);

    parametersLayout.setFormModel(formModel);
    parametersLayout.initUI(!Module.MODULE_SUBTYPE.TASK_FORM.equals(module.getSubType()));

    toolbar.setSpacing(true);//from w w  w .j av  a  2 s  .  c  o m
    toolbar.addStyleName("toolbar");

    btnOk.addStyleName(ValoTheme.BUTTON_PRIMARY);
    btnOk.setCaption("OK");
    toolbar.addComponent(btnOk);
    toolbar.setComponentAlignment(btnOk, Alignment.MIDDLE_RIGHT);

    btnClose.setCaption("Close");
    toolbar.addComponent(btnClose);
    toolbar.setComponentAlignment(btnClose, Alignment.MIDDLE_RIGHT);

    cssLayout.addComponent(parametersLayout);
    cssLayout.setSizeFull();
    cssLayout.addStyleName("scrollable");

    layout.setSizeFull();
    layout.setMargin(true);
    layout.addComponent(cssLayout);
    layout.setExpandRatio(cssLayout, 1f);
    layout.addComponent(toolbar);
    layout.setComponentAlignment(toolbar, Alignment.BOTTOM_RIGHT);

    setCaption("Form parameters");
    center();
    setResizable(false);
    //        setClosable(false);
    setModal(true);
    addStyleName("no-vertical-drag-hints");
    addStyleName("no-horizontal-drag-hints");
    setContent(layout);
    setWidth(80, Unit.PERCENTAGE);
    setHeight(80, Unit.PERCENTAGE);
}

From source file:com.hybridbpm.ui.component.bpm.window.ProcessConfigureWindow.java

License:Apache License

public void initUI(ProcessModelLayout processModelLayout) {
    this.processModelLayout = processModelLayout;
    variableEditorLayout.setProcessModel(processModelLayout.getProcessModel());
    variableEditorLayout.initUI();/*from  ww  w .  j  ava  2  s  .  co  m*/
    fileEditorLayout.setProcessModel(processModelLayout.getProcessModel());
    fileEditorLayout.initUI();

    toolbar.setSpacing(true);
    toolbar.addStyleName("toolbar");

    btnOk.addStyleName(ValoTheme.BUTTON_PRIMARY);
    btnOk.setCaption("OK");
    toolbar.addComponent(btnOk);
    toolbar.setComponentAlignment(btnOk, Alignment.MIDDLE_RIGHT);

    btnClose.setCaption("Close");
    toolbar.addComponent(btnClose);
    toolbar.setComponentAlignment(btnClose, Alignment.MIDDLE_RIGHT);

    //        cssLayout.addComponent(variableEditorLayout);
    //        cssLayout.setSizeFull();
    //        cssLayout.addStyleName("scrollable");
    tabSheet.setSizeFull();
    tabSheet.addTab(variableEditorLayout, "Data");
    tabSheet.addTab(fileEditorLayout, "Files");

    layout.setSizeFull();
    layout.setMargin(true);
    layout.addComponent(tabSheet);
    layout.setExpandRatio(tabSheet, 1f);
    layout.addComponent(toolbar);
    layout.setComponentAlignment(toolbar, Alignment.BOTTOM_RIGHT);

    setCaption("Process data");
    center();
    setResizable(false);
    //        setClosable(false);
    setModal(true);
    addStyleName("no-vertical-drag-hints");
    addStyleName("no-horizontal-drag-hints");
    setContent(layout);
    setWidth(80, Unit.PERCENTAGE);
    setHeight(80, Unit.PERCENTAGE);
}

From source file:com.hybridbpm.ui.component.bpm.window.TransitionConfigureWindow.java

License:Apache License

public void initUI(ProcessModelLayout processModelLayout) {
    this.processModelLayout = processModelLayout;
    nameTextField.setCaption(("Name"));
    nameTextField.setWidth(300, Unit.PIXELS);
    nameTextField.setNullRepresentation("");

    expressionTextField.setCaption(("Condition Expression"));
    expressionTextField.setWidth(100, Unit.PERCENTAGE);
    expressionTextField.setHeight(50, Unit.PIXELS);
    expressionTextField.setMode(AceMode.groovy);
    expressionTextField.setTheme(AceTheme.chrome);
    expressionTextField.setShowGutter(false);
    SuggestionExtension extension = new SuggestionExtension(
            new VariableSuggester(this.processModelLayout.getProcessModel()));
    extension.setSuggestOnDot(false);/*from w  ww  .  jav  a  2 s .co  m*/
    extension.extend(expressionTextField);

    defaultCheckBox.setCaption(("Default Transition"));

    yTextField.setCaption(("Y"));
    yTextField.setWidth(100, Unit.PIXELS);
    yTextField.setNullRepresentation("");
    yTextField.setVisible(false);

    xTextField.setCaption(("Y"));
    xTextField.setWidth(100, Unit.PIXELS);
    xTextField.setNullRepresentation("");
    xTextField.setVisible(false);

    //        configurationLayout.setCaption("Transition properties");
    //        configurationLayout.addStyleName("process-config");
    configurationLayout.setMargin(new MarginInfo(true, true, true, true));
    configurationLayout.setSpacing(true);
    configurationLayout.addComponent(nameTextField, 0, 0, 0, 0);
    configurationLayout.addComponent(defaultCheckBox, 1, 0, 1, 0);
    configurationLayout.setComponentAlignment(defaultCheckBox, Alignment.BOTTOM_RIGHT);
    configurationLayout.addComponent(expressionTextField, 0, 1, 1, 1);
    configurationLayout.addComponent(xTextField, 0, 2, 0, 2);
    configurationLayout.addComponent(yTextField, 1, 2, 1, 2);
    configurationLayout.setColumnExpandRatio(0, 1f);
    configurationLayout.setColumnExpandRatio(1, 1f);
    configurationLayout.setColumnExpandRatio(2, 1f);

    fieldGroup.setBuffered(true); //important
    fieldGroup.bind(xTextField, "x");
    fieldGroup.bind(yTextField, "y");
    fieldGroup.bind(nameTextField, "name");
    fieldGroup.bind(expressionTextField, "expression");
    fieldGroup.bind(defaultCheckBox, "defaultTransition");
    fieldGroup.setItemDataSource(processModelLayout.getActiveElement().getTransitionModel());

    toolbar.setSpacing(true);
    toolbar.setWidth(100, Unit.PERCENTAGE);
    toolbar.addStyleName("toolbar");

    btnShowMore.setCaption(("Show more"));
    btnShowMore.setStyleName(ValoTheme.BUTTON_LINK);
    toolbar.addComponent(btnShowMore);
    toolbar.setComponentAlignment(btnShowMore, Alignment.MIDDLE_LEFT);
    toolbar.setExpandRatio(btnShowMore, 1f);

    btnOk.addStyleName(ValoTheme.BUTTON_PRIMARY);
    btnOk.setCaption(("OK"));
    toolbar.addComponent(btnOk);
    toolbar.setComponentAlignment(btnOk, Alignment.MIDDLE_RIGHT);

    btnClose.setCaption(("Close"));
    toolbar.addComponent(btnClose);
    toolbar.setComponentAlignment(btnClose, Alignment.MIDDLE_RIGHT);

    layout.addStyleName("process-config-layout");
    layout.setSpacing(true);
    layout.setMargin(true);
    layout.addComponent(configurationLayout);
    layout.addComponent(toolbar);
    layout.setComponentAlignment(toolbar, Alignment.MIDDLE_RIGHT);

    setCaption("Transition");
    center();
    setResizable(false);
    //        setClosable(false);
    setModal(true);
    addStyleName("no-vertical-drag-hints");
    addStyleName("no-horizontal-drag-hints");
    addStyleName("process-config-window");
    setContent(layout);
}

From source file:com.hybridbpm.ui.component.ConfigureWindow.java

License:Apache License

public ConfigureWindow(Component dataLayout, String caption) {
    this.dataLayout = dataLayout;
    setCaption(caption);/* www  .  ja v  a 2 s .  c o m*/

    errorMessage.setVisible(false);
    errorMessage.setStyleName(ValoTheme.LABEL_FAILURE);

    toolbar.setSpacing(true);
    toolbar.addStyleName("toolbar");

    btnOk.addStyleName(ValoTheme.BUTTON_PRIMARY);
    btnOk.addStyleName(ValoTheme.BUTTON_SMALL);
    btnOk.setCaption("OK");
    toolbar.addComponent(btnOk);
    toolbar.setComponentAlignment(btnOk, Alignment.MIDDLE_RIGHT);

    btnClose.setCaption("Close");
    btnClose.addStyleName(ValoTheme.BUTTON_SMALL);

    toolbar.addComponent(btnClose);
    toolbar.setComponentAlignment(btnClose, Alignment.MIDDLE_RIGHT);

    cssLayout.addComponent(this.dataLayout);
    cssLayout.setSizeFull();
    cssLayout.addStyleName("scrollable");

    layout.setSizeFull();
    layout.setMargin(true);
    layout.addComponent(cssLayout);
    layout.setExpandRatio(cssLayout, 1f);
    layout.addComponent(errorMessage);
    layout.addComponent(toolbar);
    layout.setComponentAlignment(toolbar, Alignment.BOTTOM_RIGHT);

    center();
    setResizable(false);
    //        setClosable(false);
    setModal(true);
    addStyleName("no-vertical-drag-hints");
    addStyleName("no-horizontal-drag-hints");
    setContent(layout);
    setWidth(80, Unit.PERCENTAGE);
    setHeight(80, Unit.PERCENTAGE);
}

From source file:com.hybridbpm.ui.component.development.AbstractEditor.java

License:Apache License

public AbstractEditor() {
    setSizeFull();/*from w  w w.ja v  a 2s .  co  m*/
    setSpacing(true);
    setMargin(new MarginInfo(true, false, false, false));
    addComponent(buttonBar);
    setComponentAlignment(buttonBar, Alignment.MIDDLE_RIGHT);
    addComponent(horizontalSplitPanel);
    setExpandRatio(horizontalSplitPanel, 1f);

    horizontalSplitPanel.setSizeFull();
    horizontalSplitPanel.setStyleName("transparent");

    buttonBar.setSpacing(true);
    buttonBar.setSpacing(true);

    btnSave.setIcon(FontAwesome.SAVE);
    btnSave.setStyleName(ValoTheme.BUTTON_BORDERLESS);
    btnSave.addStyleName(ValoTheme.BUTTON_SMALL);
    btnSave.addStyleName(ValoTheme.BUTTON_PRIMARY);
}

From source file:com.hybridbpm.ui.view.LoginView.java

License:Apache License

private void buildLoginForm() {
    Responsive.makeResponsive(loginPanel);
    loginPanel.setSizeUndefined();//from   w w  w .  j  a v  a2  s.c  om
    loginPanel.setSpacing(true);
    loginPanel.addStyleName("login-panel");

    labels.addStyleName("labels");
    welcome.setSizeUndefined();
    welcome.addStyleName(ValoTheme.LABEL_H4);
    welcome.addStyleName(ValoTheme.LABEL_LIGHT);
    title.setSizeUndefined();
    title.addStyleName(ValoTheme.LABEL_H3);
    title.addStyleName(ValoTheme.LABEL_COLORED);

    fields.setSpacing(true);
    fields.addStyleName("fields");

    username.setIcon(FontAwesome.USER);
    username.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON);
    username.setNullRepresentation("");

    password.setIcon(FontAwesome.LOCK);
    password.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON);

    signin.addStyleName(ValoTheme.BUTTON_PRIMARY);
    signin.setClickShortcut(ShortcutAction.KeyCode.ENTER);
    signin.focus();

    fields.setComponentAlignment(signin, Alignment.BOTTOM_LEFT);

    signin.addClickListener((Button.ClickEvent event) -> {
        HybridbpmUI.getCurrent().login(username.getValue(), password.getValue(), rememberMe.getValue());
    });
}

From source file:com.kpg.diary.ui.MenuLayout.java

License:Apache License

/**
 * Builds the menu./*from ww w .  j  a  v a  2s . c  o  m*/
 *
 * @param navigator
 *            the navigator
 * @return the css layout
 */
private CssLayout buildMenu(Navigator navigator) {
    // Add items
    menuItemsMap();
    HorizontalLayout top = new HorizontalLayout();
    top.setWidth("100%");
    top.addStyleName(ValoTheme.MENU_TITLE);

    top.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
    top.addStyleName(ValoTheme.MENU_TITLE);
    menu.addComponent(top);
    // menu.addComponent(createThemeSelect());
    menu.addComponent(top);
    Button showMenu = new Button("Menu", new ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            if (menu.getStyleName().contains("valo-menu-visible")) {
                menu.removeStyleName("valo-menu-visible");
            } else {
                menu.addStyleName("valo-menu-visible");
            }
        }
    });
    showMenu.addStyleName(ValoTheme.BUTTON_PRIMARY);
    showMenu.addStyleName(ValoTheme.BUTTON_SMALL);
    showMenu.addStyleName("valo-menu-toggle");
    showMenu.setIcon(FontAwesome.LIST);
    menu.addComponent(showMenu);

    Label title = new Label("<h2>Diary</h2>", ContentMode.HTML);
    title.setSizeUndefined();
    top.addComponent(title);
    top.setExpandRatio(title, 1);
    menuItemsLayout.setPrimaryStyleName("valo-menuitems");
    menu.addComponent(menuItemsLayout);
    for (final Entry<String, String> item : menuItems.entrySet()) {
        Button b = new Button(item.getValue(), new ClickListener() {
            @Override
            public void buttonClick(ClickEvent event) {
                navigator.navigateTo(item.getKey());
            }
        });
        b.setHtmlContentAllowed(true);
        b.setPrimaryStyleName(ValoTheme.MENU_ITEM);
        if (IConstants.NavigationMenu.ADDRESS.getKey().equals(item.getKey())) {
            b.setIcon(FontAwesome.BOOK);
        } else if (IConstants.NavigationMenu.PERSON.getKey().equals(item.getKey())) {
            b.setIcon(FontAwesome.USER);
        } else {
            b.setIcon(FontAwesome.APPLE);
        }
        menuItemsLayout.addComponent(b);
    }
    return menu;
}

From source file:com.mcparland.john.vaadin_mvn_arch.samples.crud.ProductForm.java

License:Apache License

public ProductForm(SampleCrudLogic sampleCrudLogic) {
    viewLogic = sampleCrudLogic;//  w  w w .java  2s. c om
    addStyleName("product-form-wrapper");
    setId("product-form");
    productName.setWidth("100%");

    price.setConverter(new EuroConverter());

    stockCount.setWidth("80px");

    availability.setNullSelectionAllowed(false);
    availability.setTextInputAllowed(false);
    for (Availability s : Availability.values()) {
        availability.addItem(s);
    }

    category.setWidth("100%");

    saveButton.addStyleName(ValoTheme.BUTTON_PRIMARY);
    cancelButton.addStyleName("cancel");
    removeButton.addStyleName(ValoTheme.BUTTON_DANGER);

    VerticalLayout layout = new VerticalLayout();
    layout.setHeight("100%");
    layout.setSpacing(true);
    layout.addStyleName("form-layout");

    HorizontalLayout priceAndStock = new HorizontalLayout(price, stockCount);
    priceAndStock.setSpacing(true);
    priceAndStock.setWidth("100%");
    price.setWidth("100%");
    stockCount.setWidth("100%");
    availability.setWidth("100%");

    layout.addComponent(productName);
    layout.addComponent(priceAndStock);
    layout.addComponent(availability);
    layout.addComponent(category);

    CssLayout expander = new CssLayout();
    expander.addStyleName("expander");
    layout.addComponent(expander);
    layout.setExpandRatio(expander, 1);

    layout.addComponent(saveButton);
    layout.addComponent(cancelButton);
    layout.addComponent(removeButton);

    addComponent(layout);

    fieldGroup = new BeanFieldGroup<Product>(Product.class);
    fieldGroup.bindMemberFields(this);

    // perform validation and enable/disable buttons while editing
    ValueChangeListener valueListener = new ValueChangeListener() {
        /**
         * The serialVersionUID.
         */
        private static final long serialVersionUID = 1L;

        @Override
        public void valueChange(ValueChangeEvent event) {
            formHasChanged();
        }
    };
    for (Field<?> f : fieldGroup.getFields()) {
        f.addValueChangeListener(valueListener);
    }

    fieldGroup.addCommitHandler(new CommitHandler() {

        /**
         * The serialVersionUID.
         */
        private static final long serialVersionUID = 1L;

        @Override
        public void preCommit(CommitEvent commitEvent) throws CommitException {
        }

        @Override
        public void postCommit(CommitEvent commitEvent) throws CommitException {
            DataService.get().updateProduct(fieldGroup.getItemDataSource().getBean());
        }
    });

    saveButton.addClickListener(new ClickListener() {
        /**
         * The serialVersionUID.
         */
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(ClickEvent event) {
            try {
                fieldGroup.commit();

                // only if validation succeeds
                Product product = fieldGroup.getItemDataSource().getBean();
                viewLogic.saveProduct(product);
            } catch (CommitException e) {
                Notification n = new Notification("Please re-check the fields", Type.ERROR_MESSAGE);
                n.setDelayMsec(500);
                n.show(getUI().getPage());
            }
        }
    });

    cancelButton.setClickShortcut(KeyCode.ESCAPE);
    cancelButton.addClickListener(new ClickListener() {
        /**
         * The serialVersionUID.
         */
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(ClickEvent event) {
            viewLogic.cancelProduct();
        }
    });

    removeButton.addClickListener(new ClickListener() {
        /**
         * The serialVersionUID.
         */
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(ClickEvent event) {
            Product product = fieldGroup.getItemDataSource().getBean();
            viewLogic.deleteProduct(product);
        }
    });
}

From source file:com.mcparland.john.vaadin_mvn_arch.samples.crud.SampleCrudView.java

License:Apache License

public HorizontalLayout createTopBar() {
    TextField filter = new TextField();
    filter.setStyleName("filter-textfield");
    filter.setInputPrompt("Filter");
    ResetButtonForTextField.extend(filter);
    filter.setImmediate(true);/*from   www.  ja  va 2  s . c o  m*/
    filter.addTextChangeListener(new FieldEvents.TextChangeListener() {
        /**
         * The serialVersionUID.
         */
        private static final long serialVersionUID = 1L;

        @Override
        public void textChange(FieldEvents.TextChangeEvent event) {
            table.setFilter(event.getText());
        }
    });

    newProduct = new Button("New product");
    newProduct.addStyleName(ValoTheme.BUTTON_PRIMARY);
    newProduct.setIcon(FontAwesome.PLUS_CIRCLE);
    newProduct.addClickListener(new ClickListener() {
        /**
         * The serialVersionUID.
         */
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(ClickEvent event) {
            viewLogic.newProduct();
        }
    });

    HorizontalLayout topLayout = new HorizontalLayout();
    topLayout.setSpacing(true);
    topLayout.setWidth("100%");
    topLayout.addComponent(filter);
    topLayout.addComponent(newProduct);
    topLayout.setComponentAlignment(filter, Alignment.MIDDLE_LEFT);
    topLayout.setExpandRatio(filter, 1);
    topLayout.setStyleName("top-bar");
    return topLayout;
}

From source file:com.mcparland.john.vaadin_mvn_arch.samples.Menu.java

License:Apache License

public Menu(Navigator navigator) {
    this.navigator = navigator;
    setPrimaryStyleName(ValoTheme.MENU_ROOT);
    menuPart = new CssLayout();
    menuPart.addStyleName(ValoTheme.MENU_PART);

    // header of the menu
    final HorizontalLayout top = new HorizontalLayout();
    top.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
    top.addStyleName(ValoTheme.MENU_TITLE);
    top.setSpacing(true);/*from w  ww  . ja  v a2  s  .  c o m*/
    Label title = new Label("My CRUD");
    title.addStyleName(ValoTheme.LABEL_H3);
    title.setSizeUndefined();
    Image image = new Image(null, new ThemeResource("img/table-logo.png"));
    image.setStyleName("logo");
    top.addComponent(image);
    top.addComponent(title);
    menuPart.addComponent(top);

    // logout menu item
    MenuBar logoutMenu = new MenuBar();
    logoutMenu.addItem("Logout", FontAwesome.SIGN_OUT, new Command() {

        /**
         * The serialVersionUID.
         */
        private static final long serialVersionUID = 1L;

        @Override
        public void menuSelected(MenuItem selectedItem) {
            VaadinSession.getCurrent().getSession().invalidate();
            Page.getCurrent().reload();
        }
    });

    logoutMenu.addStyleName("user-menu");
    menuPart.addComponent(logoutMenu);

    // button for toggling the visibility of the menu when on a small screen
    final Button showMenu = new Button("Menu", new ClickListener() {
        /**
         * The serialVersionUID.
         */
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(final ClickEvent event) {
            if (menuPart.getStyleName().contains(VALO_MENU_VISIBLE)) {
                menuPart.removeStyleName(VALO_MENU_VISIBLE);
            } else {
                menuPart.addStyleName(VALO_MENU_VISIBLE);
            }
        }
    });
    showMenu.addStyleName(ValoTheme.BUTTON_PRIMARY);
    showMenu.addStyleName(ValoTheme.BUTTON_SMALL);
    showMenu.addStyleName(VALO_MENU_TOGGLE);
    showMenu.setIcon(FontAwesome.NAVICON);
    menuPart.addComponent(showMenu);

    // container for the navigation buttons, which are added by addView()
    menuItemsLayout = new CssLayout();
    menuItemsLayout.setPrimaryStyleName(VALO_MENUITEMS);
    menuPart.addComponent(menuItemsLayout);

    addComponent(menuPart);
}