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:de.mendelson.comm.as2.webclient2.TransactionDetailsDialog.java

/**Could be overwritten, contains the content to display*/
@Override/*w  w w  .  ja v  a 2  s  .  c om*/
public AbstractComponent getContentPanel() {
    Panel panel = new Panel();
    VerticalLayout layout = new VerticalLayout();
    this.detailsTable = this.createDetailsTable();
    layout.addComponent(this.detailsTable);
    this.tabSheet = this.createTabSheet();
    layout.addComponent(this.tabSheet);
    layout.setSizeFull();
    panel.addComponent(layout);
    panel.setSizeFull();
    return (panel);
}

From source file:de.metas.ui.web.vaadin.window.components.AWindowTab.java

License:Open Source License

public AWindowTab(final TabModel tabModel) {
    super();//from w ww  .j  a v a2 s.  c  o m
    this.tabModel = tabModel;
    setSizeFull();
    setCaption(tabModel.getName());

    toolbar = new ATabToolbar(tabModel.getToolbarModel());
    addComponent(toolbar);

    {
        formLayout = new AWindowTabFormLayout(tabModel.getWindowContext(), tabModel.getDescriptor());
        formLayout.setRow(tabModel.getCurrentRow());

        final Panel formLayoutContainer = new Panel();
        formLayoutContainer.setHeight("400px");
        formLayoutContainer.setContent(formLayout);
        addComponent(formLayoutContainer);
    }

    // final AWindowTabGridLayout gridLayout = new AWindowTabGridLayout(tabModel.getWindowContext(), tabModel.getRowsContainer());
    // addComponent(gridLayout);
}

From source file:de.unioninvestment.eai.portal.portlet.crud.mvp.views.ui.Popup.java

License:Apache License

private void init() {
    this.setModal(true);
    this.setHeight(325, Unit.PIXELS);
    this.setWidth(500, Unit.PIXELS);

    VerticalLayout layout = new VerticalLayout();
    layout.setSizeFull();/*  w  w w . j a v a2  s. c  o m*/
    layout.setSpacing(true);
    layout.setMargin(true);
    setContent(layout);

    Panel panel = new Panel();
    panel.setHeight(100, Unit.PERCENTAGE);
    panel.addStyleName(Runo.PANEL_LIGHT);
    layout.addComponent(panel);
    layout.setExpandRatio(panel, 1);

    messageLabel = new Label();
    panel.setContent(messageLabel);

    Button close = new Button("Beenden", new Button.ClickListener() {
        private static final long serialVersionUID = -8385641161488292715L;

        public void buttonClick(ClickEvent event) {
            UI.getCurrent().removeWindow(Popup.this);
        }
    });

    layout.addComponent(close);
    layout.setComponentAlignment(close, Alignment.BOTTOM_RIGHT);
}

From source file:de.uni_leipzig.informatik.pcai042.boa.gui.goldstandard.GoldstandardGUI.java

License:Open Source License

@AutoGenerated
private Panel buildPanelTokens() {
    // common part: create layout
    panelTokens = new Panel();
    panelTokens.setImmediate(false);/*ww  w  . jav a2 s  .  c o m*/
    panelTokens.setWidth("500px");
    panelTokens.setHeight("140px");

    // verticalLayoutTokens
    verticalLayoutTokens = new VerticalLayout();
    verticalLayoutTokens.setImmediate(false);
    verticalLayoutTokens.setWidth("100.0%");
    verticalLayoutTokens.setHeight("-1px");
    verticalLayoutTokens.setMargin(false);
    panelTokens.setContent(verticalLayoutTokens);

    return panelTokens;
}

From source file:de.uni_tuebingen.qbic.qbicmainportlet.MultiscaleComponent.java

License:Open Source License

public void initUI() {
    mainlayout = new VerticalLayout();
    mainlayout.setWidth(100, Unit.PERCENTAGE);
    commentsPanel = new Panel();

    Label commentsLabel = new Label("No comments added so far.", ContentMode.HTML);
    commentsPanel.setContent(commentsLabel);

    commentsPanel.setImmediate(true);//from  w w w  . j ava2 s .c  o m
    commentsPanel.setWidth(50, Unit.PERCENTAGE);
    commentsPanel.setHeight(UI.getCurrent().getPage().getBrowserWindowHeight() * 0.2f, Unit.PIXELS);

    setCompositionRoot(mainlayout);
}

From source file:de.uni_tuebingen.qbic.qbicmainportlet.ProjInformationComponent.java

License:Open Source License

