List of usage examples for com.vaadin.ui Button setIcon
@Override public void setIcon(Resource icon)
From source file:fr.univlorraine.mondossierweb.views.windows.SignificationsMobileWindow.java
License:Apache License
/** * Cre une fentre/*w ww .java 2s .c o m*/ */ public SignificationsMobileWindow(boolean afficherSignificationIndicateurProfondeur) { setWidth("95%"); setHeight("95%"); setCaption(applicationContext.getMessage("significationsWindow.title", null, getLocale())); setModal(true); setResizable(false); setClosable(false); setStyleName("v-popover-blank"); VerticalLayout layout = new VerticalLayout(); layout.setSizeFull(); setContent(layout); VerticalLayout panelLayout = new VerticalLayout(); panelLayout.setWidth("100%"); panelLayout.setStyleName("v-scrollableelement"); panelLayout.setSpacing(true); panelLayout.setMargin(true); if (MdwTouchkitUI.getCurrent().getEtudiant().isSignificationResultatsUtilisee()) { Panel panelSignificationResultats = new Panel(); panelSignificationResultats.setCaption( applicationContext.getMessage(NAME + ".info.significations.resultats", null, getLocale())); panelSignificationResultats.addStyleName("significationpanel"); panelSignificationResultats.setWidth("100%"); VerticalLayout significationLayout = new VerticalLayout(); significationLayout.setWidth("100%"); significationLayout.setMargin(true); significationLayout.setSpacing(true); Set<String> ss = MdwTouchkitUI.getCurrent().getEtudiant().getSignificationResultats().keySet(); for (String k : ss) { if (k != null && !k.equals("") && !k.equals(" ")) { HorizontalLayout signLayout = new HorizontalLayout(); signLayout.setSizeFull(); signLayout.setMargin(true); signLayout.setSpacing(true); Label codeLabel = new Label(k); codeLabel.setStyleName(ValoTheme.LABEL_BOLD); codeLabel.addStyleName("v-label-align-right"); signLayout.addComponent(codeLabel); Label valueLabel = new Label( "" + MdwTouchkitUI.getCurrent().getEtudiant().getSignificationResultats().get(k)); signLayout.addComponent(valueLabel); significationLayout.addComponent(signLayout); } } panelSignificationResultats.setContent(significationLayout); panelLayout.addComponent(panelSignificationResultats); } if (afficherSignificationIndicateurProfondeur) { Panel panelSignificationIndicateurs = new Panel(); panelSignificationIndicateurs.setCaption( applicationContext.getMessage(NAME + ".info.significations.indicateurs", null, getLocale())); panelSignificationIndicateurs.addStyleName("significationpanel"); panelSignificationIndicateurs.setWidth("100%"); VerticalLayout significationLayout = new VerticalLayout(); significationLayout.setMargin(true); significationLayout.setSpacing(true); significationLayout.setWidth("100%"); //1er NIVEAU HorizontalLayout levelLayout1 = new HorizontalLayout(); levelLayout1.setWidth("100%"); HorizontalLayout levelMainLayout1 = new HorizontalLayout(); levelMainLayout1.setWidth("100%"); levelMainLayout1.setSpacing(true); levelMainLayout1.setStyleName("level-indicator-layout"); int k = 0; for (int i = 0; i < 1; i++) { //Ajout d'un level k++; Label libLevelLayout = new Label(); libLevelLayout.setSizeFull(); libLevelLayout.setHeight("8px"); libLevelLayout.setStyleName("layout-level-green-indicator"); levelMainLayout1.addComponent(libLevelLayout); } //On pense avoir 7 level maxi for (int j = k; j < 8; j++) { Label libLevelSpaceLayout = new Label(); libLevelSpaceLayout.setSizeFull(); libLevelSpaceLayout.setHeight("8px"); levelMainLayout1.addComponent(libLevelSpaceLayout); } levelLayout1.addComponent(levelMainLayout1); levelLayout1.addComponent(new Label("1er niveau")); significationLayout.addComponent(levelLayout1); //2em NIVEAU HorizontalLayout levelLayout2 = new HorizontalLayout(); levelLayout2.setSizeFull(); HorizontalLayout levelMainLayout2 = new HorizontalLayout(); levelMainLayout2.setSizeFull(); levelMainLayout2.setSpacing(true); levelMainLayout2.setStyleName("level-indicator-layout"); k = 0; for (int i = 0; i < 2; i++) { //Ajout d'un level k++; Label libLevelLayout = new Label(); libLevelLayout.setSizeFull(); libLevelLayout.setHeight("8px"); libLevelLayout.setStyleName("layout-level-green-indicator"); levelMainLayout2.addComponent(libLevelLayout); } //On pense avoir 7 level maxi for (int j = k; j < 8; j++) { Label libLevelSpaceLayout = new Label(); libLevelSpaceLayout.setSizeFull(); libLevelSpaceLayout.setHeight("8px"); levelMainLayout2.addComponent(libLevelSpaceLayout); } levelLayout2.addComponent(levelMainLayout2); levelLayout2.addComponent(new Label("2em niveau")); significationLayout.addComponent(levelLayout2); //3em NIVEAU HorizontalLayout levelLayout3 = new HorizontalLayout(); levelLayout3.setSizeFull(); HorizontalLayout levelMainLayout3 = new HorizontalLayout(); levelMainLayout3.setSizeFull(); levelMainLayout3.setSpacing(true); levelMainLayout3.setStyleName("level-indicator-layout"); k = 0; for (int i = 0; i < 3; i++) { //Ajout d'un level k++; Label libLevelLayout = new Label(); libLevelLayout.setSizeFull(); libLevelLayout.setHeight("8px"); libLevelLayout.setStyleName("layout-level-green-indicator"); levelMainLayout3.addComponent(libLevelLayout); } //On pense avoir 7 level maxi for (int j = k; j < 8; j++) { Label libLevelSpaceLayout = new Label(); libLevelSpaceLayout.setSizeFull(); libLevelSpaceLayout.setHeight("8px"); levelMainLayout3.addComponent(libLevelSpaceLayout); } levelLayout3.addComponent(levelMainLayout3); levelLayout3.addComponent(new Label("3em niveau")); significationLayout.addComponent(levelLayout3); //4em NIVEAU HorizontalLayout levelLayout4 = new HorizontalLayout(); levelLayout4.setSizeFull(); HorizontalLayout levelMainLayout4 = new HorizontalLayout(); levelMainLayout4.setSizeFull(); levelMainLayout4.setSpacing(true); levelMainLayout4.setStyleName("level-indicator-layout"); k = 0; for (int i = 0; i < 4; i++) { //Ajout d'un level k++; Label libLevelLayout = new Label(); libLevelLayout.setSizeFull(); libLevelLayout.setHeight("8px"); libLevelLayout.setStyleName("layout-level-green-indicator"); levelMainLayout4.addComponent(libLevelLayout); } //On pense avoir 7 level maxi for (int j = k; j < 8; j++) { Label libLevelSpaceLayout = new Label(); libLevelSpaceLayout.setSizeFull(); libLevelSpaceLayout.setHeight("8px"); levelMainLayout4.addComponent(libLevelSpaceLayout); } levelLayout4.addComponent(levelMainLayout4); levelLayout4.addComponent(new Label("4em niveau")); significationLayout.addComponent(levelLayout4); //ETC HorizontalLayout levelLayoutEtc = new HorizontalLayout(); levelLayoutEtc.setSizeFull(); levelLayoutEtc.addComponent(new Label("...")); levelLayoutEtc.addComponent(new Label("")); significationLayout.addComponent(levelLayoutEtc); panelSignificationIndicateurs.setContent(significationLayout); panelLayout.addComponent(panelSignificationIndicateurs); } layout.addComponent(panelLayout); // close button HorizontalLayout bLayout = new HorizontalLayout(); bLayout.setSizeFull(); bLayout.setHeight("50px"); Button closeButton = new Button(); //closeButton.setCaption(applicationContext.getMessage("significationsWindow.btnFermer", null, getLocale())); closeButton.setStyleName(ValoTheme.BUTTON_PRIMARY); closeButton.addStyleName("v-popover-button"); closeButton.setIcon(FontAwesome.CHECK); closeButton.addClickListener(e -> { close(); }); bLayout.addComponent(closeButton); bLayout.setComponentAlignment(closeButton, Alignment.MIDDLE_CENTER); layout.addComponent(bLayout); layout.setExpandRatio(panelLayout, 1); }
From source file:gov.osti.doecode.RepositoryForm.java
/** * Create a basic form UI for editing software metadata information. * /*w ww .j a v a 2 s . c o 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:gov.va.ds4p.ds4pmobileportal.ui.AuditLogs.java
License:Open Source License
private Button getButtonWithIcon(String val) { Button res = new Button(val); res.setStyleName(Runo.BUTTON_LINK);/*from w ww . jav a 2 s.c om*/ if ("Permit".equals(val)) { res.setIcon(new ThemeResource("../runo/icons/16/ok.png")); } else { res.setIcon(new ThemeResource("../runo/icons/16/attention.png")); } return res; }
From source file:gov.va.ds4p.ds4pmobileportal.ui.AuditLogs.java
License:Open Source License
private Popover getPopoverTextArea(String val, String title) { Popover popover = new Popover(); popover.setModal(true);/*from www . j a va 2 s . co m*/ popover.setClosable(true); popover.setWidth("700px"); popover.setHeight("100%"); CssLayout popLayout = new CssLayout(); popLayout.setSizeFull(); popLayout.setMargin(true); NavigationView navView = new NavigationView(popLayout); navView.setCaption(title); CssLayout layout2 = new CssLayout(); TextArea textArea = new TextArea(); textArea.setWidth("100%"); textArea.setHeight("700px"); textArea.setValue(val); textArea.setReadOnly(true); layout2.addComponent(textArea); popLayout.addComponent(layout2); Button close = new Button(null, new Button.ClickListener() { public void buttonClick(ClickEvent event) { event.getButton().getWindow().getParent().removeWindow(event.getButton().getWindow()); } }); close.setIcon(new ThemeResource("../runo/icons/64/cancel.png")); navView.setRightComponent(close); popover.setContent(navView); return popover; }
From source file:gov.va.ds4p.ds4pmobileportal.ui.eHealthDirect.java
License:Open Source License
private Popover getPopoverLabel(String val, String title) { Popover popover = new Popover(); popover.setModal(true);/*from w w w .jav a 2s. c om*/ popover.setClosable(true); popover.setWidth("700px"); popover.setHeight("100%"); CssLayout popLayout = new CssLayout(); popLayout.setSizeFull(); popLayout.setMargin(true); NavigationView navView = new NavigationView(popLayout); navView.setCaption(title); CssLayout layout2 = new CssLayout(); Label lbl = new Label(); lbl.setContentMode(Label.CONTENT_XHTML); lbl.setStyleName(Runo.LABEL_SMALL); lbl.setValue(val); layout2.addComponent(lbl); popLayout.addComponent(layout2); Button close = new Button(null, new Button.ClickListener() { public void buttonClick(Button.ClickEvent event) { event.getButton().getWindow().getParent().removeWindow(event.getButton().getWindow()); } }); close.setIcon(new ThemeResource("../runo/icons/64/cancel.png")); navView.setRightComponent(close); popover.setContent(navView); return popover; }
From source file:gov.va.ds4p.ds4pmobileportal.ui.eHealthExchange.java
License:Open Source License
private Popover getPopoverTextArea(String val, String title) { Popover popover = new Popover(); popover.setModal(true);//from ww w . j a v a 2s . c om popover.setClosable(true); popover.setWidth("700px"); popover.setHeight("100%"); CssLayout popLayout = new CssLayout(); popLayout.setSizeFull(); popLayout.setMargin(true); NavigationView navView = new NavigationView(popLayout); navView.setCaption(title); CssLayout layout2 = new CssLayout(); TextArea textArea = new TextArea(); textArea.setWidth("100%"); textArea.setHeight("700px"); textArea.setValue(val); textArea.setReadOnly(true); layout2.addComponent(textArea); popLayout.addComponent(layout2); Button close = new Button(null, new ClickListener() { public void buttonClick(ClickEvent event) { event.getButton().getWindow().getParent().removeWindow(event.getButton().getWindow()); } }); close.setIcon(new ThemeResource("../runo/icons/64/cancel.png")); navView.setRightComponent(close); popover.setContent(navView); return popover; }
From source file:gov.va.ds4p.ds4pmobileportal.ui.eHealthExchange.java
License:Open Source License
private Popover getPopoverLabel(String val, String title) { Popover popover = new Popover(); popover.setModal(true);/*w w w .j ava 2s. c om*/ popover.setClosable(true); popover.setWidth("700px"); popover.setHeight("100%"); CssLayout popLayout = new CssLayout(); popLayout.setSizeFull(); popLayout.setMargin(true); NavigationView navView = new NavigationView(popLayout); navView.setCaption(title); CssLayout layout2 = new CssLayout(); Label lbl = new Label(); lbl.setContentMode(Label.CONTENT_XHTML); lbl.setStyleName(Runo.LABEL_SMALL); lbl.setValue(val); layout2.addComponent(lbl); popLayout.addComponent(layout2); Button close = new Button(null, new ClickListener() { public void buttonClick(ClickEvent event) { event.getButton().getWindow().getParent().removeWindow(event.getButton().getWindow()); } }); close.setIcon(new ThemeResource("../runo/icons/64/cancel.png")); navView.setRightComponent(close); popover.setContent(navView); return popover; }
From source file:gov.va.ds4p.ds4pmobileportal.ui.eHealthExchange.java
License:Open Source License
private Popover getPopoverPDF(String val, String title) { Popover popover = new Popover(); popover.setModal(true);/* w ww . j a va 2 s .c om*/ popover.setClosable(true); popover.setWidth("700px"); popover.setHeight("100%"); CssLayout popLayout = new CssLayout(); popLayout.setSizeFull(); popLayout.setMargin(true); NavigationView navView = new NavigationView(popLayout); navView.setCaption(title); CssLayout layout2 = new CssLayout(); Embedded pdf = new Embedded(); pdf.setType(Embedded.TYPE_BROWSER); pdf.setMimeType("application/pdf"); pdf.setSizeFull(); pdf.setWidth("100%"); pdf.setHeight("700px"); pdf.setSource(createPdf(val)); layout2.addComponent(pdf); popLayout.addComponent(layout2); Button close = new Button(null, new ClickListener() { public void buttonClick(ClickEvent event) { event.getButton().getWindow().getParent().removeWindow(event.getButton().getWindow()); } }); 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.HCSLogs.java
public HCSLogs() { session = ((HealthElementsTouchKitUI) UI.getCurrent()).getSessionAttributes(); setCaption("Standards Log Output"); final VerticalComponentGroup content = new VerticalComponentGroup(); createTable();/* w w w .jav a 2 s . c o m*/ content.addComponent(logTable); Button refresh = new Button(); refresh.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { try { logTable.removeAllItems(); logTable.setContainerDataSource(populateHCSLogs()); logTable.setColumnReorderingAllowed(true); logTable.setColumnCollapsingAllowed(false); logTable.setVisibleColumns(new Object[] { "date", "purposeofuse", "resourceType", "id" }); logTable.setColumnHeaders(new String[] { "Date", "POU", "Resource Requested", "Resource ID" }); } catch (Exception ex) { ex.printStackTrace(); } } }); refresh.setImmediate(true); refresh.setIcon(FontAwesome.REFRESH); setRightComponent(refresh); HorizontalButtonGroup hGroup = new HorizontalButtonGroup(); hGroup.setCaption("Click Button View Std Area"); hGroup.setWidth("100%"); Button resourceBtn = new Button("FHIR Resource"); Button slsRulesExecBtn = new Button("SLS Rules"); Button slsOutputBtn = new Button("SLS Actions"); Button ppsRulesExecBtn = new Button("PPS Rules"); Button ppsOutputBtn = new Button("PPS Actions"); Button consentBtn = new Button("Consent"); Button labeledResourceBtn = new Button("HCS Results"); resourceBtn.setImmediate(true); slsRulesExecBtn.setImmediate(true); slsOutputBtn.setImmediate(true); ppsRulesExecBtn.setImmediate(true); ppsOutputBtn.setImmediate(true); consentBtn.setImmediate(true); labeledResourceBtn.setImmediate(true); resourceBtn.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { try { Object rowId = logTable.getValue(); if (rowId != null) { String obj = (String) logTable.getContainerProperty(rowId, "resource").getValue(); Popover popover = getPopoverTextArea(obj, "FHIR Resource"); popover.showRelativeTo(getNavigationBar()); } } catch (Exception ex) { ex.printStackTrace(); } } }); slsRulesExecBtn.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { try { Object rowId = logTable.getValue(); if (rowId != null) { String obj = (String) logTable.getContainerProperty(rowId, "slsrules").getValue(); Popover popover = getPopoverTextArea(obj, "SLS Rules"); popover.showRelativeTo(getNavigationBar()); } } catch (Exception ex) { ex.printStackTrace(); } } }); slsOutputBtn.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { try { Object rowId = logTable.getValue(); if (rowId != null) { String obj = (String) logTable.getContainerProperty(rowId, "slsresults").getValue(); Popover popover = getPopoverTextArea(obj, "SLS Actions"); popover.showRelativeTo(getNavigationBar()); } } catch (Exception ex) { ex.printStackTrace(); } } }); ppsRulesExecBtn.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { try { Object rowId = logTable.getValue(); if (rowId != null) { String obj = (String) logTable.getContainerProperty(rowId, "ppsrules").getValue(); Popover popover = getPopoverTextArea(obj, "PPS Rules"); popover.showRelativeTo(getNavigationBar()); } } catch (Exception ex) { ex.printStackTrace(); } } }); ppsOutputBtn.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { try { Object rowId = logTable.getValue(); if (rowId != null) { String obj = (String) logTable.getContainerProperty(rowId, "ppsresults").getValue(); Popover popover = getPopoverTextArea(obj, "PPS Actions"); popover.showRelativeTo(getNavigationBar()); } } catch (Exception ex) { ex.printStackTrace(); } } }); consentBtn.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { try { Object rowId = logTable.getValue(); if (rowId != null) { String obj = (String) logTable.getContainerProperty(rowId, "consent").getValue(); Popover popover = getPopoverTextArea(obj, "Consent"); popover.showRelativeTo(getNavigationBar()); } } catch (Exception ex) { ex.printStackTrace(); } } }); labeledResourceBtn.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { try { Object rowId = logTable.getValue(); if (rowId != null) { String obj = (String) logTable.getContainerProperty(rowId, "labeledresource").getValue(); Popover popover = getPopoverTextArea(obj, "HCS Results"); popover.showRelativeTo(getNavigationBar()); } } catch (Exception ex) { ex.printStackTrace(); } } }); hGroup.addComponent(resourceBtn); hGroup.addComponent(slsRulesExecBtn); hGroup.addComponent(slsOutputBtn); hGroup.addComponent(consentBtn); hGroup.addComponent(ppsRulesExecBtn); hGroup.addComponent(ppsOutputBtn); hGroup.addComponent(labeledResourceBtn); content.addComponent(hGroup); setContent(new CssLayout(content)); }
From source file:gov.va.ehtac.appsonfhir.ui.HCSLogs.java
private Button getButtonWithIcon(String val) { Button rButton = new Button(); rButton.setStyleName(Runo.LABEL_SMALL); Label lbl = new Label(); rButton.setData(val); if (val.contains("Condition")) { rButton.setCaption("Condition Bundle"); } else if (val.contains("Observation")) { rButton.setCaption("Observation Bundle"); } else if (val.contains("MedicationPrescription")) { rButton.setCaption("Medication Prescription Bundle"); } else if (val.contains("Allergy")) { rButton.setCaption("Allergy Intolerence Bundle"); } else if (val.contains("Immunization")) { rButton.setCaption("Immunization Bundle"); } else if (val.contains("Encounter")) { rButton.setCaption("Encounter Bundle"); } else {//from w w w . ja v a 2 s . c om rButton.setCaption("Unknown Resource Bundle"); } rButton.setIcon(new ThemeResource("../runo/icons/16/document-web.png")); rButton.setData(val); // rButton.addListener(new MouseEvents.ClickListener() { // // @Override // public void click(MouseEvents.ClickEvent event) { // String data = (String)event.getButton().getData(); // String title = (String)event.getButton().getCaption(); // Popover p = getPopoverTextArea(data, title); // p.showRelativeTo(getNavigationBar()); // } // }); return rButton; }