Example usage for com.vaadin.ui Alignment TOP_CENTER

List of usage examples for com.vaadin.ui Alignment TOP_CENTER

Introduction

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

Prototype

Alignment TOP_CENTER

To view the source code for com.vaadin.ui Alignment TOP_CENTER.

Click Source Link

Usage

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

License:Open Source License

/**
 * Precondition: {DatasetView#table} has to be initialized. e.g. with
 * {DatasetView#buildFilterTable} If it is not, strange behaviour has to be expected. builds the
 * Layout of this view./*www .  j a  v a  2  s. c  om*/
 */
private void buildLayout() {
    this.vert.removeAllComponents();
    this.vert.setWidth("100%");

    // Table (containing datasets) section
    VerticalLayout tableSectionDatasets = new VerticalLayout();
    VerticalLayout tableSectionSamples = new VerticalLayout();
    HorizontalLayout tableSectionContent = new HorizontalLayout();
    HorizontalLayout sampletableSectionContent = new HorizontalLayout();

    tableSectionContent.setMargin(new MarginInfo(false, false, false, false));
    sampletableSectionContent.setMargin(new MarginInfo(false, false, false, false));

    // tableSectionContent.setCaption("Datasets");
    // tableSectionContent.setIcon(FontAwesome.FLASK);

    descriptionLabel.setWidth("100%");
    tableSectionDatasets.addComponent(descriptionLabel);

    sampletableSectionContent.addComponent(sampleGrid);
    tableSectionContent.addComponent(this.datasetTable);

    tableSectionDatasets.setMargin(new MarginInfo(true, false, false, true));
    tableSectionDatasets.setSpacing(true);

    tableSectionSamples.setMargin(new MarginInfo(true, false, true, true));
    tableSectionSamples.setSpacing(true);

    tableSectionDatasets.addComponent(tableSectionContent);

    tableSectionSamples.addComponent(sampletableSectionContent);
    tableSectionSamples.addComponent(exportSamples);

    this.vert.addComponent(tableSectionDatasets);

    sampleGrid.setWidth("100%");
    datasetTable.setWidth("100%");
    tableSectionDatasets.setWidth("100%");

    tableSectionSamples.setWidth("100%");
    sampletableSectionContent.setWidth("100%");

    tableSectionContent.setWidth("100%");

    HorizontalLayout buttonLayout = new HorizontalLayout();
    buttonLayout.setMargin(new MarginInfo(false, false, false, true));
    buttonLayout.setHeight(null);
    buttonLayout.setSpacing(true);

    this.download.setEnabled(false);
    buttonLayout.setSpacing(true);

    Button checkAll = new Button("Select all datasets");
    checkAll.addClickListener(new ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            for (Object itemId : datasetTable.getItemIds()) {
                ((CheckBox) datasetTable.getItem(itemId).getItemProperty("Select").getValue()).setValue(true);
            }
        }
    });

    Button uncheckAll = new Button("Unselect all datasets");
    uncheckAll.addClickListener(new ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            for (Object itemId : datasetTable.getItemIds()) {
                ((CheckBox) datasetTable.getItem(itemId).getItemProperty("Select").getValue()).setValue(false);
            }
        }
    });

    buttonLayout.addComponent(exportData);
    buttonLayout.addComponent(checkAll);
    buttonLayout.addComponent(uncheckAll);
    // buttonLayout.addComponent(visualize);
    buttonLayout.addComponent(this.download);

    String content = "<p> In case of multiple file selections, Project Browser will create a tar archive.</p>"
            + "<hr>" + "<p> If you need help on extracting a tar archive file, follow the tips below: </p>"
            + "<p>" + FontAwesome.WINDOWS.getHtml() + " Windows </p>"
            + "<p> To open/extract TAR file on Windows, you can use 7-Zip, Easy 7-Zip, PeaZip.</p>" + "<hr>"
            + "<p>" + FontAwesome.APPLE.getHtml() + " MacOS </p>"
            + "<p> To open/extract TAR file on Mac, you can use Mac OS built-in utility Archive Utility,<br> or third-part freeware. </p>"
            + "<hr>" + "<p>" + FontAwesome.LINUX.getHtml() + " Linux </p>"
            + "<p> You need to use command tar. The tar is the GNU version of tar archiving utility. <br> "
            + "To extract/unpack a tar file, type: $ tar -xvf file.tar</p>";

    PopupView tooltip = new PopupView(new helpers.ToolTip(content));
    tooltip.setHeight("44px");

    HorizontalLayout help = new HorizontalLayout();
    help.setSizeFull();
    HorizontalLayout helpContent = new HorizontalLayout();
    // helpContent.setSizeFull();

    help.setMargin(new MarginInfo(false, false, false, true));
    Label helpText = new Label("Attention: Click here before Download!");
    helpContent.addComponent(new Label(FontAwesome.QUESTION_CIRCLE.getHtml(), ContentMode.HTML));
    helpContent.addComponent(helpText);
    helpContent.addComponent(tooltip);
    helpContent.setSpacing(true);

    help.addComponent(helpContent);
    help.setComponentAlignment(helpContent, Alignment.TOP_CENTER);

    /**
     * prepare download.
     */
    download.setResource(new ExternalResource("javascript:"));
    download.setEnabled(false);

    for (final Object itemId : this.datasetTable.getItemIds()) {
        setCheckedBox(itemId, (String) this.datasetTable.getItem(itemId).getItemProperty("CODE").getValue());
    }

    this.datasetTable.addItemClickListener(new ItemClickListener() {
        @Override
        public void itemClick(ItemClickEvent event) {
            if (!event.isDoubleClick() & !((boolean) datasetTable.getItem(event.getItemId())
                    .getItemProperty("isDirectory").getValue())) {
                String datasetCode = (String) datasetTable.getItem(event.getItemId()).getItemProperty("CODE")
                        .getValue();
                String datasetFileName = (String) datasetTable.getItem(event.getItemId())
                        .getItemProperty("File Name").getValue();
                URL url = null;
                try {
                    Resource res = null;
                    Object parent = datasetTable.getParent(event.getItemId());
                    if (parent != null) {

                        String parentDatasetFileName = (String) datasetTable.getItem(parent)
                                .getItemProperty("File Name").getValue();
                        try {
                            url = datahandler.getOpenBisClient().getUrlForDataset(datasetCode,
                                    parentDatasetFileName + "/" + URLEncoder.encode(datasetFileName, "UTF-8"));
                        } catch (UnsupportedEncodingException e) {
                            // TODO Auto-generated catch block
                            e.printStackTrace();
                        }
                    } else {
                        try {
                            url = datahandler.getOpenBisClient().getUrlForDataset(datasetCode,
                                    URLEncoder.encode(datasetFileName, "UTF-8"));
                        } catch (UnsupportedEncodingException e) {
                            // TODO Auto-generated catch block
                            e.printStackTrace();
                        }
                    }

                    Window subWindow = new Window();
                    VerticalLayout subContent = new VerticalLayout();
                    subContent.setMargin(true);
                    subContent.setSizeFull();
                    subWindow.setContent(subContent);
                    QbicmainportletUI ui = (QbicmainportletUI) UI.getCurrent();
                    Boolean visualize = false;

                    if (datasetFileName.endsWith(".pdf")) {
                        QcMlOpenbisSource re = new QcMlOpenbisSource(url);
                        StreamResource streamres = new StreamResource(re, datasetFileName);
                        streamres.setMIMEType("application/pdf");
                        res = streamres;
                        visualize = true;
                    }

                    if (datasetFileName.endsWith(".png")) {
                        QcMlOpenbisSource re = new QcMlOpenbisSource(url);
                        StreamResource streamres = new StreamResource(re, datasetFileName);
                        streamres.setMIMEType("application/png");
                        res = streamres;
                        visualize = true;
                    }

                    if (datasetFileName.endsWith(".qcML")) {
                        QcMlOpenbisSource re = new QcMlOpenbisSource(url);
                        StreamResource streamres = new StreamResource(re, datasetFileName);
                        streamres.setMIMEType("text/xml");
                        res = streamres;
                        visualize = true;
                    }

                    if (datasetFileName.endsWith(".alleles")) {
                        QcMlOpenbisSource re = new QcMlOpenbisSource(url);
                        StreamResource streamres = new StreamResource(re, datasetFileName);
                        streamres.setMIMEType("text/plain");
                        res = streamres;
                        visualize = true;
                    }

                    if (datasetFileName.endsWith(".tsv")) {
                        QcMlOpenbisSource re = new QcMlOpenbisSource(url);
                        StreamResource streamres = new StreamResource(re, datasetFileName);
                        streamres.setMIMEType("text/plain");
                        res = streamres;
                        visualize = true;
                    }

                    if (datasetFileName.endsWith(".log")) {
                        QcMlOpenbisSource re = new QcMlOpenbisSource(url);
                        StreamResource streamres = new StreamResource(re, datasetFileName);
                        streamres.setMIMEType("text/plain");
                        res = streamres;
                        visualize = true;
                    }

                    if (datasetFileName.endsWith(".html")) {
                        QcMlOpenbisSource re = new QcMlOpenbisSource(url);
                        StreamResource streamres = new StreamResource(re, datasetFileName);
                        streamres.setMIMEType("text/html");
                        res = streamres;
                        visualize = true;
                    }

                    if (datasetFileName.endsWith(".GSvar")) {
                        QcMlOpenbisSource re = new QcMlOpenbisSource(url);
                        StreamResource streamres = new StreamResource(re, datasetFileName);
                        streamres.setMIMEType("text/plain");
                        res = streamres;
                        visualize = true;
                    }

                    if (visualize) {
                        BrowserFrame frame = new BrowserFrame("", res);

                        frame.setSizeFull();
                        subContent.addComponent(frame);

                        // Center it in the browser window
                        subWindow.center();
                        subWindow.setModal(true);
                        subWindow.setSizeUndefined();
                        subWindow.setHeight("75%");
                        subWindow.setWidth("75%");
                        subWindow.setResizable(false);

                        frame.setSizeFull();
                        frame.setHeight("100%");
                        // frame.setHeight((int) (ui.getPage().getBrowserWindowHeight() * 0.9), Unit.PIXELS);

                        // Open it in the UI
                        ui.addWindow(subWindow);
                    }

                } catch (MalformedURLException e) {
                    LOGGER.error(String.format("Visualization failed because of malformedURL for dataset: %s",
                            datasetCode));
                    helpers.Utils.Notification("No file attached.",
                            "Given dataset has no file attached to it!! Please Contact your project manager. Or check whether it already has some data",
                            "error");

                    // Notification
                    // .show(
                    // "Given dataset has no file attached to it!! Please Contact your project manager. Or
                    // check whether it already has some data",
                    // Notification.Type.ERROR_MESSAGE);
                }
            }
        }
    });
    this.vert.addComponent(help);
    this.vert.addComponent(buttonLayout);
    this.vert.addComponent(tableSectionSamples);

}

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

