List of usage examples for com.vaadin.ui VerticalLayout addComponent
@Override public void addComponent(Component c)
From source file:com.etest.view.tq.TQCoverageUI.java
Window getMaxItemsWindow(Item item, double previousValue) { Window sub = new Window("Field Value: "); sub.setWidth("150px"); sub.setModal(true);//from w w w . ja v a 2 s. co m sub.center(); sub.setResizable(false); VerticalLayout v = new VerticalLayout(); v.setWidth("100%"); v.setMargin(true); v.setSpacing(true); TextField field = new CommonTextField("Enter Value..", "Enter a Value: "); v.addComponent(field); Button button = new Button("CLOSE"); button.setWidth("100%"); button.setIcon(FontAwesome.TASKS); button.addStyleName(ValoTheme.BUTTON_PRIMARY); button.addStyleName(ValoTheme.BUTTON_SMALL); button.addClickListener((Button.ClickEvent event) -> { boolean isNumeric = CommonUtilities.isNumeric(field.getValue().trim()); if (!isNumeric) { return; } item.getItemProperty("Max Items").setValue(CommonUtilities.convertStringToDouble(field.getValue())); if (tq.calculateTotalMaxItems(grid) == CommonUtilities .convertStringToDouble(totalItems.getValue().trim())) { footer.getCell("Max Items").setText(String.valueOf(tq.calculateTotalMaxItems(grid))); } else { item.getItemProperty("Max Items").setValue(previousValue); footer.getCell("Max Items").setText(String.valueOf(tq.calculateTotalMaxItems(grid))); ShowErrorNotification.warning("Total Max Items should be equal to Total Test Items"); return; } sub.close(); }); v.addComponent(button); v.setComponentAlignment(button, Alignment.BOTTOM_CENTER); sub.setContent(v); sub.getContent().setHeightUndefined(); return sub; }
From source file:com.etest.view.tq.TQCoverageWindow.java
Window confirmDeleteWindow() { Window sub = new Window("TQ Coverage"); sub.setWidth("250px"); sub.setResizable(false);//from w ww . j a v a2 s . c o m sub.setModal(true); sub.center(); VerticalLayout v = new VerticalLayout(); v.setWidth("100%"); v.setMargin(true); Button delete = new Button("DELETE TQ?"); delete.setWidth("100%"); delete.setIcon(FontAwesome.TRASH_O); delete.addStyleName(ValoTheme.BUTTON_PRIMARY); delete.addStyleName(ValoTheme.BUTTON_SMALL); delete.addClickListener((Button.ClickEvent event) -> { boolean result = tq.deleteTQCoverage(getTQCoverageId()); if (result) { sub.close(); close(); } }); v.addComponent(delete); sub.setContent(v); sub.getContent().setHeightUndefined(); return sub; }
From source file:com.etest.view.tq.TQListUI.java
public Table populateDataTable() { removeAllItems();/* w w w . j av a2 s .co m*/ int i = 0; for (TQCoverage t : tq.getAllTQCoverage()) { VerticalLayout v = new VerticalLayout(); v.setWidth("100%"); Button view = new Button("view"); view.setSizeFull(); view.setData(t.getTqCoverageId()); view.setIcon(FontAwesome.VIDEO_CAMERA); view.addStyleName(ValoTheme.BUTTON_LINK); view.addStyleName(ValoTheme.BUTTON_TINY); view.addStyleName(ValoTheme.BUTTON_QUIET); view.addStyleName("button-container"); view.addClickListener(remarksBtnClickListener); v.addComponent(view); v.setComponentAlignment(view, Alignment.MIDDLE_LEFT); Button approve = new Button("status"); approve.setSizeFull(); approve.setData(t.getTqCoverageId()); approve.addStyleName(ValoTheme.BUTTON_LINK); approve.addStyleName(ValoTheme.BUTTON_TINY); approve.addStyleName(ValoTheme.BUTTON_QUIET); approve.addStyleName("button-container"); v.addComponent(approve); v.setComponentAlignment(approve, Alignment.MIDDLE_LEFT); // Button print = new Button("print"); // print.setSizeFull(); // print.setData(t.getTqCoverageId()); // print.setIcon(FontAwesome.PRINT); // print.addStyleName(ValoTheme.BUTTON_LINK); // print.addStyleName(ValoTheme.BUTTON_TINY); // print.addStyleName(ValoTheme.BUTTON_QUIET); // print.addStyleName("button-container"); // print.addClickListener(remarksBtnClickListener); // v.addComponent(print); // v.setComponentAlignment(print, Alignment.MIDDLE_LEFT); if (t.getStatus() == 0) { approve.setIcon(FontAwesome.THUMBS_DOWN); // print.setVisible(false); } else { approve.setIcon(FontAwesome.THUMBS_UP); // print.setVisible(true); } addItem(new Object[] { t.getExamTitle(), cs.getCurriculumById(t.getCurriculumId()).getSubject(), t.getDateCreated(), t.getTotalHoursCoverage(), t.getTotalItems(), v }, i); i++; } setPageLength(size()); return this; }
From source file:com.etest.view.tq.TQMainUI.java
public TQMainUI() { setWidth("100%"); addStyleName("bar"); VerticalLayout v = new VerticalLayout(); v.setCaption("Create TQ Coverage"); v.setWidth("100%"); v.addComponent(new TQCoverageUI()); v.setMargin(true);/*from w ww . ja va 2s . c om*/ addComponent(v); v = new VerticalLayout(); v.setCaption("TQ List"); v.setWidth("100%"); v.addComponent(tqListUI.populateDataTable()); v.setMargin(true); addComponent(v); v = new VerticalLayout(); v.setCaption("Item Analysis"); v.setWidth("100%"); v.addComponent(tqItemAnalysis.populateDataTable()); v.setMargin(true); addComponent(v); // v = new VerticalLayout(); // v.setCaption("Reports"); // v.setWidth("100%"); // v.addComponent(new ReportMainUI()); // v.setMargin(true); // addComponent(v); addSelectedTabChangeListener(this); }
From source file:com.example.bbs.vaadin.view.Labels.java
License:Apache License
public Labels() { setMargin(true);/*from w w w. j a va 2 s . c o m*/ addStyleName("content-labels"); Label h1 = new Label("Labels"); h1.addStyleName(ValoTheme.LABEL_H1); addComponent(h1); HorizontalLayout split = new HorizontalLayout(); split.setWidth("100%"); addComponent(split); VerticalLayout left = new VerticalLayout(); left.setMargin(new MarginInfo(false, true, false, false)); split.addComponent(left); Label huge = new Label("Huge type for display text."); huge.addStyleName(ValoTheme.LABEL_HUGE); left.addComponent(huge); Label large = new Label( "Large type for introductory text. Etiam at risus et justo dignissim congue. Donec congue lacinia dui, a porttitor lectus condimentum laoreet. Nunc eu."); large.addStyleName(ValoTheme.LABEL_LARGE); left.addComponent(large); Label h2 = new Label("Subtitle"); h2.addStyleName(ValoTheme.LABEL_H2); left.addComponent(h2); Label normal = new Label( "Normal type for plain text, with a <a href=\"https://vaadin.com\">regular link</a>. Etiam at risus et justo dignissim congue. Donec congue lacinia dui, a porttitor lectus condimentum laoreet. Nunc eu.", ContentMode.HTML); left.addComponent(normal); Label h3 = new Label("Small Title"); h3.addStyleName(ValoTheme.LABEL_H3); left.addComponent(h3); Label small = new Label( "Small type for additional text. Etiam at risus et justo dignissim congue. Donec congue lacinia dui, a porttitor lectus condimentum laoreet. Nunc eu."); small.addStyleName(ValoTheme.LABEL_SMALL); left.addComponent(small); Label tiny = new Label("Tiny type for minor text."); tiny.addStyleName(ValoTheme.LABEL_TINY); left.addComponent(tiny); Label h4 = new Label("Section Title"); h4.addStyleName(ValoTheme.LABEL_H4); left.addComponent(h4); normal = new Label( "Normal type for plain text. Etiam at risus et justo dignissim congue. Donec congue lacinia dui, a porttitor lectus condimentum laoreet. Nunc eu."); left.addComponent(normal); Panel p = new Panel("Additional Label Styles"); split.addComponent(p); VerticalLayout right = new VerticalLayout(); right.setSpacing(true); right.setMargin(true); p.setContent(right); Label label = new Label( "Bold type for prominent text. Etiam at risus et justo dignissim congue. Donec congue lacinia dui, a porttitor lectus condimentum laoreet. Nunc eu."); label.addStyleName(ValoTheme.LABEL_BOLD); right.addComponent(label); label = new Label( "Light type for subtle text. Etiam at risus et justo dignissim congue. Donec congue lacinia dui, a porttitor lectus condimentum laoreet. Nunc eu."); label.addStyleName(ValoTheme.LABEL_LIGHT); right.addComponent(label); label = new Label( "Colored type for highlighted text. Etiam at risus et justo dignissim congue. Donec congue lacinia dui, a porttitor lectus condimentum laoreet. Nunc eu."); label.addStyleName(ValoTheme.LABEL_COLORED); right.addComponent(label); label = new Label("A label for success"); label.addStyleName(ValoTheme.LABEL_SUCCESS); right.addComponent(label); label = new Label("A label for failure"); label.addStyleName(ValoTheme.LABEL_FAILURE); right.addComponent(label); }
From source file:com.example.SimpleExampleVaadinUI.java
License:Apache License
@Override protected void init(VaadinRequest request) { VerticalLayout vl = new VerticalLayout(); vl.addComponent(new MyComponent()); setContent(vl);// w ww .j a v a 2 s. co m }
From source file:com.example.vaadin.MyVaadinApplication.java
License:Apache License
public void authenticatedScreen() { VerticalLayout vLayout = new VerticalLayout(); Label label = new Label("Logged in as " + currentUser.getPrincipal().toString()); vLayout.setSizeFull();//from w w w . ja va 2s .co m vLayout.addComponent(horizontalSplit); /* Allocate all available extra space to the horizontal split panel */ vLayout.setExpandRatio(horizontalSplit, 1); /* Set the initial split position so we can have a 200 pixel menu to the left */ horizontalSplit.setFirstComponent(tree); horizontalSplit.setSplitPosition(200, SplitPanel.UNITS_PIXELS); vLayout.addStyleName("view"); getMainWindow().setContent(vLayout); //this.addComponent(layout); }
From source file:com.expressui.core.MainApplication.java
License:Open Source License
@Override public void init() { currentInstance.set(this); setTheme(getCustomTheme());//from www. j a v a 2s .c om customizeConfirmDialogStyle(); Window mainWindow = new Window(); setMainWindow(mainWindow); mainWindow.addStyleName("e-main-window"); mainWindow.setCaption(getTypeCaption()); VerticalLayout mainLayout = new VerticalLayout(); String id = StringUtil.generateDebugId("e", this, mainLayout, "mainLayout"); mainLayout.setDebugId(id); mainWindow.setSizeFull(); mainLayout.setSizeFull(); mainWindow.setContent(mainLayout); setLogoutURL(getApplicationProperties().getRestartApplicationUrl()); configureLeftMenuBar(mainMenuBar.getLeftMenuBarRoot()); configureRightMenuBar(mainMenuBar.getRightMenuBarRoot()); mainLayout.addComponent(mainMenuBar); pageLayoutTabSheet = new TabSheet(); id = StringUtil.generateDebugId("e", this, pageLayoutTabSheet, "pageLayoutTabSheet"); pageLayoutTabSheet.setDebugId(id); pageLayoutTabSheet.addStyleName("e-main-page-layout"); pageLayoutTabSheet.setSizeFull(); mainLayout.addComponent(pageLayoutTabSheet); mainLayout.setExpandRatio(pageLayoutTabSheet, 1.0f); Link expressUILink = new Link(uiMessageSource.getMessage("mainApplication.footerMessage"), new ExternalResource(uiMessageSource.getMessage("mainApplication.footerLink"))); expressUILink.setTargetName("_blank"); expressUILink.setIcon(new ThemeResource("../expressui/favicon.png")); expressUILink.setSizeUndefined(); mainLayout.addComponent(expressUILink); mainLayout.setComponentAlignment(expressUILink, Alignment.TOP_CENTER); configureSessionTimeout(mainWindow); postWire(); onDisplay(); }
From source file:com.expressui.core.MainApplication.java
License:Open Source License
/** * Opens a separate error Window with the full stack trace of a throwable * and error box highlighting the root cause message. * * @param throwable full stack trace of this throwable is displayed in error Window *///from w w w . ja v a 2 s.c o m public void openErrorWindow(Throwable throwable) { showError(ExceptionUtils.getRootCauseMessage(throwable)); String message = ExceptionUtils.getFullStackTrace(throwable); Window errorWindow = new Window(uiMessageSource.getMessage("mainApplication.errorWindowCaption")); errorWindow.addStyleName("opaque"); VerticalLayout layout = (VerticalLayout) errorWindow.getContent(); layout.setSpacing(true); layout.setWidth("100%"); errorWindow.setWidth("100%"); errorWindow.setModal(true); Label label = new Label(message); label.setContentMode(Label.CONTENT_PREFORMATTED); layout.addComponent(label); errorWindow.setClosable(true); errorWindow.setScrollable(true); getMainWindow().addWindow(errorWindow); }
From source file:com.expressui.core.view.form.layout.TopLabelGridLayout.java
License:Open Source License
@Override public void addField(FormField formField) { VerticalLayout fieldLayout = (VerticalLayout) getComponent(formField.getColumnStart() - 1, formField.getRowStart() - 1); if (fieldLayout == null) { addFieldImpl(formField);//w w w . ja va 2 s . com } else { Field field = formField.getField(); fieldLayout.addComponent(field); } }