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.cms.utils.CommonUtils.java

public static Panel addOg2Panel(OptionGroup og, String caption, String height) {
    og.setWidth("100%");
    og.setHeight("-1px");
    og.setImmediate(true);//from w w w .  j a va2s  . co m
    og.setMultiSelect(true);
    VerticalLayout layout = new VerticalLayout();
    layout.setWidth("100%");
    layout.setHeightUndefined();
    layout.setImmediate(true);
    layout.setMargin(true);
    layout.setSpacing(true);
    layout.addComponent(og);
    layout.setComponentAlignment(og, Alignment.MIDDLE_LEFT);
    Panel panel = new Panel();
    if (!DataUtil.isStringNullOrEmpty(caption)) {
        panel.setCaption(caption);
    }
    panel.setWidth("100%");
    panel.setImmediate(true);
    if (!DataUtil.isStringNullOrEmpty(height)) {
        panel.setHeight(height);
    } else {
        panel.setHeight("200px");
    }
    panel.addStyleName(Runo.PANEL_LIGHT);
    panel.setContent(layout);
    return panel;
}

From source file:com.compomics.jtraml.web.TramlConverterApplication.java

License:Apache License

/**
 * Initiate the main layout./*www  .j  a  v  a  2 s  . co  m*/
 */
private void initLayout() {
    window.addComponent(new HeaderPanel(this));

    iInputForm = new ConversionForm(this);

    iOutputTable = new ResultsPanel(this);

    iSeparatorPanel = new Panel();
    iSeparatorPanel.setStyleName("v-split-line");

    if (iOutputTable.getNumberOfResults() == 0) {
        iOutputTable.setVisible(false);
        iSeparatorPanel.setVisible(false);
    }

    GridLayout grid = new GridLayout(3, 1);

    grid.addComponent(iInputForm, 0, 0);
    grid.addComponent(iSeparatorPanel, 1, 0);
    grid.addComponent(iOutputTable, 2, 0);

    window.addComponent(grid);
    window.addComponent(new FooterPanel(this));
}

From source file:com.compomics.sigpep.webapp.MyVaadinApplication.java

License:Apache License

