Example usage for com.vaadin.ui Accordion Accordion

List of usage examples for com.vaadin.ui Accordion Accordion

Introduction

In this page you can find the example usage for com.vaadin.ui Accordion Accordion.

Prototype

public Accordion() 

Source Link

Document

Creates an empty accordion.

Usage

From source file:com.trivago.mail.pigeon.web.components.templates.ModalAddTemplate.java

License:Apache License

private void assembleHelpComponents(final Panel helpRootPanel) {
    VerticalLayout vHelpLayout = new VerticalLayout();

    Link velocityLink = new Link("Velocity User Guide",
            new ExternalResource("http://velocity.apache.org/engine/releases/velocity-1.7/user-guide.html"));
    velocityLink.setTargetName("_blank");
    Label helpText1 = new Label(
            "<p>You can find the basic template language user guide at the vendors homepage.</p>",
            Label.CONTENT_XHTML);
    Label helpText2 = new Label(
            "<p>The standard set of commands is enriched with our application specific variables."
                    + "Those will help you to get the newsletter personalized. See below for a list of variables and and macros.</p>",
            Label.CONTENT_XHTML);

    Accordion accordion = new Accordion();

    // Sender/*from w ww  .  j a  va 2  s .c  o  m*/
    StringBuilder senderText = new StringBuilder("<dl>");
    senderText.append("<dt>sender.uuid.id</dt><dd>The unique id of the sender</dd>");
    senderText.append("<dt>sender.name</dt><dd>The name of the sender</dd>");
    senderText.append("<dt>sender.email.from</dt><dd>The 'from' eMail of the sender</dd>");
    senderText.append("<dt>sender.email.replyto</dt><dd>The reply-to eMail of the sender</dd>");
    senderText.append("</dl>");
    Label senderLabel = new Label(senderText.toString(), Label.CONTENT_XHTML);
    VerticalLayout senderBox = new VerticalLayout();
    senderBox.addComponent(senderLabel);
    senderBox.setMargin(true);
    accordion.addTab(senderBox).setCaption("Sender");

    // Recipient
    StringBuilder recipientText = new StringBuilder("<dl>");
    recipientText.append("<dt>recipient.uuid.id</dt><dd>The unique id of the recipient</dd>");
    recipientText.append(
            "<dt>recipient.uuid.external</dt><dd>The external (e.g. imported from the live system) id of the recipient</dd>");
    recipientText.append("<dt>recipient.name</dt><dd>The name of the recipient</dd>");
    recipientText.append("<dt>recipient.email</dt><dd>The eMail of the recipient</dd>");
    recipientText.append("<dt>recipient.name.title</dt><dd>The reply-to eMail of the sender</dd>");
    recipientText.append("<dt>recipient.name.first</dt><dd>The reply-to eMail of the sender</dd>");
    recipientText.append("<dt>recipient.name.last</dt><dd>The reply-to eMail of the sender</dd>");
    recipientText.append("<dt>recipient.gender</dt><dd>The reply-to eMail of the sender</dd>");
    recipientText.append("<dt>recipient.birthday</dt><dd>The reply-to eMail of the sender</dd>");
    recipientText.append("<dt>recipient.language</dt><dd>The reply-to eMail of the sender</dd>");
    recipientText.append("<dt>recipient.location.city</dt><dd>The reply-to eMail of the sender</dd>");
    recipientText.append("<dt>recipient.location.country</dt><dd>The reply-to eMail of the sender</dd>");
    recipientText.append("</dl>");
    Label recipientLabel = new Label(recipientText.toString(), Label.CONTENT_XHTML);
    VerticalLayout recipientBox = new VerticalLayout();
    recipientBox.addComponent(recipientLabel);
    recipientBox.setMargin(true);
    accordion.addTab(recipientBox).setCaption("Recipient");

    // Mail
    StringBuilder mailText = new StringBuilder("<dl>");
    mailText.append("<dt>recipient.uuid.id</dt><dd>The unique id of the recipient</dd>");
    mailText.append(
            "<dt>recipient.uuid.external</dt><dd>The external (e.g. imported from the live system) id of the recipient</dd>");
    mailText.append("</dl>");
    Label mailLabel = new Label(mailText.toString(), Label.CONTENT_XHTML);
    VerticalLayout mailBox = new VerticalLayout();
    mailBox.addComponent(mailLabel);
    mailBox.setMargin(true);
    accordion.addTab(mailBox).setCaption("Mail");

    // Campaign
    StringBuilder campaignText = new StringBuilder("<dl>");
    campaignText.append("<dt>recipient.uuid.id</dt><dd>The unique id of the recipient</dd>");
    campaignText.append(
            "<dt>recipient.uuid.external</dt><dd>The external (e.g. imported from the live system) id of the recipient</dd>");
    campaignText.append("<dt>recipient.name</dt><dd>The name of the recipient</dd>");
    campaignText.append("<dt>recipient.email</dt><dd>The eMail of the recipient</dd>");
    campaignText.append("<dt>sender.email.replyto</dt><dd>The reply-to eMail of the sender</dd>");
    campaignText.append("</dl>");
    Label campaignLabel = new Label(campaignText.toString(), Label.CONTENT_XHTML);
    VerticalLayout campaignBox = new VerticalLayout();
    campaignBox.addComponent(campaignLabel);
    campaignBox.setMargin(true);
    accordion.addTab(campaignBox).setCaption("Campaign");

    vHelpLayout.addComponent(helpText1);
    vHelpLayout.addComponent(velocityLink);
    vHelpLayout.addComponent(helpText2);
    vHelpLayout.addComponent(accordion);

    helpRootPanel.addComponent(vHelpLayout);
}

