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.mic.springvaadin.ui.AspectJManagedUI.java

License:Apache License

@Override
protected void init(VaadinRequest vaadinRequest) {
    VerticalLayout layout = new VerticalLayout();
    layout.setSizeFull();// w  w  w  .  j  a v a 2 s  .  c  om
    layout.setSpacing(true);
    layout.setMargin(true);

    defaultLabel = new Label("Default View 1");
    defaultLabel.setImmediate(true);
    layout.addComponent(defaultLabel);

    viewContainer = new Panel();
    viewContainer.setSizeFull();
    layout.addComponent(viewContainer);
    layout.setExpandRatio(viewContainer, 1f);

    setContent(layout);

    Navigator navigator = new Navigator(this, viewContainer);
    navigator.addView("default", new DefaultView());
    navigator.addView("default2", new DefaultView2());
    if (navigator.getState().isEmpty()) {
        navigator.navigateTo("default");
    }
}

From source file:com.morevaadin.vaadin7.navigation.NavigationRoot.java

License:Apache License

@Override
protected void init(WrappedRequest request) {

    VerticalLayout layout = new VerticalLayout();

    MenuBar bar = new MenuBar();

    layout.addComponent(bar);// w ww . ja v a2  s .  com

    Panel panel = new Panel() {

        {
            addComponent(new Label("Default"));
        }
    };

    layout.addComponent(panel);

    setContent(layout);

    final Navigator navigator = new Navigator(panel);

    for (final String view : VIEWS) {

        bar.addItem(view, new Command() {

            @Override
            public void menuSelected(MenuItem selectedItem) {

                navigator.navigateTo(view);
            }
        });

        navigator.addView(view, new ViewLayout(view));
    }
}

From source file:com.naoset.framework.frontend.component.profile.CustomerEditWindowView.java

@Override
protected Component buildContent() {
    addMenuItems(new MenuBar().new MenuItem("", FontAwesome.EDIT, edit()));
    return new Panel();

}

From source file:com.naoset.framework.frontend.view.window.DialogWindow.java

private Panel buildBodyWrapper() {
    Panel bodyWrapper = new Panel();
    bodyWrapper.setSizeFull();//  ww w. j av  a 2  s .c  o  m
    bodyWrapper.addStyleName(ValoTheme.PANEL_BORDERLESS);
    bodyWrapper.addStyleName("scroll-divider");
    return bodyWrapper;
}

From source file:com.ocs.dynamo.showcase.DefaultUI.java

License:Apache License

/**
 * Main method - sets up the application
 *//*from   w w  w. j  av  a2s .  c  o  m*/
@Override
protected void init(VaadinRequest request) {

    // Create the content root layout for the UI
    VerticalLayout content = new VerticalLayout();
    setContent(content);

    // navigator part
    VerticalLayout viewLayout = new VerticalLayout();
    viewPanel = new Panel();
    viewPanel.setImmediate(Boolean.TRUE);
    viewPanel.setContent(viewLayout);

    // create a state manager and set its default view
    // this is done to circumvent a bug with the view being created twice if
    // navigator.navigateTo is called directly
    Navigator.UriFragmentManager stateManager = new com.vaadin.navigator.Navigator.UriFragmentManager(
            this.getPage());
    stateManager.setState(Views.MOVIES_VIEW);

    // create the navigator
    navigator = new Navigator(this, stateManager, new Navigator.SingleComponentContainerViewDisplay(viewPanel));
    UI.getCurrent().setNavigator(navigator);
    navigator.addProvider(viewProvider);
    navigator.setErrorView(new ErrorView());

    menu = menuService.constructMenu("movies.menu", navigator);
    content.addComponent(menu);

    // Display the greeting
    content.addComponent(viewPanel);
}

From source file:com.ocs.dynamo.ui.component.ErrorView.java

License:Apache License

@Override
public void build() {
    VerticalLayout main = new DefaultVerticalLayout(true, true);

    Panel panel = new Panel();
    panel.setCaption(message("ocs.error.occurred"));
    main.addComponent(panel);//  ww w  .j  a  v a  2s  . c o m

    VerticalLayout inside = new DefaultVerticalLayout(true, true);
    panel.setContent(inside);

    Label errorLabel = new Label(message("ocs.view.unknown"));
    inside.addComponent(errorLabel);

    setCompositionRoot(main);
}

From source file:com.ocs.dynamo.ui.composite.dialog.BaseModalDialog.java

License:Apache License

private void constructLayout() {
    this.setModal(true);
    this.setResizable(false);

    Panel panel = new Panel();
    panel.setCaptionAsHtml(true);// ww w .ja v  a  2 s . c om
    panel.setCaption(getTitle());

    this.setContent(panel);

    VerticalLayout main = new DefaultVerticalLayout();
    main.setStyleName("ocsDialog");
    panel.setContent(main);

    doBuild(main);

    DefaultHorizontalLayout buttonBar = new DefaultHorizontalLayout();
    main.addComponent(buttonBar);

    doBuildButtonBar(buttonBar);
}

From source file:com.ocs.dynamo.ui.composite.form.AbstractModelBasedSearchForm.java

License:Apache License