private void initUI() {
    vert = new VerticalLayout();
    descHorz = new HorizontalLayout();
    // horz = new HorizontalLayout();
    statusPanel = new Panel();
    descriptionPanel = new Panel();
    datasetTable = buildFilterTable();/*from   w  w  w.  ja  va  2 s .c  o  m*/
    peopleInCharge = new Accordion();

    setResponsive(true);
    vert.setResponsive(true);
    descHorz.setResponsive(true);
    statusPanel.setResponsive(true);
    descriptionPanel.setResponsive(true);

    vert.setMargin(new MarginInfo(true, true, false, false));

    setSizeFull();
    vert.setSizeFull();
    descHorz.setSizeFull();
    statusPanel.setSizeFull();
    descriptionPanel.setSizeFull();

    investigator = new Label("", ContentMode.HTML);
    contactPerson = new Label("", ContentMode.HTML);
    projectManager = new Label("", ContentMode.HTML);

    final VerticalLayout layoutI = new VerticalLayout(investigator);
    final VerticalLayout layoutC = new VerticalLayout(contactPerson);
    final VerticalLayout layoutP = new VerticalLayout(projectManager);

    layoutI.setMargin(true);
    layoutC.setMargin(true);
    layoutP.setMargin(true);

    peopleInCharge.addTab(layoutI, "Investigator");
    peopleInCharge.addTab(layoutC, "Contact Person");
    peopleInCharge.addTab(layoutP, "Project Manager");

    descEdit = new Button("Edit");
    descEdit.setIcon(FontAwesome.PENCIL);
    descEdit.setStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED);
    descEdit.setResponsive(true);

    descEdit.addClickListener(new ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            changeMetadata.updateUI(projectBean);
            VerticalLayout subContent = new VerticalLayout();
            subContent.setMargin(true);
            subContent.addComponent(changeMetadata);

            Window subWindow = new Window("Edit Metadata");
            subWindow.setContent(subContent);
            // Center it in the browser window
            subWindow.center();
            subWindow.setModal(true);
            subWindow.setIcon(FontAwesome.PENCIL);
            subWindow.setHeight("75%");
            subWindow.setResizable(false);
            // subWindow.setSizeFull();

            subWindow.addCloseListener(new CloseListener() {
                /**
                 * 
                 */
                private static final long serialVersionUID = -1329152609834711109L;

                @Override
                public void windowClose(CloseEvent e) {
                    ProjectBean updatedBean = datahandler.getProjectFromDB(projectBean.getId());
                    updateUI(updatedBean, projectType);
                }
            });

            QbicmainportletUI ui = (QbicmainportletUI) UI.getCurrent();
            ui.addWindow(subWindow);
        }
    });

    // horz.addComponent(descEdit);
    // horz.setComponentAlignment(descEdit, Alignment.TOP_RIGHT);
    // horz.setExpandRatio(investigator, 0.4f);
    // horz.setExpandRatio(contactPerson, 0.4f);
    // horz.setExpandRatio(descEdit, 0.2f);

    contact = new Label("", ContentMode.HTML);
    patientInformation = new Label("No patient information provided.", ContentMode.HTML);

    experimentLabel = new Label("");
    statusContent = new VerticalLayout();
    hlaTypeLabel = new Label("Not available.", ContentMode.HTML);
    hlaTypeLabel.setStyleName("patientview");

    this.setCompositionRoot(vert);
    // this.setCompositionRoot(mainLayout);
}

From source file:de.uni_tuebingen.qbic.qbicmainportlet.SearchBarView.java

License:Open Source License

