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(String caption) 

Source Link

Document

Creates a new empty panel with caption.

Usage

From source file:ch.bfh.ti.soed.hs16.srs.black.view.reservationView.ReservationTableView.java

License:Open Source License

public ReservationTableView() {
    Panel panel = new Panel("My Reservations");
    table = new Table();
    table.addContainerProperty("RoomEntity", Integer.class, null);
    table.addContainerProperty("Start Time", Date.class, null);
    table.addContainerProperty("End Time", Date.class, null);
    table.addContainerProperty("Cancel", Button.class, null);
    table.setPageLength(table.size());/* w  w w .  ja  v  a2  s. com*/
    panel.setContent(table);

    listReservations = new VerticalLayout(panel);
    listReservations.setSizeUndefined();
    listReservations.setMargin(true);
}

From source file:ch.bfh.ti.soed.hs16.srs.black.view.signUpView.SignUpView.java

License:Open Source License

public SignUpView() {
    usernameField = new TextField("Username");
    usernameField.setIcon(FontAwesome.USER);
    usernameField.setWidth(12, Unit.EM);
    passwordField = new PasswordField("Password");
    passwordField.setIcon(FontAwesome.KEY);
    passwordField.setWidth(12, Unit.EM);
    passwordFieldRepeat = new PasswordField("Repeat Password");
    passwordFieldRepeat.setIcon(FontAwesome.KEY);
    passwordFieldRepeat.setWidth(12, Unit.EM);
    addUserButton = new Button("Add New User");
    addUserButton.setWidth(12, Unit.EM);
    goBackButton = new Button("Back");

    VerticalLayout layout = new VerticalLayout();
    Panel panel = new Panel("Sign Up - Smart ReservationEntity System");
    panel.setSizeUndefined();/*from   w ww .jav  a2 s  .c om*/
    layout.addComponent(panel);

    FormLayout content = new FormLayout();
    content.addComponents(usernameField, passwordField, passwordFieldRepeat, addUserButton);
    content.setSizeUndefined();
    content.setMargin(true);
    VerticalLayout formAndBack = new VerticalLayout(content, goBackButton);
    formAndBack.setMargin(true);
    panel.setContent(formAndBack);

    setCompositionRoot(layout);

    layout.setComponentAlignment(panel, Alignment.MIDDLE_CENTER);
    layout.setMargin(new MarginInfo(true, false, false, false));
}

From source file:ch.bfh.ti.soed.hs16.srs.green.view.MyUI.java

License:Open Source License

/**
 * Method which actually creates the whole UI.
 *//*  w w  w.ja  va 2 s . c o  m*/
@Override
protected void init(VaadinRequest vaadinRequest) {

    VerticalLayout layout = new VerticalLayout();

    Panel panel = new Panel("Login");
    panel.setSizeUndefined();

    FormLayout content = new FormLayout();
    userName = new TextField("Username");
    content.addComponent(userName);

    PasswordField password = new PasswordField("Password");
    content.addComponent(password);

    Button login = new Button("Login");
    register = new Button("Register");
    CheckBox askBox = new CheckBox("Are you a Roommanager?");

    login.setStyleName(Reindeer.BUTTON_SMALL);
    login.setWidth("86px");

    register.setStyleName(Reindeer.BUTTON_SMALL);
    register.setWidth("86px");
    askBox.setStyleName(Reindeer.BUTTON_SMALL);

    HorizontalLayout hl = new HorizontalLayout();
    hl.setSpacing(true);
    hl.addComponent(login);
    hl.addComponent(register);
    hl.addComponent(askBox);

    content.addComponent(hl);
    content.setSizeUndefined();
    content.setMargin(true);

    panel.setContent(content);

    login.addClickListener(e -> {
        System.out.println(userName.getValue());
        System.out.println(password.getValue());
        try {
            if (controller.login(userName.getValue(), password.getValue())
                    || userName.equals(userName.getValue()) && password.equals(password.getValue())) {
                setContent(new ReservationUI());
            }
        } catch (Throwable e1) {
            e1.printStackTrace();
        }
    });

    register.addClickListener(e -> {
        try {
            Role x = askBox.getValue() ? Role.ROOMMANAGER : Role.CUSTOMER;
            controller.register(userName.getValue(), password.getValue(), x);
        } catch (Throwable e1) {
            e1.printStackTrace();
        }
    });

    layout.setMargin(true);
    layout.setSpacing(true);
    layout.addComponent(panel);
    setContent(layout);
}

