List of usage examples for com.vaadin.ui HorizontalLayout setMargin
@Override public void setMargin(boolean enabled)
From source file:de.symeda.sormas.ui.task.TaskListComponent.java
License:Open Source License
public TaskListComponent(TaskContext context, ReferenceDto entityRef) { setWidth(100, Unit.PERCENTAGE);//from w w w. jav a2 s .com setMargin(false); setSpacing(false); HorizontalLayout componentHeader = new HorizontalLayout(); componentHeader.setMargin(false); componentHeader.setSpacing(false); componentHeader.setWidth(100, Unit.PERCENTAGE); addComponent(componentHeader); list = new TaskList(context, entityRef); addComponent(list); list.reload(); Label tasksHeader = new Label(I18nProperties.getString(Strings.entityTasks)); tasksHeader.addStyleName(CssStyles.H3); componentHeader.addComponent(tasksHeader); if (UserProvider.getCurrent().hasUserRight(UserRight.TASK_CREATE)) { createButton = new Button(I18nProperties.getCaption(Captions.taskNewTask)); createButton.addStyleName(ValoTheme.BUTTON_PRIMARY); createButton.setIcon(VaadinIcons.PLUS_CIRCLE); createButton.addClickListener( e -> ControllerProvider.getTaskController().create(context, entityRef, this::reload)); componentHeader.addComponent(createButton); componentHeader.setComponentAlignment(createButton, Alignment.MIDDLE_RIGHT); } }
From source file:de.symeda.sormas.ui.task.TaskListEntry.java
License:Open Source License
public TaskListEntry(TaskIndexDto task) { this.task = task; setMargin(false);// w w w . j a va 2 s.co m 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.symeda.sormas.ui.therapy.TherapyView.java
License:Open Source License
private VerticalLayout createPrescriptionsHeader() { VerticalLayout prescriptionsHeader = new VerticalLayout(); prescriptionsHeader.setMargin(false); prescriptionsHeader.setSpacing(false); prescriptionsHeader.setWidth(100, Unit.PERCENTAGE); HorizontalLayout headlineRow = new HorizontalLayout(); headlineRow.setMargin(false); headlineRow.setSpacing(true);//from ww w.j a v a 2 s . c om headlineRow.setWidth(100, Unit.PERCENTAGE); { Label prescriptionsLabel = new Label(I18nProperties.getString(Strings.entityPrescriptions)); CssStyles.style(prescriptionsLabel, CssStyles.H3); headlineRow.addComponent(prescriptionsLabel); headlineRow.setExpandRatio(prescriptionsLabel, 1); // Bulk operations if (UserProvider.getCurrent().hasUserRight(UserRight.PERFORM_BULK_OPERATIONS)) { MenuBar bulkOperationsDropdown = new MenuBar(); MenuItem bulkOperationsItem = bulkOperationsDropdown .addItem(I18nProperties.getCaption(Captions.bulkActions), null); Command deleteCommand = selectedItem -> { ControllerProvider.getTherapyController() .deleteAllSelectedPrescriptions(prescriptionGrid.getSelectedRows(), new Runnable() { public void run() { reloadPrescriptionGrid(); } }); }; bulkOperationsItem.addItem(I18nProperties.getCaption(Captions.bulkDelete), VaadinIcons.TRASH, deleteCommand); headlineRow.addComponent(bulkOperationsDropdown); headlineRow.setComponentAlignment(bulkOperationsDropdown, Alignment.MIDDLE_RIGHT); } Button newPrescriptionButton = new Button( I18nProperties.getCaption(Captions.prescriptionNewPrescription)); CssStyles.style(newPrescriptionButton, ValoTheme.BUTTON_PRIMARY); newPrescriptionButton.addClickListener(e -> { ControllerProvider.getTherapyController().openPrescriptionCreateForm( prescriptionCriteria.getTherapy(), this::reloadPrescriptionGrid); }); headlineRow.addComponent(newPrescriptionButton); headlineRow.setComponentAlignment(newPrescriptionButton, Alignment.MIDDLE_RIGHT); } prescriptionsHeader.addComponent(headlineRow); HorizontalLayout filterRow = new HorizontalLayout(); filterRow.setMargin(false); filterRow.setSpacing(true); { prescriptionTypeFilter = new ComboBox(); prescriptionTypeFilter.setWidth(140, Unit.PIXELS); prescriptionTypeFilter.setInputPrompt(I18nProperties.getPrefixCaption(PrescriptionDto.I18N_PREFIX, PrescriptionDto.PRESCRIPTION_TYPE)); prescriptionTypeFilter.addItems((Object[]) TreatmentType.values()); prescriptionTypeFilter.addValueChangeListener(e -> { prescriptionCriteria.prescriptionType(((TreatmentType) e.getProperty().getValue())); navigateTo(prescriptionCriteria); }); filterRow.addComponent(prescriptionTypeFilter); prescriptionTextFilter = new TextField(); prescriptionTextFilter.setWidth(300, Unit.PIXELS); prescriptionTextFilter.setNullRepresentation(""); prescriptionTextFilter.setInputPrompt(I18nProperties.getString(Strings.promptPrescriptionTextFilter)); prescriptionTextFilter.addTextChangeListener(e -> { prescriptionCriteria.textFilter(e.getText()); reloadPrescriptionGrid(); }); filterRow.addComponent(prescriptionTextFilter); } prescriptionsHeader.addComponent(filterRow); return prescriptionsHeader; }
From source file:de.symeda.sormas.ui.therapy.TherapyView.java
License:Open Source License
private VerticalLayout createTreatmentsHeader() { VerticalLayout treatmentsHeader = new VerticalLayout(); treatmentsHeader.setMargin(false);/* w w w.j a va 2s . c o m*/ treatmentsHeader.setSpacing(false); treatmentsHeader.setWidth(100, Unit.PERCENTAGE); HorizontalLayout headlineRow = new HorizontalLayout(); headlineRow.setMargin(false); headlineRow.setSpacing(true); headlineRow.setWidth(100, Unit.PERCENTAGE); { Label treatmentsLabel = new Label(I18nProperties.getString(Strings.headingTreatments)); CssStyles.style(treatmentsLabel, CssStyles.H3); headlineRow.addComponent(treatmentsLabel); headlineRow.setExpandRatio(treatmentsLabel, 1); // Bulk operations if (UserProvider.getCurrent().hasUserRight(UserRight.PERFORM_BULK_OPERATIONS)) { MenuBar bulkOperationsDropdown = new MenuBar(); MenuItem bulkOperationsItem = bulkOperationsDropdown .addItem(I18nProperties.getCaption(Captions.bulkActions), null); Command deleteCommand = selectedItem -> { ControllerProvider.getTherapyController() .deleteAllSelectedTreatments(treatmentGrid.getSelectedRows(), new Runnable() { public void run() { reloadTreatmentGrid(); } }); }; bulkOperationsItem.addItem(I18nProperties.getCaption(Captions.bulkDelete), VaadinIcons.TRASH, deleteCommand); headlineRow.addComponent(bulkOperationsDropdown); headlineRow.setComponentAlignment(bulkOperationsDropdown, Alignment.MIDDLE_RIGHT); } Button newTreatmentButton = new Button(I18nProperties.getCaption(Captions.treatmentNewTreatment)); newTreatmentButton.addClickListener(e -> { ControllerProvider.getTherapyController().openTreatmentCreateForm(treatmentCriteria.getTherapy(), this::reloadTreatmentGrid); }); headlineRow.addComponent(newTreatmentButton); headlineRow.setComponentAlignment(newTreatmentButton, Alignment.MIDDLE_RIGHT); } treatmentsHeader.addComponent(headlineRow); HorizontalLayout filterRow = new HorizontalLayout(); filterRow.setMargin(false); filterRow.setSpacing(true); { treatmentTypeFilter = new ComboBox(); treatmentTypeFilter.setWidth(140, Unit.PIXELS); treatmentTypeFilter.setInputPrompt( I18nProperties.getPrefixCaption(TreatmentDto.I18N_PREFIX, TreatmentDto.TREATMENT_TYPE)); treatmentTypeFilter.addItems((Object[]) TreatmentType.values()); treatmentTypeFilter.addValueChangeListener(e -> { treatmentCriteria.treatmentType(((TreatmentType) e.getProperty().getValue())); navigateTo(treatmentCriteria); }); filterRow.addComponent(treatmentTypeFilter); treatmentTextFilter = new TextField(); treatmentTextFilter.setWidth(300, Unit.PIXELS); treatmentTextFilter.setNullRepresentation(""); treatmentTextFilter.setInputPrompt(I18nProperties.getString(Strings.promptTreatmentTextFilter)); treatmentTextFilter.addTextChangeListener(e -> { treatmentCriteria.textFilter(e.getText()); reloadTreatmentGrid(); }); filterRow.addComponent(treatmentTextFilter); } treatmentsHeader.addComponent(filterRow); return treatmentsHeader; }
From source file:de.symeda.sormas.ui.user.UsersView.java
License:Open Source License
public HorizontalLayout createFilterBar() { HorizontalLayout filterLayout = new HorizontalLayout(); filterLayout.setMargin(false); filterLayout.setSpacing(true);// ww w. j ava 2 s . co m filterLayout.setSizeUndefined(); filterLayout.addStyleName(CssStyles.VSPACE_3); activeFilter = new ComboBox(); activeFilter.setWidth(200, Unit.PIXELS); activeFilter.setInputPrompt(I18nProperties.getPrefixCaption(UserDto.I18N_PREFIX, UserDto.ACTIVE)); activeFilter.addItems(ACTIVE_FILTER, INACTIVE_FILTER); activeFilter.addValueChangeListener(e -> { criteria.active(ACTIVE_FILTER.equals(e.getProperty().getValue()) ? Boolean.TRUE : INACTIVE_FILTER.equals(e.getProperty().getValue()) ? Boolean.FALSE : null); navigateTo(criteria); }); filterLayout.addComponent(activeFilter); userRolesFilter = new ComboBox(); userRolesFilter.setWidth(200, Unit.PIXELS); userRolesFilter.setInputPrompt(I18nProperties.getPrefixCaption(UserDto.I18N_PREFIX, UserDto.USER_ROLES)); userRolesFilter.addItems(UserRole.getAssignableRoles(UserProvider.getCurrent().getUserRoles())); userRolesFilter.addValueChangeListener(e -> { criteria.userRole((UserRole) e.getProperty().getValue()); navigateTo(criteria); }); filterLayout.addComponent(userRolesFilter); searchField = new TextField(); searchField.setWidth(200, Unit.PIXELS); searchField.setNullRepresentation(""); searchField.setInputPrompt(I18nProperties.getString(Strings.promptUserSearch)); searchField.setImmediate(true); searchField.addTextChangeListener(e -> { criteria.freeText(e.getText()); grid.reload(); }); filterLayout.addComponent(searchField); return filterLayout; }
From source file:de.uni_leipzig.informatik.pcai042.boa.gui.evaluation.EvaluationView.java
License:Open Source License
/** * Build content 'annotation process' of tab 2. * // www . j ava2s . c o m * @return content of second tab */ private Layout buildTab2Content() { VerticalLayout tab2Content = new VerticalLayout(); tab2Content.setSpacing(true); tab2Content.setMargin(true); tab2Content.setSizeFull(); this.textAreaSentence = new TextArea("Sentence:"); textAreaSentence.setImmediate(true); textAreaSentence.setRows(7); textAreaSentence.setWidth("100%"); tab2Content.addComponent(textAreaSentence); HorizontalLayout hlay1 = new HorizontalLayout(); this.buttonNew = new Button("New"); buttonNew.setImmediate(true); buttonNew.setDescription("Type in new sentences"); this.buttonAnnotate = new Button("Annotate"); buttonAnnotate.setImmediate(true); buttonAnnotate.setDescription("Annotate the sentences above"); hlay1.setSpacing(true); hlay1.setMargin(false); hlay1.addComponent(buttonNew); hlay1.addComponent(buttonAnnotate); tab2Content.addComponent(hlay1); this.listSelectAnnotation = new ListSelect("Annotations:"); listSelectAnnotation.setImmediate(true); listSelectAnnotation.setHeight("150px"); listSelectAnnotation.setWidth("100%"); listSelectAnnotation.setNullSelectionAllowed(false); tab2Content.addComponent(listSelectAnnotation); this.textAreaAnnotation = new TextArea("Further annotations with other surface forms:"); textAreaAnnotation.setImmediate(false); textAreaAnnotation.setRows(4); textAreaAnnotation.setReadOnly(true); textAreaAnnotation.setWidth("100%"); tab2Content.addComponent(textAreaAnnotation); //this.buttonNext = new Button("Next"); //buttonNext.setImmediate(true); //buttonNext.setDescription("Get next annotation"); //tab2Content.addComponent(buttonNext); return tab2Content; }
From source file:de.uni_leipzig.informatik.pcai042.boa.gui.evaluation.EvaluationView.java
License:Open Source License
/** * Build content 'evaluation process' of tab 3. * //w w w . j a v a 2s . c om * @return content of third tab */ private Layout buildTab3Content() { VerticalLayout tab3Content = new VerticalLayout(); tab3Content.setSpacing(true); tab3Content.setMargin(true); tab3Content.setSizeFull(); Label instructions = new Label( "<b>Instructions:</b> <i>Please select and click a sentence below in order to process the evaluation.</i>", Label.CONTENT_XHTML); tab3Content.addComponent(instructions); this.tableEvaluation = new Table("Evaluation process:"); tableEvaluation.setHeight("150px"); tableEvaluation.setWidth("100%"); tableEvaluation.setImmediate(true); tableEvaluation.setSelectable(true); tableEvaluation.setMultiSelect(false); tableEvaluation.setSortDisabled(false); tableEvaluation.addContainerProperty("ID", Integer.class, null); tableEvaluation.addContainerProperty("Sentence", String.class, null); tableEvaluation.addContainerProperty("Precision", Double.class, null); tableEvaluation.addContainerProperty("Recall", Double.class, null); tableEvaluation.addContainerProperty("F-Score", Double.class, null); tab3Content.addComponent(tableEvaluation); this.buttonNext2 = new Button("Next"); buttonNext2.setImmediate(true); buttonNext2.setDescription("Get the next sentence in table"); tab3Content.addComponent(buttonNext2); this.textAreaEvalSentence = new TextArea("Sentence:"); textAreaEvalSentence.setImmediate(false); textAreaEvalSentence.setReadOnly(true); textAreaEvalSentence.setRows(3); textAreaEvalSentence.setWidth("100%"); tab3Content.addComponent(textAreaEvalSentence); HorizontalLayout hlay1 = new HorizontalLayout(); this.listSelectGoldstandard = new ListSelect("Goldstandard:"); listSelectGoldstandard.setImmediate(true); listSelectGoldstandard.setHeight("120px"); listSelectGoldstandard.setWidth("100%"); listSelectGoldstandard.setNullSelectionAllowed(false); this.listSelectFramework = new ListSelect("Framework:"); listSelectFramework.setImmediate(true); listSelectFramework.setHeight("120px"); listSelectFramework.setWidth("100%"); listSelectFramework.setNullSelectionAllowed(false); hlay1.setSpacing(true); hlay1.setMargin(false); hlay1.setWidth("100%"); hlay1.addComponent(listSelectGoldstandard); hlay1.addComponent(listSelectFramework); tab3Content.addComponent(hlay1); return tab3Content; }
From source file:de.uni_tuebingen.qbic.qbicmainportlet.AddPatientView.java
License:Open Source License
/** * /*from w ww . ja v a 2 s .c o m*/ * @return */ VerticalLayout initButtonLayout() { registerPatients = new Button("Register Patients"); // registerPatients.setWidth("100%"); registerPatients.setStyleName(ValoTheme.BUTTON_FRIENDLY); registerPatients.setVisible(false); registerPatients.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { callPatientRegistration(); } }); buttonLayoutSection = new VerticalLayout(); HorizontalLayout buttonLayout = new HorizontalLayout(); buttonLayout.setMargin(new MarginInfo(true, false, true, false)); buttonLayout.setHeight(null); buttonLayout.setWidth("100%"); buttonLayoutSection.setWidth("100%"); buttonLayoutSection.addComponent(buttonLayout); buttonLayout.addComponent(registerPatients); return buttonLayoutSection; }
From source file:de.uni_tuebingen.qbic.qbicmainportlet.AddPatientView.java
License:Open Source License
/** * initializes the hla typing registration layout * /*from w w w. j a v a 2 s. com*/ * @return */ void hlaTypingLayout() { hlaLayout.removeAllComponents(); hlaLayout.setWidth("100%"); hlaLayout.setVisible(false); hlaLayout.setMargin(new MarginInfo(true, false, false, false)); hlaLayout.setHeight(null); hlaLayout.setSpacing(true); hlaInfo = new CustomVisibilityComponent(new Label("HLA Typing")); ((Label) hlaInfo.getInnerComponent()).setHeight("24px"); Component hlaContext = Utils.questionize(hlaInfo, "Register available HLA typing for this patient (one allele per line)", "HLA Typing"); hlaLayout.addComponent(hlaContext); HorizontalLayout hlalayout = new HorizontalLayout(); VerticalLayout hlaLayout1 = new VerticalLayout(); hlaLayout1.addComponent(registerHLAI); hlaLayout1.addComponent(hlaItypes); VerticalLayout hlaLayout2 = new VerticalLayout(); hlaLayout2.addComponent(registerHLAII); hlaLayout2.addComponent(hlaIItypes); hlalayout.addComponent(hlaLayout1); hlalayout.addComponent(hlaLayout2); hlalayout.setSpacing(true); typingMethod.addItems(datahandler.getOpenBisClient().getVocabCodesForVocab("Q_HLA_TYPING_METHODS")); hlaLayout.addComponent(typingMethod); hlaLayout.addComponent(hlalayout); }
From source file:de.uni_tuebingen.qbic.qbicmainportlet.BiologicalSamplesComponent.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.//from www .j a v a 2 s . co m */ private void buildLayout() { this.vert.removeAllComponents(); this.vert.setSizeFull(); vert.setResponsive(true); // Table (containing datasets) section VerticalLayout tableSection = new VerticalLayout(); HorizontalLayout tableSectionContent = new HorizontalLayout(); HorizontalLayout sampletableSectionContent = new HorizontalLayout(); tableSection.setResponsive(true); tableSectionContent.setResponsive(true); sampletableSectionContent.setResponsive(true); tableSectionContent.setMargin(new MarginInfo(true, false, false, false)); sampletableSectionContent.setMargin(new MarginInfo(true, false, false, false)); // tableSectionContent.setCaption("Datasets"); // tableSectionContent.setIcon(FontAwesome.FLASK); tableSection.addComponent(new Label(String.format( "This view shows the sample sources (e.g., human, mouse) to be studied and the corresponding extracted samples. With sample sources, information specific to the subject (e.g., age or BMI in the case of patient data) can be stored. The extracted sample is a sample which has been extracted from the corresponding sample source. This is the raw sample material that can be later prepared for specific analytical methods such as MS or NGS.<br> " + "\n\n There are %s extracted samples coming from %s distinct sample sources in this study.", numberOfBioSamples, numberOfEntitySamples), ContentMode.HTML)); tableSectionContent.addComponent(sampleBioGrid); sampletableSectionContent.addComponent(sampleEntityGrid); sampleEntityGrid.setCaption("Sample Sources"); sampleBioGrid.setCaption("Extracted Samples"); tableSection.setMargin(new MarginInfo(true, false, true, true)); tableSection.setSpacing(true); tableSection.addComponent(sampletableSectionContent); tableSection.addComponent(exportSources); tableSection.addComponent(tableSectionContent); tableSection.addComponent(exportSamples); this.vert.addComponent(tableSection); sampleBioGrid.setWidth(100, Unit.PERCENTAGE); sampleEntityGrid.setWidth(100, Unit.PERCENTAGE); // sampleBioGrid.setHeightMode(HeightMode.ROW); // sampleEntityGrid.setHeightMode(HeightMode.ROW); // sampleBioGrid.setHeightByRows(Math.min(10, numberOfBioSamples)); // sampleEntityGrid.setHeightByRows(Math.min(10, 5)); tableSection.setSizeFull(); sampletableSectionContent.setSizeFull(); tableSectionContent.setSizeFull(); }