List of usage examples for com.vaadin.ui Panel setWidth
@Override public void setWidth(String width)
From source file:org.openeos.erp.sales.ui.VaadinPrintDocumentUsertaskUI.java
License:Apache License
@SuppressWarnings("unchecked") @Override//from www.j av a2s . co m protected VerticalLayout createVaadinComponent(UserTask userTask, UIApplication<IUnoVaadinApplication> application) { EntityInfo info = extractEntity(userTask); String documentName = userTask.getMetaData(METADATA_PRINT_DOCUMENT_NAME); if (documentName == null || documentName.trim().length() == 0) { throw new IllegalArgumentException("The user task has not document meta data"); } System.out.print(info.classDefinition); final EntityDocument document = entityDocumentService .findDocument((Class<Object>) info.classDefinition.getClassDefined(), info.entity, documentName); if (document == null) { throw new RuntimeException("Document not found"); } final StreamSource streamSource = new StreamSource() { @Override public InputStream getStream() { try { return document.openInputStream(); } catch (IOException e) { throw new RuntimeException(e); } } }; final StreamResource resource = new StreamResource(streamSource, document.getName(), application.getConcreteApplication().getMainWindow().getApplication()); VerticalLayout layout = super.createVaadinComponent(userTask, application); Panel panel = createPanel("Documents"); panel.setWidth("100%"); Button buttonDocument = new Button(); buttonDocument.setStyleName(Reindeer.BUTTON_LINK); buttonDocument.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { event.getButton().getWindow().open(resource, document.getName()); } }); buttonDocument.setCaption(documentName); panel.addComponent(buttonDocument); layout.addComponent(panel); return layout; }
From source file:org.processbase.ui.core.template.DefaultConfirmDialogFactory.java
License:Open Source License
public ConfirmDialog create(final String caption, final String message, final String okCaption, final String cancelCaption) { // Create a confirm dialog final ConfirmDialog confirm = new ConfirmDialog(); confirm.setCaption(caption != null ? caption : DEFAULT_CAPTION); // Close listener implementation confirm.addListener(new Window.CloseListener() { private static final long serialVersionUID = 1971800928047045825L; public void windowClose(CloseEvent ce) { confirm.setConfirmed(false); if (confirm.getListener() != null) { confirm.getListener().onClose(confirm); }/*from w w w.j a v a 2s . com*/ } }); // Create content VerticalLayout c = (VerticalLayout) confirm.getContent(); c.setSizeFull(); c.setSpacing(true); // Panel for scrolling lengthty messages. Panel scroll = new Panel(new VerticalLayout()); scroll.setScrollable(true); c.addComponent(scroll); scroll.setWidth("100%"); scroll.setHeight("100%"); scroll.setStyleName(Reindeer.PANEL_LIGHT); c.setExpandRatio(scroll, 1f); // Always HTML, but escape Label text = new Label("", Label.CONTENT_RAW); scroll.addComponent(text); confirm.setMessageLabel(text); confirm.setMessage(message); HorizontalLayout buttons = new HorizontalLayout(); c.addComponent(buttons); buttons.setSpacing(true); buttons.setHeight(format(BUTTON_HEIGHT) + "em"); buttons.setWidth("100%"); Label spacer = new Label(""); buttons.addComponent(spacer); spacer.setWidth("100%"); buttons.setExpandRatio(spacer, 1f); final Button cancel = new Button(cancelCaption != null ? cancelCaption : DEFAULT_CANCEL_CAPTION); cancel.setData(false); cancel.setClickShortcut(KeyCode.ESCAPE, null); buttons.addComponent(cancel); buttons.setComponentAlignment(cancel, Alignment.MIDDLE_RIGHT); confirm.setCancelButton(cancel); final Button ok = new Button(okCaption != null ? okCaption : DEFAULT_OK_CAPTION); ok.setData(true); ok.setClickShortcut(KeyCode.ENTER, null); ok.setStyleName(Reindeer.BUTTON_DEFAULT); ok.focus(); buttons.addComponent(ok); buttons.setComponentAlignment(ok, Alignment.MIDDLE_RIGHT); confirm.setOkButton(ok); // Create a listener for buttons Button.ClickListener cb = new Button.ClickListener() { private static final long serialVersionUID = 3525060915814334881L; public void buttonClick(ClickEvent event) { // Copy the button date to window for passing through either // "OK" or "CANCEL" confirm.setConfirmed(event.getButton() == ok); // This has to be invoked as the window.close // event is not fired when removed. if (confirm.getListener() != null) { confirm.getListener().onClose(confirm); } confirm.close(); } }; cancel.addListener(cb); ok.addListener(cb); // Approximate the size of the dialog double[] dim = getDialogDimensions(message, ConfirmDialog.CONTENT_TEXT_WITH_NEWLINES); confirm.setWidth(format(dim[0]) + "em"); confirm.setHeight(format(dim[1]) + "em"); confirm.setResizable(false); return confirm; }
From source file:org.rdflivenews.annotator.gui.AnnotatorGuiApplication.java
License:Apache License
@Override public void init() { setMainWindow(main);/*from w w w. jav a2s. c om*/ 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.s23m.cell.editor.semanticdomain.ui.components.layout.ImpactAnalysisFormLayout.java
License:Mozilla Public License
private void init() { setMargin(true);//from ww w.j a v a 2 s .co m resultsPanel = new Panel(); resultsPanel.addStyleName(Runo.PANEL_LIGHT); resultsPanel.setWidth(RESULTS_PANEL_WIDTH); resultsPanel.setHeight(RESULTS_PANEL_HEIGHT); addComponent(resultsPanel); parent.getMainApplication().getMainWindow().showNotification("Processing results..."); final List<Set> dependentInstances = doImapactAnalysis( analysedSet.identity().uniqueRepresentationReference().toString()); this.pageIndex = 0; final Label lblTitle = new Label(); lblTitle.setValue( analysedSet.identity().name() + "<br/> can impact : " + dependentInstances.size() + " instaces(s)"); lblTitle.setContentMode(Label.CONTENT_XHTML); lblTitle.setStyleName("title-label"); resultsPanel.addComponent(lblTitle); if (dependentInstances.size() > 0) { final int startIndex = pageIndex * PAGE_SIZE; final int endIndex = startIndex + PAGE_SIZE; final Panel resultsContentPanel = new Panel(); resultsContentPanel.setWidth(RESULTS_CONTENT_PANEL_WIDTH); resultsContentPanel.setHeight(RESULTS_CONTENT_PANEL_HEIGHT); resultsPanel.addComponent(resultsContentPanel); buildResultsPage(dependentInstances, resultsContentPanel, startIndex, endIndex); } }
From source file:org.vaadin.dialogs.DefaultConfirmDialogFactory.java
License:Mozilla Public License
public ConfirmDialog create(final String caption, final String message, final String okCaption, final String cancelCaption) { // Create a confirm dialog final ConfirmDialog confirm = new ConfirmDialog(); confirm.setCaption(caption != null ? caption : DEFAULT_CAPTION); // Close listener implementation confirm.addListener(new Window.CloseListener() { private static final long serialVersionUID = 1971800928047045825L; public void windowClose(CloseEvent ce) { // Only process if still enabled if (confirm.isEnabled()) { confirm.setEnabled(false); // avoid double processing confirm.setConfirmed(false); if (confirm.getListener() != null) { confirm.getListener().onClose(confirm); }/*from w w w . j a v a2 s. c o m*/ } } }); // Create content VerticalLayout c = (VerticalLayout) confirm.getContent(); c.setSizeFull(); c.setSpacing(true); // Panel for scrolling lengthty messages. Panel scroll = new Panel(new VerticalLayout()); scroll.setScrollable(true); c.addComponent(scroll); scroll.setWidth("100%"); scroll.setHeight("100%"); scroll.setStyleName(Reindeer.PANEL_LIGHT); c.setExpandRatio(scroll, 1f); // Always HTML, but escape Label text = new Label("", Label.CONTENT_RAW); scroll.addComponent(text); confirm.setMessageLabel(text); confirm.setMessage(message); HorizontalLayout buttons = new HorizontalLayout(); c.addComponent(buttons); buttons.setSpacing(true); buttons.setHeight(format(BUTTON_HEIGHT) + "em"); buttons.setWidth("100%"); Label spacerLeft = new Label(""); buttons.addComponent(spacerLeft); spacerLeft.setWidth("100%"); buttons.setExpandRatio(spacerLeft, 1f); final Button cancel = new Button(cancelCaption != null ? cancelCaption : DEFAULT_CANCEL_CAPTION); cancel.setData(false); cancel.setClickShortcut(KeyCode.ESCAPE, null); buttons.addComponent(cancel); confirm.setCancelButton(cancel); final Button ok = new Button(okCaption != null ? okCaption : DEFAULT_OK_CAPTION); ok.setData(true); ok.setClickShortcut(KeyCode.ENTER, null); ok.focus(); buttons.addComponent(ok); confirm.setOkButton(ok); Label spacerRight = new Label(""); buttons.addComponent(spacerRight); spacerRight.setWidth("100%"); buttons.setExpandRatio(spacerRight, 1f); // Create a listener for buttons Button.ClickListener cb = new Button.ClickListener() { private static final long serialVersionUID = 3525060915814334881L; public void buttonClick(ClickEvent event) { // Copy the button date to window for passing through either // "OK" or "CANCEL". Only process id still enabled. if (confirm.isEnabled()) { confirm.setEnabled(false); // Avoid double processing confirm.setConfirmed(event.getButton() == ok); // We need to cast this way, because of the backward // compatibility issue in 6.4 series. Component parent = confirm.getParent(); if (parent instanceof Window) { try { Method m = Window.class.getDeclaredMethod("removeWindow", Window.class); m.invoke(parent, confirm); } catch (Exception e) { throw new RuntimeException( "Failed to remove confirmation dialog from the parent window.", e); } } // This has to be invoked as the window.close // event is not fired when removed. if (confirm.getListener() != null) { confirm.getListener().onClose(confirm); } } } }; cancel.addListener(cb); ok.addListener(cb); // Approximate the size of the dialog double[] dim = getDialogDimensions(message, ConfirmDialog.CONTENT_TEXT_WITH_NEWLINES); confirm.setWidth(format(dim[0]) + "em"); confirm.setHeight(format(dim[1]) + "em"); confirm.setResizable(false); return confirm; }
From source file:probe.com.view.body.quantdatasetsoverview.diseasegroupsfilters.PopupRecombineDiseaseGroups.java
private void initPopupLayout() { int h = 0;//(default_DiseaseCat_DiseaseGroupMap.size() * 33) + 300; for (Map<String, String> m : default_DiseaseCat_DiseaseGroupMap.values()) { if (h < m.size()) { h = m.size();//from ww w. j av a2s . c o m } } h = (h * 26) + 200; int w = 700; if (Page.getCurrent().getBrowserWindowHeight() - 280 < h) { h = Page.getCurrent().getBrowserWindowHeight() - 280; } if (Page.getCurrent().getBrowserWindowWidth() < w) { w = Page.getCurrent().getBrowserWindowWidth(); } popupWindow.setWidth(w + "px"); popupWindow.setHeight(h + "px"); popupBodyLayout.setWidth((w - 50) + "px"); Set<String> diseaseSet = Quant_Central_Manager.getDiseaseCategorySet(); diseaseTypeSelectionList.setDescription("Select disease category"); for (String disease : diseaseSet) { diseaseTypeSelectionList.addItem(disease); diseaseTypeSelectionList.setItemCaption(disease, (disease)); } HorizontalLayout diseaseCategorySelectLayout = new HorizontalLayout(); diseaseCategorySelectLayout.setWidthUndefined(); diseaseCategorySelectLayout.setHeight("50px"); diseaseCategorySelectLayout.setSpacing(true); diseaseCategorySelectLayout.setMargin(true); popupBodyLayout.addComponent(diseaseCategorySelectLayout); popupBodyLayout.setComponentAlignment(diseaseCategorySelectLayout, Alignment.TOP_LEFT); Label title = new Label("Disease Category"); title.setStyleName(Reindeer.LABEL_SMALL); diseaseCategorySelectLayout.addComponent(title); diseaseCategorySelectLayout.setComponentAlignment(title, Alignment.BOTTOM_CENTER); diseaseTypeSelectionList.setWidth("200px"); diseaseTypeSelectionList.setNullSelectionAllowed(false); diseaseTypeSelectionList.setValue("All"); diseaseTypeSelectionList.setImmediate(true); diseaseCategorySelectLayout.addComponent(diseaseTypeSelectionList); diseaseCategorySelectLayout.setComponentAlignment(diseaseTypeSelectionList, Alignment.TOP_LEFT); diseaseTypeSelectionList.setStyleName("diseaseselectionlist"); diseaseTypeSelectionList.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(Property.ValueChangeEvent event) { boolean showAll = false; String value = event.getProperty().getValue().toString(); if (value.equalsIgnoreCase("All")) { showAll = true; } for (String dName : diseaseGroupsGridLayoutMap.keySet()) { if (dName.equalsIgnoreCase(value) || showAll) { diseaseGroupsGridLayoutMap.get(dName).setVisible(true); } else { diseaseGroupsGridLayoutMap.get(dName).setVisible(false); } } } }); VerticalLayout diseaseGroupsNamesContainer = new VerticalLayout(); diseaseGroupsNamesContainer.setWidth("100%"); diseaseGroupsNamesContainer.setHeightUndefined(); popupBodyLayout.addComponent(diseaseGroupsNamesContainer); diseaseGroupsNamesContainer.setStyleName(Reindeer.LAYOUT_WHITE); GridLayout diseaseNamesHeader = new GridLayout(2, 1); diseaseNamesHeader.setWidth("100%"); diseaseNamesHeader.setHeightUndefined(); diseaseNamesHeader.setSpacing(true); diseaseNamesHeader.setMargin(new MarginInfo(true, false, true, false)); diseaseGroupsNamesContainer.addComponent(diseaseNamesHeader); Label col1Label = new Label("Group Name"); diseaseNamesHeader.addComponent(col1Label, 0, 0); col1Label.setStyleName(Reindeer.LABEL_SMALL); Label col2Label = new Label("Suggested Name"); diseaseNamesHeader.addComponent(col2Label, 1, 0); col2Label.setStyleName(Reindeer.LABEL_SMALL); Panel diseaseGroupsNamesFrame = new Panel(); diseaseGroupsNamesFrame.setWidth("100%"); diseaseGroupsNamesFrame.setHeight((h - 200) + "px"); diseaseGroupsNamesContainer.addComponent(diseaseGroupsNamesFrame); diseaseGroupsNamesFrame.setStyleName(Reindeer.PANEL_LIGHT); VerticalLayout diseaseNamesUpdateContainerLayout = new VerticalLayout(); for (String diseaseCategory : diseaseSet) { if (diseaseCategory.equalsIgnoreCase("All")) { continue; } HorizontalLayout diseaseNamesUpdateContainer = initDiseaseNamesUpdateContainer(diseaseCategory); diseaseNamesUpdateContainerLayout.addComponent(diseaseNamesUpdateContainer); diseaseGroupsGridLayoutMap.put(diseaseCategory, diseaseNamesUpdateContainer); } diseaseGroupsNamesFrame.setContent(diseaseNamesUpdateContainerLayout); HorizontalLayout btnLayout = new HorizontalLayout(); btnLayout.setMargin(true); btnLayout.setSpacing(true); Button resetFiltersBtn = new Button("Reset"); resetFiltersBtn.setPrimaryStyleName("resetbtn"); btnLayout.addComponent(resetFiltersBtn); resetFiltersBtn.setWidth("50px"); resetFiltersBtn.setHeight("24px"); resetFiltersBtn.setDescription("Reset group names to default"); resetFiltersBtn.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { resetToDefault(); } }); Button resetToOriginalBtn = new Button("Publications Names"); resetToOriginalBtn.setPrimaryStyleName("resetbtn"); btnLayout.addComponent(resetToOriginalBtn); resetToOriginalBtn.setWidth("150px"); resetToOriginalBtn.setHeight("24px"); resetToOriginalBtn.setDescription("Reset group names to original publication names"); resetToOriginalBtn.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { resetToPublicationsNames(); } }); Button applyFilters = new Button("Update"); applyFilters.setDescription("Update disease groups with the selected names"); applyFilters.setPrimaryStyleName("resetbtn"); applyFilters.setWidth("50px"); applyFilters.setHeight("24px"); btnLayout.addComponent(applyFilters); applyFilters.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { updateGroups(); } }); popupBodyLayout.addComponent(btnLayout); popupBodyLayout.setComponentAlignment(btnLayout, Alignment.MIDDLE_RIGHT); resetToDefault(); }
From source file:probe.com.view.body.quantdatasetsoverview.diseasegroupsfilters.popupreordergroups.SortableLayoutContainer.java
public SortableLayoutContainer(int w, int subH, final String strTitle, Set<String> labels, Map<String, String> diseaseStyleMap) { this.diseaseStyleMap = diseaseStyleMap; this.setStyleName(Reindeer.LAYOUT_WHITE); this.setSpacing(true); this.strTitle = strTitle; this.groupSelectionMap = new HashMap<String, Boolean>(); this.selectionSet = new LinkedHashSet<String>(); // this.fullSelectionSet = new LinkedHashSet<String>(); HorizontalLayout headerLayoutI = new HorizontalLayout(); Label titileI = new Label(strTitle); titileI.setStyleName("custLabel"); headerLayoutI.addComponent(titileI); this.addComponent(headerLayoutI); int containerWidth = ((w) / 2) - 20; this.setWidth(containerWidth + "px"); int height = subH - 15; headerLayoutI.setWidth(containerWidth + "px"); clearBtn = new Button("Clear"); clearBtn.setStyleName(Reindeer.BUTTON_LINK); clearBtn.setWidth("40px"); clearBtn.setHeight("18px"); clearBtn.setEnabled(false);//from w w w. ja va 2 s . c om headerLayoutI.addComponent(clearBtn); headerLayoutI.setComponentAlignment(clearBtn, Alignment.TOP_RIGHT); clearBtn.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { // autoClear = true; singleSelected = false; diseaseGroupSelectOption.setValue(null); } }); Panel bodyPanel = new Panel(); HorizontalLayout bodyLayout = new HorizontalLayout(); bodyLayout.setStyleName(Reindeer.LAYOUT_WHITE); bodyPanel.setContent(bodyLayout); this.addComponent(bodyPanel); bodyPanel.setHeight(subH + "px"); bodyPanel.setWidth((containerWidth) + "px"); counterLayoutContainer = new VerticalLayout(); bodyLayout.addComponent(counterLayoutContainer); counterLayoutContainer.setHeight(height + "px"); counterLayoutContainer.setWidth("30px"); counterLayoutContainer.setStyleName(Reindeer.LAYOUT_WHITE); counterLayout = new VerticalLayout(); counterLayoutContainer.addComponent(counterLayout); counterLayout.setWidth("30px"); counterLayout.setSpacing(false); counterLayout.setStyleName("countcontainer"); int sortableItremWidth = containerWidth - 26 - 6 - 15; sortableDiseaseGroupLayout = new SortableLayout(); bodyLayout.addComponent(sortableDiseaseGroupLayout); sortableDiseaseGroupLayout.setWidth(sortableItremWidth + "px"); sortableDiseaseGroupLayout.setData(strTitle); sortableDiseaseGroupLayout.addStyleName("no-horizontal-drag-hints"); checkboxLayout = new VerticalLayout(); bodyLayout.addComponent(checkboxLayout); checkboxLayout.setSpacing(false); checkboxLayout.setEnabled(false); checkboxLayout.setHeight(height + "px"); checkboxLayout.setStyleName("countcontainer"); checkboxLayout.setMargin(new MarginInfo(false, false, false, false)); diseaseGroupSelectOption = new OptionGroup(); checkboxLayout.addComponent(diseaseGroupSelectOption); checkboxLayout.setComponentAlignment(diseaseGroupSelectOption, Alignment.TOP_LEFT); // diseaseGroupSelectOption.setWidth("20px"); diseaseGroupSelectOption.setNullSelectionAllowed(true); // user can not 'unselect' diseaseGroupSelectOption.setMultiSelect(true); diseaseGroupSelectOption.addStyleName("sortablelayoutselect"); diseaseGroupSelectOption.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(Property.ValueChangeEvent event) { if (autoClear) { autoClear = false; return; } for (String key : groupSelectionMap.keySet()) { groupSelectionMap.put(key, Boolean.FALSE); } getSelectionSet().clear(); singleSelected = false; int counter = 0; for (Object key : ((Set) diseaseGroupSelectOption.getValue())) { if (((Integer) key) >= groupsIds.size()) { continue; } groupSelectionMap.put(groupsIds.get((Integer) key), Boolean.TRUE); singleSelected = true; counter++; getSelectionSet().add(groupsIds.get((Integer) key)); } if (counter == groupsIds.size()) { singleSelected = false; } } }); itemWidth = sortableItremWidth - 10; initLists(labels); }
From source file:ru.codeinside.gses.webui.manager.DirectoryPanel.java
License:Mozilla Public License
static Component createDirectoryPanel() { HorizontalSplitPanel horSplit = new HorizontalSplitPanel(); horSplit.setSizeFull();/*from w w w . j a v a2 s. c om*/ horSplit.setMargin(true); Panel panel00 = new Panel(); Panel panel01 = new Panel(); Panel panel10 = new Panel(); horSplit.setFirstComponent(panel00); VerticalLayout vl = new VerticalLayout(); horSplit.setSecondComponent(vl); vl.addComponent(panel01); vl.addComponent(panel10); vl.setSpacing(true); horSplit.setWidth("100%"); vl.setHeight("100%"); panel00.setHeight("100%"); panel00.setWidth("100%"); panel01.setWidth("100%"); panel01.setHeight("100%"); panel10.setHeight("100%"); horSplit.setSplitPosition(35); vl.setExpandRatio(panel01, 0.25f); vl.setExpandRatio(panel10, 0.75f); final Table dirMapTable = ManagerWorkplace.createDirectoryMapTable(); final FilterTable directoryTable = ManagerWorkplace.createDirectoryTable(); dirMapTable.setVisible(false); final Form createFieldForm = new Form(); createFieldForm.setCaption(" ? ?"); final TextField keyField = new TextField(""); keyField.setRequired(true); keyField.setMaxLength(254); createFieldForm.addField("key", keyField); final TextField valField = new TextField(""); valField.setRequired(true); valField.setMaxLength(1022); createFieldForm.addField("val", valField); createFieldForm.setVisible(false); Button addButton = new Button("", new AddTupleButtonListener(createFieldForm, directoryTable, keyField, valField, dirMapTable)); createFieldForm.addField("submit", addButton); directoryTable.addListener(new DirectoryTableChangeListener(createFieldForm, directoryTable, dirMapTable)); ManagerWorkplace.buildContainer(directoryTable, createFieldForm, dirMapTable); directoryTable.setColumnHeaders(new String[] { "?", "", "" }); final Form createDirectory = new Form(); createDirectory.setCaption(" ?"); final TextField field = new TextField("?"); field.setRequired(true); field.setMaxLength(255); field.setRequiredError(" ?"); createDirectory.addField("name", field); Button createButton = new Button("", new CreateDirectoryButtonListener(field, createDirectory, directoryTable)); createDirectory.addField("submit", createButton); Panel loadPanel = new Panel(); loadPanel.setCaption(" ?"); UploadDirectory events = new UploadDirectory(directoryTable, dirMapTable); Upload c = new Upload("", events); c.addListener(events); c.setButtonCaption(""); loadPanel.addComponent(c); VerticalLayout verticalLayout = new VerticalLayout(); verticalLayout.setSizeFull(); verticalLayout.setSpacing(true); verticalLayout.addComponent(loadPanel); verticalLayout.addComponent(createDirectory); verticalLayout.addComponent(directoryTable); panel00.addComponent(verticalLayout); panel01.addComponent(createFieldForm); dirMapTable.setSizeFull(); dirMapTable.setPageLength(13); panel10.addComponent(dirMapTable); return horSplit; }
From source file:ru.codeinside.gses.webui.manager.ManagerWorkplace.java
License:Mozilla Public License
private Component createProcedurePanel1() { HorizontalLayout hl = new HorizontalLayout(); hl.setSpacing(true);//from w w w. j a va 2 s. co m hl.setWidth("100%"); hl.setHeight("100%"); Panel panel00 = new Panel(); panel00.setHeight("100%"); panel00.setWidth("100%"); Panel panel01 = new Panel(); panel01.setWidth("100%"); panel01.setHeight("100%"); Panel panel10 = new Panel(); panel10.setSizeFull(); panel10.setScrollable(false); hl.addComponent(panel00); hl.addComponent(panel01); VerticalLayout vl = new VerticalLayout(); vl.setSizeFull(); vl.setMargin(true); vl.setSpacing(true); vl.addComponent(hl); vl.addComponent(panel10); hl.setExpandRatio(panel00, 0.33f); hl.setExpandRatio(panel01, 0.77f); vl.setExpandRatio(hl, 0.6f); vl.setExpandRatio(panel10, 0.4f); procedureForm = new ProcedureForm(); procedureTable = new ProcedureTable(procedureForm); filter = createFilteringForm(procedureTable); panel00.addComponent(filter); panel01.addComponent(procedureForm); panel10.addComponent(procedureTable); ap.addItemSetChangeListener(filter); ap.addItemSetChangeListener(procedureForm); return vl; }
From source file:steps.FinishStep.java
License:Open Source License
public FinishStep(final Wizard w, AttachmentConfig attachmentConfig) { this.w = w;//from ww w .j a v a2 s . c om this.attachConfig = attachmentConfig; main = new VerticalLayout(); main.setMargin(true); main.setSpacing(true); Label header = new Label("Summary and File Upload"); main.addComponent(Styles.questionize(header, "Here you can download spreadsheets of the samples in your experiment " + "and upload informative files belonging to your project, e.g. treatment information. " + "It might take a few minutes for your files to show up in our project browser.", "Last Step")); summary = new Label(); summary.setContentMode(ContentMode.PREFORMATTED); Panel summaryPane = new Panel(); summaryPane.setContent(summary); summaryPane.setWidth("550px"); main.addComponent(summaryPane); downloads = new VerticalLayout(); downloads.setCaption("Download Spreadsheets:"); downloads.setSpacing(true); dlEntities = new Button("Sample Sources"); dlExtracts = new Button("Sample Extracts"); dlPreps = new Button("Sample Preparations"); dlEntities.setEnabled(false); dlExtracts.setEnabled(false); dlPreps.setEnabled(false); downloads.addComponent(dlEntities); downloads.addComponent(dlExtracts); downloads.addComponent(dlPreps); this.bar = new ProgressBar(); this.info = new Label(); info.setCaption("Preparing Spreadsheets"); main.addComponent(bar); main.addComponent(info); main.addComponent(downloads); browserLink = new Button("Show in Project Browser"); main.addComponent(browserLink); attach = new CheckBox("Upload Additional Files"); // attach.setVisible(false); attach.addValueChangeListener(new ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { uploads.setVisible(attach.getValue()); w.getFinishButton().setVisible(!attach.getValue()); } }); main.addComponent(Styles.questionize(attach, "Upload one or more small files pertaining to the experimental design of this project.", "Upload Attachments")); }