Example usage for com.vaadin.ui Panel Panel

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

Introduction

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

Prototype

public Panel() 

Source Link

Document

Creates a new empty panel.

Usage

From source file:it.vige.greenarea.bpm.custom.ui.operatorelogistico.PerformanceMissioni.java

License:Apache License

private ChartComponent createChartComponent(String type) {
    ReportData report = new ReportData();
    // report.setTitle("Crediti di mobilit residui");
    List<Dataset> datasets = new ArrayList<Dataset>();
    report.setDatasets(datasets);//  w ww  . java 2 s . co m
    Dataset dataset = new Dataset();
    dataset.setDescription("Crediti di mobilit residui");
    dataset.setType(type);

    @SuppressWarnings("unchecked")
    Map<String, Number> elencoAccessi = (Map<String, Number>) historicVariableInstance.getValue();
    @SuppressWarnings("unchecked")
    final Map<String, List<Missione>> elencoMissioni = (Map<String, List<Missione>>) historicVariableInstancePerMissioni
            .getValue();
    filtraPerOperatoreLogistico(elencoAccessi, elencoMissioni);

    dataset.setData(elencoAccessi);
    datasets.add(dataset);

    byte[] reportData = null;
    try {
        reportData = report.toString().getBytes("UTF-8");
    } catch (UnsupportedEncodingException e) {
        logger.error("errore conversione json", e);
    }
    final Map<String, Number> finalElencoAccessi = elencoAccessi;
    ChartComponent chart = ChartGenerator.generateChart(reportData);
    chart.setWidth(100, UNITS_PERCENTAGE);
    chart.setHeight(100, UNITS_PERCENTAGE);
    chart.addListener(new LayoutClickListener() {

        private static final long serialVersionUID = 5416440288386886066L;

        @Override
        public void layoutClick(LayoutClickEvent event) {
            String data = individuaData(event, finalElencoAccessi);
            List<Missione> missioni = elencoMissioni.get(data);
            I18nManager i18nManager = get().getI18nManager();
            PopupWindow window = new PopupWindow(
                    i18nManager.getMessage(PERFORMANCE_MISSIONI_POPUP) + " " + data);
            VerticalLayout verticalLayout = new VerticalLayout();
            window.setContent(verticalLayout);
            Panel numeroTotaleMissioni = new Panel();
            numeroTotaleMissioni
                    .addComponent(new Label(i18nManager.getMessage(PERFORMANCE_MISSIONI_NUMERO_TOTALE_MISSIONI)
                            + " " + missioni.size()));
            verticalLayout.addComponent(numeroTotaleMissioni);
            Map<Color, Integer> totaleRanking = calcoloTotaleRanking(elencoMissioni, data);
            Panel numeroRossi = new Panel();
            int totaleRossi = totaleRanking.get(ROSSO);
            numeroRossi.addComponent(new Label(i18nManager.getMessage(PERFORMANCE_MISSIONI_NUMERO_ROSSI) + " "
                    + totaleRossi + " - " + (double) totaleRossi / missioni.size() * 100 + "%"));
            verticalLayout.addComponent(numeroRossi);
            Panel numeroVerdi = new Panel();
            int totaleVerdi = totaleRanking.get(VERDE);
            numeroVerdi.addComponent(new Label(i18nManager.getMessage(PERFORMANCE_MISSIONI_NUMERO_VERDI) + " "
                    + totaleVerdi + " - " + (double) totaleVerdi / missioni.size() * 100 + "%"));
            verticalLayout.addComponent(numeroVerdi);
            Panel numeroGialli = new Panel();
            int totaleGialli = totaleRanking.get(GIALLO);
            numeroGialli.addComponent(new Label(i18nManager.getMessage(PERFORMANCE_MISSIONI_NUMERO_GIALLI) + " "
                    + totaleGialli + " - " + (double) totaleGialli / missioni.size() * 100 + "%"));
            verticalLayout.addComponent(numeroGialli);
            Panel totaleCreditiConsumati = new Panel();
            totaleCreditiConsumati.addComponent(
                    new Label(i18nManager.getMessage(PERFORMANCE_MISSIONI_TOTALE_CREDITI_CONSUMATI) + " "
                            + calcoloTotaleCreditiConsumati(finalElencoAccessi, data)));
            verticalLayout.addComponent(totaleCreditiConsumati);
            Panel bonus = new Panel();
            bonus.addComponent(new Label(i18nManager.getMessage(PERFORMANCE_MISSIONI_BONUS) + " " + 0));
            verticalLayout.addComponent(bonus);
            verticalLayout.addStyleName("main-table");
            window.addListener(new SubmitEventListener() {
                private static final long serialVersionUID = 1L;

                @Override
                protected void submitted(SubmitEvent event) {

                }

                @Override
                protected void cancelled(SubmitEvent event) {
                }
            });
            window.setWidth(450, Sizeable.UNITS_PIXELS);
            window.setHeight(450, Sizeable.UNITS_PIXELS);
            window.setModal(true);
            window.center();
            get().getViewManager().showPopupWindow(window);
        }
    });
    return chart;
}

