List of usage examples for com.vaadin.ui HorizontalLayout HorizontalLayout
public HorizontalLayout()
From source file:com.esspl.datagen.ui.ResultView.java
License:Open Source License
public ResultView(final DataGenApplication dataGenApplication, ArrayList<GeneratorBean> rowList) { log.debug("ResultView constructor start"); VerticalLayout layout = (VerticalLayout) this.getContent(); layout.setMargin(false);/*from www .ja va 2 s.c om*/ layout.setSpacing(false); layout.setHeight("500px"); layout.setWidth("600px"); Button close = new Button("Close", new ClickListener() { public void buttonClick(ClickEvent event) { log.info("ResultView - Close Button clicked"); dataGenApplication.getMainWindow().removeWindow(event.getButton().getWindow()); } }); close.setIcon(DataGenConstant.CLOSE_ICON); String dataOption = dataGenApplication.generateType.getValue().toString(); Generator genrator = null; if (dataOption.equalsIgnoreCase("xml")) { genrator = new XmlDataGenerator(); } else if (dataOption.equalsIgnoreCase("sql")) { genrator = new SqlDataGenerator(); } else if (dataOption.equalsIgnoreCase("csv")) { genrator = new CsvDataGenerator(); } if (genrator == null) { log.info("ResultView - genrator object is null"); dataGenApplication.getMainWindow().removeWindow(this); return; } //Data generated from respective command class and shown in the modal window final TextArea message = new TextArea(); message.setSizeFull(); message.setHeight("450px"); message.setWordwrap(false); message.setStyleName("noResizeTextArea"); message.setValue(genrator.generate(dataGenApplication, rowList)); layout.addComponent(message); Button copy = new Button("Copy", new ClickListener() { public void buttonClick(ClickEvent event) { log.info("ResultView - Copy Button clicked"); //As on Unix environment, it gives headless exception we need to handle it try { //StringSelection stringSelection = new StringSelection(message.getValue().toString()); Transferable tText = new StringSelection(message.getValue().toString()); Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); clipboard.setContents(tText, null); } catch (HeadlessException e) { dataGenApplication.getMainWindow() .showNotification("Due to some problem Text could not be copied."); e.printStackTrace(); } } }); copy.setIcon(DataGenConstant.COPY_ICON); Button execute = new Button("Execute", new ClickListener() { public void buttonClick(ClickEvent event) { log.info("ResultView - Execute Button clicked"); dataGenApplication.tabSheet.setSelectedTab(dataGenApplication.executor); dataGenApplication.executor.setScript(message.getValue().toString()); dataGenApplication.getMainWindow().removeWindow(event.getButton().getWindow()); } }); execute.setIcon(DataGenConstant.EXECUTOR_ICON); Button export = new Button("Export to File", new ClickListener() { public void buttonClick(ClickEvent event) { log.info("ResultView - Export to File Button clicked"); String dataOption = dataGenApplication.generateType.getValue().toString(); DataGenStreamUtil resource = null; try { if (dataOption.equalsIgnoreCase("xml")) { File tempFile = File.createTempFile("tmp", ".xml"); BufferedWriter out = new BufferedWriter(new FileWriter(tempFile)); out.write(message.getValue().toString()); out.close(); resource = new DataGenStreamUtil(dataGenApplication, "data.xml", "text/xml", tempFile); } else if (dataOption.equalsIgnoreCase("csv")) { File tempFile = File.createTempFile("tmp", ".csv"); BufferedWriter out = new BufferedWriter(new FileWriter(tempFile)); out.write(message.getValue().toString()); out.close(); resource = new DataGenStreamUtil(dataGenApplication, "data.csv", "text/csv", tempFile); } else if (dataOption.equalsIgnoreCase("sql")) { File tempFile = File.createTempFile("tmp", ".sql"); BufferedWriter out = new BufferedWriter(new FileWriter(tempFile)); out.write(message.getValue().toString()); out.close(); resource = new DataGenStreamUtil(dataGenApplication, "data.sql", "text/plain", tempFile); } getWindow().open(resource, "_self"); } catch (FileNotFoundException e) { log.info("ResultView - Export to File Error - " + e.getMessage()); e.printStackTrace(); } catch (IOException e) { log.info("ResultView - Export to File Error - " + e.getMessage()); e.printStackTrace(); } catch (Exception e) { log.info("ResultView - Export to File Error - " + e.getMessage()); e.printStackTrace(); } } }); export.setIcon(DataGenConstant.EXPORT_ICON); HorizontalLayout bttnBar = new HorizontalLayout(); if (dataOption.equalsIgnoreCase("sql")) { bttnBar.addComponent(execute); } bttnBar.addComponent(export); bttnBar.addComponent(copy); bttnBar.addComponent(close); layout.addComponent(bttnBar); layout.setComponentAlignment(bttnBar, Alignment.MIDDLE_CENTER); log.debug("ResultView constructor end"); }
From source file:com.esspl.datagen.ui.SettingsView.java
License:Open Source License
private Component createBottomBar(final DataGenApplication dataGenApplication) { HorizontalLayout bottom = new HorizontalLayout(); bottom.setWidth("100%"); bottom.setSpacing(true);// ww w . j a v a 2s.c o m Button addButton = new Button("Add", new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { ConnectionProfile profile = new ConnectionProfile("New Profile", "", "", "", ""); SettingsManager.get().getConfiguration().addProfile(profile); list.getContainerDataSource().addItem(profile); list.select(profile); } }); Button saveProfilesButton = new Button("Save Profiles", new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { SettingsManager.get().persistConfiguration(); } }); Button closeButton = new Button("Close", new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { dataGenApplication.toolbar.reloadConnectionProfile(); close(); } }); bottom.addComponent(addButton); bottom.addComponent(saveProfilesButton); bottom.addComponent(closeButton); bottom.setComponentAlignment(closeButton, Alignment.MIDDLE_RIGHT); bottom.setExpandRatio(closeButton, 1); return bottom; }
From source file:com.esspl.datagen.ui.TableDataView.java
License:Open Source License
public TableDataView(final JdbcTable table, final Connection connection, final DataGenApplication dataApp) { log.debug("TableDataView - constructor start"); setCaption("Data"); dataGenApplication = dataApp;/*from w w w . jav a2 s. co m*/ VerticalLayout vl = new VerticalLayout(); vl.setSizeFull(); setCompositionRoot(vl); HorizontalLayout hBar = new HorizontalLayout(); hBar.setWidth("98%"); hBar.setHeight("40px"); rows = new TextField(); rows.setWidth("50px"); rows.setImmediate(true); rows.addValidator(new IntegerValidator("Rows must be an Integer")); Label lbl = new Label("Generate "); content = new HorizontalLayout(); content.setHeight("40px"); content.setMargin(false, false, false, true); content.setSpacing(true); content.addComponent(lbl); content.setComponentAlignment(lbl, Alignment.MIDDLE_CENTER); content.addComponent(rows); content.setComponentAlignment(rows, Alignment.MIDDLE_CENTER); Button addDataButton = new Button("Row(S) Data", new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { log.debug("TableDataView - Generate Data Button clicked"); populateGenerator(table); } }); addDataButton.addStyleName("small"); addDataButton.setIcon(DataGenConstant.ADD_SMALL); content.addComponent(addDataButton); content.setComponentAlignment(addDataButton, Alignment.MIDDLE_CENTER); Button refreshButton = new Button("Refresh", new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { log.debug("TableDataView - Refresh Button clicked"); refreshDataView(table, connection); } }); refreshButton.addStyleName("small"); refreshButton.setIcon(DataGenConstant.RESET); content.addComponent(refreshButton); content.setComponentAlignment(refreshButton, Alignment.MIDDLE_CENTER); //Tapas:10/08/2012 - Export feature implementation started HorizontalLayout expContainer = new HorizontalLayout(); expContainer.setSpacing(true); PopupButton exportButton = new PopupButton("Export"); exportButton.setComponent(new DataExportView()); exportButton.addListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { //dataApp.getMainWindow().showNotification("Export Button clicked!"); } }); exportButton.setIcon(DataGenConstant.DATAEXPORT_ICON); expContainer.addComponent(exportButton); expContainer.setComponentAlignment(exportButton, Alignment.MIDDLE_LEFT); //Tapas:10/08/2012 - Import feature implementation started PopupButton importButton = new PopupButton("Import"); importButton.setComponent(new DataImportView()); importButton.addListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { //dataApp.getMainWindow().showNotification("Import Button clicked!"); } }); importButton.setIcon(DataGenConstant.DATAIMPORT_ICON); expContainer.addComponent(importButton); expContainer.setComponentAlignment(importButton, Alignment.MIDDLE_RIGHT); tableContainer = new VerticalLayout(); tableContainer.setSizeFull(); hBar.addComponent(content); hBar.setComponentAlignment(content, Alignment.MIDDLE_LEFT); hBar.addComponent(expContainer); hBar.setComponentAlignment(expContainer, Alignment.MIDDLE_RIGHT); vl.addComponent(hBar); vl.addComponent(tableContainer); vl.setExpandRatio(tableContainer, 1f); refreshDataView(table, connection); log.debug("TableDataView - constructor end"); }
From source file:com.etest.valo.ComboBoxes.java
License:Apache License
public ComboBoxes() { setMargin(true);//from www . j ava2s. c om Label h1 = new Label("Combo Boxes"); h1.addStyleName("h1"); addComponent(h1); HorizontalLayout row = new HorizontalLayout(); row.addStyleName("wrapping"); row.setSpacing(true); addComponent(row); ComboBox combo = new ComboBox("Normal"); combo.setInputPrompt("You can type here"); combo.setContainerDataSource(MainUI.generateContainer(200, false)); combo.setNullSelectionAllowed(false); combo.select(combo.getItemIds().iterator().next()); combo.setItemCaptionPropertyId(MainUI.CAPTION_PROPERTY); combo.setItemIconPropertyId(MainUI.ICON_PROPERTY); combo.setItemIcon(combo.getItemIds().iterator().next(), new ThemeResource("../runo/icons/16/document.png")); row.addComponent(combo); CssLayout group = new CssLayout(); group.setCaption("Grouped with a Button"); group.addStyleName("v-component-group"); row.addComponent(group); combo = new ComboBox(); combo.setInputPrompt("You can type here"); combo.setContainerDataSource(MainUI.generateContainer(200, false)); combo.setNullSelectionAllowed(false); combo.select(combo.getItemIds().iterator().next()); combo.setItemCaptionPropertyId(MainUI.CAPTION_PROPERTY); combo.setItemIconPropertyId(MainUI.ICON_PROPERTY); combo.setWidth("240px"); group.addComponent(combo); Button today = new Button("Do It"); group.addComponent(today); combo = new ComboBox("Explicit size"); combo.setInputPrompt("You can type here"); combo.addItem("Option One"); combo.addItem("Option Two"); combo.addItem("Option Three"); combo.setWidth("260px"); combo.setHeight("60px"); row.addComponent(combo); combo = new ComboBox("No text input allowed"); combo.setInputPrompt("You can click here"); combo.addItem("Option One"); combo.addItem("Option Two"); combo.addItem("Option Three"); combo.setTextInputAllowed(false); combo.setNullSelectionAllowed(false); combo.select("Option One"); row.addComponent(combo); combo = new ComboBox("Error"); combo.setInputPrompt("You can type here"); combo.addItem("Option One"); combo.addItem("Option Two"); combo.addItem("Option Three"); combo.setNullSelectionAllowed(false); combo.select("Option One"); combo.setComponentError(new UserError("Fix it, now!")); row.addComponent(combo); combo = new ComboBox("Error, borderless"); combo.setInputPrompt("You can type here"); combo.addItem("Option One"); combo.addItem("Option Two"); combo.addItem("Option Three"); combo.setNullSelectionAllowed(false); combo.select("Option One"); combo.setComponentError(new UserError("Fix it, now!")); combo.addStyleName("borderless"); row.addComponent(combo); combo = new ComboBox("Disabled"); combo.setInputPrompt("You can't type here"); combo.addItem("Option One"); combo.addItem("Option Two"); combo.addItem("Option Three"); combo.setEnabled(false); row.addComponent(combo); combo = new ComboBox("Custom color"); combo.setInputPrompt("You can type here"); combo.setContainerDataSource(MainUI.generateContainer(200, false)); combo.setItemCaptionPropertyId(MainUI.CAPTION_PROPERTY); combo.setItemIconPropertyId(MainUI.ICON_PROPERTY); combo.addStyleName("color1"); row.addComponent(combo); combo = new ComboBox("Custom color"); combo.setInputPrompt("You can type here"); combo.setContainerDataSource(MainUI.generateContainer(200, false)); combo.setItemCaptionPropertyId(MainUI.CAPTION_PROPERTY); combo.setItemIconPropertyId(MainUI.ICON_PROPERTY); combo.addStyleName("color2"); row.addComponent(combo); combo = new ComboBox("Custom color"); combo.setInputPrompt("You can type here"); combo.setContainerDataSource(MainUI.generateContainer(200, false)); combo.setItemCaptionPropertyId(MainUI.CAPTION_PROPERTY); combo.setItemIconPropertyId(MainUI.ICON_PROPERTY); combo.addStyleName("color3"); row.addComponent(combo); combo = new ComboBox("Small"); combo.setInputPrompt("You can type here"); combo.setContainerDataSource(MainUI.generateContainer(200, false)); combo.setItemCaptionPropertyId(MainUI.CAPTION_PROPERTY); combo.setItemIconPropertyId(MainUI.ICON_PROPERTY); combo.addStyleName("small"); row.addComponent(combo); combo = new ComboBox("Large"); combo.setInputPrompt("You can type here"); combo.setContainerDataSource(MainUI.generateContainer(200, false)); combo.setItemCaptionPropertyId(MainUI.CAPTION_PROPERTY); combo.setItemIconPropertyId(MainUI.ICON_PROPERTY); combo.addStyleName("large"); row.addComponent(combo); combo = new ComboBox("Borderless"); combo.setInputPrompt("You can type here"); combo.addItem("Option One"); combo.addItem("Option Two"); combo.addItem("Option Three"); combo.addStyleName("borderless"); row.addComponent(combo); combo = new ComboBox("Tiny"); combo.setInputPrompt("You can type here"); combo.setContainerDataSource(MainUI.generateContainer(200, false)); combo.setItemCaptionPropertyId(MainUI.CAPTION_PROPERTY); combo.setItemIconPropertyId(MainUI.ICON_PROPERTY); combo.addStyleName("tiny"); row.addComponent(combo); combo = new ComboBox("Huge"); combo.setInputPrompt("You can type here"); combo.setContainerDataSource(MainUI.generateContainer(200, false)); combo.setItemCaptionPropertyId(MainUI.CAPTION_PROPERTY); combo.setItemIconPropertyId(MainUI.ICON_PROPERTY); combo.addStyleName("huge"); row.addComponent(combo); }
From source file:com.etest.valo.Forms.java
License:Apache License
public Forms() { setSpacing(true);/*from ww w . j a v a 2 s.com*/ setMargin(true); Label title = new Label("Forms"); title.addStyleName("h1"); addComponent(title); final FormLayout form = new FormLayout(); form.setMargin(false); form.setWidth("800px"); form.addStyleName("light"); addComponent(form); Label section = new Label("Personal Info"); section.addStyleName("h2"); section.addStyleName("colored"); form.addComponent(section); StringGenerator sg = new StringGenerator(); TextField name = new TextField("Name"); name.setValue(sg.nextString(true) + " " + sg.nextString(true)); name.setWidth("50%"); form.addComponent(name); DateField birthday = new DateField("Birthday"); birthday.setValue(new Date(80, 0, 31)); form.addComponent(birthday); TextField username = new TextField("Username"); username.setValue(sg.nextString(false) + sg.nextString(false)); username.setRequired(true); form.addComponent(username); OptionGroup sex = new OptionGroup("Sex"); sex.addItem("Female"); sex.addItem("Male"); sex.select("Male"); sex.addStyleName("horizontal"); form.addComponent(sex); section = new Label("Contact Info"); section.addStyleName("h3"); section.addStyleName("colored"); form.addComponent(section); TextField email = new TextField("Email"); email.setValue(sg.nextString(false) + "@" + sg.nextString(false) + ".com"); email.setWidth("50%"); email.setRequired(true); form.addComponent(email); TextField location = new TextField("Location"); location.setValue(sg.nextString(true) + ", " + sg.nextString(true)); location.setWidth("50%"); location.setComponentError(new UserError("This address doesn't exist")); form.addComponent(location); TextField phone = new TextField("Phone"); phone.setWidth("50%"); form.addComponent(phone); HorizontalLayout wrap = new HorizontalLayout(); wrap.setSpacing(true); wrap.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); wrap.setCaption("Newsletter"); CheckBox newsletter = new CheckBox("Subscribe to newsletter", true); wrap.addComponent(newsletter); ComboBox period = new ComboBox(); period.setTextInputAllowed(false); period.addItem("Daily"); period.addItem("Weekly"); period.addItem("Monthly"); period.setNullSelectionAllowed(false); period.select("Weekly"); period.addStyleName("small"); period.setWidth("10em"); wrap.addComponent(period); form.addComponent(wrap); section = new Label("Additional Info"); section.addStyleName("h4"); section.addStyleName("colored"); form.addComponent(section); TextField website = new TextField("Website"); website.setInputPrompt("http://"); website.setWidth("100%"); form.addComponent(website); TextArea shortbio = new TextArea("Short Bio"); shortbio.setValue( "Quis aute iure reprehenderit in voluptate velit esse. Cras mattis iudicium purus sit amet fermentum."); shortbio.setWidth("100%"); shortbio.setRows(2); form.addComponent(shortbio); final RichTextArea bio = new RichTextArea("Bio"); bio.setWidth("100%"); bio.setValue( "<div><p><span>Integer legentibus erat a ante historiarum dapibus.</span> <span>Vivamus sagittis lacus vel augue laoreet rutrum faucibus.</span> <span>A communi observantia non est recedendum.</span> <span>Morbi fringilla convallis sapien, id pulvinar odio volutpat.</span> <span>Ab illo tempore, ab est sed immemorabili.</span> <span>Quam temere in vitiis, legem sancimus haerentia.</span></p><p><span>Morbi odio eros, volutpat ut pharetra vitae, lobortis sed nibh.</span> <span>Quam diu etiam furor iste tuus nos eludet?</span> <span>Cum sociis natoque penatibus et magnis dis parturient.</span> <span>Quam diu etiam furor iste tuus nos eludet?</span> <span>Tityre, tu patulae recubans sub tegmine fagi dolor.</span></p><p><span>Curabitur blandit tempus ardua ridiculus sed magna.</span> <span>Phasellus laoreet lorem vel dolor tempus vehicula.</span> <span>Etiam habebis sem dicantur magna mollis euismod.</span> <span>Hi omnes lingua, institutis, legibus inter se differunt.</span></p></div>"); form.addComponent(bio); form.setReadOnly(true); bio.setReadOnly(true); Button edit = new Button("Edit", new ClickListener() { @Override public void buttonClick(ClickEvent event) { boolean readOnly = form.isReadOnly(); if (readOnly) { bio.setReadOnly(false); form.setReadOnly(false); form.removeStyleName("light"); event.getButton().setCaption("Save"); event.getButton().addStyleName("primary"); } else { bio.setReadOnly(true); form.setReadOnly(true); form.addStyleName("light"); event.getButton().setCaption("Edit"); event.getButton().removeStyleName("primary"); } } }); HorizontalLayout footer = new HorizontalLayout(); footer.setMargin(new MarginInfo(true, false, true, false)); footer.setSpacing(true); footer.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); form.addComponent(footer); footer.addComponent(edit); Label lastModified = new Label("Last modified by you a minute ago"); lastModified.addStyleName("light"); footer.addComponent(lastModified); }
From source file:com.etest.valo.MenuBars.java
License:Apache License
public MenuBars() { setMargin(true);//from w ww . ja v a 2 s. c om setSpacing(true); Label h1 = new Label("Menu Bars"); h1.addStyleName("h1"); addComponent(h1); MenuBar menuBar = getMenuBar(); menuBar.setCaption("Normal style"); addComponent(menuBar); menuBar = getMenuBar(); menuBar.setCaption("Small style"); menuBar.addStyleName("small"); addComponent(menuBar); menuBar = getMenuBar(); menuBar.setCaption("Borderless style"); menuBar.addStyleName("borderless"); addComponent(menuBar); menuBar = getMenuBar(); menuBar.setCaption("Small borderless style"); menuBar.addStyleName("borderless"); menuBar.addStyleName("small"); addComponent(menuBar); Label h2 = new Label("Drop Down Button"); h2.addStyleName("h2"); addComponent(h2); HorizontalLayout wrap = new HorizontalLayout(); wrap.addStyleName("wrapping"); wrap.setSpacing(true); addComponent(wrap); wrap.addComponent(getMenuButton("Normal", false)); MenuBar split = getMenuButton("Small", false); split.addStyleName("small"); wrap.addComponent(split); split = getMenuButton("Borderless", false); split.addStyleName("borderless"); wrap.addComponent(split); split = getMenuButton("Themed", false); split.addStyleName("color1"); wrap.addComponent(split); split = getMenuButton("Small", false); split.addStyleName("color1"); split.addStyleName("small"); wrap.addComponent(split); h2 = new Label("Split Button"); h2.addStyleName("h2"); addComponent(h2); wrap = new HorizontalLayout(); wrap.addStyleName("wrapping"); wrap.setSpacing(true); addComponent(wrap); wrap.addComponent(getMenuButton("Normal", true)); split = getMenuButton("Small", true); split.addStyleName("small"); wrap.addComponent(split); split = getMenuButton("Borderless", true); split.addStyleName("borderless"); wrap.addComponent(split); split = getMenuButton("Themed", true); split.addStyleName("color1"); wrap.addComponent(split); split = getMenuButton("Small", true); split.addStyleName("color1"); split.addStyleName("small"); wrap.addComponent(split); }
From source file:com.etest.valo.Sliders.java
License:Apache License
public Sliders() { setMargin(true);/*ww w .jav a 2 s.co m*/ Label h1 = new Label("Sliders"); h1.addStyleName("h1"); addComponent(h1); HorizontalLayout row = new HorizontalLayout(); row.addStyleName("wrapping"); row.setSpacing(true); addComponent(row); Slider slider = new Slider("Horizontal"); slider.setValue(50.0); row.addComponent(slider); slider = new Slider("Horizontal, sized"); slider.setValue(50.0); slider.setWidth("200px"); row.addComponent(slider); slider = new Slider("Custom handle"); slider.setValue(50.0); slider.setWidth("200px"); slider.addStyleName("color1"); row.addComponent(slider); slider = new Slider("Custom track"); slider.setValue(50.0); slider.setWidth("200px"); slider.addStyleName("color2"); row.addComponent(slider); slider = new Slider("Custom indicator"); slider.setValue(50.0); slider.setWidth("200px"); slider.addStyleName("color3"); row.addComponent(slider); slider = new Slider("No indicator"); slider.setValue(50.0); slider.setWidth("200px"); slider.addStyleName("no-indicator"); row.addComponent(slider); slider = new Slider("With ticks (not in IE8 & IE9)"); slider.setValue(3.0); slider.setWidth("200px"); slider.setMax(4); slider.addStyleName("ticks"); row.addComponent(slider); slider = new Slider("Toggle imitation"); slider.setWidth("50px"); slider.setResolution(0); slider.setMin(0); slider.setMax(1); row.addComponent(slider); slider = new Slider("Vertical"); slider.setValue(50.0); slider.setOrientation(SliderOrientation.VERTICAL); row.addComponent(slider); slider = new Slider("Vertical, sized"); slider.setValue(50.0); slider.setOrientation(SliderOrientation.VERTICAL); slider.setHeight("200px"); row.addComponent(slider); slider = new Slider("Custom handle"); slider.setValue(50.0); slider.setHeight("200px"); slider.addStyleName("color1"); slider.setOrientation(SliderOrientation.VERTICAL); row.addComponent(slider); slider = new Slider("Custom track"); slider.setValue(50.0); slider.setHeight("200px"); slider.addStyleName("color2"); slider.setOrientation(SliderOrientation.VERTICAL); row.addComponent(slider); slider = new Slider("Custom indicator"); slider.setValue(50.0); slider.setHeight("200px"); slider.addStyleName("color3"); slider.setOrientation(SliderOrientation.VERTICAL); row.addComponent(slider); slider = new Slider("No indicator"); slider.setValue(50.0); slider.setHeight("200px"); slider.addStyleName("no-indicator"); slider.setOrientation(SliderOrientation.VERTICAL); row.addComponent(slider); slider = new Slider("With ticks"); slider.setValue(3.0); slider.setHeight("200px"); slider.setMax(4); slider.addStyleName("ticks"); slider.setOrientation(SliderOrientation.VERTICAL); row.addComponent(slider); slider = new Slider("Disabled"); slider.setValue(50.0); slider.setEnabled(false); row.addComponent(slider); h1 = new Label("Progress Bars"); h1.addStyleName("h1"); addComponent(h1); row = new HorizontalLayout(); row.addStyleName("wrapping"); row.setSpacing(true); addComponent(row); pb = new ProgressBar(); pb.setCaption("Default"); pb.setWidth("300px"); // pb.setValue(0.6f); row.addComponent(pb); pb2 = new ProgressBar(); pb2.setCaption("Point style"); pb2.setWidth("300px"); pb2.addStyleName("point"); // pb2.setValue(0.6f); row.addComponent(pb2); if (!MainUI.isTestMode()) { ProgressBar pb3 = new ProgressBar(); pb3.setIndeterminate(true); pb3.setCaption("Indeterminate"); row.addComponent(pb3); } }
From source file:com.etest.valo.Trees.java
License:Apache License
public Trees() { setMargin(true);// w ww. jav a2 s . c o m Label h1 = new Label("Trees"); h1.addStyleName("h1"); addComponent(h1); HorizontalLayout row = new HorizontalLayout(); row.addStyleName("wrapping"); row.setSpacing(true); addComponent(row); Tree tree = new Tree(); tree.setSelectable(true); tree.setMultiSelect(true); Container generateContainer = MainUI.generateContainer(10, true); tree.setContainerDataSource(generateContainer); tree.setDragMode(TreeDragMode.NODE); row.addComponent(tree); tree.setItemCaptionPropertyId(MainUI.CAPTION_PROPERTY); tree.setItemIconPropertyId(MainUI.ICON_PROPERTY); tree.expandItem(generateContainer.getItemIds().iterator().next()); tree.setDropHandler(new DropHandler() { @Override public AcceptCriterion getAcceptCriterion() { return AcceptAll.get(); } @Override public void drop(DragAndDropEvent event) { Notification.show(event.getTransferable().toString()); } }); // Add actions (context menu) tree.addActionHandler(MainUI.getActionHandler()); }
From source file:com.etest.view.notification.NotificationMainUI.java
public NotificationMainUI() { setSizeFull();// www . j a v a2 s. c o m setSpacing(true); if (VaadinSession.getCurrent().getAttribute("userId") == null) { Page.getCurrent().setLocation("http://localhost:8080/"); } else { addComponent(populateNoficationTable()); } HorizontalLayout h = new HorizontalLayout(); h.setWidth("950px"); Button sendMsgBtn = new Button("Send Message"); sendMsgBtn.setWidthUndefined(); sendMsgBtn.addStyleName(ValoTheme.BUTTON_SMALL); sendMsgBtn.addStyleName(ValoTheme.BUTTON_PRIMARY); sendMsgBtn.addClickListener((Button.ClickEvent event) -> { Notification.show("Send Message!"); }); h.addComponent(sendMsgBtn); h.setComponentAlignment(sendMsgBtn, Alignment.MIDDLE_RIGHT); addComponent(h); }
From source file:com.etest.view.notification.ViewCaseNotificationWindow.java
VerticalLayout buildForms() { VerticalLayout v = new VerticalLayout(); v.setWidth("700px"); v.setMargin(true);/*from w w w . java2s . co m*/ v.setSpacing(true); Label cellCase = new Label(); cellCase.setValue("<b>Case</b>: " + ccs.getCellCaseById(getCellCaseId()).getCaseTopic()); cellCase.setContentMode(ContentMode.HTML); v.addComponent(cellCase); Label cellItem = new Label(); cellItem.setContentMode(ContentMode.HTML); Button approvalBtn = new Button(); approvalBtn.setCaption("Approve CASE"); approvalBtn.setWidthUndefined(); approvalBtn.addStyleName(ValoTheme.BUTTON_TINY); approvalBtn.addStyleName(ValoTheme.BUTTON_PRIMARY); approvalBtn.addClickListener(buttonClickListener); if (ccs.getCellCaseById(getCellCaseId()).getApprovalStatus() == 0) { approvalBtn.setVisible(true); } else { approvalBtn.setVisible(false); } v.addComponent(approvalBtn); HorizontalLayout h1 = new HorizontalLayout(); h1.setWidth("100%"); approvalItemBtn.setVisible(false); approvalItemBtn.setWidthUndefined(); approvalItemBtn.addStyleName(ValoTheme.BUTTON_TINY); approvalItemBtn.addStyleName(ValoTheme.BUTTON_PRIMARY); if (getCellItemId() != 0) { approvalBtn.setCaption("Approve ITEM"); CellItem ci = cis.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>"); cellItem.setValue("<b>STEM</b>: " + getStem()); OptionGroup options = new OptionGroup(); options.addItems(cis.getCellItemById(getCellItemId()).getOptionA(), cis.getCellItemById(getCellItemId()).getOptionB(), cis.getCellItemById(getCellItemId()).getOptionC(), cis.getCellItemById(getCellItemId()).getOptionD()); h1.addComponent(options); h1.setComponentAlignment(options, Alignment.MIDDLE_CENTER); if (cis.getCellItemById(getCellItemId()).getCellItemStatus() == 0) { approvalItemBtn.setVisible(true); } else { approvalItemBtn.setVisible(false); } approvalItemBtn.addClickListener(buttonClickListener); approvalItemBtn.setVisible(true); } v.addComponent(approvalBtn); v.addComponent(cellItem); v.addComponent(h1); v.addComponent(approvalItemBtn); Label separator = new Label("<HR>"); separator.setContentMode(ContentMode.HTML); v.addComponent(separator); return v; }