List of usage examples for com.vaadin.ui VerticalLayout setSpacing
@Override public void setSpacing(boolean spacing)
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 . j av a 2 s. c o m 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.system.internal.bundle.BundleTab.java
License:Open Source License
private void init() { setMargin(true);/*from w w w.j a v a2 s . co m*/ setSpacing(true); // ---------------------------------------------------- // Title // ---------------------------------------------------- HorizontalLayout header = new HorizontalLayout(); header.setSpacing(true); header.setMargin(true); Label title = new Label(format("Bundle %d: %s (%s)", bundle.getBundleId(), getHeader(bundle, Constants.BUNDLE_NAME), bundle.getVersion())); title.addStyleName("h1"); header.addComponent(title); header.setComponentAlignment(title, Alignment.MIDDLE_LEFT); addComponent(header); // ---------------------------------------------------- // Action(s) Bar // ---------------------------------------------------- HorizontalLayout actions = new HorizontalLayout(); if (BundleHelper.isState(bundle, Bundle.INSTALLED) || BundleHelper.isState(bundle, Bundle.RESOLVED)) { Button changeState = new Button(); changeState.addClickListener(new StartBundleClickListener(bundle, notifierService)); //changeState.addStyleName("no-padding"); changeState.setCaption("Start"); changeState.setIcon(new ClassResource(getClass(), "/images/32x32/go-next.png")); actions.addComponent(changeState); } if (BundleHelper.isState(bundle, Bundle.ACTIVE)) { Button changeState = new Button(); changeState.addClickListener(new StopBundleClickListener(bundle, notifierService)); //changeState.addStyleName("no-padding"); changeState.setCaption("Stop"); changeState.setIcon(new ClassResource(getClass(), "/images/32x32/media-record.png")); actions.addComponent(changeState); } // Update Button update = new Button(); update.addClickListener(new UpdateBundleClickListener(bundle, notifierService)); //update.addStyleName("no-padding"); update.setCaption("Update"); update.setIcon(new ClassResource(getClass(), "/images/32x32/view-refresh.png")); actions.addComponent(update); // Trash Button trash = new Button(); trash.addClickListener(new UninstallBundleClickListener(bundle, notifierService)); //trash.addStyleName("no-padding"); trash.setCaption("Remove"); trash.setIcon(new ClassResource(getClass(), "/images/32x32/user-trash-full.png")); actions.addComponent(trash); addComponent(actions); setComponentAlignment(actions, Alignment.MIDDLE_RIGHT); // ---------------------------------------------------- // Standard Section // ---------------------------------------------------- Table table = new Table(); table.setColumnHeaderMode(Table.ColumnHeaderMode.HIDDEN); table.setWidth("100%"); Section mainSection = new Section("Standard", table); addComponent(mainSection); table.addContainerProperty("label", Label.class, null); table.addContainerProperty("value", Label.class, null); table.addItem(new Object[] { label("Bundle ID"), label(String.valueOf(bundle.getBundleId())) }, "bundle.id"); for (Map.Entry<String, String> entry : HEADERS.entrySet()) { String value = getHeader(bundle, entry.getKey()); if (value != null) { table.addItem(new Object[] { label(entry.getValue()), label(value) }, entry.getKey()); } } table.addItem(new Object[] { label("Location"), label(bundle.getLocation()) }, "bundle.location"); Date date = new Date(bundle.getLastModified()); table.addItem(new Object[] { label("Last Modified"), label(date.toString()) }, "last.modified"); // ---------------------------------------------------- // Packages Section // ---------------------------------------------------- FilteredPackageTable exported = new FilteredPackageTable("Exported"); FilteredPackageTable imported = new FilteredPackageTable("Imported"); GridLayout packages = new GridLayout(2, 1); packages.addComponent(exported); packages.addComponent(imported); packages.setSpacing(true); packages.setWidth("100%"); Section packagesSection = new Section("Packages", packages); addComponent(packagesSection); BundleWiring wiring = bundle.adapt(BundleWiring.class); if (wiring != null) { for (BundleCapability capability : wiring.getCapabilities(PackageNamespace.PACKAGE_NAMESPACE)) { String name = (String) capability.getAttributes().get(PackageNamespace.PACKAGE_NAMESPACE); Version version = (Version) capability.getAttributes() .get(PackageNamespace.CAPABILITY_VERSION_ATTRIBUTE); exported.addPackage(format("%s (%s)", name, version)); } for (BundleRequirement requirement : wiring.getRequirements(PackageNamespace.PACKAGE_NAMESPACE)) { String filter = requirement.getDirectives().get(PackageNamespace.REQUIREMENT_FILTER_DIRECTIVE); imported.addPackage(filter); } } // ---------------------------------------------------- // Services Section // ---------------------------------------------------- FilteredServiceTable registered = new FilteredServiceTable("Registered"); FilteredServiceTable used = new FilteredServiceTable("Used Services"); VerticalLayout services = new VerticalLayout(registered, used); services.setSpacing(true); services.setWidth("100%"); ServiceReference<?>[] registeredServices = bundle.getRegisteredServices(); if (registeredServices != null) { for (ServiceReference<?> reference : registeredServices) { registered.addService(reference); } } ServiceReference<?>[] inUseServices = bundle.getServicesInUse(); if (inUseServices != null) { for (ServiceReference<?> reference : inUseServices) { used.addService(reference); } } if (!registered.isEmpty() || !used.isEmpty()) { Section servicesSection = new Section("Services", services); addComponent(servicesSection); } // ---------------------------------------------------- // Raw Manifest Section // ---------------------------------------------------- Page.Styles styles = Page.getCurrent().getStyles(); styles.add(".monospaced-font {font-family: monospace !important; }"); Table manifest = new Table(); manifest.setColumnHeaderMode(Table.ColumnHeaderMode.HIDDEN); manifest.setWidth("100%"); manifest.addStyleName("monospaced-font"); manifest.setPageLength(15); manifest.addContainerProperty("name", String.class, null); manifest.addContainerProperty("value", String.class, null); Dictionary<String, String> headers = bundle.getHeaders(); for (String key : Collections.list(headers.keys())) { manifest.addItem(new Object[] { key, headers.get(key) }, null); } Section manifestSection = new Section("Manifest", manifest); addComponent(manifestSection); }
From source file:com.peergreen.webconsole.vaadin.DefaultWindow.java
License:Open Source License
/** * Create a default window//from ww w. j av a2s .co m * @param caption window caption * @param content window content. Vaadin component * @param footerButtons list of buttons in footer */ public DefaultWindow(String caption, Component content, Button... footerButtons) { setCaption(caption); setClosable(false); setResizable(false); addStyleName("edit-dashboard"); VerticalLayout main = new VerticalLayout(); main.setSpacing(true); main.setMargin(true); main.setStyleName("default-window"); content.addStyleName("default-window-content"); main.addComponent(content); HorizontalLayout footer = new HorizontalLayout(); footer.setStyleName("footer"); footer.setWidth("100%"); HorizontalLayout buttons = new HorizontalLayout(); buttons.setSpacing(true); buttons.setMargin(true); for (Button button : footerButtons) { buttons.addComponent(button); } footer.addComponent(buttons); footer.setComponentAlignment(buttons, Alignment.MIDDLE_RIGHT); main.addComponent(footer); setContent(main); }
From source file:com.pms.component.ganttchart.DemoUI.java
License:Apache License
private void openStepEditor(AbstractStep step) { final Window win = new Window("Step Editor"); win.setResizable(false);/*from w w w.j a va 2s.c o m*/ win.center(); final Collection<Component> hidden = new ArrayList<Component>(); BeanItem<AbstractStep> item = new BeanItem<AbstractStep>(step); final FieldGroup group = new FieldGroup(item); group.setBuffered(true); TextField captionField = new TextField("Caption"); captionField.setNullRepresentation(""); group.bind(captionField, "caption"); TextField descriptionField = new TextField("Description"); descriptionField.setNullRepresentation(""); group.bind(descriptionField, "description"); descriptionField.setVisible(false); hidden.add(descriptionField); NativeSelect captionMode = new NativeSelect("Caption Mode"); captionMode.addItem(Step.CaptionMode.TEXT); captionMode.addItem(Step.CaptionMode.HTML); group.bind(captionMode, "captionMode"); captionMode.setVisible(false); hidden.add(captionMode); final NativeSelect parentStepSelect = new NativeSelect("Parent Step"); parentStepSelect.setEnabled(false); if (!gantt.getSteps().contains(step)) { // new step parentStepSelect.setEnabled(true); for (Step parentStepCanditate : gantt.getSteps()) { parentStepSelect.addItem(parentStepCanditate); parentStepSelect.setItemCaption(parentStepCanditate, parentStepCanditate.getCaption()); if (step instanceof SubStep) { if (parentStepCanditate.getSubSteps().contains(step)) { parentStepSelect.setValue(parentStepCanditate); parentStepSelect.setEnabled(false); break; } } } } parentStepSelect.setVisible(false); hidden.add(parentStepSelect); TextField bgField = new TextField("Background color"); bgField.setNullRepresentation(""); group.bind(bgField, "backgroundColor"); bgField.setVisible(false); hidden.add(bgField); DateField startDate = new DateField("Start date"); startDate.setLocale(gantt.getLocale()); startDate.setTimeZone(gantt.getTimeZone()); startDate.setResolution(Resolution.SECOND); startDate.setConverter(new DateToLongConverter()); group.bind(startDate, "startDate"); DateField endDate = new DateField("End date"); endDate.setLocale(gantt.getLocale()); endDate.setTimeZone(gantt.getTimeZone()); endDate.setResolution(Resolution.SECOND); endDate.setConverter(new DateToLongConverter()); group.bind(endDate, "endDate"); CheckBox showMore = new CheckBox("Show all settings"); showMore.addValueChangeListener(new ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { for (Component c : hidden) { c.setVisible((Boolean) event.getProperty().getValue()); } win.center(); } }); VerticalLayout content = new VerticalLayout(); content.setMargin(true); content.setSpacing(true); win.setContent(content); content.addComponent(captionField); content.addComponent(captionMode); content.addComponent(descriptionField); content.addComponent(parentStepSelect); content.addComponent(bgField); content.addComponent(startDate); content.addComponent(endDate); content.addComponent(showMore); HorizontalLayout buttons = new HorizontalLayout(); content.addComponent(buttons); Button ok = new Button("Ok", new ClickListener() { @Override public void buttonClick(ClickEvent event) { try { group.commit(); AbstractStep step = ((BeanItem<AbstractStep>) group.getItemDataSource()).getBean(); gantt.markStepDirty(step); if (parentStepSelect.isEnabled() && parentStepSelect.getValue() != null) { SubStep subStep = addSubStep(parentStepSelect, step); step = subStep; } if (step instanceof Step && !gantt.getSteps().contains(step)) { gantt.addStep((Step) step); } if (ganttListener != null && step instanceof Step) { ganttListener.stepModified((Step) step); } win.close(); } catch (CommitException e) { Notification.show("Commit failed", e.getMessage(), Type.ERROR_MESSAGE); e.printStackTrace(); } } private SubStep addSubStep(final NativeSelect parentStepSelect, AbstractStep dataSource) { SubStep subStep = new SubStep(); subStep.setCaption(dataSource.getCaption()); subStep.setCaptionMode(dataSource.getCaptionMode()); subStep.setStartDate(dataSource.getStartDate()); subStep.setEndDate(dataSource.getEndDate()); subStep.setBackgroundColor(dataSource.getBackgroundColor()); subStep.setDescription(dataSource.getDescription()); subStep.setStyleName(dataSource.getStyleName()); ((Step) parentStepSelect.getValue()).addSubStep(subStep); return subStep; } }); Button cancel = new Button("Cancel", new ClickListener() { @Override public void buttonClick(ClickEvent event) { group.discard(); win.close(); } }); Button delete = new Button("Delete", new ClickListener() { @Override public void buttonClick(ClickEvent event) { AbstractStep step = ((BeanItem<AbstractStep>) group.getItemDataSource()).getBean(); if (step instanceof SubStep) { SubStep substep = (SubStep) step; substep.getOwner().removeSubStep(substep); } else { gantt.removeStep((Step) step); if (ganttListener != null) { ganttListener.stepDeleted((Step) step); } } win.close(); } }); buttons.addComponent(ok); buttons.addComponent(cancel); buttons.addComponent(delete); win.setClosable(true); DashboardUI.getCurrent().getUI().addWindow(win); }
From source file:com.pms.component.ganttchart.scheduletask.TaskGanntChart.java
License:Apache License
private void openStepEditor(AbstractStep step) { final Window win = new Window("More Info"); win.setResizable(false);// w w w. j av a 2 s . com win.center(); VerticalLayout content = new VerticalLayout(); content.setMargin(true); content.setSpacing(true); win.setContent(content); String taskName = step.getCaption(); UserStoryDAO userStoryDAO = (UserStoryDAO) DashboardUI.context.getBean("UserStory"); UserStory userStory = userStoryDAO.getCurrentWorkingUserStory(project); TaskDAO taskDAO = (TaskDAO) DashboardUI.context.getBean("Task"); Task task1 = taskDAO.getTaskFromUserStroyNameAndTaskName(userStory.getName(), taskName); TextField userStoryNameField = new TextField("Task Name"); userStoryNameField.setValue(task1.getName()); TextField userStoryPriority = new TextField("Priority"); userStoryPriority.setValue(String.valueOf(task1.getPriority())); TextField userStoryState = new TextField("State"); userStoryState.setValue(task1.getState()); TextField projectName = new TextField("Project Name"); projectName.setValue(project.getName()); TextField userStoryName = new TextField("UserStoryName Name"); userStoryName.setValue(userStory.getName()); content.addComponent(userStoryNameField); content.addComponent(userStoryPriority); content.addComponent(userStoryState); content.addComponent(projectName); content.addComponent(userStoryName); Button ok = new Button("Ok", new ClickListener() { @Override public void buttonClick(ClickEvent event) { win.close(); } }); content.addComponent(ok); win.setClosable(true); DashboardUI.getCurrent().getUI().addWindow(win); }
From source file:com.pms.component.ganttchart.scheduletask.UserStoryGanntChart.java
License:Apache License
private void openStepEditor(AbstractStep step) { final Window win = new Window("More Info"); win.setResizable(false);/*from w w w. j a va 2 s .c o m*/ win.center(); VerticalLayout content = new VerticalLayout(); content.setMargin(true); content.setSpacing(true); win.setContent(content); String userStoryName = step.getCaption(); UserStoryDAO userStoryDAO = (UserStoryDAO) DashboardUI.context.getBean("UserStory"); UserStory userStory = userStoryDAO.getUserStoryFormProjectNameAndUserStoryName(project.getName(), userStoryName); TextField userStoryNameField = new TextField("User Story Name"); userStoryNameField.setValue(userStory.getName()); TextField userStoryPriority = new TextField("Priority"); userStoryPriority.setValue(String.valueOf(userStory.getPriority())); TextField userStoryState = new TextField("State"); userStoryState.setValue(userStory.getState()); TextField projectName = new TextField("Project Name"); projectName.setValue(project.getName()); content.addComponent(userStoryNameField); content.addComponent(userStoryPriority); content.addComponent(userStoryState); content.addComponent(projectName); Button ok = new Button("Ok", new ClickListener() { @Override public void buttonClick(ClickEvent event) { win.close(); } }); content.addComponent(ok); win.setClosable(true); DashboardUI.getCurrent().getUI().addWindow(win); }
From source file:com.purebred.core.MainApplication.java
License:Open Source License
/** * Open separate error Window, useful for showing stacktraces. * * @param message//from w w w . j a v a2 s .com */ public void openErrorWindow(String message) { Window errorWindow = new Window("Error"); errorWindow.addStyleName("opaque"); VerticalLayout layout = (VerticalLayout) errorWindow.getContent(); layout.setSpacing(true); layout.setWidth("100%"); errorWindow.setWidth("100%"); errorWindow.setModal(true); Label label = new Label(message); label.setContentMode(Label.CONTENT_PREFORMATTED); layout.addComponent(label); errorWindow.setClosable(true); errorWindow.setScrollable(true); MainApplication.getInstance().getMainWindow().addWindow(errorWindow); }
From source file:com.purebred.core.view.EntityComponent.java
License:Open Source License
/** * Called after Spring constructs this bean. Overriding methods should call super. *//* ww w . j ava 2s. c o m*/ @PostConstruct public void postConstruct() { VerticalLayout layout = new VerticalLayout(); layout.setMargin(true); layout.setSpacing(true); setCompositionRoot(layout); setCustomSizeUndefined(); }
From source file:com.purebred.core.view.EntityFormWindow.java
License:Open Source License
private void initialize() { addStyleName("p-entity-form-window"); addStyleName("opaque"); VerticalLayout layout = (VerticalLayout) getContent(); layout.setMargin(true);/*w ww .j a va 2 s .co m*/ layout.setSpacing(true); layout.setSizeUndefined(); setSizeUndefined(); setModal(true); setClosable(true); setScrollable(true); addListener(CloseEvent.class, this, "onClose"); MainApplication.getInstance().getMainWindow().addWindow(this); }
From source file:com.purebred.core.view.entityselect.EntitySelect.java
License:Open Source License
public void open() { popupWindow = new Window(getEntityCaption()); popupWindow.addStyleName("p-entity-select-window"); popupWindow.addStyleName("opaque"); VerticalLayout layout = (VerticalLayout) popupWindow.getContent(); layout.setMargin(true);// ww w. j a va 2 s.c o m layout.setSpacing(true); layout.setSizeUndefined(); popupWindow.setSizeUndefined(); popupWindow.setModal(true); popupWindow.setClosable(true); getResults().getEntityQuery().clear(); getResults().selectPageSize(5); getResults().search(); configurePopupWindow(popupWindow); popupWindow.addComponent(this); MainApplication.getInstance().getMainWindow().addWindow(popupWindow); }