License:Open Source License

void buildEmptyComments() {

    // add comments
    VerticalLayout addComment = new VerticalLayout();
    addComment.setMargin(true);/*w ww .  ja  v  a 2s  .c  om*/
    addComment.setWidth(100, Unit.PERCENTAGE);
    final TextArea comments = new TextArea();
    comments.setInputPrompt("Write your comment here...");
    comments.setWidth(100, Unit.PERCENTAGE);
    comments.setRows(2);
    Button commentsOk = new Button("Add Comment");
    commentsOk.addStyleName(ValoTheme.BUTTON_FRIENDLY);
    commentsOk.addClickListener(new ClickListener() {
        /**
         * 
         */
        private static final long serialVersionUID = -5369241494545155677L;

        public void buttonClick(ClickEvent event) {
            if ("".equals(comments.getValue()))
                return;

            String newComment = comments.getValue();
            // reset comments
            comments.setValue("");
            // use some date format
            Date dNow = new Date();
            SimpleDateFormat ft = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");

            Note note = new Note();
            note.setComment(newComment);
            note.setUsername(controller.getUser());
            note.setTime(ft.format(dNow));

            // show it now
            // pastcomments.getContainerDataSource().addItem(note);
            notes.add(note);

            // TODO write back
            Label commentsLabel = new Label(translateComments(notes), ContentMode.HTML);
            commentsPanel.setContent(commentsLabel);

            // write back to openbis
            if (!controller.addNote(note)) {
                Notification.show("Could not add comment to sample. How did you do that?");
            }

        }

    });

    HorizontalLayout inputPrompt = new HorizontalLayout();
    inputPrompt.addComponent(comments);
    inputPrompt.addComponent(commentsOk);

    inputPrompt.setWidth(50, Unit.PERCENTAGE);
    inputPrompt.setComponentAlignment(commentsOk, Alignment.TOP_RIGHT);
    inputPrompt.setExpandRatio(comments, 1.0f);

    // addComment.addComponent(comments);
    // addComment.addComponent(commentsOk);

    addComment.addComponent(commentsPanel);
    addComment.addComponent(inputPrompt);

    // addComment.setComponentAlignment(comments, Alignment.TOP_CENTER);
    // addComment.setComponentAlignment(commentsOk, Alignment.MIDDLE_CENTER);

    addComment.setComponentAlignment(commentsPanel, Alignment.TOP_CENTER);
    addComment.setComponentAlignment(inputPrompt, Alignment.MIDDLE_CENTER);

    mainlayout.addComponent(addComment);

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

    // mainlayout.addComponent(commentsPanel);
    // mainlayout.setComponentAlignment(commentsPanel,
    // Alignment.TOP_CENTER);
}

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

