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:com.hack23.cia.web.impl.ui.application.views.user.document.pagemode.SearchDocumentPageModContentFactoryImpl.java

License:Apache License

@Secured({ "ROLE_ANONYMOUS", "ROLE_USER", "ROLE_ADMIN" })
@Override//from  w w w  .jav a2 s  . co m
public Layout createContent(final String parameters, final MenuBar menuBar, final Panel panel) {
    final VerticalLayout panelContent = createPanelContent();

    final String pageId = getPageId(parameters);

    getMenuItemFactory().createMainPageMenuBar(menuBar);

    final VerticalLayout searchLayout = new VerticalLayout();
    searchLayout.setSizeFull();
    panelContent.addComponent(searchLayout);

    final VerticalLayout searchresultLayout = new VerticalLayout();
    searchresultLayout.setSizeFull();

    final Panel formPanel = new Panel();
    formPanel.setSizeFull();

    searchresultLayout.addComponent(formPanel);

    final FormLayout formContent = new FormLayout();
    formPanel.setContent(formContent);

    panelContent.addComponent(searchresultLayout);

    final SearchDocumentRequest searchRequest = new SearchDocumentRequest();
    searchRequest.setSessionId(RequestContextHolder.currentRequestAttributes().getSessionId());
    searchRequest.setMaxResults(MAX_RESULT_SIZE);
    searchRequest.setSearchExpression("");
    final SearchDocumentResponseHandler handler = new SearchDocumentResponseHandler() {

        /** The Constant serialVersionUID. */
        private static final long serialVersionUID = 1L;

        @Override
        public void handle(final SearchDocumentResponse response) {
            searchresultLayout.removeAllComponents();

            final BeanItemContainer<DocumentElement> documentActivityDataDataDataSource = new BeanItemContainer<>(
                    DocumentElement.class, response.getResultElement());

            getGridFactory().createBasicBeanItemGrid(searchresultLayout, documentActivityDataDataDataSource,
                    "Document",
                    new String[] { "rm", "createdDate", "madePublicDate", "documentType", "subType", "title",
                            "subTitle", "status" },
                    new String[] { "label", "id", "hit", "relatedId", "org", "tempLabel", "numberValue",
                            "systemDate", "kallId", "documentFormat", "documentUrlText", "documentUrlHtml",
                            "documentStatusUrlXml", "committeeReportUrlXml" },
                    null, null, null);

        }
    };
    final ClickListener searchListener = new SearchDocumentClickListener(searchRequest, getApplicationManager(),
            handler);
    getFormFactory().addRequestInputFormFields(formContent, new BeanItem<>(searchRequest),
            SearchDocumentRequest.class, Arrays.asList(new String[] { "searchExpression" }), "Search",
            searchListener);

    getPageActionEventHelper().createPageEvent(ViewAction.VISIT_DOCUMENT_VIEW, ApplicationEventGroup.USER, NAME,
            parameters, pageId);

    return panelContent;

}

From source file:com.haulmont.cuba.web.log.LogWindow.java

License:Apache License

private void initUI() {
    ClientConfig clientConfig = AppBeans.<Configuration>get(Configuration.NAME).getConfig(ClientConfig.class);

    String closeShortcut = clientConfig.getCloseShortcut();
    KeyCombination closeCombination = KeyCombination.create(closeShortcut);

    com.vaadin.event.ShortcutAction closeShortcutAction = new com.vaadin.event.ShortcutAction(
            "closeShortcutAction", closeCombination.getKey().getCode(),
            KeyCombination.Modifier.codes(closeCombination.getModifiers()));

    addActionHandler(new com.vaadin.event.Action.Handler() {
        @Override/*w ww.j a va 2 s.co  m*/
        public com.vaadin.event.Action[] getActions(Object target, Object sender) {
            return new com.vaadin.event.Action[] { closeShortcutAction };
        }

        @Override
        public void handleAction(com.vaadin.event.Action action, Object sender, Object target) {
            if (Objects.equals(action, closeShortcutAction)) {
                close();
            }
        }
    });

    VerticalLayout layout = new VerticalLayout();
    layout.setSpacing(true);
    layout.setSizeFull();
    setContent(layout);

    Panel scrollablePanel = new Panel();
    scrollablePanel.setSizeFull();
    VerticalLayout scrollContent = new VerticalLayout();
    scrollContent.setSizeUndefined();
    scrollablePanel.setContent(scrollContent);

    final Label label = new Label();
    label.setContentMode(ContentMode.HTML);
    label.setValue(writeLog());
    label.setSizeUndefined();
    label.setStyleName("c-log-content");

    ((Layout) scrollablePanel.getContent()).addComponent(label);

    HorizontalLayout topLayout = new HorizontalLayout();
    topLayout.setWidth("100%");
    topLayout.setHeightUndefined();

    Messages messages = AppBeans.get(Messages.NAME);
    Button refreshBtn = new CubaButton(messages.getMessage(getClass(), "logWindow.refreshBtn"),
            (Button.ClickListener) event -> label.setValue(writeLog()));

    topLayout.addComponent(refreshBtn);

    layout.addComponent(topLayout);
    layout.addComponent(scrollablePanel);

    layout.setExpandRatio(scrollablePanel, 1.0f);
}

