Example usage for com.vaadin.ui Panel setStyleName

List of usage examples for com.vaadin.ui Panel setStyleName

Introduction

In this page you can find the example usage for com.vaadin.ui Panel setStyleName.

Prototype

@Override
    public void setStyleName(String style) 

Source Link

Usage

From source file:fr.univlorraine.mondossierweb.views.NotesMobileView.java

License:Apache License

public void refresh() {

    //On vrifie le droit d'accder  la vue
    if (UI.getCurrent() instanceof MdwTouchkitUI
            && (userController.isEnseignant() || userController.isEtudiant())
            && MdwTouchkitUI.getCurrent() != null && MdwTouchkitUI.getCurrent().getEtudiant() != null) {

        removeAllComponents();//from   w w w  .  j  av a2s  .  c om

        /* Style */
        setMargin(false);
        setSpacing(false);
        setSizeFull();

        //NAVBAR
        HorizontalLayout navbar = new HorizontalLayout();
        navbar.setSizeFull();
        navbar.setHeight("40px");
        navbar.setStyleName("navigation-bar");

        //Bouton retour
        if (userController.isEnseignant()) {
            returnButton = new Button();
            returnButton.setIcon(FontAwesome.ARROW_LEFT);
            //returnButton.setStyleName(ValoTheme.BUTTON_ICON_ONLY);
            returnButton.setStyleName("v-nav-button");
            returnButton.addClickListener(e -> {
                if (MdwTouchkitUI.getCurrent().getDossierEtuFromView() != null && MdwTouchkitUI.getCurrent()
                        .getDossierEtuFromView().equals(ListeInscritsMobileView.NAME)) {
                    MdwTouchkitUI.getCurrent().navigateToListeInscrits();
                }

                if (MdwTouchkitUI.getCurrent().getDossierEtuFromView() != null && MdwTouchkitUI.getCurrent()
                        .getDossierEtuFromView().equals(RechercheMobileView.NAME)) {
                    MdwTouchkitUI.getCurrent().navigateToRecherche(null);
                }
            });
            navbar.addComponent(returnButton);
            navbar.setComponentAlignment(returnButton, Alignment.MIDDLE_LEFT);
        }

        //Titre
        Label labelNavBar = new Label(MdwTouchkitUI.getCurrent().getEtudiant().getNom());
        labelNavBar.setStyleName("v-label-navbar");
        navbar.addComponent(labelNavBar);
        navbar.setComponentAlignment(labelNavBar, Alignment.MIDDLE_CENTER);

        navbar.setExpandRatio(labelNavBar, 1);

        //Significations
        if (MdwTouchkitUI.getCurrent().getEtudiant().isSignificationResultatsUtilisee()) {
            significationButton = new Button();
            significationButton.setIcon(FontAwesome.INFO_CIRCLE);
            significationButton.setStyleName("v-nav-button");
            significationButton.addClickListener(e -> {
                //afficher les significations
                SignificationsMobileWindow w = new SignificationsMobileWindow(false);
                UI.getCurrent().addWindow(w);
            });
            navbar.addComponent(significationButton);
            navbar.setComponentAlignment(significationButton, Alignment.MIDDLE_RIGHT);
        }

        addComponent(navbar);

        VerticalLayout globalLayout = new VerticalLayout();
        //globalLayout.setSizeFull();
        globalLayout.setSpacing(true);
        globalLayout.setMargin(true);
        globalLayout.setStyleName("v-scrollableelement");

        List<Diplome> ldiplomes = MdwTouchkitUI.getCurrent().getEtudiant().getDiplomes();
        if (ldiplomes != null && ldiplomes.size() > 0) {
            Panel diplomesPanel = new Panel(
                    applicationContext.getMessage(NAME + ".table.diplomes", null, getLocale()));
            diplomesPanel.setStyleName("centertitle-panel");
            diplomesPanel.addStyleName("v-colored-panel-caption");
            VerticalLayout diplomesLayout = new VerticalLayout();
            for (Diplome diplome : ldiplomes) {
                Panel panelEnCours = null;

                panelEnCours = new Panel(diplome.getAnnee());
                panelEnCours.setStyleName("v-panel-caption-centertitle-panel");

                HorizontalLayout noteLayout = new HorizontalLayout();
                noteLayout.setSizeFull();
                noteLayout.setSpacing(true);

                VerticalLayout libelleLayout = new VerticalLayout();
                libelleLayout.setSizeFull();

                Label libelleButton = new Label(diplome.getLib_web_vdi());
                libelleButton.setHeight("100%");
                libelleButton.setWidth("100%");
                libelleButton.addStyleName("label-centre");

                //Appel de la window contenant le dtail des notes
                if (diplome.getResultats() != null && diplome.getResultats().size() > 0) {
                    libelleLayout.addComponent(new Label(""));
                }
                libelleLayout.addComponent(libelleButton);
                libelleLayout.setComponentAlignment(libelleButton, Alignment.MIDDLE_CENTER);

                HorizontalLayout notesessionLayout = new HorizontalLayout();
                notesessionLayout.setSizeFull();
                notesessionLayout.setSpacing(true);

                if (diplome.getResultats() != null && diplome.getResultats().size() > 0) {
                    int i = 0;
                    for (Resultat r : diplome.getResultats()) {
                        i++;
                        VerticalLayout resultatLayout = new VerticalLayout();
                        resultatLayout.setSizeFull();
                        Label session = new Label(r.getSession());
                        session.setStyleName("label-bold-with-bottom");
                        resultatLayout.addComponent(session);
                        Label note = new Label(r.getNote());
                        resultatLayout.addComponent(note);
                        Label resultat = new Label(r.getAdmission());
                        resultatLayout.addComponent(resultat);
                        //Si c'est la dernire session
                        if (i == diplome.getResultats().size()) {
                            //On affiche les infos en gras
                            note.setStyleName(ValoTheme.LABEL_BOLD);
                            resultat.setStyleName(ValoTheme.LABEL_BOLD);
                        }
                        notesessionLayout.addComponent(resultatLayout);
                    }
                } else {
                    Label resultat = new Label("Aucun rsultat");
                    resultat.setStyleName(ValoTheme.LABEL_SMALL);
                    notesessionLayout.addComponent(resultat);
                }

                noteLayout.addComponent(libelleLayout);

                noteLayout.addComponent(notesessionLayout);

                panelEnCours.setContent(noteLayout);
                diplomesLayout.addComponent(panelEnCours);
            }
            diplomesPanel.setContent(diplomesLayout);
            globalLayout.addComponent(diplomesPanel);
        }

        List<Etape> letapes = MdwTouchkitUI.getCurrent().getEtudiant().getEtapes();

        if (letapes != null && letapes.size() > 0) {
            Panel elpsPanel = new Panel(
                    applicationContext.getMessage(NAME + ".table.etapes", null, getLocale()));
            elpsPanel.setStyleName("centertitle-panel");
            elpsPanel.addStyleName("v-colored-panel-caption");
            VerticalLayout elpsLayout = new VerticalLayout();

            for (Etape etape : letapes) {
                Panel panelEnCours = null;

                panelEnCours = new Panel(etape.getAnnee());
                panelEnCours.setStyleName("v-panel-caption-centertitle-panel");

                HorizontalLayout noteLayout = new HorizontalLayout();
                noteLayout.setSizeFull();
                noteLayout.setSpacing(true);

                VerticalLayout libelleLayout = new VerticalLayout();
                libelleLayout.setSizeFull();

                Button libelleButton = new Button(etape.getLibelle());
                Utils.setButtonStyle(libelleButton);
                libelleButton.setHeight("100%");
                libelleButton.setWidth("100%");

                //Appel de la window contenant le dtail des notes
                prepareBoutonAppelDetailDesNotes(libelleButton, etape);
                if (etape.getResultats() != null && etape.getResultats().size() > 0) {
                    libelleLayout.addComponent(new Label(""));
                }
                libelleLayout.addComponent(libelleButton);
                libelleLayout.setComponentAlignment(libelleButton, Alignment.MIDDLE_CENTER);

                HorizontalLayout notesessionLayout = new HorizontalLayout();
                notesessionLayout.setSizeFull();
                notesessionLayout.setSpacing(true);

                if (etape.getResultats() != null && etape.getResultats().size() > 0) {
                    int i = 0;
                    for (Resultat r : etape.getResultats()) {
                        i++;
                        VerticalLayout resultatLayout = new VerticalLayout();
                        resultatLayout.setSizeFull();
                        Label session = new Label(r.getSession());
                        session.setStyleName("label-bold-with-bottom");
                        resultatLayout.addComponent(session);
                        Label note = new Label(r.getNote());
                        resultatLayout.addComponent(note);
                        Label resultat = new Label(r.getAdmission());
                        resultatLayout.addComponent(resultat);
                        //Si c'est la dernire session
                        if (i == etape.getResultats().size()) {
                            //On affiche les infos en gras
                            note.setStyleName(ValoTheme.LABEL_BOLD);
                            resultat.setStyleName(ValoTheme.LABEL_BOLD);
                        }
                        notesessionLayout.addComponent(resultatLayout);
                    }
                } else {
                    Label resultat = new Label("Aucun rsultat");
                    resultat.setStyleName(ValoTheme.LABEL_SMALL);
                    notesessionLayout.addComponent(resultat);
                }

                noteLayout.addComponent(libelleLayout);

                noteLayout.addComponent(notesessionLayout);

                panelEnCours.setContent(noteLayout);
                elpsLayout.addComponent(panelEnCours);
            }
            elpsPanel.setContent(elpsLayout);
            globalLayout.addComponent(elpsPanel);

        }

        addComponent(globalLayout);
        setExpandRatio(globalLayout, 1);
    }
}

