List of usage examples for com.vaadin.ui Label setHeight
@Override public void setHeight(String height)
From source file:probe.com.view.body.QuantCompareDataLayout.java
private VerticalLayout initSelectEnterDatasetDiseaseGroups(int width) { VerticalLayout selectDiseaseGroupsMainLayout = new VerticalLayout(); selectDiseaseGroupsMainLayout.setMargin(new MarginInfo(true, false, false, true)); selectDiseaseGroupsMainLayout.setSpacing(true); Label titleLabel = new Label("1. Select/Enter Dataset Disease Groups"); titleLabel.setContentMode(ContentMode.HTML); titleLabel.setStyleName("normalheader"); titleLabel.setHeight("20px"); selectDiseaseGroupsMainLayout.addComponent(titleLabel); selectDiseaseGroupsMainLayout.setComponentAlignment(titleLabel, Alignment.TOP_LEFT); HorizontalLayout selectionResultsContainer = new HorizontalLayout(); // selectionResultsContainer.setStyleName("diseasegroupselectionresult"); String containerWidth = ((width * 2) + 10) + "px"; selectionResultsContainer.setWidth(containerWidth); selectDiseaseGroupsMainLayout.setWidth(containerWidth); selectionResultsContainer.addComponent(selectionResultsLabel); selectionResultsLabel.setStyleName(Reindeer.LABEL_SMALL); // selectionResultsLabel.setValue("Selection: Group A / Group B"); // miniselectionResultsLabel.setValue("( Group A / Group B )"); Property.ValueChangeListener diseaseGroupsListListener = new Property.ValueChangeListener() { @Override/*ww w . j a v a 2 s .c o m*/ public void valueChange(Property.ValueChangeEvent event) { String value = "Selection: "; if (diseaseGroupsListA.getValue() != null) { diseaseGroupsListA.setRequired(false); value += diseaseGroupsListA.getValue().toString(); useRowSorter = diseaseGroupNames.contains(diseaseGroupsListA.getValue().toString().trim()); } if (diseaseGroupsListB.getValue() != null) { diseaseGroupsListB.setRequired(false); value += " / " + diseaseGroupsListB.getValue().toString(); useColumnSorter = diseaseGroupNames.contains(diseaseGroupsListB.getValue().toString().trim()); // reset(); } selectionResultsLabel.setValue(value); miniselectionResultsLabel.setValue(value); if ((diseaseGroupsListA.getValue() != null) && (diseaseGroupsListB.getValue() != null)) { if (diseaseGroupsListA.getValue().toString().trim() .equalsIgnoreCase(diseaseGroupsListB.getValue().toString().trim())) { useRowSorter = useColumnSorter = false; } } } }; HorizontalLayout diseaseGroupsListsContainer = new HorizontalLayout(); selectDiseaseGroupsMainLayout.addComponent(diseaseGroupsListsContainer); diseaseGroupsListsContainer.setWidth(containerWidth); diseaseGroupsListA.setStyleName("diseasegrouplist"); diseaseGroupsListA.setNullSelectionAllowed(false); diseaseGroupsListA.setImmediate(true); diseaseGroupsListA.setNewItemsAllowed(true); diseaseGroupsListA.setWidth(width, Unit.PIXELS); diseaseGroupsListA.setInputPrompt("Select or enter new disease group name"); diseaseGroupsListA.setRequiredError("Select or enter new disease group name"); diseaseGroupsListB.setStyleName("diseasegrouplist"); diseaseGroupsListB.setNullSelectionAllowed(false); diseaseGroupsListB.setRequiredError("Select or enter new disease group name"); diseaseGroupsListB.setImmediate(true); diseaseGroupsListB.setNewItemsAllowed(true); diseaseGroupsListB.setWidth(width, Unit.PIXELS); diseaseGroupsListB.setInputPrompt("Select or enter new disease group name"); selectDiseaseGroupsMainLayout.addComponent(selectionResultsContainer); diseaseGroupsListsContainer.addComponent(diseaseGroupsListA); diseaseGroupsListsContainer.addComponent(diseaseGroupsListB); diseaseGroupsListsContainer.setComponentAlignment(diseaseGroupsListB, Alignment.TOP_RIGHT); this.resetLists(); diseaseGroupsListA.addValueChangeListener(diseaseGroupsListListener); diseaseGroupsListB.addValueChangeListener(diseaseGroupsListListener); diseaseGroupsListA.setNewItemHandler(new AbstractSelect.NewItemHandler() { @Override public void addNewItem(String newItemCaption) { diseaseGroupsListA.addItem(newItemCaption); diseaseGroupsListA.select(newItemCaption); } }); diseaseGroupsListB.setNewItemHandler(new AbstractSelect.NewItemHandler() { @Override public void addNewItem(String newItemCaption) { diseaseGroupsListB.addItem(newItemCaption); diseaseGroupsListB.select(newItemCaption); } }); return selectDiseaseGroupsMainLayout;//new HideOnClickLayout("Select/Enter Dataset Disease Groups", proteinsDataCapturingMainLayout, miniSelectDiseaseGroupsLayout, Alignment.TOP_LEFT, null, null); }
From source file:probe.com.view.body.QuantCompareDataLayout.java
private VerticalLayout initProteinsDataCapture(int width) { VerticalLayout proteinsDataCapturingMainLayout = new VerticalLayout(); proteinsDataCapturingMainLayout.setSpacing(true); proteinsDataCapturingMainLayout.setMargin(true); String containerWidth = ((width * 2) + 10) + "px"; proteinsDataCapturingMainLayout.setWidth(containerWidth); proteinsDataCapturingMainLayout.setSpacing(true); Label titleLabel = new Label("2. Insert UniProt Proteins Accessions"); titleLabel.setContentMode(ContentMode.HTML); titleLabel.setStyleName("normalheader"); titleLabel.setHeight("20px"); proteinsDataCapturingMainLayout.addComponent(titleLabel); proteinsDataCapturingMainLayout.setComponentAlignment(titleLabel, Alignment.TOP_LEFT); GridLayout insertProteinsLayout = new GridLayout(3, 3); proteinsDataCapturingMainLayout.addComponent(insertProteinsLayout); insertProteinsLayout.setSpacing(true); insertProteinsLayout.setMargin(new MarginInfo(false, false, false, false)); insertProteinsLayout.setWidth(containerWidth); HorizontalLayout hlo1 = new HorizontalLayout(); hlo1.setWidth("100%"); hlo1.setMargin(new MarginInfo(false, true, false, false)); Label highLabel = new Label("<font color='#cc0000'> High</font>"); highLabel.setWidth("40px"); highLabel.setContentMode(ContentMode.HTML); hlo1.addComponent(highLabel);//from www. j a v a2s. co m HorizontalLayout hlo2 = new HorizontalLayout(); hlo2.setWidth("100%"); hlo2.setMargin(new MarginInfo(false, true, false, false)); Label stableLabel = new Label("<font color='#018df4'> Stable</font>"); stableLabel.setWidth("50px"); stableLabel.setContentMode(ContentMode.HTML); hlo2.addComponent(stableLabel); HorizontalLayout hlo3 = new HorizontalLayout(); hlo3.setWidth("100%"); hlo3.setMargin(new MarginInfo(false, true, false, false)); Label lowLabel = new Label("<font color='#009900'> Low</font>"); lowLabel.setWidth("40px"); lowLabel.setContentMode(ContentMode.HTML); hlo3.addComponent(lowLabel); insertProteinsLayout.addComponent(hlo1, 0, 0); insertProteinsLayout.setComponentAlignment(hlo1, Alignment.MIDDLE_CENTER); insertProteinsLayout.addComponent(hlo2, 1, 0); insertProteinsLayout.setComponentAlignment(hlo2, Alignment.MIDDLE_CENTER); insertProteinsLayout.addComponent(hlo3, 2, 0); insertProteinsLayout.setComponentAlignment(hlo3, Alignment.MIDDLE_CENTER); highTextArea.setWidth("100%"); highTextArea.setHeight("200px"); insertProteinsLayout.addComponent(highTextArea, 0, 1); insertProteinsLayout.setComponentAlignment(highTextArea, Alignment.MIDDLE_CENTER); stableTextArea.setWidth("100%"); stableTextArea.setHeight("200px"); insertProteinsLayout.addComponent(stableTextArea, 1, 1); insertProteinsLayout.setComponentAlignment(stableTextArea, Alignment.MIDDLE_CENTER); lowTextArea.setWidth("100%"); lowTextArea.setHeight("200px"); insertProteinsLayout.addComponent(lowTextArea, 2, 1); insertProteinsLayout.setComponentAlignment(lowTextArea, Alignment.MIDDLE_CENTER); VerticalLayout clear1 = new VerticalLayout(); hlo1.addComponent(clear1); clear1.setDescription("Clear field"); clear1.setStyleName("clearfieldbtn"); clear1.setWidth("20px"); clear1.setHeight("20px"); // insertProteinsLayout.addComponent(clear1, 0, 2); hlo1.setComponentAlignment(clear1, Alignment.MIDDLE_RIGHT); clear1.addLayoutClickListener(new LayoutEvents.LayoutClickListener() { @Override public void layoutClick(LayoutEvents.LayoutClickEvent event) { highTextArea.clear(); } }); VerticalLayout clear2 = new VerticalLayout(); hlo2.addComponent(clear2); clear2.setDescription("Clear field"); clear2.setStyleName("clearfieldbtn"); clear2.setWidth("20px"); clear2.setHeight("20px"); clear2.addLayoutClickListener(new LayoutEvents.LayoutClickListener() { @Override public void layoutClick(LayoutEvents.LayoutClickEvent event) { stableTextArea.clear(); } }); hlo2.setComponentAlignment(clear2, Alignment.MIDDLE_RIGHT); VerticalLayout clear3 = new VerticalLayout(); hlo3.addComponent(clear3); clear3.setDescription("Clear field"); clear3.setStyleName("clearfieldbtn"); clear3.setWidth("20px"); clear3.setHeight("20px"); clear3.addLayoutClickListener(new LayoutEvents.LayoutClickListener() { @Override public void layoutClick(LayoutEvents.LayoutClickEvent event) { lowTextArea.clear(); } }); hlo3.setComponentAlignment(clear3, Alignment.MIDDLE_RIGHT); Label errorLabel = new Label(); proteinsDataCapturingMainLayout.addComponent(errorLabel); HorizontalLayout btnsLayout = new HorizontalLayout(); btnsLayout.setSpacing(true); btnsLayout.setMargin(new MarginInfo(true, false, false, false)); proteinsDataCapturingMainLayout.addComponent(btnsLayout); proteinsDataCapturingMainLayout.setComponentAlignment(btnsLayout, Alignment.MIDDLE_RIGHT); Button sampleBtn = new Button("Sample"); sampleBtn.setStyleName(Reindeer.BUTTON_SMALL); btnsLayout.addComponent(sampleBtn); sampleBtn.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { reset(); highTextArea.setValue(highAcc); lowTextArea.setValue(lowAcc); stableTextArea.setValue(stableAcc); diseaseGroupsListA.select("Group A"); diseaseGroupsListB.select("Group B"); compareBtn.focus(); } }); Button resetBtn = new Button("Reset"); resetBtn.setStyleName(Reindeer.BUTTON_SMALL); btnsLayout.addComponent(resetBtn); resetBtn.setId("resetBtn"); resetBtn.addClickListener(this); compareBtn = new Button("Compare"); compareBtn.setStyleName(Reindeer.BUTTON_SMALL); btnsLayout.addComponent(compareBtn); compareBtn.setId("compareBtn"); compareBtn.addClickListener(this); // highTextArea.setValue(highAcc); // lowTextArea.setValue(lowAcc); // stableTextArea.setValue(stableAcc); return proteinsDataCapturingMainLayout; }
From source file:probe.com.view.body.welcomelayout.PublicationsInformationWindow.java
private VerticalLayout initPublicationLayout(Object[] publicationData) { VerticalLayout publicationlayout = new VerticalLayout(); publicationlayout.setWidth("500px"); publicationlayout.setHeightUndefined(); publicationlayout.setSpacing(true);//from w w w .ja va 2 s . c o m publicationlayout.setMargin(new MarginInfo(false, false, false, false)); publicationlayout.setStyleName("publicationstyle"); Label pubmedIdLabel = new Label( "<h5>Pubmed Id: <a href='http://www.ncbi.nlm.nih.gov/pubmed/" + publicationData[0].toString() + "' target='_blank' ><font style:'text-decoration:underline !important;'>" + publicationData[0].toString() + "</font></a></h5>"); pubmedIdLabel.setContentMode(ContentMode.HTML); publicationlayout.addComponent(pubmedIdLabel); pubmedIdLabel.setHeight("40px"); Label proteinsNumLabel = new Label("<h5>#Proteins: " + publicationData[5].toString() + "</h5>"); proteinsNumLabel.setDescription("Number of publication proteins " + publicationData[4].toString()); proteinsNumLabel.setContentMode(ContentMode.HTML); publicationlayout.addComponent(proteinsNumLabel); proteinsNumLabel.setHeight("40px"); Label uproteinsNumLabel = new Label( "<h5>#Publication Specific Proteins: " + publicationData[4].toString() + "</h5>"); uproteinsNumLabel .setDescription("Number of publication specific proteins " + publicationData[4].toString()); uproteinsNumLabel.setContentMode(ContentMode.HTML); publicationlayout.addComponent(uproteinsNumLabel); uproteinsNumLabel.setHeight("40px"); Label PeptidesNumLabel = new Label("<h5>#Peptides: " + publicationData[7].toString() + "</h5>"); PeptidesNumLabel.setContentMode(ContentMode.HTML); publicationlayout.addComponent(PeptidesNumLabel); PeptidesNumLabel.setDescription("Number of publication peptides " + publicationData[7].toString()); PeptidesNumLabel.setHeight("40px"); Label uPeptidesNumLabel = new Label( "<h5>#Publication Specific Peptides: " + publicationData[6].toString() + "</h5>"); uPeptidesNumLabel.setContentMode(ContentMode.HTML); publicationlayout.addComponent(uPeptidesNumLabel); uPeptidesNumLabel .setDescription("Number of publication specific peptides " + publicationData[6].toString()); uPeptidesNumLabel.setHeight("40px"); Label titleLabel = new Label( "<textarea rows='5' cols='52' readonly >" + publicationData[3].toString() + "</textarea>"); titleLabel.setContentMode(ContentMode.HTML); publicationlayout.addComponent(titleLabel); titleLabel.setHeight("100px"); return publicationlayout; }
From source file:probe.com.view.core.QuantDataUploader.java
/** * initialize the upload unit layout/* ww w . j a v a 2 s .c o m*/ */ private void initLayouts() { Label selectFileTitle = new Label( "<h4 style='font-family:verdana;font-weight:bold;'><strong aligen='center' style='font-family:verdana;color:#00000;'>Upload New File</strong></h4>"); selectFileTitle.setContentMode(ContentMode.HTML); selectFileTitle.setHeight("45px"); selectFileTitle.setWidth("100%"); this.addComponent(selectFileTitle); this.setComponentAlignment(selectFileTitle, Alignment.TOP_CENTER); upload = new Upload(null, this); upload.setStyleName("small"); upload.setVisible(true); upload.setHeight("30px"); upload.setWidth("100%"); upload.setButtonCaption("UPLOAD ADD / EDIT EXPERIMENT"); upload.addSucceededListener(this); this.addComponent(upload); }
From source file:rs.pupin.jpo.esta_ld.EndpointWindow.java
@Override public void attach() { super.attach(); // add endpoint field Label lbl = new Label("Endpoint:"); lbl.setSizeUndefined();//from w ww.j a v a 2s .co m settingsLayout.addComponent(lbl, 0, 0, 0, 0); settingsLayout.setComponentAlignment(lbl, Alignment.MIDDLE_LEFT); endpointInput = new TextField(); endpointInput.setValue(state.endpoint); endpointInput.setWidth("100%"); settingsLayout.addComponent(endpointInput, 1, 0, 1, 0); settingsLayout.setComponentAlignment(endpointInput, Alignment.MIDDLE_RIGHT); // add blank row lbl = new Label(""); lbl.setHeight("30px"); settingsLayout.addComponent(lbl, 0, 1, 1, 1); // add buttons HorizontalLayout hl = new HorizontalLayout(); hl.setSpacing(true); hl.setSizeUndefined(); btnOK = new Button("OK"); btnCancel = new Button("Cancel"); hl.addComponent(btnOK); hl.addComponent(btnCancel); settingsLayout.addComponent(hl, 1, 2); settingsLayout.setComponentAlignment(hl, Alignment.MIDDLE_RIGHT); createListeners(); center(); }
From source file:rs.pupin.jpo.esta_ld.EstaLdComponent.java
private void refreshDimensions() { // clean everything just in case dimLayout.removeAllComponents();/*from www. j a va 2 s .co m*/ geoDimension = null; timeDimension = null; measures = null; btnGeo = null; boxGeo = null; dimNames = null; dimValues = null; if (selectDataSet.getValue() == null) return; // VerticalLayout lLayout = new VerticalLayout(); // lLayout.setSizeUndefined(); // lLayout.setSpacing(true); // lLayout.setDebugId("dim-btn-layout"); // dimLayout.addComponent(lLayout); // VerticalLayout rLayout = new VerticalLayout(); // rLayout.setSizeUndefined(); // rLayout.setSpacing(true); // rLayout.setWidth("100%"); // dimLayout.addComponent(rLayout); // dimLayout.setExpandRatio(rLayout, 2.0f); final DataSet ds = (DataSet) selectDataSet.getValue(); measures = ds.getStructure().getMeasures(); StringBuilder builderMeasures = new StringBuilder(); StringBuilder builderMeasureNames = new StringBuilder(); for (Measure m : measures) { builderMeasures.append(", '"); builderMeasures.append(m.getUri()); builderMeasures.append("'"); if (m.getLabel() != null) { builderMeasureNames.append(", '"); builderMeasureNames.append(m.getLabel()); builderMeasureNames.append("'"); } else { builderMeasureNames.append(", undefined"); } } builderMeasureNames.replace(0, 2, "[").append("]"); builderMeasures.replace(0, 2, "javaSetMeasures(["); builderMeasures.append("], ").append(builderMeasureNames.toString()).append(")"); getWindow().executeJavaScript(builderMeasures.toString()); measName = new Button("Measure"); // measName.setSizeUndefined(); // measName.setWidth("100%"); measName.setHeight(CONTENT_ELEM_HEIGHT); measName.setWidth(CONTENT_ELEM_WIDTH); measName.addStyleName("dim-name"); measName.addStyleName("unselectable"); measValues = new ComboBox(null, measures); measValues.setImmediate(true); measValues.setSizeUndefined(); measValues.setWidth("100%"); measValues.setHeight(CONTENT_ELEM_HEIGHT); measValues.addStyleName("dim-value"); measValues.setNullSelectionAllowed(false); measValues.select(measures.iterator().next()); measValues.addListener(dimListener); // measValues.addListener(new Property.ValueChangeListener() { // public void valueChange(Property.ValueChangeEvent event) { // Measure m = (Measure)event.getProperty().getValue(); // // put measure in // } // }); int rowIndex = 0; int columnIndex = 0; dimLayout.addComponent(measName, columnIndex, rowIndex); columnIndex++; // dimLayout.setExpandRatio(measName, 2.0f); dimLayout.addComponent(measValues, columnIndex, rowIndex, columnIndex + 1, rowIndex); columnIndex += 2; // dimLayout.setComponentAlignment(measValues, Alignment.BOTTOM_LEFT); LinkedList<Dimension> dimsForShow = new LinkedList<Dimension>(); for (Dimension dim : ds.getStructure().getDimensions()) { if (dim.isGeoDimension()) geoDimension = dim; else if (dim.isTimeDimension()) { timeDimension = dim; dimsForShow.addFirst(dim); } else dimsForShow.add(dim); } dimNames = new Button[dimsForShow.size()]; dimAggregIndicators = new Label[dimsForShow.size()]; dimValues = new ComboBox[dimsForShow.size()]; int i = 0; StringBuilder builderPossibleValues = new StringBuilder(); boolean firstPass = true; for (Dimension dim : dimsForShow) { // add dimension pick // first create a button to represent dimension name final Button btnName = new Button(dim.toString()); // btnName.setSizeUndefined(); // btnName.setWidth("100%"); btnName.setHeight(CONTENT_ELEM_HEIGHT); btnName.setWidth(CONTENT_ELEM_WIDTH); btnName.setData(dim); btnName.addStyleName("dim-name"); if (firstPass) { btnName.addStyleName("selected"); firstPass = false; } btnName.addListener(new Button.ClickListener() { public void buttonClick(Button.ClickEvent event) { if (btnName.getStyleName().contains("selected")) { btnName.removeStyleName("selected"); } else { btnName.addStyleName("selected"); } freeDimensionsChanged(); } }); dimNames[i] = btnName; final Label btnAggreg = new Label("<span>Σ</span>", Label.CONTENT_XHTML); btnAggreg.setWidth("30px"); btnAggreg.setHeight(CONTENT_ELEM_HEIGHT); btnAggreg.setData(dim); btnAggreg.addStyleName("dim-name"); btnAggreg.addStyleName("dim-aggreg"); // this will have to go to the layout listener // btnAggreg.addListener(new Button.ClickListener() { // public void buttonClick(Button.ClickEvent event) { // if (btnAggreg.getStyleName().contains("selected")) { // btnAggreg.removeStyleName("selected"); // } else { // btnAggreg.addStyleName("selected"); // aggregDimensionsChanged(); // } // } // }); dimAggregIndicators[i] = btnAggreg; // create a combo box for picking dimension value Collection<Value> vals = ds.getValuesForDimension(dim); Collection<ValueWrapper> valsWrapped = new LinkedList<ValueWrapper>(); for (Value v : vals) valsWrapped.add(new ValueWrapper(v)); builderPossibleValues.append(",").append(stringifyCollection(vals)); ComboBox boxValue = new ComboBox(null, valsWrapped); boxValue.setImmediate(true); boxValue.setNullSelectionAllowed(false); if (valsWrapped.iterator().hasNext()) boxValue.select(valsWrapped.iterator().next()); else boxValue.setEnabled(false); boxValue.setSizeUndefined(); boxValue.setWidth("100%"); boxValue.setHeight(CONTENT_ELEM_HEIGHT); boxValue.addStyleName("dim-value"); boxValue.addListener(dimListener); dimValues[i] = boxValue; // put them in a horizontal layout and add to the view // HorizontalLayout layout = new HorizontalLayout(); // layout.setSizeUndefined(); // layout.setWidth("100%"); // layout.setSpacing(true); // dimLayout.addComponent(layout); // dimLayout.setExpandRatio(layout, 2.0f); // layout.addComponent(btnName); // layout.addComponent(boxValue); // layout.setExpandRatio(boxValue, 2.0f); // lLayout.addComponent(btnName); // lLayout.setExpandRatio(btnName, 2.0f); // rLayout.addComponent(boxValue); // rLayout.setComponentAlignment(boxValue, Alignment.BOTTOM_LEFT); dimLayout.addComponent(btnName, columnIndex, rowIndex); if (++columnIndex == 6) { columnIndex = 0; rowIndex++; dimLayout.setRows(rowIndex + 1); } dimLayout.addComponent(btnAggreg, columnIndex, rowIndex); if (++columnIndex == 6) { columnIndex = 0; rowIndex++; dimLayout.setRows(rowIndex + 1); } dimLayout.addComponent(boxValue, columnIndex, rowIndex); if (++columnIndex == 6) { columnIndex = 0; rowIndex++; dimLayout.setRows(rowIndex + 1); } i++; } if (timeDimension != null) getWindow().executeJavaScript("javaSetHasTimeDimension(true)"); else getWindow().executeJavaScript("javaSetHasTimeDimension(false)"); if (geoDimension != null) { btnGeo = new Button(geoDimension.toString()); // btnGeo.setSizeUndefined(); // btnGeo.setWidth("100%"); btnGeo.setHeight(CONTENT_ELEM_HEIGHT); btnGeo.setWidth(CONTENT_ELEM_WIDTH); btnGeo.setData(geoDimension); btnGeo.addStyleName("dim-name"); btnGeo.addStyleName("geo-name"); btnGeo.addListener(new Button.ClickListener() { public void buttonClick(Button.ClickEvent event) { if (btnGeo.getStyleName().contains("selected")) { btnGeo.removeStyleName("selected"); } else { btnGeo.addStyleName("selected"); } freeDimensionsChanged(); } }); btnAggregGeo = new Label("<span>Σ</span>", Label.CONTENT_XHTML); btnAggregGeo.setHeight(CONTENT_ELEM_HEIGHT); btnAggregGeo.setData(geoDimension); btnAggregGeo.addStyleName("dim-name"); btnAggregGeo.addStyleName("dim-aggreg"); StringBuilder builder = new StringBuilder(); Collection<Value> posVals = ds.getValuesForDimension(geoDimension); Collection<ValueWrapper> posValsWrapped = new LinkedList<ValueWrapper>(); for (Value v : posVals) posValsWrapped.add(new ValueWrapper(v)); Value selectedVal = posVals.iterator().next(); String selectedValString = ""; if (selectedVal instanceof URI) { selectedValString = "<" + selectedVal.stringValue() + ">"; } else { selectedValString = "\"" + selectedVal.stringValue() + "\""; URI dataType = ((Literal) selectedVal).getDatatype(); if (dataType != null && !dataType.stringValue().contains("string")) { selectedValString += "^^<" + dataType.stringValue() + ">"; } } builder.append("javaSetGeoAll('").append(geoDimension.getUri()); builder.append("',").append(stringifyCollection(posVals)); builder.append(",'").append(selectedValString).append("',true)"); boxGeo = new ComboBox(null, posValsWrapped); boxGeo.setData(posVals); boxGeo.setImmediate(true); boxGeo.setNullSelectionAllowed(false); boxGeo.select(posValsWrapped.iterator().next()); boxGeo.setSizeUndefined(); boxGeo.setWidth("100%"); boxGeo.setHeight(CONTENT_ELEM_HEIGHT); boxGeo.addStyleName("geo-value"); boxGeo.addListener(geoListener); // lLayout.addComponent(btnGeo); // lLayout.setExpandRatio(btnGeo, 2.0f); // rLayout.addComponent(boxGeo); // rLayout.setComponentAlignment(boxGeo, Alignment.BOTTOM_LEFT); dimLayout.addComponent(btnGeo, columnIndex, rowIndex); columnIndex++; dimLayout.addComponent(btnAggregGeo, columnIndex, rowIndex); columnIndex++; dimLayout.addComponent(boxGeo, columnIndex, rowIndex); columnIndex++; getWindow().executeJavaScript(builder.toString()); } else { getWindow().executeJavaScript("javaSetGeoAll('',[],'',true)"); } // TODO cover the case where there is more than 1 geo dimension builderPossibleValues.replace(0, 1, "javaSetPossibleValues(["); builderPossibleValues.append("])"); getWindow().executeJavaScript(builderPossibleValues.toString()); if (dimsForShow.isEmpty()) { if (geoDimension != null) getWindow().executeJavaScript("javaSetGeoFree(true)"); else getWindow().executeJavaScript("javaSetGeoFree(false)"); getWindow().executeJavaScript("javaSetFreeDimensions([], true)"); } else { getWindow().executeJavaScript("javaSetGeoFree(false)"); getWindow().executeJavaScript("javaSetFreeDimensions([0], true)"); } dimListener.valueChange(null); getWindow().executeJavaScript("setTimeout(expandDimNameButtons(),200)"); }
From source file:rs.pupin.jpo.validation.gui.ValidationSettingsWindow.java
@Override public void attach() { // add endpoint field Label lbl = new Label("Endpoint:"); lbl.setSizeUndefined();//from w ww . j ava 2 s.c om settingsLayout.addComponent(lbl, 0, 0, 0, 0); settingsLayout.setComponentAlignment(lbl, Alignment.MIDDLE_LEFT); endpointInput = new TextField(); endpointInput.setValue(state.endpoint); endpointInput.setWidth("100%"); settingsLayout.addComponent(endpointInput, 1, 0, 1, 0); // add graph field lbl = new Label("Graph:"); lbl.setSizeUndefined(); settingsLayout.addComponent(lbl, 0, 1, 0, 1); settingsLayout.setComponentAlignment(lbl, Alignment.MIDDLE_LEFT); graphInput = new TextField(); graphInput.setValue(state.graph); graphInput.setWidth("100%"); settingsLayout.addComponent(graphInput, 1, 1, 1, 1); lbl = new Label(""); lbl.setHeight("30px"); settingsLayout.addComponent(lbl, 0, 2, 1, 2); // add basic authentication check box authCheckBox = new CheckBox("Use basic authentication"); authCheckBox.setSizeUndefined(); settingsLayout.addComponent(authCheckBox, 0, 3, 1, 3); settingsLayout.setComponentAlignment(authCheckBox, Alignment.MIDDLE_LEFT); // add username field lbl = new Label("Username:"); lbl.setSizeUndefined(); settingsLayout.addComponent(lbl, 0, 4); settingsLayout.setComponentAlignment(lbl, Alignment.MIDDLE_LEFT); usernameInput = new TextField(); usernameInput.setWidth("100%"); usernameInput.setEnabled(false); settingsLayout.addComponent(usernameInput, 1, 4); settingsLayout.setComponentAlignment(usernameInput, Alignment.MIDDLE_LEFT); // add password field lbl = new Label("Password:"); lbl.setSizeUndefined(); settingsLayout.addComponent(lbl, 0, 5); settingsLayout.setComponentAlignment(lbl, Alignment.MIDDLE_LEFT); passwordInput = new PasswordField(); passwordInput.setWidth("100%"); passwordInput.setEnabled(false); settingsLayout.addComponent(passwordInput, 1, 5); lbl = new Label(""); lbl.setHeight("30px"); settingsLayout.addComponent(lbl, 0, 6, 1, 6); // add OntoWiki check box owCheckBox = new CheckBox("Use OntoWiki instance"); owCheckBox.setSizeUndefined(); if (state.owUrl != null) owCheckBox.setValue(true); else owCheckBox.setValue(false); settingsLayout.addComponent(owCheckBox, 0, 7, 1, 7); settingsLayout.setComponentAlignment(owCheckBox, Alignment.MIDDLE_LEFT); // add OntoWiki field lbl = new Label("OntoWiki URL:"); lbl.setSizeUndefined(); settingsLayout.addComponent(lbl, 0, 8); settingsLayout.setComponentAlignment(lbl, Alignment.MIDDLE_LEFT); owInput = new TextField(); owInput.setWidth("100%"); if (state.owUrl != null) { owInput.setEnabled(true); owInput.setValue(state.owUrl); } else owInput.setEnabled(false); settingsLayout.addComponent(owInput, 1, 8); settingsLayout.setComponentAlignment(owInput, Alignment.MIDDLE_LEFT); lbl = new Label(""); lbl.setHeight("30px"); settingsLayout.addComponent(lbl, 0, 9, 1, 9); // add buttons HorizontalLayout hl = new HorizontalLayout(); hl.setSpacing(true); hl.setSizeUndefined(); btnOK = new Button("OK"); btnCancel = new Button("Cancel"); hl.addComponent(btnOK); hl.addComponent(btnCancel); settingsLayout.addComponent(hl, 1, 10); settingsLayout.setComponentAlignment(hl, Alignment.MIDDLE_RIGHT); createListeners(); center(); }
From source file:uk.q3c.krail.testapp.view.GridViewBase.java
License:Apache License
@Override protected void doBuild() { Label label = new Label("This is the " + this.getClass().getSimpleName()); label.setHeight("100px"); GridLayout grid = new GridLayout(3, 3); grid.addComponent(label, 1, 1);/*from w ww.ja v a 2 s . c om*/ grid.setSizeFull(); grid.setColumnExpandRatio(0, 0.33f); grid.setColumnExpandRatio(1, 0.33f); grid.setColumnExpandRatio(2, 0.33f); grid.setRowExpandRatio(0, 0.4f); grid.setRowExpandRatio(1, 0.2f); grid.setRowExpandRatio(2, 0.4f); label.setSizeFull(); setRootComponent(grid); }