Example usage for com.vaadin.ui Alignment MIDDLE_RIGHT

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

Introduction

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

Prototype

Alignment MIDDLE_RIGHT

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

Click Source Link

Usage

From source file:no.uib.probe.mnpc_2017.view.ApplicationLayout.java

public ApplicationLayout() {
    this.setWidth("100%");
    this.setHeightUndefined();
    //        this.setStyleName(Reindeer.LAYOUT_WHITE);
    this.setMargin(false);
    this.setSpacing(true);

    VerticalLayout headerLayout = new VerticalLayout();
    headerLayout.setWidth("100%");
    headerLayout.setHeight("77px");
    this.addComponent(headerLayout);

    Panel mainBodyPanel = new Panel();
    //        headerLayout.setStyleName(Reindeer.LAYOUT_BLUE);

    HorizontalLayout topLayoutContainer = new HorizontalLayout();
    headerLayout.addComponent(topLayoutContainer);
    headerLayout.setComponentAlignment(topLayoutContainer, Alignment.MIDDLE_CENTER);
    topLayoutContainer.setWidthUndefined();
    topLayoutContainer.setHeight("100%");

    VerticalLayout logoLayout = new VerticalLayout();
    logoLayout.setWidth("200px");
    logoLayout.setHeight("100%");
    logoLayout.setStyleName("starlogo");
    logoLayout.setMargin(new MarginInfo(false, true, false, false));

    Label title = new Label("NPC 2017");
    logoLayout.addComponent(title);//from   w  w  w  .ja  va2  s  .c  o  m

    topLayoutContainer.addComponent(logoLayout);
    topLayoutContainer.setComponentAlignment(logoLayout, Alignment.MIDDLE_RIGHT);

    HorizontalLayout mainMenuContainer = new HorizontalLayout();
    mainMenuContainer.setWidth("780px");
    topLayoutContainer.addComponent(mainMenuContainer);
    topLayoutContainer.setComponentAlignment(mainMenuContainer, Alignment.MIDDLE_RIGHT);

    VerticalLayout layoutI = new VerticalLayout();
    mainMenuContainer.addComponent(generateMenuBtn("Home", layoutI));

    VerticalLayout layoutII = new VerticalLayout();
    mainMenuContainer.addComponent(generateMenuBtn("Programme", layoutII));

    VerticalLayout layoutIII = new VerticalLayout();
    mainMenuContainer.addComponent(generateMenuBtn("Practical Information", layoutIII));

    VerticalLayout layoutIV = new VerticalLayout();
    mainMenuContainer.addComponent(generateMenuBtn("Exhibition & Sponsorship", layoutIV));

    VerticalLayout layoutV = new VerticalLayout();
    mainMenuContainer.addComponent(generateMenuBtn("Registration", layoutV));

    VerticalLayout layoutVI = new VerticalLayout();
    mainMenuContainer.addComponent(generateMenuBtn("Contact", layoutVI));

}

From source file:org.activiti.editor.ui.EditorProcessDefinitionDetailPanel.java

License:Apache License

protected void initActions() {
    newModelButton = new Button(i18nManager.getMessage(Messages.PROCESS_NEW));
    newModelButton.addListener(new NewModelClickListener());

    importModelButton = new Button(i18nManager.getMessage(Messages.PROCESS_IMPORT));
    importModelButton.addListener(new ImportModelClickListener());

    editModelButton = new Button(i18nManager.getMessage(Messages.PROCESS_EDIT));
    editModelButton.addListener(new EditModelClickListener(modelData));

    actionLabel = new Label(i18nManager.getMessage(Messages.MODEL_ACTION));
    actionLabel.setSizeUndefined();/*  ww  w . jav a2 s .  co m*/

    actionSelect = new Select();
    actionSelect.addItem(i18nManager.getMessage(Messages.PROCESS_COPY));
    actionSelect.addItem(i18nManager.getMessage(Messages.PROCESS_DELETE));
    actionSelect.addItem(i18nManager.getMessage(Messages.PROCESS_DEPLOY));
    actionSelect.addItem(i18nManager.getMessage(Messages.PROCESS_EXPORT));

    actionSelect.setWidth("100px");
    actionSelect.setFilteringMode(Filtering.FILTERINGMODE_OFF);
    actionSelect.setImmediate(true);
    actionSelect.addListener(new ValueChangeListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void valueChange(ValueChangeEvent event) {
            if (i18nManager.getMessage(Messages.PROCESS_COPY).equals(event.getProperty().getValue())) {
                ExplorerApp.get().getViewManager().showPopupWindow(new CopyModelPopupWindow(modelData));
            } else if (i18nManager.getMessage(Messages.PROCESS_DELETE).equals(event.getProperty().getValue())) {
                ExplorerApp.get().getViewManager().showPopupWindow(new DeleteModelPopupWindow(modelData));
            } else if (i18nManager.getMessage(Messages.PROCESS_DEPLOY).equals(event.getProperty().getValue())) {
                deployModel();
            } else if (i18nManager.getMessage(Messages.PROCESS_EXPORT).equals(event.getProperty().getValue())) {
                exportModel();
            }
        }
    });

    // Clear toolbar and add 'start' button
    processDefinitionPage.getToolBar().removeAllButtons();
    processDefinitionPage.getToolBar().removeAllAdditionalComponents();
    processDefinitionPage.getToolBar().addButton(newModelButton);
    processDefinitionPage.getToolBar().addButton(importModelButton);
    processDefinitionPage.getToolBar().addButton(editModelButton);
    processDefinitionPage.getToolBar().addAdditionalComponent(actionLabel);
    processDefinitionPage.getToolBar().setComponentAlignment(actionLabel, Alignment.MIDDLE_LEFT);
    processDefinitionPage.getToolBar().addAdditionalComponent(actionSelect);
    processDefinitionPage.getToolBar().setComponentAlignment(actionSelect, Alignment.MIDDLE_RIGHT);
}