From source file:gov.va.ds4p.ds4pmobileportal.ui.eHealthDirect.java

License:Open Source License

private Panel getDropArea() {
    Panel p = new Panel();
    p.setStyleName(Runo.PANEL_LIGHT);
    VerticalLayout v = (VerticalLayout) p.getContent();
    v.setHeight("100%");
    v.addComponent(getDropPanel());/*ww  w. ja v a  2 s .  c o m*/
    v.addComponent(label1);
    v.addComponent(label2);
    v.addComponent(label3);

    return p;
}

From source file:gov.va.ds4p.ds4pmobileportal.ui.eHealthDirect.java

License:Open Source License

private Panel getDropPanel() {
    Panel p = new Panel();
    VerticalLayout v = (VerticalLayout) p.getContent();
    v.setSpacing(true);/*  www  .j a v  a  2 s . com*/
    //v.setHeight("100%");
    p.setStyleName(Runo.PANEL_LIGHT);

    Panel wrapperPanel = new Panel();
    VerticalLayout vDPanel = (VerticalLayout) wrapperPanel.getContent();
    deleteBTN.setIcon(new ThemeResource("../runo/icons/64/folder-add.png"));
    deleteBTN.setWidth("64px");
    deleteBTN.setHeight("64px");

    vDPanel.addComponent(deleteBTN);
    final DragAndDropWrapper wrapper = new DragAndDropWrapper(wrapperPanel);
    wrapper.setWidth("100px");
    wrapper.setHeight("100px");

    wrapperPanel.setStyleName(Runo.PANEL_LIGHT);

    wrapper.setDropHandler(new DropHandler() {

        @Override
        public void drop(DragAndDropEvent event) {
            // expecting this to be an html5 drag
            DragAndDropWrapper.WrapperTransferable tr = (DragAndDropWrapper.WrapperTransferable) event
                    .getTransferable();
            Html5File[] files = tr.getFiles();
            if (files != null) {
                for (final Html5File html5File : files) {
                    final String fileName = html5File.getFileName();

                    if (html5File.getFileSize() > FILE_SIZE_LIMIT) {
                        getWindow().showNotification("File rejected. Max 2MB files are accepted by Sampler",
                                Window.Notification.TYPE_WARNING_MESSAGE);
                    } else {

                        final ByteArrayOutputStream bas = new ByteArrayOutputStream();
                        StreamVariable streamVariable = new StreamVariable() {

                            public OutputStream getOutputStream() {
                                return bas;
                            }

                            public boolean listenProgress() {
                                return false;
                            }

                            public void onProgress(StreamVariable.StreamingProgressEvent event) {
                            }

                            public void streamingStarted(StreamVariable.StreamingStartEvent event) {
                            }

                            public void streamingFinished(StreamVariable.StreamingEndEvent event) {
                                progress.setVisible(false);
                                Boolean res = updateProviderProcessingInbox(bas.toByteArray());
                                if (res.booleanValue()) {
                                    getWindow().showNotification(
                                            "Processing Complete: " + fileName + " " + html5File.getType() + " "
                                                    + html5File.getFileSize(),
                                            Window.Notification.TYPE_HUMANIZED_MESSAGE);
                                } else {
                                    getWindow().showNotification(
                                            "Processing Error: You Do Not Have Necessary Permissions to Receive and Process Files.",
                                            Window.Notification.TYPE_TRAY_NOTIFICATION);
                                }
                            }

                            public void streamingFailed(StreamVariable.StreamingErrorEvent event) {
                                progress.setVisible(false);
                            }

                            public boolean isInterrupted() {
                                return false;
                            }
                        };
                        html5File.setStreamVariable(streamVariable);
                        progress.setVisible(true);
                    }
                }

            } else {
                String text = tr.getText();
                if (text != null) {
                    getWindow().showNotification(text, Window.Notification.TYPE_HUMANIZED_MESSAGE);
                }
            }
        }

        @Override
        public AcceptCriterion getAcceptCriterion() {
            return AcceptAll.get();
        }
    });

    v.addComponent(wrapper);

    return p;
}