From source file:jcaster_vaadin.Gui2.java

License:Open Source License

@AutoGenerated
private Panel buildGeneralPanel() {
    // common part: create layout
    generalPanel = new Panel();
    generalPanel.setWidth("100.0%");
    generalPanel.setHeight("100.0%");
    generalPanel.setImmediate(false);/*w w  w  .j av a 2s  . com*/

    // verticalLayout_2
    verticalLayout_2 = buildVerticalLayout_2();
    generalPanel.setContent(verticalLayout_2);

    return generalPanel;
}

From source file:jcaster_vaadin.Gui2.java

License:Open Source License

@AutoGenerated
private Panel buildVideoPanel() {
    // common part: create layout
    videoPanel = new Panel();
    videoPanel.setWidth("100.0%");
    videoPanel.setHeight("100.0%");
    videoPanel.setImmediate(false);/*from w  w w .j  av a  2 s. c  o m*/

    // verticalLayout_3
    verticalLayout_3 = buildVerticalLayout_3();
    videoPanel.setContent(verticalLayout_3);

    return videoPanel;
}

From source file:jcaster_vaadin.Gui2.java

License:Open Source License

@AutoGenerated
private Panel buildAudioPanel() {
    // common part: create layout
    audioPanel = new Panel();
    audioPanel.setWidth("100.0%");
    audioPanel.setHeight("100.0%");
    audioPanel.setImmediate(false);//from  ww  w.  j a v  a2  s  .  c  o  m

    // verticalLayout_4
    verticalLayout_4 = buildVerticalLayout_4();
    audioPanel.setContent(verticalLayout_4);

    return audioPanel;
}

From source file:management.limbr.ui.VaadinUI.java

License:Open Source License

@Override
protected void init(VaadinRequest request) {

    final VerticalLayout root = new VerticalLayout();
    root.setSizeFull();/*from ww w .  j av a  2  s  . com*/
    root.setMargin(true);
    root.setSpacing(true);
    setContent(root);

    Image logo = new Image(null, new ExternalResource("images/logo1.png"));
    logo.setHeight(1.2f, Unit.EM);
    logo.setWidthUndefined();

    CssLayout navBar = new CssLayout();
    navBar.addStyleName(ValoTheme.LAYOUT_COMPONENT_GROUP);
    navBar.addComponent(logo);
    navBar.addComponent(createNavButton("Users", UsersViewImpl.VIEW_NAME));
    root.addComponent(navBar);

    final Panel viewContainer = new Panel();
    viewContainer.setSizeFull();
    root.addComponent(viewContainer);
    root.setExpandRatio(viewContainer, 1.0f);

    Navigator navigator = new Navigator(this, viewContainer);
    navigator.addProvider(viewProvider);

}

From source file:module.contents.presentationTier.component.PageView.java

License:Open Source License