From source file:org.activiti.explorer.ui.custom.SelectUsersPopupWindow.java

License:Apache License

protected void initDoneButton() {
    doneButton = new Button("Done");

    doneButton.addListener(new ClickListener() {
        public void buttonClick(ClickEvent event) {
            // Fire event such that depending UI's can be updated
            fireEvent(new SubmitEvent(doneButton, SubmitEvent.SUBMITTED));

            // close popup window
            close();/*from www. j  a  va  2 s.c o m*/
        }
    });

    addComponent(doneButton);
    windowLayout.setComponentAlignment(doneButton, Alignment.MIDDLE_RIGHT);
}

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

License:Apache License

protected void initAddMembersButton(HorizontalLayout membersHeader) {
    Button addButton = new Button();
    addButton.addStyleName(ExplorerLayout.STYLE_ADD);
    membersHeader.addComponent(addButton);
    membersHeader.setComponentAlignment(addButton, Alignment.MIDDLE_RIGHT);

    addButton.addListener(new ClickListener() {
        public void buttonClick(ClickEvent event) {
            final SelectUsersPopupWindow selectUsersPopup = new SelectUsersPopupWindow(
                    i18nManager.getMessage(Messages.GROUP_SELECT_MEMBERS, group.getId()), true, false,
                    getCurrentMembers());
            ExplorerApp.get().getViewManager().showPopupWindow(selectUsersPopup);

            // Listen to submit events (that contain the selected users)
            selectUsersPopup.addListener(new SubmitEventListener() {
                protected void submitted(SubmitEvent event) {
                    Collection<String> userIds = selectUsersPopup.getSelectedUserIds();
                    if (!userIds.isEmpty()) {
                        for (String userId : userIds) {
                            identityService.createMembership(userId, group.getId());
                        }// www  .  j  ava 2 s .  co m
                        notifyMembershipChanged();
                    }
                }

                protected void cancelled(SubmitEvent event) {
                }
            });
        }
    });
}

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

License:Apache License

protected void initAddGroupsButton(HorizontalLayout groupHeader) {
    Button addRelatedContentButton = new Button();
    addRelatedContentButton.addStyleName(ExplorerLayout.STYLE_ADD);
    groupHeader.addComponent(addRelatedContentButton);
    groupHeader.setComponentAlignment(addRelatedContentButton, Alignment.MIDDLE_RIGHT);

    addRelatedContentButton.addListener(new ClickListener() {
        private static final long serialVersionUID = 1L;

        public void buttonClick(ClickEvent event) {
            final GroupSelectionPopupWindow selectionPopup = new GroupSelectionPopupWindow(identityService,
                    user.getId());//from w  ww .  j a v  a2s .c o  m
            selectionPopup.addListener(new SubmitEventListener() {
                private static final long serialVersionUID = 1L;

                protected void submitted(SubmitEvent event) {
                    Set<String> selectedGroups = selectionPopup.getSelectedGroupIds();
                    if (!selectedGroups.isEmpty()) {
                        for (String groupId : selectedGroups) {
                            identityService.createMembership(user.getId(), groupId);
                        }
                        notifyMembershipChanged();
                    }
                }

                protected void cancelled(SubmitEvent event) {
                }
            });
            ExplorerApp.get().getViewManager().showPopupWindow(selectionPopup);
        }
    });
}