From source file:cirad.cgh.vcf2fasta.Vcf2fastaUI.java

License:Open Source License

@Override
protected void init(VaadinRequest request) {
    config = initConfig();/*ww w .  j  a va2s  .c o m*/

    Panel mainPanel = new Panel("Vcf2fasta");

    VerticalLayout layout = new VerticalLayout();
    layout.setMargin(true);
    mainPanel.setContent(layout);

    vcf2fastaForm = new Vcf2fastaForm(this, config);
    vcf2fastaForm.setFormSubmitHandler(getSubmitClickListener(this));

    layout.addComponent(vcf2fastaForm);

    setTheme("tests-valo-reindeer");
    //setTheme("tests-valo-facebook");
    //setTheme("tests-valo-metro");

    setContent(mainPanel);
}

From source file:com.application.modules.commercial.ClientListView.java

public void init() {

    //Recherche TextField
    rech = new ComboBox("Rechercher un Client :");
    this.addComponent(rech);
    this.setComponentAlignment(rech, Alignment.TOP_RIGHT);

    //Panels// w  ww.  jav  a  2 s  .  c om
    HorizontalLayout panels = new HorizontalLayout();
    panels.setHeight("100%");
    panels.setWidth("100%");
    Panel panel_liste = new Panel("Liste des Clients");
    Panel panel_license = new Panel("Liste des licenses");
    panels.addComponent(panel_liste);
    panels.addComponent(panel_license);
    this.addComponent(panels);

    //Intervention Liste table
    Client_liste = new Table();
    Client_liste.setHeight("550px");
    License_liste = new Table();
    License_liste.setHeight("550px");

    Client_liste.setWidth("100%");
    License_liste.setWidth("100%");

    // selectable
    Client_liste.setSelectable(true);
    Client_liste.setMultiSelect(false);
    Client_liste.setImmediate(true);

    License_liste.setSelectable(true);
    License_liste.setMultiSelect(false);
    License_liste.setImmediate(true);

    // turn on column reordering and collapsing
    Client_liste.setColumnReorderingAllowed(true);
    Client_liste.setColumnCollapsingAllowed(true);
    License_liste.setColumnReorderingAllowed(true);
    License_liste.setColumnCollapsingAllowed(true);

    //Client Table
    Client_liste.addContainerProperty("Num", String.class, null);
    Client_liste.addContainerProperty("Nom client", String.class, null);
    Client_liste.addContainerProperty("Contact", String.class, null);
    Client_liste.addContainerProperty("Adresse", String.class, null);
    Client_liste.addContainerProperty("Tlephone", String.class, null);

    //License Table
    License_liste.addContainerProperty("Num", String.class, null);
    License_liste.addContainerProperty("Application", String.class, null);
    License_liste.addContainerProperty("Date Expiration", Date.class, null);

    panel_liste.addComponent(Client_liste);
    panel_license.addComponent(License_liste);

    rech.setImmediate(true);
    Property.ValueChangeListener listener = new Property.ValueChangeListener() {
        public void valueChange(ValueChangeEvent event) {
            presenter.load_ClientListe();
        }
    };

    Client_liste.addListener(new ItemClickEvent.ItemClickListener() {
        @Override
        public void itemClick(ItemClickEvent itemClickEvent) {
            System.out.println(itemClickEvent.getItemId().toString());
            presenter.load_LicenseListe(itemClickEvent.getItemId());
        }
    });

    rech.addListener(listener);

    //Class Layout properties
    this.setWidth("100%");
    this.setMargin(true);
    this.setSpacing(true);

    presenter.load_ClientListe();
    presenter.list_client();

}

From source file:com.arcusys.liferay.vaadinplugin.ControlPanelUI.java

License:Apache License