@Override
public void attach() {
    super.attach();

    final Panel layout = new Panel();
    final SpacingHandler content = (SpacingHandler) layout.getContent();
    content.setSpacing(true);/*from   w  ww .  j av  a2s .  c o m*/
    final MarginHandler marginHandler = (MarginHandler) layout.getContent();
    marginHandler.setMargin(new MarginInfo(false));
    setCompositionRoot(layout);
    layout.setHeight(500, UNITS_PIXELS);
    layout.addStyleName(BennuTheme.PANEL_LIGHT);

    final Label title = new Label("<h2>" + page.getTitle().getContent() + "</h2>", Label.CONTENT_XHTML);
    title.setSizeFull();
    layout.addComponent(title);

    final PageIndex pageIndex = new PageIndex();
    layout.addComponent(pageIndex);

    final PageContent pageContent = new PageContent();
    layout.addComponent(pageContent);

    if (scrolledSection != null) {
        scrollIntoSection(scrolledSection.getExternalId());
    }
    /*
     * renderPageMenuArea(horizontalSplitPanel);
     * renderPageContent(horizontalSplitPanel);
     */
}

From source file:module.pandabox.presentation.PandaBox.java

License:Open Source License

private Component getBennuInterface() {
    GridSystemLayout gsl = new GridSystemLayout();
    gsl.setMargin(false);/*w ww.  j  av  a  2  s.  c  o  m*/

    Label lblBigTitle = new Label("A Big Title (H1)", Label.CONTENT_TEXT);
    lblBigTitle.setStyleName(BennuTheme.LABEL_H1);

    Label lblBigText = new Label(LOREM_TEXT_LARGE, Label.CONTENT_TEXT);

    gsl.setCell("big_title", 16, lblBigTitle);
    gsl.setCell("big_text", 16, lblBigText);

    Label lblOneLink = new Label(
            "<a href='http://www.google.com'>Label Link : One link a day keeps the doctor away</a>",
            Label.CONTENT_XHTML);
    gsl.setCell("label_one_link", 16, lblOneLink);

    Button btOneLink = new Button("Button Link: One link a day keeps the doctor away", new ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            event.getButton().getWindow().showNotification("You just clicked a button link!");
        }
    });

    btOneLink.setStyleName(BaseTheme.BUTTON_LINK);
    gsl.setCell("button_one_link", 16, btOneLink);

    Label lblTitleH2 = new Label("A Not So Big Title (H2)", Label.CONTENT_TEXT);
    lblTitleH2.setStyleName(BennuTheme.LABEL_H2);
    gsl.setCell("not_so_big_title", 16, lblTitleH2);

    Label lblSmallText = new Label(LOREM_TEXT_SMALL, Label.CONTENT_TEXT);
    gsl.setCell("small_text", 16, lblSmallText);

    Table table = new Table();
    table.setSizeFull();
    table.setPageLength(0);
    table.addContainerProperty("Name", String.class, "");
    table.addContainerProperty("Age", Integer.class, "");
    table.addContainerProperty("Nickname", String.class, "");

    table.addItem(new Object[] { "Giacomo Guilizzoni", 34, "Peidi" }, 1);
    table.addItem(new Object[] { "Giodp Jack Guilizzoni", 4, "The Guids" }, 2);
    table.addItem(new Object[] { "Marco Botton", 31, "" }, 3);
    table.addItem(new Object[] { "Mariah Maciachlan", 35, "Patata" }, 4);
    table.addItem(new Object[] { "Valerie Libery WOW! Division", 23, "Val" }, 5);
    table.addItem(new Object[] { "Guido Master lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum", 99,
            "Booya Master" }, 6);

    gsl.setCell("table", 16, table);

    Label lblTitleH3 = new Label("A Getting Smaller Title (H3)", Label.CONTENT_TEXT);
    lblTitleH3.setStyleName(BennuTheme.LABEL_H3);
    gsl.setCell("getting_smaller_title", 16, lblTitleH3);

    Panel panelLeft = new Panel();
    panelLeft.setScrollable(true);
    panelLeft.setSizeFull();
    panelLeft.setHeight("145px");
    panelLeft.addComponent(new Label(LOREM_TEXT_ALL));

    Panel panelRight = new Panel();
    panelRight.addComponent(new Label(LOREM_TEXT_LARGE));

    gsl.setCell("panel_left", 8, panelLeft);
    gsl.setCell("panel_right", 8, panelRight);

    Label lblTitleH4 = new Label("A Smaller Title (H4)", Label.CONTENT_TEXT);
    lblTitleH4.setStyleName(BennuTheme.LABEL_H4);
    gsl.setCell("smaller_title", 16, lblTitleH4);

    Label lblTextb4Form = new Label(LOREM_TEXT_SMALL, Label.CONTENT_TEXT);
    gsl.setCell("txtB4Form", 0, 8, 8, lblTextb4Form);

    Form form = new Form();
    form.setSizeFull();
    form.addField("form_label", new TextField("Form Label"));
    form.addField("large_form_label", new DateField("Large Form Label"));
    form.addField("much_larger_form_label", new Select("Much Larger Form Label"));
    form.addField("something_diff", new TextArea("And now for something completely different"));

    final OptionGroup checkboxes = new OptionGroup("Checkboxes fun");
    checkboxes.setMultiSelect(true);
    checkboxes.addItem("not selected");
    checkboxes.addItem("selected");
    checkboxes.select("selected");
    checkboxes.addItem("disabled");
    checkboxes.setItemEnabled("disabled", false);
    checkboxes.addItem("disabled selected");
    checkboxes.select("disabled selected");
    checkboxes.setItemEnabled("disabled selected", false);

    form.addField("checkboxes", checkboxes);

    final OptionGroup radiobuttons = new OptionGroup("Radio on/off");
    radiobuttons.addItem("option 1(selected)");
    radiobuttons.select("option 1(selected)");
    radiobuttons.addItem("option 2");
    radiobuttons.addItem("option 3 (disabled)");
    radiobuttons.setItemEnabled("option 3 (disabled)", false);

    radiobuttons.addItem("option 4 (disabled and selected)");
    radiobuttons.select("option 4 (disabled and selected)");
    radiobuttons.setItemEnabled("option 4 (disabled and selected)", false);

    form.addField("radiobuttons", radiobuttons);

    form.getFooter().addComponent(new Button("Submit the info"));
    form.getFooter().addComponent(new Button("Cancel the info"));

    final Panel rightFormPanel = new Panel();
    rightFormPanel.setScrollable(true);
    rightFormPanel.setSizeFull();
    rightFormPanel.setHeight("400px");
    rightFormPanel.addComponent(new Label(LOREM_TEXT_ALL, Label.CONTENT_TEXT));

    gsl.setCell("form", 12, form);
    gsl.setCell("rightFormPanel", 4, rightFormPanel);

    return gsl;
}

