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:com.rdonasco.security.application.views.ApplicationEditorView.java

License:Apache License

public ApplicationEditorView() {
    applicationInfoPanel = new Panel(I18NResource.localize("Application Editor"));
    hostViewContainer = new VerticalLayout();
    nameField = new TextField(I18NResource.localize("Name"));
    tokenField = new TextField(I18NResource.localize("Token"));
    buttonsLayout = new HorizontalLayout();
    cancelButton = new Button();
    saveButton = new Button();
    editButton = new Button();
    generateTokenButton = new Button();
}

From source file:com.rex.components.valo.CommonParts.java

License:Apache License

Panel loadingIndicators() {
    Panel p = new Panel("Loading Indicator");
    final VerticalLayout content = new VerticalLayout();
    p.setContent(content);//from  w ww  .j a  v  a 2s  .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 (!ReportEngineUI.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.scipionyx.butterflyeffect.frontend.configuration.ui.view.AboutView.java

License:Apache License

/**
 * /*from   www .j a  v a  2  s .com*/
 * @param workAreaPanel
 */
private GridLayout createClusterInformation(String type, VerticalLayout workAreaPanel) {

    GridLayout layout = new GridLayout(4, 2);
    layout.setSizeFull();
    layout.setMargin(true);
    layout.setSpacing(true);

    Label label = new Label("Cluster Information - " + type);
    label.setStyleName(ValoTheme.LABEL_H2);

    Panel panelClusterInformation = new Panel(layout);
    panelClusterInformation.setStyleName(ValoTheme.PANEL_WELL);

    workAreaPanel.addComponents(label, panelClusterInformation);

    return layout;

}

From source file:com.squadd.chat.DialogController.java

public void updateChatLog(Integer amount) {
    ArrayList mess = getLastMessagesFromDB(amount);

    if (mess.size() > 0) {
        Panel add = new Panel("add 50 messages");
        add.setId("add");
        add.addClickListener(more);/*w w w .  j a va2  s . c o m*/
        content.addComponent(add);

        for (int i = mess.size(); i > 0; i--) {
            print((ChatMessage) mess.get(mess.size() - i));
        }
    }
}

From source file:com.squadd.UI.MenuLayout.java

public MenuLayout() {
    groupsPanel = new Panel("My Groups");
    messagesPanel = new Panel("Messages");
    mainPagePanel = new Panel("Main Page");

    configureLayout();//from  ww  w  . jav a  2  s  .c  om
}

From source file:com.squadd.views.MainPageView.java

protected Panel fillContentPanel(Layout layout) {
    //must be overriden for not allowing empty content panel
    return new Panel(layout);
}

From source file:com.tapas.evidence.fe.components.EvidenceUpload.java

License:Apache License

public EvidenceUpload(final IUiMessageSource messageSource, final Locale locale) {
    this.messagesource = messageSource;
    this.locale = locale;

    this.setSizeUndefined();

    root = new Panel(getMessage("upload.component.caption"));
    setCompositionRoot(root);/*from  w  w w  . j a  v a  2  s .  c  o  m*/
    UIUtils.clearBorder(root);
    ((AbstractLayout) root.getContent()).setMargin(false);

    // Create the Upload component.
    upload = new Upload(getMessage("upload.upload.caption"), this);
    upload.setImmediate(true);

    // Use a custom button caption instead of plain "Upload".
    upload.setButtonCaption(getMessage("upload.button.caption"));

    // Listen for events regarding the success of upload.
    upload.addListener((Upload.SucceededListener) this);
    upload.addListener((Upload.FailedListener) this);
    upload.addListener((Upload.StartedListener) this);

    // Create a panel for displaying the uploaded image.
    imagePanel = new Panel(getMessage("upload.image.caption"));
    ((AbstractLayout) imagePanel.getContent()).setMargin(false);
    status = new Label(getMessage("upload.image.notloaded"));
    imagePanel.setWidth("200px");
    imagePanel.setHeight("150px");
    root.addComponent(imagePanel);
    root.addComponent(status);

    root.addComponent(upload);
}

From source file:com.trivago.mail.pigeon.web.components.groups.GroupList.java

License:Apache License

public GroupList() {
    final GroupList gl = this;
    final Panel rootPanel = new Panel("Groups");
    rootPanel.setWidth("800px");
    Button groupListNewButton = new Button("Add group");
    groupListNewButton.setImmediate(true);
    groupListNewButton.setIcon(new ThemeResource("../runo/icons/16/document-add.png"));
    groupListNewButton.addListener(new Button.ClickListener() {
        @Override/*w ww .  j  ava2 s . co m*/
        public void buttonClick(Button.ClickEvent event) {
            Window modalNewWindow = new ModalAddNewGroup(gl);
            event.getButton().getWindow().addWindow(modalNewWindow);
            modalNewWindow.setVisible(true);
        }
    });

    viewTable = new Table();
    viewTable.setWidth("100%");
    final Button editButton = new Button("Edit");
    editButton.setImmediate(true);
    editButton.setIcon(new ThemeResource("../runo/icons/16/document-txt.png"));
    editButton.addListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            if (viewTable.isEditable()) {
                viewTable.setEditable(false);
                editButton.setCaption("Edit");
                viewTable.requestRepaintAll();
                editButton.getWindow().showNotification("Save successful",
                        Window.Notification.TYPE_HUMANIZED_MESSAGE);
            } else {
                viewTable.setEditable(true);
                editButton.setCaption("Save");
                viewTable.requestRepaintAll();
            }
        }
    });

    viewTable.setImmediate(true);
    beanContainer = new BeanContainer<>(RecipientGroup.class);

    List<RecipientGroup> groupList = getGroupList();
    for (RecipientGroup group : groupList) {
        beanContainer.addItem(group.getId(), group);
    }

    viewTable.setContainerDataSource(beanContainer);
    viewTable.addGeneratedColumn("memberNumber", new GroupColumnGenerator());
    viewTable.addGeneratedColumn("Actions", new ActionButtonColumnGenerator());

    // First set the vis. cols, then the headlines (the other way round leads to an exception)
    viewTable.setVisibleColumns(new String[] { "id", "name", "memberNumber", "Actions" });

    viewTable.setColumnHeaders(new String[] { "ID", "Name", "Member #", "Actions" });

    viewTable.setColumnExpandRatio(3, 2);
    viewTable.setColumnExpandRatio(4, 2);

    HorizontalLayout topButtonLayout = new HorizontalLayout();
    topButtonLayout.setSpacing(true);
    topButtonLayout.setMargin(false, false, true, false);
    topButtonLayout.addComponent(groupListNewButton);
    topButtonLayout.addComponent(editButton);

    rootPanel.addComponent(topButtonLayout);
    rootPanel.addComponent(viewTable);

    setCompositionRoot(rootPanel);
}

