List of usage examples for com.vaadin.ui HorizontalLayout setComponentAlignment
@Override public void setComponentAlignment(Component childComponent, Alignment alignment)
From source file:net.sf.gazpachoquest.questionnaires.views.QuestionnaireView.java
License:Open Source License
private HorizontalLayout createHeader() { final HorizontalLayout layout = new HorizontalLayout(); layout.setWidth("100%"); layout.setMargin(true);//from w w w. j a v a 2 s. com layout.setSpacing(true); final Label title = new Label("Activiti + Vaadin - A Match Made in Heaven"); title.addStyleName(Reindeer.LABEL_H1); layout.addComponent(title); layout.setExpandRatio(title, 1.0f); Label currentUser = new Label(); currentUser.setSizeUndefined(); layout.addComponent(currentUser); layout.setComponentAlignment(currentUser, Alignment.MIDDLE_RIGHT); Button logout = new Button("Logout"); logout.addStyleName(Reindeer.BUTTON_SMALL); // logout.addListener(createLogoutButtonListener()); layout.addComponent(logout); layout.setComponentAlignment(logout, Alignment.MIDDLE_RIGHT); return layout; }
From source file:nl.amc.biolab.nsg.display.component.MainUI.java
License:Open Source License
private HorizontalLayout buildTopPanelMid() { // common part: create layout HorizontalLayout topPanelMid = new HorizontalLayout(); topPanelMid.setImmediate(false);/*from w ww.ja v a 2 s . co m*/ topPanelMid.setWidth("-1px"); topPanelMid.setHeight("-1px"); topPanelMid.setMargin(false); topPanelMid.setSpacing(true); // searchLabel searchLabel = new Label(); searchLabel.setImmediate(false); searchLabel.setWidth("-1px"); searchLabel.setHeight("-1px"); searchLabel.setValue("search "); topPanelMid.addComponent(searchLabel); topPanelMid.setComponentAlignment(searchLabel, Alignment.MIDDLE_CENTER); // searchSelect searchSelect = new Select(); searchSelect.setImmediate(false); searchSelect.setWidth("-1px"); searchSelect.setHeight("-1px"); topPanelMid.addComponent(searchSelect); topPanelMid.setComponentAlignment(searchSelect, Alignment.MIDDLE_CENTER); // label_1 label_1 = new Label(); label_1.setImmediate(false); label_1.setWidth("-1px"); label_1.setHeight("-1px"); label_1.setValue(" with "); topPanelMid.addComponent(label_1); topPanelMid.setComponentAlignment(label_1, Alignment.MIDDLE_CENTER); // searchTextField searchTextField = new TextField(); searchTextField.setImmediate(false); searchTextField.setWidth("-1px"); searchTextField.setHeight("-1px"); topPanelMid.addComponent(searchTextField); topPanelMid.setComponentAlignment(searchTextField, Alignment.MIDDLE_CENTER); searchButton = new NativeButton(); searchButton.setCaption("refine search"); topPanelMid.addComponent(searchButton); topPanelMid.setComponentAlignment(searchButton, Alignment.MIDDLE_CENTER); allSearchButton = new NativeButton(); allSearchButton.setCaption("search in all columns"); topPanelMid.addComponent(allSearchButton); topPanelMid.setComponentAlignment(allSearchButton, Alignment.MIDDLE_CENTER); newSearchButton = new NativeButton(); newSearchButton.setCaption("new search"); topPanelMid.addComponent(newSearchButton); topPanelMid.setComponentAlignment(newSearchButton, Alignment.MIDDLE_CENTER); return topPanelMid; }
From source file:nl.amc.biolab.nsg.display.component.ProcessingForm.java
License:Open Source License
public void setButtons() { HorizontalLayout buttons = new HorizontalLayout(); buttons.setHeight("40px"); buttons.setSpacing(true);/*from w w w . j a v a 2 s .com*/ getLayout().addComponent(buttons); final Button startButton = new NativeButton(); startButton.setCaption(SUBMIT); startButton.setImmediate(true); startButton.setWidth("-1px"); startButton.setHeight("-1px"); startButton.addListener(new Button.ClickListener() { private static final long serialVersionUID = 1906358615316029946L; public void buttonClick(ClickEvent event) { System.out.println(app.getValue()); Set<Long> inputDbIds = new HashSet<Long>(); for (Object iid : inputData.getItemIds()) { inputData.select(iid); inputDbIds.add(((DataElement) iid).getDbId()); } ((VaadinTestApplication) getApplication()).getUserDataService().setDataElementDbIds(inputDbIds); form.commit(); processing.setApplication((Application) app.getValue()); startButton.setData(processing); form.fireEvent(new Event(startButton)); } }); buttons.addComponent(startButton); buttons.setComponentAlignment(startButton, Alignment.TOP_RIGHT); final Button delButton = new NativeButton(); delButton.setCaption("remove inputs"); delButton.setImmediate(true); delButton.setWidth("-1px"); delButton.setHeight("-1px"); delButton.addListener(new Button.ClickListener() { private static final long serialVersionUID = -3377452914254101817L; @SuppressWarnings("unchecked") public void buttonClick(ClickEvent event) { if (inputData.getValue() != null) { for (DataElement de : (Set<DataElement>) inputData.getValue()) { inputData.removeItem(de); dataElements.remove(de); } } } }); buttons.addComponent(delButton); buttons.setComponentAlignment(delButton, Alignment.TOP_RIGHT); }
From source file:nl.amc.biolab.nsg.display.component.ViewerForm.java
License:Open Source License
private void addButtons(final List<Component> buttonList) { if (buttonList != null && buttonList.size() != 0) { HorizontalLayout buttons = new HorizontalLayout(); // buttons.setWidth("100%"); buttons.setHeight("50px"); buttons.setSpacing(true);/*from w ww .j a v a2 s. c o m*/ layout.addComponent(buttons); for (Component b : buttonList) { buttons.addComponent(b); buttons.setComponentAlignment(b, Alignment.TOP_LEFT); } getLayout().addComponent(buttons); } }
From source file:nl.kpmg.lcm.ui.view.transfer.MonitorPanel.java
License:Apache License
private HorizontalLayout initSearchLayout(RestClientService restClientService1) throws UnsupportedOperationException { taskStatusComboBox = initTaskStatusComboBox(); searchField = new TextField(); searchField.addStyleName("margin-right-20"); searchField.addStyleName("width-search-field"); searchField.setCaption("Search criteria"); searchField.setInputPrompt("Type search criteria"); Button searchButton = new Button("Search"); searchButton.addClickListener(new SearchListener()); HorizontalLayout searchlayout = new HorizontalLayout(); searchlayout.addComponent(taskStatusComboBox); searchlayout.addComponent(searchField); searchlayout.addComponent(searchButton); searchlayout.setComponentAlignment(searchButton, Alignment.BOTTOM_RIGHT); searchlayout.addStyleName("margin-bottom-20"); return searchlayout; }
From source file:nl.kpmg.lcm.ui.view.transfer.SchedulePanel.java
License:Apache License
private HorizontalLayout initSearchLayout(RestClientService restClientService1) throws UnsupportedOperationException { remoteLcmListComboBox = initRemoteLcmListComboBox(); searchField = new TextField(); searchField.addStyleName("margin-right-20"); searchField.addStyleName("width-search-field"); searchField.setCaption("Search criteria"); searchField.setInputPrompt("Type search criteria"); Button searchButton = new Button("Search"); searchButton.addClickListener(new SearchListener()); HorizontalLayout searchlayout = new HorizontalLayout(); searchlayout.addComponent(remoteLcmListComboBox); searchlayout.addComponent(searchField); searchlayout.addComponent(searchButton); searchlayout.setComponentAlignment(searchButton, Alignment.BOTTOM_RIGHT); searchlayout.addStyleName("margin-bottom-20"); return searchlayout; }
From source file:no.uib.probe.csf.pr.touch.view.core.SearchingField.java
/** * Default constructor to initialize the main attributes. *//*from ww w .j ava2 s. c o m*/ public SearchingField() { this.setSpacing(true); this.setHeightUndefined(); HorizontalLayout searchFieldContainerLayout = new HorizontalLayout(); searchFieldContainerLayout.setWidthUndefined(); searchFieldContainerLayout.setHeight(100, Unit.PERCENTAGE); searchFieldContainerLayout.setSpacing(true); TextField searchField = new TextField(); searchField.setDescription("Search proteins by name or accession"); searchField.setImmediate(true); searchField.setWidth(100, Unit.PIXELS); searchField.setHeight(18, Unit.PIXELS); searchField.setInputPrompt("Search..."); searchFieldContainerLayout.addComponent(searchField); searchField.setTextChangeTimeout(1500); searchField.setStyleName(ValoTheme.TEXTFIELD_SMALL); searchField.addStyleName(ValoTheme.TEXTFIELD_TINY); final Button b = new Button(); searchField.setTextChangeEventMode(AbstractTextField.TextChangeEventMode.LAZY); searchField.addShortcutListener(new Button.ClickShortcut(b, ShortcutListener.KeyCode.ENTER)); VerticalLayout searchingBtn = new VerticalLayout(); searchingBtn.setWidth(22, Unit.PIXELS); searchingBtn.setHeight(18, Unit.PIXELS); searchingBtn.setStyleName("tablesearchingbtn"); searchFieldContainerLayout.addComponent(searchingBtn); searchFieldContainerLayout.setComponentAlignment(searchingBtn, Alignment.TOP_CENTER); this.addComponent(searchFieldContainerLayout); this.setComponentAlignment(searchFieldContainerLayout, Alignment.TOP_CENTER); searchingCommentLabel = new Label(); searchingCommentLabel.setWidth(100, Unit.PERCENTAGE); searchingCommentLabel.setHeight(23, Unit.PIXELS); searchingCommentLabel.addStyleName(ValoTheme.LABEL_BOLD); searchingCommentLabel.addStyleName(ValoTheme.LABEL_SMALL); searchingCommentLabel.addStyleName(ValoTheme.LABEL_TINY); this.addComponent(searchingCommentLabel); this.setComponentAlignment(searchingCommentLabel, Alignment.TOP_CENTER); searchingBtn.addLayoutClickListener((LayoutEvents.LayoutClickEvent event) -> { b.click(); }); searchField.addTextChangeListener((FieldEvents.TextChangeEvent event) -> { SearchingField.this.textChanged(event.getText()); }); b.addClickListener((Button.ClickEvent event) -> { SearchingField.this.textChanged(searchField.getValue()); }); }
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 ww w .j a v a 2s . 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.accelerators.activiti.admin.ui.GroupCreateForm.java
License:Open Source License
/** * /* w w w .j av a 2 s. co m*/ * @param app */ public GroupCreateForm(AdminApp application) { // Set application reference this.app = application; // Enable buffering so that commit() must be called for the form. setWriteThrough(false); // Set the form to act immediately on user input. setImmediate(true); // Set form size setSizeFull(); // Setup footer layout HorizontalLayout footer = new HorizontalLayout(); footer.setSpacing(true); footer.setWidth("100%"); footer.setVisible(true); // Add footer setFooter(footer); // Init buttons create = new Button(app.getMessage(Messages.Create), (ClickListener) this); close = new Button(app.getMessage(Messages.Close), (ClickListener) this); reset = new Button(app.getMessage(Messages.Reset), this, "discard"); // Set button grid GridLayout grid = new GridLayout(3, 1); grid.addComponent(create, 0, 0); grid.addComponent(reset, 1, 0); grid.addComponent(close, 2, 0); grid.setSpacing(true); // Add grid to footer footer.addComponent(grid); // Right align buttons in footer footer.setComponentAlignment(grid, Alignment.BOTTOM_RIGHT); // Init group types types = new String[] { app.getMessage(Messages.Assignment), app.getMessage(Messages.Program), app.getMessage(Messages.Project), app.getMessage(Messages.Role), app.getMessage(Messages.Team), app.getMessage(Messages.Unit) }; // Create combo box for group types groupTypes = new ComboBox("type"); groupTypes.setFilteringMode(Filtering.FILTERINGMODE_STARTSWITH); for (int i = 0; i < types.length; i++) { groupTypes.addItem(types[i]); } // Propagate changes directly groupTypes.setImmediate(true); // Allow adding new group types groupTypes.setNewItemsAllowed(true); // Get available users members = new TwinColSelect(app.getMessage(Messages.Members), app.getAdminService().getUsers()); // Set column headers members.setLeftColumnCaption(app.getMessage(Messages.AvailableUsers)); members.setRightColumnCaption(app.getMessage(Messages.GroupMembers)); // Propagate changes directly members.setImmediate(true); // Set max width members.setWidth("100%"); // Field factory for over riding how fields are created setFormFieldFactory(new DefaultFieldFactory() { private static final long serialVersionUID = 1L; @Override public Field createField(Item item, Object propertyId, Component uiContext) { if (propertyId.equals("type")) { groupTypes.setWidth("100%"); groupTypes.setRequired(false); groupTypes.setCaption(app.getMessage(Messages.Types)); return groupTypes; } Field field = super.createField(item, propertyId, uiContext); if (propertyId.equals("id")) { TextField tf = (TextField) field; // Do not display "null" to the user when the field is empty tf.setNullRepresentation(""); // Set as required field tf.setRequired(true); // Set error message tf.setRequiredError("Id is missing"); // Set read only tf.setReadOnly(false); } else if (propertyId.equals("name")) { TextField tf = (TextField) field; // Do not display "null" to the user when the field is empty tf.setNullRepresentation(""); // Set as required field tf.setRequired(true); // Set error message tf.setRequiredError(app.getMessage(Messages.GroupNameIsMissing)); } field.setWidth("100%"); return field; } }); }
From source file:org.accelerators.activiti.admin.ui.GroupEditForm.java
License:Open Source License
/** * //from w ww . j ava 2s. co m * @param app */ public GroupEditForm(AdminApp application) { // Set application reference this.app = application; // Enable buffering so that commit() must be called for the form. setWriteThrough(false); // Set the form to act immediately on user input. setImmediate(true); // Set form size setSizeFull(); // Setup footer layout HorizontalLayout footer = new HorizontalLayout(); footer.setSpacing(true); footer.setWidth("100%"); footer.setVisible(true); // Add footer setFooter(footer); // Init buttons save = new Button(app.getMessage(Messages.Save), (ClickListener) this); close = new Button(app.getMessage(Messages.Close), (ClickListener) this); reset = new Button(app.getMessage(Messages.Reset), this, "discard"); // Set button grid GridLayout grid = new GridLayout(3, 1); grid.addComponent(save, 0, 0); grid.addComponent(reset, 1, 0); grid.addComponent(close, 2, 0); grid.setSpacing(true); // Add grid to footer footer.addComponent(grid); // Right align buttons in footer footer.setComponentAlignment(grid, Alignment.BOTTOM_RIGHT); // Init group types types = new String[] { app.getMessage(Messages.Assignment), app.getMessage(Messages.Program), app.getMessage(Messages.Project), app.getMessage(Messages.Role), app.getMessage(Messages.Team), app.getMessage(Messages.Unit) }; // Create combo box for group types groupTypes = new ComboBox("type"); groupTypes.setFilteringMode(Filtering.FILTERINGMODE_STARTSWITH); for (int i = 0; i < types.length; i++) { groupTypes.addItem(types[i]); } // Propagate changes directly groupTypes.setImmediate(true); // Allow adding new group types groupTypes.setNewItemsAllowed(true); // Get available users members = new TwinColSelect(app.getMessage(Messages.Members), app.getAdminService().getUsers()); // Set column headers members.setLeftColumnCaption(app.getMessage(Messages.AvailableUsers)); members.setRightColumnCaption(app.getMessage(Messages.GroupMembers)); // Propagate changes directly members.setImmediate(true); // Set max width members.setWidth("100%"); // Field factory for over riding how fields are created setFormFieldFactory(new DefaultFieldFactory() { private static final long serialVersionUID = 1L; @Override public Field createField(Item item, Object propertyId, Component uiContext) { if (propertyId.equals("type")) { groupTypes.setWidth("100%"); groupTypes.setRequired(false); groupTypes.setCaption(app.getMessage(Messages.Types)); return groupTypes; } Field field = super.createField(item, propertyId, uiContext); if (propertyId.equals("id")) { TextField tf = (TextField) field; // Do not display "null" to the user when the field is empty tf.setNullRepresentation(""); // Set as read-only. Changing the id will create a new // group. tf.setReadOnly(true); // Set as required field // tf.setRequired(true); // Set error message tf.setRequiredError("Id is missing"); } else if (propertyId.equals("name")) { TextField tf = (TextField) field; // Do not display "null" to the user when the field is empty tf.setNullRepresentation(""); // Set as required field tf.setRequired(true); // Set error message tf.setRequiredError(app.getMessage(Messages.GroupNameIsMissing)); } field.setWidth("100%"); return field; } }); }