From source file:org.activiti.explorer.ui.profile.ProfilePanel.java

License:Apache License

protected void initAboutSection() {
    // Header//from w ww .  j av  a 2  s .c om
    HorizontalLayout header = new HorizontalLayout();
    header.setWidth(100, UNITS_PERCENTAGE);
    header.addStyleName(ExplorerLayout.STYLE_DETAIL_BLOCK);
    infoPanelLayout.addComponent(header);

    Label aboutLabel = createProfileHeader(infoPanelLayout, i18nManager.getMessage(Messages.PROFILE_ABOUT));
    header.addComponent(aboutLabel);
    header.setExpandRatio(aboutLabel, 1.0f);

    // only show edit/save buttons if current user matches
    if (isCurrentLoggedInUser) {
        Button actionButton = null;
        if (!editable) {
            actionButton = initEditProfileButton();
        } else {
            actionButton = initSaveProfileButton();
        }
        header.addComponent(actionButton);
        header.setComponentAlignment(actionButton, Alignment.MIDDLE_RIGHT);
    }

    // 'About' fields
    GridLayout aboutLayout = createInfoSectionLayout(2, 4);

    // Name
    if (!editable && (isDefined(user.getFirstName()) || isDefined(user.getLastName()))) {
        addProfileEntry(aboutLayout, i18nManager.getMessage(Messages.PROFILE_NAME),
                user.getFirstName() + " " + user.getLastName());
    } else if (editable) {
        firstNameField = new TextField();
        firstNameField.focus();
        addProfileInputField(aboutLayout, i18nManager.getMessage(Messages.PROFILE_FIRST_NAME), firstNameField,
                user.getFirstName());
        lastNameField = new TextField();
        addProfileInputField(aboutLayout, i18nManager.getMessage(Messages.PROFILE_LAST_NAME), lastNameField,
                user.getLastName());
    }

    // Job title
    if (!editable && isDefined(jobTitle)) {
        addProfileEntry(aboutLayout, i18nManager.getMessage(Messages.PROFILE_JOBTITLE), jobTitle);
    } else if (editable) {
        jobTitleField = new TextField();
        addProfileInputField(aboutLayout, i18nManager.getMessage(Messages.PROFILE_JOBTITLE), jobTitleField,
                jobTitle);
    }

    // Birthdate
    if (!editable && isDefined(birthDate)) {
        addProfileEntry(aboutLayout, i18nManager.getMessage(Messages.PROFILE_BIRTHDATE), birthDate);
    } else if (editable) {
        birthDateField = new DateField();
        birthDateField.setDateFormat(Constants.DEFAULT_DATE_FORMAT);
        birthDateField.setResolution(DateField.RESOLUTION_DAY);
        try {
            birthDateField.setValue(new SimpleDateFormat(Constants.DEFAULT_DATE_FORMAT).parse(birthDate));
        } catch (Exception e) {
        } // do nothing
        addProfileInputField(aboutLayout, i18nManager.getMessage(Messages.PROFILE_BIRTHDATE), birthDateField,
                null);
    }

    // Location
    if (!editable && isDefined(location)) {
        addProfileEntry(aboutLayout, i18nManager.getMessage(Messages.PROFILE_LOCATION), location);
    } else if (editable) {
        locationField = new TextField();
        addProfileInputField(aboutLayout, i18nManager.getMessage(Messages.PROFILE_LOCATION), locationField,
                location);
    }
}

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

License:Apache License