From source file:com.trivago.mail.pigeon.web.components.groups.GroupSelectBox.java

License:Apache License

public GroupSelectBox() {
    Panel rootPanel = new Panel("Select Recipient Group");
    select = new Select("Available Groups");
    select.setFilteringMode(AbstractSelect.Filtering.FILTERINGMODE_CONTAINS);
    select.setNullSelectionAllowed(false);
    reloadSelect();/*ww  w. j av  a  2s  .  c  om*/
    select.addListener(new Select.ValueChangeListener() {
        @Override
        public void valueChange(Property.ValueChangeEvent event) {

            selectedGroup = (Long) event.getProperty().getValue();
            log.debug("Group Select Value: " + selectedGroup);
        }
    });
    rootPanel.addComponent(select);
    setCompositionRoot(rootPanel);
    log.debug("Init groups done.");
}

From source file:com.trivago.mail.pigeon.web.components.groups.ModalAddNewGroup.java

License:Apache License

public ModalAddNewGroup(final GroupList gl) {
    super();/*from  w  w  w. j  av a2 s.  co  m*/

    setModal(true);
    setWidth("300px");
    setClosable(false);

    Panel rootPanel = new Panel("Add new group");

    VerticalLayout verticalLayout = new VerticalLayout();

    VerticalLayout formLayout = new VerticalLayout();

    final TextField tfName = new TextField("Name");

    verticalLayout.addComponent(tfName);

    HorizontalLayout buttonLayout = new HorizontalLayout();

    Button saveButton = new Button("Save");
    Button cancelButton = new Button("Cancel");

    saveButton.addListener(new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            if (tfName.getValue().equals("")) {
                tfName.setComponentError(new UserError("Name must not be empty"));
            } else {
                tfName.setComponentError(null);
            }

            /* TODO XXX check for existing group: no duplicates! */

            if (!tfName.getValue().equals("")) {
                tfName.setComponentError(null);

                long groupId = Util.generateId();

                try {
                    RecipientGroup g = new RecipientGroup(groupId, tfName.getValue().toString());
                    event.getButton().getWindow().setVisible(false);
                    event.getButton().getWindow().getParent().removeComponent(event.getButton().getWindow());
                    event.getButton().getWindow().getParent().showNotification("Saved successfully",
                            Notification.TYPE_HUMANIZED_MESSAGE);
                    gl.getBeanContainer().addItem(g.getId(), g);

                    // The group select could be placed anywhere but must be reloaded to reflect the changes.
                    GroupSelectBox.reloadSelect();
                } catch (RuntimeException e) {
                    // Should never happen ... hopefully :D
                }
            }

            event.getButton().getWindow().setVisible(false);
            event.getButton().getWindow().getParent().removeComponent(event.getButton().getWindow());
        }
    });

    cancelButton.addListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            event.getButton().getWindow().setVisible(false);
            event.getButton().getWindow().getParent().removeComponent(event.getButton().getWindow());
        }
    });

    buttonLayout.addComponent(saveButton);
    buttonLayout.addComponent(cancelButton);

    verticalLayout.addComponent(formLayout);
    verticalLayout.addComponent(buttonLayout);
    rootPanel.addComponent(verticalLayout);
    this.addComponent(rootPanel);
}