From source file:net.sf.gazpachoquest.questionnaires.views.QuestionnaireView.java

License:Open Source License

@Override
public void enter(ViewChangeEvent event) {
    logger.debug("Entering {} view ", QuestionnaireView.NAME);
    addStyleName(Reindeer.LAYOUT_BLUE);//  w ww  .j a v  a 2s.  c  om
    addStyleName("questionnaires");

    WebBrowser webBrowser = Page.getCurrent().getWebBrowser();
    Integer screenWidth = webBrowser.getScreenWidth();
    Integer heightWidth = webBrowser.getScreenHeight();

    logger.debug("Browser screen settings  {} x {}", screenWidth, heightWidth);

    if (heightWidth <= 480) {
        renderingMode = RenderingMode.QUESTION_BY_QUESTION;
    }

    // centralLayout.addStyleName("questionnaires");
    // new Responsive(centralLayout);

    RespondentAccount respondent = (RespondentAccount) VaadinServletService.getCurrentServletRequest()
            .getUserPrincipal();
    if (respondent.hasPreferredLanguage()) {
        preferredLanguage = Language.fromString(respondent.getPreferredLanguage());
    } else {
        preferredLanguage = Language.fromLocale(webBrowser.getLocale());
    }
    questionnaireId = respondent.getGrantedquestionnaireIds().iterator().next();
    logger.debug("Trying to fetch questionnair identified with id  = {} ", questionnaireId);
    QuestionnaireDefinitionDTO definition = questionnaireResource.getDefinition(questionnaireId);
    sectionInfoVisible = definition.isSectionInfoVisible();
    QuestionnairePageDTO page = questionnaireResource.getPage(questionnaireId, renderingMode, preferredLanguage,
            NavigationAction.ENTERING);

    logger.debug("Displaying page {}/{} with {} questions", page.getMetadata().getNumber(),
            page.getMetadata().getCount(), page.getQuestions().size());
    questionsLayout = new VerticalLayout();
    update(page);

    Label questionnaireTitle = new Label(definition.getLanguageSettings().getTitle());
    questionnaireTitle.addStyleName(Reindeer.LABEL_H1);

    VerticalLayout mainLayout = new VerticalLayout();
    mainLayout.setSizeFull();
    mainLayout.setMargin(true);
    mainLayout.addComponent(questionnaireTitle);
    mainLayout.addComponent(questionsLayout);
    // Add the responsive capabilities to the components

    Panel centralLayout = new Panel();
    centralLayout.setContent(mainLayout);
    centralLayout.setSizeFull();
    centralLayout.getContent().setSizeUndefined();

    Responsive.makeResponsive(questionnaireTitle);
    setCompositionRoot(centralLayout);
    setSizeFull();
}