private void createUI() {
    //create main layout
    mainLayout = new VerticalLayout();
    mainLayout.setWidth("720px");
    mainLayout.setSpacing(true);//from   w  w  w  .j  ava  2 s  . c  o m

    setContent(mainLayout);

    //create Setting layout
    settingsPanel = new Panel("Settings");
    settingsLayout = new FormLayout();
    settingsPanel.setContent(settingsLayout);

    versionUpgradeProgressIndicator = createProgressIndicator();

    changeVersionButton = createChangeVersionButton();
    updateVaadinVersionButton = createUpdateVaadinVersionButton();

    Version vaadinNewestVersion = newestDownloadInfo.getVersion();
    //add details
    detailsButton = createDetailsButton();

    vaadinVersionLayout = createVaadinVersionLayout(vaadinNewestVersion.toString(), changeVersionButton,
            updateVaadinVersionButton, versionUpgradeProgressIndicator, detailsButton);
    settingsLayout.addComponent(vaadinVersionLayout);

    activeWidgetsetLabel = createActiveWidgetsetLabel();
    settingsLayout.addComponent(activeWidgetsetLabel);

    // Add-on selection
    HorizontalLayout addonDirectoryLayout = createAddonDirectoryLayout();
    settingsLayout.addComponent(addonDirectoryLayout);

    //Add-on included
    includeAddonsOptionGroup = createIncludeAddonsList();
    addonsListHolder = createIncludeAddonsListLayout(includeAddonsOptionGroup);
    settingsLayout.addComponent(addonsListHolder);

    //addition dependencies
    additionalDependenciesLabel = createAdditionalDependenciesLabel();
    settingsLayout.addComponent(additionalDependenciesLabel);

    mainLayout.addComponent(settingsPanel);

    additionalDependenciesButton = createAdditionalDependenciesButton();
    mainLayout.addComponent(additionalDependenciesButton);

    //Compilation layout
    HorizontalLayout compilationlayout = new HorizontalLayout();
    compileWidgetsetButton = createCompileWidgetsetButton();
    compilationlayout.addComponent(compileWidgetsetButton);
    terminateCompilationButton = createTerminateCompilationButton();
    compilationlayout.addComponent(terminateCompilationButton);
    compilationProgressIndicator = createProgressIndicator();
    compilationlayout.addComponent(compilationProgressIndicator);
    compilationlayout.setComponentAlignment(compilationProgressIndicator, Alignment.MIDDLE_LEFT);
    settingsLayout.addComponent(compilationlayout);

    //Output console
    outputConsole = createOutputConsole();
    mainLayout.addComponent(outputConsole);

    addonsNotFoundLabel = createAddonsNotFoundLabel();
}

From source file:com.assemblade.ui.views.LoginScreen.java

License:Apache License

public LoginScreen() {
    app = CatApplication.getInstance();//from   w  w  w . j a  va 2  s .  c o m
    setSizeFull();
    Panel loginPanel = new Panel("Login");
    loginPanel.setWidth("400px");
    LoginForm loginForm = new LoginForm();
    loginForm.setUsernameCaption("Username: ");
    loginForm.setPasswordCaption("Password: ");
    loginForm.addListener(this);
    loginForm.setHeight("150px");
    loginPanel.addComponent(loginForm);
    addComponent(loginPanel);
    setComponentAlignment(loginPanel, Alignment.MIDDLE_CENTER);
    HorizontalLayout footer = new HorizontalLayout();
    footer.setHeight("50px");
    addComponent(footer);
}

From source file:com.cavisson.gui.dashboard.components.controls.CommonParts.java

License:Apache License