From source file:gov.va.ds4p.ds4pmobileportal.ui.eHealthDirect.java

License:Open Source License

private Panel getResultsTable() {
    Panel p = new Panel();
    p.setStyleName(Runo.PANEL_LIGHT);
    VerticalLayout v = (VerticalLayout) p.getContent();
    v.setSpacing(true);/*from w  w w  .j  a v a2s  .c  om*/
    table = new Table();
    table.setStyleName(Runo.TABLE_SMALL);
    table.setCaption("Processed XDM Packages");
    table.setWidth("100%");
    table.setHeight("400px");
    table.setMultiSelect(false);
    table.setSelectable(true);
    table.setImmediate(true); // react at once when something is selected
    table.setEditable(false);
    table.setWriteThrough(false);
    table.setContainerDataSource(populateTable());

    table.setColumnReorderingAllowed(true);
    table.setColumnCollapsingAllowed(false);
    table.setVisibleColumns(new Object[] { "oDate", "oPatientName", "oSender", "oConfidentiality",
            "oRefrainPolicy", "oPurposeOfUse" });
    table.setColumnHeaders(new String[] { "Date Processed", "Patient Name", "From", "Confidentiality",
            "Primary Refrain Policy", "Intended Purpose Of Use" });

    v.addComponent(table);
    return p;
}