From source file:net.sourceforge.javydreamercsw.validation.manager.web.component.DataEntryComponent.java

License:Apache License

@Override
protected Component initContent() {
    Panel p = new Panel();
    FormLayout layout = new FormLayout();
    p.setContent(layout);//from  w ww .  j  av a  2 s .  co m
    getInternalValue().forEach(de -> {
        BeanFieldGroup binder = new BeanFieldGroup(de.getClass());
        binder.setItemDataSource(de);
        TextField name = new TextField(TRANSLATOR.translate("general.name"));
        binder.bind(name, "entryName");
        name.setConverter(new TranslationConverter());
        layout.addComponent(name);
        TextField type = new TextField(TRANSLATOR.translate("general.type"));
        type.setConverter(new Converter<String, DataEntryType>() {

            @Override
            public DataEntryType convertToModel(String value, Class<? extends DataEntryType> targetType,
                    Locale locale) throws Converter.ConversionException {
                for (DataEntryType det : DataEntryTypeServer.getTypes()) {
                    if (TRANSLATOR.translate(det.getTypeName()).equals(value)) {
                        return det;
                    }
                }
                return null;
            }

            @Override
            public String convertToPresentation(DataEntryType value, Class<? extends String> targetType,
                    Locale locale) throws Converter.ConversionException {
                return TRANSLATOR.translate(value.getTypeName());
            }

            @Override
            public Class<DataEntryType> getModelType() {
                return DataEntryType.class;
            }

            @Override
            public Class<String> getPresentationType() {
                return String.class;
            }
        });
        DataEntryPropertyComponent properties = new DataEntryPropertyComponent(edit);
        binder.bind(type, "dataEntryType");
        layout.addComponent(type);
        binder.bind(properties, "dataEntryPropertyList");
        layout.addComponent(properties);
        binder.setReadOnly(!edit);
        type.setReadOnly(true);
    });
    return p;
}

From source file:net.sourceforge.javydreamercsw.validation.manager.web.component.DataEntryPropertyComponent.java

License:Apache License

@Override
protected Component initContent() {
    Panel p = new Panel();
    FormLayout l = new FormLayout();
    getInternalValue().forEach(prop -> {
        if (!prop.getPropertyName().equals("property.expected.result")) {
            HorizontalLayout hl = new HorizontalLayout();
            TextField tf = new TextField(TRANSLATOR.translate(prop.getPropertyName()), prop.getPropertyValue());
            hl.addComponent(tf);//from  w ww.j  ava 2  s.  co  m
            if (edit) {
                //Add button for deleting this property.
                Button delete = new Button();
                delete.setIcon(VaadinIcons.MINUS);
                delete.addClickListener(listener -> {
                    getInternalValue().remove(prop);
                    l.removeComponent(hl);
                });
                hl.addComponent(delete);
            }
            l.addComponent(hl);
        }
    });
    p.setContent(l);
    return p;
}