Panel loadingIndicators() {
    Panel p = new Panel("Loading Indicator");
    final VerticalLayout content = new VerticalLayout();
    p.setContent(content);//from   w  w  w.  java2  s. co  m
    content.setSpacing(true);
    content.setMargin(true);
    content.addComponent(new Label("You can test the loading indicator by pressing the buttons."));

    CssLayout group = new CssLayout();
    group.setCaption("Show the loading indicator for");
    group.addStyleName("v-component-group");
    content.addComponent(group);
    Button loading = new Button("0.8");
    loading.addClickListener(new ClickListener() {
        @Override
        public void buttonClick(final ClickEvent event) {
            try {
                Thread.sleep(800);
            } catch (InterruptedException e) {
            }
        }
    });
    group.addComponent(loading);

    Button delay = new Button("3");
    delay.addClickListener(new ClickListener() {
        @Override
        public void buttonClick(final ClickEvent event) {
            try {
                Thread.sleep(3000);
            } catch (InterruptedException e) {
            }
        }
    });
    group.addComponent(delay);

    Button wait = new Button("15");
    wait.addClickListener(new ClickListener() {
        @Override
        public void buttonClick(final ClickEvent event) {
            try {
                Thread.sleep(15000);
            } catch (InterruptedException e) {
            }
        }
    });
    wait.addStyleName("last");
    group.addComponent(wait);
    Label label = new Label("   seconds", ContentMode.HTML);
    label.setSizeUndefined();
    group.addComponent(label);

    Label spinnerDesc = new Label(
            "The theme also provides a mixin that you can use to include a spinner anywhere in your application. The button below reveals a Label with a custom style name, for which the spinner mixin is added.");
    spinnerDesc.addStyleName("small");
    spinnerDesc.setCaption("Spinner");
    content.addComponent(spinnerDesc);

    if (!ValoThemeUI.isTestMode()) {
        final Label spinner = new Label();
        spinner.addStyleName("spinner");

        Button showSpinnerButton = new Button("Show spinner", new ClickListener() {
            @Override
            public void buttonClick(final ClickEvent event) {
                content.replaceComponent(event.getComponent(), spinner);
            }
        });
        content.addComponent(showSpinnerButton);
    }

    return p;
}

From source file:com.cavisson.gui.dashboard.components.controls.CommonParts.java

License:Apache License