@Override
public void build() {
    VerticalLayout main = new DefaultVerticalLayout(false, true);

    // add a wrapper for adding an action handler
    wrapperPanel = new Panel();
    main.addComponent(wrapperPanel);//from  www. ja v a 2s.  co  m

    // create the search form
    filterLayout = constructFilterLayout();
    wrapperPanel.setContent(filterLayout);

    // action handler for carrying out a search after an Enter press
    wrapperPanel.addActionHandler(new Handler() {

        private static final long serialVersionUID = -2136828212405809213L;

        private Action enter = new ShortcutAction(null, ShortcutAction.KeyCode.ENTER, null);

        @Override
        public Action[] getActions(Object target, Object sender) {
            return new Action[] { enter };
        }

        @Override
        public void handleAction(Action action, Object sender, Object target) {
            if (action == enter) {
                search();
            }
        }
    });

    // create the button bar
    HorizontalLayout buttonBar = new DefaultHorizontalLayout();
    main.addComponent(buttonBar);

    constructButtonBar(buttonBar);

    // add custom buttons
    postProcessButtonBar(buttonBar);

    // add any custom functionality
    postProcessLayout();

    // initial search
    // search();

    setCompositionRoot(main);
}

From source file:com.ocs.dynamo.ui.composite.form.ModelBasedEditForm.java

License:Apache License

/**
 * Construct the layout (form and panel) for an attribute group
 * //from   w ww  .ja va2s  . c o m
 * @param parent
 *            the parent component
 * @param tabs
 *            whether to include the component in a tab sheet
 * @param tabSheet
 *            the parent tab sheet (only used if the "tabs" parameter is true)
 * @param caption
 *            caption of the panel or tab sheet
 * @param lowest
 *            indicates whether this is the lowest level
 * @return
 */
private Layout constructAttributeGroupLayout(Layout parent, boolean tabs, TabSheet tabSheet, String caption,
        boolean lowest) {
    Layout innerLayout = null;
    if (lowest) {
        innerLayout = new FormLayout();
        ((FormLayout) innerLayout).setMargin(true);
        if (!tabs) {
            ((FormLayout) innerLayout).setStyleName(DynamoConstants.CSS_CLASS_HALFSCREEN);
        }
    } else {
        innerLayout = new DefaultVerticalLayout(true, true);
    }

    if (tabs) {
        tabSheet.addTab(innerLayout, caption);
    } else {
        Panel panel = new Panel();
        panel.setStyleName("attributePanel");
        panel.setCaption(caption);
        panel.setContent(innerLayout);
        parent.addComponent(panel);
    }
    return innerLayout;
}

From source file:com.ocs.dynamo.ui.composite.layout.BaseSplitLayout.java

License:Apache License

/**
 * Builds the component//from w  w  w .ja  v a  2 s.c o  m
 */
@Override
public void build() {
    mainLayout = new DefaultVerticalLayout(true, true);

    HorizontalSplitPanel splitter = null;
    VerticalLayout splitterLayout = null;

    detailLayout = new DefaultVerticalLayout();
    emptyDetailView();

    // optional header
    headerLayout = constructHeaderLayout();
    if (headerLayout != null) {
        mainLayout.addComponent(headerLayout);
    }

    // construct option quick search field
    quickSearchField = constructSearchField();

    // additional quick search field
    if (!isHorizontalMode()) {
        if (quickSearchField != null) {
            mainLayout.addComponent(quickSearchField);
        }
    }

    // table init
    getTableWrapper().getTable().setPageLength(getPageLength());
    getTableWrapper().getTable().setSortEnabled(isSortEnabled());
    constructTableDividers();

    // extra splitter (for horizontal mode)
    if (isHorizontalMode()) {
        splitter = new HorizontalSplitPanel();
        mainLayout.addComponent(splitter);

        splitterLayout = new DefaultVerticalLayout(false, true);
        if (quickSearchField != null) {
            splitterLayout.addComponent(quickSearchField);
        }

        splitterLayout.addComponent(getTableWrapper());
        splitter.setFirstComponent(splitterLayout);
    } else {
        mainLayout.addComponent(getTableWrapper());
    }

    if (isHorizontalMode()) {
        splitterLayout.addComponent(getButtonBar());
    } else {
        mainLayout.addComponent(getButtonBar());
    }

    // create a panel to hold the edit form
    Panel editPanel = new Panel();
    editPanel.setContent(detailLayout);

    if (isHorizontalMode()) {
        // create the layout that is the right part of the splitter
        VerticalLayout extra = new DefaultVerticalLayout(true, false);
        extra.addComponent(editPanel);
        splitter.setSecondComponent(extra);
    } else {
        mainLayout.addComponent(editPanel);
    }

    addButton = constructAddButton();
    if (addButton != null) {
        getButtonBar().addComponent(addButton);
    }

    removeButton = constructRemoveButton();
    if (removeButton != null) {
        registerButton(removeButton);
        getButtonBar().addComponent(removeButton);
    }

    // allow the user to define extra buttons
    postProcessButtonBar(getButtonBar());

    postProcessLayout(mainLayout);

    checkButtonState(null);
    setCompositionRoot(mainLayout);
}