From source file:com.hris.connection.ErrorLoggedNotification.java

public static void showErrorLoggedOnWindow(String error, String className) {
    VerticalLayout v = new VerticalLayout();
    v.setSizeFull();//from  w w  w .  ja v a2s  .  co  m
    v.setMargin(true);

    Window sub = new Window("ERROR MESSAGE!", v);
    sub.setWidth("500px");
    if (sub.getParent() == null) {
        UI.getCurrent().addWindow(sub);
    }
    sub.setModal(true);

    Panel panel = new Panel();
    panel.setSizeFull();
    panel.setContent(new Label(error + " on \n" + className, ContentMode.HTML));
    panel.getContent().setHeightUndefined();

    sub.setContent(panel);
    sub.getContent().setHeightUndefined();
}

From source file:com.jiangyifen.ec2.ui.mgr.system.tabsheet.MgrPhone2PhoneSettingView.java

/**
 *  ????/*from  w  ww .java2  s .com*/
 * @param panelContent
 */
private void createCsrSelectTables(VerticalLayout panelContent) {
    csrSelectHLayout = new HorizontalLayout();
    csrSelectHLayout.setSpacing(true);
    csrSelectHLayout.setVisible(false);
    csrSelectHLayout.setWidth("100%");
    panelContent.addComponent(csrSelectHLayout);

    Label caption = new Label("");
    caption.setWidth("-1px");
    caption.setDescription("<B>??</B>");
    csrSelectHLayout.addComponent(caption);

    // ???
    HorizontalLayout panelLayout = new HorizontalLayout();
    panelLayout.setSpacing(true);
    panelLayout.setMargin(false, true, false, true);
    panelLayout.setWidth("100%");

    Panel tablePanel = new Panel();
    tablePanel.setContent(panelLayout);
    csrSelectHLayout.addComponent(tablePanel);
    csrSelectHLayout.setExpandRatio(tablePanel, 1.0f);

    // (??)
    VerticalLayout leftComponents = createLeftComponents();
    panelLayout.addComponent(leftComponents);
    panelLayout.setExpandRatio(leftComponents, 0.4f);

    // ??("?")
    VerticalLayout middleComponents = createMiddleComponents();
    panelLayout.addComponent(middleComponents);
    panelLayout.setComponentAlignment(middleComponents, Alignment.MIDDLE_CENTER);
    panelLayout.setExpandRatio(middleComponents, 0.2f);

    // ?(????)
    VerticalLayout rightComponents = createRightComponents();
    panelLayout.addComponent(rightComponents);
    panelLayout.setExpandRatio(rightComponents, 0.4f);
}

From source file:com.klwork.explorer.ui.content.email.EmailDetailPanel.java

License:Apache License

protected void addHtmlContent(String html) {
    Panel panel = new Panel();
    panel.setWidth(800, UNITS_PIXELS);/*from   w  w  w. ja  v a  2s  .c o  m*/
    panel.setHeight(300, UNITS_PIXELS);

    content = new Label(html, Label.CONTENT_XHTML);
    content.setHeight(100, UNITS_PERCENTAGE);

    panel.setContent(content);
    mainLayout.addComponent(panel);
}

From source file:com.klwork.explorer.ui.custom.DetailPanel.java

License:Apache License

public DetailPanel() {
    setSizeFull();/*from   ww  w. jav  a 2 s  . co  m*/
    addStyleName(ExplorerLayout.STYLE_DETAIL_PANEL);
    setMargin(true);

    CssLayout cssLayout = new CssLayout(); // Needed for rounded corners,
    cssLayout.addStyleName(ExplorerLayout.STYLE_DETAIL_PANEL);
    cssLayout.setSizeFull();
    super.addComponent(cssLayout);

    mainPanel = new Panel();
    mainPanel.addStyleName(Reindeer.PANEL_LIGHT);
    mainPanel.setSizeFull();
    cssLayout.addComponent(mainPanel);

    // Use default layout
    VerticalLayout verticalLayout = new VerticalLayout();
    verticalLayout.setWidth(100, Unit.PERCENTAGE);
    verticalLayout.setMargin(true);
    mainPanel.setContent(verticalLayout);
}