@Override
public void init() {
    iApplication = this;
    iSigPepSessionFactory = ApplicationLocator.getInstance().getApplication().getSigPepSessionFactory();

    //add theme//w w w .j a v a 2 s.c  om
    setTheme("sigpep");

    //add main window
    Window lMainwindow = new Window("Sigpep Application");
    setMainWindow(lMainwindow);
    lMainwindow.addStyleName("v-app-my");

    //add notification component
    iNotifique = new Notifique(Boolean.FALSE);
    CustomOverlay lCustomOverlay = new CustomOverlay(iNotifique, getMainWindow());
    getMainWindow().addComponent(lCustomOverlay);

    //add form help
    iFormHelp = new FormHelp();
    iFormHelp.setFollowFocus(Boolean.TRUE);
    this.getMainWindow().getContent().addComponent(iFormHelp);

    //add panels
    iCenterLeft = new Panel();
    iCenterLeft.addStyleName(Reindeer.PANEL_LIGHT);
    iCenterLeft.setHeight("400px");
    iCenterLeft.setWidth("100%");

    iCenterRight = new Panel();
    iCenterRight.addStyleName(Reindeer.PANEL_LIGHT);
    iCenterRight.setHeight("400px");
    iCenterRight.setWidth("75%");

    //add form tabs
    iFormTabSheet = new FormTabSheet(this);
    iCenterLeft.addComponent(iFormTabSheet);

    iBottomLayoutResults = new VerticalLayout();

    if (PropertiesConfigurationHolder.showTestDemoFolder()) {
        Button lButton = new Button("load test data");
        lButton.addListener(new Button.ClickListener() {
            public void buttonClick(Button.ClickEvent event) {
                new BackgroundThread().run();
            }
        });
        iBottomLayoutResults.addComponent(lButton);
    }

    // Add the selector component
    iSelectionComponent = new TransitionSelectionComponent(MyVaadinApplication.this);
    iCenterRight.addComponent(iSelectionComponent);

    iHeaderLayout = new HorizontalLayout();
    iHeaderLayout.setSizeFull();
    iHeaderLayout.setHeight("100px");
    iHeaderLayout.addStyleName("v-header");

    VerticalLayout lVerticalLayout = new VerticalLayout();

    GridLayout lGridLayout = new GridLayout(2, 1);
    lGridLayout.setSpacing(true);
    lGridLayout.setSizeFull();

    lGridLayout.addComponent(iCenterLeft, 0, 0);
    lGridLayout.setComponentAlignment(iCenterLeft, Alignment.TOP_LEFT);

    lGridLayout.addComponent(iCenterRight, 1, 0);
    lGridLayout.setComponentAlignment(iCenterRight, Alignment.TOP_CENTER);

    lVerticalLayout.addComponent(iHeaderLayout);
    lVerticalLayout.addComponent(lGridLayout);
    lVerticalLayout.addComponent(iBottomLayoutResults);

    lVerticalLayout.setComponentAlignment(iHeaderLayout, Alignment.MIDDLE_CENTER);
    lVerticalLayout.setComponentAlignment(lGridLayout, Alignment.MIDDLE_CENTER);
    lVerticalLayout.setComponentAlignment(iBottomLayoutResults, Alignment.MIDDLE_CENTER);

    lMainwindow.addComponent(lVerticalLayout);
    lMainwindow.addComponent(pusher);

    // Create a tracker for vaadin.com domain.
    String lDomainName = PropertiesConfigurationHolder.getInstance().getString("analytics.domain");
    String lPageId = PropertiesConfigurationHolder.getInstance().getString("analytics.page");

    GoogleAnalyticsTracker tracker = new GoogleAnalyticsTracker("UA-26252212-1", lDomainName);
    lMainwindow.addComponent(tracker);
    tracker.trackPageview(lPageId);

    /**
     * Sets an UncaughtExceptionHandler and executes the thread by the ExecutorsService
     */
    Thread.setDefaultUncaughtExceptionHandler(new MyUncaughtExceptionHandler());

    parseSessionId();
}

From source file:com.constellio.app.ui.pages.base.MainLayoutImpl.java

