List of usage examples for com.vaadin.ui GridLayout addComponent
public void addComponent(Component component, int column1, int row1, int column2, int row2) throws OverlapsException, OutOfBoundsException
Adds a component to the grid in the specified area.
From source file:org.ikasan.dashboard.ui.topology.window.NewServerWindow.java
License:BSD License
public void init() { this.setModal(true); this.setResizable(false); GridLayout gridLayout = new GridLayout(2, 6); gridLayout.setWidth("480px"); gridLayout.setColumnExpandRatio(0, .15f); gridLayout.setColumnExpandRatio(1, .85f); gridLayout.setSpacing(true);//from w w w .ja va2 s . c o m gridLayout.setMargin(true); Label newBusinessStreamLabel = new Label("New Server"); newBusinessStreamLabel.addStyleName(ValoTheme.LABEL_HUGE); gridLayout.addComponent(newBusinessStreamLabel, 0, 0, 1, 0); Label nameLabel = new Label("Name:"); nameLabel.setSizeUndefined(); this.name = new TextField(); this.name.addValidator(new StringLengthValidator("A name must be entered.", 1, null, false)); this.name.setWidth("90%"); gridLayout.addComponent(nameLabel, 0, 1); gridLayout.setComponentAlignment(nameLabel, Alignment.MIDDLE_RIGHT); gridLayout.addComponent(name, 1, 1); Label urlLabel = new Label("URL:"); urlLabel.setSizeUndefined(); this.url = new TextField(); this.url.addValidator(new StringLengthValidator("A url must be entered.", 1, null, false)); this.url.setWidth("90%"); gridLayout.addComponent(urlLabel, 0, 2); gridLayout.setComponentAlignment(urlLabel, Alignment.MIDDLE_RIGHT); gridLayout.addComponent(url, 1, 2); Label portLabel = new Label("Port Number:"); portLabel.setSizeUndefined(); this.port = new TextField(); this.port.addValidator(new IntegerValidator("A port number and must be a valid number.")); this.port.setWidth("45%"); StringToIntegerConverter plainIntegerConverter = new StringToIntegerConverter() { protected java.text.NumberFormat getFormat(Locale locale) { NumberFormat format = super.getFormat(locale); format.setGroupingUsed(false); return format; }; }; // either set for the field or in your field factory for multiple fields this.port.setConverter(plainIntegerConverter); gridLayout.addComponent(portLabel, 0, 3); gridLayout.setComponentAlignment(portLabel, Alignment.MIDDLE_RIGHT); gridLayout.addComponent(port, 1, 3); Label descriptionLabel = new Label("Description:"); descriptionLabel.setSizeUndefined(); this.description = new TextArea(); this.description.addValidator(new StringLengthValidator("A description must be entered.", 1, null, false)); this.description.setWidth("90%"); this.description.setRows(4); this.name.setValidationVisible(false); this.description.setValidationVisible(false); this.url.setValidationVisible(false); this.port.setValidationVisible(false); gridLayout.addComponent(descriptionLabel, 0, 4); gridLayout.setComponentAlignment(descriptionLabel, Alignment.TOP_RIGHT); gridLayout.addComponent(description, 1, 4); Button createButton = new Button("Create"); Button cancelButton = new Button("Cancel"); GridLayout buttonLayout = new GridLayout(2, 1); buttonLayout.setSpacing(true); buttonLayout.addComponent(createButton); buttonLayout.setComponentAlignment(createButton, Alignment.MIDDLE_CENTER); buttonLayout.addComponent(cancelButton); buttonLayout.setComponentAlignment(cancelButton, Alignment.MIDDLE_CENTER); gridLayout.addComponent(buttonLayout, 0, 5, 1, 5); gridLayout.setComponentAlignment(buttonLayout, Alignment.MIDDLE_CENTER); BeanItem<Server> policyItem = new BeanItem<Server>(this.server); name.setPropertyDataSource(policyItem.getItemProperty("name")); description.setPropertyDataSource(policyItem.getItemProperty("description")); url.setPropertyDataSource(policyItem.getItemProperty("url")); port.setPropertyDataSource(policyItem.getItemProperty("port")); createButton.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { try { NewServerWindow.this.name.validate(); NewServerWindow.this.description.validate(); NewServerWindow.this.url.validate(); NewServerWindow.this.port.validate(); } catch (InvalidValueException e) { NewServerWindow.this.name.setValidationVisible(true); NewServerWindow.this.description.setValidationVisible(true); NewServerWindow.this.url.setValidationVisible(true); NewServerWindow.this.port.setValidationVisible(true); return; } NewServerWindow.this.name.setValidationVisible(false); NewServerWindow.this.description.setValidationVisible(false); NewServerWindow.this.url.setValidationVisible(false); NewServerWindow.this.port.setValidationVisible(false); topologyService.save(server); Notification.show("New Server Created!"); UI.getCurrent().removeWindow(NewServerWindow.this); } }); cancelButton.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { UI.getCurrent().removeWindow(NewServerWindow.this); } }); this.setContent(gridLayout); }
From source file:org.ikasan.dashboard.ui.topology.window.ServerWindow.java
License:BSD License
public void init() { this.setModal(true); this.setResizable(false); GridLayout gridLayout = new GridLayout(2, 7); gridLayout.setWidth("480px"); gridLayout.setColumnExpandRatio(0, .15f); gridLayout.setColumnExpandRatio(1, .85f); gridLayout.setSpacing(true);// w ww . j a v a 2 s . c o m gridLayout.setMargin(true); Label newBusinessStreamLabel = new Label("Server"); newBusinessStreamLabel.addStyleName(ValoTheme.LABEL_HUGE); gridLayout.addComponent(newBusinessStreamLabel, 0, 0, 1, 0); Label nameLabel = new Label("Name:"); nameLabel.setSizeUndefined(); this.name = new TextField(); this.name.addValidator(new StringLengthValidator("A name must be entered.", 1, null, false)); this.name.setWidth("90%"); gridLayout.addComponent(nameLabel, 0, 1); gridLayout.setComponentAlignment(nameLabel, Alignment.MIDDLE_RIGHT); gridLayout.addComponent(name, 1, 1); Label urlLabel = new Label("URL:"); urlLabel.setSizeUndefined(); this.url = new TextField(); this.url.addValidator(new StringLengthValidator("A url must be entered.", 1, null, false)); this.url.setWidth("90%"); gridLayout.addComponent(urlLabel, 0, 3); gridLayout.setComponentAlignment(urlLabel, Alignment.MIDDLE_RIGHT); gridLayout.addComponent(url, 1, 3); Label portLabel = new Label("Port Number:"); portLabel.setSizeUndefined(); this.port = new TextField(); this.port.addValidator(new IntegerValidator("A port number and must be a valid number.")); this.port.setWidth("45%"); StringToIntegerConverter plainIntegerConverter = new StringToIntegerConverter() { protected java.text.NumberFormat getFormat(Locale locale) { NumberFormat format = super.getFormat(locale); format.setGroupingUsed(false); return format; }; }; // either set for the field or in your field factory for multiple fields this.port.setConverter(plainIntegerConverter); gridLayout.addComponent(portLabel, 0, 4); gridLayout.setComponentAlignment(portLabel, Alignment.MIDDLE_RIGHT); gridLayout.addComponent(port, 1, 4); Label descriptionLabel = new Label("Description:"); descriptionLabel.setSizeUndefined(); this.description = new TextArea(); this.description.addValidator(new StringLengthValidator("A description must be entered.", 1, null, false)); this.description.setWidth("90%"); this.description.setRows(4); this.name.setValidationVisible(false); this.description.setValidationVisible(false); this.url.setValidationVisible(false); this.port.setValidationVisible(false); gridLayout.addComponent(descriptionLabel, 0, 5); gridLayout.setComponentAlignment(descriptionLabel, Alignment.TOP_RIGHT); gridLayout.addComponent(description, 1, 5); Button saveButton = new Button("Save"); Button cancelButton = new Button("Cancel"); GridLayout buttonLayout = new GridLayout(2, 1); buttonLayout.setSpacing(true); buttonLayout.addComponent(saveButton); buttonLayout.setComponentAlignment(saveButton, Alignment.MIDDLE_CENTER); buttonLayout.addComponent(cancelButton); buttonLayout.setComponentAlignment(cancelButton, Alignment.MIDDLE_CENTER); gridLayout.addComponent(buttonLayout, 0, 6, 1, 6); gridLayout.setComponentAlignment(buttonLayout, Alignment.MIDDLE_CENTER); BeanItem<Server> serverItem = new BeanItem<Server>(this.server); name.setPropertyDataSource(serverItem.getItemProperty("name")); description.setPropertyDataSource(serverItem.getItemProperty("description")); url.setPropertyDataSource(serverItem.getItemProperty("url")); this.port.setPropertyDataSource(serverItem.getItemProperty("port")); saveButton.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { try { ServerWindow.this.name.validate(); ServerWindow.this.description.validate(); ServerWindow.this.url.validate(); ServerWindow.this.port.validate(); } catch (InvalidValueException e) { ServerWindow.this.name.setValidationVisible(true); ServerWindow.this.description.setValidationVisible(true); ServerWindow.this.url.setValidationVisible(true); ServerWindow.this.port.setValidationVisible(true); return; } ServerWindow.this.name.setValidationVisible(false); ServerWindow.this.description.setValidationVisible(false); ServerWindow.this.url.setValidationVisible(false); ServerWindow.this.port.setValidationVisible(false); topologyService.save(server); Notification.show("New Server Created!"); UI.getCurrent().removeWindow(ServerWindow.this); } }); cancelButton.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { UI.getCurrent().removeWindow(ServerWindow.this); } }); this.setContent(gridLayout); }
From source file:org.ikasan.dashboard.ui.topology.window.StartupControlConfigurationWindow.java
License:BSD License
/** * Helper method to initialise this object. * //from w w w . j av a2 s . c om * @param message */ protected void init() { setModal(true); setResizable(false); setHeight("320px"); setWidth("550px"); GridLayout gridLayout = new GridLayout(2, 6); gridLayout.setWidth("500px"); gridLayout.setColumnExpandRatio(0, .15f); gridLayout.setColumnExpandRatio(1, .85f); gridLayout.setSpacing(true); gridLayout.setMargin(true); Label startupControlLabel = new Label("Startup Control"); startupControlLabel.addStyleName(ValoTheme.LABEL_HUGE); gridLayout.addComponent(startupControlLabel, 0, 0, 1, 0); Label moduleNameLabel = new Label(); moduleNameLabel.setContentMode(ContentMode.HTML); moduleNameLabel.setValue(VaadinIcons.ARCHIVE.getHtml() + " Module Name:"); moduleNameLabel.setSizeUndefined(); gridLayout.addComponent(moduleNameLabel, 0, 1); gridLayout.setComponentAlignment(moduleNameLabel, Alignment.MIDDLE_RIGHT); startupControl = this.startupControlService.getStartupControl(flow.getModule().getName(), flow.getName()); startupControlItem = new BeanItem<StartupControl>(startupControl); moduleNameTextField = new TextField(); moduleNameTextField.setRequired(true); moduleNameTextField.setPropertyDataSource(startupControlItem.getItemProperty("moduleName")); moduleNameTextField.setReadOnly(true); moduleNameTextField.setWidth("90%"); gridLayout.addComponent(moduleNameTextField, 1, 1); Label flowNameLabel = new Label(); flowNameLabel.setContentMode(ContentMode.HTML); flowNameLabel.setValue(VaadinIcons.AUTOMATION.getHtml() + " Flow Name:"); flowNameLabel.setSizeUndefined(); gridLayout.addComponent(flowNameLabel, 0, 2); gridLayout.setComponentAlignment(flowNameLabel, Alignment.MIDDLE_RIGHT); flowNameTextField = new TextField(); flowNameTextField.setRequired(true); flowNameTextField.setPropertyDataSource(startupControlItem.getItemProperty("flowName")); flowNameTextField.setReadOnly(true); flowNameTextField.setWidth("90%"); gridLayout.addComponent(flowNameTextField, 1, 2); Label startupTypeLabel = new Label("Startup Type:"); startupTypeLabel.setSizeUndefined(); this.startupType = new ComboBox(); this.startupType.addItem(StartupType.MANUAL); this.startupType.setItemCaption(StartupType.MANUAL, "Manual"); this.startupType.addItem(StartupType.AUTOMATIC); this.startupType.setItemCaption(StartupType.AUTOMATIC, "Automatic"); this.startupType.addItem(StartupType.DISABLED); this.startupType.setItemCaption(StartupType.DISABLED, "Disabled"); this.startupType.setPropertyDataSource(startupControlItem.getItemProperty("startupType")); this.startupType.setNullSelectionAllowed(false); this.startupType.addValidator(new StringLengthValidator("A name must be entered.", 1, null, false)); this.startupType.setWidth("90%"); this.startupType.setValidationVisible(false); gridLayout.addComponent(startupTypeLabel, 0, 3); gridLayout.setComponentAlignment(startupTypeLabel, Alignment.MIDDLE_RIGHT); gridLayout.addComponent(this.startupType, 1, 3); Label commentLabel = new Label("Comment:"); commentLabel.setSizeUndefined(); this.comment = new TextArea(); this.comment.setRows(3); this.comment.addValidator(new StringLengthValidator("A name must be entered.", 1, null, false)); this.comment.setWidth("90%"); this.comment.setValidationVisible(false); this.comment.setNullRepresentation(""); this.comment.setPropertyDataSource(startupControlItem.getItemProperty("comment")); gridLayout.addComponent(commentLabel, 0, 4); gridLayout.setComponentAlignment(commentLabel, Alignment.MIDDLE_RIGHT); gridLayout.addComponent(this.comment, 1, 4); Button saveButton = new Button("Save"); Button cancelButton = new Button("Cancel"); GridLayout buttonLayout = new GridLayout(2, 1); buttonLayout.setSpacing(true); buttonLayout.addComponent(saveButton); buttonLayout.setComponentAlignment(saveButton, Alignment.MIDDLE_CENTER); buttonLayout.addComponent(cancelButton); buttonLayout.setComponentAlignment(cancelButton, Alignment.MIDDLE_CENTER); gridLayout.addComponent(buttonLayout, 0, 5, 1, 5); gridLayout.setComponentAlignment(buttonLayout, Alignment.MIDDLE_CENTER); saveButton.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { StartupControl sc = startupControlItem.getBean(); if (((StartupType) startupType.getValue()) == StartupType.DISABLED && (comment.getValue() == null || comment.getValue().length() == 0)) { Notification.show("A comment must be entered for a 'Disabled' start up type!", Type.ERROR_MESSAGE); return; } else { final IkasanAuthentication authentication = (IkasanAuthentication) VaadinService .getCurrentRequest().getWrappedSession() .getAttribute(DashboardSessionValueConstants.USER); StartupControlConfigurationWindow.this.startupControlService.setStartupType(sc.getModuleName(), sc.getFlowName(), (StartupType) startupType.getValue(), comment.getValue(), authentication.getName()); Notification.show("Saved!"); } } }); cancelButton.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { UI.getCurrent().removeWindow(StartupControlConfigurationWindow.this); } }); this.setContent(gridLayout); }
From source file:org.lunifera.examples.kwiee.erp.module.core.presentation.web.vaadin.ui.KwieeUINavigator.java
License:Open Source License
@Override public void init(VaadinRequest request) { // initialize push ////from w w w. j a v a2 s . co m pusher = new ICEPush(); pusher.extend(this); // prepare UI // GridLayout root = new GridLayout(8, 8); root.setStyleName(Reindeer.LAYOUT_BLUE); root.addStyleName("kwiee"); root.setSizeFull(); root.setMargin(new MarginInfo(false, true, true, true)); root.setSpacing(false); setContent(root); root.setRowExpandRatio(0, 0.7f); root.setRowExpandRatio(1, 1.0f); root.setRowExpandRatio(2, 1.0f); root.setRowExpandRatio(3, 1.0f); root.setRowExpandRatio(4, 1.0f); root.setRowExpandRatio(5, 1.0f); root.setRowExpandRatio(6, 1.0f); root.setRowExpandRatio(7, 0.4f); // Create top frame topFrame = new HorizontalLayout(); topFrame.addStyleName("k-topframe"); topFrame.setMargin(true); topFrame.setSpacing(true); topFrame.setSizeFull(); root.addComponent(topFrame, 1, 0, 7, 0); // Create top frame navFrame = new CssLayout(); navFrame.addStyleName("k-navframe"); navFrame.setSizeFull(); root.addComponent(navFrame, 0, 1, 0, 6); // Create main frame mainFrame = new CssLayout(); mainFrame.setSizeFull(); root.addComponent(mainFrame, 1, 1, 7, 6); tabSheet = new TabSheet(); tabSheet.setSizeFull(); mainFrame.addComponent(tabSheet); // task table createTasksTable(); // Create bottom frame bottomFrame = new CssLayout(); bottomFrame.addStyleName("k-bottomframe"); bottomFrame.setSizeFull(); root.addComponent(bottomFrame, 0, 7, 7, 7); initialized = true; // attach the pending modules // synchronized (this) { for (IUIModule module : pendingModules) { attachModule(module); } pendingModules.clear(); } }
From source file:org.processbase.ui.bpm.generator.GeneratedWindow.java
License:Open Source License
protected void generateWindow() throws Exception { prepareAttachmentDefinitions();//from w w w. j a v a 2 s . co m prepareGroovyScripts(); for (Page page : pageFlow.getPages().getPages()) { TableStyle ts = barResource.getTableStyle(page); GridLayout gridLayout = new GridLayout(ts.getColumns(), ts.getRows()); gridLayout.setMargin(false, true, true, true); gridLayout.setSpacing(true); for (Object wg : page.getWidgets().getWidgetsAndGroups()) { Component component = null; if (wg instanceof Widget) { Widget widget = (Widget) wg; component = getComponent(widget); components.put(component, widget); fields.put("field_" + widget.getId(), component); ComponentStyle componentStyle = ts.getElements().get(widget.getId()); int fColumn = componentStyle.getPosition().getFColumn(); int fRow = componentStyle.getPosition().getFRow(); int tColumn = componentStyle.getPosition().getTColumn(); int tRow = componentStyle.getPosition().getTRow(); // System.out.println(widget.getId() + " " + fColumn + " " + tColumn + " " + fRow + " " + tRow); CSSProperty cssProperty = componentStyle.getCss(); if (cssProperty != null) { // System.out.print(widget.getId() + " H:" + cssProperty.getHeigth()); // System.out.print(" W:" + cssProperty.getWidth()); // System.out.println(" A:" + cssProperty.getAlign()); } else { if (!(component instanceof Table) && !(component instanceof Button) && (fColumn == tColumn)) { component.setWidth("200px"); } } gridLayout.addComponent(component, fColumn, fRow, tColumn, tRow); } else if (wg instanceof WidgetGroup) { } } pages.add(gridLayout); } taskPanel.setContent(pages.get(currentPage)); taskPanel.setCaption(pageFlow.getPages().getPages().get(currentPage).getPageLabel()); }
From source file:org.rdflivenews.annotator.gui.AnnotatorGuiApplication.java
License:Apache License
@Override public void init() { setMainWindow(main);//from www . j a va 2s .c o m setTheme("mytheme"); if (!patterns.isEmpty()) { mainLayout.removeAllComponents(); main.removeAllComponents(); this.pattern = patterns.remove(0); this.writeTodoPatterns(); GridLayout grid = new GridLayout(4, 6); grid.setSpacing(true); HorizontalLayout labels = new HorizontalLayout(); labels.setSizeFull(); subject = new Label("<span style=\"font-size:130%\">" + this.pattern.entityOne + "</span>"); subject.setContentMode(Label.CONTENT_XHTML); subject.setSizeFull(); patternLabel = new Label("<span style=\"font-size:130%;color:red;\">" + this.pattern.nlr + "</span>"); patternLabel.setContentMode(Label.CONTENT_XHTML); patternLabel.setSizeFull(); patternLabel.setStyleName("center"); object = new Label( "<span style=\"font-size:130%;text-align:right;\">" + this.pattern.entityTwo + "</span>"); object.setContentMode(Label.CONTENT_XHTML); object.setSizeFull(); object.setStyleName("right"); String sentenceLabel = "<a href=\"" + this.pattern.url + "\">" + "<span style=\"font-size:130%\">" + this.pattern.sentence .replace(this.pattern.entityOne, "<span style=\"font-weight:bold\">" + this.pattern.entityOne + "</span>") .replace(this.pattern.entityTwo, "<span style=\"font-weight:bold\">" + this.pattern.entityTwo + "</span>") .replace(this.pattern.nlr, "<span style=\"color:red\">" + this.pattern.nlr + "</span>") + "</span></a>"; sentence = new Label(sentenceLabel); sentence.setContentMode(Label.CONTENT_XHTML); grid.addComponent(sentence, 0, 0, 3, 0); labels.addComponent(subject); labels.addComponent(patternLabel); labels.addComponent(object); // grid.addComponent(subject, 0, 1); // grid.addComponent(patternLabel, 1, 1, 2, 1); // grid.addComponent(object, 3, 1); labels.setComponentAlignment(subject, Alignment.MIDDLE_LEFT); labels.setComponentAlignment(patternLabel, Alignment.MIDDLE_CENTER); labels.setComponentAlignment(object, Alignment.MIDDLE_RIGHT); grid.addComponent(labels, 0, 1, 3, 1); AutocompleteWidget subject = new AutocompleteWidget(index); subject.addSelectionListener(new SelectionListener() { @Override public void itemSelected(SolrItem item) { subjectUri.setValue(item.getUri()); } }); grid.addComponent(subject, 0, 2, 1, 2); AutocompleteWidget object = new AutocompleteWidget(index); object.addSelectionListener(new SelectionListener() { @Override public void itemSelected(SolrItem item) { objectUri.setValue(item.getUri()); } }); grid.addComponent(object, 2, 2, 3, 2); saidObject = new TextArea("Say Cluster Object Value"); saidObject.setWidth("100%"); grid.addComponent(saidObject, 0, 5, 1, 5); comment = new TextArea("Comments"); comment.setWidth("100%"); grid.addComponent(comment, 2, 5, 3, 5); HorizontalLayout urisAndCluster = new HorizontalLayout(); subjectUri = new TextField("Subject URI"); objectUri = new TextField("Object URI"); subjectUri.setSizeFull(); objectUri.setSizeFull(); //cluster category combobox clusterCategoriesBox = new ComboBox(); clusterCategoriesBox.setWidth("40%"); clusterCategoriesBox.setCaption("Cluster Category"); clusterCategoriesBox.addContainerProperty("name", String.class, null); clusterCategoriesBox.setItemCaptionMode(ComboBox.ITEM_CAPTION_MODE_ITEM); for (ClusterCategory cat : ClusterCategory.values()) { clusterCategoriesBox.addItem(cat).getItemProperty("name").setValue(cat.getName()); } clusterCategoriesBox.setImmediate(true); clusterCategoriesBox.setValue(ClusterCategory.UNKNOWN); clusterCategoriesBox.setNullSelectionAllowed(false); urisAndCluster.setSizeFull(); urisAndCluster.addComponent(subjectUri); urisAndCluster.addComponent(clusterCategoriesBox); urisAndCluster.addComponent(objectUri); urisAndCluster.setComponentAlignment(subjectUri, Alignment.MIDDLE_LEFT); urisAndCluster.setComponentAlignment(clusterCategoriesBox, Alignment.MIDDLE_CENTER); urisAndCluster.setComponentAlignment(objectUri, Alignment.MIDDLE_RIGHT); grid.addComponent(urisAndCluster, 0, 3, 3, 3); // grid.addComponent(clusterCategoriesBox, 1, 3, 2, 3); // grid.setComponentAlignment(clusterCategoriesBox, Alignment.BOTTOM_CENTER); mainLayout.addComponent(grid); HorizontalLayout submitButtonslayout = new HorizontalLayout(); nextButton = new NativeButton("Next"); trashButton = new NativeButton("Trash"); stopButton = new NativeButton("Stop"); nextButton.addListener(this); trashButton.addListener(this); stopButton.addListener(this); submitButtonslayout.setSpacing(true); submitButtonslayout.setWidth("100%"); submitButtonslayout.addComponent(trashButton); submitButtonslayout.addComponent(stopButton); submitButtonslayout.addComponent(nextButton); submitButtonslayout.setComponentAlignment(nextButton, Alignment.MIDDLE_RIGHT); submitButtonslayout.setComponentAlignment(stopButton, Alignment.MIDDLE_RIGHT); mainLayout.addComponent(submitButtonslayout); mainLayout.setSpacing(true); mainLayout.setWidth(null); mainLayout.setHeight("100%"); Panel panel = new Panel(); panel.setWidth(null); panel.addComponent(mainLayout); main.addComponent(panel); ((VerticalLayout) main.getContent()).setHeight("100%"); ((VerticalLayout) main.getContent()).setComponentAlignment(panel, Alignment.MIDDLE_CENTER); //force URI search with given labels subject.setSearchTerm(this.pattern.entityOne); object.setSearchTerm(this.pattern.entityTwo); } else getMainWindow().showNotification("No patterns anymore..."); }
From source file:org.sensorhub.ui.StorageAdminPanel.java
License:Mozilla Public License
protected void buildDataPanel(GridLayout form, IRecordStorageModule<?> storage) { // measurement outputs int i = 1;//from w w w . jav a 2 s .c o m if (storage.isEnabled()) { for (IRecordStoreInfo dsInfo : storage.getRecordStores().values()) { Panel panel = newPanel("Stream #" + i++); GridLayout panelLayout = ((GridLayout) panel.getContent()); panelLayout.setSpacing(true); // stored time period double[] timeRange = storage.getRecordsTimeRange(dsInfo.getName()); Label l = new Label("<b>Time Range:</b> " + new DateTimeFormat().formatIso(timeRange[0], 0) + " / " + new DateTimeFormat().formatIso(timeRange[1], 0)); l.setContentMode(ContentMode.HTML); panelLayout.addComponent(l, 0, 0, 1, 0); // time line panelLayout.addComponent(buildGantt(storage, dsInfo), 0, 1, 1, 1); // data structure DataComponent dataStruct = dsInfo.getRecordDescription(); Component sweForm = new SWECommonForm(dataStruct); panelLayout.addComponent(sweForm); // data table panelLayout.addComponent(buildTable(storage, dsInfo)); if (oldPanel != null) form.replaceComponent(oldPanel, panel); else form.addComponent(panel); oldPanel = panel; } } }
From source file:org.vaadin.johannesh.jfokus2012.touchkit.view.ShowContactView.java
License:Open Source License
private void buildLayout() { layout = new CssLayout(); layout.addStyleName("show-contact-view"); layout.setWidth("100%"); VerticalComponentGroup infoGroup = new VerticalComponentGroup(""); infoGroup.setWidth("100%"); Component label;/* w ww . java 2 s .c o m*/ Property p; p = item.getItemProperty(ContactUtils.PROPERTY_COMPANY); label = new Label(new ContactUtils.CompanyPropertyFormatter(p)); label.setCaption(ContactUtils.formatFieldCaption(ContactUtils.PROPERTY_COMPANY)); infoGroup.addComponent(label); p = item.getItemProperty(ContactUtils.PROPERTY_MOBILE); label = new Label(p); label.setCaption(ContactUtils.formatFieldCaption(ContactUtils.PROPERTY_MOBILE)); infoGroup.addComponent(label); p = item.getItemProperty(ContactUtils.PROPERTY_EMAIL); label = new Label(p); label.setCaption(ContactUtils.formatFieldCaption(ContactUtils.PROPERTY_EMAIL)); infoGroup.addComponent(label); Embedded picture = new Embedded("", new ThemeResource("icon/picture.png")); picture.setWidth("57px"); picture.setHeight("57px"); Label firstName = new Label(item.getItemProperty(ContactUtils.PROPERTY_FIRST_NAME)); firstName.addStyleName("strong-name"); Label lastName = new Label(item.getItemProperty(ContactUtils.PROPERTY_LAST_NAME)); lastName.addStyleName("strong-name"); GridLayout nameLayout = new GridLayout(2, 2); nameLayout.setWidth("100%"); nameLayout.setSpacing(true); nameLayout.setMargin(true, true, false, true); nameLayout.setColumnExpandRatio(1, 1.0f); nameLayout.addComponent(picture, 0, 0, 0, 1); nameLayout.addComponent(firstName, 1, 0); nameLayout.addComponent(lastName, 1, 1); nameLayout.setComponentAlignment(firstName, Alignment.MIDDLE_LEFT); nameLayout.setComponentAlignment(lastName, Alignment.MIDDLE_LEFT); final Favourite favourite = new Favourite(); favourite.setImmediate(true); favourite.setReadOnly(true); favourite.setIcon(new ThemeResource("icon/favourite.png")); favourite.setPropertyDataSource(item.getItemProperty(ContactUtils.PROPERTY_FAVOURITE)); layout.addComponent(nameLayout); layout.addComponent(favourite); layout.addComponent(infoGroup); Button editButton = new Button("Edit"); editButton.addListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { getNavigationManager().navigateTo(new EditContactView(item)); } }); setRightComponent(editButton); setContent(layout); }
From source file:v7cr.ReviewTab.java
License:Open Source License
private Panel getBasicInfo(V7CR v7, Review r, Project proj, String linkUrl) { Panel p = new Panel(v7.getMessage("reviewTab.review")); p.setWidth("600px"); GridLayout grid = new GridLayout(3, 4); grid.setSizeFull();//from w w w . j a va2 s . com p.setContent(grid); grid.setSpacing(true); Locale l = v7.getLocale(); SchemaDefinition sd = r.getSchemaDefinition(); grid.addComponent(new Label(sd.getFieldCaption("s", l)), 0, 0, 1, 0); p.addComponent(new Label("<b>" + LocalizedString .get(sd.getFieldDefinition("s").getPossibleValueMetaData(r.getStatus()), "caption", l) + "</b>", Label.CONTENT_XHTML)); p.addComponent(new Label(sd.getFieldCaption("p", l))); p.addComponent(new Label("[" + proj.getId() + "]")); grid.addComponent(new Label(proj.getName())); p.addComponent(new Label(sd.getFieldCaption("reviewee", l))); p.addComponent(new Label(r.getReviewee().getId())); grid.addComponent(new Label(r.getReviewee().getName())); p.addComponent(new Label(sd.getFieldCaption("t", l))); grid.addComponent(new Label(r.getTitle()), 1, 3, 2, 3); p.addComponent(new Label(v7.getMessage("reviewTab.directLink"))); Link link = new Link(linkUrl, new ExternalResource(linkUrl)); link.setTargetName("_blank"); link.setIcon(new ThemeResource("../runo/icons/16/arrow-right.png")); grid.addComponent(link); return p; }
From source file:v7cr.ReviewTab.java
License:Open Source License
private Panel getSVNPanel(V7CR v7, SchemaDefinition sd, SVNLogEntry svn, Project proj) { if (svn == null) return null; Locale l = v7.getLocale();//from ww w .j a v a 2s.c o m Panel p = new Panel(v7.getMessage("reviewTab.subversion")); p.setWidth("600px"); GridLayout grid = new GridLayout(4, 4); grid.setSizeFull(); p.setContent(grid); grid.setSpacing(true); p.addComponent(new Label(sd.getFieldCaption("svn.rev", l))); p.addComponent(new Label("" + svn.getRevision())); p.addComponent(new Label(DateFormat.getDateTimeInstance().format(svn.getDate()))); p.addComponent(new Label(svn.getAuthor())); Link link = new Link(v7.getMessage("reviewTab.viewChanges"), new ExternalResource(proj.getChangesetViewUrl(svn.getRevision()))); link.setTargetName("_blank"); link.setIcon(new ThemeResource("../runo/icons/16/arrow-right.png")); p.addComponent(link); grid.addComponent(new Label(svn.getMessage()), 1, 1, 3, 1); Map<String, SVNLogEntryPath> changed = svn.getChangedPaths(); if (changed != null) { Tree changeTree = new Tree(sd.getFieldCaption("svn.changed", l) + "(" + changed.size() + ")"); Set<String> paths = changed.keySet(); for (String s : changed.keySet()) { changeTree.addItem(s); changeTree.setChildrenAllowed(s, false); changeTree.setItemCaption(s, changed.get(s).getType() + " " + s); } if (paths.size() > 5) { compressTree(changeTree, paths); } grid.addComponent(changeTree, 0, 2, 3, 2); } return p; }