Example usage for com.vaadin.ui Alignment BOTTOM_RIGHT

List of usage examples for com.vaadin.ui Alignment BOTTOM_RIGHT

Introduction

In this page you can find the example usage for com.vaadin.ui Alignment BOTTOM_RIGHT.

Prototype

Alignment BOTTOM_RIGHT

To view the source code for com.vaadin.ui Alignment BOTTOM_RIGHT.

Click Source Link

Usage

From source file:org.activiti.explorer.ui.form.FormPropertiesForm.java

License:Apache License

protected void initButtons() {
    submitFormButton = new Button();
    cancelFormButton = new Button();

    HorizontalLayout buttons = new HorizontalLayout();
    buttons.setSpacing(true);/*from   ww  w  .j a va 2s.co  m*/
    buttons.setWidth(100, UNITS_PERCENTAGE);
    buttons.addStyleName(ExplorerLayout.STYLE_DETAIL_BLOCK);
    buttons.addComponent(submitFormButton);
    buttons.setComponentAlignment(submitFormButton, Alignment.BOTTOM_RIGHT);

    buttons.addComponent(cancelFormButton);
    buttons.setComponentAlignment(cancelFormButton, Alignment.BOTTOM_RIGHT);

    Label buttonSpacer = new Label();
    buttons.addComponent(buttonSpacer);
    buttons.setExpandRatio(buttonSpacer, 1.0f);
    addComponent(buttons);
}

From source file:org.activiti.explorer.ui.management.deployment.DeleteDeploymentPopupWindow.java

License:Apache License

protected void addButtons() {
    // Cancel//from w w  w.  j av  a 2  s. com
    Button cancelButton = new Button(i18nManager.getMessage(Messages.BUTTON_CANCEL));
    cancelButton.addStyleName(Reindeer.BUTTON_SMALL);
    cancelButton.addListener(new ClickListener() {
        public void buttonClick(ClickEvent event) {
            close();
        }
    });

    // Delete
    Button deleteButton = new Button(i18nManager.getMessage(Messages.DEPLOYMENT_DELETE_POPUP_DELETE_BUTTON));
    deleteButton.addStyleName(Reindeer.BUTTON_SMALL);
    deleteButton.addListener(new ClickListener() {
        public void buttonClick(ClickEvent event) {
            // Delete deployment, close popup window and refresh deployment list
            repositoryService.deleteDeployment(deployment.getId(), true);
            close();
            deploymentPage.refreshSelectNext();
        }
    });

    // Alignment
    HorizontalLayout buttonLayout = new HorizontalLayout();
    buttonLayout.setSpacing(true);
    buttonLayout.addComponent(cancelButton);
    buttonLayout.addComponent(deleteButton);
    addComponent(buttonLayout);
    windowLayout.setComponentAlignment(buttonLayout, Alignment.BOTTOM_RIGHT);
}

From source file:org.activiti.explorer.ui.management.identity.GroupSelectionPopupWindow.java

License:Apache License

protected void initSelectButton() {
    final Button selectButton = new Button(i18nManager.getMessage(Messages.USER_SELECT_GROUPS));
    addComponent(selectButton);// ww  w. j a va2s  . c o  m
    ((VerticalLayout) getContent()).setComponentAlignment(selectButton, Alignment.BOTTOM_RIGHT);

    selectButton.addListener(new ClickListener() {
        public void buttonClick(ClickEvent event) {
            fireEvent(new SubmitEvent(selectButton, SubmitEvent.SUBMITTED));
            close();
        }
    });
}

From source file:org.activiti.explorer.ui.management.identity.NewGroupPopupWindow.java

License:Apache License

protected void initCreateButton() {
    HorizontalLayout buttonLayout = new HorizontalLayout();
    buttonLayout.setWidth(100, UNITS_PERCENTAGE);
    form.getFooter().setWidth(100, UNITS_PERCENTAGE);
    form.getFooter().addComponent(buttonLayout);

    Button createButton = new Button(i18nManager.getMessage(Messages.GROUP_CREATE));
    buttonLayout.addComponent(createButton);
    buttonLayout.setComponentAlignment(createButton, Alignment.BOTTOM_RIGHT);

    createButton.addListener(new ClickListener() {
        public void buttonClick(ClickEvent event) {
            handleFormSubmit();/*from w  w w.  ja v  a 2 s  . c om*/
        }
    });
}

From source file:org.activiti.explorer.ui.management.identity.NewUserPopupWindow.java

License:Apache License

protected void initCreateButton() {
    HorizontalLayout buttonLayout = new HorizontalLayout();
    buttonLayout.setWidth(100, UNITS_PERCENTAGE);
    form.getFooter().setWidth(100, UNITS_PERCENTAGE);
    form.getFooter().addComponent(buttonLayout);

    Button createButton = new Button(i18nManager.getMessage(Messages.USER_CREATE));
    buttonLayout.addComponent(createButton);
    buttonLayout.setComponentAlignment(createButton, Alignment.BOTTOM_RIGHT);

    createButton.addListener(new ClickListener() {
        public void buttonClick(ClickEvent event) {
            handleFormSubmit();/*from w  w w  .j  ava2 s.c o m*/
        }
    });
}

