List of usage examples for com.vaadin.ui Button setDescription
public void setDescription(String description)
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 w w .j a va 2 s . c om*/ 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.expressui.core.view.util.CodePopup.java
License:Open Source License
/** * Creates a popup code button.// w ww . j a va 2s. c o m * * @param classes classes for displaying related source code and Javadoc. If * class is within com.expressui.core or com.expressui.domain, * then Javadoc is displayed, otherwise source code. * @return popup code button */ public Button createPopupCodeButton(final Class... classes) { Button codeButton = new Button(null, new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { open(classes); } }); codeButton.setIcon(new ThemeResource("../expressui/icons/32/java.png")); codeButton.setStyleName(BaseTheme.BUTTON_LINK); codeButton.setDescription(uiMessageSource.getToolTip("codePopup.toolTip")); return codeButton; }
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./* w w w. j a v a 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); }
From source file:com.freebox.engeneering.application.web.layout.LeftSideBarController.java
License:Apache License
private void createFooterSideBar() { VerticalLayout verticalLayout = super.getView(); sideBarFooter.setSizeUndefined();//from w w w . j ava2s .com sideBarFooter.addStyleName("user"); Image profilePic = new Image(null, new ThemeResource("img/profile-pic.png")); profilePic.setWidth("34px"); sideBarFooter.addComponent(profilePic); Label userName = new Label("MOHELLEBI ATAF"); userName.setSizeUndefined(); sideBarFooter.addComponent(userName); Command cmd = new Command() { @Override public void menuSelected(MenuItem selectedItem) { Notification.show("Not implemented in this demo"); } }; MenuBar settings = new MenuBar(); MenuItem settingsMenu = settings.addItem("", null); settingsMenu.setStyleName("icon-cog"); settingsMenu.addItem("Settings", cmd); settingsMenu.addItem("Preferences", cmd); settingsMenu.addSeparator(); settingsMenu.addItem("My Account", cmd); sideBarFooter.addComponent(settings); Button exit = new NativeButton("Exit"); exit.addStyleName("icon-cancel"); exit.setDescription("Sign Out"); sideBarFooter.addComponent(exit); exit.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { } }); verticalLayout.addComponent(sideBarFooter); }
From source file:com.github.peholmst.mvp4vaadin.navigation.ui.NavigationBar.java
License:Apache License
/** * Adds a breadcrumb to the navigation bar for the specified view. If there * already is one or more breadcrumbs in the bar, a separator will be added * before the actual navigation button:/*from w w w . j a v a2s .com*/ * * <pre> * First view >> Second view >> Third view * </pre> * * A click on the navigation button will result in a request to the view * controller to navigate to that particular view. * * @see #addViewButton(String) * @see #addViewSeparator() * * @param view * the view to add (must not be <code>null</code>). */ protected void addBreadcrumbForView(final ControllableView view) { if (getViewController().getTrail().size() > 1) { Label separator = addViewSeparator(); separator.setData(view); } final Button btn = addViewButton(view.getDisplayName()); btn.setDescription(view.getViewDescription()); btn.addListener(new Button.ClickListener() { private static final long serialVersionUID = -2163467482631873920L; @Override public void buttonClick(ClickEvent event) { getViewController().goToView(view); } }); btn.setData(view); }
From source file:com.github.peholmst.springsecuritydemo.ui.MainView.java
License:Apache License
/** * TODO Document me!//from w ww . j a v a2s . c om * * @return */ protected Component createTicketBrowser() { final HorizontalLayout toolbar = new HorizontalLayout(); toolbar.setSpacing(true); toolbar.setWidth("100%"); final Button refreshButton = new Button(getApplication().getMessage("tickets.refresh.caption")); refreshButton.setIcon(new ThemeResource("icons/16/refresh.png")); refreshButton.setStyleName("small"); refreshButton.setDescription(getApplication().getMessage("tickets.refresh.descr")); toolbar.addComponent(refreshButton); toolbar.setComponentAlignment(refreshButton, Alignment.MIDDLE_LEFT); final Button addButton = new Button(getApplication().getMessage("tickets.add.caption")); addButton.setIcon(new ThemeResource("icons/16/add.png")); addButton.setStyleName("small"); addButton.setDescription(getApplication().getMessage("tickets.add.descr")); toolbar.addComponent(addButton); toolbar.setComponentAlignment(addButton, Alignment.MIDDLE_RIGHT); final SplitPanel splitPanel = new SplitPanel(); splitPanel.setSizeFull(); final Table ticketsTable = new Table(); ticketsTable.setSizeFull(); splitPanel.addComponent(ticketsTable); splitPanel.addComponent(new Label("The form for editing tickets will show up here")); final VerticalLayout browser = new VerticalLayout(); browser.setSizeFull(); browser.addComponent(toolbar); browser.addComponent(splitPanel); browser.setExpandRatio(splitPanel, 1.0f); return browser; }
From source file:com.github.peholmst.springsecuritydemo.ui.MainView.java
License:Apache License
/** * TODO Document me!/*from w w w . j a v a 2s . c om*/ * * @return */ @SuppressWarnings("serial") protected Component createHeader() { final HorizontalLayout header = new HorizontalLayout(); header.setMargin(true); header.setWidth("100%"); /* * Header label will contain the name and version of the application. */ final Label headerLabel = new Label( getApplication().getMessage("app.title", getApplication().getVersion())); headerLabel.setStyleName("appHeaderText"); header.addComponent(headerLabel); header.setStyleName("appHeader"); header.setExpandRatio(headerLabel, 1.0f); header.setComponentAlignment(headerLabel, Alignment.MIDDLE_LEFT); /* * User links contains information about the current user and a button * for logging out. */ final HorizontalLayout userLinks = new HorizontalLayout(); userLinks.setStyleName("appHeaderUserLinks"); userLinks.setSpacing(true); /* * The user label contains the name of the current user. */ final Label userLabel = new Label( getApplication().getMessage("main.currentlyLoggedIn", getApplication().getUser().getName()), Label.CONTENT_XHTML); userLinks.addComponent(userLabel); userLinks.setComponentAlignment(userLabel, Alignment.MIDDLE_LEFT); userLabel.setSizeUndefined(); /* * The logout button closes the application, effectively logging the * user out. */ final Button logoutButton = new Button(getApplication().getMessage("main.logout.caption"), new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { // TODO Add confirmation getApplication().close(); } }); logoutButton.setDescription(getApplication().getMessage("main.logout.descr")); logoutButton.setStyleName("small"); userLinks.addComponent(logoutButton); userLinks.setComponentAlignment(logoutButton, Alignment.MIDDLE_RIGHT); header.addComponent(userLinks); header.setComponentAlignment(userLinks, Alignment.MIDDLE_RIGHT); return header; }
From source file:com.haulmont.ext.web.ui.TreeCompany.CompanyExtBrowser.java
License:Open Source License
@Override public void init(Map<String, Object> params) { super.init(params); table = getComponent("extClientTable"); Button expandCollapseTrigger = (Button) getComponent("expandCollapseTrigger"); if (expandCollapseTrigger != null) expandCollapseTrigger.setDescription(getMessage("expandCollapseTrigger")); addAction(new AbstractAction("expandCollapseTrigger") { @Override/*from w w w . j a v a 2 s . c o m*/ public void actionPerform(Component component) { if (treeExpanded) table.collapseAll(); else table.expandAll(); treeExpanded = !treeExpanded; } @Override public String getCaption() { return "+/-"; } }); extCompanysDs = getDsContext().get("extCompanyDs"); extCompanysTable = getComponent("extCompanysTable"); republicDs = getDsContext().get("republicDs"); areadDs = getDsContext().get("areadDs"); villaDs = getDsContext().get("villaDs"); republicDs.refresh(); republicDs.addListener(new CollectionDsListenerAdapter() { @Override public void itemChanged(Datasource ds, Entity prevItem, Entity item) { refreshRDs(); extCompanysTable.expandAll(); } }); ((Select) WebComponentsHelper.unwrap(republic)).setNullSelectionAllowed(false); if (republicDs.size() > 0) { Republic defaultRepublic = (Republic) republicDs.getItem(republicDs.getItemIds().iterator().next()); if (defaultRepublic != null) defaultRepublic = (Republic) republicDs.getItem(republicDs.getItemIds().iterator().next()); republic.setValue(defaultRepublic); } villaDs.setQuery( "select v from ext$Villa v where v.republic.id= :ds$republicDs and v.aread.id is null order by v.villaname"); villaDs.refresh(); final CompanyExt[] companyExt = { null }; areadDs.refresh(); areadDs.addListener(new CollectionDsListenerAdapter() { @Override public void itemChanged(Datasource ds, Entity prevItem, Entity item) { refreshADs(); extCompanysTable.expandAll(); if (areadDs.getItem() == null) { villaDs.setQuery( "select v from ext$Villa v where v.republic.id= :ds$republicDs and v.aread.id is null order by v.villaname"); villaDs.refresh(); } else { villaDs.setQuery("select v from ext$Villa v where v.aread.areadname= '" + ((Aread) areadDs.getItem()).getAreadname() + "' order by v.villaname"); villaDs.refresh(); } } }); villaDs.addListener(new CollectionDsListenerAdapter() { @Override public void itemChanged(Datasource ds, Entity prevItem, Entity item) { refreshVDs(); extCompanysTable.expandAll(); } }); extCompanysTable.addAction(new RefreshAction(extCompanysTable)); extCompanysTable.addAction(new CreateAction(extCompanysTable, WindowManager.OpenType.DIALOG) { @Override public void actionPerform(Component component) { if (areadDs.getItem() != null && villaDs.getItem() == null) areadDs.refresh(); else if (villaDs.getItem() != null) villaDs.refresh(); else republicDs.refresh(); if (republicDs.getItem() == null) { showNotification(MessageProvider.getMessage(this.getClass(), "RepublicDoesNotExit"), IFrame.NotificationType.ERROR); return; } super.actionPerform(component); } @Override protected void afterCommit(Entity entity) { refreshRDs(); if (areadDs.getItem() != null) refreshADs(); if (villaDs.getItem() != null) refreshVDs(); CompanyExt parent = ((CompanyExt) entity).getParentCompanyExt(); if (parent != null) extCompanysTable.expand(parent.getId()); } @Override public Map<String, Object> getInitialValues() { Map<String, Object> params = new HashMap<String, Object>(); params.put("parentCompanyExt", extCompanysDs.getItem()); params.put("republic", republicDs.getItem()); if (areadDs.getItem() != null && villaDs.getItem() != null) { params.put("aread", areadDs.getItem()); params.put("villa", villaDs.getItem()); } else if (areadDs.getItem() != null) { params.put("aread", areadDs.getItem()); } else if (villaDs.getItem() != null) { params.put("villa", villaDs.getItem()); } return params; } @Override public Map<String, Object> getWindowParams() { Map<String, Object> params = new HashMap<String, Object>(); params.put("param$republic", republicDs.getItem()); if (areadDs.getItem() != null && villaDs.getItem() != null) { params.put("param$aread", areadDs.getItem()); params.put("param$villa", villaDs.getItem()); } else if (areadDs.getItem() != null) { params.put("param$aread", areadDs.getItem()); } else if (villaDs.getItem() != null) { params.put("param$villa", villaDs.getItem()); } params.put("visibleCompanyField", false); return params; } }); extCompanysTable.addAction(new EditAction(extCompanysTable, WindowManager.OpenType.DIALOG) { @Override protected void afterCommit(Entity entity) { refreshRDs(); if (areadDs.getItem() != null) refreshADs(); if (villaDs.getItem() != null) refreshVDs(); CompanyExt parent = ((CompanyExt) entity).getParentCompanyExt(); if (parent != null) extCompanysTable.expand(parent.getId()); } @Override public Map<String, Object> getWindowParams() { Map<String, Object> params = new HashMap<String, Object>(); params.put("param$republic", republicDs.getItem()); if (areadDs.getItem() != null && villaDs.getItem() != null) { params.put("param$aread", areadDs.getItem()); params.put("param$villa", villaDs.getItem()); } else if (areadDs.getItem() != null) { params.put("param$aread", areadDs.getItem()); } else if (villaDs.getItem() != null) { params.put("param$villa", villaDs.getItem()); } params.put("extCompany", extCompanysDs.getItem()); params.put("visibleCompanyField", false); return params; } }); extCompanysTable.addAction(new CompanyExtRemoveAction()); extClientTable = getComponent("extClientTable"); TableActionsHelper clientHelper = new TableActionsHelper(this, extClientTable); clientHelper.createCreateAction(new ValueProvider() { public Map<String, Object> getValues() { return Collections.<String, Object>singletonMap("extCompany", extCompanysDs.getItem()); } public Map<String, Object> getParameters() { return null; } }); clientHelper.createEditAction(); extClientTable.addAction(new RemoveAction()); extClientTable.addAction(new AbstractAction("add") { private UserSession userSession = UserSessionProvider.getUserSession(); private MetaClass metaClass = extClientTable.getDatasource().getMetaClass(); @Override public boolean isEnabled() { return super.isEnabled() && userSession.isEntityOpPermitted(metaClass, EntityOp.CREATE); } public void actionPerform(Component component) { final CompanyExt companyExt = extCompanysTable.getSingleSelected(); if (companyExt == null) { showNotification(getMessage("selectCompany.msg"), IFrame.NotificationType.HUMANIZED); return; } Map<String, Object> lookupParams = Collections.<String, Object>singletonMap("companyExtLookup", true); App.getInstance().getWindowManager().getDialogParams().setHeight(700); App.getInstance().getWindowManager().getDialogParams().setWidth(750); openLookup("ext$Client.browse", new Lookup.Handler() { public void handleLookup(Collection items) { CollectionDatasourceImpl extClientDs = (CollectionDatasourceImpl) extClientTable .getDatasource(); for (Object o : items) { ExtClient extClient = (ExtClient) o; extClient.setExtCompany(companyExt); extClientDs.modified(extClient); } extClientDs.commit(); extClientDs.refresh(); } }, WindowManager.OpenType.DIALOG, lookupParams); } @Override public String getCaption() { return getMessage("add"); } }); extClientTable.addAction(new AbstractAction("moveToCompany") { private UserSession userSession = UserSessionProvider.getUserSession(); private MetaClass metaClass = extClientTable.getDatasource().getMetaClass(); @Override public boolean isEnabled() { return super.isEnabled() && userSession.isEntityOpPermitted(metaClass, EntityOp.UPDATE); } public void actionPerform(Component component) { final ExtClient extClient = extClientTable.getSingleSelected(); if (extClient == null) { return; } App.getInstance().getWindowManager().getDialogParams().setWidth(750).setHeight(400); openLookup("ext$CompanyExt.lookup", new Window.Lookup.Handler() { public void handleLookup(Collection items) { CompanyExt companyExt = (CompanyExt) items.iterator().next(); extClient.setExtCompany(companyExt); extClientTable.getDatasource().commit(); extClientTable.getDatasource().refresh(); } }, WindowManager.OpenType.DIALOG, Collections.<String, Object>singletonMap("form", extCompanysDs.getItem())); } @Override public String getCaption() { return getMessage("moveToCompany"); } }); initLazyTabs(); }
From source file:com.hybridbpm.ui.component.bpm.OpenCaseColumnGenerator.java
License:Apache License
@Override public Object generateCell(Table source, Object itemId, Object columnId) { Case case1 = (Case) itemId; String title = (String) source.getItem(itemId).getItemProperty("caseTitle").getValue(); Button button = new Button(title, clickListener); button.setData(case1); button.addStyleName(ValoTheme.BUTTON_LINK); button.setDescription("Open case"); return button; }
From source file:com.hybridbpm.ui.component.bpm.OpenTaskColumnGenerator.java
License:Apache License
@Override public Object generateCell(Table source, Object itemId, Object columnId) { Task task = (Task) itemId;/*from www . java2 s . c om*/ Button button = new Button(task.getTaskTitle(), clickListener); button.setData(task); button.addStyleName(ValoTheme.BUTTON_LINK); button.setDescription("Open task"); return button; }