List of usage examples for com.vaadin.ui.themes ValoTheme BUTTON_PRIMARY
String BUTTON_PRIMARY
To view the source code for com.vaadin.ui.themes ValoTheme BUTTON_PRIMARY.
Click Source Link
From source file:org.jumpmind.vaadin.ui.common.ConfirmDialog.java
License:Open Source License
public ConfirmDialog(String caption, String text, final IConfirmListener confirmListener) { setCaption(caption);//from www. java 2s . co m setModal(true); setResizable(true); setWidth(300, Unit.PIXELS); setHeight(200, Unit.PIXELS); setClosable(false); VerticalLayout layout = new VerticalLayout(); layout.setSizeFull(); layout.setSpacing(true); layout.setMargin(true); setContent(layout); if (isNotBlank(text)) { Label textLabel = new Label(text); layout.addComponent(textLabel); layout.setExpandRatio(textLabel, 1); } HorizontalLayout buttonLayout = new HorizontalLayout(); buttonLayout.setStyleName(ValoTheme.WINDOW_BOTTOM_TOOLBAR); buttonLayout.setSpacing(true); buttonLayout.setWidth(100, Unit.PERCENTAGE); Label spacer = new Label(" "); buttonLayout.addComponent(spacer); buttonLayout.setExpandRatio(spacer, 1); Button cancelButton = new Button("Cancel"); cancelButton.setClickShortcut(KeyCode.ESCAPE); cancelButton.addClickListener(new ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { UI.getCurrent().removeWindow(ConfirmDialog.this); } }); buttonLayout.addComponent(cancelButton); Button okButton = new Button("Ok"); okButton.setStyleName(ValoTheme.BUTTON_PRIMARY); okButton.setClickShortcut(KeyCode.ENTER); okButton.addClickListener(new ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { if (confirmListener.onOk()) { UI.getCurrent().removeWindow(ConfirmDialog.this); } } }); buttonLayout.addComponent(okButton); layout.addComponent(buttonLayout); okButton.focus(); }
From source file:org.jumpmind.vaadin.ui.common.PromptDialog.java
License:Open Source License
public PromptDialog(String caption, String text, String defaultValue, final IPromptListener promptListener) { setCaption(caption);/*from w w w . ja v a2 s .c o m*/ setModal(true); setResizable(false); setSizeUndefined(); setClosable(false); VerticalLayout layout = new VerticalLayout(); layout.setSpacing(true); layout.setMargin(true); setContent(layout); if (isNotBlank(text)) { layout.addComponent(new Label(text)); } final TextField field = new TextField(); field.setWidth(100, Unit.PERCENTAGE); field.setNullRepresentation(""); field.setValue(defaultValue); if (defaultValue != null) { field.setSelectionRange(0, defaultValue.length()); } layout.addComponent(field); HorizontalLayout buttonLayout = new HorizontalLayout(); buttonLayout.addStyleName(ValoTheme.WINDOW_BOTTOM_TOOLBAR); buttonLayout.setSpacing(true); buttonLayout.setWidth(100, Unit.PERCENTAGE); Label spacer = new Label(" "); buttonLayout.addComponent(spacer); buttonLayout.setExpandRatio(spacer, 1); Button cancelButton = new Button("Cancel"); cancelButton.setClickShortcut(KeyCode.ESCAPE); cancelButton.addClickListener(new ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { UI.getCurrent().removeWindow(PromptDialog.this); } }); buttonLayout.addComponent(cancelButton); Button okButton = new Button("Ok"); okButton.setStyleName(ValoTheme.BUTTON_PRIMARY); okButton.setClickShortcut(KeyCode.ENTER); okButton.addClickListener(new ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { if (promptListener.onOk(field.getValue())) { UI.getCurrent().removeWindow(PromptDialog.this); } } }); buttonLayout.addComponent(okButton); layout.addComponent(buttonLayout); field.focus(); }
From source file:org.jumpmind.vaadin.ui.common.ResizableWindow.java
License:Open Source License
protected Button buildCloseButton() { Button closeButton = new Button("Close"); closeButton.addStyleName(ValoTheme.BUTTON_PRIMARY); closeButton.addClickListener(new CloseButtonListener()); closeButton.focus();/*from ww w. j a v a 2s .co m*/ return closeButton; }
From source file:org.lucidj.newview.NewView.java
License:Apache License
private void buildView() { setMargin(true);/*from w w w . ja v a2 s .c o m*/ setSpacing(true); Label header = new Label("New project"); header.addStyleName("h2"); header.addStyleName("colored"); addComponent(header); frm_project_name = new TextField("Name"); frm_project_name.setImmediate(true); frm_project_name.setTextChangeEventMode(AbstractTextField.TextChangeEventMode.EAGER); frm_project_name.setRequired(true); frm_project_name.setInputPrompt("Project name"); frm_project_name.setWidth(100, Unit.PERCENTAGE); frm_project_name.addTextChangeListener(new FieldEvents.TextChangeListener() { @Override public void textChange(FieldEvents.TextChangeEvent textChangeEvent) { validate(textChangeEvent.getText()); } }); frm_project_name.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(Property.ValueChangeEvent valueChangeEvent) { validate((String) valueChangeEvent.getProperty().getValue()); } }); addComponent(frm_project_name); addComponent(form_location_panel()); addComponent(form_type_panel()); // TODO: FILL FROM PLUGINS //fill_project_options (this); //------------------ // ARTIFACT OPTIONS //------------------ frm_artifact_options = new Label("Artifact options placeholder"); frm_artifact_options.setId("_artifact_options"); frm_artifact_options.addStyleName("h3"); frm_artifact_options.addStyleName("colored"); addComponent(frm_artifact_options); //------------- // FORM FOOTER //------------- frm_create_project = new Button("Create"); frm_create_project.addStyleName(ValoTheme.BUTTON_PRIMARY); frm_create_project.setEnabled(false); frm_create_project.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent clickEvent) { create_project(); } }); frm_messages = new Label(); frm_footer = new HorizontalLayout(); frm_footer.setMargin(new MarginInfo(true, false, true, false)); frm_footer.setSpacing(true); frm_footer.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); frm_footer.addComponent(frm_create_project); frm_footer.addComponent(frm_messages); addComponent(frm_footer); //--------------------------- // INIT THE ARTIFACT OPTIONS //--------------------------- // This is the last step since it will look for frm_artifact_options and frm_footer // to clear the form and fill in the options from the artifact fill_artifact_options(); }
From source file:org.lucidj.newview.NewView.java
License:Apache License
private Layout form_location_panel() { VerticalLayout rolldown = new VerticalLayout(); rolldown.setCaption("Location"); rolldown.setSpacing(true);/*from w ww .ja va 2 s. c om*/ HorizontalLayout directory_and_browse = new HorizontalLayout(); directory_and_browse.setSpacing(true); directory_and_browse.setWidth(100, Unit.PERCENTAGE); frm_directory = new TextField(); frm_directory.setValue(projects_dir.toString()); frm_directory.setWidth(100, Unit.PERCENTAGE); directory_and_browse.addComponent(frm_directory); Button confirm = new Button("Save"); confirm.addStyleName(ValoTheme.BUTTON_PRIMARY); confirm.setVisible(false); directory_and_browse.addComponent(confirm); Button change_directory = new Button("Change location..."); directory_and_browse.addComponent(change_directory); directory_and_browse.setExpandRatio(frm_directory, 1.0f); rolldown.addComponent(directory_and_browse); Path projects_home = securityEngine.getSubject().getDefaultUserDir(); frm_directories = rendererFactory.newRenderer(projects_home); frm_directories.setVisible(false); rolldown.addComponent(frm_directories); change_directory.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent clickEvent) { if (frm_directories.isVisible()) { change_directory.setCaption("Change location..."); frm_directories.setVisible(false); confirm.setVisible(false); } else { change_directory.setCaption("Cancel change"); frm_directories.setVisible(true); confirm.setVisible(true); } } }); frm_directories.addListener(new Listener() { @Override public void componentEvent(Event event) { if (event instanceof ItemClickEvent) { ItemClickEvent itemClickEvent = (ItemClickEvent) event; File item_id = ((File) itemClickEvent.getItemId()); log.info("CLICK item_path={}", item_id); frm_directory.setValue(item_id.getPath()); } } }); return (rolldown); }
From source file:org.lucidj.vaadinui.Login.java
License:Apache License
@Override // LoginForm protected Component createContent(TextField userNameField, PasswordField passwordField, Button loginButton) { // Save the predefined components this.userNameField = userNameField; this.passwordField = passwordField; this.loginButton = loginButton; // Make LoginForm container full-screen setSizeFull();//from ww w. j a va 2 s.com VerticalLayout layout = new VerticalLayout(); layout.setSizeFull(); layout.addStyleName("login-wallpaper"); final VerticalLayout loginPanel = new VerticalLayout(); loginPanel.setSizeUndefined(); loginPanel.setMargin(true); loginPanel.setSpacing(true); Responsive.makeResponsive(loginPanel); loginPanel.addStyleName("card"); //-------- // HEADER //-------- final HorizontalLayout labels = new HorizontalLayout(); labels.setWidth("100%"); final Label title = new Label("<h3><strong>LucidJ</strong> Console</h3>", ContentMode.HTML); labels.addComponent(title); labels.setExpandRatio(title, 1); loginPanel.addComponent(labels); //-------- // FIELDS //-------- HorizontalLayout fields = new HorizontalLayout(); fields.setSpacing(true); fields.addStyleName("fields"); userNameField.setImmediate(true); userNameField.setTextChangeEventMode(AbstractTextField.TextChangeEventMode.EAGER); final ShortcutListener username_enter_listener = new ShortcutListener("Next field (Tab)", ShortcutAction.KeyCode.ENTER, null) { @Override public void handleAction(Object o, Object o1) { passwordField.setValue(""); passwordField.focus(); } }; userNameField.addTextChangeListener(new FieldEvents.TextChangeListener() { @Override public void textChange(FieldEvents.TextChangeEvent textChangeEvent) { show_default_message(); int new_username_length = textChangeEvent.getText().length(); // Check for autofill if (userNameField.isEmpty() && new_username_length > 1 && !userNameField_filling) { // This is autofill userNameField.removeShortcutListener(username_enter_listener); userNameField.setCursorPosition(new_username_length); userNameField.setSelectionRange(0, new_username_length); } else { userNameField_filling = true; passwordField.setValue(""); userNameField.addShortcutListener(username_enter_listener); } } }); userNameField.addFocusListener(new FieldEvents.FocusListener() { @Override public void focus(FieldEvents.FocusEvent focusEvent) { // Cursor on username, Enter jump to password loginButton.removeClickShortcut(); userNameField.addShortcutListener(username_enter_listener); } }); userNameField.addBlurListener(new FieldEvents.BlurListener() { @Override public void blur(FieldEvents.BlurEvent blurEvent) { // Cursor on password or elsewhere, enter submits userNameField.removeShortcutListener(username_enter_listener); loginButton.setClickShortcut(ShortcutAction.KeyCode.ENTER); } }); passwordField.setImmediate(true); passwordField.setTextChangeEventMode(AbstractTextField.TextChangeEventMode.EAGER); passwordField.addTextChangeListener(new FieldEvents.TextChangeListener() { @Override public void textChange(FieldEvents.TextChangeEvent textChangeEvent) { show_default_message(); } }); loginButton.addStyleName(ValoTheme.BUTTON_PRIMARY); loginButton.setDisableOnClick(true); fields.addComponents(userNameField, passwordField, loginButton); fields.setComponentAlignment(loginButton, Alignment.BOTTOM_LEFT); loginPanel.addComponent(fields); //-------- // FOOTER //-------- loginPanel.addComponent(new CheckBox("Remember me", true)); loginPanel.addComponent(message_label); show_default_message(); layout.addComponent(loginPanel); layout.setComponentAlignment(loginPanel, Alignment.MIDDLE_CENTER); return (layout); }
From source file:org.tylproject.vaadin.addon.fields.drilldown.DrillDownWindow.java
License:Apache License
public Layout makeLayout(ZoomField<T> field) { btnClose.setStyleName(ValoTheme.BUTTON_PRIMARY); content.addStyleName(ValoTheme.PANEL_BORDERLESS); Component dialogContents = field.getZoomDialog().getDialogContents(); content.setContent(dialogContents);//from w w w . j av a 2 s . c o m content.setSizeFull(); buttonBar.setStyleName(ValoTheme.WINDOW_BOTTOM_TOOLBAR); buttonBar.setWidth("100%"); buttonBar.setSpacing(true); buttonBar.setExpandRatio(spacer, 1); rootLayout.setSizeFull(); rootLayout.setExpandRatio(content, 1); rootLayout.setMargin(new MarginInfo(true, false, true, false)); return rootLayout; }
From source file:org.tylproject.vaadin.addon.fields.search.SearchWindow.java
License:Apache License
public SearchWindow(final SearchForm searchForm) { this.searchForm = searchForm; searchForm.setSizeUndefined();/* www . j av a2 s. c o m*/ this.setContent(rootLayout); setClosable(false); setModal(true); setDraggable(false); setResizable(false); rootLayout.setMargin(true); btnApply.addStyleName(ValoTheme.BUTTON_PRIMARY); buttonLayout.addStyleName(ValoTheme.WINDOW_BOTTOM_TOOLBAR); buttonLayout.setSizeFull(); buttonLayout.setExpandRatio(spacer, 1f); rootLayout.addComponents(searchForm, buttonLayout); btnApply.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { apply(); } }); btnClear.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { clear(); } }); btnCancel.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { cancel(); } }); }
From source file:org.tylproject.vaadin.addon.fields.zoom.ZoomWindow.java
License:Apache License
public Layout makeLayout(ZoomField<T> field) { btnSelect.addStyleName(ValoTheme.BUTTON_PRIMARY); content.addStyleName(ValoTheme.PANEL_BORDERLESS); Component dialogContents = field.getZoomDialog().getDialogContents(); content.setContent(dialogContents);/*from ww w.j a va 2s . c o m*/ content.setSizeFull(); rootLayout.setSizeFull(); rootLayout.setExpandRatio(content, 1); rootLayout.setMargin(new MarginInfo(true, false, true, false)); return rootLayout; }
From source file:org.vaadin.spring.samples.security.shared.LoginUI.java
License:Apache License
@Override protected void init(VaadinRequest request) { getPage().setTitle("Vaadin Shared Security Demo Login"); FormLayout loginForm = new FormLayout(); loginForm.setSizeUndefined();// w ww . j a v a 2 s . c o m userName = new TextField("Username"); passwordField = new PasswordField("Password"); rememberMe = new CheckBox("Remember me"); login = new Button("Login"); loginForm.addComponent(userName); loginForm.addComponent(passwordField); loginForm.addComponent(rememberMe); loginForm.addComponent(login); login.addStyleName(ValoTheme.BUTTON_PRIMARY); login.setDisableOnClick(true); login.setClickShortcut(ShortcutAction.KeyCode.ENTER); login.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { login(); } }); VerticalLayout loginLayout = new VerticalLayout(); loginLayout.setSpacing(true); loginLayout.setSizeUndefined(); if (request.getParameter("logout") != null) { loggedOutLabel = new Label("You have been logged out!"); loggedOutLabel.addStyleName(ValoTheme.LABEL_SUCCESS); loggedOutLabel.setSizeUndefined(); loginLayout.addComponent(loggedOutLabel); loginLayout.setComponentAlignment(loggedOutLabel, Alignment.BOTTOM_CENTER); } loginLayout.addComponent(loginFailedLabel = new Label()); loginLayout.setComponentAlignment(loginFailedLabel, Alignment.BOTTOM_CENTER); loginFailedLabel.setSizeUndefined(); loginFailedLabel.addStyleName(ValoTheme.LABEL_FAILURE); loginFailedLabel.setVisible(false); loginLayout.addComponent(loginForm); loginLayout.setComponentAlignment(loginForm, Alignment.TOP_CENTER); VerticalLayout rootLayout = new VerticalLayout(loginLayout); rootLayout.setSizeFull(); rootLayout.setComponentAlignment(loginLayout, Alignment.MIDDLE_CENTER); setContent(rootLayout); setSizeFull(); }