From source file:org.activiti.explorer.ui.task.DescriptionComponent.java

License:Apache License

protected void initLayoutClickListener() {
    addListener(new LayoutClickListener() {
        public void layoutClick(LayoutClickEvent event) {
            if (event.getClickedComponent() != null && event.getClickedComponent().equals(descriptionLabel)) {
                // textarea
                final TextArea descriptionTextArea = new TextArea();
                descriptionTextArea.setWidth(100, UNITS_PERCENTAGE);
                descriptionTextArea.setValue(task.getDescription());
                editLayout.addComponent(descriptionTextArea);

                // ok button
                Button okButton = new Button(i18nManager.getMessage(Messages.BUTTON_OK));
                editLayout.addComponent(okButton);
                editLayout.setComponentAlignment(okButton, Alignment.BOTTOM_RIGHT);

                // replace
                replaceComponent(descriptionLabel, editLayout);

                // When OK is clicked -> update task data + ui
                okButton.addListener(new ClickListener() {
                    public void buttonClick(ClickEvent event) {
                        // Update data
                        task.setDescription(descriptionTextArea.getValue().toString());
                        taskService.saveTask(task);

                        // Update UI
                        descriptionLabel.setValue(task.getDescription());
                        replaceComponent(editLayout, descriptionLabel);
                    }//from   ww  w . j a va 2  s.co m
                });
            }
        }
    });
}

From source file:org.activiti.explorer.ui.task.TaskDetailPanel.java

License:Apache License

protected void initDescription(HorizontalLayout layout) {
    final CssLayout descriptionLayout = new CssLayout();
    descriptionLayout.setWidth(100, UNITS_PERCENTAGE);
    layout.addComponent(descriptionLayout);
    layout.setExpandRatio(descriptionLayout, 1.0f);
    layout.setComponentAlignment(descriptionLayout, Alignment.MIDDLE_LEFT);

    String descriptionText = null;
    if (task.getDescription() != null && !"".equals(task.getDescription())) {
        descriptionText = task.getDescription();
    } else {/*from w w w .j  a  v a  2s.  co m*/
        descriptionText = i18nManager.getMessage(Messages.TASK_NO_DESCRIPTION);
    }
    final Label descriptionLabel = new Label(descriptionText);
    descriptionLabel.addStyleName(ExplorerLayout.STYLE_CLICKABLE);
    descriptionLayout.addComponent(descriptionLabel);

    descriptionLayout.addListener(new LayoutClickListener() {
        public void layoutClick(LayoutClickEvent event) {
            if (event.getClickedComponent() != null && event.getClickedComponent().equals(descriptionLabel)) {
                // layout for textarea + ok button
                final VerticalLayout editLayout = new VerticalLayout();
                editLayout.setSpacing(true);

                // textarea
                final TextArea descriptionTextArea = new TextArea();
                descriptionTextArea.setNullRepresentation("");
                descriptionTextArea.setWidth(100, UNITS_PERCENTAGE);
                descriptionTextArea.setValue(task.getDescription());
                editLayout.addComponent(descriptionTextArea);

                // ok button
                Button okButton = new Button(i18nManager.getMessage(Messages.BUTTON_OK));
                editLayout.addComponent(okButton);
                editLayout.setComponentAlignment(okButton, Alignment.BOTTOM_RIGHT);

                // replace
                descriptionLayout.replaceComponent(descriptionLabel, editLayout);

                // When OK is clicked -> update task data + ui
                okButton.addListener(new ClickListener() {
                    public void buttonClick(ClickEvent event) {
                        // Update data
                        task.setDescription(descriptionTextArea.getValue().toString());
                        taskService.saveTask(task);

                        // Update UI
                        descriptionLabel.setValue(task.getDescription());
                        descriptionLayout.replaceComponent(editLayout, descriptionLabel);
                    }
                });
            }
        }
    });
}

From source file:org.apache.ace.webui.vaadin.EditWindow.java

License:Apache License

/**
 * @param object//from  ww w  .j  av a2s. co  m
 * @param factories
 */
