List of usage examples for com.vaadin.ui CssLayout CssLayout
public CssLayout()
From source file:fr.amapj.view.engine.ui.ValoMenuLayout.java
License:Open Source License
public ValoMenuLayout() { contentArea = new CssLayout(); menuArea = new CssLayout(); loginAera = new CssLayout(); }
From source file:fr.ortec.dsi.pointage.presentation.ihm.view.TextFields.java
License:Apache License
public TextFields() { setMargin(true);//w ww . j ava 2 s . co m setSpacing(true); Label h1 = new Label("Text Fields"); h1.addStyleName(ValoTheme.LABEL_H1); addComponent(h1); HorizontalLayout row = new HorizontalLayout(); row.addStyleName(ValoTheme.LAYOUT_HORIZONTAL_WRAPPING); addComponent(row); TextField tf = new TextField("Normal"); tf.setIcon(testIcon.get()); row.addComponent(tf); tf = new TextField("Custom color"); tf.addStyleName("color1"); row.addComponent(tf); tf = new TextField("User Color"); tf.addStyleName("color2"); row.addComponent(tf); tf = new TextField("Themed"); tf.addStyleName("color3"); row.addComponent(tf); tf = new TextField("Error"); tf.setValue("Somethings wrong"); tf.setComponentError(new UserError("Fix it, now!")); row.addComponent(tf); tf = new TextField("Error, borderless"); tf.setValue("Somethings wrong"); tf.setComponentError(new UserError("Fix it, now!")); tf.addStyleName(ValoTheme.TEXTFIELD_BORDERLESS); row.addComponent(tf); tf = new TextField("Small"); tf.setValue("Field value"); tf.addStyleName(ValoTheme.TEXTFIELD_SMALL); row.addComponent(tf); tf = new TextField("Large"); tf.setValue("Field value"); tf.addStyleName(ValoTheme.TEXTFIELD_LARGE); tf.setIcon(testIcon.get(true)); row.addComponent(tf); tf = new TextField(); tf.setValue("Font, no caption"); tf.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON); tf.setIcon(testIcon.get()); row.addComponent(tf); tf = new TextField(); tf.setValue("Image, no caption"); tf.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON); tf.setIcon(testIcon.get(true, 16)); row.addComponent(tf); CssLayout group = new CssLayout(); group.addStyleName(ValoTheme.LAYOUT_COMPONENT_GROUP); row.addComponent(group); Button button = new Button("Do It"); // button.addStyleName(ValoTheme.BUTTON_PRIMARY); group.addComponent(button); tf = new TextField("Right-aligned"); tf.setValue("1,234"); tf.addStyleName(ValoTheme.TEXTFIELD_ALIGN_RIGHT); row.addComponent(tf); tf = new TextField("Tiny"); tf.setValue("Field value"); tf.addStyleName(ValoTheme.TEXTFIELD_TINY); row.addComponent(tf); tf = new TextField("Huge"); tf.setValue("Field value"); tf.addStyleName(ValoTheme.TEXTFIELD_HUGE); row.addComponent(tf); h1 = new Label("Text Areas"); h1.addStyleName(ValoTheme.LABEL_H1); addComponent(h1); row = new HorizontalLayout(); row.addStyleName(ValoTheme.LAYOUT_HORIZONTAL_WRAPPING); addComponent(row); RichTextArea rta = new RichTextArea(); rta.setValue("<b>Some</b> <i>rich</i> content"); row.addComponent(rta); rta = new RichTextArea("Read-only"); rta.setValue("<b>Some</b> <i>rich</i> content"); rta.setReadOnly(true); row.addComponent(rta); }
From source file:fr.univlorraine.mondossierweb.MainUI.java
License:Apache License
/** * Construction du menu tudiant//w w w . j a va 2s . c o m */ private void buildMainMenuEtudiant() { //Si l'tudiant dont on affiche le dossier est renseign if (etudiant != null) { //Ajout du style au menu mainMenu.setPrimaryStyleName(ValoTheme.MENU_PART); //On fixe la largeur du menu mainMenu.setWidth("233px"); //Si on a une url pour la photo de l'tudiant if (etudiant.getPhoto() != null) { //Layout contenant la photo HorizontalLayout photoLayout = new HorizontalLayout(); //Ajout du style au layout photoLayout.addStyleName(ValoTheme.MENU_SUBTITLE); //On fixe la largeur du layout photoLayout.setWidth(213, Unit.PIXELS); //La layout a des marges photoLayout.setMargin(true); //Bouton qui indique, en fonction de l'icone, si l'tudiant est inscrit pour l'anne en cours. Par dfaut, icone indiquant que l'tudiant est inscrit Button etuInscritBtn = new Button("", FontAwesome.CHECK_CIRCLE); //Ajout du style au bouton etuInscritBtn.setPrimaryStyleName(ValoTheme.BUTTON_BORDERLESS); //Si l'tudiant est inscrit pour l'anne en cours if (etudiant.isInscritPourAnneeEnCours()) { //On fixe la description du bouton etuInscritBtn.setDescription("Inscrit pour l'anne universitaire " + Utils.getAnneeUniversitaireEnCours(etudiantController.getAnneeUnivEnCours(this))); } else { //On change l'icone du bouton pour indiquer que l'tudiant n'est pas inscrit etuInscritBtn.setIcon(FontAwesome.EXCLAMATION_CIRCLE); //On fixe la description du bouton etuInscritBtn.setDescription("Non Inscrit pour l'anne universitaire " + Utils.getAnneeUniversitaireEnCours(etudiantController.getAnneeUnivEnCours(this))); } //Ajout d'un lment vide dans le layout photoLayout.addComponent(new HorizontalLayout()); //Cration de l'image contenant la photo Image fotoEtudiant = new Image(null, new ExternalResource(etudiant.getPhoto())); fotoEtudiant.setWidth("120px"); //Ajout de la photo au layout photoLayout.addComponent(fotoEtudiant); //Alignement de la photo photoLayout.setComponentAlignment(fotoEtudiant, Alignment.MIDDLE_CENTER); //La photo prend toute la place disponible dans son layout photoLayout.setExpandRatio(fotoEtudiant, 1); //Ajout au layout du bouton, qui indique, en fonction de l'icone, si l'tudiant est inscrit pour l'anne en cours photoLayout.addComponent(etuInscritBtn); //Ajout du layout de la photo au menu mainMenu.addComponent(photoLayout); } //Ajout du Prnom/Nom et codetu de l'tudiant dans le menu Label usernameLabel = new Label(etudiant.getNom() + "<br />" + etudiant.getCod_etu(), ContentMode.HTML); usernameLabel.addStyleName(ValoTheme.MENU_SUBTITLE); usernameLabel.addStyleName("retourALaLigneAutomatique"); usernameLabel.setSizeUndefined(); mainMenu.addComponent(usernameLabel); /* Etat Civil */ addItemMenu("Etat-civil", EtatCivilView.NAME, FontAwesome.USER); //info annuelles visibles que si tudiant inscrit pour l'anne en cours if (etudiant.isInscritPourAnneeEnCours()) { addItemMenu("Informations annuelles", InformationsAnnuellesView.NAME, FontAwesome.INFO_CIRCLE); } /* Adresses */ addItemMenu(applicationContext.getMessage(AdressesView.NAME + ".title", null, getLocale()), AdressesView.NAME, FontAwesome.HOME); /* Inscriptions */ addItemMenu("Inscriptions", InscriptionsView.NAME, FontAwesome.FILE_TEXT); /* Calendrier */ addItemMenu("Calendrier des preuves", CalendrierView.NAME, FontAwesome.CALENDAR); /* Notes et Rsultats */ addItemMenu(applicationContext.getMessage(NotesView.NAME + ".title", null, getLocale()), NotesView.NAME, FontAwesome.LIST); /* Sparation avant Bouton "Aide" */ CssLayout bottomMainMenu1 = new CssLayout(); bottomMainMenu1.setStyleName(ValoTheme.MENU_SUBTITLE); bottomMainMenu1.setSizeUndefined(); mainMenu.addComponent(bottomMainMenu1); /* Aide */ Button helpBtn = new Button(applicationContext.getMessage("helpWindow.defaultTitle", null, getLocale()), FontAwesome.SUPPORT); helpBtn.setPrimaryStyleName(ValoTheme.MENU_ITEM); helpBtn.addClickListener(e -> { UI.getCurrent() .addWindow(new HelpBasicWindow( applicationContext.getMessage("helpWindow.text.etudiant", null, getLocale()), applicationContext.getMessage("helpWindow.defaultTitle", null, getLocale()), true)); }); mainMenu.addComponent(helpBtn); /* Deconnexion */ //Voir si on peut accder l'appli hors ENT, le dtecter, et afficher le bouton dconnexion if (configController.isLogoutCasPropose() && userController.isEtudiant()) { Button decoBtn = new Button("Dconnexion", FontAwesome.SIGN_OUT); decoBtn.setPrimaryStyleName(ValoTheme.MENU_ITEM); decoBtn.addClickListener(e -> { getUI().getPage().setLocation("j_spring_security_logout"); }); mainMenu.addComponent(decoBtn); } /* Sparation */ CssLayout bottomMainMenu = new CssLayout(); bottomMainMenu.setStyleName(ValoTheme.MENU_SUBTITLE); bottomMainMenu.setSizeUndefined(); mainMenu.addComponent(bottomMainMenu); } }
From source file:fr.univlorraine.mondossierweb.views.AdressesView.java
License:Apache License
/** * Initialise la vue/*from w ww . j a va 2s . c om*/ */ @PostConstruct public void init() { //On vrifie le droit d'accder la vue if (UI.getCurrent() instanceof MainUI && (userController.isEnseignant() || userController.isEtudiant()) && MainUI.getCurrent() != null && MainUI.getCurrent().getEtudiant() != null) { removeAllComponents(); /* Style */ setMargin(true); setSpacing(true); /* Titre */ Label title = new Label(applicationContext.getMessage(NAME + ".title", null, getLocale())); title.addStyleName(ValoTheme.LABEL_H1); addComponent(title); VerticalLayout globalLayout = new VerticalLayout(); globalLayout.setSizeFull(); globalLayout.setSpacing(true); //Layout avec les infos etatcivil et contact CssLayout idLayout = new CssLayout(); idLayout.setSizeFull(); idLayout.setStyleName("flexwrap"); globalLayout.addComponent(idLayout); // Enable Responsive CSS selectors for the layout Responsive.makeResponsive(idLayout); if (MainUI.getCurrent().getEtudiant().getAdresseAnnuelle() != null) { FormLayout formAdresseAnnuelleLayout = new FormLayout(); formAdresseAnnuelleLayout.setSpacing(true); formAdresseAnnuelleLayout.setMargin(true); Panel panelAdresseAnnuelle = new Panel( applicationContext.getMessage(NAME + ".adresseannuelle.title", null, getLocale()) + " " + MainUI.getCurrent().getEtudiant().getAdresseAnnuelle().getAnnee()); String captionAdresseAnnuelle = applicationContext.getMessage(NAME + ".adresse.title", null, getLocale()); Label fieldAdresseAnnuelle = new Label(); formatLabel(fieldAdresseAnnuelle, captionAdresseAnnuelle, MainUI.getCurrent().getEtudiant().getAdresseAnnuelle().getAdresse1()); formAdresseAnnuelleLayout.addComponent(fieldAdresseAnnuelle); String annuelle2 = valuateTextFieldFromMultipleValues( MainUI.getCurrent().getEtudiant().getAdresseAnnuelle().getAdresse2(), MainUI.getCurrent().getEtudiant().getAdresseAnnuelle().getAdresse3()); if (annuelle2 != null) { Label fieldAdresseAnnuelle2 = new Label(); formatLabel(fieldAdresseAnnuelle2, null, annuelle2); formAdresseAnnuelleLayout.addComponent(fieldAdresseAnnuelle2); } String captionVilleAnnuelle = applicationContext.getMessage(NAME + ".ville.title", null, getLocale()); Label fieldVilleAnnuelle = new Label(); formatLabel(fieldVilleAnnuelle, captionVilleAnnuelle, valuateTextFieldFromMultipleValues( MainUI.getCurrent().getEtudiant().getAdresseAnnuelle().getAdresseetranger(), MainUI.getCurrent().getEtudiant().getAdresseAnnuelle().getCodePostal(), MainUI.getCurrent().getEtudiant().getAdresseAnnuelle().getVille())); formAdresseAnnuelleLayout.addComponent(fieldVilleAnnuelle); String captionPaysAnnuelle = applicationContext.getMessage(NAME + ".pays.title", null, getLocale()); Label fieldPaysAnnuelle = new Label(); formatLabel(fieldPaysAnnuelle, captionPaysAnnuelle, MainUI.getCurrent().getEtudiant().getAdresseAnnuelle().getPays()); formAdresseAnnuelleLayout.addComponent(fieldPaysAnnuelle); String captionTelephoneAnnuelle = applicationContext.getMessage(NAME + ".telephone.title", null, getLocale()); Label fieldTelephoneAnnuelle = new Label(); formatLabel(fieldTelephoneAnnuelle, captionTelephoneAnnuelle, MainUI.getCurrent().getEtudiant().getAdresseAnnuelle().getNumerotel()); formAdresseAnnuelleLayout.addComponent(fieldTelephoneAnnuelle); panelAdresseAnnuelle.setContent(formAdresseAnnuelleLayout); HorizontalLayout adresseAnnuelleGlobalLayout = new HorizontalLayout(); adresseAnnuelleGlobalLayout.setSizeUndefined(); adresseAnnuelleGlobalLayout.setStyleName("firstitembox"); adresseAnnuelleGlobalLayout.addComponent(panelAdresseAnnuelle); adresseAnnuelleGlobalLayout.setExpandRatio(panelAdresseAnnuelle, 1); idLayout.addComponent(adresseAnnuelleGlobalLayout); } if (MainUI.getCurrent().getEtudiant().getAdresseFixe() != null) { FormLayout formAdresseFixeLayout = new FormLayout(); formAdresseFixeLayout.setSpacing(true); formAdresseFixeLayout.setMargin(true); Panel panelAdresseFixe = new Panel( applicationContext.getMessage(NAME + ".adressefixe.title", null, getLocale())); String captionAdresseFixe = applicationContext.getMessage(NAME + ".adresse.title", null, getLocale()); Label fieldAdresseFixe = new Label(); formatLabel(fieldAdresseFixe, captionAdresseFixe, MainUI.getCurrent().getEtudiant().getAdresseFixe().getAdresse1()); formAdresseFixeLayout.addComponent(fieldAdresseFixe); String adfixe2 = valuateTextFieldFromMultipleValues( MainUI.getCurrent().getEtudiant().getAdresseFixe().getAdresse2(), MainUI.getCurrent().getEtudiant().getAdresseFixe().getAdresse3()); if (adfixe2 != null) { Label fieldAdresseFixe2 = new Label(); formatLabel(fieldAdresseFixe2, null, adfixe2); formAdresseFixeLayout.addComponent(fieldAdresseFixe2); } String captionVilleFixe = applicationContext.getMessage(NAME + ".ville.title", null, getLocale()); Label fieldVilleFixe = new Label(); formatLabel(fieldVilleFixe, captionVilleFixe, valuateTextFieldFromMultipleValues( MainUI.getCurrent().getEtudiant().getAdresseFixe().getAdresseetranger(), MainUI.getCurrent().getEtudiant().getAdresseFixe().getCodePostal(), MainUI.getCurrent().getEtudiant().getAdresseFixe().getVille())); formAdresseFixeLayout.addComponent(fieldVilleFixe); String captionPaysFixe = applicationContext.getMessage(NAME + ".pays.title", null, getLocale()); Label fieldPaysFixe = new Label(); formatLabel(fieldPaysFixe, captionPaysFixe, MainUI.getCurrent().getEtudiant().getAdresseFixe().getPays()); formAdresseFixeLayout.addComponent(fieldPaysFixe); String captionTelephoneFixe = applicationContext.getMessage(NAME + ".telephone.title", null, getLocale()); Label fieldTelephoneFixe = new Label(); formatLabel(fieldTelephoneFixe, captionTelephoneFixe, MainUI.getCurrent().getEtudiant().getAdresseFixe().getNumerotel()); formAdresseFixeLayout.addComponent(fieldTelephoneFixe); panelAdresseFixe.setContent(formAdresseFixeLayout); HorizontalLayout adresseFixeGlobalLayout = new HorizontalLayout(); adresseFixeGlobalLayout.setSizeUndefined(); adresseFixeGlobalLayout.setStyleName("itembox"); adresseFixeGlobalLayout.addComponent(panelAdresseFixe); adresseFixeGlobalLayout.setExpandRatio(panelAdresseFixe, 1); idLayout.addComponent(adresseFixeGlobalLayout); } addComponent(globalLayout); if (userController.isEtudiant() && configController.isModificationAdressesAutorisee() && MainUI.getCurrent().getEtudiant().getAdresseAnnuelle() != null) { HorizontalLayout btnLayout = new HorizontalLayout(); btnLayout.setSizeFull(); btnLayout.setSpacing(true); Button btnModifAdresses = new Button( applicationContext.getMessage(NAME + ".bouton.modifieradresses", null, getLocale())); btnModifAdresses.setStyleName(ValoTheme.BUTTON_PRIMARY); btnModifAdresses.setIcon(FontAwesome.EDIT); btnModifAdresses.addClickListener(e -> { ModificationAdressesWindow maw = new ModificationAdressesWindow( MainUI.getCurrent().getEtudiant()); maw.addCloseListener(f -> { init(); }); UI.getCurrent().addWindow(maw); }); btnLayout.addComponent(btnModifAdresses); btnLayout.setComponentAlignment(btnModifAdresses, Alignment.MIDDLE_LEFT); addComponent(btnLayout); } } }
From source file:fr.univlorraine.mondossierweb.views.EtatCivilView.java
License:Apache License
/** * Initialise la vue//from w w w . j a va 2 s. c o m */ @PostConstruct public void init() { LOG.debug(userController.getCurrentUserName() + " EtatCivilView"); //On vrifie le droit d'accder la vue if (UI.getCurrent() instanceof MainUI && (userController.isEnseignant() || userController.isEtudiant())) { if (MainUI.getCurrent() != null && MainUI.getCurrent().getEtudiant() != null) { LOG.debug(userController.getCurrentUserName() + " init EtatCivilView"); /* Style */ setMargin(true); setSpacing(true); /* Titre */ Label title = new Label(applicationContext.getMessage(NAME + ".title", null, getLocale())); title.addStyleName(ValoTheme.LABEL_H1); addComponent(title); VerticalLayout globalLayout = new VerticalLayout(); globalLayout.setSizeFull(); globalLayout.setSpacing(true); //Layout avec les infos etatcivil et contact CssLayout idLayout = new CssLayout(); idLayout.setSizeFull(); idLayout.setStyleName("flexwrap"); globalLayout.addComponent(idLayout); // Enable Responsive CSS selectors for the layout Responsive.makeResponsive(idLayout); /* Generalites */ FormLayout formGeneralitesLayout = new FormLayout(); formGeneralitesLayout.setSpacing(true); formGeneralitesLayout.setMargin(true); Panel panelGeneralites = new Panel( applicationContext.getMessage(NAME + ".generalites.title", null, getLocale())); String captionNumDossier = applicationContext.getMessage(NAME + ".numdossier.title", null, getLocale()); Label fieldNumDossier = new Label(); formatLabel(fieldNumDossier, captionNumDossier, MainUI.getCurrent().getEtudiant().getCod_etu()); formGeneralitesLayout.addComponent(fieldNumDossier); String captionNNE = applicationContext.getMessage(NAME + ".nne.title", null, getLocale()); Label fieldNNE = new Label(); formatLabel(fieldNNE, captionNNE, MainUI.getCurrent().getEtudiant().getCod_nne()); formGeneralitesLayout.addComponent(fieldNNE); String captionNom = applicationContext.getMessage(NAME + ".nom.title", null, getLocale()); Label fieldNom = new Label(); formatLabel(fieldNom, captionNom, MainUI.getCurrent().getEtudiant().getNom()); formGeneralitesLayout.addComponent(fieldNom); String captionMail = applicationContext.getMessage(NAME + ".mail.title", null, getLocale()); Label mailLabel = new Label(); mailLabel.setCaption(captionMail); String mail = MainUI.getCurrent().getEtudiant().getEmail(); if (StringUtils.hasText(mail)) { mail = "<a href=\"mailto:" + mail + "\">" + mail + "</a>"; mailLabel.setValue(mail); mailLabel.setContentMode(ContentMode.HTML); } mailLabel.setSizeFull(); formGeneralitesLayout.addComponent(mailLabel); String captionNationalite = applicationContext.getMessage(NAME + ".nationalite.title", null, getLocale()); Label fieldNationalite = new Label(); formatLabel(fieldNationalite, captionNationalite, MainUI.getCurrent().getEtudiant().getNationalite()); formGeneralitesLayout.addComponent(fieldNationalite); String captionDateNaissance = applicationContext.getMessage(NAME + ".naissance.title", null, getLocale()); Label fieldDateNaissance = new Label(); formatLabel(fieldDateNaissance, captionDateNaissance, MainUI.getCurrent().getEtudiant().getDatenaissance()); formGeneralitesLayout.addComponent(fieldDateNaissance); String captionLieuNaissance = applicationContext.getMessage(NAME + ".lieunaissance.title", null, getLocale()); Label fieldLieuNaissance = new Label(); formatLabel(fieldLieuNaissance, captionLieuNaissance, MainUI.getCurrent().getEtudiant().getLieunaissance()); formGeneralitesLayout.addComponent(fieldLieuNaissance); String captionDepNaissance = applicationContext.getMessage(NAME + ".depnaissance.title", null, getLocale()); Label fieldDepNaissance = new Label(); formatLabel(fieldDepNaissance, captionDepNaissance, MainUI.getCurrent().getEtudiant().getDepartementnaissance()); formGeneralitesLayout.addComponent(fieldDepNaissance); panelGeneralites.setContent(formGeneralitesLayout); HorizontalLayout generalitesGlobalLayout = new HorizontalLayout(); generalitesGlobalLayout.setSizeUndefined(); generalitesGlobalLayout.setStyleName("firstitembox"); generalitesGlobalLayout.addComponent(panelGeneralites); generalitesGlobalLayout.setExpandRatio(panelGeneralites, 1); idLayout.addComponent(generalitesGlobalLayout); /* Bac */ Panel panelBac = new Panel(applicationContext.getMessage(NAME + ".bac.title", null, getLocale())); //Si plusieurs bac if (MainUI.getCurrent().getEtudiant().getListeBac() != null && MainUI.getCurrent().getEtudiant().getListeBac().size() > 1) { panelBac.setCaption(applicationContext.getMessage(NAME + ".bacs.title", null, getLocale())); TabSheet bacTabSheet = new TabSheet(); VerticalLayout vBacLayout = new VerticalLayout(); vBacLayout.setSizeFull(); bacTabSheet.setSizeFull(); bacTabSheet.addStyleName(ValoTheme.TABSHEET_FRAMED); for (BacEtatCivil bec : MainUI.getCurrent().getEtudiant().getListeBac()) { FormLayout tabBacLayout = new FormLayout(); tabBacLayout.setSizeFull(); tabBacLayout.setMargin(false); ajouterBacToView(tabBacLayout, bec); bacTabSheet.addTab(tabBacLayout, bec.getCod_bac(), FontAwesome.GRADUATION_CAP); } vBacLayout.addComponent(bacTabSheet); panelBac.setContent(vBacLayout); } else { //Si un seul bac FormLayout formBacLayout = new FormLayout(); formBacLayout.setSizeFull(); if (MainUI.getCurrent().getEtudiant().getListeBac() != null && MainUI.getCurrent().getEtudiant().getListeBac().size() == 1) { formBacLayout.setSpacing(true); formBacLayout.setMargin(true); ajouterBacToView(formBacLayout, MainUI.getCurrent().getEtudiant().getListeBac().get(0)); } panelBac.setContent(formBacLayout); } HorizontalLayout bacGlobalLayout = new HorizontalLayout(); bacGlobalLayout.setSizeUndefined(); bacGlobalLayout.setStyleName("itembox"); bacGlobalLayout.addComponent(panelBac); bacGlobalLayout.setExpandRatio(panelBac, 1); idLayout.addComponent(bacGlobalLayout); /* Info de contact */ panelContact = new Panel(applicationContext.getMessage(NAME + ".contact.title", null, getLocale())); renseignerPanelContact(); globalLayout.addComponent(panelContact); addComponent(globalLayout); } else { /* Erreur */ addComponent(new BasicErreurMessageLayout(applicationContext)); } } }
From source file:gov.va.ds4p.ds4pmobileportal.ui.AuditLogs.java
License:Open Source License
public void buildView() { CssLayout content = new CssLayout(); content.setWidth("100%"); setCaption("Access Control Decisioning Logs - " + AdminContext.getSessionAttributes().getSelectedPatientName()); table = new Table(); table.setWidth("100%"); table.setHeight("350px"); table.setMultiSelect(false);//w w w .ja v a 2 s . com table.setSelectable(true); table.setImmediate(true); // react at once when something is selected table.setEditable(false); table.setWriteThrough(true); table.setContainerDataSource(populateAuthorizationRequests()); table.setColumnReorderingAllowed(true); table.setColumnCollapsingAllowed(false); table.setVisibleColumns(new Object[] { "msgDate", "healthcareObject", "purposeOfUse", "requestor", "uniqueIdentifier", "decision", "responsetime", "messageId" }); table.setColumnHeaders(new String[] { "Date", "Resource", "POU", "Recipient", "Patient ID", "PDP Decision", "Resp. Time(ms)", "Message ID" }); content.addComponent(table); Button obligationsBTN = new Button("Obligations"); Button rulesGeneratedBTN = new Button("SLS - Rules Generated"); Button rulesExecutedBTN = new Button("SLS - Rules Executed"); HorizontalComponentGroup hGroup = new HorizontalComponentGroup(); hGroup.setWidth("100%"); hGroup.addComponent(obligationsBTN); hGroup.addComponent(rulesGeneratedBTN); hGroup.addComponent(rulesExecutedBTN); content.addComponent(hGroup); obligationsBTN.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { AuthLog log = getAuthLogObject(); if (log != null) { String drl = log.getObligations(); Popover popover = getPopoverTextArea(drl, "XACML Response - Obligations"); popover.showRelativeTo(getNavigationBar()); } } }); rulesGeneratedBTN.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { AuthLog log = getAuthLogObject(); if (log != null) { String drl = log.getGenDrl(); Popover popover = getPopoverTextArea(drl, "Generated DRL (Annotation Rules)"); popover.showRelativeTo(getNavigationBar()); } } }); rulesExecutedBTN.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { AuthLog log = getAuthLogObject(); if (log != null) { String drl = log.getExecRules(); Popover popover = getPopoverTextArea(drl, "Executed Annotation Rules"); popover.showRelativeTo(getNavigationBar()); } } }); setContent(content); }
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);// ww w. j a v a 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 void buildView() { CssLayout content = new CssLayout(); content.setWidth("100%"); setCaption("eHealth Direct - " + AdminContext.getSessionAttributes().getUserId()); hp.setStyleName(Runo.SPLITPANEL_SMALL); hp.setSplitPosition(20, Sizeable.UNITS_PERCENTAGE); hp.setHeight("450px"); hp.setLocked(false);// w ww.ja va 2 s . co m hp.setFirstComponent(getDropArea()); hp.setSecondComponent(getResultsTable()); HorizontalComponentGroup hg = new HorizontalComponentGroup(); hg.setWidth("100%"); hg.addComponent(refresh); hg.addComponent(viewMetaData); hg.addComponent(viewEncryptedDoc); hg.addComponent(viewTransformed); hg.addComponent(testDisclosure); viewMetaData.addListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { processMetaDataForViewing(); } }); viewTransformed.addListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { //test for selection Directprocessing obj = getTableObject(); if (obj != null) { String refrainPolicy = obj.getRefrainPolicy(); String doc = obj.getDocument(); if (refrainPolicy.equals("NORDSLCD")) { getWindow().showNotification("Warning", disclosure, Window.Notification.TYPE_WARNING_MESSAGE); } Popover popover = getPopoverLabel(getHTMLVersionOfCDA(doc), "Transformed Clinical Summary"); popover.showRelativeTo(getNavigationBar()); } } }); content.addComponent(hp); content.addComponent(hg); setContent(content); }
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);/* ww w .j a v a2 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(); 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 void buildView() { CssLayout content = new CssLayout(); content.setWidth("100%"); setCaption("eHealth Exchange - " + AdminContext.getSessionAttributes().getSelectedPatientName()); VerticalComponentGroup vGroup = new VerticalComponentGroup(); Label displayAction = new Label( "<div style='color:#333;'><p>First perform a secured <b>Search</b> (DocumentQuery) for all available patient documents." + " Then <b>highlight</b> the document of interest in the table, then click" + " on the <b>Retrieve Document</b> button to perform a secured DocumentRetrieve." + " Decrpyt the document by clicking any of the 2 <b>Decryption</b> buttons results may vary depending" + " on you privileges. Once decrypted you may view the HTML form by clicking on the <b>View Clinical Document</b>.</p></div>", Label.CONTENT_XHTML); vGroup.addComponent(displayAction);// w w w . j a v a 2 s . co m Button searchBTN = new Button("Search"); searchBTN.setStyleName(Runo.BUTTON_SMALL); searchBTN.setWidth("100"); content.addComponent(vGroup); content.addComponent(searchBTN); table = new Table(); table.setWidth("100%"); table.setHeight("350px"); table.setMultiSelect(false); table.setSelectable(true); table.setImmediate(true); // react at once when something is selected table.setEditable(false); table.setWriteThrough(true); table.setContainerDataSource(populateTable()); table.setColumnReorderingAllowed(true); table.setColumnCollapsingAllowed(false); table.setVisibleColumns(new Object[] { "patientId", "docId", "docType", "respId", "msgId" }); table.setColumnHeaders( new String[] { "Patient ID", "Document ID", "Document Type", "Repository", "Message" }); content.addComponent(table); retrieveBTN = new Button("Retrieve Document"); decryptDocBTN = new Button("Decrypt Document"); decryptDocMaskBTN = new Button("Decrypt Doc and Entries"); viewHTMLBTN = new Button("View Clinical Document"); viewPDFBTN = new Button("Consent PDF"); viewXACMLBTN = new Button("Consent Policy"); viewSAMLBTN = new Button("View Authorization (SAML)"); viewMetaData = new Button("View Meta Data"); HorizontalComponentGroup hGroup = new HorizontalComponentGroup(); hGroup.setWidth("100%"); retrieveBTN.setEnabled(false); decryptDocBTN.setEnabled(false); decryptDocMaskBTN.setEnabled(false); viewHTMLBTN.setEnabled(false); viewPDFBTN.setEnabled(false); viewXACMLBTN.setEnabled(false); viewSAMLBTN.setEnabled(false); viewMetaData.setEnabled(false); hGroup.addComponent(retrieveBTN); hGroup.addComponent(decryptDocBTN); hGroup.addComponent(decryptDocMaskBTN); hGroup.addComponent(viewHTMLBTN); hGroup.addComponent(viewPDFBTN); hGroup.addComponent(viewXACMLBTN); hGroup.addComponent(viewSAMLBTN); hGroup.addComponent(viewMetaData); content.addComponent(hGroup); searchBTN.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { patientId = AdminContext.getSessionAttributes().getSelectedPatientId(); patientName = AdminContext.getSessionAttributes().getSelectedPatientName(); currentDocument = ""; decryptDocument = ""; requestedService = "DocQuery"; //area.setValue(currentDocument); //area.setCaption("No Documents Selected"); String decision = "Permit"; if (patientId.equals("PUI100015060013")) { PolicyEnforcementObject pObj = policyEngine.enforceResouce( AdminContext.getSessionAttributes().getPurposeOfUse(), "PSY", "DocumentQueryOut"); decision = pObj.getPdpDecision(); } if (decision.equals("Permit")) { String res = lookUpPatient(); metaData = res; if (res.indexOf("XDSDocumentEntry.uniqueId") > -1) { AdhocQueryResponse adhoc = getQueryResponse(res); RegistryObjectListType rList = adhoc.getRegistryObjectList(); List<ExchangeResults> xList = processMetaData(rList); refreshTable(xList); } else { //throw warning docId = "NA"; docType = "NA"; messageId = "NA"; respId = "1.3.6.1.4.1.21367.2010.1.2.1040"; ExchangeResults eR = new ExchangeResults(patientName, patientId, docId, docType, "", "", "", messageId, respId); List<ExchangeResults> xList = new ArrayList(); xList.add(eR); refreshTable(xList); displayErrorMessage(res); } retrieveBTN.setEnabled(false); decryptDocBTN.setEnabled(false); decryptDocMaskBTN.setEnabled(false); viewHTMLBTN.setEnabled(false); viewPDFBTN.setEnabled(false); viewXACMLBTN.setEnabled(false); viewSAMLBTN.setEnabled(true); viewMetaData.setEnabled(true); } else { getWindow().showNotification("Warning", "You do not have the necessary authorization privileges to perform this operation.", Window.Notification.TYPE_WARNING_MESSAGE); } } }); table.addListener(new Property.ValueChangeListener() { @Override public void valueChange(Property.ValueChangeEvent event) { Object rowId = table.getValue(); if (rowId != null) { patientName = (String) table.getContainerProperty(rowId, "patientName").getValue(); patientId = (String) table.getContainerProperty(rowId, "patientId").getValue(); docId = (String) table.getContainerProperty(rowId, "docId").getValue(); docType = (String) table.getContainerProperty(rowId, "docType").getValue(); respId = (String) table.getContainerProperty(rowId, "respId").getValue(); messageId = (String) table.getContainerProperty(rowId, "msgId").getValue(); if (docType.equals("Consult Notes")) { retrieveBTN.setEnabled(true); decryptDocBTN.setEnabled(true); decryptDocBTN.setCaption("Decrypt Document"); decryptDocMaskBTN.setEnabled(true); viewHTMLBTN.setEnabled(true); viewPDFBTN.setEnabled(false); viewXACMLBTN.setEnabled(false); } else if (docType.equals("Consent Notes") || docType.equals("Consult")) { retrieveBTN.setEnabled(true); decryptDocBTN.setEnabled(true); decryptDocBTN.setCaption("Extract Document"); decryptDocMaskBTN.setEnabled(false); viewHTMLBTN.setEnabled(true); viewPDFBTN.setEnabled(true); viewXACMLBTN.setEnabled(true); } else { getWindow().showNotification("Warning", "Could not determine document type for processing.", Window.Notification.TYPE_WARNING_MESSAGE); } } } }); retrieveBTN.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { Object rowId = table.getValue(); String decision = "Permit"; if (patientId.equals("PUI100015060013")) { PolicyEnforcementObject pObj = policyEngine.enforceResouce( AdminContext.getSessionAttributes().getPurposeOfUse(), "PSY", "DocumentRetrieveOut"); decision = pObj.getPdpDecision(); } if (decision.equals("Permit")) { if (rowId != null) { getDocument(); requestedService = "DocRetrieve"; System.out.println("CURRENT DOCUMENT SIZE: " + currentDocument.length()); Popover popover = getPopoverTextArea(currentDocument, "Document Retrieve Response"); popover.showRelativeTo(getNavigationBar()); } else { getWindow().showNotification("Warning", "No row selected, Please select document for retrieval.", Window.Notification.TYPE_WARNING_MESSAGE); } } else { getWindow().showNotification("Warning", "You do not have the necessary authorization privileges to perform this operation.", Window.Notification.TYPE_WARNING_MESSAGE); } } }); decryptDocBTN.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { if (currentDocument.length() == 0) { getWindow().showNotification("Warning", "You must select and retrieve document first.", Window.Notification.TYPE_WARNING_MESSAGE); } else { try { String sOrg = AdminContext.getSessionAttributes().getSelectedOrg(); if (sOrg.equals("FEISystems")) { ihe.iti.xds_b._2007.RetrieveDocumentSetResponse xdsbRetrieveDocumentSetResponse = unmarshallFromXml( ihe.iti.xds_b._2007.RetrieveDocumentSetResponse.class, currentDocument); ihe.iti.xds_b._2007.RetrieveDocumentSetResponse.DocumentResponse documentResponse = xdsbRetrieveDocumentSetResponse .getDocumentResponse().get(0); if (docType.equals("Consult Notes")) { byte[] processDocBytes = documentResponse.getDocument(); decryptDocument = decryptDocumentExcludeElements(processDocBytes, keyD); } else { byte[] processDocBytes = documentResponse.getDocument(); decryptDocument = new String(processDocBytes); } } else { decryptDocument = currentDocument; } Popover popover = getPopoverLabel(convertXMLtoXHTML(decryptDocument), "Decrypted - Document Only"); popover.showRelativeTo(getNavigationBar()); } catch (Exception ex) { ex.printStackTrace(); } } } }); decryptDocMaskBTN.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { if (currentDocument.length() == 0) { getWindow().showNotification("Warning", "You must select and retrieve document first.", Window.Notification.TYPE_WARNING_MESSAGE); } else { String decision = "Permit"; if (patientId.equals("PUI100015060013")) { PolicyEnforcementObject pObj = policyEngine.enforceResouce( AdminContext.getSessionAttributes().getPurposeOfUse(), "PSY", "DocumentEntryUnMask"); decision = pObj.getPdpDecision(); } if (decision.equals("Permit")) { try { ihe.iti.xds_b._2007.RetrieveDocumentSetResponse xdsbRetrieveDocumentSetResponse = unmarshallFromXml( ihe.iti.xds_b._2007.RetrieveDocumentSetResponse.class, currentDocument); ihe.iti.xds_b._2007.RetrieveDocumentSetResponse.DocumentResponse documentResponse = xdsbRetrieveDocumentSetResponse .getDocumentResponse().get(0); if (docType.equals("Consult Notes")) { byte[] processDocBytes = documentResponse.getDocument(); decryptDocument = decryptDocument(processDocBytes, keyD, keyM); } else { byte[] processDocBytes = documentResponse.getDocument(); decryptDocument = new String(processDocBytes); } Popover popover = getPopoverLabel(convertXMLtoXHTML(decryptDocument), "Decrypted - Document and Masked Entries"); popover.showRelativeTo(getNavigationBar()); } catch (Exception ex) { ex.printStackTrace(); } } else { getWindow().showNotification("Warning", "You do not have the necessary authorization privileges to perform this operation.", Window.Notification.TYPE_WARNING_MESSAGE); } } } }); viewHTMLBTN.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { if (decryptDocument.length() == 0) { getWindow().showNotification("Warning", "You must select and retrieve document first, then view decrypted version, before attempting to transform it.", Window.Notification.TYPE_WARNING_MESSAGE); } else { String decision = "Permit"; if (patientId.equals("PUI100015060013")) { PolicyEnforcementObject pObj = policyEngine.enforceResouce( AdminContext.getSessionAttributes().getPurposeOfUse(), "PSY", "DocumentView"); decision = pObj.getPdpDecision(); } if (decision.equals("Permit")) { String sOrg = AdminContext.getSessionAttributes().getSelectedOrg(); if (sOrg.equals("FEISystems")) { getWindow().showNotification("Warning", disclosure, Window.Notification.TYPE_WARNING_MESSAGE); } String title = ""; if (docType.equals("Consult Notes")) { title = "Summary of Episode - C32"; } else if (docType.equals("Consent Notes")) { title = "CDA R2 Consent Directive"; } else { title = "Unknown Document Type"; } Popover popover = getPopoverLabel(getHTMLVersionOfCDA(decryptDocument), title); popover.showRelativeTo(getNavigationBar()); } else { getWindow().showNotification("Warning", "You do not have the necessary authorization privileges to perform this operation.", Window.Notification.TYPE_WARNING_MESSAGE); } } } }); viewPDFBTN.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { processPDFForViewing(); } }); viewXACMLBTN.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { processXACMLForViewing(); } }); viewSAMLBTN.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { processSAMLForViewing(); } }); viewMetaData.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { processMetaDataForViewing(); } }); setContent(content); }