Example usage for com.vaadin.ui Alignment MIDDLE_CENTER

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

Introduction

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

Prototype

Alignment MIDDLE_CENTER

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

Click Source Link

Usage

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

public PasswordRecoveryWindow() {
    setModal(true);//  w  ww.j  a v a2 s  .com
    setResizable(false);
    setDraggable(false);
    setCaption(Language.get(Word.RESET_PW));
    addCloseShortcut(ShortcutAction.KeyCode.ENTER, null);

    windowLayout = new VerticalLayout();
    windowLayout.setMargin(false);
    windowLayout.setSizeUndefined();

    forms = new FormLayout();
    forms.setMargin(true);
    forms.setSizeUndefined();

    send = new Button(Language.get(Word.SEND_RESET_CODE));

    emailOrUsername = new TextField(Language.get(Word.USERNAME_OR_EMAIL));
    emailOrUsername.setMaxLength(256);
    emailOrUsername.focus();
    forms.addComponent(emailOrUsername);

    footer = new GridLayout(3, 1);
    footer.setSpacing(true);
    footer.addStyleName(ValoTheme.WINDOW_BOTTOM_TOOLBAR);
    footer.setWidth(100.0f, Sizeable.Unit.PERCENTAGE);

    Label placeholder = new Label();

    cancel = new Button(Language.get(Word.CANCEL));
    cancel.setIcon(VaadinIcons.CLOSE);
    cancel.addClickListener(ce -> {
        close();
    });
    cancel.setClickShortcut(ShortcutAction.KeyCode.ESCAPE, null);

    send.setIcon(VaadinIcons.CHECK);
    send.addStyleName(ValoTheme.BUTTON_PRIMARY);
    sendListener = send.addClickListener(ce -> changeWindow());
    send.setClickShortcut(ShortcutAction.KeyCode.ENTER, null);

    footer.setSizeUndefined();
    footer.setWidth("100%");
    footer.addComponents(placeholder, cancel, send);
    footer.setColumnExpandRatio(0, 1);//ExpandRatio(placeholder, 1);
    footer.setComponentAlignment(cancel, Alignment.MIDDLE_CENTER);
    footer.setComponentAlignment(send, Alignment.MIDDLE_CENTER);

    windowLayout.addComponents(forms, footer);
    windowLayout.setWidth("450px");

    setContent(windowLayout);
    //setWidth("450px");
}

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