private Component buildFooter(User user) {
    HorizontalLayout footer = new HorizontalLayout();
    footer.addStyleName(ValoTheme.WINDOW_BOTTOM_TOOLBAR);
    footer.setWidth(100.0f, Unit.PERCENTAGE);

    Button cancelButton = new Button(Language.get(Word.CANCEL));
    cancelButton.setIcon(VaadinIcons.CLOSE);
    cancelButton.addClickListener(event -> {
        close();//from   www . ja  va 2 s  .c  om
    });

    saveButton = new Button(Language.get(Word.SAVE));
    saveButton.setIcon(VaadinIcons.CHECK);
    saveButton.addStyleName(ValoTheme.BUTTON_PRIMARY);
    saveButton.addClickListener(event -> {
        boolean error = false;
        if (!user.getFirstName().equals(firstNameField.getValue())) {
            boolean success = UserUtils.changeFirstName(user, firstNameField.getValue());
            if (!success) {
                error = true;
            }
        }
        if (!user.getLastName().equals(lastNameField.getValue())) {
            boolean success = UserUtils.changeLastName(user, lastNameField.getValue());
            if (!success) {
                error = true;
            }
        }
        if (!user.getUsername().equals(usernameField.getValue())) {
            boolean success = UserUtils.changeUsername(user, usernameField.getValue());
            if (!success) {
                error = true;
            }
        }
        if (!user.getEmail().equals(emailField.getValue())) {
            UI.getCurrent().addWindow(ActivateWindow.get());
            boolean success = UserUtils.changeEmail(user, user.getEmail(), emailField.getValue(),
                    emailField.getValue());
            if (!success) {
                error = true;
            }
        }
        boolean wrongPW = false;
        if (!password1Field.isEmpty() && password1Field.getValue().equals(password2Field.getValue())) {
            wrongPW = !UserUtils.changePassword(user, oldPasswordField.getValue(), password1Field.getValue(),
                    password2Field.getValue());
        }
        if (error) {
            VaadinUtils.errorNotification(Language.get(Word.UNEXPECTED_ERROR));
        } else if (wrongPW) {
            VaadinUtils.errorNotification(Language.get(Word.WRONG_PASSWORD));
        } else {
            VaadinUtils.infoNotification(Language.get(Word.SUCCESSFULLY_SAVED));
            close();
        }
    });
    saveButton.focus();

    Label placeholder = new Label();

    footer.addComponents(placeholder, cancelButton, saveButton);
    footer.setExpandRatio(placeholder, 5);
    footer.setComponentAlignment(cancelButton, Alignment.TOP_CENTER);
    footer.setComponentAlignment(saveButton, Alignment.TOP_CENTER);
    return footer;
}

From source file:dhbw.ka.mwi.businesshorizon2.ui.initialscreen.InitialScreenViewImpl.java

License:Open Source License

/**
 * Diese Methode setzt das Layout fr den Screen fest sowie den Titel der Anwendung.
 * Zustzlich wird hier noch das Men erzeugt und die Buttons, um ein Projekt zu bearbeiten,
 * ein neues anzulegen oder ein bestehendes zu lschen.
 *
 * @author Christian Scherer, Mirko Gpfrich, Marco Glaser
 *//*from w  ww. ja  v  a2s .c  o  m*/