Panel notifications() {
    Panel p = new Panel("Notifications");
    VerticalLayout content = new VerticalLayout() {
        Notification notification = new Notification("");
        TextField title = new TextField("Title");
        TextArea description = new TextArea("Description");
        MenuBar style = new MenuBar();
        MenuBar type = new MenuBar();
        String typeString = "";
        String styleString = "";
        TextField delay = new TextField();
        {//from w  ww  . ja v  a  2 s .c om
            setSpacing(true);
            setMargin(true);

            title.setInputPrompt("Title for the notification");
            title.addValueChangeListener(new ValueChangeListener() {
                @Override
                public void valueChange(final ValueChangeEvent event) {
                    if (title.getValue() == null || title.getValue().length() == 0) {
                        notification.setCaption(null);
                    } else {
                        notification.setCaption(title.getValue());
                    }
                }
            });
            title.setValue("Notification Title");
            title.setWidth("100%");
            addComponent(title);

            description.setInputPrompt("Description for the notification");
            description.addStyleName("small");
            description.addValueChangeListener(new ValueChangeListener() {
                @Override
                public void valueChange(final ValueChangeEvent event) {
                    if (description.getValue() == null || description.getValue().length() == 0) {
                        notification.setDescription(null);
                    } else {
                        notification.setDescription(description.getValue());
                    }
                }
            });
            description.setValue(
                    "A more informative message about what has happened. Nihil hic munitissimus habendi senatus locus, nihil horum? Inmensae subtilitatis, obscuris et malesuada fames. Hi omnes lingua, institutis, legibus inter se differunt.");
            description.setWidth("100%");
            addComponent(description);

            Command typeCommand = new Command() {
                @Override
                public void menuSelected(final MenuItem selectedItem) {
                    if (selectedItem.getText().equals("Humanized")) {
                        typeString = "";
                        notification.setStyleName(styleString.trim());
                    } else {
                        typeString = selectedItem.getText().toLowerCase();
                        notification.setStyleName((typeString + " " + styleString.trim()).trim());
                    }
                    for (MenuItem item : type.getItems()) {
                        item.setChecked(false);
                    }
                    selectedItem.setChecked(true);
                }
            };

            type.setCaption("Type");
            MenuItem humanized = type.addItem("Humanized", typeCommand);
            humanized.setCheckable(true);
            humanized.setChecked(true);
            type.addItem("Tray", typeCommand).setCheckable(true);
            type.addItem("Warning", typeCommand).setCheckable(true);
            type.addItem("Error", typeCommand).setCheckable(true);
            type.addItem("System", typeCommand).setCheckable(true);
            addComponent(type);
            type.addStyleName("small");

            Command styleCommand = new Command() {
                @Override
                public void menuSelected(final MenuItem selectedItem) {
                    styleString = "";
                    for (MenuItem item : style.getItems()) {
                        if (item.isChecked()) {
                            styleString += " " + item.getText().toLowerCase();
                        }
                    }
                    if (styleString.trim().length() > 0) {
                        notification.setStyleName((typeString + " " + styleString.trim()).trim());
                    } else if (typeString.length() > 0) {
                        notification.setStyleName(typeString.trim());
                    } else {
                        notification.setStyleName(null);
                    }
                }
            };

            style.setCaption("Additional style");
            style.addItem("Dark", styleCommand).setCheckable(true);
            style.addItem("Success", styleCommand).setCheckable(true);
            style.addItem("Failure", styleCommand).setCheckable(true);
            style.addItem("Bar", styleCommand).setCheckable(true);
            style.addItem("Small", styleCommand).setCheckable(true);
            style.addItem("Closable", styleCommand).setCheckable(true);
            addComponent(style);
            style.addStyleName("small");

            CssLayout group = new CssLayout();
            group.setCaption("Fade delay");
            group.addStyleName("v-component-group");
            addComponent(group);

            delay.setInputPrompt("Infinite");
            delay.addStyleName("align-right");
            delay.addStyleName("small");
            delay.setWidth("7em");
            delay.addValueChangeListener(new ValueChangeListener() {
                @Override
                public void valueChange(final ValueChangeEvent event) {
                    try {
                        notification.setDelayMsec(Integer.parseInt(delay.getValue()));
                    } catch (Exception e) {
                        notification.setDelayMsec(-1);
                        delay.setValue("");
                    }

                }
            });
            delay.setValue("1000");
            group.addComponent(delay);

            Button clear = new Button(null, new ClickListener() {
                @Override
                public void buttonClick(final ClickEvent event) {
                    delay.setValue("");
                }
            });
            clear.setIcon(FontAwesome.TIMES_CIRCLE);
            clear.addStyleName("last");
            clear.addStyleName("small");
            clear.addStyleName("icon-only");
            group.addComponent(clear);
            group.addComponent(new Label("  msec", ContentMode.HTML));

            GridLayout grid = new GridLayout(3, 3);
            grid.setCaption("Show in position");
            addComponent(grid);
            grid.setSpacing(true);

            Button pos = new Button("", new ClickListener() {
                @Override
                public void buttonClick(final ClickEvent event) {
                    notification.setPosition(Position.TOP_LEFT);
                    notification.show(Page.getCurrent());
                }
            });
            pos.addStyleName("small");
            grid.addComponent(pos);

            pos = new Button("", new ClickListener() {
                @Override
                public void buttonClick(final ClickEvent event) {
                    notification.setPosition(Position.TOP_CENTER);
                    notification.show(Page.getCurrent());
                }
            });
            pos.addStyleName("small");
            grid.addComponent(pos);

            pos = new Button("", new ClickListener() {
                @Override
                public void buttonClick(final ClickEvent event) {
                    notification.setPosition(Position.TOP_RIGHT);
                    notification.show(Page.getCurrent());
                }
            });
            pos.addStyleName("small");
            grid.addComponent(pos);

            pos = new Button("", new ClickListener() {
                @Override
                public void buttonClick(final ClickEvent event) {
                    notification.setPosition(Position.MIDDLE_LEFT);
                    notification.show(Page.getCurrent());
                }
            });
            pos.addStyleName("small");
            grid.addComponent(pos);

            pos = new Button("", new ClickListener() {
                @Override
                public void buttonClick(final ClickEvent event) {
                    notification.setPosition(Position.MIDDLE_CENTER);
                    notification.show(Page.getCurrent());
                }
            });
            pos.addStyleName("small");
            grid.addComponent(pos);

            pos = new Button("", new ClickListener() {
                @Override
                public void buttonClick(final ClickEvent event) {
                    notification.setPosition(Position.MIDDLE_RIGHT);
                    notification.show(Page.getCurrent());
                }
            });
            pos.addStyleName("small");
            grid.addComponent(pos);

            pos = new Button("", new ClickListener() {
                @Override
                public void buttonClick(final ClickEvent event) {
                    notification.setPosition(Position.BOTTOM_LEFT);
                    notification.show(Page.getCurrent());
                }
            });
            pos.addStyleName("small");
            grid.addComponent(pos);

            pos = new Button("", new ClickListener() {
                @Override
                public void buttonClick(final ClickEvent event) {
                    notification.setPosition(Position.BOTTOM_CENTER);
                    notification.show(Page.getCurrent());
                }
            });
            pos.addStyleName("small");
            grid.addComponent(pos);

            pos = new Button("", new ClickListener() {
                @Override
                public void buttonClick(final ClickEvent event) {
                    notification.setPosition(Position.BOTTOM_RIGHT);
                    notification.show(Page.getCurrent());
                }
            });
            pos.addStyleName("small");
            grid.addComponent(pos);

        }
    };
    p.setContent(content);

    return p;
}