private Component buildClippingsTab(User user) {
    HorizontalLayout root = new HorizontalLayout();
    root.setCaption(Language.get(Word.CLIPPINGS));
    root.setIcon(VaadinIcons.NEWSPAPER);
    root.setWidth("100%");
    root.setSpacing(true);//from w  ww.ja  v  a2  s .co  m
    root.setMargin(true);

    FormLayout formLayoutClippingDetails = new FormLayout();
    formLayoutClippingDetails.addStyleName(ValoTheme.FORMLAYOUT_LIGHT);
    root.addComponent(formLayoutClippingDetails);

    CheckBox checkBoxReceiveEmails = new CheckBox();
    checkBoxReceiveEmails.setValue(UserUtils.getEmailNewsletter(user));
    checkBoxReceiveEmails.addValueChangeListener(v -> UserUtils.setEmailNewsletter(user, v.getValue()));
    HorizontalLayout layoutCheckBoxReceiveEmails = new HorizontalLayout(checkBoxReceiveEmails);
    layoutCheckBoxReceiveEmails.setCaption(Language.get(Word.EMAIL_SUBSCRIPTION));
    layoutCheckBoxReceiveEmails.setMargin(false);
    layoutCheckBoxReceiveEmails.setSpacing(false);

    HorizontalLayout layoutAddNewClippingTime = new HorizontalLayout();
    layoutAddNewClippingTime.setMargin(false);
    layoutAddNewClippingTime.setCaption(Language.get(Word.ADD_CLIPPING_TIME));
    layoutAddNewClippingTime.setWidth("100%");

    InlineDateTimeField dateFieldNewClippingTime = new InlineDateTimeField();
    LocalDateTime value = LocalDateTime.now(ZoneId.of("Europe/Berlin"));
    dateFieldNewClippingTime.setValue(value);
    dateFieldNewClippingTime.setLocale(VaadinSession.getCurrent().getLocale());
    dateFieldNewClippingTime.setResolution(DateTimeResolution.MINUTE);
    dateFieldNewClippingTime.addStyleName("time-only");

    Button buttonAddClippingTime = new Button();
    buttonAddClippingTime.setIcon(VaadinIcons.PLUS);
    buttonAddClippingTime.addStyleName(ValoTheme.BUTTON_PRIMARY);
    buttonAddClippingTime.setClickShortcut(ShortcutAction.KeyCode.ENTER, null);
    buttonAddClippingTime.addClickListener(e -> {
        LocalTime generalTime = dateFieldNewClippingTime.getValue().toLocalTime();
        layoutClippingTimes.addComponent(getTimeRow(user, generalTime));
        UserUtils.addClippingSendTime(user, generalTime);
    });
    layoutAddNewClippingTime.addComponents(dateFieldNewClippingTime, buttonAddClippingTime);
    layoutAddNewClippingTime.setComponentAlignment(dateFieldNewClippingTime, Alignment.MIDDLE_LEFT);
    layoutAddNewClippingTime.setComponentAlignment(buttonAddClippingTime, Alignment.MIDDLE_CENTER);
    layoutAddNewClippingTime.setExpandRatio(dateFieldNewClippingTime, 5);

    layoutClippingTimes = new VerticalLayout();
    layoutClippingTimes.setMargin(new MarginInfo(true, false, false, true));
    layoutClippingTimes.setCaption(Language.get(Word.CLIPPING_TIMES));
    layoutClippingTimes.setWidth("100%");
    layoutClippingTimes.addStyleName("times");

    Set<LocalTime> userTimes = user.getClippingTime();
    userTimes.forEach(t -> layoutClippingTimes.addComponent(getTimeRow(user, t)));

    formLayoutClippingDetails.addComponents(layoutCheckBoxReceiveEmails, layoutAddNewClippingTime,
            layoutClippingTimes);

    return root;
}

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

private Component getTimeRow(User user, LocalTime time) {
    HorizontalLayout layoutTimeRow = new HorizontalLayout();
    layoutTimeRow.setWidth("100%");

    DateTimeFormatter formatter = DateTimeFormatter.ofLocalizedTime(FormatStyle.SHORT);
    Label labelTime = new Label(time.format(formatter));

    Button buttonDelete = new Button(VaadinIcons.TRASH);
    buttonDelete.addStyleName(ValoTheme.BUTTON_DANGER);
    buttonDelete.setWidth("80px");
    buttonDelete.addClickListener(e -> {
        if (layoutClippingTimes.getComponentCount() > 1) {
            layoutClippingTimes.removeComponent(layoutTimeRow);
            UserUtils.removeClippingSendTime(user, time);
        } else {/*  w  w  w . j a va 2s. c  o  m*/
            VaadinUtils.errorNotification(Language.get(Word.AT_LREAST_ONE_TIME));
        }
    });

    layoutTimeRow.addComponents(labelTime, buttonDelete);
    layoutTimeRow.setComponentAlignment(labelTime, Alignment.MIDDLE_LEFT);
    layoutTimeRow.setComponentAlignment(buttonDelete, Alignment.MIDDLE_CENTER);
    layoutTimeRow.setExpandRatio(labelTime, 5);

    return layoutTimeRow;
}

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