private void generateUi() {

    mainLayout = new VerticalLayout();
    leftLayout = new HorizontalLayout();
    rightLayout = new VerticalLayout();
    topRightLayout = new HorizontalLayout();
    leftContentLayout = new VerticalLayout();
    bottomLeftLayout = new VerticalLayout();
    bottomRightLayout = new VerticalLayout();
    bottomRightLayout.setHeight(90, UNITS_PERCENTAGE);
    bottomRightLayout.setWidth(100, UNITS_PERCENTAGE);
    bottomRightLayout.addStyleName("horizontalBottom");
    bottomLayout = new VerticalLayout();
    gap = new Label();
    leftContainerSpacing = new VerticalLayout();
    progressBar = new Embedded(null);
    progressBarGap = new Label();
    splitter = new Label("<hr style='border:none;background-color:black;height:2px'>", Label.CONTENT_XHTML);
    splitter2 = new Label("<hr style='border:none;background-color:black;height:2px'>", Label.CONTENT_XHTML);
    menuButtonsLayout = new HorizontalLayout();
    homeButtonLayout = new VerticalLayout();
    logoutButtonLayout = new VerticalLayout();
    homeButton = new Button();
    logoutButton = new Button();
    homeButtonLabel = new Label("Startseite");
    logoutButtonLabel = new Label("Ausloggen");
    descriptionLayout = new VerticalLayout();
    bottomGap = new Label();
    faqLayout = new HorizontalLayout();
    homeIcon = new Embedded(null, new ThemeResource("./images/icons/newIcons/1418766062_house_home-128.png"));
    middleGap = new Label();

    mainLayout.setSizeFull();
    mainLayout.setStyleName("mainLayout");
    leftLayout.setSizeFull();
    leftLayout.setStyleName("leftContainer");
    rightLayout.setSizeFull();
    rightLayout.setStyleName("rightContainer");
    bottomLayout.setSizeFull();
    bottomLeftLayout.setSizeFull();
    //      bottomRightLayout.setWidth(90, UNITS_PERCENTAGE);
    //      bottomRightLayout.setStyleName("projectDetailsLayout");
    topRightLayout.setSizeFull();
    leftContentLayout.setSizeFull();
    progressBar.setSizeUndefined();
    progressBar.setVisible(false);
    //   leftContentLayout.setHeight(Sizeable.SIZE_UNDEFINED, 0);

    leftLogoLayout = new VerticalLayout();
    logo = new Embedded(null, new ThemeResource("images/logo_businesshorizon_vertical.png"));

    gap.setHeight("10px");
    bottomGap.setHeight("40px");
    middleGap.setHeight("10px");
    progressBarGap.setHeight("15px");
    leftContainerSpacing.setSizeFull();

    homeIcon.setWidth(70, UNITS_PIXELS);
    homeIcon.setHeight(70, UNITS_PIXELS);

    seitenLabel = new Label("Startseite");
    seitenLabel.setStyleName("seitenLabel");
    seitenLabel.setWidth(Sizeable.SIZE_UNDEFINED, 0);
    descriptionLabel = new Label("bersicht ber alle Projekte");
    descriptionLabel.setStyleName("descriptionLabel");
    descriptionLabel.setWidth(Sizeable.SIZE_UNDEFINED, 0);
    descriptionLayout.setWidth(100, UNITS_PERCENTAGE);
    descriptionLayout.setHeight(80, UNITS_PIXELS);
    splitter.setWidth(98, UNITS_PERCENTAGE);
    splitter2.setWidth(98, UNITS_PERCENTAGE);
    menuButtonsLayout.setWidth(100, UNITS_PERCENTAGE);
    menuButtonsLayout.setHeight(Sizeable.SIZE_UNDEFINED, 0);
    homeButtonLayout.setSizeFull();
    logoutButtonLayout.setSizeFull();
    homeButton.setHeight(30, UNITS_PIXELS);
    homeButton.setWidth(30, UNITS_PIXELS);
    homeButton.setStyleName("homeButton");
    logoutButton.setHeight(30, UNITS_PIXELS);
    logoutButton.setWidth(30, UNITS_PIXELS);
    logoutButton.setStyleName("logoutButton");
    homeButtonLabel.setWidth(Sizeable.SIZE_UNDEFINED, 0);
    homeButtonLabel.setStyleName("topBarButtonLabel");
    logoutButtonLabel.setWidth(Sizeable.SIZE_UNDEFINED, 0);
    logoutButtonLabel.setStyleName("topBarButtonLabel");
    faqLayout.setWidth(100, UNITS_PERCENTAGE);
    faqLayout.setHeight(50, UNITS_PIXELS);

    horizontalSplitPanel = new HorizontalSplitPanel();
    horizontalSplitPanel.setSplitPosition(30, UNITS_PERCENTAGE);
    horizontalSplitPanel.setLocked(true);
    horizontalSplitPanel.setStyleName("horizontalMain");
    verticalSplitPanel = new VerticalSplitPanel();
    verticalSplitPanel.setSplitPosition(126, UNITS_PIXELS);
    verticalSplitPanel.setLocked(true);
    verticalSplitPanel.setWidth(90, UNITS_PERCENTAGE);
    verticalSplitPanel.setHeight(100, UNITS_PERCENTAGE);
    horizontalSplitPanelRight = new HorizontalSplitPanel();
    horizontalSplitPanelRight.setSplitPosition(30, UNITS_PERCENTAGE);
    horizontalSplitPanelRight.setLocked(true);
    horizontalSplitPanelRight.addStyleName("horizontalBottom");
    horizontalSplitPanelRight.setHeight(90, UNITS_PERCENTAGE);
    horizontalSplitPanelRight.setWidth(100, UNITS_PERCENTAGE);

    descriptionLayout.addComponent(descriptionLabel);
    leftLogoLayout.addComponent(logo);
    leftContentLayout.addComponent(gap);
    leftContentLayout.addComponent(homeIcon);
    leftContentLayout.addComponent(seitenLabel);
    leftContentLayout.addComponent(splitter);
    leftContentLayout.addComponent(descriptionLayout);
    leftContentLayout.addComponent(splitter2);
    leftContentLayout.addComponent(middleGap);
    leftContentLayout.addComponent(menuButtonsLayout);
    leftContentLayout.addComponent(progressBarGap);
    leftContentLayout.addComponent(progressBar);
    leftContentLayout.addComponent(leftContainerSpacing);
    leftContentLayout.addComponent(bottomGap);
    leftContentLayout.setExpandRatio(leftContainerSpacing, 1.0f);
    leftLayout.addComponent(leftLogoLayout);
    leftLayout.addComponent(leftContentLayout);
    leftLayout.setExpandRatio(leftContentLayout, 1.0f);
    descriptionLayout.setComponentAlignment(descriptionLabel, Alignment.MIDDLE_CENTER);
    leftLogoLayout.setComponentAlignment(logo, Alignment.MIDDLE_CENTER);
    leftContentLayout.setComponentAlignment(homeIcon, Alignment.TOP_CENTER);
    leftContentLayout.setComponentAlignment(seitenLabel, Alignment.TOP_CENTER);
    leftContentLayout.setComponentAlignment(progressBar, Alignment.MIDDLE_CENTER);
    //      leftContentLayout.setComponentAlignment(descriptionLabel, Alignment.TOP_CENTER);
    menuButtonsLayout.addComponent(homeButtonLayout);
    menuButtonsLayout.addComponent(logoutButtonLayout);
    homeButtonLayout.addComponent(homeButton);
    homeButtonLayout.addComponent(homeButtonLabel);
    logoutButtonLayout.addComponent(logoutButton);
    logoutButtonLayout.addComponent(logoutButtonLabel);

    homeButtonLayout.setComponentAlignment(homeButton, Alignment.TOP_CENTER);
    homeButtonLayout.setComponentAlignment(homeButtonLabel, Alignment.MIDDLE_CENTER);
    logoutButtonLayout.setComponentAlignment(logoutButton, Alignment.TOP_CENTER);
    logoutButtonLayout.setComponentAlignment(logoutButtonLabel, Alignment.MIDDLE_CENTER);

    leftLogoLayout.setWidth(Sizeable.SIZE_UNDEFINED, 0);
    leftLogoLayout.setHeight(100, UNITS_PERCENTAGE);
    leftContentLayout.setSizeFull();

    rightLayout.addComponent(verticalSplitPanel);
    bottomLayout.addComponent(horizontalSplitPanelRight);

    horizontalSplitPanel.addComponent(leftLayout);
    horizontalSplitPanel.addComponent(rightLayout);

    verticalSplitPanel.addComponent(topRightLayout);
    verticalSplitPanel.addComponent(bottomLayout);

    //      horizontalSplitPanelRight.setSecondComponent(bottomRightLayout);

    rightLayout.setComponentAlignment(verticalSplitPanel, Alignment.MIDDLE_CENTER);
    bottomLayout.setComponentAlignment(horizontalSplitPanelRight, Alignment.MIDDLE_CENTER);

    mainLayout.addComponent(horizontalSplitPanel);

    homeButton.addListener(new ClickListener() {

        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(ClickEvent event) {
            ConfirmDialog.show(event.getButton().getWindow(), "Warnung",
                    "Beim Abbruch gehen Ihre Eingaben verloren! Mchten Sie zur Startseite zurckkehren?",
                    "Okay", "Abbrechen", new ConfirmDialog.Listener() {

                        private static final long serialVersionUID = 1L;

                        @Override
                        public void onClose(ConfirmDialog dialog) {
                            if (dialog.isConfirmed()) {
                                presenter.showInitialScreen();
                            } else {

                            }
                        }
                    });

        }

    });

    logoutButton.addListener(new ClickListener() {

        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(ClickEvent event) {
            ConfirmDialog.show(event.getButton().getWindow(), "Warnung",
                    "Mchten Sie sich wirklich ausloggen?", "Okay", "Abbrechen", new ConfirmDialog.Listener() {

                        private static final long serialVersionUID = 1L;

                        @Override
                        public void onClose(ConfirmDialog dialog) {
                            if (dialog.isConfirmed()) {
                                presenter.doLogout();
                            } else {

                            }
                        }
                    });
        }

    });

    setContent(mainLayout);

    addProjectButton = new TopBarButton("addProjectButton", "Neues Projekt");
    addProjectButton.addLabel("hinzufgen");
    addProjectButtonListener = new ClickListener() {

        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(ClickEvent event) {
            presenter.showProjectCreationScreen();
            String[] desc = new String[2];
            desc[0] = "Geben Sie hier den Namen und";
            desc[1] = "eine Beschreibung ein";
            setPageDescription("./images/icons/newIcons/1418831401_circle_add_plus-128.png",
                    "Neues Projekt anlegen", desc);
        }

    };
    addTopButton(addProjectButton, addProjectButtonListener);

    editProjectButton = new TopBarButton("editProjectButton", "Projekt bearbeiten");
    editProjectButtonListener = new ClickListener() {

        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(ClickEvent event) {
            presenter.showProjectEditScreen();
            String[] desc = new String[2];
            desc[0] = "ndern Sie hier Name oder";
            desc[1] = "Beschreibung des Projekts";
            setPageDescription("./images/icons/newIcons/1418765965_editor_pencil_pen_edit_write-128.png",
                    "Projekt bearbeiten", desc);
        }

    };
    addTopButton(editProjectButton, editProjectButtonListener);
    deleteProjectButton = new TopBarButton("deleteProjectButton", "Projekt lschen");
    deleteProjectButton.setButtonWidth(25);
    deleteProjectButtonListener = new ClickListener() {

        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(ClickEvent event) {
            final Project project = projectProxy.getSelectedProject();

            logger.debug("Projekt-loeschen Button aus dem Hauptfenster aufgerufen.");

            ConfirmDialog.show(getWindow(), project.getName() + " lschen?",
                    "Wollen sie das Projekt wirklich lschen?", "Ja", "Nein", new ConfirmDialog.Listener() {

                        private static final long serialVersionUID = 1L;

                        @Override
                        public void onClose(ConfirmDialog dialog) {
                            if (dialog.isConfirmed()) {
                                presenter.removeProject(project);
                            } else {

                            }
                        }
                    });

        }

    };
    addTopButton(deleteProjectButton, deleteProjectButtonListener);

    createImportButton();
    topRightLayout.addComponent(importButton);
    topRightLayout.setComponentAlignment(importButton, Alignment.MIDDLE_CENTER);

    exportButton = new TopBarButton("exportButton", "Projekte");
    exportButton.addLabel("exportieren");
    exportButtonListener = new ClickListener() {

        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(ClickEvent event) {
            File exportFile = presenter.exportProjects();
            event.getButton().getWindow().open(new Downloader(exportFile, getApplication()));
        }

    };
    addTopButton(exportButton, exportButtonListener);

    topBarSpacing = new VerticalLayout();
    topBarSpacing.setSizeFull();
    topRightLayout.addComponent(topBarSpacing);
    topRightLayout.setExpandRatio(topBarSpacing, 1.0f);

}