protected void populateSubTasks(List<HistoricTaskInstance> subTasks) {
    if (!subTasks.isEmpty()) {
        for (final HistoricTaskInstance subTask : subTasks) {
            // icon
            Embedded icon = null;// w w w  .  j av a 2 s.  co m

            if (subTask.getEndTime() != null) {
                icon = new Embedded(null, Images.TASK_FINISHED_22);
            } else {
                icon = new Embedded(null, Images.TASK_22);
            }
            icon.setWidth(22, UNITS_PIXELS);
            icon.setWidth(22, UNITS_PIXELS);
            subTaskLayout.addComponent(icon);

            // Link to subtask
            Button subTaskLink = new Button(subTask.getName());
            subTaskLink.addStyleName(Reindeer.BUTTON_LINK);
            subTaskLink.addListener(new ClickListener() {
                public void buttonClick(ClickEvent event) {
                    ExplorerApp.get().getViewManager().showTaskPage(subTask.getId());
                }
            });
            subTaskLayout.addComponent(subTaskLink);
            subTaskLayout.setComponentAlignment(subTaskLink, Alignment.MIDDLE_LEFT);

            if (subTask.getEndTime() == null) {
                // Delete icon only appears when task is not finished yet
                Embedded deleteIcon = new Embedded(null, Images.DELETE);
                deleteIcon.addStyleName(ExplorerLayout.STYLE_CLICKABLE);
                deleteIcon.addListener(new DeleteSubTaskClickListener(subTask, this));
                subTaskLayout.addComponent(deleteIcon);
                subTaskLayout.setComponentAlignment(deleteIcon, Alignment.MIDDLE_RIGHT);
            } else {
                // Next line of grid
                subTaskLayout.newLine();
            }
        }
    } else {
        Label noSubTasksLabel = new Label(i18nManager.getMessage(Messages.TASK_NO_SUBTASKS));
        noSubTasksLabel.setSizeUndefined();
        noSubTasksLabel.addStyleName(Reindeer.LABEL_SMALL);
        subTaskLayout.addComponent(noSubTasksLabel);
    }

}

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

License:Apache License

protected void initActions() {
    HorizontalLayout actionsContainer = new HorizontalLayout();
    actionsContainer.setSizeFull();//  ww w . j a  va 2 s . c o m

    // Title
    Label processTitle = new Label(i18nManager.getMessage(Messages.TASK_RELATED_CONTENT));
    processTitle.addStyleName(ExplorerLayout.STYLE_H3);
    processTitle.setSizeFull();
    actionsContainer.addComponent(processTitle);
    actionsContainer.setComponentAlignment(processTitle, Alignment.MIDDLE_LEFT);
    actionsContainer.setExpandRatio(processTitle, 1.0f);

    // Add content button
    Button addRelatedContentButton = new Button();
    addRelatedContentButton.addStyleName(ExplorerLayout.STYLE_ADD);
    addRelatedContentButton.addListener(new com.vaadin.ui.Button.ClickListener() {
        private static final long serialVersionUID = 1L;

        public void buttonClick(com.vaadin.ui.Button.ClickEvent event) {
            CreateAttachmentPopupWindow popup = new CreateAttachmentPopupWindow();

            if (task.getProcessInstanceId() != null) {
                popup.setProcessInstanceId(task.getProcessInstanceId());
            } else {
                popup.setTaskId(task.getId());
            }

            // Add listener to update attachments when added
            popup.addListener(new SubmitEventListener() {

                private static final long serialVersionUID = 1L;

                @Override
                protected void submitted(SubmitEvent event) {
                    taskDetailPanel.notifyRelatedContentChanged();
                }

                @Override
                protected void cancelled(SubmitEvent event) {
                    // No attachment was added so updating UI isn't needed.
                }
            });

            ExplorerApp.get().getViewManager().showPopupWindow(popup);
        }
    });

    actionsContainer.addComponent(addRelatedContentButton);
    actionsContainer.setComponentAlignment(processTitle, Alignment.MIDDLE_RIGHT);

    addComponent(actionsContainer);
}

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

License:Apache License

/**
 * Creates a new {@link AddArtifactWindow} instance.
 * //w  w  w  .j a v a2  s  .  c o m
 * @param sessionDir
 *            the session directory to temporary place artifacts in;
 * @param obrUrl
 *            the URL of the OBR to use.
 */