public RegisterWindow() {
    setModal(true);//from w  w  w  . j  av  a 2 s .co  m
    setResizable(false);
    setDraggable(false);
    setCaption(Language.get(Word.REGISTER));
    addCloseShortcut(KeyCode.ENTER, null);

    Button save = new Button(Language.get(Word.REGISTER));

    VerticalLayout windowLayout = new VerticalLayout();
    windowLayout.setMargin(false);
    windowLayout.setSizeUndefined();

    FormLayout forms = new FormLayout();
    forms.setMargin(true);
    forms.setSizeUndefined();

    TextField firstName = new TextField(Language.get(Word.FIRST_NAME));
    firstName.focus();
    firstName.setMaxLength(20);
    firstName.addValueChangeListener(event -> {
        String firstNameError = UserUtils.checkName(event.getValue());
        if (!firstNameError.isEmpty()) {
            firstName.setComponentError(new UserError(firstNameError, AbstractErrorMessage.ContentMode.HTML,
                    ErrorMessage.ErrorLevel.INFORMATION));
            VaadinUtils.infoNotification(firstNameError);
            save.setEnabled(setError(firstName, true));
        } else {
            firstName.setComponentError(null);
            boolean enabled = setError(firstName, false);
            save.setEnabled(enabled);
        }
    });
    forms.addComponent(firstName);

    TextField lastName = new TextField(Language.get(Word.LAST_NAME));
    lastName.setMaxLength(20);
    lastName.addValueChangeListener(event -> {
        String lastNameError = UserUtils.checkName(event.getValue());
        if (!lastNameError.isEmpty()) {
            lastName.setComponentError(new UserError(lastNameError, AbstractErrorMessage.ContentMode.HTML,
                    ErrorMessage.ErrorLevel.INFORMATION));
            VaadinUtils.infoNotification(lastNameError);
            save.setEnabled(setError(lastName, true));
        } else {
            lastName.setComponentError(null);
            save.setEnabled(setError(lastName, false));
        }
    });
    forms.addComponent(lastName);

    TextField userName = new TextField(Language.get(Word.USERNAME));
    userName.setMaxLength(20);
    userName.addValueChangeListener(event -> {
        String userNameError = UserUtils.checkUsername(event.getValue());
        if (!userNameError.isEmpty()) {
            userName.setComponentError(new UserError(userNameError, AbstractErrorMessage.ContentMode.HTML,
                    ErrorMessage.ErrorLevel.INFORMATION));
            VaadinUtils.infoNotification(userNameError);
            save.setEnabled(setError(userName, true));
        } else {
            userName.setComponentError(null);
            save.setEnabled(setError(userName, false));

        }
    });
    forms.addComponent(userName);

    TextField email1 = new TextField(Language.get(Word.EMAIL));
    email1.setMaxLength(256);
    email1.addValueChangeListener(event -> {
        String email1Error = UserUtils.checkEmail(event.getValue().toLowerCase());
        if (!email1Error.isEmpty()) {
            email1.setComponentError(new UserError(email1Error, AbstractErrorMessage.ContentMode.HTML,
                    ErrorMessage.ErrorLevel.INFORMATION));
            VaadinUtils.infoNotification(email1Error);
            save.setEnabled(setError(email1, true));
        } else {
            email1.setComponentError(null);
            save.setEnabled(setError(email1, false));
        }
    });
    forms.addComponent(email1);

    TextField email2 = new TextField(Language.get(Word.EMAIL_AGAIN));
    email2.setMaxLength(256);
    email2.addValueChangeListener(event -> {
        String email2Error = UserUtils.checkEmail(event.getValue().toLowerCase())
                + UserUtils.checkSecondEmail(email1.getValue().toLowerCase(), event.getValue().toLowerCase());
        if (!email2Error.isEmpty()) {
            email2.setComponentError(new UserError(email2Error, AbstractErrorMessage.ContentMode.HTML,
                    ErrorMessage.ErrorLevel.INFORMATION));
            VaadinUtils.infoNotification(email2Error);
            save.setEnabled(setError(email2, true));
        } else {
            email2.setComponentError(null);
            save.setEnabled(setError(email2, false));
        }
    });
    forms.addComponent(email2);

    ProgressBar strength = new ProgressBar();

    PasswordField password1 = new PasswordField(Language.get(Word.PASSWORD));
    password1.setMaxLength(51);
    password1.addValueChangeListener(event -> {
        String password1Error = UserUtils.checkPassword(event.getValue());
        strength.setValue(UserUtils.calculatePasswordStrength(event.getValue()));
        if (!password1Error.isEmpty()) {
            password1.setComponentError(new UserError(password1Error, AbstractErrorMessage.ContentMode.HTML,
                    ErrorMessage.ErrorLevel.INFORMATION));
            VaadinUtils.infoNotification(password1Error);
            save.setEnabled(setError(password1, true));
        } else {
            password1.setComponentError(null);
            save.setEnabled(setError(password1, false));
        }

    });
    forms.addComponent(password1);

    strength.setWidth("184px");
    strength.setHeight("1px");
    forms.addComponent(strength);

    PasswordField password2 = new PasswordField(Language.get(Word.PASSWORD_AGAIN));
    password2.setMaxLength(51);
    password2.addValueChangeListener(event -> {
        String password2Error = UserUtils.checkPassword(event.getValue())
                + UserUtils.checkSecondPassword(password1.getValue(), event.getValue());
        if (!password2Error.isEmpty()) {
            password2.setComponentError(new UserError(password2Error, AbstractErrorMessage.ContentMode.HTML,
                    ErrorMessage.ErrorLevel.INFORMATION));
            VaadinUtils.infoNotification(password2Error);
            save.setEnabled(setError(password2, true));
        } else {
            password2.setComponentError(null);
            save.setEnabled(setError(password2, false));
        }
    });
    forms.addComponent(password2);

    GridLayout footer = new GridLayout(3, 1);
    footer.setSpacing(true);
    footer.setSizeUndefined();
    footer.addStyleName(ValoTheme.WINDOW_BOTTOM_TOOLBAR);
    footer.setWidth(100.0f, Unit.PERCENTAGE);

    Label placeholder = new Label();

    Button cancel = new Button(Language.get(Word.CANCEL));
    cancel.setIcon(VaadinIcons.CLOSE);
    cancel.addClickListener(ce -> {
        close();
    });
    cancel.setClickShortcut(KeyCode.ESCAPE, null);

    save.setEnabled(false);
    save.setIcon(VaadinIcons.CHECK);
    save.addStyleName(ValoTheme.BUTTON_PRIMARY);
    save.addClickListener(ce -> {
        try {
            User user = UserUtils.registerUser(userName.getValue(), password1.getValue(), password2.getValue(),
                    email1.getValue().toLowerCase(), email2.getValue().toLowerCase(), firstName.getValue(),
                    lastName.getValue());
            UserUtils.setCurrentUser(user);
            close();
            UI.getCurrent().addWindow(ActivateWindow.get());
        } catch (UserCreationException ex) {
            Log.error("Registration failed", ex);
            VaadinUtils.errorNotification(Language.get(Word.REG_FAILED));
        }
    });
    save.setClickShortcut(KeyCode.ENTER, null);

    footer.addComponents(placeholder, cancel, save);
    footer.setColumnExpandRatio(0, 1);//ExpandRatio(placeholder, 1);
    footer.setComponentAlignment(cancel, Alignment.MIDDLE_CENTER);
    footer.setComponentAlignment(save, Alignment.MIDDLE_CENTER);

    windowLayout.addComponent(forms);
    windowLayout.addComponent(footer);

    setContent(windowLayout);
}

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

