List of usage examples for com.vaadin.ui Alignment TOP_CENTER
Alignment TOP_CENTER
To view the source code for com.vaadin.ui Alignment TOP_CENTER.
Click Source Link
From source file:org.ikasan.dashboard.ui.topology.window.ComponentConfigurationWindow.java
License:BSD License
protected Panel createListPanel(final ConfigurationParameterListImpl parameter) { Panel paramPanel = new Panel(); paramPanel.setStyleName("dashboard"); paramPanel.setWidth("100%"); GridLayout paramLayout = new GridLayout(2, 3); paramLayout.setSpacing(true);/* w w w.ja v a2s.com*/ paramLayout.setSizeFull(); paramLayout.setMargin(true); paramLayout.setColumnExpandRatio(0, .25f); paramLayout.setColumnExpandRatio(1, .75f); Label label = new Label(parameter.getName()); label.setIcon(VaadinIcons.COG); label.addStyleName(ValoTheme.LABEL_LARGE); label.addStyleName(ValoTheme.LABEL_BOLD); label.setSizeUndefined(); paramLayout.addComponent(label, 0, 0, 1, 0); paramLayout.setComponentAlignment(label, Alignment.TOP_LEFT); final List<String> valueList = parameter.getValue(); final GridLayout listLayout = new GridLayout(3, (valueList.size() != 0 ? valueList.size() : 1) + 1); listLayout.setWidth("450px"); listLayout.setMargin(true); listLayout.setSpacing(true); listLayout.setColumnExpandRatio(0, 0.25f); listLayout.setColumnExpandRatio(1, 0.5f); listLayout.setColumnExpandRatio(2, 0.25f); int i = 0; for (final String value : valueList) { final Label valueLabel = new Label("Value"); final TextField valueField = new TextField(); valueField.setValue(value); valueField.setWidth("90%"); listLayout.addComponent(valueLabel, 0, i); listLayout.addComponent(valueField, 1, i); final String mapKey = parameter.getName() + i; this.valueTextFields.put(mapKey, valueField); final Button removeButton = new Button("remove"); removeButton.setStyleName(ValoTheme.BUTTON_LINK); removeButton.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { valueList.remove(value); listLayout.removeComponent(valueLabel); listLayout.removeComponent(valueField); listLayout.removeComponent(removeButton); valueTextFields.remove(mapKey); } }); listLayout.addComponent(removeButton, 2, i); i++; } final Button addButton = new Button("add"); addButton.setStyleName(ValoTheme.BUTTON_LINK); addButton.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { final Label valueLabel = new Label("Value"); final TextField valueField = new TextField(); valueField.setWidth("90%"); listLayout.insertRow(listLayout.getRows()); listLayout.removeComponent(addButton); listLayout.addComponent(valueLabel, 0, listLayout.getRows() - 2); listLayout.addComponent(valueField, 1, listLayout.getRows() - 2); final String mapKey = parameter.getName() + valueTextFields.size(); valueTextFields.put(mapKey, valueField); final Button removeButton = new Button("remove"); removeButton.setStyleName(ValoTheme.BUTTON_LINK); removeButton.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { listLayout.removeComponent(valueLabel); listLayout.removeComponent(valueField); listLayout.removeComponent(removeButton); valueTextFields.remove(mapKey); } }); listLayout.addComponent(removeButton, 2, listLayout.getRows() - 2); listLayout.addComponent(addButton, 0, listLayout.getRows() - 1); } }); listLayout.addComponent(addButton, 0, listLayout.getRows() - 1); Panel mapPanel = new Panel(); mapPanel.setStyleName("dashboard"); mapPanel.setContent(listLayout); paramLayout.addComponent(mapPanel, 0, 1, 1, 1); paramLayout.setComponentAlignment(mapPanel, Alignment.TOP_CENTER); paramPanel.setContent(paramLayout); Label paramDescriptionLabel = new Label("Description:"); paramDescriptionLabel.setSizeUndefined(); TextArea descriptionTextField = new TextArea(); descriptionTextField.setRows(4); descriptionTextField.setWidth("80%"); descriptionTextField.setId(parameter.getName()); paramLayout.addComponent(paramDescriptionLabel, 0, 2); paramLayout.addComponent(descriptionTextField, 1, 2); paramLayout.setComponentAlignment(paramDescriptionLabel, Alignment.TOP_RIGHT); descriptionTextFields.put(parameter.getName(), descriptionTextField); if (parameter.getDescription() != null) { descriptionTextField.setValue(parameter.getDescription()); } return paramPanel; }
From source file:org.ikasan.dashboard.ui.topology.window.WiretapConfigurationWindow.java
License:BSD License
/** * Helper method to initialise this object. * /*from w w w . j a v a2s. c om*/ * @param message */ protected void init() { setModal(true); setHeight("90%"); setWidth("90%"); GridLayout layout = new GridLayout(2, 10); layout.setSizeFull(); layout.setSpacing(true); layout.setMargin(true); layout.setColumnExpandRatio(0, .25f); layout.setColumnExpandRatio(1, .75f); Label wiretapLabel = new Label("Wiretap Configuration"); wiretapLabel.setStyleName(ValoTheme.LABEL_HUGE); layout.addComponent(wiretapLabel); Label moduleNameLabel = new Label(); moduleNameLabel.setContentMode(ContentMode.HTML); moduleNameLabel.setValue(VaadinIcons.ARCHIVE.getHtml() + " Module Name:"); moduleNameLabel.setSizeUndefined(); layout.addComponent(moduleNameLabel, 0, 1); layout.setComponentAlignment(moduleNameLabel, Alignment.MIDDLE_RIGHT); TextField moduleNameTextField = new TextField(); moduleNameTextField.setRequired(true); moduleNameTextField.setValue(this.component.getFlow().getModule().getName()); moduleNameTextField.setReadOnly(true); moduleNameTextField.setWidth("80%"); layout.addComponent(moduleNameTextField, 1, 1); Label flowNameLabel = new Label(); flowNameLabel.setContentMode(ContentMode.HTML); flowNameLabel.setValue(VaadinIcons.AUTOMATION.getHtml() + " Flow Name:"); flowNameLabel.setSizeUndefined(); layout.addComponent(flowNameLabel, 0, 2); layout.setComponentAlignment(flowNameLabel, Alignment.MIDDLE_RIGHT); TextField flowNameTextField = new TextField(); flowNameTextField.setRequired(true); flowNameTextField.setValue(this.component.getFlow().getName()); flowNameTextField.setReadOnly(true); flowNameTextField.setWidth("80%"); layout.addComponent(flowNameTextField, 1, 2); Label componentNameLabel = new Label(); componentNameLabel.setContentMode(ContentMode.HTML); componentNameLabel.setValue(VaadinIcons.COG.getHtml() + " Component Name:"); componentNameLabel.setSizeUndefined(); layout.addComponent(componentNameLabel, 0, 3); layout.setComponentAlignment(componentNameLabel, Alignment.MIDDLE_RIGHT); TextField componentNameTextField = new TextField(); componentNameTextField.setRequired(true); componentNameTextField.setValue(this.component.getName()); componentNameTextField.setReadOnly(true); componentNameTextField.setWidth("80%"); layout.addComponent(componentNameTextField, 1, 3); Label errorCategoryLabel = new Label("Relationship:"); errorCategoryLabel.setSizeUndefined(); layout.addComponent(errorCategoryLabel, 0, 4); layout.setComponentAlignment(errorCategoryLabel, Alignment.MIDDLE_RIGHT); final ComboBox relationshipCombo = new ComboBox(); // relationshipCombo.addValidator(new StringLengthValidator( // "An relationship must be selected!", 1, -1, false)); relationshipCombo.setImmediate(false); relationshipCombo.setValidationVisible(false); relationshipCombo.setRequired(true); relationshipCombo.setRequiredError("A relationship must be selected!"); relationshipCombo.setHeight("30px"); relationshipCombo.setNullSelectionAllowed(false); layout.addComponent(relationshipCombo, 1, 4); relationshipCombo.addItem("before"); relationshipCombo.setItemCaption("before", "Before"); relationshipCombo.addItem("after"); relationshipCombo.setItemCaption("after", "After"); Label jobTypeLabel = new Label("Job Type:"); jobTypeLabel.setSizeUndefined(); layout.addComponent(jobTypeLabel, 0, 5); layout.setComponentAlignment(jobTypeLabel, Alignment.MIDDLE_RIGHT); final ComboBox jobTopCombo = new ComboBox(); // jobTopCombo.addValidator(new StringLengthValidator( // "A job type must be selected!", 1, -1, false)); jobTopCombo.setImmediate(false); jobTopCombo.setValidationVisible(false); jobTopCombo.setRequired(true); jobTopCombo.setRequiredError("A job type must be selected!"); jobTopCombo.setHeight("30px"); jobTopCombo.setNullSelectionAllowed(false); layout.addComponent(jobTopCombo, 1, 5); jobTopCombo.addItem("loggingJob"); jobTopCombo.setItemCaption("loggingJob", "Logging Job"); jobTopCombo.addItem("wiretapJob"); jobTopCombo.setItemCaption("wiretapJob", "Wiretap Job"); final Label timeToLiveLabel = new Label("Time to Live:"); timeToLiveLabel.setSizeUndefined(); timeToLiveLabel.setVisible(false); layout.addComponent(timeToLiveLabel, 0, 6); layout.setComponentAlignment(timeToLiveLabel, Alignment.MIDDLE_RIGHT); final TextField timeToLiveTextField = new TextField(); timeToLiveTextField.setRequired(true); timeToLiveTextField.setValidationVisible(false); jobTopCombo.setRequiredError("A time to live value must be entered!"); timeToLiveTextField.setVisible(false); timeToLiveTextField.setWidth("40%"); layout.addComponent(timeToLiveTextField, 1, 6); jobTopCombo.addValueChangeListener(new ComboBox.ValueChangeListener() { /* (non-Javadoc) * @see com.vaadin.data.Property.ValueChangeListener#valueChange(com.vaadin.data.Property.ValueChangeEvent) */ @Override public void valueChange(ValueChangeEvent event) { String value = (String) event.getProperty().getValue(); if (value.equals("wiretapJob")) { timeToLiveLabel.setVisible(true); timeToLiveTextField.setVisible(true); } else { timeToLiveLabel.setVisible(false); timeToLiveTextField.setVisible(false); } } }); GridLayout buttonLayouts = new GridLayout(3, 1); buttonLayouts.setSpacing(true); Button saveButton = new Button("Save"); saveButton.setStyleName(ValoTheme.BUTTON_SMALL); saveButton.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { try { relationshipCombo.validate(); jobTopCombo.validate(); if (timeToLiveTextField.isVisible()) { timeToLiveTextField.validate(); } } catch (InvalidValueException e) { relationshipCombo.setValidationVisible(true); relationshipCombo.markAsDirty(); jobTopCombo.setValidationVisible(true); jobTopCombo.markAsDirty(); if (timeToLiveTextField.isVisible()) { timeToLiveTextField.setValidationVisible(true); timeToLiveTextField.markAsDirty(); } Notification.show("There are errors on the wiretap creation form!", Type.ERROR_MESSAGE); return; } createWiretap((String) relationshipCombo.getValue(), (String) jobTopCombo.getValue(), timeToLiveTextField.getValue()); } }); Button cancelButton = new Button("Cancel"); cancelButton.setStyleName(ValoTheme.BUTTON_SMALL); cancelButton.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { close(); } }); buttonLayouts.addComponent(saveButton); buttonLayouts.addComponent(cancelButton); layout.addComponent(buttonLayouts, 0, 7, 1, 7); layout.setComponentAlignment(buttonLayouts, Alignment.MIDDLE_CENTER); Panel paramPanel = new Panel(); paramPanel.setStyleName("dashboard"); paramPanel.setWidth("100%"); paramPanel.setContent(layout); triggerTable = new Table(); Label existingWiretapLabel = new Label("Existing Wiretaps"); existingWiretapLabel.setStyleName(ValoTheme.LABEL_HUGE); layout.addComponent(existingWiretapLabel, 0, 8, 1, 8); layout.addComponent(triggerTable, 0, 9, 1, 9); layout.setComponentAlignment(triggerTable, Alignment.TOP_CENTER); this.triggerTable.setWidth("80%"); this.triggerTable.setHeight(150, Unit.PIXELS); this.triggerTable.setCellStyleGenerator(new IkasanCellStyleGenerator()); this.triggerTable.addStyleName(ValoTheme.TABLE_SMALL); this.triggerTable.addStyleName("ikasan"); this.triggerTable.addContainerProperty("Job Type", String.class, null); this.triggerTable.addContainerProperty("Relationship", String.class, null); this.triggerTable.addContainerProperty("Trigger Parameters", String.class, null); this.triggerTable.addContainerProperty("", Button.class, null); refreshTriggerTable(); GridLayout wrapper = new GridLayout(1, 1); wrapper.setMargin(true); wrapper.setSizeFull(); wrapper.addComponent(paramPanel); this.setContent(wrapper); }
From source file:org.inakirj.imagerulette.screens.DicePlayView.java
License:Open Source License
/** * Sets the layout.//from www . j a v a 2s . c om */ private void setLayout() { mainLayout = new VerticalLayout(); mainLayout.setWidth(100, Unit.PERCENTAGE); FileResource resource = new FileResource(new File( VaadinService.getCurrent().getBaseDirectory().getAbsolutePath() + "/WEB-INF/image/nope.png")); Image none = new Image("", resource); randomImgToBeReplaced = none; randomImgToBeReplaced.setWidth(78, Unit.PIXELS); randomImgToBeReplaced.setHeight(81, Unit.PIXELS); randomImgToBeReplaced.addStyleName("random-image"); imageLayout = new HorizontalLayout(); imageLayout.addComponent(randomImgToBeReplaced); imageLayout.setWidth(100, Unit.PERCENTAGE); imageLayout.setComponentAlignment(randomImgToBeReplaced, Alignment.TOP_CENTER); Button rollBtn = new Button(); rollBtn.addClickListener(e -> onPickABallClick()); rollBtn.setWidth(25, Unit.PERCENTAGE); rollBtn.setHeight(50, Unit.PIXELS); rollBtn.setIcon(FontAwesome.CUBE); rollBtn.addStyleName("dice-button-roll"); mainLayout.addComponent(imageLayout); mainLayout.addComponent(rollBtn); mainLayout.setComponentAlignment(rollBtn, Alignment.BOTTOM_CENTER); calculateStats(); addComponent(mainLayout); }
From source file:org.investovator.ui.agentgaming.user.DashboardPlayingView.java
License:Open Source License
private void createUI() { //Setup Layout content = new VerticalLayout(); content.setDefaultComponentAlignment(Alignment.TOP_CENTER); content.setSpacing(true);//from ww w. jav a2 s .co m HorizontalLayout row1 = new HorizontalLayout(); HorizontalLayout row2 = new HorizontalLayout(); row1.setDefaultComponentAlignment(Alignment.TOP_CENTER); row2.setDefaultComponentAlignment(Alignment.TOP_CENTER); row1.setWidth("100%"); row2.setWidth("100%"); row1.setHeight("60%"); row1.setHeight("35%"); content.addComponent(row1); content.addComponent(row2); content.setExpandRatio(row1, 55); content.setExpandRatio(row2, 45); //Portfolio Summary portfolioSummary = new PortfolioSummary(); //QuoteUI quoteUI = new QuoteUI(companyData); watchListTable = getTable(); currentPriceChart = new MultiStockChart(); //Adding to main layout row1.addComponent(watchListTable); row1.addComponent(currentPriceChart); row2.addComponent(quoteUI); row2.addComponent(portfolioSummary); row2.setComponentAlignment(portfolioSummary, Alignment.TOP_CENTER); watchListTable.addStyleName("center-caption"); quoteUI.addStyleName("center-caption"); currentPriceChart.addStyleName("center-caption"); content.setSizeFull(); this.setSizeFull(); this.setContent(content); }
From source file:org.jdal.vaadin.ui.form.FormDialog.java
License:Apache License
public void init() { setContent(form);// w ww . j av a2 s. c om getContent().setSizeUndefined(); center(); acceptButtonListener = new AcceptButtonListener(); cancelButtonListener = new CancelButtonListener(); HorizontalLayout buttonLayout = new HorizontalLayout(); Button acceptButton = FormUtils.newButton(acceptButtonListener); Button cancelButton = FormUtils.newButton(cancelButtonListener); buttonLayout.setSpacing(true); buttonLayout.addComponent(acceptButton); buttonLayout.addComponent(cancelButton); HorizontalLayout footer = new HorizontalLayout(); footer.addComponent(buttonLayout); footer.setSizeFull(); footer.setComponentAlignment(buttonLayout, Alignment.TOP_CENTER); form.setFooter(footer); form.setSizeFull(); form.getLayout().setSizeFull(); }
From source file:org.jdal.vaadin.ui.FormUtils.java
License:Apache License
/** * Add a default commit/discard buttons to a form * @param f the Form//from www .j a v a 2 s .co m */ public static void addOKCancelButtons(Form f) { Button ok = newOKButton(f); Button cancel = newCancelButton(f); HorizontalLayout hl = new HorizontalLayout(); hl.setSpacing(true); hl.addComponent(ok); hl.addComponent(cancel); HorizontalLayout footer = new HorizontalLayout(); footer.setWidth("100%"); footer.addComponent(hl); footer.setComponentAlignment(hl, Alignment.TOP_CENTER); f.setFooter(footer); }
From source file:org.jdal.vaadin.ui.FormUtils.java
License:Apache License
/** * Show a YES/NO confirm dialog//w w w. j a va 2s . c o m * @param window Window to attach the dialog * @param msg the msg */ public static void showConfirmDialog(UI ui, final Command command, String msg) { final Window dlg = new Window("Please Confirm"); VerticalLayout vl = new VerticalLayout(); vl.setSizeFull(); vl.setSpacing(true); vl.setMargin(true); Label label = new Label(msg, Label.CONTENT_XHTML); vl.addComponent(label); HorizontalLayout hl = new HorizontalLayout(); hl.setSpacing(true); Button ok = new Button(StaticMessageSource.getMessage("yes")); ok.addClickListener(new ClickListener() { public void buttonClick(ClickEvent event) { command.execute(null); closeWindow(dlg); } }); Button cancel = new Button(StaticMessageSource.getMessage("no")); cancel.addClickListener(new ClickListener() { public void buttonClick(ClickEvent event) { closeWindow(dlg); } }); hl.setSpacing(true); hl.addComponent(ok); hl.addComponent(cancel); hl.setSizeFull(); vl.addComponent(hl); vl.setComponentAlignment(hl, Alignment.TOP_CENTER); dlg.setContent(vl); dlg.setModal(true); vl.setSizeUndefined(); ui.addWindow(dlg); }
From source file:org.jpos.qi.system.EmptyView.java
License:Open Source License
public EmptyView(boolean canAdd) { Label emptyLabel = new Label("There are no items in this view"); emptyLabel.addStyleName(ValoTheme.LABEL_H2); addComponents(emptyLabel);// w ww . j av a 2s .c om setComponentAlignment(emptyLabel, Alignment.TOP_CENTER); setExpandRatio(emptyLabel, 0); if (canAdd) { Button addNew = new Button(QI.getQI().getMessage("add")); addNew.setIcon(VaadinIcons.PLUS); String actualRoute = QI.getQI().getNavigator().getState(); addNew.addClickListener(listener -> QI.getQI().getNavigator().navigateTo(actualRoute + "/new")); addNew.addStyleName(ValoTheme.BUTTON_LARGE); addNew.addStyleName(ValoTheme.BUTTON_FRIENDLY); addComponent(addNew); setComponentAlignment(addNew, Alignment.TOP_CENTER); setExpandRatio(addNew, 1); } }
From source file:org.jumpmind.metl.ui.views.design.EditFlowPalette.java
License:Open Source License
protected void addItemToFlowPanelSection(String labelName, String componentType, VerticalLayout componentLayout, ClassResource icon, String componentId) { FlowPaletteItem paletteItem = new FlowPaletteItem(labelName); if (componentId != null) { paletteItem.setShared(true);/*from ww w .java 2 s. com*/ paletteItem.setComponentId(componentId); } else { paletteItem.setComponentType(componentType); paletteItem.setShared(false); } paletteItem.setIcon(icon); paletteItem.addStyleName(ValoTheme.BUTTON_ICON_ALIGN_TOP); paletteItem.addStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED); paletteItem.addStyleName("leftAligned"); paletteItem.setWidth(100, Unit.PERCENTAGE); DragAndDropWrapper wrapper = new DragAndDropWrapper(paletteItem); wrapper.setSizeUndefined(); wrapper.setDragStartMode(DragStartMode.WRAPPER); componentLayout.addComponent(wrapper); componentLayout.setComponentAlignment(wrapper, Alignment.TOP_CENTER); }
From source file:org.jumpmind.metl.ui.views.DesignNavigator.java
License:Open Source License
public void refresh() { refreshOpenProjects();//from w w w.j a v a 2s . c o m setMenuItemsEnabled(); if (treeTable.size() == 0) { removeComponent(treeTable); if (openProjectsLayout != null) { removeComponent(openProjectsLayout); } openProjectsLayout = new VerticalLayout(); openProjectsLayout.addStyleName(ValoTheme.LAYOUT_CARD); openProjectsLayout.setSizeFull(); openProjectsLayout.setMargin(true); Button viewProjects = new Button("Click to manage projects"); viewProjects.addStyleName(ValoTheme.BUTTON_LINK); viewProjects.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { viewProjects(); } }); openProjectsLayout.addComponent(viewProjects); openProjectsLayout.setComponentAlignment(viewProjects, Alignment.TOP_CENTER); addComponent(openProjectsLayout); setExpandRatio(openProjectsLayout, 1); viewProjects(); } else { boolean add = true; Iterator<Component> i = iterator(); while (i.hasNext()) { if (i.next().equals(treeTable)) { add = false; break; } } if (add) { if (openProjectsLayout != null) { removeComponent(openProjectsLayout); } addComponent(treeTable); setExpandRatio(treeTable, 1); } treeTable.refreshRowCache(); } }