From source file:com.vaadin.uitest.Accordions.java

License:Apache License

Accordion getAccordion(String caption) {
    TestIcon testIcon = new TestIcon(0);
    Accordion ac = new Accordion();
    ac.setCaption(caption);/*from  w w w .  j a  va 2  s .  co m*/
    ac.addTab(new VerticalLayout() {
        {
            setMargin(true);
            Label label = new Label(
                    "Fabio vel iudice vincam, sunt in culpa qui officia. Ut enim ad minim veniam, quis nostrud exercitation.");
            label.setWidth("100%");
            addComponent(label);
        }
    }, "First Caption", testIcon.get());
    ac.addTab(new VerticalLayout() {
        {
            setMargin(true);
            Label label = new Label("Gallia est omnis divisa in partes tres, quarum.");
            label.setWidth("100%");
            addComponent(label);
        }
    }, "Second Caption", testIcon.get());
    ac.addTab(new VerticalLayout() {
        {
            setMargin(true);
            Label label = new Label(
                    "Nihil hic munitissimus habendi senatus locus, nihil horum? Sed haec quis possit intrepidus aestimare tellus.");
            label.setWidth("100%");
            addComponent(label);
        }
    }, "Third Caption", testIcon.get());
    ac.addTab(new VerticalLayout() {
        {
            setMargin(true);
            Label label = new Label(
                    "Inmensae subtilitatis, obscuris et malesuada fames. Quisque ut dolor gravida, placerat libero vel, euismod.");
            label.setWidth("100%");
            addComponent(label);
        }
    }, "Custom Caption Style", testIcon.get()).setStyleName("color1");
    return ac;
}

From source file:de.akquinet.engineering.vaadin.vaangular.demo.VaangularUI.java

License:Apache License

@Override
protected void init(VaadinRequest request) {

    try {/*from  w w w .jav  a2s.com*/

        VerticalLayout mainLayout = new VerticalLayout();
        mainLayout.setMargin(true);
        mainLayout.setSpacing(true);
        Accordion accordion = new Accordion();

        weatherInfo = new Weather();
        final int[] times = new int[] { 10, 12, 14, 16 };
        final String[] entries = new String[] { "<strong>10</strong> sunny", "<strong>12</strong> windy",
                "<strong>14</strong> cold", "<strong>20</strong> superb" };
        weatherInfo.setDaten(times, entries);
        weatherInfo.addClickListener(new WeatherClickListener() {

            private static final long serialVersionUID = 1L;

            @Override
            public void click(int time, String entry) {
                showPopup(entry);
            }
        });
        weatherInfo.setButtonCaption("E-Mail (from angular)");
        accordion.addTab(weatherInfo, "Weather-Demo");
        mainLayout.addComponent(accordion);

        javaSend = new Button();
        javaSend.setCaption("E-Mail (from Java)");
        javaSend.addClickListener(new ClickListener() {

            private static final long serialVersionUID = 1L;

            @Override
            public void buttonClick(ClickEvent event) {
                int index = weatherInfo.getSliderPos();
                System.out.println("Button from w/in Java - value: " + index);
                showPopup(entries[index]);
            }
        });
        mainLayout.addComponent(javaSend);

        setContent(mainLayout);
    } catch (Exception e) {
        throw new RuntimeException("some stupid error occured!", e);
    }
}