public void initUI() {
    mainlayout = new Panel();
    mainlayout.addStyleName(ValoTheme.PANEL_BORDERLESS);

    // static information for the user
    // Label info = new Label();
    // info.setValue(infotext);
    // info.setStyleName(ValoTheme.LABEL_LIGHT);
    // info.setStyleName(ValoTheme.LABEL_H4);
    // mainlayout.addComponent(info);

    // Search bar
    // *----------- search text field .... search button-----------*
    HorizontalLayout searchbar = new HorizontalLayout();
    searchbar.setSpacing(true);/*  w  w w  . j  a  v  a2s .  c o  m*/
    final TextField searchfield = new TextField();
    searchfield.setHeight("44px");
    searchfield.setImmediate(true);

    searchfield.setInputPrompt("search for sample");
    // TODO would be nice to have a autofill or something similar
    searchbar.addComponent(searchfield);
    Button searchOk = new Button("GoTo");
    searchOk.addStyleName(ValoTheme.BUTTON_BORDERLESS);
    searchOk.setIcon(FontAwesome.SEARCH);
    searchOk.addClickListener(new ClickListener() {
        private static final long serialVersionUID = -2409450448301908214L;

        @Override
        public void buttonClick(ClickEvent event) {
            // TODO how to deal with entities
            Pattern pattern = Pattern.compile("Q[A-Z0-9]{4}[0-9]{3}[A-Z0-9]{2}");
            Pattern pattern2 = Pattern.compile("Q[A-Z0-9]{4}ENTITY-[0-9]+");

            LOGGER.info("searching for sample: " + (String) searchfield.getValue());

            if (searchfield.getValue() == null || searchfield.getValue().toString().equals("")) {
                Notification.show("Please provide a Barcode before clicking GoTo.", Type.WARNING_MESSAGE);
            }

            else {
                String entity = (String) searchfield.getValue().toString();

                Matcher matcher = pattern.matcher(entity);
                Matcher matcher2 = pattern2.matcher(entity);

                Boolean patternFound1 = matcher.find();
                Boolean patternFound2 = matcher2.find();

                if (patternFound1) {
                    try {
                        Sample foundSample = datahandler.getOpenBisClient()
                                .getSampleByIdentifier(matcher.group(0).toString());
                        String identifier = foundSample.getIdentifier();

                        State state = (State) UI.getCurrent().getSession().getAttribute("state");
                        ArrayList<String> message = new ArrayList<String>();
                        message.add("clicked");
                        message.add(identifier);
                        message.add("sample");
                        state.notifyObservers(message);
                    } catch (Exception e) {
                        Notification.show("No Sample found for given barcode.", Type.WARNING_MESSAGE);
                    }
                }

                else if (patternFound2) {
                    try {
                        Sample foundSample = datahandler.getOpenBisClient()
                                .getSampleByIdentifier(matcher2.group(0).toString());
                        String identifier = foundSample.getIdentifier();

                        State state = (State) UI.getCurrent().getSession().getAttribute("state");
                        ArrayList<String> message = new ArrayList<String>();
                        message.add("clicked");
                        message.add(identifier);
                        message.add("sample");
                        state.notifyObservers(message);
                    } catch (Exception e) {
                        Notification.show("No Sample found for given barcode.", Type.WARNING_MESSAGE);
                    }
                } else {
                    Notification.show("Please provide a valid Sample Barcode.", Type.WARNING_MESSAGE);
                }
            }
        }
    });

    // setClickShortcut() would add global shortcut, instead we
    // 'scope' the shortcut to the panel:
    mainlayout.addAction(new com.vaadin.ui.Button.ClickShortcut(searchOk, KeyCode.ENTER));
    // searchfield.addItems(this.getSearchResults("Q"));
    searchfield.setDescription(infotext);
    searchfield.addValidator(new NullValidator("Field must not be empty", false));
    searchfield.setValidationVisible(false);

    searchbar.addComponent(searchOk);
    // searchbar.setMargin(new MarginInfo(true, false, true, false));
    mainlayout.setContent(searchbar);
    // mainlayout.setComponentAlignment(searchbar, Alignment.MIDDLE_RIGHT);
    // mainlayout.setWidth(100, Unit.PERCENTAGE);
    setCompositionRoot(mainlayout);
}

From source file:de.uni_tuebingen.qbic.qbicmainportlet.SearchEngineView.java

License:Open Source License

