List of usage examples for com.vaadin.ui Alignment TOP_RIGHT
Alignment TOP_RIGHT
To view the source code for com.vaadin.ui Alignment TOP_RIGHT.
Click Source Link
From source file:org.s23m.cell.editor.semanticdomain.ui.components.MultitabPanel.java
License:Mozilla Public License
private void createMultitabPanel() { addStyleName(Runo.PANEL_LIGHT);// w w w . ja v a 2 s .co m getLayout().setMargin(true); // Search results tab content searchResultPanel = new Panel(); final VerticalLayout searchLayer = new VerticalLayout(); searchLayer.setHeight(SEARCH_RESULTS_PANEL_HEIGHT); searchResultPanel.addStyleName(Runo.PANEL_LIGHT); searchLayer.addComponent(searchResultPanel); // Details form tab content final VerticalLayout detailsFormLayout = new VerticalLayout(); detailsFormLayout.setMargin(true); detailsForm = new Form() { @SuppressWarnings("unchecked") @Override public void setReadOnly(final boolean readOnly) { super.setReadOnly(readOnly); final BeanItem<DetailsData> dataSrc = (BeanItem<DetailsData>) detailsForm.getItemDataSource(); final Set detailsInstance = dataSrc.getBean().getInstance(); if (!InstanceGetter.hasModifiableName(detailsInstance)) { for (final String id : DetailsData.getNameFieldIds()) { final Field f = detailsForm.getField(id); f.setReadOnly(true); } } } }; detailsForm.setCaption("Instance Details"); detailsForm.setImmediate(true); detailsForm.setWriteThrough(false); final DetailsData detailsData = new DetailsData(Root.root); final BeanItem<DetailsData> detailsItem = new BeanItem<DetailsData>(detailsData); final FormFieldFactory formFieldFactory = new PanelFormFieldFactory(); detailsForm.setFormFieldFactory(formFieldFactory); //addImageUploadControls(detailsData); detailsForm.setItemDataSource(detailsItem); detailsForm.setVisibleItemProperties(DetailsData.getDisplayOrder()); detailsForm.setFooter(new VerticalLayout()); final HorizontalLayout formButtonBar = new HorizontalLayout(); formButtonBar.setSpacing(true); formButtonBar.setHeight(BUTTON_BAR_HEIGHT); final Layout footer = detailsForm.getFooter(); footer.addComponent(formButtonBar); editBtn = new Button(EDIT_BUTTON_LABEL, this, FORM_EVENT_HANDLER); saveBtn = new Button(SAVE_BUTTON_LABEL, this, FORM_EVENT_HANDLER); saveBtn.setVisible(false); cancelBtn = new Button(CANCEL_BUTTON_LABEL, this, FORM_EVENT_HANDLER); cancelBtn.setVisible(false); formButtonBar.addComponent(editBtn); formButtonBar.setComponentAlignment(editBtn, Alignment.TOP_RIGHT); formButtonBar.addComponent(saveBtn); formButtonBar.addComponent(cancelBtn); detailsFormLayout.addComponent(detailsForm); tabSheet = new TabSheet(); tabSheet.setWidth(TAB_SHEET_WIDTH_RATIO); tabSheet.setHeight("90%"); tabSheet.addTab(searchLayer, SEARCH_TAB_LABEL, EditorIcon.SEARCH.getIconImage()); tabSheet.addTab(detailsFormLayout, DETAILS_TAB_LABEL, EditorIcon.DETAILS.getIconImage()); tabSheet.addTab(new AdminFormLayout(this), ADMIN_TAB_LABEL, EditorIcon.ADMIN.getIconImage()); //tabSheet.addTab(new GraphVisualizationLayout(this), VISUALIZATION_TAB, EditorIcon.ADMIN.getIconImage()); addComponent(tabSheet); }
From source file:org.vaadin.overlay.sample.OverlaySampleApplication.java
License:Apache License
@Override protected void init(VaadinRequest request) { VerticalLayout layout = new VerticalLayout(); final Label label = new Label("Alignment.TOP_LEFT"); layout.addComponent(label);//from www .ja v a 2 s . c o m for (int i = 0; i < 20; i++) { Button button = new Button("Sample Button"); layout.addComponent(button); final ImageOverlay io = new ImageOverlay(button); Resource res = new ClassResource(this.getClass(), "../icon-new.png"); io.setImage(res); io.setComponentAnchor(Alignment.TOP_LEFT); // Top left of the button io.setOverlayAnchor(Alignment.MIDDLE_CENTER); // Center of the image io.setClickListener(new OverlayClickListener() { public void overlayClicked(CustomClickableOverlay overlay) { Notification.show("ImageOverlay Clicked!"); } }); layout.addComponent(io); io.setEnabled(true); final TextOverlay to = new TextOverlay(button, "New!"); to.setComponentAnchor(Alignment.MIDDLE_RIGHT); // Top right of the button to.setOverlayAnchor(Alignment.MIDDLE_CENTER); // Center of the image to.setClickListener(new OverlayClickListener() { public void overlayClicked(CustomClickableOverlay overlay) { Notification.show("TextOverlay Clicked!"); } }); layout.addComponent(to); button.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { Alignment a = io.getComponentAnchor(); String s = ""; if (Alignment.TOP_LEFT.equals(a)) { a = Alignment.TOP_CENTER; s = "TOP_CENTER"; } else if (Alignment.TOP_CENTER.equals(a)) { a = Alignment.TOP_RIGHT; s = "TOP_RIGHT"; } else if (Alignment.TOP_RIGHT.equals(a)) { a = Alignment.MIDDLE_RIGHT; s = "MIDDLE_RIGHT"; } else if (Alignment.MIDDLE_RIGHT.equals(a)) { a = Alignment.BOTTOM_RIGHT; s = "BOTTOM_RIGHT"; } else if (Alignment.BOTTOM_RIGHT.equals(a)) { a = Alignment.BOTTOM_CENTER; s = "BOTTOM_CENTER"; } else if (Alignment.BOTTOM_CENTER.equals(a)) { a = Alignment.BOTTOM_LEFT; s = "BOTTOM_LEFT"; } else if (Alignment.BOTTOM_LEFT.equals(a)) { a = Alignment.MIDDLE_LEFT; s = "MIDDLE_LEFT"; } else if (Alignment.MIDDLE_LEFT.equals(a)) { a = Alignment.TOP_LEFT; s = "TOP_LEFT"; } io.setComponentAnchor(a); label.setValue("Alignment." + s); } }); } setContent(layout); }
From source file:org.vaadin.tori.ToriUI.java
License:Apache License
private void addControlPanelIfInDevelopment() { final AuthorizationService authorizationService = apiLoader.getAuthorizationService(); if (authorizationService instanceof DebugAuthorizationService) { DebugControlPanel debugControlPanel = new DebugControlPanel( (DebugAuthorizationService) authorizationService); mainLayout.addComponent(debugControlPanel); mainLayout.setComponentAlignment(debugControlPanel, Alignment.TOP_RIGHT); }/*from w w w . j a v a 2 s . c om*/ }
From source file:org.vaadin.training.fundamentals.happening.ui.viewimpl.ShowHappeningViewImpl.java
License:Apache License
@SuppressWarnings("serial") private void rebuildLayout() { removeAllComponents();/*from w w w . ja v a 2 s.c o m*/ ResourceBundle tr = AppData.getTr(AppData.getLocale()); Button editButton = new Button(tr.getString("Button.Edit")); editButton.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { eventRouter.fireEvent(new EditSelectedEvent(event.getButton())); } }); addComponent(editButton, 0, 0, 1, 0); setComponentAlignment(editButton, Alignment.TOP_RIGHT); }
From source file:pl.alburnus.testcaseapp.AddressBookMainView.java
License:Apache License
private void buildMainArea() { VerticalLayout verticalLayout = new VerticalLayout(); setSecondComponent(verticalLayout);/*from www . j a v a 2 s. co m*/ personTable = new Table(null, persons);//Biding Person tabel z JPAContainer personTable.setSelectable(true); personTable.setImmediate(true); personTable.addListener(new Property.ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { setModificationsEnabled(event.getProperty().getValue() != null); } private void setModificationsEnabled(boolean b) { deleteButton.setEnabled(b); editButton.setEnabled(b); } }); personTable.setSizeFull(); // personTable.setSelectable(true); /* personTable.addListener(new ItemClickListener() { @Override public void itemClick(ItemClickEvent event) { if (event.isDoubleClick()) { personTable.select(event.getItemId()); } } }); */ //OK personTable.setVisibleColumns( new Object[] { "firstName", "lastName", "department", "phoneNumber", "street", "city", "zipCode" }); HorizontalLayout toolbar = new HorizontalLayout(); newButton = new Button("Add"); newButton.addClickListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { //Tworzony jest nowy obiekt opakowany w BeanItem, ktory umozliwa jego polaczenie z FORM final BeanItem<Person> newPersonItem = new BeanItem<Person>(new Person()); PersonEditor personEditor = new PersonEditor(newPersonItem); personEditor.addListener(new EditorSavedListener() { @Override public void editorSaved(EditorSavedEvent event) { persons.addEntity(newPersonItem.getBean()); } }); UI.getCurrent().addWindow(personEditor); //Dodanie okienka do dodania adresu } }); deleteButton = new Button("Delete"); deleteButton.addClickListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { persons.removeItem(personTable.getValue()); } }); deleteButton.setEnabled(false); editButton = new Button("Edit"); editButton.addClickListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { UI.getCurrent().addWindow(new PersonEditor(personTable.getItem(personTable.getValue()))); } }); editButton.setEnabled(false); searchField = new TextField(); searchField.setInputPrompt("Search by name"); searchField.addTextChangeListener(new TextChangeListener() { @Override public void textChange(TextChangeEvent event) { textFilter = event.getText(); updateFilters(); } }); toolbar.addComponent(newButton); toolbar.addComponent(deleteButton); toolbar.addComponent(editButton); toolbar.addComponent(searchField); toolbar.setWidth("100%"); toolbar.setExpandRatio(searchField, 1); toolbar.setComponentAlignment(searchField, Alignment.TOP_RIGHT); verticalLayout.addComponent(toolbar); verticalLayout.addComponent(personTable); verticalLayout.setExpandRatio(personTable, 1); verticalLayout.setSizeFull(); }
From source file:pl.exsio.plupload.field.PluploadField.java
License:Open Source License
@Override protected Component initContent() { this.layout = new HorizontalLayout(); this.layout.setStyleName("plupload-field"); this.layout.setSpacing(true); this.uploader.setMultiSelection(false); this.uploader.setStyleName("plupload-field-uploader"); if (byte[].class.equals(this.returnTypeClass)) { this.uploader.setChunkHandlerFactory(new ByteArrayChunkHandlerFactory()); }// www. j a va2s. c o m this.progressBar = new ProgressBar(); this.progressBar.setIndeterminate(false); this.progressBar.setValue(0f); this.progressBar.setWidth("128px"); this.progressBar.setStyleName("plupload-field-progressbar"); this.progressBar.setVisible(false); this.nameLabel = new Label(); this.nameLabel.setStyleName("plupload-field-name"); this.nameLabel.setWidth("128px"); this.removeButton = new Button(this.removeLabel, FontAwesome.TIMES); this.removeButton.setVisible(false); this.removeButton.setStyleName("plupload-field-remove"); VerticalLayout vlayout = new VerticalLayout(); vlayout.addComponent(this.nameLabel); vlayout.addComponent(this.progressBar); this.layout.addComponent(this.uploader); this.layout.addComponent(vlayout); this.layout.addComponent(this.removeButton); this.layout.setComponentAlignment(this.removeButton, Alignment.TOP_RIGHT); return layout; }
From source file:probe.com.view.body.quantcompare.PieChart.java
public PieChart(String title, double full, double found, final String notfound) { this.setWidth(200 + "px"); this.setHeight(200 + "px"); defaultKeyColorMap.put("Found", new Color(110, 177, 206)); defaultKeyColorMap.put("Not found", new Color(219, 169, 1)); otherSymbols.setGroupingSeparator('.'); this.setStyleName("click"); labels = new String[] { "Found", "Not found" }; double foundPercent = ((found / full) * 100.0); df = new DecimalFormat("#.##", otherSymbols); valuesMap.put("Found", ((int) found) + " (" + df.format(foundPercent) + "%)"); values = new Double[] { foundPercent, 100.0 - foundPercent }; valuesMap.put("Not found", ((int) (full - found)) + " (" + df.format(100.0 - foundPercent) + "%)"); String defaultImgURL = initPieChart(200, 200, title); chartImg.setSource(new ExternalResource(defaultImgURL)); this.addComponent(chartImg); this.addLayoutClickListener(PieChart.this); popupLayout = new PopupView(null, popupBody); popupLayout.setHideOnMouseOut(false); popupBody.setWidth("300px"); popupBody.setStyleName(Reindeer.LAYOUT_WHITE); popupBody.setHeightUndefined();//from ww w . ja v a 2 s . co m this.addComponent(popupLayout); this.notfound = notfound.replace(" ", "").replace(",", "/n"); HorizontalLayout topLayout = new HorizontalLayout(); topLayout.setWidth("100%"); topLayout.setHeight("20px"); Label header = new Label("<b>Not Found (New Proteins)</b>"); header.setStyleName(Reindeer.LABEL_SMALL); topLayout.addComponent(header); header.setContentMode(ContentMode.HTML); VerticalLayout closeBtn = new VerticalLayout(); closeBtn.setWidth("10px"); closeBtn.setHeight("10px"); closeBtn.setStyleName("closebtn"); topLayout.addComponent(closeBtn); topLayout.setComponentAlignment(closeBtn, Alignment.TOP_RIGHT); closeBtn.addLayoutClickListener(new LayoutEvents.LayoutClickListener() { @Override public void layoutClick(LayoutEvents.LayoutClickEvent event) { popupLayout.setPopupVisible(false); } }); popupBody.addComponent(topLayout); popupBody.addComponent(textArea); textArea.setWidth("100%"); textArea.setHeight("150px"); textArea.setValue(this.notfound); textArea.setReadOnly(true); popupBody.setSpacing(true); HorizontalLayout bottomLayout = new HorizontalLayout(); bottomLayout.setWidth("100%"); bottomLayout.setHeight("40px"); bottomLayout.setMargin(new MarginInfo(false, true, true, true)); popupBody.addComponent(bottomLayout); Button exportTableBtn = new Button(""); exportTableBtn.setHeight("24px"); exportTableBtn.setWidth("24px"); exportTableBtn.setPrimaryStyleName("exportxslbtn"); exportTableBtn.setDescription("Export table data"); exportTableBtn.addClickListener(new Button.ClickListener() { private Table table; @Override public void buttonClick(Button.ClickEvent event) { if (table == null) { table = new Table(); table.addContainerProperty("Index", Integer.class, null, "", null, Table.Align.RIGHT); table.addContainerProperty("Accession", String.class, Table.Align.CENTER); table.setVisible(false); addComponent(table); int i = 1; for (String str : notfound.replace(" ", "").replace(",", "\n").split("\n")) { table.addItem(new Object[] { i, str }, i++); } } ExcelExport csvExport = new ExcelExport(table, "Not found protein accessions (New proteins)"); // csvExport.setReportTitle("CSF-PR / Not found protein accessions (New proteins) "); csvExport.setExportFileName("CSF-PR - Not found protein accessions" + ".xls"); csvExport.setMimeType(CsvExport.EXCEL_MIME_TYPE); csvExport.setDisplayTotals(false); csvExport.setExcelFormatOfProperty("Index", "#0;[Red] #0"); csvExport.export(); } }); bottomLayout.addComponent(exportTableBtn); bottomLayout.setComponentAlignment(exportTableBtn, Alignment.MIDDLE_RIGHT); }
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// w ww . jav a2 s .com 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.quantdatasetsoverview.diseasegroupsfilters.ComparisonsSelectionOverviewBubbleChart.java
public ComparisonsSelectionOverviewBubbleChart(final QuantCentralManager Quant_Central_Manager, final CSFPRHandler CSFPR_Handler, int chartWidth, int chartHeight, Set<QuantDiseaseGroupsComparison> selectedComparisonList, List<QuantProtein> searchQuantificationProtList) { userDataCounter = 0;//from w ww .ja va 2 s. c o m this.searchQuantificationProtList = searchQuantificationProtList; Map<String, String> diseaseHashedColorMap = Quant_Central_Manager.getDiseaseHashedColorMap(); for (String str : diseaseHashedColorMap.keySet()) { diseaseColorMap.put(str, Color.decode(diseaseHashedColorMap.get(str))); } this.width = chartWidth; this.height = 600; this.CSFPR_Handler = CSFPR_Handler; this.setWidth(width + "px"); this.setHeightUndefined(); this.Quant_Central_Manager = Quant_Central_Manager; this.Quant_Central_Manager.registerStudySelectionListener(ComparisonsSelectionOverviewBubbleChart.this); this.setSpacing(true); //init toplayout topLayout.setHeight(30 + "px"); topLayout.setSpacing(true); topLayout.setMargin(new MarginInfo(false, false, true, false)); this.addComponent(topLayout); Label overviewLabel = new Label("<font style='margin-left :50px;'>Overview</font> "); overviewLabel.setContentMode(ContentMode.HTML); topLayout.addComponent(overviewLabel); overviewLabel.setStyleName("subtitle"); overviewLabel.setWidth("120px"); InfoPopupBtn info = new InfoPopupBtn( "The bubble chart give an overview for the proteins existed in the selected comparisons.<br/>The diameter of the bubble represents the number of the proteins in the selected comparison and the color represents the trend<br/>"); info.setWidth("16px"); info.setHeight("16px"); topLayout.addComponent(info); this.topLayout.setVisible(false); //end of toplayout //init chartlayout this.chartLayoutContainer.setVisible(false); this.addComponent(chartLayoutContainer); chartLayoutContainer.setWidth(width + "px"); chartLayoutContainer.setHeight(height + "px"); chartLayoutContainer.addComponent(chartImage, "left: " + 0 + "px; top: " + 0 + "px;"); chartLayoutContainer.addComponent(chartLayout, "left: " + 0 + "px; top: " + 0 + "px;"); chartLayout.setWidth(width + "px"); chartLayout.setHeight(height + "px"); chartLayout.addLayoutClickListener(ComparisonsSelectionOverviewBubbleChart.this); //end of chartlayout //init bottomlayout bottomLayout.setWidth("100%"); this.addComponent(bottomLayout); this.setComponentAlignment(bottomLayout, Alignment.BOTTOM_RIGHT); bottomLayout.setVisible(false); HorizontalLayout btnContainerLayout = new HorizontalLayout(); btnContainerLayout.setSpacing(true); // btnContainerLayout.setMargin(new MarginInfo(false, false, false, false)); btnContainerLayout.setWidthUndefined(); btnContainerLayout.setHeightUndefined(); // btnContainerLayout.addStyleName("leftspacer"); bottomLayout.addComponent(btnContainerLayout); bottomLayout.setComponentAlignment(btnContainerLayout, Alignment.TOP_RIGHT); TrendLegend legendLayout = new TrendLegend("bubblechart"); legendLayout.setWidthUndefined(); legendLayout.setHeight("24px"); btnContainerLayout.addComponent(legendLayout); btnContainerLayout.setComponentAlignment(legendLayout, Alignment.TOP_RIGHT); // btnContainerLayout.setExpandRatio(legendLayout, 600); // btnContainerLayout.setExpandRatio(btnContainerLayout, 210); // VerticalLayout stableBtnWrapper = new VerticalLayout(); //// stableBtnWrapper.setWidth("64px"); // HorizontalLayout stableBtn = new HorizontalLayout(); // stableBtnWrapper.addComponent(stableBtn); // stableBtnWrapper.setComponentAlignment(stableBtn, Alignment.TOP_LEFT); // btnContainerLayout.addComponent(stableBtnWrapper); groupSwichBtn = new GroupSwichBtn(Quant_Central_Manager, searchQuantificationProtList); btnContainerLayout.addComponent(groupSwichBtn); final VerticalLayout appliedIcon = new VerticalLayout(); appliedIcon.setStyleName("appliedicon"); appliedIcon.setWidth("24px"); appliedIcon.setHeight("24px"); appliedIcon.setDescription("Hide stable proteins"); btnContainerLayout.addComponent(appliedIcon); // stableBtn.setStyleName("stablebtn"); // stableBtn.setHeight("24px"); // Label stableLabel = new Label("Equal"); // stableLabel.setWidth("44px"); // stableBtn.addComponent(stableLabel); appliedIcon.addLayoutClickListener(new LayoutEvents.LayoutClickListener() { @Override public void layoutClick(LayoutEvents.LayoutClickEvent event) { if (appliedIcon.getStyleName().equalsIgnoreCase("appliedicon")) { appliedIcon.setStyleName("unappliedicon"); Quant_Central_Manager.updateSignificantOnlySelection(true); appliedIcon.setDescription("Show stable proteins"); } else { appliedIcon.setStyleName("appliedicon"); Quant_Central_Manager.updateSignificantOnlySelection(false); appliedIcon.setDescription("Hide stable proteins"); } } }); exportPdfBtn = new Button(""); exportPdfBtn.setWidth("24px"); exportPdfBtn.setHeight("24px"); exportPdfBtn.setPrimaryStyleName("exportpdfbtn"); exportPdfBtn.setDescription("Export chart image"); StreamResource myResource = createResource(); FileDownloader fileDownloader = new FileDownloader(myResource); fileDownloader.extend(exportPdfBtn); btnContainerLayout.addComponent(exportPdfBtn); VerticalLayout unselectAllBtn = new VerticalLayout(); unselectAllBtn.setStyleName("unselectallbtn"); btnContainerLayout.addComponent(unselectAllBtn); btnContainerLayout.setComponentAlignment(unselectAllBtn, Alignment.TOP_LEFT); unselectAllBtn.setDescription("Clear selection"); unselectAllBtn.addLayoutClickListener(new LayoutEvents.LayoutClickListener() { @Override public void layoutClick(LayoutEvents.LayoutClickEvent event) { Quant_Central_Manager.setBubbleChartQuantProteinsSelection(new HashSet<String>(), ""); resetChart(); } }); final VerticalLayout selectMultiBtn = new VerticalLayout(); selectMultiBtn.setStyleName("selectmultiselectedbtn"); btnContainerLayout.addComponent(selectMultiBtn); btnContainerLayout.setComponentAlignment(selectMultiBtn, Alignment.TOP_LEFT); selectMultiBtn.setDescription("Multiple selection"); activeMultiSelect = true; selectMultiBtn.addLayoutClickListener(new LayoutEvents.LayoutClickListener() { @Override public void layoutClick(LayoutEvents.LayoutClickEvent event) { if (selectMultiBtn.getStyleName().equalsIgnoreCase("selectmultiselectedbtn")) { selectMultiBtn.setStyleName("selectmultibtn"); activeMultiSelect = false; } else { selectMultiBtn.setStyleName("selectmultiselectedbtn"); activeMultiSelect = true; } } }); //end of btns layout //init empty layout emptySelectionLayout = new VerticalLayout(); this.addComponent(emptySelectionLayout); emptySelectionLayout.setWidth(100 + "%"); emptySelectionLayout.setHeightUndefined(); VerticalLayout spacer = new VerticalLayout(); spacer.setHeight("100px"); spacer.setWidth("10px"); spacer.setStyleName(Reindeer.LAYOUT_WHITE); emptySelectionLayout.addComponent(spacer); emptySelectionLayout.setComponentAlignment(spacer, Alignment.BOTTOM_RIGHT); Label startLabel = new Label( "<center><h2 style='color:gray;'><b>Select comparison from the table</b></h2></center>"); startLabel.setContentMode(ContentMode.HTML); emptySelectionLayout.addComponent(startLabel); emptySelectionLayout.setComponentAlignment(startLabel, Alignment.MIDDLE_CENTER); Image handleft = new Image(); handleft.setSource(new ThemeResource("img/handleft.png")); emptySelectionLayout.addComponent(handleft); emptySelectionLayout.setComponentAlignment(handleft, Alignment.MIDDLE_CENTER); //init bubble chart }
From source file:probe.com.view.body.quantdatasetsoverview.diseasegroupsfilters.ComparisonsSelectionOverviewBubbleChart.java
public ComparisonsSelectionOverviewBubbleChart(final QuantCentralManager Quant_Central_Manager, final CSFPRHandler CSFPR_Handler, int chartWidth, int chartHeight, Set<QuantDiseaseGroupsComparison> selectedComparisonList, List<QuantProtein> searchQuantificationProtList, QuantDiseaseGroupsComparison userCustomizedComparison) { this.userCustomizedComparison = userCustomizedComparison; userDataCounter = 1;// ww w . j a v a2 s .c om this.searchQuantificationProtList = searchQuantificationProtList; Map<String, String> diseaseHashedColorMap = Quant_Central_Manager.getDiseaseHashedColorMap(); for (String str : diseaseHashedColorMap.keySet()) { diseaseColorMap.put(str, Color.decode(diseaseHashedColorMap.get(str))); } this.width = chartWidth; this.height = 600; this.CSFPR_Handler = CSFPR_Handler; this.setWidth(width + "px"); this.setHeightUndefined(); this.Quant_Central_Manager = Quant_Central_Manager; this.Quant_Central_Manager.registerStudySelectionListener(ComparisonsSelectionOverviewBubbleChart.this); this.setSpacing(true); //init toplayout topLayout.setHeight(30 + "px"); topLayout.setSpacing(true); topLayout.setMargin(new MarginInfo(false, false, true, false)); this.addComponent(topLayout); Label overviewLabel = new Label("<font style='margin-left :50px;'>Overview</font> "); overviewLabel.setContentMode(ContentMode.HTML); topLayout.addComponent(overviewLabel); overviewLabel.setStyleName("subtitle"); overviewLabel.setWidth("120px"); InfoPopupBtn info = new InfoPopupBtn( "The bubble chart give an overview for the proteins existed in the selected comparisons.<br/>The diameter of the bubble represents the number of the proteins in the selected comparison and the color represents the trend<br/>"); info.setWidth("16px"); info.setHeight("16px"); topLayout.addComponent(info); //end of toplayout //init chartlayout this.chartLayoutContainer.setVisible(false); this.addComponent(chartLayoutContainer); this.addComponent(chartLayoutContainer); chartLayoutContainer.setWidth(width + "px"); chartLayoutContainer.setHeight(height + "px"); chartLayoutContainer.addComponent(chartImage, "left: " + 0 + "px; top: " + 0 + "px;"); chartLayoutContainer.addComponent(chartLayout, "left: " + 0 + "px; top: " + 0 + "px;"); chartLayout.setWidth(width + "px"); chartLayout.setHeight(height + "px"); chartLayout.addLayoutClickListener(ComparisonsSelectionOverviewBubbleChart.this); //end of chartlayout //init bottomlayout bottomLayout.setWidth("100%"); this.addComponent(bottomLayout); this.setComponentAlignment(bottomLayout, Alignment.BOTTOM_RIGHT); bottomLayout.setVisible(false); HorizontalLayout btnContainerLayout = new HorizontalLayout(); btnContainerLayout.setSpacing(true); // btnContainerLayout.setMargin(new MarginInfo(false, false, false, false)); btnContainerLayout.setWidthUndefined(); btnContainerLayout.setHeightUndefined(); // btnContainerLayout.addStyleName("leftspacer"); bottomLayout.addComponent(btnContainerLayout); bottomLayout.setComponentAlignment(btnContainerLayout, Alignment.TOP_RIGHT); TrendLegend legendLayout = new TrendLegend("bubblechart"); legendLayout.setWidthUndefined(); legendLayout.setHeight("24px"); btnContainerLayout.addComponent(legendLayout); btnContainerLayout.setComponentAlignment(legendLayout, Alignment.TOP_RIGHT); Quant_Central_Manager.insertNoftfication("Quantitative Datasets", "Remeber you can flip the disease group comparisons using (Swich disease groups button)<img src='VAADIN/themes/dario-theme/img/flip-v-updated.png' height='25px' width='25' alt='Reorder and select' Align='center'/> ", width, width, "flipnotification"); // btnContainerLayout.setExpandRatio(legendLayout, 600); // btnContainerLayout.setExpandRatio(btnContainerLayout, 210); // VerticalLayout stableBtnWrapper = new VerticalLayout(); //// stableBtnWrapper.setWidth("64px"); // HorizontalLayout stableBtn = new HorizontalLayout(); // stableBtnWrapper.addComponent(stableBtn); // stableBtnWrapper.setComponentAlignment(stableBtn, Alignment.TOP_LEFT); // btnContainerLayout.addComponent(stableBtnWrapper); groupSwichBtn = new GroupSwichBtn(Quant_Central_Manager, searchQuantificationProtList); btnContainerLayout.addComponent(groupSwichBtn); final VerticalLayout appliedIcon = new VerticalLayout(); appliedIcon.setStyleName("appliedicon"); appliedIcon.setWidth("24px"); appliedIcon.setHeight("24px"); appliedIcon.setDescription("Hide stable proteins"); btnContainerLayout.addComponent(appliedIcon); // stableBtn.setStyleName("stablebtn"); // stableBtn.setHeight("24px"); // Label stableLabel = new Label("Equal"); // stableLabel.setWidth("44px"); // stableBtn.addComponent(stableLabel); appliedIcon.addLayoutClickListener(new LayoutEvents.LayoutClickListener() { @Override public void layoutClick(LayoutEvents.LayoutClickEvent event) { if (appliedIcon.getStyleName().equalsIgnoreCase("appliedicon")) { appliedIcon.setStyleName("unappliedicon"); Quant_Central_Manager.updateSignificantOnlySelection(true); appliedIcon.setDescription("Show stable proteins"); } else { appliedIcon.setStyleName("appliedicon"); Quant_Central_Manager.updateSignificantOnlySelection(false); appliedIcon.setDescription("Hide stable proteins"); } } }); exportPdfBtn = new Button(""); exportPdfBtn.setWidth("24px"); exportPdfBtn.setHeight("24px"); exportPdfBtn.setPrimaryStyleName("exportpdfbtn"); exportPdfBtn.setDescription("Export chart image"); StreamResource myResource = createResource(); FileDownloader fileDownloader = new FileDownloader(myResource); fileDownloader.extend(exportPdfBtn); btnContainerLayout.addComponent(exportPdfBtn); VerticalLayout unselectAllBtn = new VerticalLayout(); unselectAllBtn.setStyleName("unselectallbtn"); btnContainerLayout.addComponent(unselectAllBtn); btnContainerLayout.setComponentAlignment(unselectAllBtn, Alignment.TOP_LEFT); unselectAllBtn.setDescription("Clear selection"); unselectAllBtn.addLayoutClickListener(new LayoutEvents.LayoutClickListener() { @Override public void layoutClick(LayoutEvents.LayoutClickEvent event) { Quant_Central_Manager.setBubbleChartQuantProteinsSelection(new HashSet<String>(), ""); resetChart(); } }); final VerticalLayout selectMultiBtn = new VerticalLayout(); selectMultiBtn.setStyleName("selectmultiselectedbtn"); btnContainerLayout.addComponent(selectMultiBtn); btnContainerLayout.setComponentAlignment(selectMultiBtn, Alignment.TOP_LEFT); selectMultiBtn.setDescription("Multiple selection"); activeMultiSelect = true; selectMultiBtn.addLayoutClickListener(new LayoutEvents.LayoutClickListener() { @Override public void layoutClick(LayoutEvents.LayoutClickEvent event) { if (selectMultiBtn.getStyleName().equalsIgnoreCase("selectmultiselectedbtn")) { selectMultiBtn.setStyleName("selectmultibtn"); activeMultiSelect = false; } else { selectMultiBtn.setStyleName("selectmultiselectedbtn"); activeMultiSelect = true; } } }); //end of btns layout //init empty layout emptySelectionLayout = new VerticalLayout(); this.addComponent(emptySelectionLayout); emptySelectionLayout.setWidth(width + "px"); emptySelectionLayout.setHeightUndefined(); VerticalLayout spacer = new VerticalLayout(); spacer.setHeight("100px"); spacer.setWidth("10px"); spacer.setStyleName(Reindeer.LAYOUT_WHITE); emptySelectionLayout.addComponent(spacer); emptySelectionLayout.setComponentAlignment(spacer, Alignment.BOTTOM_RIGHT); Label startLabel = new Label( "<center><h2 style='color:gray;'><b>Select comparison from the table</b></h2></center>"); startLabel.setContentMode(ContentMode.HTML); emptySelectionLayout.addComponent(startLabel); emptySelectionLayout.setComponentAlignment(startLabel, Alignment.MIDDLE_CENTER); Image handleft = new Image(); handleft.setSource(new ThemeResource("img/handleft.png")); emptySelectionLayout.addComponent(handleft); emptySelectionLayout.setComponentAlignment(handleft, Alignment.MIDDLE_CENTER); }