Example usage for com.vaadin.ui Panel getContent

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

Introduction

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

Prototype

@Override
    public Component getContent() 

Source Link

Usage

From source file:de.catma.ui.repository.SourceDocumentPanel.java

License:Open Source License

private Component createContentInfoForm() {

    Panel contentInfoPanel = new Panel();
    contentInfoPanel.getContent().setSizeUndefined();
    contentInfoPanel.getContent().setWidth("100%");
    contentInfoPanel.setSizeFull();//from   w w  w.  j a  va 2  s. c om

    contentInfoForm = new Form();
    contentInfoForm.setSizeFull();
    contentInfoForm.setCaption("Information");
    contentInfoForm.setWriteThrough(false);
    contentInfoForm.setReadOnly(true);
    contentInfoForm.setEnabled(false);

    BeanItem<ContentInfoSet> contentInfoItem = new BeanItem<ContentInfoSet>(emptyContentInfoSet);
    contentInfoForm.setItemDataSource(contentInfoItem);
    contentInfoForm.setVisibleItemProperties(new String[] { "title", "author", "description", "publisher" });

    contentInfoForm.setReadOnly(true);
    contentInfoPanel.addComponent(contentInfoForm);

    return contentInfoPanel;
}

From source file:de.catma.ui.repository.TagLibraryPanel.java

License:Open Source License

private Component createTagLibraryTreePanel() {

    Panel tagLibraryPanel = new Panel();
    tagLibraryPanel.getContent().setSizeUndefined();
    tagLibraryPanel.setSizeFull();/*from  w ww  .j av  a2 s  .  c om*/

    tagLibraryContainer = new HierarchicalContainer();

    tagLibrariesTree = new Tree();
    tagLibrariesTree.setContainerDataSource(tagLibraryContainer);

    tagLibrariesTree.setCaption("Tag Libraries");
    tagLibrariesTree.addStyleName("bold-label-caption");
    tagLibrariesTree.setImmediate(true);
    tagLibrariesTree.setItemCaptionMode(Tree.ITEM_CAPTION_MODE_ID);

    tagLibraryContainer.addContainerProperty(SORTCAP_PROP, String.class, null);

    for (TagLibraryReference tlr : repository.getTagLibraryReferences()) {
        addTagLibraryReferenceToTree(tlr);
    }
    tagLibraryContainer.sort(new Object[] { SORTCAP_PROP }, new boolean[] { true });

    tagLibraryPanel.addComponent(tagLibrariesTree);

    return tagLibraryPanel;
}

From source file:edu.nps.moves.mmowgli.modules.actionplans.ActionPlanPageTabImages.java

License:Open Source License

private void setUpIndexListener(Panel p) {
    ((AbstractLayout) p.getContent()).addComponentAttachListener(new IndexListener());
}

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);//from  w ww . j a  v  a2  s . com
    VerticalLayout v = (VerticalLayout) p.getContent();
    v.setHeight("100%");
    v.addComponent(getDropPanel());
    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);// w  w w .  j  av a  2  s.  c o  m
    //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);/*  w w  w  .  jav  a 2s.  c om*/
    VerticalLayout v = (VerticalLayout) p.getContent();
    v.setSpacing(true);
    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);/*from   ww w  .j  av a  2  s .  c  om*/
    VerticalLayout v = (VerticalLayout) p.getContent();
    v.setSpacing(true);
    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.ds4p.ds4pmobileportal.ui.LoginView.java

License:Open Source License

private Panel getLoginPanel() {
    Panel p = new Panel();
    VerticalLayout v = (VerticalLayout) p.getContent();
    v.setSpacing(true);/*  ww  w .  java 2s  .  c  o  m*/
    v.setHeight("300px");
    Label sandi = new Label("");
    sandi.setIcon(new ThemeResource("onc_s_and_i_logo.png"));
    v.addComponent(sandi);

    final TextField username = new TextField("User Name:");
    final PasswordField userpass = new PasswordField("Password:");
    username.setWidth("500px");
    userpass.setWidth("500px");
    v.addComponent(username);
    v.addComponent(userpass);

    HorizontalLayout h = new HorizontalLayout();
    h.setSpacing(true);
    h.setWidth("500px");
    Button okBTN = new Button("Ok");
    Label l = new Label("");
    l.setIcon(new ThemeResource("header-logo.png"));
    h.addComponent(okBTN);
    h.addComponent(l);
    v.addComponent(h);
    okBTN.addListener(new Button.ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            userN = (String) username.getValue();
            userP = (String) userpass.getValue();
            authenticate();
            if (userProfile == null) {
                getWindow().showNotification("Login Error", "Incorrect username or password combination.",
                        Window.Notification.TYPE_WARNING_MESSAGE);
            } else {
                AdminContext.getSessionAttributes().setUserProfile(userProfile);
                ((MyVaadinApplication) getApplication()).loginComplete();
            }
        }
    });

    okBTN.setImmediate(true);

    return p;
}

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 w  w .  jav a2 s. 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: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 2 s. com*/
    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();
}