From source file:de.decidr.ui.view.help.HelpDialogComponent.java

License:Apache License

public HelpDialogComponent() {
    super("DecidR Help");
    VerticalLayout layout = (VerticalLayout) getContent();
    layout.setSpacing(true);// w w  w  .j a v a2s . c o  m

    horLayout = new HorizontalLayout();
    horLayout.setSpacing(false);

    layout.addComponent(horLayout);
    horLayout.setSizeFull();

    closeButton = new Button("Close", new HideHelpDialogAction());
    showMainScreenHelp = new Button("Show in main window", new HideHelpDialogAction());
    showMainScreenHelp.addListener(new ShowHelpAction());

    acc = new Accordion();
    acc.setSizeFull();

    acc.addTab(new AccountManagementHelpComponent(), "Account Management", null);
    acc.addTab(new WorkflowParticipationHelpComponent(), "Workflow Participation", null);
    acc.addTab(new WorkflowInstanceManagementHelpComponent(), "Workflow Instance Management", null);
    acc.addTab(new TenantSettingsHelpComponent(), "Tenant Settings", null);
    acc.addTab(new TenantUserManagementHelpComponent(), "Tenant User Management", null);
    acc.addTab(new WorkflowModelingHelpComponent(), "Workflow Modeling", null);
    acc.addTab(new WorkflowModelEditorHelpComponent(), "Workflow Model Editor", null);
    acc.addTab(new TenantMonitoringHelpComponent(), "Tenant Monitoring", null);
    acc.addTab(new SystemSettingsHelpComponent(), "System Settings", null);
    acc.addTab(new SystemStatusHelpComponent(), "System Status", null);
    acc.addTab(new UserManagementHelpComponent(), "User Management", null);
    acc.addTab(new TenantManagementHelpComponent(), "Tenant Management", null);
    acc.addTab(new GlossaryHelpComponent(), "Glossary", null);

    horLayout.addComponent(showMainScreenHelp);
    horLayout.setComponentAlignment(showMainScreenHelp, Alignment.TOP_LEFT);
    horLayout.addComponent(closeButton);
    horLayout.setComponentAlignment(closeButton, Alignment.TOP_RIGHT);
    layout.addComponent(acc);
}

From source file:de.decidr.ui.view.HelpComponent.java

License:Apache License

/**
 * This method initializes the components of the help component.
 *//*w w w .  ja va  2s .  co  m*/
