List of usage examples for com.vaadin.ui Button setIcon
@Override public void setIcon(Resource icon)
From source file:gov.va.ehtac.appsonfhir.ui.HCSLogs.java
private Popover getPopoverTextArea(String val, String title) { popover = new Popover(); popover.setModal(true);// w ww . ja v a2 s. co m popover.setClosable(true); popover.setWidth("700px"); popover.setHeight("550px"); CssLayout popLayout = new CssLayout(); popLayout.setSizeFull(); NavigationView navView = new NavigationView(popLayout); navView.setCaption(title); CssLayout layout2 = new CssLayout(); TextArea textArea = new TextArea(); textArea.setWidth("100%"); textArea.setHeight("490px"); textArea.setValue(val); // textArea.setReadOnly(true); // textArea.setStyleName(Runo.LABEL_SMALL); layout2.addComponent(textArea); popLayout.addComponent(layout2); Button close = new Button(null, new Button.ClickListener() { public void buttonClick(Button.ClickEvent event) { popover.removeFromParent(); } }); close.setIcon(new ThemeResource("../runo/icons/64/cancel.png")); navView.setRightComponent(close); popover.setContent(navView); return popover; }
From source file:gov.va.ehtac.appsonfhir.ui.PatientSearch.java
private Popover getPopoverResults() { popover = new Popover(); popover.setModal(true);//from ww w . j a v a 2 s .com popover.setClosable(true); popover.setWidth("500px"); popover.setHeight("350px"); CssLayout popLayout = new CssLayout(); popLayout.setSizeFull(); NavigationView navView = new NavigationView(popLayout); navView.setCaption("Search Results"); CssLayout layout2 = new CssLayout(); createTable(); layout2.addComponent(searchTable); Button selectPatient = new Button("Select", new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { try { Object rowId = searchTable.getValue(); if (rowId != null) { String id = (String) searchTable.getContainerProperty(rowId, "patientid").getValue(); String last = (String) searchTable.getContainerProperty(rowId, "lastname").getValue(); String first = (String) searchTable.getContainerProperty(rowId, "firstname").getValue(); String gender = (String) searchTable.getContainerProperty(rowId, "gender").getValue(); String dob = (String) searchTable.getContainerProperty(rowId, "dob").getValue(); PatientSearchResults results = (PatientSearchResults) searchTable .getContainerProperty(rowId, "oResults").getValue(); session.setPatientId(id); session.setPatientNameAgeGenderDisplay(last + ", " + first + " " + gender + " " + dob); patientDisplayName.setValue(session.getPatientNameAgeGenderDisplay()); System.out.println("PATIENT NameAgeGender: " + session.getPatientNameAgeGenderDisplay() + " PATIENT ID: " + session.getPatientId()); System.out.println(results.getPayload()); popover.close(); grabAllPatientData(); } } catch (Exception ex) { ex.printStackTrace(); } } }); layout2.addComponent(selectPatient); popLayout.addComponent(layout2); Button close = new Button(null, new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { popover.removeFromParent(); } }); close.setIcon(new ThemeResource("../runo/icons/64/cancel.png")); navView.setLeftComponent(close); navView.setRightComponent(selectPatient); popover.setContent(navView); return popover; }
From source file:gov.va.ehtac.appsonfhir.ui.Tools.java
public Tools() { setCaption("Patient Tools"); final HorizontalButtonGroup hGroup = new HorizontalButtonGroup(); Button weightBTN = new Button("Weight Scale"); weightBTN.setIcon(FontAwesome.DELICIOUS); weightBTN.setWidth("310px"); Button heartRateBTN = new Button("Heart Rate"); heartRateBTN.setIcon(FontAwesome.HEART); heartRateBTN.setWidth("310px"); Button bloodPressureBTN = new Button("Blood Pressure"); bloodPressureBTN.setIcon(FontAwesome.HEART_O); bloodPressureBTN.setWidth("310px"); Button glucoseBTN = new Button("Diabetes Management"); glucoseBTN.setIcon(FontAwesome.FILE_CODE_O); glucoseBTN.setWidth("310px"); hGroup.addComponent(weightBTN);/*from ww w . ja v a 2 s .co m*/ hGroup.addComponent(heartRateBTN); hGroup.addComponent(bloodPressureBTN); hGroup.addComponent(glucoseBTN); setContent(new CssLayout(hGroup)); }
From source file:gov.va.ehtac.appsonfhir.ui.Vitals.java
public Vitals() { session = ((HealthElementsTouchKitUI) UI.getCurrent()).getSessionAttributes(); setCaption("Observations - " + session.getPatientNameAgeGenderDisplay()); final VerticalComponentGroup content = new VerticalComponentGroup(); createTable();//from ww w . j a va 2 s .c o m content.addComponent(vitalsTable); final Button submitButton = new Button("Submit"); submitButton.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { Notification.show("Thanks!"); } }); Button b = new Button("HCS"); b.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { try { HCSOrchestratorService service = new HCSOrchestratorService(); HCSOrchestrator port = service.getHCSOrchestratorPort(); ((BindingProvider) port).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, "http://localhost:7080/HCSServices/HCSOrchestratorService?wsdl"); List<HcsCategory> hcs = new ArrayList(); ApplySecurityLabelsFHIRForResourceReleaseResponse.Return r = port .applySecurityLabelsFHIRForResourceRelease(composeXMLStringFeed(bundle), "1", hcs, session.getPurposeOfUse()); System.out.println(r.getProcessedAtomFeed()); //HcsTaggingResponse res = port.genFHIRConfidentialityLabels(composeXMLStringFeed(bundle), hcs); } catch (Exception ex) { ex.printStackTrace(); } } }); b.setIcon(FontAwesome.SHARE); setRightComponent(b); setContent(new CssLayout(content)); }
From source file:gov.va.ehtac.myappsonfhir.ui.FitnessWellness.java
public FitnessWellness() { session = ((HealthElementsForPatientTouchKitUI) UI.getCurrent()).getSessionAttributes(); setCaption("My Health Apps"); content = new VerticalComponentGroup(); this.setWidth("100%"); this.setHeight("100%"); if (dRequest.equals("chart")) { content.addComponent(getChartLayout()); } else if (dRequest.equals("raw")) { content.addComponent(getRawData()); } else {//from ww w .java2s. com //this is a problem content.addComponent(new Panel()); } Button refresh = new Button(); refresh.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { try { dRequest = "chart"; refresh(); } catch (Exception ex) { ex.printStackTrace(); } } }); refresh.setImmediate(true); refresh.setIcon(FontAwesome.REFRESH); setRightComponent(refresh); setContent(new CssLayout(content)); }
From source file:gov.va.ehtac.myappsonfhir.ui.ImmunizationRequest.java
private Popover getPopoverResults(String umaResults) { popover = new Popover(); popover.setModal(true);//from w w w. j a v a2 s.c o m popover.setClosable(true); popover.setWidth("500px"); popover.setHeight("350px"); CssLayout popLayout = new CssLayout(); popLayout.setSizeFull(); NavigationView navView = new NavigationView(popLayout); navView.setCaption("Request Completed"); Label lbl = new Label(umaResults); CssLayout layout2 = new CssLayout(); layout2.addComponent(lbl); setTable(); layout2.addComponent(immunizationTable); popLayout.addComponent(layout2); Button close = new Button(null, new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { popover.removeFromParent(); } }); close.setIcon(new ThemeResource("../runo/icons/64/cancel.png")); navView.setRightComponent(close); popover.setContent(navView); return popover; }
From source file:io.github.jikuja.vaadin_yamapa.ui.views.PoiMap.java
License:Creative Commons License
private void setupCenterCrossHair() { Button helper = new Button(); helper.addStyleName("helper"); helper.setIcon(FontAwesome.CROSSHAIRS); helper.addStyleName(ValoTheme.BUTTON_BORDERLESS); helper.addStyleName(ValoTheme.BUTTON_ICON_ONLY); addComponent(helper);/*from w w w. j ava 2s . c o m*/ }
From source file:io.mateu.ui.vaadin.framework.MyUI.java
License:Apache License
/** * abre una vista. La colocar en el lado derecho * * @param ui//ww w.j av a2s . co m * @param view */ public static void addView(MyUI ui, AbstractView view) { if (view == null) { System.out.println("abriendo vista null"); ui.getViewDisplay().removeAllComponents(); } else { System.out.println("abriendo vista " + view.getClass().getName() + "::" + view.getViewId()); ViewLayout v = new ViewLayout(view); if (view instanceof AbstractDialog) { AbstractDialog d = (AbstractDialog) view; // Create a sub-window and set the content Window subWindow = new Window(((AbstractDialog) view).getTitle()); HorizontalLayout footer = new HorizontalLayout(); footer.setWidth("100%"); footer.setSpacing(true); footer.addStyleName(ValoTheme.WINDOW_BOTTOM_TOOLBAR); Label footerText = new Label(""); footerText.setSizeUndefined(); Button ok; if (d instanceof AbstractAddRecordDialog) { ok = new Button("Add record", e -> { List<String> errors = v.getView().getForm().validate(); if (errors.size() > 0) { io.mateu.ui.core.client.app.MateuUI.notifyErrors(errors); } else { //if (d.isCloseOnOk()) subWindow.close(); ((AbstractAddRecordDialog) view).addAndClean(v.getView().getForm().getData()); } }); } else { ok = new Button(d.getOkText(), e -> { List<String> errors = v.getView().getForm().validate(); if (errors.size() > 0) { io.mateu.ui.core.client.app.MateuUI.notifyErrors(errors); } else { if (d.isCloseOnOk()) subWindow.close(); ((AbstractDialog) view).onOk(v.getView().getForm().getData()); } }); } ok.addStyleName(ValoTheme.BUTTON_PRIMARY); ok.setClickShortcut(ShortcutAction.KeyCode.ENTER); footer.addComponents(footerText); for (AbstractAction a : d.getActions()) { Button b = new Button(a.getName(), e -> { a.run(); }); //b.addStyleName(ValoTheme.BUTTON_); //b.setClickShortcut(ShortcutAction.KeyCode.ENTER); if ("previous".equalsIgnoreCase(a.getName())) { b.setIcon(VaadinIcons.ANGLE_LEFT); } else if ("next".equalsIgnoreCase(a.getName())) { b.setIcon(VaadinIcons.ANGLE_RIGHT); } footer.addComponent(b); } if (d instanceof AbstractListEditorDialog) { AbstractListEditorDialog lv = (AbstractListEditorDialog) d; Property<Integer> pos = new SimpleObjectProperty<>(); pos.setValue(lv.getInitialPos()); Button prev = new Button("Previous", e -> { List<String> errors = v.getView().getForm().validate(); if (errors.size() > 0) { io.mateu.ui.core.client.app.MateuUI.notifyErrors(errors); } else { if (pos.getValue() > 0) { lv.setData(pos.getValue(), view.getForm().getData()); pos.setValue(pos.getValue() - 1); view.getForm().setData(lv.getData(pos.getValue())); } } }); prev.setIcon(VaadinIcons.ANGLE_LEFT); footer.addComponent(prev); Button next = new Button("Next", e -> { List<String> errors = v.getView().getForm().validate(); if (errors.size() > 0) { io.mateu.ui.core.client.app.MateuUI.notifyErrors(errors); } else { if (pos.getValue() < lv.getListSize() - 1) { lv.setData(pos.getValue(), view.getForm().getData()); pos.setValue(pos.getValue() + 1); view.getForm().setData(lv.getData(pos.getValue())); } } }); next.setIcon(VaadinIcons.ANGLE_RIGHT); footer.addComponent(next); pos.addListener(new ChangeListener<Integer>() { @Override public void changed(ObservableValue<? extends Integer> observable, Integer oldValue, Integer newValue) { if (newValue <= 0) { prev.setEnabled(false); } else { prev.setEnabled(true); } if (newValue < lv.getListSize() - 1) { next.setEnabled(true); } else { next.setEnabled(false); } } }); } footer.addComponents(ok); //, cancel); footer.setExpandRatio(footerText, 1); v.addComponent(footer); subWindow.setContent(v); // Center it in the browser window subWindow.center(); subWindow.setModal(true); // Open it in the UI ui.addWindow(subWindow); } else { System.out.println("aadiendo vista al contenedor de vistas"); ui.getViewDisplay().removeAllComponents(); ui.getViewDisplay().addComponent(v); ui.refreshMenu(v.getArea(), v.getMenu()); } } }
From source file:io.mateu.ui.vaadin.framework.MyUI.java
License:Apache License
/** * construye el menu//from ww w . j av a 2 s. c o 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:it.vige.greenarea.bpm.custom.ui.form.GreenareaAbstractFormPropertyRenderer.java
License:Apache License
protected void addButton(String operation, HorizontalLayout buttons, final String item, final Table table) { final String finalOperation = operation; final Button button = new Button(); if (operation.equals(MODIFICA.name())) button.setIcon(new ThemeResource("img/edit.png")); else if (operation.equals(CANCELLAZIONE.name())) button.setIcon(new ThemeResource("img/delete.png")); else//w w w.j a v a 2s .c om button.setIcon(new ThemeResource("img/task-16.png")); button.addStyleName(BUTTON_LINK); I18nManager i18nManager = get().getI18nManager(); button.setDescription(i18nManager.getMessage(operation)); buttons.addComponent(button); buttons.setComponentAlignment(button, BOTTOM_RIGHT); button.addListener(new ClickListener() { private static final long serialVersionUID = -6091586145870618870L; public void buttonClick(ClickEvent event) { // Extract the submitted values from the form. Throws // exception // when validation fails. try { table.select(item); Map<String, String> formProperties = greenareaFormPropertiesForm .getGreenareaFormPropertiesComponent().getFormPropertyValues(); setOperation(formProperties, finalOperation); greenareaFormPropertiesForm.getMainTitle() .setPropertyDataSource(new ObjectProperty<String>( greenareaFormPropertiesForm.getMainTitle().getValue() + " > " + finalOperation, String.class)); FormPropertiesEvent formPropertiesEvent = greenareaFormPropertiesForm.new FormPropertiesEvent( greenareaFormPropertiesForm, TYPE_SUBMIT, formProperties); greenareaFormPropertiesForm.fireEvent(formPropertiesEvent); button.setComponentError(null); } catch (InvalidValueException ive) { // Error is presented to user by the form component } } }); }