From source file:com.klwork.explorer.ui.custom.UploadComponent.java

License:Apache License

protected void addDropPanel() {
    Panel dropPanel = new Panel();
    dropPanel.setContent(new VerticalLayout());
    DragAndDropWrapper dragAndDropWrapper = new DragAndDropWrapper(dropPanel);
    //WW_TODO ?//from  w ww  . j  av a 2 s . c  o  m
    dragAndDropWrapper.setDropHandler(this);
    dragAndDropWrapper.setWidth("80%");
    addComponent(dragAndDropWrapper);
    setComponentAlignment(dragAndDropWrapper, Alignment.MIDDLE_CENTER);
    //
    Label dropLabel = new Label(i18nManager.getMessage(Messages.UPLOAD_DROP));
    dropLabel.setSizeUndefined();
    ((VerticalLayout) dropPanel.getContent()).addComponent(dropLabel);
    ((VerticalLayout) dropPanel.getContent()).setComponentAlignment(dropLabel, Alignment.MIDDLE_CENTER);
}

From source file:com.klwork.explorer.ui.task.ProcessInstanceEventsPanel.java

License:Apache License

public void initAddEventInput(HorizontalLayout hLayout) {
    Panel textFieldPanel = new Panel(); // Hack: actionHandlers can only be
    // attached to panels or windows
    textFieldPanel.addStyleName(Reindeer.PANEL_LIGHT);
    VerticalLayout textFieldPanelLayout = new VerticalLayout();
    textFieldPanel.setContent(textFieldPanelLayout);

    textFieldPanel.setWidth(100, Unit.PERCENTAGE);
    hLayout.addComponent(textFieldPanel);
    hLayout.setExpandRatio(textFieldPanel, 1.0f);

    commentInputField = new TextField();
    commentInputField.setWidth(100, Unit.PERCENTAGE);
    textFieldPanelLayout.addComponent(commentInputField);

    // Hack to catch keyboard 'enter'
    textFieldPanel.addActionHandler(new Handler() {
        public void handleAction(Action action, Object sender, Object target) {
            addNewComment(commentInputField.getValue().toString());
        }// ww  w .  ja  va  2 s.  c  o m

        public Action[] getActions(Object target, Object sender) {
            return new Action[] { new ShortcutAction("enter", ShortcutAction.KeyCode.ENTER, null) };
        }
    });
}

From source file:com.klwork.explorer.ui.task.SubTaskComponent.java

License:Apache License

protected void initAddSubTaskPanel(HorizontalLayout headerLayout) {
    // The add button is placed in a panel, so we can catch 'enter' and 'escape' events
    addSubTaskPanel = new Panel();
    addSubTaskPanel.setContent(new VerticalLayout());
    addSubTaskPanel.setSizeUndefined();/* w  ww.j  a va  2 s  . c  om*/
    addSubTaskPanel.addStyleName(Reindeer.PANEL_LIGHT);
    addSubTaskPanel.addStyleName("no-border");
    headerLayout.addComponent(addSubTaskPanel);
    //?
    initAddSubTaskPanelKeyboardActions();
    //WW_TODO subTask +
    initAddButton();
}

From source file:com.klwork.explorer.ui.task.TaskEventsPanel.java

License:Apache License

public void initAddEventInput(HorizontalLayout hLayout) {
    Panel textFieldPanel = new Panel(); // Hack: actionHandlers can only be attached to panels or windows
    textFieldPanel.addStyleName(Reindeer.PANEL_LIGHT);
    VerticalLayout textFieldPanelLayout = new VerticalLayout();
    textFieldPanel.setContent(textFieldPanelLayout);

    textFieldPanel.setWidth(100, Unit.PERCENTAGE);
    hLayout.addComponent(textFieldPanel);
    hLayout.setExpandRatio(textFieldPanel, 1.0f);

    commentInputField = new TextField();
    commentInputField.setWidth(100, Unit.PERCENTAGE);
    textFieldPanelLayout.addComponent(commentInputField);

    // Hack to catch keyboard 'enter'
    textFieldPanel.addActionHandler(new Handler() {
        public void handleAction(Action action, Object sender, Object target) {
            addNewComment(commentInputField.getValue().toString());
        }/*from  www .j av  a 2 s . c o m*/

        public Action[] getActions(Object target, Object sender) {
            return new Action[] { new ShortcutAction("enter", ShortcutAction.KeyCode.ENTER, null) };
        }
    });
}