public void initUI() {

    mainlayout = new Panel();
    mainlayout.addStyleName(ValoTheme.PANEL_BORDERLESS);

    // Search bar
    // *----------- search text field .... search button-----------*
    VerticalLayout searchbar = new VerticalLayout();
    searchbar.setWidth(100, Unit.PERCENTAGE);
    setResponsive(true);/*from   w  w  w. j  a  v a 2s.  c o  m*/
    searchbar.setResponsive(true);
    // searchbar.setWidth();

    HorizontalLayout buttonLayout = new HorizontalLayout();
    buttonLayout.setResponsive(true);
    buttonLayout.setWidth(75, Unit.PERCENTAGE);

    // searchbar.setSpacing(true);
    final TextField searchfield = new TextField();
    searchfield.setHeight("44px");
    searchfield.setImmediate(true);
    searchfield.setResponsive(true);
    searchfield.setWidth(75, Unit.PERCENTAGE);

    buttonLayout.setSpacing(true);

    searchfield.setInputPrompt("search DB");
    // searchfield.setCaption("QSearch");
    // searchfield.setWidth(25.0f, Unit.EM);
    // searchfield.setWidth(60, Unit.PERCENTAGE);

    // TODO would be nice to have a autofill or something similar
    // searchFieldLayout.addComponent(searchfield);
    searchbar.addComponent(searchfield);
    searchbar.setComponentAlignment(searchfield, Alignment.MIDDLE_RIGHT);

    final NativeSelect navsel = new NativeSelect();
    navsel.addItem("Whole DB");
    navsel.addItem("Projects Only");
    navsel.addItem("Experiments Only");
    navsel.addItem("Samples Only");
    navsel.setValue("Whole DB");
    navsel.setHeight("20px");
    navsel.setNullSelectionAllowed(false);
    navsel.setResponsive(true);
    navsel.setWidth(100, Unit.PERCENTAGE);

    navsel.addValueChangeListener(new Property.ValueChangeListener() {

        /**
         * 
         */
        private static final long serialVersionUID = -6896454887050432147L;

        @Override
        public void valueChange(ValueChangeEvent event) {
            // TODO Auto-generated method stub
            Notification.show((String) navsel.getValue());

            switch ((String) navsel.getValue()) {
            case "Whole DB":
                datahandler.setShowOptions(Arrays.asList("Projects", "Experiments", "Samples"));
                break;
            case "Projects Only":
                datahandler.setShowOptions(Arrays.asList("Projects"));
                break;
            case "Experiments Only":
                datahandler.setShowOptions(Arrays.asList("Experiments"));
                break;
            case "Samples Only":
                datahandler.setShowOptions(Arrays.asList("Samples"));
                break;
            default:
                datahandler.setShowOptions(Arrays.asList("Projects", "Experiments", "Samples"));
                break;
            }

        }
    });

    searchbar.addComponent(buttonLayout);
    searchbar.setComponentAlignment(buttonLayout, Alignment.MIDDLE_RIGHT);
    Button searchOk = new Button("");
    searchOk.setStyleName(ValoTheme.BUTTON_TINY);
    // searchOk.addStyleName(ValoTheme.BUTTON_BORDERLESS);
    searchOk.setIcon(FontAwesome.SEARCH);
    searchOk.setSizeUndefined();
    // searchOk.setWidth(15.0f, Unit.EM);
    searchOk.setResponsive(true);
    searchOk.setHeight("20px");

    searchOk.addClickListener(new ClickListener() {
        private static final long serialVersionUID = -2409450448301908214L;

        @Override
        public void buttonClick(ClickEvent event) {
            String queryString = (String) searchfield.getValue().toString();

            LOGGER.debug("the query was " + queryString);

            if (searchfield.getValue() == null || searchfield.getValue().toString().equals("")
                    || searchfield.getValue().toString().trim().length() == 0) {
                Notification.show("Query field was empty!", Type.WARNING_MESSAGE);
            } else {

                try {
                    /**
                     * Sample foundSample = datahandler.getOpenBisClient() .getSampleByIdentifier(
                     * matcher.group(0).toString());
                     */

                    datahandler.setSampleResults(querySamples(queryString));
                    datahandler.setExpResults(queryExperiments(queryString));
                    datahandler.setProjResults(queryProjects(queryString));
                    datahandler.setLastQueryString(queryString);

                    State state = (State) UI.getCurrent().getSession().getAttribute("state");
                    ArrayList<String> message = new ArrayList<String>();
                    message.add("clicked");
                    message.add("view" + queryString);
                    message.add("searchresults");
                    state.notifyObservers(message);

                } catch (Exception e) {
                    LOGGER.error("after query: ", e);
                    Notification.show("No Sample found for given barcode.", Type.WARNING_MESSAGE);
                }
            }

        }

    });

    // setClickShortcut() would add global shortcut, instead we
    // 'scope' the shortcut to the panel:
    mainlayout.addAction(new com.vaadin.ui.Button.ClickShortcut(searchOk, KeyCode.ENTER));
    // searchfield.addItems(this.getSearchResults("Q"));
    searchfield.setDescription(infotext);
    searchfield.addValidator(new NullValidator("Field must not be empty", false));
    searchfield.setValidationVisible(false);

    buttonLayout.addComponent(navsel);
    // buttonLayout.addComponent(new Label(""));
    buttonLayout.addComponent(searchOk);

    // searchFieldLayout.setComponentAlignment(searchOk, Alignment.TOP_RIGHT);
    // buttonLayout.setExpandRatio(searchOk, 1);
    // buttonLayout.setExpandRatio(navsel, 1);

    // searchFieldLayout.setSpacing(true);
    buttonLayout.setComponentAlignment(searchOk, Alignment.BOTTOM_RIGHT);
    // buttonLayout.setComponentAlignment(navsel, Alignment.BOTTOM_LEFT);

    buttonLayout.setExpandRatio(searchOk, 1);
    buttonLayout.setExpandRatio(navsel, 2);

    // searchbar.setMargin(new MarginInfo(true, false, true, false));
    mainlayout.setContent(searchbar);
    // mainlayout.setComponentAlignment(searchbar, Alignment.MIDDLE_RIGHT);
    // mainlayout.setWidth(100, Unit.PERCENTAGE);
    setCompositionRoot(mainlayout);
}