private void init() {
    verticalLayout = new VerticalLayout();
    this.setCompositionRoot(verticalLayout);

    acc = new Accordion();
    acc.setSizeFull();

    AccountManagementHelpComponent accMngHelp = new AccountManagementHelpComponent();
    WorkflowParticipationHelpComponent wfpHelp = new WorkflowParticipationHelpComponent();
    WorkflowInstanceManagementHelpComponent wfiMngHelp = new WorkflowInstanceManagementHelpComponent();
    TenantSettingsHelpComponent tsetHelp = new TenantSettingsHelpComponent();
    TenantUserManagementHelpComponent tuserHelp = new TenantUserManagementHelpComponent();
    WorkflowModelingHelpComponent wfmHelp = new WorkflowModelingHelpComponent();
    WorkflowModelEditorHelpComponent wfmeHelp = new WorkflowModelEditorHelpComponent();
    TenantMonitoringHelpComponent tmonHelp = new TenantMonitoringHelpComponent();
    SystemSettingsHelpComponent syssetHelp = new SystemSettingsHelpComponent();
    SystemStatusHelpComponent sysstatHelp = new SystemStatusHelpComponent();
    UserManagementHelpComponent userMngHelp = new UserManagementHelpComponent();
    TenantManagementHelpComponent tMngHelp = new TenantManagementHelpComponent();
    GlossaryHelpComponent glHelp = new GlossaryHelpComponent();

    acc.addTab(accMngHelp, "Account Management", null);
    acc.addTab(wfpHelp, "Workflow Participation", null);
    acc.addTab(wfiMngHelp, "Workflow Instance Management", null);
    acc.addTab(tsetHelp, "Tenant Settings", null);
    acc.addTab(tuserHelp, "Tenant User Management", null);
    acc.addTab(wfmHelp, "Workflow Modeling", null);
    acc.addTab(wfmeHelp, "Workflow Model Editor", null);
    acc.addTab(tmonHelp, "Tenant Monitoring", null);
    acc.addTab(syssetHelp, "System Settings", null);
    acc.addTab(sysstatHelp, "System Status", null);
    acc.addTab(userMngHelp, "User Management", null);
    acc.addTab(tMngHelp, "Tenant Management", null);
    acc.addTab(glHelp, "Glossary", null);

    acc.setSelectedTab(glHelp);

    verticalLayout.addComponent(acc);
}

From source file:de.escidoc.admintool.view.context.ContextAddView.java

License:Open Source License

private void addAdminDescriptorField() {
    adminDescriptorAccordion = new Accordion();
    adminDescriptorAccordion.setWidth(ViewConstants.FIELD_WIDTH);
    adminDescriptorAccordion.setSizeFull();

    final Panel accordionPanel = new Panel();
    accordionPanel.setContent(adminDescriptorAccordion);
    accordionPanel.setSizeFull();/* ww w .  j av  a 2  s .c o m*/
    accordionPanel.setWidth(ViewConstants.FIELD_WIDTH);

    final Button addButton = new Button(ViewConstants.ADD_LABEL);
    final Button editButton = new Button(ViewConstants.EDIT_LABEL);
    final Button delButton = new Button(ViewConstants.REMOVE_LABEL);

    addButton.setStyleName("small");
    editButton.setStyleName("small");
    delButton.setStyleName("small");

    addButton.addListener(new NewAdminDescriptorListener(mainWindow, adminDescriptorAccordion));
    editButton.addListener(new EditAdminDescriptorListener(mainWindow, adminDescriptorAccordion));
    delButton.addListener(new RemoveAdminDescriptorListener(adminDescriptorAccordion));

    panel.addComponent(LayoutHelper.create("Admin Descriptors", accordionPanel, LABEL_WIDTH + 2, 300, false,
            new Button[] { addButton, editButton, delButton }));
}

From source file:de.escidoc.admintool.view.context.ContextEditForm.java

License:Open Source License

private void addAdminDescriptor() {
    adminDescriptorAccordion = new Accordion();
    adminDescriptorAccordion.setWidth(ViewConstants.FIELD_WIDTH);
    adminDescriptorAccordion.setSizeFull();

    final Panel accordionPanel = new Panel();
    accordionPanel.setContent(adminDescriptorAccordion);
    accordionPanel.setSizeFull();/*from   ww  w  .  jav a 2s .  co m*/
    accordionPanel.setWidth(ViewConstants.FIELD_WIDTH);

    addAdminDescButton.setStyleName(AppConstants.SMALL_BUTTON);
    editAdminDescButton.setStyleName(AppConstants.SMALL_BUTTON);
    delAdminDescButton.setStyleName(AppConstants.SMALL_BUTTON);

    addAdminDescButton.addListener(new NewAdminDescriptorListener(mainWindow, adminDescriptorAccordion));
    editAdminDescButton.addListener(new EditAdminDescriptorListener(mainWindow, adminDescriptorAccordion));
    delAdminDescButton.addListener(new RemoveAdminDescriptorListener(adminDescriptorAccordion));

    form.addComponent(LayoutHelper.create("Admin Descriptors", accordionPanel, LABEL_WIDTH, 300, false,
            new Button[] { addAdminDescButton, editAdminDescButton, delAdminDescButton }));
}

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();//  w  w  w . j a v  a 2s.c om
    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:dev.DevUI.java