public MainLayoutImpl(AppLayerFactory appLayerFactory) {
    this.presenter = new MainLayoutPresenter(this);

    mainMenuContentFooterLayout = new HorizontalLayout();
    mainMenuContentFooterLayout.setSizeFull();
    mainMenuContentFooterLayout.addStyleName("main-menu-content-footer");

    contentViewWrapper = new Panel();

    Navigator navigator = new Navigator(UI.getCurrent(), contentViewWrapper);
    NavigatorConfigurationService navigatorConfigurationService = appLayerFactory
            .getNavigatorConfigurationService();
    navigatorConfigurationService.configure(navigator);
    UI.getCurrent().setNavigator(navigator);

    contentFooterWrapperLayout = new CssLayout();
    contentFooterWrapperLayout.setId("content-footer-wrapper");

    contentFooterLayout = new VerticalLayout();
    contentFooterLayout.addStyleName("content-footer");

    header = buildHeader();/*from   w ww. j av  a2s . co m*/
    header.setSizeUndefined();

    mainMenu = buildMainMenu();

    userDocumentsWindow = new UserDocumentsWindow();
    dragAndDropWrapper = new DragAndDropWrapper(mainMenuContentFooterLayout);
    dragAndDropWrapper.setSizeFull();
    dragAndDropWrapper.setDropHandler(userDocumentsWindow);
    navigator.addViewChangeListener(new ViewChangeListener() {
        @Override
        public boolean beforeViewChange(ViewChangeEvent event) {
            return true;
        }

        @Override
        public void afterViewChange(ViewChangeEvent event) {
            View newView = event.getNewView();
            if (newView instanceof NoDragAndDrop) {
                dragAndDropWrapper.setDropHandler(null);
            } else if (newView instanceof DropHandler) {
                dragAndDropWrapper.setDropHandler((DropHandler) newView);
            } else {
                List<DropHandler> viewDropHandlers = ComponentTreeUtils.getChildren((Component) newView,
                        DropHandler.class);
                if (viewDropHandlers.size() > 1) {
                    dragAndDropWrapper.setDropHandler(null);
                } else if (viewDropHandlers.size() == 1) {
                    dragAndDropWrapper.setDropHandler(viewDropHandlers.get(0));
                } else if (dragAndDropWrapper.getDropHandler() != userDocumentsWindow) {
                    dragAndDropWrapper.setDropHandler(userDocumentsWindow);
                }
            }
            //            SerializationUtils.clone(event.getOldView());
            //            SerializationUtils.clone(newView);
        }
    });

    addComponent(header);
    addComponent(dragAndDropWrapper);
    setExpandRatio(dragAndDropWrapper, 1);

    mainMenuContentFooterLayout.addComponent(mainMenu);
    mainMenuContentFooterLayout.addComponent(contentFooterWrapperLayout);
    mainMenuContentFooterLayout.setExpandRatio(contentFooterWrapperLayout, 1);

    contentFooterWrapperLayout.addComponent(contentFooterLayout);

    contentFooterLayout.addComponent(contentViewWrapper);

    Component message = buildMessage();
    if (message != null) {
        message.addStyleName("message");
        contentFooterLayout.addComponent(message);
    }

    contentFooterLayout.setExpandRatio(contentViewWrapper, 1);

    Component footer = buildFooter();
    if (footer != null) {
        contentFooterLayout.addComponent(footer);
    }

    Component license = buildLicense();
    if (license != null) {
        license.addStyleName("license");
    }

    PagesComponentsExtensionParams params = new PagesComponentsExtensionParams(header, mainMenu,
            contentFooterLayout, this, contentViewWrapper, contentFooterWrapperLayout, presenter.getUser());
    appLayerFactory.getExtensions().getSystemWideExtensions().decorateView(params);
    String collection = ConstellioUI.getCurrentSessionContext().getCurrentCollection();
    if (collection != null) {
        appLayerFactory.getExtensions().forCollection(collection).decorateView(params);
    }

    buildInitJavascript();
}

From source file:com.cxplonka.feature.ui.vaadin.VaadinUI.java