protected void initDialog(final NamedObject object, List<UIExtensionFactory> factories) {
    VerticalLayout fields = new VerticalLayout();
    fields.setSpacing(true);
    fields.addComponent(m_name);
    fields.addComponent(m_description);

    TabSheet tabs = new TabSheet();
    tabs.setHeight("350px");
    tabs.setWidth("100%");
    tabs.setVisible(!factories.isEmpty());

    Map<String, Object> context = new HashMap<>();
    context.put("object", object);
    populateContext(context);

    for (UIExtensionFactory factory : factories) {
        try {
            tabs.addTab(factory.create(context));
        } catch (Throwable ex) {
            // We ignore extension factories that throw exceptions
            // TODO: log this or something
            ex.printStackTrace();
        }
    }

    Button okButton = new Button("Ok", new Button.ClickListener() {
        public void buttonClick(ClickEvent event) {
            try {
                onOk((String) m_name.getValue(), (String) m_description.getValue());
                close();
            } catch (Exception e) {
                handleError(e);
            }
        }
    });
    // Allow enter to be used to close this dialog with enter directly...
    okButton.setClickShortcut(KeyCode.ENTER);
    okButton.addStyleName("primary");

    Button cancelButton = new Button("Cancel", new Button.ClickListener() {
        public void buttonClick(ClickEvent event) {
            close();
        }
    });
    cancelButton.setClickShortcut(KeyCode.ESCAPE);

    HorizontalLayout buttonBar = new HorizontalLayout();
    buttonBar.setSpacing(true);
    buttonBar.addComponent(okButton);
    buttonBar.addComponent(cancelButton);

    VerticalLayout layout = (VerticalLayout) getContent();
    layout.setMargin(true);
    layout.setSpacing(true);
    layout.addComponent(fields);
    layout.addComponent(tabs);
    layout.addComponent(buttonBar);

    // The components added to the window are actually added to the window's
    // layout; you can use either. Alignments are set using the layout
    layout.setComponentAlignment(buttonBar, Alignment.BOTTOM_RIGHT);

    m_name.focus();
}

From source file:org.apache.ace.webui.vaadin.GenericAddWindow.java

License:Apache License

/**
 * Initializes this dialog by placing all components on it.
 *///  ww  w.  j  a  va2s . c  om
protected void initDialog() {
    VerticalLayout fields = new VerticalLayout();
    fields.setSpacing(true);
    fields.addComponent(m_name);
    fields.addComponent(m_description);

    final Button okButton = new Button("Ok", new Button.ClickListener() {
        public void buttonClick(ClickEvent event) {
            try {
                onOk((String) m_name.getValue(), (String) m_description.getValue());
                close();
            } catch (Exception e) {
                handleError(e);
            }
        }
    });
    okButton.setEnabled(false);
    // Allow enter to be used to close this dialog with enter directly...
    okButton.setClickShortcut(KeyCode.ENTER);
    okButton.addStyleName(Reindeer.BUTTON_DEFAULT);

    Button cancelButton = new Button("Cancel", new Button.ClickListener() {
        public void buttonClick(ClickEvent event) {
            close();
        }
    });
    cancelButton.setClickShortcut(KeyCode.ESCAPE);

    m_name.addListener(new TextChangeListener() {
        @Override
        public void textChange(TextChangeEvent event) {
            String text = event.getText();
            okButton.setEnabled((text != null) && !"".equals(text.trim()));
        }
    });
    m_name.setTextChangeTimeout(250);
    m_name.setTextChangeEventMode(TextChangeEventMode.TIMEOUT);

    HorizontalLayout buttonBar = new HorizontalLayout();
    buttonBar.setSpacing(true);
    buttonBar.addComponent(okButton);
    buttonBar.addComponent(cancelButton);

    VerticalLayout layout = (VerticalLayout) getContent();
    layout.setMargin(true);
    layout.setSpacing(true);
    layout.addComponent(fields);
    layout.addComponent(buttonBar);

    // The components added to the window are actually added to the window's
    // layout; you can use either. Alignments are set using the layout
    layout.setComponentAlignment(buttonBar, Alignment.BOTTOM_RIGHT);

    // Allow direct typing...
    m_name.focus();
}

From source file:org.apache.tamaya.ui.views.login.LoginBox.java

License:Apache License

private void addButtons() {
    HorizontalLayout buttonsLayout = new HorizontalLayout();
    Button forgotButton = new Button("Forgot", new Button.ClickListener() {
        @Override// w  w w . j ava2s. co m
        public void buttonClick(Button.ClickEvent clickEvent) {
            Notification.show("Sorry, this feature is not yet implemented.",
                    Notification.Type.TRAY_NOTIFICATION);
        }
    });
    Button loginButton = new Button("Login", new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent clickEvent) {
            login();
        }
    });
    buttonsLayout.addComponents(forgotButton, loginButton);
    addComponent(buttonsLayout);
    buttonsLayout.setSpacing(true);
    forgotButton.addStyleName(UIConstants.BUTTON_LINK);
    loginButton.addStyleName(UIConstants.BUTTON_PRIMARY);
    loginButton.setClickShortcut(ShortcutAction.KeyCode.ENTER);
    setComponentAlignment(buttonsLayout, Alignment.BOTTOM_RIGHT);
}