From source file:dhbw.ka.mwi.businesshorizon2.ui.initialscreen.InitialScreenViewImpl.java

License:Open Source License

public void createImportButton() {
    importButton = new VerticalLayout();
    importButton.setWidth(150, com.vaadin.terminal.Sizeable.UNITS_PIXELS);
    importButton.setHeight(80, com.vaadin.terminal.Sizeable.UNITS_PIXELS);
    importButton.setStyleName("topBarButtonContainer");
    UploadReceiver receiver = new UploadReceiver(eventBus);
    Upload upload = new Upload(null, receiver);
    upload.setButtonCaption("");
    upload.setImmediate(true);//from   www .j a v  a  2 s . com
    upload.addListener(receiver);
    upload.setStyleName("importButton");
    upload.setWidth(30, com.vaadin.terminal.Sizeable.UNITS_PIXELS);
    upload.setHeight(30, com.vaadin.terminal.Sizeable.UNITS_PIXELS);
    Label gap = new Label();
    gap.setHeight("5px");
    Label label = new Label("Projekte");
    label.setStyleName("topBarButtonLabel");
    label.setSizeUndefined();
    Label label2 = new Label("importieren");
    label2.setStyleName("topBarButtonLabel");
    label2.setSizeUndefined();
    VerticalLayout labelLayout = new VerticalLayout();
    labelLayout.setHeight(45, com.vaadin.terminal.Sizeable.UNITS_PIXELS);
    labelLayout.setWidth(100, UNITS_PERCENTAGE);
    importButton.addComponent(upload);
    labelLayout.addComponent(label);
    labelLayout.addComponent(label2);
    importButton.addComponent(gap);
    importButton.addComponent(labelLayout);
    importButton.setComponentAlignment(upload, Alignment.TOP_CENTER);
    labelLayout.setComponentAlignment(label, Alignment.MIDDLE_CENTER);
    labelLayout.setComponentAlignment(label2, Alignment.MIDDLE_CENTER);
}

From source file:dhbw.ka.mwi.businesshorizon2.ui.initialscreen.InitialScreenViewImpl.java

License:Open Source License