private void initLayout() {
    final VerticalLayout root = new VerticalLayout();
    root.setSizeFull();/*from  w ww  .j  a v a  2  s.  c  o m*/
    root.setMargin(true);
    root.setSpacing(true);
    setContent(root);

    final CssLayout navigationBar = new CssLayout();
    navigationBar.addStyleName(ValoTheme.LAYOUT_COMPONENT_GROUP);

    navigationBar.addComponent(createNavigationButton("Default View", DefaultView.VIEW_NAME));
    navigationBar.addComponent(createNavigationButton("Data View", DataTableView.VIEW_NAME));

    root.addComponent(navigationBar);

    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:com.esofthead.mycollab.module.project.view.task.GanttChartTaskContainer.java

License:Open Source License

private Panel createControls() {

    Panel panel = new Panel();
    panel.setWidth(100, Unit.PERCENTAGE);

    HorizontalLayout controls = new HorizontalLayout();
    controls.setSpacing(true);/*www.j  a va  2s.  c  om*/
    controls.setMargin(true);
    panel.setContent(controls);

    start = new DateField(AppContext.getMessage(TaskI18nEnum.FORM_START_DATE));
    start.setValue(gantt.getStartDate());
    start.setResolution(Resolution.DAY);
    start.setImmediate(true);
    start.addValueChangeListener(startDateValueChangeListener);

    end = new DateField(AppContext.getMessage(TaskI18nEnum.FORM_END_DATE));
    end.setValue(gantt.getEndDate());
    end.setResolution(Resolution.DAY);
    end.setImmediate(true);
    end.addValueChangeListener(endDateValueChangeListener);

    reso = new NativeSelect("Resolution");
    reso.setNullSelectionAllowed(false);
    reso.addItem(org.tltv.gantt.client.shared.Resolution.Hour);
    reso.addItem(org.tltv.gantt.client.shared.Resolution.Day);
    reso.addItem(org.tltv.gantt.client.shared.Resolution.Week);
    reso.setValue(gantt.getResolution());
    reso.setImmediate(true);
    reso.addValueChangeListener(resolutionValueChangeListener);

    controls.addComponent(start);
    controls.addComponent(end);
    controls.addComponent(reso);
    panel.setStyleName(UIConstants.THEME_NO_BORDER);

    return panel;
}

From source file:com.esofthead.mycollab.module.project.view.task.GanttChartViewImpl.java

License:Open Source License

private Panel createControls() {
    Panel panel = new Panel();
    panel.setWidth(100, Unit.PERCENTAGE);

    MHorizontalLayout controls = new MHorizontalLayout().withMargin(true);
    panel.setContent(controls);//from  w w w . j  av a 2 s .  c om

    DateFieldExt start = new DateFieldExt(AppContext.getMessage(TaskI18nEnum.FORM_START_DATE));
    start.setValue(gantt.getStartDate());
    start.setResolution(Resolution.DAY);
    start.setImmediate(true);
    start.addValueChangeListener(startDateValueChangeListener);

    DateField end = new DateFieldExt(AppContext.getMessage(TaskI18nEnum.FORM_END_DATE));
    end.setValue(gantt.getEndDate());
    end.setResolution(Resolution.DAY);
    end.setImmediate(true);
    end.addValueChangeListener(endDateValueChangeListener);

    reso = new NativeSelect("Resolution");
    reso.setNullSelectionAllowed(false);
    reso.addItem(org.tltv.gantt.client.shared.Resolution.Hour);
    reso.addItem(org.tltv.gantt.client.shared.Resolution.Day);
    reso.addItem(org.tltv.gantt.client.shared.Resolution.Week);
    reso.setValue(gantt.getResolution());
    reso.setImmediate(true);
    reso.addValueChangeListener(resolutionValueChangeListener);

    controls.with(start, end, reso);
    panel.setStyleName(UIConstants.THEME_NO_BORDER);

    return panel;
}

From source file:com.esspl.datagen.ui.ExecutorView.java

License:Open Source License

public ExecutorView(DataGenApplication application) {
    log.debug("ExecutorView - constructor start");
    dataGenApplication = application;/*from ww  w. j  av  a  2 s .co  m*/
    setSizeFull();

    VerticalLayout vl = new VerticalLayout();
    vl.setSizeFull();
    setCompositionRoot(vl);

    splitPanel = new VerticalSplitPanel();
    splitPanel.setSizeFull();

    //Script TextArea
    sqlScript = new TextArea();
    sqlScript.setSizeFull();
    sqlScript.setWordwrap(false);
    sqlScript.setStyleName("noResizeTextArea");

    HorizontalLayout queryOptions = new HorizontalLayout();
    queryOptions.setMargin(false, false, false, true);
    queryOptions.setSpacing(true);
    queryOptions.setWidth("100%");
    queryOptions.setHeight("40px");

    Button executeButton = new Button("Execute", new ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            log.info("ExecutorView - Execute Button clicked");
            executeScript(sqlScript.getValue().toString());
        }
    });
    executeButton.addStyleName("small");
    executeButton.setIcon(DataGenConstant.EXECUTOR_ICON);
    executeButton.setDescription("Press Ctrl+Enter to execute the query");

    Button clearQueryButton = new Button("Clear SQL", new ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            log.info("ExecutorView - Clear SQL Button clicked");
            sqlScript.setValue("");
        }
    });
    clearQueryButton.addStyleName("small");
    clearQueryButton.setIcon(DataGenConstant.CLEAR_SMALL);
    clearQueryButton.setDescription("Clears the Sql");

    Button clearConsoleButton = new Button("Clear Console", new ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            log.info("ExecutorView - Clear Console Button clicked");
            logText.setValue("");
        }
    });
    clearConsoleButton.addStyleName("small");
    clearConsoleButton.setIcon(DataGenConstant.CLEAR_SMALL);
    clearConsoleButton.setDescription("Clears the Console");

    maxRowsBox = new ComboBox(null, Arrays.asList(10, 100, 500, 1000, 5000, 10000));
    maxRowsBox.setDescription("Max number of rows to retrieve");
    maxRowsBox.setWidth(100, UNITS_PIXELS);
    maxRowsBox.setNewItemsAllowed(false);
    maxRowsBox.setNullSelectionAllowed(false);
    maxRowsBox.setValue(100);

    //Bottom section components
    resultSheet = new TabSheet();
    resultSheet.setSizeFull();
    resultSheet.addStyleName(Runo.TABSHEET_SMALL);

    logText = new Label();
    logText.setContentMode(Label.CONTENT_XHTML);
    logText.setSizeFull();

    //Panel to add refresher
    logPanel = new Panel();
    logPanel.setSizeFull();
    logPanel.setScrollable(true);
    logPanel.setStyleName(Runo.PANEL_LIGHT);
    logPanel.addComponent(logText);

    //Refresher added to show instant log messages
    refresher = new Refresher();
    logPanel.addComponent(refresher);

    //Loading image
    loadingImg = new Embedded("", DataGenConstant.LOADING_ICON);
    loadingImg.setVisible(false);
    logPanel.addComponent(loadingImg);

    resultSheet.addTab(logPanel, "Console");
    resultTab = resultSheet.addTab(new Label(), "Results");

    queryOptions.addComponent(executeButton);
    queryOptions.setComponentAlignment(executeButton, Alignment.MIDDLE_LEFT);
    queryOptions.addComponent(clearQueryButton);
    queryOptions.setComponentAlignment(clearQueryButton, Alignment.MIDDLE_LEFT);
    queryOptions.addComponent(clearConsoleButton);
    queryOptions.setComponentAlignment(clearConsoleButton, Alignment.MIDDLE_LEFT);
    queryOptions.setExpandRatio(clearConsoleButton, 1);
    queryOptions.addComponent(maxRowsBox);
    queryOptions.setComponentAlignment(maxRowsBox, Alignment.MIDDLE_RIGHT);

    splitPanel.setFirstComponent(sqlScript);
    splitPanel.setSecondComponent(resultSheet);

    vl.addComponent(queryOptions);
    vl.addComponent(splitPanel);
    vl.setExpandRatio(splitPanel, 1);

    sqlScript.addShortcutListener(new ShortcutListener("Execute Script", null, ShortcutAction.KeyCode.ENTER,
            ShortcutAction.ModifierKey.CTRL) {

        @Override
        public void handleAction(Object sender, Object target) {
            executeScript(sqlScript.getValue().toString());
        }
    });
    log.debug("ExecutorView - constructor end");
}