License:Open Source License

private VerticalLayout getPrognoseMethodenInfos() {
    VerticalLayout vl = new VerticalLayout();
    infoText0 = new Label("<h1>Prognosemethode</h1>");
    infoText0.setContentMode(Label.CONTENT_XHTML);
    infoText1 = new Label("<h2>Methode zur Parametereingabe</h2>");
    infoText1.setContentMode(Label.CONTENT_XHTML);

    gl = new GridLayout(2, 4);
    gl.setSizeFull();/*  www.j a  v a  2s. c o m*/
    gl.setColumnExpandRatio(1, 1.0f);

    gl.addComponent(iconStochastic, 0, 0);
    gl.setComponentAlignment(iconStochastic, Alignment.MIDDLE_CENTER);
    gl.addComponent(stochasticHeadline, 1, 0);
    gl.addComponent(stochasticText, 1, 1);

    gl.addComponent(iconDeterministic, 0, 2);
    gl.setComponentAlignment(iconDeterministic, Alignment.MIDDLE_CENTER);
    gl.addComponent(deterministicHeadline, 1, 2);
    gl.addComponent(deterministicText, 1, 3);

    vl.addComponent(infoText0);
    vl.addComponent(infoText1);
    vl.addComponent(gl);

    return vl;
}

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

License:Open Source License