public void setPageDescription(String source, String page, String[] description) {
    int labelCount = descriptionLayout.getComponentCount();
    Label oldLabel;/*from  w w  w .  jav  a2s  .c  om*/
    int i;
    homeIcon.setSource(new ThemeResource(source));
    seitenLabel.setValue(page);
    for (i = 0; i < labelCount && i < description.length; i++) {
        oldLabel = (Label) descriptionLayout.getComponent(i);
        oldLabel.setValue(description[i]);
        if (i == 0) {
            descriptionLayout.setComponentAlignment(oldLabel, Alignment.BOTTOM_CENTER);
        } else {
            descriptionLayout.setComponentAlignment(oldLabel, Alignment.TOP_CENTER);
        }
    }
    //      descriptionLabel.setValue(description[0]);
    for (int a = i; a < description.length; a++) {
        Label newLabel = new Label(description[a]);
        newLabel.setStyleName("descriptionLabel");
        newLabel.setWidth(Sizeable.SIZE_UNDEFINED, 0);
        descriptionLayout.addComponent(newLabel);
        descriptionLayout.setComponentAlignment(newLabel, Alignment.TOP_CENTER);
    }
    for (int b = i; b < labelCount; b++) {
        descriptionLayout.removeComponent(descriptionLayout.getComponent(b));
    }
}

From source file:dhbw.ka.mwi.businesshorizon2.ui.login.LogInScreenViewImplv2.java

License:Open Source License

/**
 * Diese Methode setzt den Titel (im Browser-Fenster) zu
 * "Business Horizon 2" und erstellt die LogIn Maske mit Listener. Der
 * Listener prft ruft die im LogIn Event gesammelten LogIn-Daten und
 * bergibt sie dem presenter zur Kontrolle. Je nach ausgang der Konrolle
 * wird dann eine Fehlermeldung aufgerufen. Zudem wird mittels dem
 * "registrieren" Button und dessen Listener eine Dialogfenster
 * bereitgestellt mit dessen sich ein neuer Anwender registrieren kann.
 * /*from w  w w  .j  ava 2  s  .  c o  m*/
 * @author Christian Scherer
 */
private void generateUi() {
    setCaption("Business Horizon 3");
    logger.debug("berschrift fr Browser erstellt");

    horizontal = new HorizontalLayout();

    vSplitPanel = new VerticalSplitPanel();
    vSplitPanel.setSplitPosition(70, Sizeable.UNITS_PERCENTAGE);
    vSplitPanel.setLocked(true);

    verticalTop = new VerticalLayout();
    verticalTop.setSizeFull();
    verticalTop.setMargin(true, true, true, true);
    verticalTop.setStyleName("loginTop");

    //Erzeugt ein Label mit dem Willkommens-Text neben dem Logo
    welcome = new Label("Willkommen bei");
    welcome.setStyleName("welcomeSlogan");

    //Erezeugt ein Label mit dem Beschreibungstext
    welcomeText = new Label(
            "Mithilfe dieser Software knnen Sie Ihre zuknftige Unternehmenswerte berechnen lassen. Hierzu stehen Ihnen verschiedene Methoden zur Verfgung, die Ihnen unterschiedliche Herangehensweisen ermglichen  je nachdem, welche Daten Ihnen zur Verfgung stehen. ");
    welcomeText.setStyleName("welcomeText");
    welcomeText.setSizeFull();

    textLayout = new HorizontalLayout();
    textLayout.setWidth(50, Sizeable.UNITS_PERCENTAGE);
    textLayout.addComponent(welcomeText);
    textLayout.setComponentAlignment(welcomeText, Alignment.TOP_RIGHT);

    iconLabel = new Label();
    iconLabel.setIcon(new ThemeResource("images/Logo_businesshorizon.png"));
    iconLabel.setWidth(40, Sizeable.UNITS_PERCENTAGE);
    iconLabel.setStyleName("logo");

    welcomeLayout = new HorizontalLayout();
    welcomeLayout.setSizeFull();
    welcomeLayout.addComponent(welcome);
    welcomeLayout.setComponentAlignment(welcome, Alignment.BOTTOM_CENTER);

    welcomeLayout.addComponent(iconLabel);
    welcomeLayout.setComponentAlignment(iconLabel, Alignment.BOTTOM_RIGHT);

    //Fgt den Beschreibungs-Text dem Bildschirm hinzu
    verticalTop.addComponent(textLayout);
    verticalTop.setComponentAlignment(textLayout, Alignment.TOP_RIGHT);

    verticalTop.addComponent(welcomeLayout);
    verticalTop.setComponentAlignment(welcomeLayout, Alignment.BOTTOM_RIGHT);

    login = new LoginForm();
    //Zur Anmeldung muss die Mailadresse als Benutzername angegeben werden
    login.setUsernameCaption("Mailadresse");
    login.setPasswordCaption("Passwort");
    login.setWidth(null);
    login.setStyleName("login_form");
    login.addListener(new LoginForm.LoginListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void onLogin(LoginEvent event) {
            presenter.doLogin(event.getLoginParameter("username"), event.getLoginParameter("password"));

        }
    });

    //VerticalLayout login = generateLogin();

    horizontal.addComponent(login);
    horizontal.setComponentAlignment(login, Alignment.TOP_CENTER);

    HorizontalLayout landingBtnLayout = new HorizontalLayout();

    loginBtnLayout = new VerticalLayout();
    loginBtn = new Button("", this);
    loginBtn.setWidth(100, Sizeable.UNITS_PIXELS);
    loginBtn.setHeight(100, Sizeable.UNITS_PIXELS);
    loginBtn.addStyleName("loginBtn");

    loginBtnLabel = new Label("Login");
    loginBtnLabel.setWidth(100, Sizeable.UNITS_PIXELS);
    loginBtnLabel.addStyleName("loginBtnLabel");

    loginBtnLayout.addComponent(loginBtn);
    loginBtnLayout.addComponent(loginBtnLabel);

    //      landingBtnLayout.addComponent(loginBtnLayout);

    //horizontal.addComponent(loginBtnLayout);
    //horizontal.setComponentAlignment(loginBtnLayout, Alignment.TOP_RIGHT);

    registerBtnLayout = new VerticalLayout();
    registerBtnLayout.setSizeUndefined();

    registerBtn = new Button("", this);
    registerBtn.setSizeUndefined();
    registerBtn.setHeight(100, Sizeable.UNITS_PIXELS);
    registerBtn.setWidth(100, Sizeable.UNITS_PIXELS);
    registerBtn.addStyleName("registerBtn");

    registerBtnLabel = new Label("Registrieren");
    registerBtnLabel.setWidth(100, Sizeable.UNITS_PIXELS);
    addStyleName("registerBtnLabel");

    registerBtnLayout.addComponent(registerBtn);
    registerBtnLayout.addComponent(registerBtnLabel);

    landingBtnLayout.addComponent(registerBtnLayout);

    passwordForgotBtn = new Button("Passwort vergessen", this);
    passwordForgotBtn.setEnabled(false);

    horizontal.addComponent(landingBtnLayout);
    horizontal.setComponentAlignment(landingBtnLayout, Alignment.TOP_RIGHT);
    horizontal.setMargin(new MarginInfo(true, true, true, true));
    horizontal.setSizeFull();
    //vertical.addComponent(passwordForgotBtn);
    //vertical.setComponentAlignment(passwordForgotBtn, Alignment.MIDDLE_CENTER);

    logger.debug("LogIn UI erstellt und Listener gesetzt");

    vSplitPanel.setFirstComponent(verticalTop);
    vSplitPanel.setSecondComponent(horizontal);

    setContent(vSplitPanel);
}

