List of usage examples for com.vaadin.ui HorizontalLayout setComponentAlignment
@Override public void setComponentAlignment(Component childComponent, Alignment alignment)
From source file:com.etest.view.testbank.cellitem.ViewStemWindow.java
FormLayout buildForms() { FormLayout form = new FormLayout(); form.setWidth("100%"); form.setMargin(true);/*from w ww . ja v a 2 s . c o m*/ form.setSpacing(true); CellItem ci = cis.getCellItemById(getCellItemId()); if (ci.getCellItemId() == 0) { ci = hs.getCellItemById(getCellItemId()); } keyList = k.getAllItemKey(getCellItemId()); keyIndexSize = keyList.size(); if (keyList.isEmpty()) { ShowErrorNotification.error("No Item Key was found for STEM: \n" + ci.getItem()); return null; } stem = ci.getItem().replace("{key}", "<u>" + keyList.get(getKeyIndex()) + "</u>"); label.setValue("<b>STEM</b>: " + getStem()); label.setContentMode(ContentMode.HTML); form.addComponent(label); HorizontalLayout h1 = new HorizontalLayout(); h1.setWidth("100%"); OptionGroup options = new OptionGroup(); options.addItems(ci.getOptionA(), ci.getOptionB(), ci.getOptionC(), ci.getOptionD()); options.addValueChangeListener((Property.ValueChangeEvent event) -> { boolean result = k.isAnswerCorrect(getCellItemId(), getItemKey(), CommonUtilities.escapeSingleQuote(event.getProperty().getValue())); if (result) { Notification.show("Correct Answer!", Notification.Type.TRAY_NOTIFICATION); } else { Notification.show("Wrong Answer", Notification.Type.TRAY_NOTIFICATION); } }); h1.addComponent(options); h1.setComponentAlignment(options, Alignment.MIDDLE_CENTER); form.addComponent(h1); GridLayout g = new GridLayout(2, 2); g.setWidth("100%"); g.setSpacing(true); prev = new Button(); prev.setWidth("50px"); prev.setIcon(FontAwesome.ANGLE_DOUBLE_LEFT); prev.addStyleName(ValoTheme.BUTTON_PRIMARY); prev.addStyleName(ValoTheme.BUTTON_SMALL); prev.addClickListener(prevBtnClickListener); g.addComponent(prev, 0, 0); g.setComponentAlignment(prev, Alignment.MIDDLE_LEFT); next = new Button(); next.setWidth("50px"); next.setIcon(FontAwesome.ANGLE_DOUBLE_RIGHT); next.addStyleName(ValoTheme.BUTTON_PRIMARY); next.addStyleName(ValoTheme.BUTTON_SMALL); next.addClickListener(nextBtnClickListener); g.addComponent(next, 1, 0); g.setComponentAlignment(next, Alignment.MIDDLE_RIGHT); if (getKeyIndexSize() == 1) { prev.setEnabled(false); next.setEnabled(false); } populateDataTable(); g.addComponent(table, 0, 1, 1, 1); g.setComponentAlignment(table, Alignment.MIDDLE_CENTER); form.addComponent(g); return form; }
From source file:com.etest.view.tq.reports.OnlineQueriesUI.java
public OnlineQueriesUI() { setWidth("100%"); setMargin(true);/*from w w w .j a v a 2s .c o m*/ setSpacing(true); Label lineSeparator1 = new Label(); lineSeparator1.setContentMode(ContentMode.HTML); lineSeparator1.setStyleName("line-separator"); Label lineSeparator2 = new Label(); lineSeparator2.setContentMode(ContentMode.HTML); lineSeparator2.setStyleName("line-separator"); disableAllComponents(false); GridLayout topGrid = new GridLayout(3, 2); topGrid.setWidth("800px"); topGrid.setSpacing(true); VerticalLayout top = new VerticalLayout(); top.setWidth("166px"); graphicalInventory.addItem("Graphical Inventory"); graphicalInventory.setWidth("300px"); top.addComponent(graphicalInventory); graphicalInventory.addValueChangeListener(firstLevelOptionListener); graphicalInventory.setImmediate(true); graphicalInventoryGroup.addItem("All Subjects"); Label subjectProportionedCaption = new Label(); subjectProportionedCaption.setWidth("500px"); subjectProportionedCaption .setCaption("A Subject's No. of Items Proportioned " + "According to the Revised Bloom's Taxonomy"); subjectProportionedCaption.setContentMode(ContentMode.HTML); subjectProportionedCaption.setHeightUndefined(); graphicalInventoryGroup.addItem(subjectProportionedCaption.getCaption()); graphicalInventoryGroup.setWidth("400px"); graphicalInventoryGroup.addValueChangeListener(secondLevelTopOptionListener); graphicalInventoryGroup.setImmediate(true); topGrid.addComponent(top, 0, 0); topGrid.addComponent(graphicalInventoryGroup, 1, 0, 2, 0); addComponent(topGrid); searchSubject1.setInputPrompt("Search Subject"); searchSubject1.setWidth("225px"); searchSubject1.addValueChangeListener(dropDownChangeListener); searchSubject1.setEnabled(false); topGrid.addComponent(searchSubject1, 1, 1); addComponent(lineSeparator1); GridLayout bottomGrid = new GridLayout(3, 3); bottomGrid.setWidth("800px"); bottomGrid.setSpacing(true); VerticalLayout bottom = new VerticalLayout(); bottom.setWidth("235px"); itemAnalysis.addItem("Item Analysis"); itemAnalysis.setWidth("310px"); bottom.addComponent(itemAnalysis); itemAnalysis.addValueChangeListener(firstLevelOptionListener); itemAnalysis.setImmediate(true); graphicalView.addItem("Graphical View"); graphicalView.setWidth("210px"); graphicalView.addValueChangeListener(secondLevelBottomOptionListener); graphicalView.setImmediate(true); tabularView.addItem("Tabular View"); tabularView.addValueChangeListener(secondLevelBottomOptionListener); tabularView.setImmediate(true); graphicalViewGroup.addItem("Summary: All Tests of a Subject"); graphicalViewGroup.addItem("Difficulty Index of a Subject's Test"); graphicalViewGroup.addItem("Discrimination Index of a Subject's Test"); graphicalViewGroup.setWidth("300px"); graphicalViewGroup.addValueChangeListener(thirdLevelBottomOptionListener); graphicalViewGroup.setImmediate(true); tabularViewGroup.addItem("Summary: All Tests of a Subject"); tabularViewGroup.addItem("Critical values of a test"); tabularViewGroup.addValueChangeListener(thirdLevelBottomOptionListener); tabularViewGroup.setImmediate(true); searchSubject2.setInputPrompt("Search Subject"); searchSubject2.setWidth("225px"); searchSubject2.addValueChangeListener(dropDownChangeListener); searchSubject2.setEnabled(false); searchTest.setWidth("225px"); searchTest.setInputPrompt("Search Test"); searchTest.setEnabled(false); searchTest.addStyleName(ValoTheme.COMBOBOX_SMALL); bottomGrid.addComponent(bottom, 0, 0); bottomGrid.addComponent(graphicalView, 1, 0); bottomGrid.addComponent(tabularView, 1, 1); bottomGrid.addComponent(graphicalViewGroup, 2, 0); bottomGrid.addComponent(tabularViewGroup, 2, 1); bottomGrid.addComponent(searchSubject2, 1, 2); bottomGrid.addComponent(searchTest, 2, 2); addComponent(bottomGrid); addComponent(lineSeparator2); HorizontalLayout h = new HorizontalLayout(); h.setWidth("100%"); h.setMargin(true); Button calculateAndViewBtn = new Button("Calculate & View"); calculateAndViewBtn.setWidth("300px"); calculateAndViewBtn.addClickListener(buttonClickListener); h.addComponent(calculateAndViewBtn); h.setComponentAlignment(calculateAndViewBtn, Alignment.MIDDLE_LEFT); addComponent(calculateAndViewBtn); }
From source file:com.expressui.core.view.form.ResultsConnectedEntityForm.java
License:Open Source License
private HorizontalLayout createNavigationFormLayout() { HorizontalLayout navigationFormLayout = new HorizontalLayout(); String id = StringUtil.generateDebugId("e", this, navigationFormLayout, "navigationFormLayout"); navigationFormLayout.setDebugId(id); navigationFormLayout.setSizeUndefined(); VerticalLayout previousButtonLayout = new VerticalLayout(); id = StringUtil.generateDebugId("e", this, previousButtonLayout, "previousButtonLayout"); previousButtonLayout.setDebugId(id); previousButtonLayout.setSizeUndefined(); previousButtonLayout.setMargin(false); previousButtonLayout.setSpacing(false); Label spaceLabel = new Label("</br></br></br>", Label.CONTENT_XHTML); spaceLabel.setSizeUndefined();/* w w w. j av a 2s. c om*/ previousButtonLayout.addComponent(spaceLabel); Button previousButton = new Button(null, this, "previousItem"); previousButton.setDescription(entityForm.uiMessageSource.getToolTip("entityForm.previous.toolTip")); previousButton.setSizeUndefined(); previousButton.addStyleName("borderless"); previousButton.setIcon(new ThemeResource("../expressui/icons/16/previous.png")); if (entityForm.getViewableToManyRelationships().size() == 0) { HorizontalLayout previousButtonHorizontalLayout = new HorizontalLayout(); id = StringUtil.generateDebugId("e", this, previousButtonHorizontalLayout, "previousButtonHorizontalLayout"); previousButtonHorizontalLayout.setDebugId(id); previousButtonHorizontalLayout.setSizeUndefined(); Label horizontalSpaceLabel = new Label(" ", Label.CONTENT_XHTML); horizontalSpaceLabel.setSizeUndefined(); previousButtonHorizontalLayout.addComponent(previousButton); previousButtonHorizontalLayout.addComponent(horizontalSpaceLabel); previousButtonLayout.addComponent(previousButtonHorizontalLayout); } else { previousButtonLayout.addComponent(previousButton); } navigationFormLayout.addComponent(previousButtonLayout); navigationFormLayout.setComponentAlignment(previousButtonLayout, Alignment.TOP_LEFT); navigationFormLayout.addComponent(entityForm); VerticalLayout nextButtonLayout = new VerticalLayout(); id = StringUtil.generateDebugId("e", this, nextButtonLayout, "nextButtonLayout"); nextButtonLayout.setDebugId(id); nextButtonLayout.setSizeUndefined(); nextButtonLayout.setMargin(false); nextButtonLayout.setSpacing(false); spaceLabel = new Label("</br></br></br>", Label.CONTENT_XHTML); spaceLabel.setSizeUndefined(); previousButtonLayout.addComponent(spaceLabel); nextButtonLayout.addComponent(spaceLabel); Button nextButton = new Button(null, this, "nextItem"); nextButton.setDescription(entityForm.uiMessageSource.getToolTip("entityForm.next.toolTip")); nextButton.setSizeUndefined(); nextButton.addStyleName("borderless"); nextButton.setIcon(new ThemeResource("../expressui/icons/16/next.png")); HorizontalLayout nextButtonHorizontalLayout = new HorizontalLayout(); id = StringUtil.generateDebugId("e", this, nextButtonHorizontalLayout, "nextButtonHorizontalLayout"); nextButtonHorizontalLayout.setDebugId(id); nextButtonHorizontalLayout.setSizeUndefined(); Label horizontalSpaceLabel = new Label(" ", Label.CONTENT_XHTML); horizontalSpaceLabel.setSizeUndefined(); nextButtonHorizontalLayout.addComponent(horizontalSpaceLabel); nextButtonHorizontalLayout.addComponent(nextButton); nextButtonLayout.addComponent(nextButtonHorizontalLayout); navigationFormLayout.addComponent(nextButtonLayout); navigationFormLayout.setComponentAlignment(nextButtonLayout, Alignment.TOP_RIGHT); navigationFormLayout.setSpacing(false); navigationFormLayout.setMargin(false); return navigationFormLayout; }
From source file:com.expressui.core.view.results.Results.java
License:Open Source License
private HorizontalLayout createNavigationLine() { HorizontalLayout resultCountDisplay = new HorizontalLayout(); setDebugId(resultCountDisplay, "resultCountDisplay"); firstResultTextField = createFirstResultTextField(); firstResultTextField.addStyleName("small"); firstResultTextField.setSizeUndefined(); resultCountDisplay.addComponent(firstResultTextField); resultCountLabel = new Label("", Label.CONTENT_XHTML); resultCountLabel.setSizeUndefined(); resultCountLabel.addStyleName("small"); resultCountDisplay.addComponent(resultCountLabel); Label spaceLabel = new Label(" ", Label.CONTENT_XHTML); spaceLabel.setSizeUndefined();/*from w ww. j a v a 2s .c o m*/ resultCountDisplay.addComponent(spaceLabel); Button refreshButton = new Button(null, getResultsTable(), "refresh"); refreshButton.setDescription(uiMessageSource.getToolTip("results.refresh.toolTip")); refreshButton.setSizeUndefined(); refreshButton.addStyleName("borderless"); refreshButton.setIcon(new ThemeResource("../expressui/icons/16/refresh-blue.png")); resultCountDisplay.addComponent(refreshButton); HorizontalLayout navigationButtons = new HorizontalLayout(); setDebugId(navigationButtons, "navigationButtons"); navigationButtons.setMargin(false, true, false, false); navigationButtons.setSpacing(true); String perPageText = uiMessageSource.getMessage("results.pageSize"); pageSizeMenu = new Select(); pageSizeMenu.addStyleName("small"); List<Integer> pageSizeOptions = applicationProperties.getPageSizeOptions(); for (Integer pageSizeOption : pageSizeOptions) { pageSizeMenu.addItem(pageSizeOption); pageSizeMenu.setItemCaption(pageSizeOption, pageSizeOption + " " + perPageText); } pageSizeMenu.setFilteringMode(Select.FILTERINGMODE_OFF); pageSizeMenu.setNewItemsAllowed(false); pageSizeMenu.setNullSelectionAllowed(false); pageSizeMenu.setImmediate(true); pageSizeMenu.setWidth(8, UNITS_EM); navigationButtons.addComponent(pageSizeMenu); firstButton = new Button(null, getResultsTable(), "firstPage"); firstButton.setDescription(uiMessageSource.getToolTip("results.first.toolTip")); firstButton.setSizeUndefined(); firstButton.addStyleName("borderless"); firstButton.setIcon(new ThemeResource("../expressui/icons/16/first.png")); navigationButtons.addComponent(firstButton); previousButton = new Button(null, getResultsTable(), "previousPage"); previousButton.setDescription(uiMessageSource.getToolTip("results.previous.toolTip")); previousButton.setSizeUndefined(); previousButton.addStyleName("borderless"); previousButton.setIcon(new ThemeResource("../expressui/icons/16/previous.png")); navigationButtons.addComponent(previousButton); nextButton = new Button(null, getResultsTable(), "nextPage"); nextButton.setDescription(uiMessageSource.getToolTip("results.next.toolTip")); nextButton.setSizeUndefined(); nextButton.addStyleName("borderless"); nextButton.setIcon(new ThemeResource("../expressui/icons/16/next.png")); navigationButtons.addComponent(nextButton); lastButton = new Button(null, getResultsTable(), "lastPage"); lastButton.setDescription(uiMessageSource.getToolTip("results.last.toolTip")); lastButton.setSizeUndefined(); lastButton.addStyleName("borderless"); lastButton.setIcon(new ThemeResource("../expressui/icons/16/last.png")); navigationButtons.addComponent(lastButton); excelButton = new Button(null, this, "openExportForm"); excelButton.setDescription(uiMessageSource.getToolTip("results.excel.toolTip")); excelButton.setSizeUndefined(); excelButton.addStyleName("borderless"); excelButton.setIcon(new ThemeResource("../expressui/icons/16/excel.bmp")); navigationButtons.addComponent(excelButton); exportForm.setExportButtonListener(this, "exportToExcel"); HorizontalLayout navigationLine = new HorizontalLayout(); setDebugId(navigationLine, "navigationLine"); navigationLine.setSizeUndefined(); navigationLine.setMargin(true, false, true, false); navigationLine.addComponent(resultCountDisplay); navigationLine.setComponentAlignment(resultCountDisplay, Alignment.BOTTOM_LEFT); spaceLabel = new Label("", Label.CONTENT_XHTML); spaceLabel.setWidth(2, Sizeable.UNITS_EM); navigationLine.addComponent(spaceLabel); navigationLine.addComponent(navigationButtons); navigationLine.setComponentAlignment(navigationButtons, Alignment.BOTTOM_RIGHT); return navigationLine; }
From source file:com.fnc.view.ui.AlphaListMainUI.java
public AlphaListMainUI() { setSizeFull();/*from w ww .j ava 2 s. co m*/ setMargin(true); addComponent(buildForms()); HorizontalLayout h = new HorizontalLayout(); h.setWidthUndefined(); h.setSpacing(true); progress.setWidth("150px"); h.addComponent(progress); h.setComponentAlignment(progress, Alignment.MIDDLE_LEFT); status.setValue("0%"); h.addComponent(status); addComponent(h); addComponent(grid); }
From source file:com.fnc.view.ui.thirteenth.ThirteenthMonthUI.java
public ThirteenthMonthUI() { setSizeFull();/*from w w w .j a va 2 s. com*/ setMargin(true); addComponent(buildForms()); HorizontalLayout h = new HorizontalLayout(); h.setWidthUndefined(); h.setSpacing(true); progress.setWidth("150px"); h.addComponent(progress); h.setComponentAlignment(progress, Alignment.MIDDLE_LEFT); status.setValue("0%"); h.addComponent(status); addComponent(h); }
From source file:com.foc.helpBook.HelpUI.java
License:Apache License
@Override public FocCentralPanel newWindow() { FocCentralPanel focCentralPanel = new FocCentralPanel(); focCentralPanel.fill();//from w w w . j a va 2 s .c o m Label labelHelpContent = new Label(); labelHelpContent.setContentMode(ContentMode.HTML); String htmlContent = (String) FocWebApplication.getFocWebSession_Static().getParameter("HELP_CONTENT"); labelHelpContent.setValue(htmlContent); VerticalLayout mainLayout = new VerticalLayout(); mainLayout.setSizeFull(); HorizontalLayout navigationLayout = new HorizontalLayout(); navigationLayout.setWidth("95%"); navigationLayout.addComponent(getPreviousPageButton()); navigationLayout.setComponentAlignment(getPreviousPageButton(), Alignment.BOTTOM_LEFT); navigationLayout.addComponent(getNextPageButton()); navigationLayout.setComponentAlignment(getNextPageButton(), Alignment.BOTTOM_RIGHT); mainLayout.addComponent(labelHelpContent); mainLayout.addComponent(navigationLayout); mainLayout.setComponentAlignment(navigationLayout, Alignment.BOTTOM_CENTER); focCentralPanel.addComponent(mainLayout); return focCentralPanel; }
From source file:com.foc.vaadin.FocCentralPanel.java
License:Apache License
protected void adjustToFullScreen(ICentralPanel newCentralPanel, boolean fullScreen) { //Panel-Vertical if (newCentralPanel != null && newCentralPanel instanceof Component) { if (fullScreen) { centralPanel.setContent((Component) newCentralPanel); centralPanel.markAsDirty();/*from w w w. ja v a 2 s .co m*/ ((Component) newCentralPanel).setWidth("100%"); //getCentralPanelWrapper().setWidth("100%"); } else { Component newCentralPanleComponent = (Component) newCentralPanel; HorizontalLayout wrapperOfCentralLayout = new HorizontalLayout(); wrapperOfCentralLayout.addComponent(newCentralPanleComponent); wrapperOfCentralLayout.setComponentAlignment(newCentralPanleComponent, Alignment.TOP_CENTER); centralPanel.setContent(wrapperOfCentralLayout); centralPanel.markAsDirty(); newCentralPanleComponent.setWidth(WIDTH_PORTRAIT); wrapperOfCentralLayout.setWidth("100%"); //Apply same style to the wrapper if (newCentralPanleComponent instanceof FocXMLLayout) { Component firstComp = ((FocXMLLayout) newCentralPanleComponent).getFirstRootComponent(); if (firstComp != null && firstComp instanceof FocXMLGuiComponent) { Attributes attrib = ((FocXMLGuiComponent) firstComp).getAttributes(); String style = attrib != null ? attrib.getValue(FXML.ATT_STYLE) : null; if (style != null) { FocXMLGuiComponentStatic.applyStyle(wrapperOfCentralLayout, style); } } } // centralPanel.setContent((Component) newCentralPanel); // centralPanel.markAsDirty(); // ((Component)newCentralPanel).setWidth(WIDTH_PORTRAIT); } } }
From source file:com.foc.vaadin.gui.xmlForm.FocXMLLayout.java
License:Apache License
@Override public void addedToNavigator() { if (FocWebApplication.getInstanceForThread().isMobile() && validationLayout != null) { FocWebVaadinWindow focWebVaadinWindow = ((FocWebVaadinWindow) getMainWindow()); if (focWebVaadinWindow != null && focWebVaadinWindow.getCentralHeader() != null) { HorizontalLayout centralHeader = focWebVaadinWindow.getCentralHeader(); centralHeader.addComponent(validationLayout); centralHeader.setComponentAlignment(validationLayout, Alignment.MIDDLE_RIGHT); centralHeader.setExpandRatio(validationLayout, 1); centralHeader.setWidth("100%"); }/*from ww w. j ava 2 s . c om*/ } }
From source file:com.freebox.engeneering.application.web.layout.HeaderController.java
License:Apache License
/** * Loads data into the form when system enters 'loadData' state. * * @param event - the state event./*from w ww. ja va 2 s . c o m*/ */ @SuppressWarnings("rawtypes") @OnEnterState(StateConstants.PROFILE) public void buildHeader(StateEvent event) { clearView(event); HorizontalLayout top = super.getView(); final Label title = new Label("My Freebox Manager"); title.setSizeUndefined(); title.addStyleName("h1"); top.addComponent(title); top.setComponentAlignment(title, Alignment.MIDDLE_LEFT); top.setExpandRatio(title, 1); Button notify = new Button(); notify.setDescription("Notifications"); notify.addStyleName("notifications"); notify.addStyleName("unread"); notify.addStyleName("icon-only"); notify.addStyleName("icon-bell"); top.addComponent(notify); top.setComponentAlignment(notify, Alignment.MIDDLE_LEFT); Button edit = new Button(); edit.addStyleName("icon-edit"); edit.addStyleName("icon-only"); edit.setDescription("Edit Dashboard"); top.addComponent(edit); top.setComponentAlignment(edit, Alignment.MIDDLE_LEFT); Button downloadB = new Button(); downloadB.addStyleName("icon-edit"); downloadB.addStyleName("icon-only"); downloadB.setDescription("Tlcharger un fichier"); top.addComponent(downloadB); top.setComponentAlignment(downloadB, Alignment.MIDDLE_LEFT); }