List of usage examples for com.vaadin.ui Button setSizeUndefined
@Override public void setSizeUndefined()
From source file:com.skysql.manager.ui.TopPanel.java
License:Open Source License
/** * Instantiates a new top panel./*from w w w.ja v a 2 s . com*/ */ public TopPanel() { setSpacing(true); addStyleName("titleLayout"); setWidth("100%"); Embedded logo = new Embedded(null, new ThemeResource("img/productlogo.png")); addComponent(logo); setComponentAlignment(logo, Alignment.BOTTOM_LEFT); // LINKS AREA (TOP-RIGHT) HorizontalLayout userSettingsLayout = new HorizontalLayout(); userSettingsLayout.setSizeUndefined(); userSettingsLayout.setSpacing(true); addComponent(userSettingsLayout); setComponentAlignment(userSettingsLayout, Alignment.MIDDLE_RIGHT); // User icon and name VerticalLayout userLayout = new VerticalLayout(); userSettingsLayout.addComponent(userLayout); userSettingsLayout.setComponentAlignment(userLayout, Alignment.BOTTOM_CENTER); UserObject userObject = VaadinSession.getCurrent().getAttribute(UserObject.class); String name = userObject.getAnyName(); userName = new Label("Welcome, " + name); userName.setSizeUndefined(); userLayout.addComponent(userName); // buttons HorizontalLayout buttonsLayout = new HorizontalLayout(); buttonsLayout.setSizeUndefined(); buttonsLayout.setSpacing(true); userSettingsLayout.addComponent(buttonsLayout); userSettingsLayout.setComponentAlignment(buttonsLayout, Alignment.MIDDLE_CENTER); // Settings button SettingsDialog settingsDialog = new SettingsDialog("Settings"); Button settingsButton = settingsDialog.getButton(); buttonsLayout.addComponent(settingsButton); buttonsLayout.setComponentAlignment(settingsButton, Alignment.MIDDLE_CENTER); // Logout Button logoutButton = new Button("Logout"); logoutButton.setSizeUndefined(); buttonsLayout.addComponent(logoutButton); buttonsLayout.setComponentAlignment(logoutButton, Alignment.MIDDLE_CENTER); logoutButton.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = 0x4C656F6E6172646FL; public void buttonClick(ClickEvent event) { UI.getCurrent().getPage().setLocation(""); UI.getCurrent().close(); getSession().setAttribute(UserObject.class, null); getSession().close(); } }); }
From source file:de.uni_tuebingen.qbic.qbicmainportlet.SearchEngineView.java
License:Open Source License
public void initUI() { mainlayout = new Panel(); mainlayout.addStyleName(ValoTheme.PANEL_BORDERLESS); // Search bar // *----------- search text field .... search button-----------* VerticalLayout searchbar = new VerticalLayout(); searchbar.setWidth(100, Unit.PERCENTAGE); setResponsive(true);// ww w . ja va 2 s . com searchbar.setResponsive(true); // searchbar.setWidth(); HorizontalLayout buttonLayout = new HorizontalLayout(); buttonLayout.setResponsive(true); buttonLayout.setWidth(75, Unit.PERCENTAGE); // searchbar.setSpacing(true); final TextField searchfield = new TextField(); searchfield.setHeight("44px"); searchfield.setImmediate(true); searchfield.setResponsive(true); searchfield.setWidth(75, Unit.PERCENTAGE); buttonLayout.setSpacing(true); searchfield.setInputPrompt("search DB"); // searchfield.setCaption("QSearch"); // searchfield.setWidth(25.0f, Unit.EM); // searchfield.setWidth(60, Unit.PERCENTAGE); // TODO would be nice to have a autofill or something similar // searchFieldLayout.addComponent(searchfield); searchbar.addComponent(searchfield); searchbar.setComponentAlignment(searchfield, Alignment.MIDDLE_RIGHT); final NativeSelect navsel = new NativeSelect(); navsel.addItem("Whole DB"); navsel.addItem("Projects Only"); navsel.addItem("Experiments Only"); navsel.addItem("Samples Only"); navsel.setValue("Whole DB"); navsel.setHeight("20px"); navsel.setNullSelectionAllowed(false); navsel.setResponsive(true); navsel.setWidth(100, Unit.PERCENTAGE); navsel.addValueChangeListener(new Property.ValueChangeListener() { /** * */ private static final long serialVersionUID = -6896454887050432147L; @Override public void valueChange(ValueChangeEvent event) { // TODO Auto-generated method stub Notification.show((String) navsel.getValue()); switch ((String) navsel.getValue()) { case "Whole DB": datahandler.setShowOptions(Arrays.asList("Projects", "Experiments", "Samples")); break; case "Projects Only": datahandler.setShowOptions(Arrays.asList("Projects")); break; case "Experiments Only": datahandler.setShowOptions(Arrays.asList("Experiments")); break; case "Samples Only": datahandler.setShowOptions(Arrays.asList("Samples")); break; default: datahandler.setShowOptions(Arrays.asList("Projects", "Experiments", "Samples")); break; } } }); searchbar.addComponent(buttonLayout); searchbar.setComponentAlignment(buttonLayout, Alignment.MIDDLE_RIGHT); Button searchOk = new Button(""); searchOk.setStyleName(ValoTheme.BUTTON_TINY); // searchOk.addStyleName(ValoTheme.BUTTON_BORDERLESS); searchOk.setIcon(FontAwesome.SEARCH); searchOk.setSizeUndefined(); // searchOk.setWidth(15.0f, Unit.EM); searchOk.setResponsive(true); searchOk.setHeight("20px"); searchOk.addClickListener(new ClickListener() { private static final long serialVersionUID = -2409450448301908214L; @Override public void buttonClick(ClickEvent event) { String queryString = (String) searchfield.getValue().toString(); LOGGER.debug("the query was " + queryString); if (searchfield.getValue() == null || searchfield.getValue().toString().equals("") || searchfield.getValue().toString().trim().length() == 0) { Notification.show("Query field was empty!", Type.WARNING_MESSAGE); } else { try { /** * Sample foundSample = datahandler.getOpenBisClient() .getSampleByIdentifier( * matcher.group(0).toString()); */ datahandler.setSampleResults(querySamples(queryString)); datahandler.setExpResults(queryExperiments(queryString)); datahandler.setProjResults(queryProjects(queryString)); datahandler.setLastQueryString(queryString); State state = (State) UI.getCurrent().getSession().getAttribute("state"); ArrayList<String> message = new ArrayList<String>(); message.add("clicked"); message.add("view" + queryString); message.add("searchresults"); state.notifyObservers(message); } catch (Exception e) { LOGGER.error("after query: ", e); Notification.show("No Sample found for given barcode.", Type.WARNING_MESSAGE); } } } }); // setClickShortcut() would add global shortcut, instead we // 'scope' the shortcut to the panel: mainlayout.addAction(new com.vaadin.ui.Button.ClickShortcut(searchOk, KeyCode.ENTER)); // searchfield.addItems(this.getSearchResults("Q")); searchfield.setDescription(infotext); searchfield.addValidator(new NullValidator("Field must not be empty", false)); searchfield.setValidationVisible(false); buttonLayout.addComponent(navsel); // buttonLayout.addComponent(new Label("")); buttonLayout.addComponent(searchOk); // searchFieldLayout.setComponentAlignment(searchOk, Alignment.TOP_RIGHT); // buttonLayout.setExpandRatio(searchOk, 1); // buttonLayout.setExpandRatio(navsel, 1); // searchFieldLayout.setSpacing(true); buttonLayout.setComponentAlignment(searchOk, Alignment.BOTTOM_RIGHT); // buttonLayout.setComponentAlignment(navsel, Alignment.BOTTOM_LEFT); buttonLayout.setExpandRatio(searchOk, 1); buttonLayout.setExpandRatio(navsel, 2); // searchbar.setMargin(new MarginInfo(true, false, true, false)); mainlayout.setContent(searchbar); // mainlayout.setComponentAlignment(searchbar, Alignment.MIDDLE_RIGHT); // mainlayout.setWidth(100, Unit.PERCENTAGE); setCompositionRoot(mainlayout); }
From source file:gov.osti.doecode.RepositoryForm.java
/** * Create a basic form UI for editing software metadata information. * //from ww w . ja va2 s . co m * @param ui link to the MyUI parent UI */ public RepositoryForm(MyUI ui) { this.ui = ui; setSizeUndefined(); agentGrid.setColumns("firstName", "lastName", "email"); agentGrid.setHeightMode(HeightMode.ROW); agentGrid.setHeightByRows(8); idGrid.setColumns("relationType", "identifierType", "value"); idGrid.setHeightMode(HeightMode.ROW); idGrid.setHeightByRows(8); idForm = new IdentifierForm(this); agentForm = new AgentForm(this); TabSheet tabs = new TabSheet(); tabs.addStyleName(ValoTheme.TABSHEET_FRAMED); tabs.addStyleName(ValoTheme.TABSHEET_PADDED_TABBAR); addComponent(tabs); HorizontalLayout main = new HorizontalLayout(); main.setSpacing(true); main.setMargin(true); FormLayout left = new FormLayout(); FormLayout right = new FormLayout(); countryCode.addItems(countryCodes); left.addComponents(url, loadButton, name, openSource, siteOwnershipCode, acronym, doi, countryCode); right.addComponents(keywords, rights, license, operatingSystem, siteAccessionNumber, otherRequirements); loadButton.addClickListener(e -> { try { SoftwareRepository repo = Reader.loadRepository("doecode"); setSoftwareRepository(repo); } catch (IOException ex) { setComponentError(new UserError("Unable to load: " + ex.getMessage())); } }); main.addComponents(left, right); tabs.addTab(main, "Metadata"); Button agentAddButton = new Button("New"); agentAddButton.setStyleName(BaseTheme.BUTTON_LINK); agentAddButton.setIcon(FontAwesome.PLUS); agentAddButton.addClickListener(e -> { agentForm.setAgent(new Agent()); }); VerticalLayout innerAgent = new VerticalLayout(agentAddButton, agentGrid); innerAgent.setSizeUndefined(); HorizontalLayout agentLayout = new HorizontalLayout(innerAgent, agentForm); agentLayout.setSpacing(true); agentLayout.setMargin(true); tabs.addTab(agentLayout, "Agents"); Button idAddButton = new Button("New"); idAddButton.setIcon(FontAwesome.PLUS); idAddButton.setStyleName(BaseTheme.BUTTON_LINK); idAddButton.setSizeUndefined(); idAddButton.addClickListener(e -> { idForm.setIdentifier(new Identifier()); }); VerticalLayout innerId = new VerticalLayout(idAddButton, idGrid); HorizontalLayout idTab = new HorizontalLayout(innerId, idForm); idTab.setSpacing(true); idTab.setMargin(true); tabs.addTab(idTab, "Identifiers"); agentGrid.addSelectionListener(e -> { if (!e.getSelected().isEmpty()) { Agent agent = (Agent) e.getSelected().iterator().next(); agentForm.setAgent(agent); System.out.println("Selected " + agent.getFirstName()); } }); idGrid.addSelectionListener(e -> { if (!e.getSelected().isEmpty()) { Identifier identifier = (Identifier) e.getSelected().iterator().next(); idForm.setIdentifier(identifier); } }); }
From source file:io.mateu.ui.vaadin.framework.MyUI.java
License:Apache License
/** * construye el menu/*w w w . ja va 2s .co m*/ * * @param request * @return */ CssLayout buildMenu(VaadinRequest request) { HorizontalLayout top = new HorizontalLayout(); top.setWidth("100%"); top.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); top.addStyleName(ValoTheme.MENU_TITLE); menu.addComponent(top); //menu.addComponent(createThemeSelect()); Button showMenu = new Button("Menu", new ClickListener() { @Override public void buttonClick(ClickEvent event) { if (menu.getStyleName().contains("valo-menu-visible")) { menu.removeStyleName("valo-menu-visible"); } else { menu.addStyleName("valo-menu-visible"); } } }); showMenu.addStyleName(ValoTheme.BUTTON_PRIMARY); showMenu.addStyleName(ValoTheme.BUTTON_SMALL); showMenu.addStyleName("valo-menu-toggle"); showMenu.setIcon(FontAwesome.LIST); menu.addComponent(showMenu); //Label title = new Label("<h3><strong>" + getApp().getName() + "</strong></h3>", ContentMode.HTML); Button title = new Button(getApp().getName(), new ClickListener() { @Override public void buttonClick(ClickEvent event) { Page.getCurrent().open("#!", (event.isAltKey() || event.isCtrlKey()) ? "_blank" : Page.getCurrent().getWindowName()); } }); title.addStyleName(ValoTheme.BUTTON_LINK); title.addStyleName("tituloapp"); title.setSizeUndefined(); top.addComponent(title); top.setExpandRatio(title, 1); settings = new MenuBar(); settings.addStyleName("user-menu"); settings.addStyleName("mi-user-menu"); menu.addComponent(settings); HorizontalLayout navlinks = new HorizontalLayout(); navlinks.setSpacing(true); { Button nav = new Button(VaadinIcons.ARROWS_CROSS, new ClickListener() { @Override public void buttonClick(ClickEvent event) { Page.getCurrent().open("#!nav", (event.isAltKey() || event.isCtrlKey()) ? "_blank" : Page.getCurrent().getWindowName()); } }); nav.addStyleName(ValoTheme.BUTTON_LINK); nav.setDescription("Search inside menu"); nav.addStyleName("navlink"); navlinks.addComponent(nav); } if (MateuUI.getApp().isFavouritesAvailable()) { Button nav = new Button(VaadinIcons.USER_STAR, new ClickListener() { @Override public void buttonClick(ClickEvent event) { Page.getCurrent().open("#!favourites", (event.isAltKey() || event.isCtrlKey()) ? "_blank" : Page.getCurrent().getWindowName()); } }); nav.addStyleName(ValoTheme.BUTTON_LINK); nav.addStyleName("navlink"); nav.setDescription("My favourites"); nav.setVisible(MateuUI.getApp().getUserData() != null); linkFavoritos = nav; navlinks.addComponent(nav); } if (MateuUI.getApp().isLastEditedAvailable()) { Button nav = new Button(VaadinIcons.RECORDS, new ClickListener() { @Override public void buttonClick(ClickEvent event) { Page.getCurrent().open("#!lastedited", (event.isAltKey() || event.isCtrlKey()) ? "_blank" : Page.getCurrent().getWindowName()); } }); nav.addStyleName(ValoTheme.BUTTON_LINK); nav.addStyleName("navlink"); nav.setDescription("Last edited records"); nav.setVisible(MateuUI.getApp().getUserData() != null); linkUltimosRegistros = nav; navlinks.addComponent(nav); } HorizontalLayout aux = new HorizontalLayout(navlinks); aux.setSpacing(false); aux.addStyleName("contenedoriconosnav"); menu.addComponent(aux); if (MateuUI.getApp().isFavouritesAvailable()) { aux = new HorizontalLayout(); { Button nav = new Button(VaadinIcons.STAR, new ClickListener() { @Override public void buttonClick(ClickEvent event) { System.out.println(Page.getCurrent().getUriFragment()); System.out.println(Page.getCurrent().getLocation()); } }); nav.addStyleName(ValoTheme.BUTTON_LINK); nav.addStyleName("navlink"); nav.setDescription("Add current page to my favourites"); nav.setVisible(MateuUI.getApp().getUserData() != null); linkNuevoFavorito = nav; aux.addComponent(nav); } aux.setSpacing(false); aux.addStyleName("contenedoriconosnav"); menu.addComponent(aux); } menuItemsLayout.setPrimaryStyleName("valo-menuitems"); menu.addComponent(menuItemsLayout); refreshMenu(null, null); return menu; }
From source file:my.vaadin.profile.MainLayout.java
public MainLayout() { Label header = new Label("Student"); header.addStyleName("colored"); header.addStyleName("h2"); //header.addStyleName("alignRight"); header.setSizeUndefined();//from w w w .j a v a 2s. c o m Button signOut = new Button("Sign-Out"); signOut.setSizeUndefined(); signOut.addStyleName("small"); Label menu = new Label("Menu"); menu.addStyleName("colored"); menu.addStyleName("h2"); upperSection.setSizeFull(); innerUpperSection.addComponent(header); innerUpperSection.addComponent(signOut); innerUpperSection.setExpandRatio(signOut, 1); innerUpperSection.setSpacing(true); innerUpperSection.setComponentAlignment(signOut, Alignment.MIDDLE_RIGHT); upperSection.addComponent(innerUpperSection); upperSection.setMargin(new MarginInfo(false, true, false, false)); upperSection.setComponentAlignment(innerUpperSection, Alignment.TOP_RIGHT); upperSection.addStyleName("borderBottom"); menuTitle.addComponent(menu); menuLayout.addComponent(menuTitle); menuLayout.setWidth("100%"); menuLayout.setComponentAlignment(menuTitle, Alignment.MIDDLE_CENTER); //menuLayout.addStyleName("whiteStuff"); // menuLayout.setExpandRatio(, 1); //contentLayout.addComponent(); lowerSection.addComponent(menuLayout); lowerSection.addComponent(contentLayout); addComponent(upperSection); addComponent(lowerSection); upperSection.setHeight(4, UNITS_EM); //showBorders(); setSizeFull(); lowerSection.setSizeFull(); //menuLayout.setSizeFull(); contentLayout.setSizeFull(); setExpandRatio(lowerSection, 1); lowerSection.setSplitPosition(15); Button lolol = new Button("hi"); menuLayout.addComponent(lolol); lolol.setWidth("100%"); lolol.setStyleName("borderless"); }
From source file:org.eclipse.hawkbit.ui.decorators.SPUIButtonStyleSmallNoBorderUHS.java
License:Open Source License
@Override public Button decorate(final Button button, final String style, final boolean setStyle, final Resource icon) { button.addStyleName(ValoTheme.BUTTON_SMALL); button.addStyleName(ValoTheme.BUTTON_BORDERLESS); button.setHeightUndefined();/*from w w w . ja v a 2 s .c o m*/ button.setSizeUndefined(); // Set Style if (null != style) { if (setStyle) { button.setStyleName(style); } else { button.addStyleName(style); } } // Set icon if (null != icon) { button.addStyleName(ValoTheme.BUTTON_ICON_ONLY); button.setIcon(icon); } return button; }
From source file:org.eclipse.hawkbit.ui.filtermanagement.TargetFilterTable.java
License:Open Source License
private Button customFilterDistributionSetButton(final Long itemId) { final Item row1 = getItem(itemId); final ProxyDistribution distSet = (ProxyDistribution) row1 .getItemProperty(SPUILabelDefinitions.AUTO_ASSIGN_DISTRIBUTION_SET).getValue(); final ActionType actionType = (ActionType) row1 .getItemProperty(SPUILabelDefinitions.AUTO_ASSIGN_ACTION_TYPE).getValue(); final String buttonId = "distSetButton"; Button updateIcon; if (distSet == null) { updateIcon = SPUIComponentProvider.getButton(buttonId, i18n.getMessage(UIMessageIdProvider.BUTTON_NO_AUTO_ASSIGNMENT), i18n.getMessage(UIMessageIdProvider.BUTTON_AUTO_ASSIGNMENT_DESCRIPTION), null, false, null, SPUIButtonStyleNoBorder.class); } else {// w w w. j a v a2 s. c o m updateIcon = actionType.equals(ActionType.FORCED) ? SPUIComponentProvider.getButton(buttonId, distSet.getNameVersion(), i18n.getMessage(UIMessageIdProvider.BUTTON_AUTO_ASSIGNMENT_DESCRIPTION), null, false, FontAwesome.BOLT, SPUIButtonStyleNoBorderWithIcon.class) : SPUIComponentProvider.getButton(buttonId, distSet.getNameVersion(), i18n.getMessage(UIMessageIdProvider.BUTTON_AUTO_ASSIGNMENT_DESCRIPTION), null, false, null, SPUIButtonStyleNoBorder.class); updateIcon.setSizeUndefined(); } updateIcon.addClickListener(this::onClickOfDistributionSetButton); updateIcon.setData(row1); updateIcon.addStyleName(ValoTheme.LINK_SMALL + " " + "on-focus-no-border link"); return updateIcon; }
From source file:org.eclipse.hawkbit.ui.rollout.rollout.DefineGroupsLayout.java
License:Open Source License
private Button createAddButton() { final Button button = SPUIComponentProvider.getButton(UIComponentIdProvider.ROLLOUT_GROUP_ADD_ID, i18n.getMessage("button.rollout.add.group"), "", "", true, FontAwesome.PLUS, SPUIButtonStyleNoBorderWithIcon.class); button.setSizeUndefined(); button.addStyleName("default-color"); button.setEnabled(true);/*from w w w.j a va 2 s . c o m*/ button.setVisible(true); button.addClickListener(event -> addGroupRowAndValidate()); return button; }
From source file:org.eclipse.skalli.view.ext.impl.internal.infobox.TagComponent.java
License:Open Source License
@SuppressWarnings({ "deprecation", "serial" }) private void paintEditTagList() { tagListLayout.removeAllComponents(); tagListLayout.setWidth("100%"); //$NON-NLS-1$ Label tagLabel = new Label("Tags:"); tagLabel.setSizeUndefined();/*from ww w .j a v a2 s. c o m*/ tagListLayout.addComponent(tagLabel); SortedSet<String> tags = TaggingUtils.getTags(project); for (String tag : tags) { Layout l = new CssLayout() { @Override protected String getCss(Component c) { if (c instanceof Label) { return "float: left; line-height: 18px; padding-right: 3px"; //$NON-NLS-1$ } else { return "float: left; line-height: 18px; padding-right: 5px"; //$NON-NLS-1$ } } }; Label label = new Label(tag); label.setSizeUndefined(); l.addComponent(label); Button removeButton = new Button("(remove)", new ClickListener() { @Override public void buttonClick(ClickEvent event) { String tag = (String) event.getButton().getData(); TaggingUtils.removeTag(project, tag); util.persist(project); paintTagEdit(); } }); removeButton.setStyleName(Button.STYLE_LINK); removeButton.setData(tag); removeButton.setSizeUndefined(); l.addComponent(removeButton); tagListLayout.addComponent(l); } }
From source file:org.ripla.web.internal.menu.ContextMenuManager.java
License:Open Source License
/** * Method to render the context menu./*from w w w . j a v a 2 s . c o m*/ * * @param inMenuSetName * String the fully qualified ID of the context menu * @param inUser * {@link User} the user instance, might be evaluated to check * the conditions * @param inAuthorization * {@link Authorization} the authorization instance, will be * evaluate to check the conditions * @param inParameters * {@link ParameterObject} the generic parameter object with * parameters that could be evaluated to check the conditions * @param inControllerClass * Class<? extends IPluggable> the active controller class * @return {@link Component} the component that displays the rendered * context menu */ public Component renderContextMenu(final String inMenuSetName, final User inUser, final Authorization inAuthorization, final ParameterObject inParameters, final Class<? extends IPluggable> inControllerClass) { final VerticalLayout outContextMenu = new VerticalLayout(); outContextMenu.setMargin(true); outContextMenu.setStyleName("ripla-contextmenu"); //$NON-NLS-1$ final ContextMenuSet lContextMenuSet = contextMenus.get(inMenuSetName); if (lContextMenuSet == null) { return outContextMenu; } for (final ContextMenuItem lItem : lContextMenuSet.getContextMenuItems()) { if (lItem.checkConditions(inUser, inAuthorization, inParameters)) { final Button lContextMenuLink = new Button(lItem.getCaption()); // NOPMD lContextMenuLink.setStyleName(BaseTheme.BUTTON_LINK); lContextMenuLink.addStyleName("ripla-contextmenu-item"); lContextMenuLink.setSizeUndefined(); final Class<? extends IPluggable> lControllerClass = lItem.getControllerClass(); if (lControllerClass.equals(inControllerClass)) { lContextMenuLink.addStyleName("active"); } lContextMenuLink.addClickListener(new ContextMenuListener( // NOPMD lControllerClass)); outContextMenu.addComponent(lContextMenuLink); } } return outContextMenu; }