From source file:gov.va.ds4p.ds4pmobileportal.ui.eHealthDirect.java

License:Open Source License

private Panel createHTMLVersionOfC32(String c32) {
    Panel p = new Panel();
    p.setStyleName(Runo.PANEL_LIGHT);
    VerticalLayout v = (VerticalLayout) p.getContent();
    v.setSpacing(true);/* w w  w.  j  a v a 2 s  .  c  o m*/
    v.setHeight("100%");
    v.setWidth("100%");
    Label l = new Label();
    l.setContentMode(Label.CONTENT_XHTML);
    l.setValue(getHTMLVersionOfCDA(c32));
    v.addComponent(l);
    return p;
}

From source file:gov.va.ehtac.appsonfhir.ui.FHIRChart.java

private Panel getMedications() {
    Panel panel = new Panel();
    panel.setStyleName(Runo.LAYOUT_DARKER);
    panel.setCaption("Medications");
    panel.setWidth("80%");
    panel.setHeight("100px");

    return panel;
}

From source file:helpers.Utils.java

License:Open Source License

public static Panel createInfoBox(String caption, String description) {
    Panel panel = new Panel(caption);
    panel.setIcon(FontAwesome.INFO);//from   www  .j  a  v a 2 s.  c o  m
    panel.setStyleName(ValoTheme.PANEL_BORDERLESS);
    HorizontalLayout layout = new HorizontalLayout();
    Label label = new Label();
    label.setValue(description);
    layout.addComponent(label);

    panel.setContent(layout);
    return panel;
}

From source file:info.magnolia.ui.framework.overlay.OverlayPresenter.java

License:Open Source License

@Override
public void openAlert(MessageStyleType type, String title, View body, String okButton,
        final AlertCallback callback) {

    final BaseDialog dialog = new LightDialog();
    dialog.addStyleName(type.getCssClass());
    dialog.addStyleName("alert");

    dialog.setCaption(title);//  w ww  . j  a  v  a 2  s  .c  o m
    CompositeIcon icon = (CompositeIcon) Classes.getClassFactory().newInstance(type.getIconClass());
    icon.setStyleName("dialog-icon");
    dialog.setHeaderToolbar(icon);
    dialog.showCloseButton();

    dialog.setContent(body.asVaadinComponent());

    Panel shortcutPanel = new Panel();
    shortcutPanel.setStyleName("shortcut-panel");
    shortcutPanel.setHeight(100, Unit.PERCENTAGE);
    shortcutPanel.setWidth(100, Unit.PERCENTAGE);
    shortcutPanel.setContent(dialog);

    final OverlayCloser overlayCloser = openOverlay(new ViewAdapter(shortcutPanel), ModalityLevel.LIGHT);
    final ShortcutListener escapeShortcut = new ShortcutListener("Escape shortcut",
            ShortcutAction.KeyCode.ESCAPE, null) {
        @Override
        public void handleAction(Object sender, Object target) {
            callback.onOk();
            dialog.closeSelf();
        }
    };
    shortcutPanel.addShortcutListener(escapeShortcut);
    addOkHandler(dialog, okButton, overlayCloser, callback);
    dialog.addDialogCloseHandler(createCloseHandler(overlayCloser));
}