From source file:com.esspl.datagen.ui.SettingsView.java

License:Open Source License

private Component createWorkArea() {
    HorizontalSplitPanel split = new HorizontalSplitPanel();
    split.setSizeFull();//from w  w w .  ja v  a  2s  .  c  o  m
    split.setSplitPosition(30);

    List<ConnectionProfile> profiles = SettingsManager.get().getConfiguration().getProfiles();
    list = new ListSelect(null, new BeanItemContainer<ConnectionProfile>(ConnectionProfile.class, profiles));
    list.setSizeFull();
    list.setNullSelectionAllowed(false);
    list.setImmediate(true);
    if (!profiles.isEmpty()) {
        list.select(profiles.get(0));
    }

    list.addListener(new Property.ValueChangeListener() {
        @Override
        public void valueChange(Property.ValueChangeEvent event) {
            refreshDetails();
        }
    });

    panel = new Panel();
    panel.setSizeFull();

    split.addComponent(list);
    split.addComponent(panel);

    return split;
}

From source file:com.etest.connection.ErrorDBNotification.java

public static void showLoggedErrorOnWindow(String str) {
    Window sub = new Window("Logged ERROR");
    sub.setWidth("500px");
    sub.setHeight("300px");
    if (sub.getParent() == null) {
        UI.getCurrent().addWindow(sub);/*from  ww w.  j  a v a 2 s .c o  m*/
    }
    sub.setModal(true);

    Panel panel = new Panel();
    panel.setSizeFull();

    panel.setContent(new Label(str));
    sub.setContent(panel);
}