public AddArtifactWindow(File sessionDir, URL obrUrl, String repositoryXML) {
    super("Add artifact");

    m_sessionDir = sessionDir;
    m_obrUrl = obrUrl;
    m_repositoryXML = repositoryXML;

    setModal(true);
    setWidth("50em");
    setCloseShortcut(KeyCode.ESCAPE);

    m_artifactsTable = new Table("Artifacts in repository");
    m_artifactsTable.addContainerProperty(PROPERTY_SYMBOLIC_NAME, String.class, null);
    m_artifactsTable.addContainerProperty(PROPERTY_VERSION, String.class, null);
    m_artifactsTable.addContainerProperty(PROPERTY_PURGE, Button.class, null);
    m_artifactsTable.setSizeFull();
    m_artifactsTable.setSelectable(true);
    m_artifactsTable.setMultiSelect(true);
    m_artifactsTable.setImmediate(true);
    m_artifactsTable.setHeight("15em");

    final Table uploadedArtifacts = new Table("Uploaded artifacts");
    uploadedArtifacts.addContainerProperty(PROPERTY_SYMBOLIC_NAME, String.class, null);
    uploadedArtifacts.addContainerProperty(PROPERTY_VERSION, String.class, null);
    uploadedArtifacts.setSizeFull();
    uploadedArtifacts.setSelectable(false);
    uploadedArtifacts.setMultiSelect(false);
    uploadedArtifacts.setImmediate(true);
    uploadedArtifacts.setHeight("15em");

    final GenericUploadHandler uploadHandler = new GenericUploadHandler(m_sessionDir) {
        @Override
        public void updateProgress(long readBytes, long contentLength) {
            // TODO Auto-generated method stub
        }

        @Override
        protected void artifactsUploaded(List<UploadHandle> uploads) {
            for (UploadHandle handle : uploads) {
                try {
                    URL artifact = handle.getFile().toURI().toURL();

                    Item item = uploadedArtifacts.addItem(artifact);
                    item.getItemProperty(PROPERTY_SYMBOLIC_NAME).setValue(handle.getFilename());
                    item.getItemProperty(PROPERTY_VERSION).setValue("");

                    m_uploadedArtifacts.add(handle.getFile());
                } catch (MalformedURLException e) {
                    showErrorNotification("Upload artifact processing failed",
                            "<br />Reason: " + e.getMessage());
                    logError("Processing of " + handle.getFilename() + " failed.", e);
                }
            }
        }
    };

    final Upload uploadArtifact = new Upload();
    uploadArtifact.setCaption("Upload Artifact");
    uploadHandler.install(uploadArtifact);

    final DragAndDropWrapper finalUploadedArtifacts = new DragAndDropWrapper(uploadedArtifacts);
    finalUploadedArtifacts.setDropHandler(new ArtifactDropHandler(uploadHandler));

    addListener(new Window.CloseListener() {
        public void windowClose(CloseEvent e) {
            for (File artifact : m_uploadedArtifacts) {
                artifact.delete();
            }
        }
    });

    HorizontalLayout searchBar = new HorizontalLayout();
    searchBar.setMargin(false);
    searchBar.setSpacing(true);

    final TextField searchField = new TextField();
    searchField.setImmediate(true);
    searchField.setValue("");

    final IndexedContainer dataSource = (IndexedContainer) m_artifactsTable.getContainerDataSource();

    m_searchButton = new Button("Search", new ClickListener() {
        public void buttonClick(ClickEvent event) {
            String searchValue = (String) searchField.getValue();

            dataSource.removeAllContainerFilters();

            if (searchValue != null && searchValue.trim().length() > 0) {
                dataSource.addContainerFilter(PROPERTY_SYMBOLIC_NAME, searchValue, true /* ignoreCase */,
                        false /* onlyMatchPrefix */);
            }
        }
    });
    m_searchButton.setImmediate(true);

    searchBar.addComponent(searchField);
    searchBar.addComponent(m_searchButton);

    m_addButton = new Button("Add", new ClickListener() {
        public void buttonClick(ClickEvent event) {
            // Import all "local" (existing) bundles...
            importLocalBundles(m_artifactsTable);
            // Import all "remote" (non existing) bundles...
            importRemoteBundles(m_uploadedArtifacts);

            close();
        }
    });
    m_addButton.setImmediate(true);
    m_addButton.setStyleName(Reindeer.BUTTON_DEFAULT);
    m_addButton.setClickShortcut(KeyCode.ENTER);

    VerticalLayout layout = (VerticalLayout) getContent();
    layout.setMargin(true);
    layout.setSpacing(true);

    layout.addComponent(searchBar);
    layout.addComponent(m_artifactsTable);
    layout.addComponent(uploadArtifact);
    layout.addComponent(finalUploadedArtifacts);
    // 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.addComponent(m_addButton);
    layout.setComponentAlignment(m_addButton, Alignment.MIDDLE_RIGHT);

    searchField.focus();
}

From source file:org.balisunrise.vaadin.components.ActionsLine.java

License:Open Source License

private void init() {
    setStyleName("b-actions-line");
    setWidth("100%");
    setHeightUndefined();//from   w ww .j  ava  2 s  .  c  om

    confirmButton = new Button("Confirmar");
    confirmButton.setIcon(FontAwesome.CHECK, "");
    cancelButton = new Button("Cancelar");
    cancelButton.setIcon(FontAwesome.TIMES, "");

    center = new HorizontalLayout();
    center.setSpacing(true);

    addComponent(confirmButton);
    setComponentAlignment(confirmButton, Alignment.MIDDLE_RIGHT);

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

    addComponent(cancelButton);
    setComponentAlignment(cancelButton, Alignment.MIDDLE_LEFT);

}