From source file:info.magnolia.ui.framework.overlay.OverlayPresenter.java

License:Open Source License

@Override
public void openConfirmation(MessageStyleType type, String title, View body, String confirmButton,
        String cancelButton, boolean cancelIsDefault, final ConfirmationCallback callback) {
    final ConfirmationDialog dialog = new ConfirmationDialog(body.asVaadinComponent(), confirmButton,
            cancelButton, cancelIsDefault);
    dialog.addStyleName(type.getCssClass());
    dialog.addStyleName("confirmation");

    dialog.setCaption(title);//from w  w w.j ava  2 s  .c  o m
    CompositeIcon icon = (CompositeIcon) Classes.getClassFactory().newInstance(type.getIconClass());
    icon.setStyleName("dialog-icon");
    dialog.setHeaderToolbar(icon);
    dialog.showCloseButton();

    dialog.setContent(body.asVaadinComponent());

    Panel shortcutPanel = new Panel();
    shortcutPanel.setStyleName("shortcut-panel");
    shortcutPanel.setHeight(100, Unit.PERCENTAGE);
    shortcutPanel.setWidth(100, Unit.PERCENTAGE);
    shortcutPanel.setContent(dialog);

    final OverlayCloser overlayCloser = openOverlay(new ViewAdapter(shortcutPanel), ModalityLevel.LIGHT);

    final ShortcutListener escapeShortcut = new ShortcutListener("Escape shortcut",
            ShortcutAction.KeyCode.ESCAPE, null) {
        @Override
        public void handleAction(Object sender, Object target) {
            callback.onCancel();
            dialog.closeSelf();
        }
    };
    shortcutPanel.addShortcutListener(escapeShortcut);
    dialog.addConfirmationHandler(new ConfirmationDialog.ConfirmationEvent.Handler() {
        @Override
        public void onConfirmation(ConfirmationEvent event) {
            if (event.isConfirmed()) {
                callback.onSuccess();
            } else {
                callback.onCancel();
            }
            overlayCloser.close();
        }
    });
    dialog.addDialogCloseHandler(createCloseHandler(overlayCloser));
}

From source file:info.magnolia.ui.framework.overlay.OverlayPresenter.java

License:Open Source License

/**
 * Opens a notification of given {@link MessageStyleType type}, with given body; it can close automatically after a timeout.
 *///w w  w .j a v  a  2 s .  co  m
@Override
public void openNotification(final MessageStyleType type, boolean doesTimeout, View viewToShow) {
    final Notification notification = new Notification(type);
    notification.setContent(viewToShow.asVaadinComponent());

    Panel shortcutPanel = new Panel();
    shortcutPanel.setStyleName("shortcut-panel");
    shortcutPanel.setWidth(null);
    shortcutPanel.setContent(notification.asVaadinComponent());
    final OverlayCloser closer = openOverlay(new ViewAdapter(shortcutPanel), ModalityLevel.NON_MODAL);

    final ShortcutListener escapeShortcut = new ShortcutListener("Escape shortcut",
            ShortcutAction.KeyCode.ESCAPE, null) {
        @Override
        public void handleAction(Object sender, Object target) {
            closer.close();
        }
    };
    shortcutPanel.addShortcutListener(escapeShortcut);

    notification.addCloseButtonListener(new ClickListener() {
        @Override
        public void buttonClick(ClickEvent clickEvent) {
            closer.close();
        }
    });

    notification.addNotificationBodyClickListener(new LayoutEvents.LayoutClickListener() {
        @Override
        public void layoutClick(LayoutEvents.LayoutClickEvent layoutClickEvent) {
            closer.setCloseTimeout(-1);
        }
    });

    if (doesTimeout) {
        closer.setCloseTimeout(TIMEOUT_SECONDS_DEFAULT);
    }

}