From source file:com.cavisson.gui.dashboard.components.controls.CommonParts.java

License:Apache License

Panel tooltips() {
    Panel p = new Panel("Tooltips");
    HorizontalLayout content = new HorizontalLayout() {
        {//  w  w w.java  2s. co m
            setSpacing(true);
            setMargin(true);
            addStyleName("wrapping");

            addComponent(new Label("Try out different tooltips/descriptions by hovering over the labels."));

            Label label = new Label("Simple");
            label.addStyleName("bold");
            label.setDescription("Simple tooltip message");
            addComponent(label);

            label = new Label("Long");
            label.addStyleName("bold");
            label.setDescription(
                    "Long tooltip message. Inmensae subtilitatis, obscuris et malesuada fames. Salutantibus vitae elit libero, a pharetra augue.");
            addComponent(label);

            label = new Label("HTML tooltip");
            label.addStyleName("bold");
            label.setDescription(
                    "<div><h1>Ut enim ad minim veniam, quis nostrud exercitation</h1><p><span>Morbi fringilla convallis sapien, id pulvinar odio volutpat.</span> <span>Vivamus sagittis lacus vel augue laoreet rutrum faucibus.</span> <span>Donec sed odio operae, eu vulputate felis rhoncus.</span> <span>At nos hinc posthac, sitientis piros Afros.</span> <span>Tu quoque, Brute, fili mi, nihil timor populi, nihil!</span></p><p><span>Gallia est omnis divisa in partes tres, quarum.</span> <span>Praeterea iter est quasdam res quas ex communi.</span> <span>Cum ceteris in veneratione tui montes, nascetur mus.</span> <span>Quam temere in vitiis, legem sancimus haerentia.</span> <span>Idque Caesaris facere voluntate liceret: sese habere.</span></p></div>");
            addComponent(label);

            label = new Label("With an error message");
            label.addStyleName("bold");
            label.setDescription("Simple tooltip message");
            label.setComponentError(new UserError("Something terrible has happened"));
            addComponent(label);

            label = new Label("With a long error message");
            label.addStyleName("bold");
            label.setDescription("Simple tooltip message");
            label.setComponentError(new UserError(
                    "<h2>Contra legem facit qui id facit quod lex prohibet <span>Tityre, tu patulae recubans sub tegmine fagi  dolor.</span> <span>Tityre, tu patulae recubans sub tegmine fagi  dolor.</span> <span>Prima luce, cum quibus mons aliud  consensu ab eo.</span> <span>Quid securi etiam tamquam eu fugiat nulla pariatur.</span> <span>Fabio vel iudice vincam, sunt in culpa qui officia.</span> <span>Nihil hic munitissimus habendi senatus locus, nihil horum?</span></p><p><span>Plura mihi bona sunt, inclinet, amari petere vellent.</span> <span>Integer legentibus erat a ante historiarum dapibus.</span> <span>Quam diu etiam furor iste tuus nos eludet?</span> <span>Nec dubitamus multa iter quae et nos invenerat.</span> <span>Quisque ut dolor gravida, placerat libero vel, euismod.</span> <span>Quae vero auctorem tractata ab fiducia dicuntur.</span></h2>",
                    AbstractErrorMessage.ContentMode.HTML, ErrorLevel.CRITICAL));
            addComponent(label);

            label = new Label("Error message only");
            label.addStyleName("bold");
            label.setComponentError(new UserError("Something terrible has happened"));
            addComponent(label);
        }
    };
    p.setContent(content);
    return p;

}