List of usage examples for com.vaadin.ui VerticalLayout setComponentAlignment
@Override public void setComponentAlignment(Component childComponent, Alignment alignment)
From source file:com.oodrive.nuage.webui.VvrManagerUi.java
License:Apache License
/** * Add a progress bar for long task./* w ww .j a v a 2s . c om*/ * * @return the layout */ public VerticalLayout addProgressBar() { final VerticalLayout layout = new VerticalLayout(); layout.setSizeFull(); final ProgressBar bar = new ProgressBar(); layout.addComponent(new Label("This operation can take some time. Please wait...")); bar.setIndeterminate(true); bar.setImmediate(true); layout.addComponent(bar); layout.setComponentAlignment(bar, Alignment.MIDDLE_CENTER); rootLayout.addComponent(layout, "top: 50%; left: 39%"); vvrManagerLayout.setEnabled(false); return layout; }
From source file:com.openhris.calendar.CalendarScheduleWindow.java
VerticalLayout scheduleLayout() { VerticalLayout layout = new VerticalLayout(); layout.setMargin(true);/*from ww w. j a v a 2s. c om*/ layout.setSpacing(true); eventType = createEventTypelect(); layout.addComponent(eventType); startDate = createDateField("Start Date: "); layout.addComponent(startDate); endDate = createDateField("End Date: "); layout.addComponent(endDate); caption = createTextField("Caption: "); layout.addComponent(caption); location = createTextField("Where: "); layout.addComponent(location); description = new TextArea("Description: "); description.setWidth("100%"); description.setRows(3); layout.addComponent(description); color = createStyleNameSelect(); layout.addComponent(color); saveEventButton = new Button("SAVE", saveEventBtnListener); saveEventButton.setWidth("100%"); deleteEventButton = new Button("DELETE", deleteEventBtnListener); deleteEventButton.setWidth("100%"); HorizontalLayout buttons = new HorizontalLayout(); buttons.setSpacing(true); buttons.setWidth("100%"); buttons.addComponent(deleteEventButton); buttons.addComponent(saveEventButton); // buttons.addComponent(editEventButton); layout.addComponent(buttons); layout.setComponentAlignment(buttons, Alignment.BOTTOM_RIGHT); return layout; }
From source file:com.openhris.calendar.CalendarScheduleWindow.java
VerticalLayout populateSchedule(CalendarComponentEvents.EventClick event) { VerticalLayout layout = new VerticalLayout(); layout.setMargin(true);/*from w w w . j a v a2s . c o m*/ layout.setSpacing(true); eventType = createEventTypelect(); eventType.setValue(basicEvent.getEventType()); layout.addComponent(eventType); startDate = createDateField("Start Date: "); startDate.setValue(event.getCalendarEvent().getStart()); layout.addComponent(startDate); endDate = createDateField("End Date: "); endDate.setValue(event.getCalendarEvent().getEnd()); layout.addComponent(endDate); caption = createTextField("Caption: "); caption.setValue(event.getCalendarEvent().getCaption()); layout.addComponent(caption); location = createTextField("Where: "); location.setValue(getBasicEvent().getLocation()); layout.addComponent(location); description = new TextArea("Description: "); description.setWidth("100%"); description.setRows(3); description.setValue(event.getCalendarEvent().getDescription()); layout.addComponent(description); color = createStyleNameSelect(); color.setValue(basicEvent.getStyleName()); layout.addComponent(color); eventDataId = createTextField("id: "); eventDataId.setValue(getBasicEvent().getEventId()); eventDataId.setVisible(false); layout.addComponent(eventDataId); editEventButton = new Button("EDIT", editEventBtnListener); editEventButton.setWidth("100%"); deleteEventButton = new Button("DELETE", deleteEventBtnListener); deleteEventButton.setWidth("100%"); HorizontalLayout buttons = new HorizontalLayout(); buttons.setSpacing(true); buttons.setWidth("100%"); buttons.addComponent(deleteEventButton); buttons.addComponent(editEventButton); layout.addComponent(buttons); layout.setComponentAlignment(buttons, Alignment.BOTTOM_RIGHT); return layout; }
From source file:com.openhris.employee.EmployeeInformationUI.java
public ComponentContainer employeeInformationWindow() { TabSheet ts = new TabSheet(); ts.setSizeFull();//w w w . j av a 2s. c o m ts.addStyleName("bar"); VerticalLayout vlayout = new VerticalLayout(); vlayout.setCaption("Personal Information"); vlayout.addComponent(employeePersonalInformation); vlayout.setComponentAlignment(employeePersonalInformation, Alignment.MIDDLE_LEFT); ts.addComponent(vlayout); vlayout = new VerticalLayout(); vlayout.setCaption("Address"); vlayout.addComponent(employeeAddress); ts.addComponent(vlayout); vlayout = new VerticalLayout(); vlayout.setCaption("Character Reference"); vlayout.addComponent(characterReference); ts.addComponent(vlayout); vlayout = new VerticalLayout(); vlayout.setCaption("Dependent(s)"); // vlayout.addComponent(employeePersonalInformation); ts.addComponent(vlayout); vlayout = new VerticalLayout(); vlayout.setCaption("Educational Background"); // vlayout.addComponent(employeePersonalInformation); ts.addComponent(vlayout); vlayout = new VerticalLayout(); vlayout.setCaption("Post Employment Info"); vlayout.addComponent(postEmploymentInfomation); ts.addComponent(vlayout); vlayout = new VerticalLayout(); vlayout.setCaption("Work History"); // vlayout.addComponent(employeePersonalInformation); ts.addComponent(vlayout); vlayout = new VerticalLayout(); vlayout.setCaption("Salary Information"); vlayout.addComponent(employeeSalaryInformation); ts.addComponent(vlayout); vlayout = new VerticalLayout(); vlayout.setCaption("Allowance Information"); vlayout.addComponent(employeeAllowanceInformation); ts.addComponent(vlayout); vlayout = new VerticalLayout(); vlayout.setCaption("Other Information"); vlayout.addComponent(otherInformation); ts.addComponent(vlayout); return ts; }
From source file:com.peergreen.webconsole.core.vaadin7.BaseUI.java
License:Open Source License
/** * Build login view//from w ww . j a v a2s . c om * * @param exit */ private void buildLoginView(final boolean exit) { if (exit) { root.removeAllComponents(); } notifierService.closeAll(); addStyleName("login"); VerticalLayout loginLayout = new VerticalLayout(); loginLayout.setId("webconsole_loginlayout_id"); loginLayout.setSizeFull(); loginLayout.addStyleName("login-layout"); root.addComponent(loginLayout); final CssLayout loginPanel = new CssLayout(); loginPanel.addStyleName("login-panel"); HorizontalLayout labels = new HorizontalLayout(); labels.setWidth(MAX_WIDTH); labels.setMargin(true); loginPanel.addComponent(labels); Label welcome = new Label("Welcome"); welcome.addStyleName("h4"); labels.addComponent(welcome); labels.setComponentAlignment(welcome, Alignment.MIDDLE_LEFT); Label title = new Label(consoleName); //title.setSizeUndefined(); title.addStyleName("h2"); title.addStyleName("light"); labels.addComponent(title); labels.setComponentAlignment(title, Alignment.MIDDLE_RIGHT); HorizontalLayout fields = new HorizontalLayout(); fields.setSpacing(true); fields.setMargin(true); fields.addStyleName("fields"); final TextField username = new TextField("Username"); username.focus(); username.setId("webconsole_login_username"); fields.addComponent(username); final PasswordField password = new PasswordField("Password"); password.setId("webconsole_login_password"); fields.addComponent(password); final Button signin = new Button("Sign In"); signin.setId("webconsole_login_signin"); signin.addStyleName("default"); fields.addComponent(signin); fields.setComponentAlignment(signin, Alignment.BOTTOM_LEFT); final ShortcutListener enter = new ShortcutListener("Sign In", ShortcutAction.KeyCode.ENTER, null) { @Override public void handleAction(Object sender, Object target) { signin.click(); } }; signin.addShortcutListener(enter); loginPanel.addComponent(fields); HorizontalLayout bottomRow = new HorizontalLayout(); bottomRow.setWidth(MAX_WIDTH); bottomRow.setMargin(new MarginInfo(false, true, false, true)); final CheckBox keepLoggedIn = new CheckBox("Keep me logged in"); bottomRow.addComponent(keepLoggedIn); bottomRow.setComponentAlignment(keepLoggedIn, Alignment.MIDDLE_LEFT); // Add new error message final Label error = new Label("Wrong username or password.", ContentMode.HTML); error.setId("webconsole_login_error"); error.addStyleName("error"); error.setSizeUndefined(); error.addStyleName("light"); // Add animation error.addStyleName("v-animate-reveal"); error.setVisible(false); bottomRow.addComponent(error); bottomRow.setComponentAlignment(error, Alignment.MIDDLE_RIGHT); loginPanel.addComponent(bottomRow); signin.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { if (authenticate(username.getValue(), password.getValue())) { // if (keepLoggedIn.getValue()) { // //Cookie userCookie = getCookieByName(PEERGREEN_USER_COOKIE_NAME); // if (getCookieByName(PEERGREEN_USER_COOKIE_NAME) == null) { // // Get a token for this user and create a cooki // Page.getCurrent().getJavaScript().execute( String.format("document.cookie = '%s=%s; path=%s'", // PEERGREEN_USER_COOKIE_NAME, token, VaadinService.getCurrentRequest().getContextPath())); // } else { // // update token // userCookie.setValue(token); // userCookie.setPath(VaadinService.getCurrentRequest().getContextPath()); // } // } buildMainView(); } else { error.setVisible(true); } } }); loginLayout.addComponent(loginPanel); loginLayout.setComponentAlignment(loginPanel, Alignment.MIDDLE_CENTER); }
From source file:com.peergreen.webconsole.scope.deployment.internal.deploymentplan.DeploymentPlanPanel.java
License:Open Source License
@PostConstruct public void init() { setSizeFull();/*from w w w . ja va2s .c om*/ TreeTable table = new TreeTable(); VerticalLayout mainContent = new VerticalLayout(); mainContent.setSpacing(true); mainContent.setMargin(true); mainContent.setStyleName("deployable-style"); mainContent.setSizeFull(); setContent(mainContent); HorizontalLayout toolBar = new HorizontalLayout(); toolBar.setMargin(true); toolBar.setSpacing(true); toolBar.setWidth("100%"); // Deployment Plan name Label deploymentPlanNameLabel = new Label("Plan"); toolBar.addComponent(deploymentPlanNameLabel); toolBar.setExpandRatio(deploymentPlanNameLabel, 1); deploymentPlanName = new TextField(); deploymentPlanName.setInputPrompt(getDefaultName()); deploymentPlanName.setWidth("100%"); toolBar.addComponent(deploymentPlanName); toolBar.setComponentAlignment(deploymentPlanName, Alignment.TOP_LEFT); toolBar.setExpandRatio(deploymentPlanName, 3); error = new Label("", ContentMode.HTML); error.addStyleName("error"); error.setSizeUndefined(); error.addStyleName("light"); error.addStyleName("v-animate-reveal"); error.setVisible(false); toolBar.addComponent(error); toolBar.setComponentAlignment(error, Alignment.TOP_RIGHT); toolBar.setExpandRatio(error, 1); mainContent.addComponent(toolBar); mainContent.setComponentAlignment(toolBar, Alignment.TOP_LEFT); mainContent.setExpandRatio(toolBar, 1); VerticalLayout deploymentPlanContainer = new VerticalLayout(); DragAndDropWrapper deploymentPlanContainerWrapper = new DragAndDropWrapper(deploymentPlanContainer); DropHandler deploymentPlanDropHandler = new DeploymentDropHandler(deploymentViewManager, this, notifierService); deploymentPlanContainerWrapper.setDropHandler(deploymentPlanDropHandler); deploymentPlanContainerWrapper.setSizeFull(); mainContent.addComponent(deploymentPlanContainerWrapper); mainContent.setExpandRatio(deploymentPlanContainerWrapper, 10); container.addContainerProperty(TREE_ITEM_ID, String.class, null); table.setSizeFull(); table.setImmediate(true); table.setMultiSelect(true); table.setSelectable(true); table.setContainerDataSource(container); table.setDragMode(Table.TableDragMode.MULTIROW); table.setItemCaptionPropertyId(TREE_ITEM_ID); table.setCellStyleGenerator(new ItemStyle(DeployableContainerType.DEPLOYED)); table.setColumnHeaderMode(Table.ColumnHeaderMode.HIDDEN); table.setDropHandler(new OrderedContainerDropHandler(table, deploymentPlanDropHandler)); table.addShortcutListener(new ShortcutListener("Delete", ShortcutAction.KeyCode.DELETE, null) { @Override public void handleAction(Object sender, Object target) { Table table = (Table) target; Collection<DeployableEntry> deployableEntries = (Collection<DeployableEntry>) table.getValue(); for (DeployableEntry deployableEntry : deployableEntries) { removeDeployable(deployableEntry); } } }); deploymentPlanContainer.addComponent(table); HorizontalLayout footer = new HorizontalLayout(); footer.setSizeFull(); footer.setSpacing(true); footer.setMargin(true); footer.addStyleName("footer"); footer.setWidth("100%"); deployIt = new CheckBox("Deploy this deployment plan"); footer.addComponent(deployIt); footer.setComponentAlignment(deployIt, Alignment.TOP_LEFT); HorizontalLayout buttons = new HorizontalLayout(); buttons.setSpacing(true); buttons.setMargin(true); Button cancel = new Button("Cancel"); cancel.addClickListener(new CancelButtonListener()); Button create = new Button("Create"); create.addClickListener(new CreateButtonListener()); create.addStyleName("wide"); create.addStyleName("default"); buttons.addComponent(cancel); buttons.addComponent(create); footer.addComponent(buttons); footer.setComponentAlignment(buttons, Alignment.TOP_RIGHT); mainContent.addComponent(footer); mainContent.setComponentAlignment(footer, Alignment.BOTTOM_RIGHT); mainContent.setExpandRatio(footer, 1); }
From source file:com.peergreen.webconsole.scope.deployment.internal.DeploymentScope.java
License:Open Source License
@PostConstruct public void init() { deploymentViewManager = createDeploymentViewManager(); OptionGroup option = new OptionGroup(); HorizontalLayout toolBar = new HorizontalLayout(); toolBar.setWidth("100%"); toolBar.setSpacing(true);/* w w w .ja v a2 s. co m*/ toolBar.setMargin(true); VerticalLayout uploadLayout = new VerticalLayout(); Upload uploader = new Upload("Upload a file here", null); uploader.setButtonCaption("Upload"); final FileUploader fileUploader = new FileUploader(deploymentViewManager, notifierService, artifactBuilder, option); uploader.setReceiver(fileUploader); uploader.addSucceededListener(fileUploader); uploader.addStartedListener(fileUploader); uploadLayout.addComponent(uploader); HorizontalLayout target = new HorizontalLayout(); option.addContainerProperty("id", String.class, null); option.setItemCaptionPropertyId("id"); option.addItem(DeployableContainerType.DEPLOYABLE.attribute()).getItemProperty("id") .setValue("Add to deployables"); option.addItem(DeployableContainerType.DEPLOYED.attribute()).getItemProperty("id").setValue("Deploy"); option.addItem(DeployableContainerType.DEPLOYMENT_PLAN.attribute()).getItemProperty("id") .setValue("Create a deployment plan"); option.addStyleName("horizontal"); option.select(DeployableContainerType.DEPLOYABLE.attribute()); target.addComponent(option); uploadLayout.addComponent(target); toolBar.addComponent(uploadLayout); Label infoLabel = new Label("Drop files here to create a deployment plan"); infoLabel.setSizeUndefined(); final VerticalLayout deploymentPlanMaker = new VerticalLayout(infoLabel); deploymentPlanMaker.setComponentAlignment(infoLabel, Alignment.MIDDLE_CENTER); Button draft = new Button("A draft is under construction"); draft.addStyleName("link"); draft.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { deploymentViewManager.showDeploymentPlanView(); } }); draft.setVisible(false); deploymentViewManager.setDeploymentPlanDraftViewer(draft); deploymentPlanMaker.addComponent(draft); deploymentPlanMaker.setComponentAlignment(draft, Alignment.TOP_CENTER); deploymentPlanMaker.setSizeFull(); deploymentPlanMaker.addStyleName("drop-area"); deploymentPlanMakerWrapper = new DragAndDropWrapper(deploymentPlanMaker); deploymentPlanMakerWrapper.setSizeFull(); toolBar.addComponent(deploymentPlanMakerWrapper); addComponent(toolBar); addComponent(framesContainer); setExpandRatio(framesContainer, 1.5f); helpWindow = notifierService.createHelpOverlay("Deployment module", "<p>To deploy, or undeploy, artifacts, you can drag and drop elements from deployables panel " + "to deployed panel and vice versa.</p>" + "<p>You can also drag files from desktop and drop them where you want to add them."); }
From source file:com.save.area.AreaUI.java
ComponentContainer getHlayoutWithBtn() { VerticalLayout buttonsLayout = new VerticalLayout(); buttonsLayout.setMargin(new MarginInfo(true, false, false, false)); Button addBtn = new AreaButton("ADD LOCATION TO AREA"); buttonsLayout.addComponent(addBtn);/* ww w.j a v a 2 s . com*/ addBtn.addClickListener(actionBtnListener); buttonsLayout.setComponentAlignment(addBtn, Alignment.MIDDLE_LEFT); Button createBtn = new AreaButton("CREATE NEW AREA"); buttonsLayout.addComponent(createBtn); createBtn.addClickListener(actionBtnListener); buttonsLayout.setComponentAlignment(createBtn, Alignment.MIDDLE_LEFT); Button editBtn = new AreaButton("EDIT AREA"); buttonsLayout.addComponent(editBtn); editBtn.addClickListener(actionBtnListener); buttonsLayout.setComponentAlignment(editBtn, Alignment.MIDDLE_LEFT); Button deleteBtn = new AreaButton("DELETE AREA"); buttonsLayout.addComponent(deleteBtn); deleteBtn.addClickListener(actionBtnListener); buttonsLayout.setComponentAlignment(deleteBtn, Alignment.MIDDLE_LEFT); Button addProvinceBtn = new AreaButton("ADD PROVINCE"); buttonsLayout.addComponent(addProvinceBtn); addProvinceBtn.addClickListener(actionBtnListener); buttonsLayout.setComponentAlignment(addProvinceBtn, Alignment.MIDDLE_LEFT); Button addCityBtn = new AreaButton("ADD CITY"); buttonsLayout.addComponent(addCityBtn); addCityBtn.addClickListener(actionBtnListener); buttonsLayout.setComponentAlignment(addCityBtn, Alignment.MIDDLE_LEFT); return buttonsLayout; }
From source file:com.siemens.ct.osgi.vaadin.pm.main.MainApplication.java
License:Open Source License
private Window getAboutDialog() { if (aboutWindow == null) { aboutWindow = new Window("About..."); aboutWindow.setModal(true);// ww w. ja va2 s.com aboutWindow.setWidth("400px"); VerticalLayout layout = (VerticalLayout) aboutWindow.getContent(); layout.setMargin(true); layout.setSpacing(true); layout.setStyleName("blue"); CssLayout titleLayout = new CssLayout(); H2 title = new H2("Dynamic Vaadin OSGi Demo"); titleLayout.addComponent(title); SmallText description = new SmallText("<br>Copyright (c) Siemens AG, Kai Tdter and others.<br>" + "Licensed under Eclipse Public License (EPL).<br><br>" + "This software contains modules licenced under<br>" + " the Apache Software Foundation 2.0 license (ASF) and EPL<br><br>" + "Many thanks to Chris Brind, Neil Bartlett and<br>" + " Petter Holmstrm for their OSGi and Vaadin<br>" + " related work, blogs, and bundles.<br><br>" + "The icons are from the Silk icon set by Mark James<br>" + "<a href=\"http://www.famfamfam.com/lab/icons/silk/\">http://www.famfamfam.com/lab/icons/silk/</a>"); description.setSizeUndefined(); description.setContentMode(Label.CONTENT_XHTML); titleLayout.addComponent(description); aboutWindow.addComponent(titleLayout); @SuppressWarnings("serial") Button close = new Button("Close", new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { (aboutWindow.getParent()).removeWindow(aboutWindow); } }); layout.addComponent(close); layout.setComponentAlignment(close, "right"); } return aboutWindow; }
From source file:com.skysql.manager.ui.CalendarDialog.java
License:Open Source License
/** * Initializes a modal window to edit schedule event. * * @param event the event// ww w. ja v a2 s . c o m * @param newEvent the new event */ private void createCalendarEventPopup(CalendarCustomEvent event, boolean newEvent) { VerticalLayout layout = new VerticalLayout(); layout.setMargin(true); layout.setSpacing(true); scheduleEventPopup = new Window(null, layout); scheduleEventPopup.setWidth("400px"); scheduleEventPopup.setModal(true); scheduleEventPopup.center(); Date occurrence = event.getOccurrence(); if (!newEvent && occurrence != null) { Form form = new Form(); form.setCaption("This is a repeat occurrence"); layout.addComponent(form); DateField dateField = new DateField("Occurrence Start"); if (useSecondResolution) { dateField.setResolution(Resolution.SECOND); } else { dateField.setResolution(Resolution.MINUTE); } dateField.setValue(event.getStart()); dateField.setEnabled(false); form.addField("dateField", dateField); form.setFooter(null); HorizontalLayout editLayout = new HorizontalLayout(); editLayout.setSpacing(true); layout.addComponent(editLayout); final Label label = new Label("Click to change the original event below:"); editLayout.addComponent(label); editLayout.setComponentAlignment(label, Alignment.BOTTOM_LEFT); editOriginalButton = new Button("Edit", new ClickListener() { private static final long serialVersionUID = 1L; public void buttonClick(ClickEvent clickEvent) { scheduleEventForm.setEnabled(true); applyEventButton.setEnabled(true); label.setValue("Editing original event:"); editOriginalButton.setVisible(false); } }); editLayout.addComponent(editOriginalButton); scheduleEventForm.setEnabled(false); } else { scheduleEventForm.setEnabled(true); } layout.addComponent(scheduleEventForm); applyEventButton = new Button("Add", new ClickListener() { private static final long serialVersionUID = 1L; public void buttonClick(ClickEvent event) { commitCalendarEvent(); } }); Button cancel = new Button("Cancel", new ClickListener() { private static final long serialVersionUID = 1L; public void buttonClick(ClickEvent event) { discardCalendarEvent(); } }); deleteEventButton = new Button("Delete", new ClickListener() { private static final long serialVersionUID = 1L; public void buttonClick(ClickEvent event) { deleteCalendarEvent(); } }); scheduleEventPopup.addListener(new CloseListener() { private static final long serialVersionUID = 1L; public void windowClose(CloseEvent e) { discardCalendarEvent(); } }); HorizontalLayout buttons = new HorizontalLayout(); buttons.setSpacing(true); buttons.addComponent(deleteEventButton); buttons.addComponent(cancel); buttons.addComponent(applyEventButton); layout.addComponent(buttons); layout.setComponentAlignment(buttons, Alignment.BOTTOM_RIGHT); }