private VerticalLayout getEingabeMethodeInfo() {
    VerticalLayout vl = new VerticalLayout();
    headline0 = new Label("<h1>Eingabemethode</h1>");
    headline0.setContentMode(Label.CONTENT_XHTML);
    headline1 = new Label("<h2>Methode zur Berechnung des Unternehmenswertes</h2>");
    headline1.setContentMode(Label.CONTENT_XHTML);

    gl = new GridLayout(2, 6);
    gl.setSizeFull();//ww w  . j a  va2 s.  com
    gl.setColumnExpandRatio(1, 1.0f);

    gl.addComponent(iconFCF, 0, 0);
    gl.setComponentAlignment(iconFCF, Alignment.MIDDLE_CENTER);
    gl.addComponent(fcfHeadline, 1, 0);
    gl.addComponent(fcfText, 1, 1);

    //      gl.addComponent(iconUKV, 0, 2);
    //      gl.setComponentAlignment(iconUKV, Alignment.MIDDLE_CENTER);
    //      gl.addComponent(ukvHeadline, 1, 2);
    //      gl.addComponent(ukvText, 1, 3);
    //      
    //      gl.addComponent(iconGKV, 0 , 4);
    //      gl.setComponentAlignment(iconGKV, Alignment.MIDDLE_CENTER);
    //      gl.addComponent(gkvHeadline, 1, 4);
    //      gl.addComponent(gkvText, 1, 5);

    vl.addComponent(headline0);
    vl.addComponent(headline1);
    vl.addComponent(gl);

    return vl;
}

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

License:Open Source License

private VerticalLayout getBerechnungsMethodeInfo() {
    VerticalLayout vl = new VerticalLayout();
    headline0 = new Label("<h1>Berechnungsmethoden</h1>");
    headline0.setContentMode(Label.CONTENT_XHTML);
    headline1 = new Label("<h2>Methode zur Prognoseerstellung</h2>");
    headline1.setContentMode(Label.CONTENT_XHTML);

    gl = new GridLayout(2, 6);
    gl.setSizeFull();/*  w ww.  j a  v a 2s .c  om*/
    gl.setColumnExpandRatio(1, 1.0f);

    gl.addComponent(iconAPV, 0, 0);
    gl.setComponentAlignment(iconAPV, Alignment.MIDDLE_CENTER);
    gl.addComponent(apvHeadline, 1, 0);
    gl.addComponent(apvText, 1, 1);

    //      gl.addComponent(iconFTE, 0, 2);
    //      gl.setComponentAlignment(iconFTE, Alignment.MIDDLE_CENTER);
    //      gl.addComponent(fteHeadline, 1, 2);
    //      gl.addComponent(fteText, 1, 3);
    //      
    //      gl.addComponent(iconWACC, 0 , 4);
    //      gl.setComponentAlignment(iconWACC, Alignment.MIDDLE_CENTER);
    //      gl.addComponent(waccHeadline, 1, 4);
    //      gl.addComponent(waccText, 1, 5);

    vl.addComponent(headline0);
    vl.addComponent(headline1);
    vl.addComponent(gl);

    return vl;
}

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
 *///  w  w w . ja v  a  2s . 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

/**
 * Diese Methode setzt die zweit bergebenen Views in den unteren rechten Bereich
 * des Layouts. Also sozusagen den aktuellen Content der Anwendung.
 * Der rechte Bereich dieses SplitPanels dient als Detailbereich zum linken Bereich.
 * Beispielsweise beim Aufrufen der Anwendung links die Projektliste und rechts
 * die Details zum jeweils ausgewhlten Projekt.
 *
 * @param leftView/*from   w ww . ja  v  a  2 s.  co m*/
 * : linker Bereich
 * @param rightView
 * : rechter Bereich (Details zum linken Bereich)
 * @author Christian Scherer, Marco Glaser
 */
@Override
public void showView(View leftView, View rightView) {
    if (bottomLayout.getComponentIndex(horizontalSplitPanelRight) == -1) {
        bottomLayout.replaceComponent(bottomRightLayout, horizontalSplitPanelRight);
        bottomLayout.setComponentAlignment(horizontalSplitPanelRight, Alignment.MIDDLE_CENTER);
    }
    horizontalSplitPanelRight.setFirstComponent((Component) leftView);
    horizontalSplitPanelRight.setSecondComponent((Component) rightView);
}

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

License:Open Source License

/**
 * @author Tobias Lindner/*from   w w  w .ja  v a2s. c  o  m*/
 */
public void showExtendedView(View exView) {
    bottomLayout.replaceComponent(horizontalSplitPanelRight, bottomRightLayout);
    bottomLayout.setComponentAlignment(bottomRightLayout, Alignment.MIDDLE_CENTER);
    bottomRightLayout.addComponent((Component) exView);
}