From source file:dhbw.ka.mwi.businesshorizon2.ui.parameterScreen.ParameterScreenViewImpl.java

License:Open Source License

/**
* Diese Methode setzt das Layout fr den Screen fest sowie den Titel der Anwendung.
*
* @author Christian Scherer, Mirko Gpfrich, Marco Glaser
*//*from  w  w  w  .ja  va 2 s .c  o  m*/
private void generateUi() {

    mainLayout.setSizeFull();
    mainLayout.setStyleName("mainLayout");
    leftLayout.setSizeFull();
    leftLayout.setStyleName("leftContainer");
    rightLayout.setSizeFull();
    bottomLayout.setSizeFull();
    bottomLeftLayout.setSizeFull();
    //leftContentLayout.setWidth(85, UNITS_PERCENTAGE);
    //leftContentLayout.setHeight(100, UNITS_PERCENTAGE);
    topRightLayout.setStyleName("topBar");
    leftContentLayout.setSizeFull();

    horizontalSplitPanel = new HorizontalSplitPanel();
    horizontalSplitPanel.setSplitPosition(30, UNITS_PERCENTAGE);
    horizontalSplitPanel.setLocked(true);
    horizontalSplitPanel.setStyleName("horizontalMain");
    verticalSplitPanel = new VerticalSplitPanel();
    verticalSplitPanel.setSplitPosition(15, UNITS_PERCENTAGE);
    verticalSplitPanel.setLocked(true);
    verticalSplitPanel.setWidth(90, UNITS_PERCENTAGE);
    verticalSplitPanel.setHeight(100, UNITS_PERCENTAGE);
    horizontalSplitPanelRight = new HorizontalSplitPanel();
    horizontalSplitPanelRight.setSplitPosition(30, UNITS_PERCENTAGE);
    horizontalSplitPanelRight.setLocked(true);
    horizontalSplitPanelRight.addStyleName("horizontalBottom");
    horizontalSplitPanelRight.setHeight(90, UNITS_PERCENTAGE);
    horizontalSplitPanelRight.setWidth(100, UNITS_PERCENTAGE);

    leftL = new Label("links");
    rightTopL = new Label("rechts Oben");
    rightBottomL = new Label("rechts Unten");
    leftBottomL = new Label("links Unten");

    rightLayout.addComponent(verticalSplitPanel);
    //   topRightLayout.addComponent(rightTopL);
    //   bottomRightLayout.addComponent(rightBottomL);
    //   bottomLeftLayout.addComponent(leftBottomL);
    bottomLayout.addComponent(horizontalSplitPanelRight);

    horizontalSplitPanel.addComponent(leftLayout);
    horizontalSplitPanel.addComponent(rightLayout);

    verticalSplitPanel.addComponent(topRightLayout);
    verticalSplitPanel.addComponent(bottomLayout);

    horizontalSplitPanelRight.addComponent(bottomLeftLayout);
    horizontalSplitPanelRight.addComponent(bottomRightLayout);

    rightLayout.setComponentAlignment(verticalSplitPanel, Alignment.MIDDLE_CENTER);
    bottomLayout.setComponentAlignment(horizontalSplitPanelRight, Alignment.MIDDLE_CENTER);

    mainLayout.addComponent(horizontalSplitPanel);

    setContent(mainLayout);

    //linke Seite Logo
    leftLogolayout = new VerticalLayout();
    leftLogolayout.setWidth(Sizeable.SIZE_UNDEFINED, 0);
    leftLogolayout.setHeight(100, UNITS_PERCENTAGE);

    logo = new Embedded(null, new ThemeResource("images/Logo_businesshorizon.png"));

    leftLogolayout.addComponent(logo);
    leftLogolayout.setComponentAlignment(logo, Alignment.MIDDLE_CENTER);

    //linke Seite Infos
    gap = new Label();
    gap.setHeight("10px");

    titleIcon = new Embedded(null, new ThemeResource(
            "./images/icons/newIcons/1418775155_device_board_presentation_content_chart-128.png"));
    titleIcon.setWidth(70, UNITS_PIXELS);
    titleIcon.setHeight(70, UNITS_PIXELS);

    seitenLabel = new Label("Schritt 2");
    seitenLabel.setStyleName("seitenLabel");
    seitenLabel.setWidth(Sizeable.SIZE_UNDEFINED, 0);

    splitter = new Label("<hr style='border:none;background-color:black;height:2px'>", Label.CONTENT_XHTML);
    splitter.setWidth(98, UNITS_PERCENTAGE);

    descriptionLabel = new Label("Stochastische Methode:");
    descriptionLabel.setStyleName("descriptionLabel");
    descriptionLabel.setWidth(Sizeable.SIZE_UNDEFINED, 0);

    descriptionLabel2 = new Label("Bitte geben Sie die Parameter ein");
    descriptionLabel2.setStyleName("descriptionLabel");
    descriptionLabel2.setWidth(Sizeable.SIZE_UNDEFINED, 0);

    descriptionLayout = new VerticalLayout();
    descriptionLayout.addComponent(descriptionLabel);
    descriptionLayout.addComponent(descriptionLabel2);
    descriptionLayout.setComponentAlignment(descriptionLabel, Alignment.TOP_CENTER);
    descriptionLayout.setComponentAlignment(descriptionLabel2, Alignment.MIDDLE_CENTER);
    descriptionLayout.setWidth(100, UNITS_PERCENTAGE);
    descriptionLayout.setHeight(60, UNITS_PIXELS);

    splitter2 = new Label("<hr style='border:none;background-color:black;height:2px'>", Label.CONTENT_XHTML);
    splitter2.setWidth(98, UNITS_PERCENTAGE);

    middleGap = new Label();
    middleGap.setHeight("10px");

    menuButtonsLayout = new HorizontalLayout();
    menuButtonsLayout.setWidth(100, UNITS_PERCENTAGE);
    menuButtonsLayout.setHeight(Sizeable.SIZE_UNDEFINED, 0);

    homeButtonLayout = new VerticalLayout();
    homeButtonLayout.setSizeFull();

    homeButton = new Button();
    homeButton.setHeight(30, UNITS_PIXELS);
    homeButton.setWidth(30, UNITS_PIXELS);
    homeButton.setStyleName("homeButton");

    homeButtonLabel = new Label("Startseite");
    homeButtonLabel.setWidth(Sizeable.SIZE_UNDEFINED, 0);
    homeButtonLabel.setStyleName("topBarButtonLabel");

    homeButtonLayout.addComponent(homeButton);
    homeButtonLayout.addComponent(homeButtonLabel);
    homeButtonLayout.setComponentAlignment(homeButton, Alignment.TOP_CENTER);
    homeButtonLayout.setComponentAlignment(homeButtonLabel, Alignment.MIDDLE_CENTER);

    menuButtonsLayout.addComponent(homeButtonLayout);
    //
    //   accountButtonLayout = new VerticalLayout();
    //   accountButtonLayout.setSizeFull();
    //   
    //   accountButton = new Button();
    //   accountButton.setHeight(30, UNITS_PIXELS);
    //   accountButton.setWidth(30, UNITS_PIXELS);
    //   accountButton.setStyleName("accountButton");
    //   
    //   accountButtonLabel = new Label("Mein Konto");
    //   accountButtonLabel.setWidth(Sizeable.SIZE_UNDEFINED, 0);
    //   accountButtonLabel.setStyleName("topBarButtonLabel");
    //   
    //   accountButtonLayout.addComponent(accountButton);
    //   accountButtonLayout.addComponent(accountButtonLabel);
    //   accountButtonLayout.setComponentAlignment(accountButton, Alignment.TOP_CENTER);;
    //   accountButtonLayout.setComponentAlignment(accountButtonLabel, Alignment.MIDDLE_CENTER);
    //   
    //   menuButtonsLayout.addComponent(accountButtonLayout);

    bottomGap = new Label();
    bottomGap.setHeight("380px");

    leftContentLayout.addComponent(gap);
    leftContentLayout.addComponent(titleIcon);
    leftContentLayout.addComponent(seitenLabel);
    leftContentLayout.addComponent(splitter);
    leftContentLayout.addComponent(descriptionLayout);
    leftContentLayout.addComponent(splitter2);
    leftContentLayout.addComponent(middleGap);
    leftContentLayout.addComponent(menuButtonsLayout);
    leftContentLayout.addComponent(bottomGap);

    leftContentLayout.setComponentAlignment(seitenLabel, Alignment.TOP_CENTER);
    leftContentLayout.setComponentAlignment(titleIcon, Alignment.TOP_CENTER);

    leftLayout.addComponent(leftLogolayout);
    leftLayout.addComponent(leftContentLayout);
    leftLayout.setExpandRatio(leftContentLayout, 1.0f);

    //Buttonleiste oben

    TopBarButton button = new TopBarButton("saveButton", "Speichern");
    addTopButton(button.getButtonComponent());
    button = new TopBarButton("resetInput", "Daten zurcksetzen");
    addTopButton(button.getButtonComponent());
    button = new TopBarButton("back", "Zurck");
    addTopButton(button.getButtonComponent());
    button = new TopBarButton("abbort", "Abbrechen");
    addTopButton(button.getButtonComponent());
    button.getButton().addListener(new Button.ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            System.out.println("cancel on safe");
            presenter.abbrechen();
        }

    });

}

