List of usage examples for com.vaadin.ui Alignment TOP_RIGHT
Alignment TOP_RIGHT
To view the source code for com.vaadin.ui Alignment TOP_RIGHT.
Click Source Link
From source file:de.symeda.sormas.ui.task.TaskGridComponent.java
License:Open Source License
public HorizontalLayout createAssigneeFilterBar() { HorizontalLayout assigneeFilterLayout = new HorizontalLayout(); assigneeFilterLayout.setMargin(false); assigneeFilterLayout.setSpacing(true); assigneeFilterLayout.setWidth(100, Unit.PERCENTAGE); assigneeFilterLayout.addStyleName(CssStyles.VSPACE_3); statusButtons = new HashMap<>(); HorizontalLayout buttonFilterLayout = new HorizontalLayout(); buttonFilterLayout.setSpacing(true); {/* w ww . j a v a 2 s. co m*/ Button allTasks = new Button(I18nProperties.getCaption(Captions.all), e -> processAssigneeFilterChange(null)); CssStyles.style(allTasks, ValoTheme.BUTTON_BORDERLESS, CssStyles.BUTTON_FILTER); allTasks.setCaptionAsHtml(true); buttonFilterLayout.addComponent(allTasks); statusButtons.put(allTasks, I18nProperties.getCaption(Captions.all)); Button officerTasks = new Button(I18nProperties.getCaption(Captions.taskOfficerTasks), e -> processAssigneeFilterChange(OFFICER_TASKS)); initializeStatusButton(officerTasks, buttonFilterLayout, OFFICER_TASKS, I18nProperties.getCaption(Captions.taskOfficerTasks)); Button myTasks = new Button(I18nProperties.getCaption(Captions.taskMyTasks), e -> processAssigneeFilterChange(MY_TASKS)); initializeStatusButton(myTasks, buttonFilterLayout, MY_TASKS, I18nProperties.getCaption(Captions.taskMyTasks)); // Default filter for lab users (that don't have any other role) is "My tasks" if ((UserProvider.getCurrent().hasUserRole(UserRole.LAB_USER) || UserProvider.getCurrent().hasUserRole(UserRole.EXTERNAL_LAB_USER)) && UserProvider.getCurrent().getUserRoles().size() == 1) { activeStatusButton = myTasks; } else { activeStatusButton = allTasks; } } assigneeFilterLayout.addComponent(buttonFilterLayout); HorizontalLayout actionButtonsLayout = new HorizontalLayout(); actionButtonsLayout.setSpacing(true); { // Show archived/active cases button if (UserProvider.getCurrent().hasUserRight(UserRight.TASK_VIEW_ARCHIVED)) { switchArchivedActiveButton = new Button( I18nProperties.getCaption(I18nProperties.getCaption(Captions.taskShowArchived))); switchArchivedActiveButton.setStyleName(ValoTheme.BUTTON_LINK); switchArchivedActiveButton.addClickListener(e -> { criteria.archived(Boolean.TRUE.equals(criteria.getArchived()) ? null : Boolean.TRUE); tasksView.navigateTo(criteria); }); actionButtonsLayout.addComponent(switchArchivedActiveButton); } // Bulk operation dropdown if (UserProvider.getCurrent().hasUserRight(UserRight.PERFORM_BULK_OPERATIONS)) { assigneeFilterLayout.setWidth(100, Unit.PERCENTAGE); MenuBar bulkOperationsDropdown = new MenuBar(); MenuItem bulkOperationsItem = bulkOperationsDropdown .addItem(I18nProperties.getCaption(Captions.bulkActions), null); Command deleteCommand = selectedItem -> { ControllerProvider.getTaskController() .deleteAllSelectedItems(grid.asMultiSelect().getSelectedItems(), new Runnable() { public void run() { grid.reload(); } }); }; bulkOperationsItem.addItem(I18nProperties.getCaption(Captions.bulkDelete), VaadinIcons.TRASH, deleteCommand); actionButtonsLayout.addComponent(bulkOperationsDropdown); } } assigneeFilterLayout.addComponent(actionButtonsLayout); assigneeFilterLayout.setComponentAlignment(actionButtonsLayout, Alignment.TOP_RIGHT); assigneeFilterLayout.setExpandRatio(actionButtonsLayout, 1); return assigneeFilterLayout; }
From source file:de.symeda.sormas.ui.task.TaskListEntry.java
License:Open Source License
public TaskListEntry(TaskIndexDto task) { this.task = task; setMargin(false);/*from w w w . java2 s . com*/ setSpacing(true); setWidth(100, Unit.PERCENTAGE); addStyleName(CssStyles.SORMAS_LIST_ENTRY); HorizontalLayout topLayout = new HorizontalLayout(); topLayout.setMargin(false); topLayout.setSpacing(false); topLayout.setWidth(100, Unit.PERCENTAGE); addComponent(topLayout); setExpandRatio(topLayout, 1); // TOP LEFT VerticalLayout topLeftLayout = new VerticalLayout(); topLeftLayout.setMargin(false); topLeftLayout.setSpacing(false); Label taskTypeLabel = new Label(DataHelper.toStringNullable(task.getTaskType())); CssStyles.style(taskTypeLabel, CssStyles.LABEL_BOLD, CssStyles.LABEL_UPPERCASE); topLeftLayout.addComponent(taskTypeLabel); Label suggestedStartLabel = new Label( I18nProperties.getPrefixCaption(TaskDto.I18N_PREFIX, TaskDto.SUGGESTED_START) + ": " + DateHelper.formatLocalShortDate(task.getSuggestedStart())); topLeftLayout.addComponent(suggestedStartLabel); Label dueDateLabel = new Label(I18nProperties.getPrefixCaption(TaskDto.I18N_PREFIX, TaskDto.DUE_DATE) + ": " + DateHelper.formatLocalShortDate(task.getDueDate())); topLeftLayout.addComponent(dueDateLabel); topLayout.addComponent(topLeftLayout); // TOP RIGHT VerticalLayout topRightLayout = new VerticalLayout(); topRightLayout.addStyleName(CssStyles.ALIGN_RIGHT); topRightLayout.setMargin(false); topRightLayout.setSpacing(false); Label statusLabel = new Label(DataHelper.toStringNullable(task.getTaskStatus())); CssStyles.style(statusLabel, CssStyles.LABEL_BOLD, CssStyles.LABEL_UPPERCASE); topRightLayout.addComponent(statusLabel); Label priorityLabel = new Label( DataHelper.toStringNullable(I18nProperties.getPrefixCaption(TaskDto.I18N_PREFIX, TaskDto.PRIORITY) + ": " + task.getPriority())); if (TaskPriority.HIGH == task.getPriority()) { priorityLabel.addStyleName(CssStyles.LABEL_IMPORTANT); } else if (TaskPriority.NORMAL == task.getPriority()) { priorityLabel.addStyleName(CssStyles.LABEL_NEUTRAL); } topRightLayout.addComponent(priorityLabel); Label userLabel = new Label(I18nProperties.getPrefixCaption(TaskDto.I18N_PREFIX, TaskDto.ASSIGNEE_USER) + ": " + task.getAssigneeUser().getCaption()); topRightLayout.addComponent(userLabel); topLayout.addComponent(topRightLayout); topLayout.setComponentAlignment(topRightLayout, Alignment.TOP_RIGHT); String statusStyle; switch (task.getTaskStatus()) { case DONE: statusStyle = CssStyles.LABEL_DONE; break; case NOT_EXECUTABLE: statusStyle = CssStyles.LABEL_NOT; break; case REMOVED: statusStyle = CssStyles.LABEL_DISCARDED; break; default: statusStyle = null; } if (statusStyle != null) { taskTypeLabel.addStyleName(statusStyle); suggestedStartLabel.addStyleName(statusStyle); dueDateLabel.addStyleName(statusStyle); statusLabel.addStyleName(statusStyle); priorityLabel.addStyleName(statusStyle); userLabel.addStyleName(statusStyle); } }
From source file:de.uni_tuebingen.qbic.qbicmainportlet.MultiscaleComponent.java
License:Open Source License
void buildEmptyComments() { // add comments VerticalLayout addComment = new VerticalLayout(); addComment.setMargin(true);//w w w .j ava2s .c om addComment.setWidth(100, Unit.PERCENTAGE); final TextArea comments = new TextArea(); comments.setInputPrompt("Write your comment here..."); comments.setWidth(100, Unit.PERCENTAGE); comments.setRows(2); Button commentsOk = new Button("Add Comment"); commentsOk.addStyleName(ValoTheme.BUTTON_FRIENDLY); commentsOk.addClickListener(new ClickListener() { /** * */ private static final long serialVersionUID = -5369241494545155677L; public void buttonClick(ClickEvent event) { if ("".equals(comments.getValue())) return; String newComment = comments.getValue(); // reset comments comments.setValue(""); // use some date format Date dNow = new Date(); SimpleDateFormat ft = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"); Note note = new Note(); note.setComment(newComment); note.setUsername(controller.getUser()); note.setTime(ft.format(dNow)); // show it now // pastcomments.getContainerDataSource().addItem(note); notes.add(note); // TODO write back Label commentsLabel = new Label(translateComments(notes), ContentMode.HTML); commentsPanel.setContent(commentsLabel); // write back to openbis if (!controller.addNote(note)) { Notification.show("Could not add comment to sample. How did you do that?"); } } }); HorizontalLayout inputPrompt = new HorizontalLayout(); inputPrompt.addComponent(comments); inputPrompt.addComponent(commentsOk); inputPrompt.setWidth(50, Unit.PERCENTAGE); inputPrompt.setComponentAlignment(commentsOk, Alignment.TOP_RIGHT); inputPrompt.setExpandRatio(comments, 1.0f); // addComment.addComponent(comments); // addComment.addComponent(commentsOk); addComment.addComponent(commentsPanel); addComment.addComponent(inputPrompt); // addComment.setComponentAlignment(comments, Alignment.TOP_CENTER); // addComment.setComponentAlignment(commentsOk, Alignment.MIDDLE_CENTER); addComment.setComponentAlignment(commentsPanel, Alignment.TOP_CENTER); addComment.setComponentAlignment(inputPrompt, Alignment.MIDDLE_CENTER); mainlayout.addComponent(addComment); // mainlayout.addComponent(pastcomments); Label commentsLabel = new Label("No comments added so far.", ContentMode.HTML); commentsPanel.setContent(commentsLabel); // mainlayout.addComponent(commentsPanel); // mainlayout.setComponentAlignment(commentsPanel, // Alignment.TOP_CENTER); }
From source file:de.uni_tuebingen.qbic.qbicmainportlet.ProjInformationComponent.java
License:Open Source License
/** * Precondition: {DatasetView#table} has to be initialized. e.g. with * {DatasetView#buildFilterTable} If it is not, strange behaviour has to be expected. builds the * Layout of this view.//www.ja va 2 s . c o m */ private void buildLayout(Boolean dataAvailable, String projectType) { vert.removeAllComponents(); // Table (containing datasets) section VerticalLayout tableSection = new VerticalLayout(); HorizontalLayout tableSectionContent = new HorizontalLayout(); VerticalLayout projDescription = new VerticalLayout(); VerticalLayout projDescriptionContent = new VerticalLayout(); tableSectionContent.setMargin(new MarginInfo(false, false, false, false)); projDescriptionContent.setMargin(new MarginInfo(false, false, false, false)); descHorz.addComponent(descContent); descHorz.addComponent(descEdit); descHorz.setComponentAlignment(descEdit, Alignment.TOP_RIGHT); descHorz.setExpandRatio(descContent, 0.9f); descHorz.setExpandRatio(descEdit, 0.1f); projDescriptionContent.addComponent(descHorz); projDescriptionContent.addComponent(peopleInCharge); // descContent.setWidth("80%"); projDescriptionContent.addComponent(descriptionPanel); projDescriptionContent.addComponent(statusPanel); // longDescription.setWidth("80%"); // projDescriptionContent.addComponent(experimentLabel); // projDescriptionContent.addComponent(statusContent); // statusContent.setSpacing(true); // statusContent.setMargin(new MarginInfo(false, false, false, true)); if (projectType.equals("patient")) { String patientInfo = ""; Boolean available = false; SearchCriteria sampleSc = new SearchCriteria(); sampleSc.addMatchClause( MatchClause.createAttributeMatch(MatchClauseAttribute.TYPE, "Q_BIOLOGICAL_ENTITY")); SearchCriteria projectSc = new SearchCriteria(); projectSc.addMatchClause( MatchClause.createAttributeMatch(MatchClauseAttribute.PROJECT, projectBean.getCode())); sampleSc.addSubCriteria(SearchSubCriteria.createExperimentCriteria(projectSc)); SearchCriteria experimentSc = new SearchCriteria(); experimentSc.addMatchClause(MatchClause.createAttributeMatch(MatchClauseAttribute.TYPE, model.ExperimentType.Q_EXPERIMENTAL_DESIGN.name())); sampleSc.addSubCriteria(SearchSubCriteria.createExperimentCriteria(experimentSc)); List<ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.Sample> samples = datahandler.getOpenBisClient() .getFacade().searchForSamples(sampleSc); for (ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.Sample sample : samples) { if (sample.getProperties().get("Q_ADDITIONAL_INFO") != null) { available = true; String[] splitted = sample.getProperties().get("Q_ADDITIONAL_INFO").split(";"); for (String s : splitted) { String[] splitted2 = s.split(":"); patientInfo += String.format("<p><u>%s</u>: %s </p> ", splitted2[0], splitted2[1]); } } } if (available) { patientInformation.setValue(patientInfo); } else { patientInformation.setValue("No patient information provided."); } updateHLALayout(); projDescriptionContent.addComponent(patientInformation); projDescriptionContent.addComponent(hlaTypeLabel); // Vaccine Designer /* * Button vaccineDesigner = new Button("Vaccine Designer"); * vaccineDesigner.setStyleName(ValoTheme.BUTTON_PRIMARY); * vaccineDesigner.setIcon(FontAwesome.CUBES); * * vaccineDesigner.addClickListener(new ClickListener() { * * @Override public void buttonClick(ClickEvent event) { * * ArrayList<String> message = new ArrayList<String>(); message.add("clicked"); StringBuilder * sb = new StringBuilder("type="); sb.append("vaccinedesign"); sb.append("&"); * sb.append("id="); sb.append(projectBean.getId()); message.add(sb.toString()); * message.add(VaccineDesignerView.navigateToLabel); state.notifyObservers(message); */ // UI.getCurrent().getNavigator() // .navigateTo(String.format(VaccineDesignerView.navigateToLabel)); // } // }); // projDescriptionContent.addComponent(vaccineDesigner); } projDescriptionContent.addComponent(tsvDownloadContent); projDescription.addComponent(projDescriptionContent); projDescriptionContent.setSpacing(true); projDescription.setMargin(new MarginInfo(false, false, true, true)); projDescription.setWidth("100%"); projDescription.setSpacing(true); // descriptionLabel.setWidth("100%"); // tableSection.addComponent(descriptionLabel); tableSectionContent.addComponent(this.datasetTable); projDescriptionContent.addComponent(contact); tableSection.setMargin(new MarginInfo(true, false, false, true)); tableSection.setSpacing(true); tableSection.addComponent(tableSectionContent); this.vert.addComponent(projDescription); datasetTable.setWidth("100%"); tableSection.setWidth("100%"); tableSectionContent.setWidth("100%"); // this.table.setSizeFull(); HorizontalLayout buttonLayout = new HorizontalLayout(); buttonLayout.setMargin(new MarginInfo(false, false, true, false)); buttonLayout.setHeight(null); // buttonLayout.setWidth("100%"); buttonLayout.setSpacing(true); this.download.setEnabled(false); buttonLayout.setSpacing(true); Button checkAll = new Button("Select all datasets"); checkAll.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { for (Object itemId : datasetTable.getItemIds()) { ((CheckBox) datasetTable.getItem(itemId).getItemProperty("Select").getValue()).setValue(true); } } }); Button uncheckAll = new Button("Unselect all datasets"); uncheckAll.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { for (Object itemId : datasetTable.getItemIds()) { ((CheckBox) datasetTable.getItem(itemId).getItemProperty("Select").getValue()).setValue(false); } } }); buttonLayout.addComponent(checkAll); buttonLayout.addComponent(uncheckAll); buttonLayout.addComponent(checkAll); buttonLayout.addComponent(uncheckAll); buttonLayout.addComponent(this.download); /** * prepare download. */ download.setResource(new ExternalResource("javascript:")); download.setEnabled(false); for (final Object itemId : this.datasetTable.getItemIds()) { setCheckedBox(itemId, (String) this.datasetTable.getItem(itemId).getItemProperty("CODE").getValue()); } /* * Send message that in datasetview the following was selected. WorkflowViews get those messages * and save them, if it is valid information for them. */ this.datasetTable.addValueChangeListener(new ValueChangeListener() { /** * */ private static final long serialVersionUID = -3554627008191389648L; @Override public void valueChange(ValueChangeEvent event) { // Nothing selected or more than one selected. Set<Object> selectedValues = (Set<Object>) event.getProperty().getValue(); State state = (State) UI.getCurrent().getSession().getAttribute("state"); ArrayList<String> message = new ArrayList<String>(); message.add("DataSetView"); if (selectedValues != null && selectedValues.size() == 1) { Iterator<Object> iterator = selectedValues.iterator(); Object next = iterator.next(); String datasetType = (String) datasetTable.getItem(next).getItemProperty("Dataset Type") .getValue(); message.add(datasetType); String project = (String) datasetTable.getItem(next).getItemProperty("Project").getValue(); String space = datahandler.getOpenBisClient().getProjectByCode(project).getSpaceCode();// .getIdentifier().split("/")[1]; message.add(project); message.add((String) datasetTable.getItem(next).getItemProperty("Sample").getValue()); // message.add((String) table.getItem(next).getItemProperty("Sample Type").getValue()); message.add((String) datasetTable.getItem(next).getItemProperty("dl_link").getValue()); message.add((String) datasetTable.getItem(next).getItemProperty("File Name").getValue()); message.add(space); // state.notifyObservers(message); } else { message.add("null"); } // TODO // state.notifyObservers(message); } }); this.datasetTable.addItemClickListener(new ItemClickListener() { @Override public void itemClick(ItemClickEvent event) { if (!event.isDoubleClick()) { String datasetCode = (String) datasetTable.getItem(event.getItemId()).getItemProperty("CODE") .getValue(); String datasetFileName = (String) datasetTable.getItem(event.getItemId()) .getItemProperty("File Name").getValue(); URL url; try { Resource res = null; Object parent = datasetTable.getParent(event.getItemId()); if (parent != null) { String parentDatasetFileName = (String) datasetTable.getItem(parent) .getItemProperty("File Name").getValue(); url = datahandler.getOpenBisClient().getUrlForDataset(datasetCode, parentDatasetFileName + "/" + datasetFileName); } else { url = datahandler.getOpenBisClient().getUrlForDataset(datasetCode, datasetFileName); } Window subWindow = new Window(); VerticalLayout subContent = new VerticalLayout(); subContent.setMargin(true); subWindow.setContent(subContent); QbicmainportletUI ui = (QbicmainportletUI) UI.getCurrent(); Boolean visualize = false; if (datasetFileName.endsWith(".pdf")) { QcMlOpenbisSource re = new QcMlOpenbisSource(url); StreamResource streamres = new StreamResource(re, datasetFileName); streamres.setMIMEType("application/pdf"); res = streamres; visualize = true; } if (visualize) { LOGGER.debug("Is resource null?: " + String.valueOf(res == null)); BrowserFrame frame = new BrowserFrame("", res); frame.setSizeFull(); subContent.addComponent(frame); // Center it in the browser window subWindow.center(); subWindow.setModal(true); subWindow.setSizeFull(); frame.setHeight((int) (ui.getPage().getBrowserWindowHeight() * 0.9), Unit.PIXELS); // Open it in the UI ui.addWindow(subWindow); } } catch (MalformedURLException e) { LOGGER.error(String.format("Visualization failed because of malformedURL for dataset: %s", datasetCode)); Notification.show( "Given dataset has no file attached to it!! Please Contact your project manager. Or check whether it already has some data", Notification.Type.ERROR_MESSAGE); } } } }); // this.vert.addComponent(buttonLayout); if (dataAvailable) { this.vert.addComponent(tableSection); tableSection.addComponent(buttonLayout); projDescription.setMargin(new MarginInfo(false, false, false, true)); } }
From source file:de.uni_tuebingen.qbic.qbicmainportlet.ToolBar.java
License:Open Source License
void init() { // setWidth(100.0f, Unit.PERCENTAGE); // addStyleName("user-menu"); // setWidth((UI.getCurrent().getPage().getBrowserWindowWidth() * 0.6f), Unit.PIXELS); MenuBar menuBar = new MenuBar(); menuBar.addStyleName("user-menu"); menuBar.setHtmlContentAllowed(true); download = menuBar.addItem("Download your data", null, null); download.setEnabled(false);/*from www . j av a 2s . c om*/ download.setIcon(new ThemeResource("computer_higher.png")); download.addSeparator(); this.downloadwhole = download.addItem("<a href=\"" + resourceUrl + "\" target=\"_blank\" style=\"text-decoration: none ; color:#2c2f34\">Download everything belonging to this entity.</a>", null); this.downloadwhole.setEnabled(false); // Open DatasetView this.datasetoverview = download.addItem("Dataset Overview", null); this.datasetoverview.setEnabled(false); manage = menuBar.addItem("Manage your data", null, null); manage.setIcon(new ThemeResource("barcode_higher.png")); manage.setEnabled(false); // Another submenu item with a sub-submenu this.createBarcodes = manage.addItem("Create Barcodes", null, null); createBarcodes.setEnabled(false); workflows = menuBar.addItem("Run workflows", null, null); workflows.setIcon(new ThemeResource("dna_higher.png")); workflows.setEnabled(false); addComponent(menuBar); // menuBar.setWidth((UI.getCurrent().getPage().getBrowserWindowWidth() * 0.3f), Unit.PIXELS); // searchEngineView.setWidth((UI.getCurrent().getPage().getBrowserWindowWidth() * 0.2f), // Unit.PIXELS); // searchEngineView.setWidth("100%"); addComponent(searchEngineView); setComponentAlignment(searchEngineView, Alignment.TOP_RIGHT); // setExpandRatio(menuBar, 0.7f); // setExpandRatio(searchEngineView, 0.3f); }
From source file:dhbw.ka.mwi.businesshorizon2.ui.login.LogInScreenViewImplv2.java
License:Open Source License
/** * Diese Methode setzt den Titel (im Browser-Fenster) zu * "Business Horizon 2" und erstellt die LogIn Maske mit Listener. Der * Listener prft ruft die im LogIn Event gesammelten LogIn-Daten und * bergibt sie dem presenter zur Kontrolle. Je nach ausgang der Konrolle * wird dann eine Fehlermeldung aufgerufen. Zudem wird mittels dem * "registrieren" Button und dessen Listener eine Dialogfenster * bereitgestellt mit dessen sich ein neuer Anwender registrieren kann. * /*from w w w . j a v a2 s .c o m*/ * @author Christian Scherer */ private void generateUi() { setCaption("Business Horizon 3"); logger.debug("berschrift fr Browser erstellt"); horizontal = new HorizontalLayout(); vSplitPanel = new VerticalSplitPanel(); vSplitPanel.setSplitPosition(70, Sizeable.UNITS_PERCENTAGE); vSplitPanel.setLocked(true); verticalTop = new VerticalLayout(); verticalTop.setSizeFull(); verticalTop.setMargin(true, true, true, true); verticalTop.setStyleName("loginTop"); //Erzeugt ein Label mit dem Willkommens-Text neben dem Logo welcome = new Label("Willkommen bei"); welcome.setStyleName("welcomeSlogan"); //Erezeugt ein Label mit dem Beschreibungstext welcomeText = new Label( "Mithilfe dieser Software knnen Sie Ihre zuknftige Unternehmenswerte berechnen lassen. Hierzu stehen Ihnen verschiedene Methoden zur Verfgung, die Ihnen unterschiedliche Herangehensweisen ermglichen je nachdem, welche Daten Ihnen zur Verfgung stehen. "); welcomeText.setStyleName("welcomeText"); welcomeText.setSizeFull(); textLayout = new HorizontalLayout(); textLayout.setWidth(50, Sizeable.UNITS_PERCENTAGE); textLayout.addComponent(welcomeText); textLayout.setComponentAlignment(welcomeText, Alignment.TOP_RIGHT); iconLabel = new Label(); iconLabel.setIcon(new ThemeResource("images/Logo_businesshorizon.png")); iconLabel.setWidth(40, Sizeable.UNITS_PERCENTAGE); iconLabel.setStyleName("logo"); welcomeLayout = new HorizontalLayout(); welcomeLayout.setSizeFull(); welcomeLayout.addComponent(welcome); welcomeLayout.setComponentAlignment(welcome, Alignment.BOTTOM_CENTER); welcomeLayout.addComponent(iconLabel); welcomeLayout.setComponentAlignment(iconLabel, Alignment.BOTTOM_RIGHT); //Fgt den Beschreibungs-Text dem Bildschirm hinzu verticalTop.addComponent(textLayout); verticalTop.setComponentAlignment(textLayout, Alignment.TOP_RIGHT); verticalTop.addComponent(welcomeLayout); verticalTop.setComponentAlignment(welcomeLayout, Alignment.BOTTOM_RIGHT); login = new LoginForm(); //Zur Anmeldung muss die Mailadresse als Benutzername angegeben werden login.setUsernameCaption("Mailadresse"); login.setPasswordCaption("Passwort"); login.setWidth(null); login.setStyleName("login_form"); login.addListener(new LoginForm.LoginListener() { private static final long serialVersionUID = 1L; @Override public void onLogin(LoginEvent event) { presenter.doLogin(event.getLoginParameter("username"), event.getLoginParameter("password")); } }); //VerticalLayout login = generateLogin(); horizontal.addComponent(login); horizontal.setComponentAlignment(login, Alignment.TOP_CENTER); HorizontalLayout landingBtnLayout = new HorizontalLayout(); loginBtnLayout = new VerticalLayout(); loginBtn = new Button("", this); loginBtn.setWidth(100, Sizeable.UNITS_PIXELS); loginBtn.setHeight(100, Sizeable.UNITS_PIXELS); loginBtn.addStyleName("loginBtn"); loginBtnLabel = new Label("Login"); loginBtnLabel.setWidth(100, Sizeable.UNITS_PIXELS); loginBtnLabel.addStyleName("loginBtnLabel"); loginBtnLayout.addComponent(loginBtn); loginBtnLayout.addComponent(loginBtnLabel); // landingBtnLayout.addComponent(loginBtnLayout); //horizontal.addComponent(loginBtnLayout); //horizontal.setComponentAlignment(loginBtnLayout, Alignment.TOP_RIGHT); registerBtnLayout = new VerticalLayout(); registerBtnLayout.setSizeUndefined(); registerBtn = new Button("", this); registerBtn.setSizeUndefined(); registerBtn.setHeight(100, Sizeable.UNITS_PIXELS); registerBtn.setWidth(100, Sizeable.UNITS_PIXELS); registerBtn.addStyleName("registerBtn"); registerBtnLabel = new Label("Registrieren"); registerBtnLabel.setWidth(100, Sizeable.UNITS_PIXELS); addStyleName("registerBtnLabel"); registerBtnLayout.addComponent(registerBtn); registerBtnLayout.addComponent(registerBtnLabel); landingBtnLayout.addComponent(registerBtnLayout); passwordForgotBtn = new Button("Passwort vergessen", this); passwordForgotBtn.setEnabled(false); horizontal.addComponent(landingBtnLayout); horizontal.setComponentAlignment(landingBtnLayout, Alignment.TOP_RIGHT); horizontal.setMargin(new MarginInfo(true, true, true, true)); horizontal.setSizeFull(); //vertical.addComponent(passwordForgotBtn); //vertical.setComponentAlignment(passwordForgotBtn, Alignment.MIDDLE_CENTER); logger.debug("LogIn UI erstellt und Listener gesetzt"); vSplitPanel.setFirstComponent(verticalTop); vSplitPanel.setSecondComponent(horizontal); setContent(vSplitPanel); }
From source file:dhbw.ka.mwi.businesshorizon2.ui.login.LogInScreenViewImplv2.java
License:Open Source License
/** * Erzeugt die Felder, die fr die Regisitrierung eines neuen Users bentigt werden * Gibt diese im Richtigen Layout zurck/*from w w w .j av a2 s .c o m*/ * @author Felix Schlosser * @return HorizontalLayout */ private HorizontalLayout generateRegisterLayout() { //Erstellen der LayoutContainer fr den Registrierungsdialog HorizontalLayout registerComponent = new HorizontalLayout(); registerComponent.setSizeFull(); registerComponent.setMargin(true, true, true, true); HorizontalLayout registerFields = new HorizontalLayout(); HorizontalLayout buttonLayout = new HorizontalLayout(); VerticalLayout credentials = new VerticalLayout(); VerticalLayout required = new VerticalLayout(); VerticalLayout optional = new VerticalLayout(); //Erstellen des Email-Feld textfieldEmailAdress = new TextField("Emailadresse eingeben"); textfieldEmailAdress.setRequired(true); textfieldEmailAdress.setRequiredError("Pflichtfeld"); //Erstellen des Passwort-Feld passwordFieldPassword = new PasswordField("Passwort eingeben"); passwordFieldPassword.setRequired(true); passwordFieldPassword.setRequiredError("Pflichtfeld"); passwordFieldPassword.setDescription( "Geben Sie bitte ein Passwort (8-12 Zeichen) ein, das folgende Kriterien erfllt: Mindestens ein Gro- und ein Kleinbuchstabe, Zahl, Sonderzeichen."); //Erstellen des Passwort-Wiederholen Feld passwordFieldPasswordRep = new PasswordField("Passwort wiederholen"); passwordFieldPasswordRep.setRequired(true); passwordFieldPasswordRep.setRequiredError("Pflichtfeld"); // Felder zur Layoutkomponente hinzufgen credentials.addComponent(textfieldEmailAdress); credentials.addComponent(passwordFieldPassword); credentials.addComponent(passwordFieldPasswordRep); //Erstellen des Vorname-Feld textfieldFirstName = new TextField("Vorname eingeben"); textfieldFirstName.setRequired(true); textfieldFirstName.setRequiredError("Pflichtfeld"); //Erstellen des Nachname-Feld textfieldLastName = new TextField("Nachname eingeben"); textfieldLastName.setRequired(true); textfieldLastName.setRequiredError("Pflichtfeld"); //Felder zur Layoutkomponente hinzufgen required.addComponent(textfieldFirstName); required.addComponent(textfieldLastName); //Erstellen Firmenname-Feld textfieldCompany = new TextField("Firmenname eingeben"); textfieldCompany.setRequired(true); textfieldCompany.setRequiredError("Pflichtfeld"); //Feld zur Layoutkomponente hinzufgen optional.addComponent(textfieldCompany); //Registrieren-Button erstellen dialogRegBtnLayout = new VerticalLayout(); dialogRegBtn = new Button("", this); dialogRegBtn.setWidth(100, Sizeable.UNITS_PIXELS); dialogRegBtn.setHeight(100, Sizeable.UNITS_PIXELS); dialogRegBtn.addStyleName("dialogRegBtn"); dialogRegBtnLabel = new Label("Registrieren"); dialogRegBtnLabel.setWidth(100, Sizeable.UNITS_PIXELS); dialogRegBtnLabel.addStyleName("dialogRegBtnLabel"); dialogRegBtnLayout.addComponent(dialogRegBtn); dialogRegBtnLayout.addComponent(dialogRegBtnLabel); dialogRegBtnLayout.setSizeUndefined(); //Abbrechen-Button erstellen registerAbortBtnLayout = new VerticalLayout(); registerAbortBtn = new Button("", this); registerAbortBtn.setWidth(100, Sizeable.UNITS_PIXELS); registerAbortBtn.setHeight(100, Sizeable.UNITS_PIXELS); registerAbortBtn.addStyleName("registerAbortBtn"); registerAbortBtnLabel = new Label("Abbrechen"); registerAbortBtnLabel.setWidth(100, Sizeable.UNITS_PIXELS); registerAbortBtnLayout.addComponent(registerAbortBtn); registerAbortBtnLayout.addComponent(registerAbortBtnLabel); buttonLayout.addComponent(dialogRegBtnLayout); buttonLayout.addComponent(registerAbortBtnLayout); buttonLayout.setMargin(true, true, true, true); registerFields.addComponent(credentials); registerFields.addComponent(required); registerFields.addComponent(optional); registerFields.setMargin(true); registerComponent.addComponent(registerFields); registerComponent.addComponent(buttonLayout); registerComponent.setComponentAlignment(buttonLayout, Alignment.TOP_RIGHT); return registerComponent; }
From source file:dhbw.ka.mwi.businesshorizon2.ui.parameterScreen.ParameterScreenViewImpl.java
License:Open Source License
/** * *//*from w w w. j a v a2s. c om*/ private void addLogoutButton() { Button logoutButton = new Button("Logout"); logoutButton.setStyleName("default"); logoutButton.addListener(new Button.ClickListener() { private static final long serialVersionUID = 7411091035775152765L; @Override public void buttonClick(ClickEvent event) { //Callback-Methode, ruft die eigentliche Logout-Methode im Presenter auf presenter.doLogout(); } }); //LogoutButton hinzufgen und ausrichten logoutButton.setEnabled(true); right.addComponent(logoutButton); right.setComponentAlignment(logoutButton, Alignment.TOP_RIGHT); }
From source file:dhbw.ka.mwi.businesshorizon2.ui.process.navigation.NavigationViewImpl.java
License:Open Source License
private void addLogoutButton(String text) { Button logoutButton = new Button(text); logoutButton.addStyleName("default"); logoutButton.setVisible(true);/*from w w w. j a va2 s . c o m*/ logoutButton.addListener(new Button.ClickListener() { private static final long serialVersionUID = 7411091035775152765L; @Override public void buttonClick(ClickEvent event) { //Callback-Methode, ruft die eigentliche Logout-Methode im Presenter auf presenter.doLogout(); } }); logoutButton.setEnabled(true); this.layout.addComponent(logoutButton); this.layout.setComponentAlignment(logoutButton, Alignment.TOP_RIGHT); }
From source file:edu.kit.dama.ui.admin.administration.user.MembershipRoleEditorWindow.java
License:Apache License
/** * Get the main layout./*from ww w . j ava 2s.c om*/ * * @return The main layout. */ private GridLayout getMainLayout() { if (mainPanel == null) { String id = "mainPanel"; LOGGER.debug("Building " + DEBUG_ID_PREFIX + id + " ..."); UIUtils7.GridLayoutBuilder builder = new UIUtils7.GridLayoutBuilder(2, 2); builder.addComponent(getMembershipsTable(), 0, 0); Label l = new Label( "To update the membership role of the selected group(s) select the new role below and click <i>'Apply New Role'</i>. The new role is limited by the user's maximum role.", ContentMode.HTML); Label spacer = new Label("<br/>", ContentMode.HTML); Button closeButton = new Button("Close"); closeButton.addClickListener((event) -> { close(); }); VerticalLayout actionLayout = new VerticalLayout(l, spacer, getRoleComboBox(), getCommitChangeButton()); actionLayout.setComponentAlignment(l, Alignment.TOP_CENTER); actionLayout.setComponentAlignment(getRoleComboBox(), Alignment.TOP_RIGHT); actionLayout.setComponentAlignment(getCommitChangeButton(), Alignment.TOP_RIGHT); actionLayout.setComponentAlignment(getCommitChangeButton(), Alignment.TOP_RIGHT); actionLayout.setSpacing(true); actionLayout.setSizeFull(); builder.addComponent(actionLayout, 1, 0); builder.addComponent(closeButton, Alignment.BOTTOM_RIGHT, 1, 1, 1, 1); mainPanel = builder.getLayout(); mainPanel.setId(DEBUG_ID_PREFIX + id); mainPanel.setSizeFull(); mainPanel.setColumnExpandRatio(0, .7f); mainPanel.setColumnExpandRatio(1, .3f); mainPanel.setRowExpandRatio(0, .99f); mainPanel.setRowExpandRatio(1, .01f); mainPanel.setSpacing(true); mainPanel.setMargin(true); updateMainPanel(); } return mainPanel; }