From source file:dhbw.clippinggorilla.userinterface.windows.NewSourceWindow.java

/**
 * Value is optional/*from  w  w w.j  av a2s.  c o  m*/
 *
 * @param action
 * @param content
 * @param value
 * @return
 */
private Component getRow(Layout parent, Runnable onDelete, String action, String content, String value) {
    Panel panelRow = new Panel();
    GridLayout layoutRow = new GridLayout(2, 1);

    Label labelInfo = new Label("", ContentMode.HTML);
    String stringInfo = action.toUpperCase() + "<br>";
    if (value != null) {
        stringInfo += content + " = " + value;
    } else {
        stringInfo += content + " ";
    }
    labelInfo.setValue(stringInfo);

    Button buttonDelete = new Button(VaadinIcons.TRASH);
    buttonDelete.addStyleName(ValoTheme.BUTTON_DANGER);
    buttonDelete.addClickListener(ce -> {
        onDelete.run();
        parent.removeComponent(panelRow);
    });

    layoutRow.addComponents(labelInfo, buttonDelete);
    layoutRow.setComponentAlignment(buttonDelete, Alignment.MIDDLE_RIGHT);
    layoutRow.setComponentAlignment(labelInfo, Alignment.MIDDLE_LEFT);
    layoutRow.setWidth("100%");
    layoutRow.setMargin(true);
    layoutRow.addStyleName("crawler");
    panelRow.setContent(layoutRow);
    panelRow.setWidth("100%");
    return panelRow;
}

From source file:dhbw.ka.mwi.businesshorizon2.ui.process.method.MethodViewImpl.java

License:Open Source License

public void showMethodView() {
    this.removeAllComponents();

    stochastic = new CheckBox("Stochastische Berechnung");
    deterministic = new CheckBox("Berechnungsmethode (Herkunft Cashflow: Deterministisch)");

    stochastic.setImmediate(true);/*  www.ja  v  a 2  s .c o m*/
    deterministic.setImmediate(true);

    methodPanel_stochastic = new Panel();
    methodPanel_stochastic.addStyleName("light");

    methodPanel_deterministic = new Panel();
    methodPanel_deterministic.addStyleName("light");

    stochastic.addListener(new Button.ClickListener() {

        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(ClickEvent event) {
            presenter.toggleMethodType(true, event.getButton().booleanValue());
        }
    });
    deterministic.addListener(new Button.ClickListener() {

        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(ClickEvent event) {
            presenter.toggleMethod_deterministicType(true, event.getButton().booleanValue());

        }
    });

    methods_stochastic = new OptionGroup();
    methods_stochastic.setMultiSelect(true);
    methods_stochastic.setImmediate(true);
    methods_stochastic.addListener(new Property.ValueChangeListener() {

        private static final long serialVersionUID = 1L;

        @SuppressWarnings("unchecked")
        @Override
        public void valueChange(ValueChangeEvent event) {
            presenter.toggleMethod((Set<AbstractStochasticMethod>) methods_stochastic.getValue());
        }
    });

    methods_deterministic = new OptionGroup();
    methods_deterministic.setMultiSelect(true);
    methods_deterministic.setImmediate(true);
    methods_deterministic.addListener(new Property.ValueChangeListener() {

        private static final long serialVersionUID = 1L;

        @SuppressWarnings("unchecked")
        @Override
        public void valueChange(ValueChangeEvent event) {
            presenter.toggleMethod_deterministic(
                    (Set<AbstractDeterministicMethod>) methods_deterministic.getValue());
        }
    });

    stochasticInput = new OptionGroup();
    stochasticInput.setImmediate(true);
    stochasticInput.addListener(new Property.ValueChangeListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void valueChange(ValueChangeEvent event) {
            InputType selected = (InputType) event.getProperty().getValue();
            presenter.toggleMethodTypeInput(true, selected);
        }
    });

    deterministicInput = new OptionGroup();
    deterministicInput.setImmediate(true);
    deterministicInput.addListener(new Property.ValueChangeListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void valueChange(ValueChangeEvent event) {
            InputType selected = (InputType) event.getProperty().getValue();
            presenter.toggleMethod_deterministicTypeInput(true, selected);
        }
    });

    initOptionGroups();
    generateUi();
    infoBox.setSizeFull();
}