From source file:dhbw.ka.mwi.businesshorizon2.ui.resultscreen.morescenarios.MoreScenarioResultViewImpl.java

License:Open Source License

public void addChartScenario(int numScenario, ColumnChart chart) {
    switch (numScenario) {
    case 0://from  w w  w  .  j  a  va 2 s.c  om
        chart.setSizeFull();
        capitalStructureChartScenario1.removeAllComponents();
        capitalStructureChartScenario1.addComponent(chart);
        capitalStructureChartScenario1.setHeight(240, UNITS_PIXELS);
        capitalStructureChartScenario1.setWidth(200, UNITS_PIXELS);
        capitalStructureChartScenario1.setComponentAlignment(chart, Alignment.TOP_CENTER);
        break;

    case 1:
        chart.setSizeFull();
        capitalStructureChartScenario2.removeAllComponents();
        capitalStructureChartScenario2.addComponent(chart);
        capitalStructureChartScenario2.setHeight(240, UNITS_PIXELS);
        capitalStructureChartScenario2.setWidth(200, UNITS_PIXELS);
        capitalStructureChartScenario2.setComponentAlignment(chart, Alignment.TOP_CENTER);
        break;

    case 2:
        capitalStructureChartScenario3.removeAllComponents();
        capitalStructureChartScenario3.addComponent(chart);
        capitalStructureChartScenario3.setHeight(240, UNITS_PIXELS);
        capitalStructureChartScenario3.setWidth(200, UNITS_PIXELS);
        capitalStructureChartScenario3.setComponentAlignment(chart, Alignment.TOP_LEFT);
        break;
    }
}

From source file:ed.cracken.pos.ui.purchases.PurchaserView.java

public PurchaserView() {

    summary = SellSummaryTo.builder().count(BigDecimal.ZERO).total(BigDecimal.ZERO).build();
    setSizeFull();//from w  w w  .j  a  v a 2  s.  co  m
    addStyleName("crud-view");
    viewLogic = new PurchaserLogic(this);
    paymentView = new PurchaserPaymentView();
    grid = new PurchaserGrid();
    grid.addSelectionListener((SelectionEvent event) -> {
        viewLogic.editItem(grid.getSelectedRow());
    });

    VerticalLayout mainContent = new VerticalLayout();
    HorizontalLayout foot;
    mainContent.addComponent(createTopBar());
    mainContent.addComponent(grid);
    mainContent.addComponent(foot = createFooter());
    mainContent.setMargin(true);
    mainContent.setSpacing(true);
    mainContent.setSizeFull();
    mainContent.setExpandRatio(grid, 1);
    mainContent.setStyleName("crud-main-layout");
    mainContent.setComponentAlignment(foot, Alignment.TOP_CENTER);
    addComponent(mainContent);
    addComponent(purchaseItemForm = new PurchaseItemForm(viewLogic));
}