List of usage examples for com.vaadin.ui HorizontalLayout addStyleName
@Override public void addStyleName(String style)
From source file:ac.uk.icl.dell.vaadin.glycanbuilder.VaadinGlycanCanvas.java
License:Open Source License
public void forceLinkagePopRepaint() { registerLinkageListeners();//w ww . j a v a2 s . co m WeeLayout toolBar = new WeeLayout(Direction.HORIZONTAL); toolBar.setWidth("100%"); HorizontalLayout popupLayout = new HorizontalLayout(); linkage_one_panel = new PopupView("1st Linkage", popupLayout); if (field_linkage_position.isEnabled() || field_anomeric_carbon.isEnabled() || field_anomeric_state.isEnabled() || field_chirality.isEnabled() || field_ring_size.isEnabled()) { linkage_one_panel.setEnabled(true); } else { linkage_one_panel.setEnabled(false); } popupLayout.addStyleName("1st_linkage_panel"); popupLayout.addComponent(field_anomeric_state); popupLayout.addComponent(field_anomeric_carbon); popupLayout.addComponent(field_linkage_position); popupLayout.addComponent(field_chirality); popupLayout.addComponent(field_ring_size); // boolean enabled=linkage_two_panel.isEnabled(); // linkage_two_panel = new PopupButton("2nd Linkage"); // linkage_two_panel.setEnabled(enabled); // linkage_two_panel.setComponent(popupLayout2); // linkage_one_panel.addStyleName(BaseTheme.BUTTON_LINK); // linkage_two_panel.addStyleName("link"); linkage_two_panel.addStyleName("igg-glycan-builder-linkage-toolbar-panel-item"); linkage_one_panel.addStyleName("igg-glycan-builder-linkage-toolbar-panel-item"); field_second_bond.addStyleName("igg-glycan-builder-linkage-toolbar-panel-item"); toolBar.addComponent(linkage_one_panel); popupLayout2.addComponent(field_second_child_position); popupLayout2.addComponent(field_second_parent_position); toolBar.addComponent(field_second_bond); toolBar.addComponent(linkage_two_panel); linkagePanel.removeAllComponents(); linkagePanel.setContent(toolBar); linkagePanel.requestRepaintAll(); }
From source file:ac.uk.icl.dell.vaadin.navigator7.IGGAppLevelWindow.java
License:Open Source License
@Override protected Component createFooter() { HorizontalLayout layout = new HorizontalLayout(); layout.setWidth("100%"); layout.addStyleName("white-background"); layout.addComponent(new Label("GlycanBuilder")); return layout; }
From source file:annis.gui.querybuilder.EdgeWindow.java
License:Apache License
public EdgeWindow(final TigerQueryBuilderCanvas parent, NodeWindow source, NodeWindow target) { this.parent = parent; this.source = source; this.target = target; setSizeFull();/*w w w.ja va2 s . c o m*/ // HACK: use our own border since the one from chameleon does not really work addStyleName(ValoTheme.PANEL_BORDERLESS); addStyleName("border-layout"); addStyleName("white-panel"); VerticalLayout vLayout = new VerticalLayout(); setContent(vLayout); vLayout.setMargin(false); HorizontalLayout toolbar = new HorizontalLayout(); toolbar.addStyleName("toolbar"); toolbar.setWidth("100%"); toolbar.setHeight("-1px"); vLayout.addComponent(toolbar); Label lblTitle = new Label("AQL Operator"); lblTitle.setWidth("100%"); toolbar.addComponent(lblTitle); toolbar.setComponentAlignment(lblTitle, Alignment.MIDDLE_LEFT); toolbar.setExpandRatio(lblTitle, 1.0f); btClose = new Button(); btClose.addStyleName(ValoTheme.BUTTON_ICON_ONLY); btClose.addStyleName(ValoTheme.BUTTON_SMALL); btClose.setIcon(FontAwesome.TIMES_CIRCLE); btClose.setWidth("-1px"); btClose.addListener((Button.ClickListener) this); toolbar.addComponent(btClose); toolbar.setComponentAlignment(btClose, Alignment.MIDDLE_RIGHT); toolbar.setExpandRatio(btClose, 0.0f); cbOperator = new ComboBox(); cbOperator.setNewItemsAllowed(false); cbOperator.setTextInputAllowed(false); cbOperator.setNullSelectionAllowed(true); cbOperator.addItem(CUSTOM); cbOperator.setItemCaption(CUSTOM, "custom"); cbOperator.setNullSelectionItemId(CUSTOM); cbOperator.setNewItemHandler(new SimpleNewItemHandler(cbOperator)); cbOperator.setImmediate(true); vLayout.addComponent(cbOperator); for (AQLOperator o : AQLOperator.values()) { cbOperator.addItem(o); cbOperator.setItemCaption(o, o.getDescription() + " (" + o.getOp() + ")"); } cbOperator.setValue(AQLOperator.DIRECT_PRECEDENCE); cbOperator.addValueChangeListener(new ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { Object val = event.getProperty().getValue(); if (val instanceof AQLOperator) { txtOperator.setValue(((AQLOperator) val).getOp()); } } }); cbOperator.setWidth("100%"); cbOperator.setHeight("20px"); txtOperator = new TextField(); txtOperator.setValue("."); txtOperator.setInputPrompt("select operator definition"); txtOperator.setSizeFull(); txtOperator.addValueChangeListener(new OperatorValueChangeListener(parent)); txtOperator.setImmediate(true); vLayout.addComponent(txtOperator); vLayout.setExpandRatio(cbOperator, 1.0f); }
From source file:annis.gui.SearchUI.java
License:Apache License
@Override protected void init(VaadinRequest request) { super.init(request); this.instanceConfig = getInstanceConfig(request); getPage().setTitle(instanceConfig.getInstanceDisplayName() + " (ANNIS Corpus Search)"); queryController = new QueryController(this); refresh = new Refresher(); // deactivate refresher by default refresh.setRefreshInterval(-1);//from w w w .j a v a2s. c om refresh.addListener(queryController); addExtension(refresh); // always get the resize events directly setImmediate(true); VerticalLayout mainLayout = new VerticalLayout(); setContent(mainLayout); mainLayout.setSizeFull(); mainLayout.setMargin(false); final ScreenshotMaker screenshot = new ScreenshotMaker(this); addExtension(screenshot); css = new CSSInject(this); HorizontalLayout layoutToolbar = new HorizontalLayout(); layoutToolbar.setWidth("100%"); layoutToolbar.setHeight("-1px"); mainLayout.addComponent(layoutToolbar); layoutToolbar.addStyleName("toolbar"); layoutToolbar.addStyleName("border-layout"); Button btAboutAnnis = new Button("About ANNIS"); btAboutAnnis.addStyleName(ChameleonTheme.BUTTON_SMALL); btAboutAnnis.setIcon(new ThemeResource("info.gif")); btAboutAnnis.addClickListener(new AboutClickListener()); btBugReport = new Button("Report Bug"); btBugReport.addStyleName(ChameleonTheme.BUTTON_SMALL); btBugReport.setDisableOnClick(true); btBugReport.setIcon(new ThemeResource("../runo/icons/16/email.png")); btBugReport.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { screenshot.makeScreenshot(); btBugReport.setCaption("bug report is initialized..."); } }); String bugmail = (String) VaadinSession.getCurrent().getAttribute("bug-e-mail"); if (bugmail != null && !bugmail.isEmpty() && !bugmail.startsWith("${") && new EmailValidator("").isValid(bugmail)) { this.bugEMailAddress = bugmail; } btBugReport.setVisible(this.bugEMailAddress != null); lblUserName = new Label("not logged in"); lblUserName.setWidth("-1px"); lblUserName.setHeight("-1px"); lblUserName.addStyleName("right-aligned-text"); btLoginLogout = new Button("Login", new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { if (isLoggedIn()) { // logout Helper.setUser(null); Notification.show("Logged out", Notification.Type.TRAY_NOTIFICATION); updateUserInformation(); } else { showLoginWindow(); } } }); btLoginLogout.setSizeUndefined(); btLoginLogout.setStyleName(ChameleonTheme.BUTTON_SMALL); btLoginLogout.setIcon(new ThemeResource("../runo/icons/16/user.png")); Button btOpenSource = new Button("Help us to make ANNIS better!"); btOpenSource.setStyleName(BaseTheme.BUTTON_LINK); btOpenSource.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { Window w = new HelpUsWindow(); w.setCaption("Help us to make ANNIS better!"); w.setModal(true); w.setResizable(true); w.setWidth("600px"); w.setHeight("500px"); addWindow(w); w.center(); } }); layoutToolbar.addComponent(btAboutAnnis); layoutToolbar.addComponent(btBugReport); layoutToolbar.addComponent(btOpenSource); layoutToolbar.addComponent(lblUserName); layoutToolbar.addComponent(btLoginLogout); layoutToolbar.setSpacing(true); layoutToolbar.setComponentAlignment(btAboutAnnis, Alignment.MIDDLE_LEFT); layoutToolbar.setComponentAlignment(btBugReport, Alignment.MIDDLE_LEFT); layoutToolbar.setComponentAlignment(btOpenSource, Alignment.MIDDLE_CENTER); layoutToolbar.setComponentAlignment(lblUserName, Alignment.MIDDLE_RIGHT); layoutToolbar.setComponentAlignment(btLoginLogout, Alignment.MIDDLE_RIGHT); layoutToolbar.setExpandRatio(btOpenSource, 1.0f); //HorizontalLayout hLayout = new HorizontalLayout(); final HorizontalSplitPanel hSplit = new HorizontalSplitPanel(); hSplit.setSizeFull(); mainLayout.addComponent(hSplit); mainLayout.setExpandRatio(hSplit, 1.0f); AutoGeneratedQueries autoGenQueries = new AutoGeneratedQueries("example queries", this); controlPanel = new ControlPanel(queryController, instanceConfig, autoGenQueries); controlPanel.setWidth(100f, Layout.Unit.PERCENTAGE); controlPanel.setHeight(100f, Layout.Unit.PERCENTAGE); hSplit.setFirstComponent(controlPanel); tutorial = new TutorialPanel(); tutorial.setHeight("99%"); mainTab = new TabSheet(); mainTab.setSizeFull(); mainTab.addTab(autoGenQueries, "example queries"); mainTab.addTab(tutorial, "Tutorial"); queryBuilder = new QueryBuilderChooser(queryController, this, instanceConfig); mainTab.addTab(queryBuilder, "Query Builder"); hSplit.setSecondComponent(mainTab); hSplit.setSplitPosition(CONTROL_PANEL_WIDTH, Unit.PIXELS); hSplit.addSplitterClickListener(new AbstractSplitPanel.SplitterClickListener() { @Override public void splitterClick(AbstractSplitPanel.SplitterClickEvent event) { if (event.isDoubleClick()) { if (hSplit.getSplitPosition() == CONTROL_PANEL_WIDTH) { // make small hSplit.setSplitPosition(0.0f, Unit.PIXELS); } else { // reset to default width hSplit.setSplitPosition(CONTROL_PANEL_WIDTH, Unit.PIXELS); } } } }); // hLayout.setExpandRatio(mainTab, 1.0f); addAction(new ShortcutListener("^Query builder") { @Override public void handleAction(Object sender, Object target) { mainTab.setSelectedTab(queryBuilder); } }); addAction(new ShortcutListener("Tutor^eial") { @Override public void handleAction(Object sender, Object target) { mainTab.setSelectedTab(tutorial); } }); getPage().addUriFragmentChangedListener(this); getSession().addRequestHandler(new RequestHandler() { @Override public boolean handleRequest(VaadinSession session, VaadinRequest request, VaadinResponse response) throws IOException { checkCitation(request); if (request.getPathInfo() != null && request.getPathInfo().startsWith("/vis-iframe-res/")) { String uuidString = StringUtils.removeStart(request.getPathInfo(), "/vis-iframe-res/"); UUID uuid = UUID.fromString(uuidString); IFrameResourceMap map = VaadinSession.getCurrent().getAttribute(IFrameResourceMap.class); if (map == null) { response.setStatus(404); } else { IFrameResource res = map.get(uuid); if (res != null) { response.setStatus(200); response.setContentType(res.getMimeType()); response.getOutputStream().write(res.getData()); } } return true; } return false; } }); getSession().setAttribute(MediaController.class, new MediaControllerImpl()); getSession().setAttribute(PDFController.class, new PDFControllerImpl()); loadInstanceFonts(); checkCitation(request); lastQueriedFragment = ""; evaluateFragment(getPage().getUriFragment()); updateUserInformation(); }
From source file:at.peppol.webgui.app.MainWindow.java
License:Mozilla Public License
private HorizontalLayout createTopBarButtons() { final HorizontalLayout topBarBtns = new HorizontalLayout(); final Button homeBtn = new Button("Home"); homeBtn.addStyleName("first"); homeBtn.addStyleName("down"); final Button aboutBtn = new Button("About"); final Button contactBtn = new Button("Contact"); contactBtn.addStyleName("last"); topBarBtns.setStyleName("segment"); topBarBtns.addStyleName("tall"); topBarBtns.addComponent(homeBtn);//from w w w .j a v a 2 s . c o m topBarBtns.addComponent(aboutBtn); topBarBtns.addComponent(contactBtn); return topBarBtns; }
From source file:by.bigvova.ui.LoginUI.java
License:Apache License
private Component buildFields() { final VerticalLayout layout = new VerticalLayout(); HorizontalLayout fields = new HorizontalLayout(); fields.setSpacing(true);/*from ww w.j a va2 s. co m*/ fields.addStyleName("fields"); final TextField username = new TextField("Username"); username.setIcon(FontAwesome.USER); username.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON); final PasswordField password = new PasswordField("Password"); password.setIcon(FontAwesome.LOCK); password.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON); final Button signin = new Button("Sign In"); signin.addStyleName(ValoTheme.BUTTON_PRIMARY); signin.setClickShortcut(ShortcutAction.KeyCode.ENTER); signin.focus(); final CheckBox checkBox = new CheckBox("Remember me", true); signin.addClickListener(new Button.ClickListener() { @Override public void buttonClick(final Button.ClickEvent event) { login(username.getValue(), password.getValue(), checkBox.getValue()); } }); fields.addComponents(username, password, signin); fields.setComponentAlignment(signin, Alignment.BOTTOM_LEFT); layout.setSpacing(true); layout.addComponent(fields); layout.addComponent(checkBox); return layout; }
From source file:com.adonis.ui.menu.Menu.java
public Menu(PersonService personService, VehicleService vehicleService, Navigator navigator) { this.navigator = navigator; setPrimaryStyleName(ValoTheme.MENU_ROOT); menuPart = new CssLayout(); menuPart.addStyleName(ValoTheme.MENU_PART); setPersonsCrudProperties(personService); setVehiclesCrudProperties(vehicleService); // header of the menu final HorizontalLayout top = new HorizontalLayout(); top.addStyleName(ValoTheme.MENU_TITLE); top.setSpacing(true);// ww w . java2 s .c o m Label title = new Label("Vehicle manager"); title.addStyleName(ValoTheme.LABEL_H1); title.setSizeUndefined(); Image image = new Image(null, new ThemeResource("img/car.png")); image.setStyleName(ValoTheme.MENU_LOGO); top.addComponent(image); top.addComponent(title); menuPart.addComponent(top); // logout menu item // HorizontalLayout logoutLayout = new HorizontalLayout(); // logoutLayout.addStyleName(ValoTheme.MENU_ITEM); // logoutLayout.setSpacing(false); // // MenuBar logoutMenu = new MenuBar(); // logoutMenu.setStyleName(VALO_MENUITEMS); // logoutMenu.addItem("Logout", new MenuBar.Command() { // // @Override // public void menuSelected(MenuBar.MenuItem selectedItem) { // VaadinSession.getCurrent().getSession().invalidate(); // Page.getCurrent().reload(); // } // }); // // logoutMenu.addStyleName("user-menu"); // Image logout = new Image(null, new ThemeResource("img/logout.png")); // logoutLayout.addComponent(logout, 0); // logoutLayout.addComponent(logoutMenu, 1); // menuPart.addComponent(logoutLayout); // button for toggling the visibility of the menu when on a small screen showMenu = new Button("Menu", new ClickListener() { @Override public void buttonClick(final ClickEvent event) { if (menuPart.getStyleName().contains(VALO_MENU_VISIBLE)) { menuPart.removeStyleName(VALO_MENU_VISIBLE); } else { menuPart.addStyleName(VALO_MENU_VISIBLE); } } }); showMenu.addStyleName(ValoTheme.BUTTON_PRIMARY); showMenu.addStyleName(ValoTheme.BUTTON_SMALL); showMenu.addStyleName(VALO_MENU_TOGGLE); // showMenu.setIcon(FontAwesome.NAVICON); menuPart.addComponent(showMenu); // container for the navigation buttons, which are added by addView() menuItemsLayout = new CssLayout(); menuItemsLayout.setPrimaryStyleName(VALO_MENUITEMS); menuPart.addComponent(menuItemsLayout); addComponent(menuPart); addStyleName("backImage"); }
From source file:com.cavisson.gui.dashboard.components.controls.ButtonsAndLinks.java
License:Apache License
/** * *//*from ww w.j a v a2 s . c o m*/ public ButtonsAndLinks() { setMargin(true); Label h1 = new Label("Buttons"); h1.addStyleName("h1"); addComponent(h1); HorizontalLayout row = new HorizontalLayout(); row.addStyleName("wrapping"); row.setSpacing(true); addComponent(row); Button button = new Button("Normal"); row.addComponent(button); button = new Button("Disabled"); button.setEnabled(false); row.addComponent(button); button = new Button("Primary"); button.addStyleName("primary"); row.addComponent(button); button = new Button("Friendly"); button.addStyleName("friendly"); row.addComponent(button); button = new Button("Danger"); button.addStyleName("danger"); row.addComponent(button); TestIcon testIcon = new TestIcon(10); button = new Button("Small"); button.addStyleName("small"); button.setIcon(testIcon.get()); row.addComponent(button); button = new Button("Large"); button.addStyleName("large"); button.setIcon(testIcon.get()); row.addComponent(button); button = new Button("Top"); button.addStyleName("icon-align-top"); button.setIcon(testIcon.get()); row.addComponent(button); button = new Button("Image icon"); button.setIcon(testIcon.get(true, 16)); row.addComponent(button); button = new Button("Image icon"); button.addStyleName("icon-align-right"); button.setIcon(testIcon.get(true)); row.addComponent(button); button = new Button("Photos"); button.setIcon(testIcon.get()); row.addComponent(button); button = new Button(); button.setIcon(testIcon.get()); button.addStyleName("icon-only"); row.addComponent(button); button = new Button("Borderless"); button.setIcon(testIcon.get()); button.addStyleName("borderless"); row.addComponent(button); button = new Button("Borderless, colored"); button.setIcon(testIcon.get()); button.addStyleName("borderless-colored"); row.addComponent(button); button = new Button("Quiet"); button.setIcon(testIcon.get()); button.addStyleName("quiet"); row.addComponent(button); button = new Button("Link style"); button.setIcon(testIcon.get()); button.addStyleName("link"); row.addComponent(button); button = new Button("Icon on right"); button.setIcon(testIcon.get()); button.addStyleName("icon-align-right"); row.addComponent(button); CssLayout group = new CssLayout(); group.addStyleName("v-component-group"); row.addComponent(group); button = new Button("One"); group.addComponent(button); button = new Button("Two"); group.addComponent(button); button = new Button("Three"); group.addComponent(button); button = new Button("Tiny"); button.addStyleName("tiny"); row.addComponent(button); button = new Button("Huge"); button.addStyleName("huge"); row.addComponent(button); NativeButton nbutton = new NativeButton("Native"); row.addComponent(nbutton); h1 = new Label("Links"); h1.addStyleName("h1"); addComponent(h1); row = new HorizontalLayout(); row.addStyleName("wrapping"); row.setSpacing(true); addComponent(row); Link link = new Link("vaadin.com", new ExternalResource("https://vaadin.com")); row.addComponent(link); link = new Link("Link with icon", new ExternalResource("https://vaadin.com")); link.addStyleName("color3"); link.setIcon(testIcon.get()); row.addComponent(link); link = new Link("Small", new ExternalResource("https://vaadin.com")); link.addStyleName("small"); row.addComponent(link); link = new Link("Large", new ExternalResource("https://vaadin.com")); link.addStyleName("large"); row.addComponent(link); link = new Link(null, new ExternalResource("https://vaadin.com")); link.setIcon(testIcon.get()); link.addStyleName("large"); row.addComponent(link); }
From source file:com.cavisson.gui.dashboard.components.controls.CheckBoxes.java
License:Apache License
public CheckBoxes() { setMargin(true);/* w w w . ja v a 2 s.co m*/ Label h1 = new Label("Check Boxes"); h1.addStyleName("h1"); addComponent(h1); HorizontalLayout row = new HorizontalLayout(); row.addStyleName("wrapping"); row.setSpacing(true); addComponent(row); CheckBox check = new CheckBox("Checked", true); row.addComponent(check); check = new CheckBox("Checked, explicit width, so that the caption should wrap", true); row.addComponent(check); check.setWidth("150px"); check = new CheckBox("Not checked"); row.addComponent(check); check = new CheckBox(null, true); check.setDescription("No caption"); row.addComponent(check); check = new CheckBox("Custom color", true); check.addStyleName("color1"); row.addComponent(check); TestIcon testIcon = new TestIcon(30); check = new CheckBox("Custom color", true); check.addStyleName("color2"); check.setIcon(testIcon.get()); row.addComponent(check); check = new CheckBox("With Icon", true); check.setIcon(testIcon.get()); row.addComponent(check); check = new CheckBox(); check.setIcon(testIcon.get(true)); row.addComponent(check); check = new CheckBox("Small", true); check.addStyleName("small"); row.addComponent(check); check = new CheckBox("Large", true); check.addStyleName("large"); row.addComponent(check); h1 = new Label("Option Groups"); h1.addStyleName("h1"); addComponent(h1); row = new HorizontalLayout(); row.addStyleName("wrapping"); row.setSpacing(true); addComponent(row); OptionGroup options = new OptionGroup("Choose one, explicit width"); options.setWidth("200px"); options.addItem("Option One"); Item two = options.addItem( "Option Two, with a longer caption that should wrap when the components width is explicitly set."); options.addItem("Option Three"); options.select("Option One"); options.setItemIcon("Option One", testIcon.get()); options.setItemIcon(two, testIcon.get()); options.setItemIcon("Option Three", testIcon.get(true)); row.addComponent(options); options = new OptionGroup("Choose many, explicit width"); options.setMultiSelect(true); options.setWidth("200px"); options.addItem("Option One"); two = options.addItem( "Option Two, with a longer caption that should wrap when the components width is explicitly set."); options.addItem("Option Three"); options.select("Option One"); options.setItemIcon("Option One", testIcon.get()); options.setItemIcon(two, testIcon.get()); options.setItemIcon("Option Three", testIcon.get(true)); row.addComponent(options); options = new OptionGroup("Choose one, small"); options.addStyleName("small"); options.setMultiSelect(false); options.addItem("Option One"); options.addItem("Option Two"); options.addItem("Option Three"); options.select("Option One"); options.setItemIcon("Option One", testIcon.get()); options.setItemIcon("Option Two", testIcon.get()); options.setItemIcon("Option Three", testIcon.get(true)); row.addComponent(options); options = new OptionGroup("Choose many, small"); options.addStyleName("small"); options.setMultiSelect(true); options.addItem("Option One"); options.addItem("Option Two"); options.addItem("Option Three"); options.select("Option One"); options.setItemIcon("Option One", testIcon.get()); options.setItemIcon("Option Two", testIcon.get()); options.setItemIcon("Option Three", testIcon.get(true)); row.addComponent(options); options = new OptionGroup("Choose one, large"); options.addStyleName("large"); options.setMultiSelect(false); options.addItem("Option One"); options.addItem("Option Two"); options.addItem("Option Three"); options.select("Option One"); options.setItemIcon("Option One", testIcon.get()); options.setItemIcon("Option Two", testIcon.get()); options.setItemIcon("Option Three", testIcon.get(true)); row.addComponent(options); options = new OptionGroup("Choose many, large"); options.addStyleName("large"); options.setMultiSelect(true); options.addItem("Option One"); options.addItem("Option Two"); options.addItem("Option Three"); options.select("Option One"); options.setItemIcon("Option One", testIcon.get()); options.setItemIcon("Option Two", testIcon.get()); options.setItemIcon("Option Three", testIcon.get(true)); row.addComponent(options); options = new OptionGroup("Horizontal items"); options.addStyleName("horizontal"); options.addItem("Option One"); two = options.addItem("Option Two, with a longer caption"); options.addItem("Option Three"); options.select("Option One"); options.setItemIcon("Option One", testIcon.get()); options.setItemIcon(two, testIcon.get()); options.setItemIcon("Option Three", testIcon.get()); row.addComponent(options); options = new OptionGroup("Horizontal items, explicit width"); options.setMultiSelect(true); options.setWidth("500px"); options.addStyleName("horizontal"); options.addItem("Option One"); two = options.addItem("Option Two, with a longer caption"); options.addItem("Option Three"); options.select("Option One"); options.setItemIcon("Option One", testIcon.get()); options.setItemIcon(two, testIcon.get()); options.setItemIcon("Option Three", testIcon.get()); row.addComponent(options); }
From source file:com.cavisson.gui.dashboard.components.controls.ColorPickers.java
License:Apache License
public ColorPickers() { setMargin(true);/*from w w w . ja va2s . com*/ Label h1 = new Label("Color Pickers"); h1.addStyleName("h1"); addComponent(h1); HorizontalLayout row = new HorizontalLayout(); row.addStyleName("wrapping"); row.setSpacing(true); addComponent(row); TestIcon testIcon = new TestIcon(40); ColorPicker cp = new ColorPicker(); cp.setDefaultCaptionEnabled(true); cp.setIcon(testIcon.get()); cp.setColor(new Color(138, 73, 115)); row.addComponent(cp); cp = new ColorPicker(); cp.setPopupStyle(PopupStyle.POPUP_SIMPLE); cp.setTextfieldVisibility(true); row.addComponent(cp); }