License:Open Source License

@Override
protected void init(VaadinRequest request) {

    final VerticalLayout mainLayout = new VerticalLayout();
    mainLayout.setSpacing(true);/*w w w  . j  a v a 2s.  c om*/
    mainLayout.setMargin(true);

    PluploadManager mgr = createUploadManager("Manager 1");
    PluploadManager mgr2 = createUploadManager("Manager 2");
    PluploadManager mgr3 = createChunkingUploadManager("Manager 3");

    mgr.getUploader().addFilter(new PluploadFilter("music", "mp3,flac"));

    VerticalLayout dropZone = new VerticalLayout() {
        {
            addComponent(new Label("Additional drop zone for music files"));
            setId("music-drop-zone");
        }
    };

    mgr.getUploader().addDropZone(dropZone);

    mgr2.getUploader().addFilter(new PluploadFilter("images", "jpg, jpeg, png"));
    mgr2.getUploader().setImageResize(
            new PluploadImageResize().setEnabled(true).setCrop(true).setHeight(200).setWidth(400));

    mainLayout.addComponent(mgr);
    mainLayout.addComponent(dropZone);
    mainLayout.addComponent(mgr2);
    mainLayout.addComponent(mgr3);

    PluploadField<File> field = createUploadField();
    final Form form = new Form();
    form.addField("file", field);
    field.addValidator(new NullValidator("file must not be null", false));
    Button submit = new Button("commit form");
    submit.addClickListener(new Button.ClickListener() {

        @Override
        public void buttonClick(Button.ClickEvent event) {
            form.commit();
        }
    });
    mainLayout.addComponent(form);
    mainLayout.addComponent(submit);

    PluploadField<byte[]> byteField = createByteUploadField();
    mainLayout.addComponent(byteField);

    final Plupload uploader = createSimpleUploader();
    uploader.setEnabled(false);
    Button b = new Button("toggle Enabled!", new Button.ClickListener() {

        @Override
        public void buttonClick(Button.ClickEvent event) {
            uploader.setEnabled(!uploader.isEnabled());
        }
    });
    mainLayout.addComponent(b);
    mainLayout.addComponent(uploader);
    final Counter c = new Counter();
    final Button.ClickListener l = new Button.ClickListener() {

        @Override
        public void buttonClick(Button.ClickEvent event) {
            Window w = new Window("win");

            if (c.get() < 5) {
                w.setContent(new Button("win", this));
                c.increment();
            } else {
                Field f = createUploadField();
                w.setContent(f);
                c.reset();
            }
            w.setWidth("400px");
            w.setHeight("200px");
            getUI().addWindow(w);
        }
    };

    Button win = new Button("Win");
    win.addClickListener(l);
    mainLayout.addComponent(win);

    Button modal = new Button("modal");
    modal.addClickListener(new Button.ClickListener() {

        @Override
        public void buttonClick(Button.ClickEvent event) {
            Window w = new Window("modal");

            final PluploadField f = createUploadField();
            w.addCloseListener(new Window.CloseListener() {

                @Override
                public void windowClose(Window.CloseEvent e) {
                    Notification.show("closed modal");
                    f.getUploader().destroy();
                }
            });
            VerticalLayout lay = new VerticalLayout();
            lay.addComponent(f);
            lay.addComponent(new Button("destroy", new Button.ClickListener() {

                @Override
                public void buttonClick(Button.ClickEvent event) {
                    f.getUploader().destroy();
                }
            }));

            w.setContent(lay);
            w.setModal(true);
            getUI().addWindow(w);
        }
    });

    Accordion acc = new Accordion();
    acc.addTab(this.createUploadManager("mgr3"), "uploader");
    acc.addTab(new HorizontalLayout(), "Stub");

    mainLayout.addComponent(acc);

    mainLayout.addComponent(modal);
    this.setContent(mainLayout);

}

From source file:org.eclipse.hawkbit.ui.common.confirmwindow.layout.AbstractConfirmationWindowLayout.java

License:Open Source License

private void createAccordian() {
    accordion = new Accordion();
    accordion.setSizeFull();
}