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.ka.mwi.businesshorizon2.ui.initialscreen.InitialScreenViewImpl.java

License:Open Source License

/**
 * Diese Methode fgt einen Button zur Button-Leiste (topRightLayout) zusammen 
 * mit einem ClickListener hinzu./* w  ww. j a va2s  . c o  m*/
 *
 * @param button
 * : Der Button
 * @param listener
 * : Der ClickListener
 * @author Marco Glaser
 */
public void addTopButton(TopBarButton button, ClickListener listener) {
    if (listener != null) {
        button.getButtonComponent().addListener(listener);
    }
    topRightLayout.addComponent(button);
    topRightLayout.setComponentAlignment(button, Alignment.MIDDLE_CENTER);
}

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

License:Open Source License

/**
 * Diese Methode fgt einen Button zur Button-Leiste (topRightLayout) an der gewnschten Stelle hinzu
 * und lscht den Button der vorher an dieser Stelle war.
 *
 * @param button//from w w  w.jav  a 2s  . c  o m
 * : Der Button
 * @param index
 * : Stelle, wo der Button gesetzt werden soll
 * @param listener
 * : Der ClickListener
 * @author Marco Glaser
 */
public void setTopButton(TopBarButton button, int index, ClickListener listener) {
    if (listener != null) {
        button.getButtonComponent().addListener(listener);
    }
    int maxIndex = topRightLayout.getComponentCount() - 1; //1 abziehen wegen dem Spacing rechts
    if (index < maxIndex) {
        Component comp = topRightLayout.getComponent(index);
        if (comp != null) {
            topRightLayout.replaceComponent(comp, button);
        }

    } else {
        topRightLayout.addComponent(button, index);
        ;
    }
    topRightLayout.setComponentAlignment(button, Alignment.MIDDLE_CENTER);
}

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);// w  w  w  .ja v  a  2s.  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 setImportButton() {
    int index = 3;
    int maxIndex = topRightLayout.getComponentCount() - 1; //1 abziehen wegen dem Spacing rechts
    if (index < maxIndex) {
        Component comp = topRightLayout.getComponent(index);
        if (comp != null) {

        }//from  w  w w  .  ja va 2s .  co  m
        topRightLayout.replaceComponent(comp, importButton);
    } else {
        topRightLayout.addComponent(importButton, index);
        ;
    }
    topRightLayout.setComponentAlignment(importButton, Alignment.MIDDLE_CENTER);
}

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

License:Open Source License

/**
 * Diese Methode ndert den oberen Teil im Men: Das Icon, von der Seite die aktuell
 * rechts als Content angezeigt wird, sowie die zugehrige Beschreibung dazu.
 *
 * @param source//  w  ww.j a v a 2 s  . co m
 * : Quelle des Icons als String
 * @param page
 * : Name der Seite
 * @param description
 * : Beschreibung der Seite
 * 
 * @author Marco Glaser
 */
public void setPageDescription(String source, String page, String description) {
    int labelCount = descriptionLayout.getComponentCount();
    homeIcon.setSource(new ThemeResource(source));
    seitenLabel.setValue(page);
    descriptionLabel.setValue(description);
    descriptionLayout.setComponentAlignment(descriptionLabel, Alignment.MIDDLE_CENTER);
    for (int i = 1; i < labelCount; i++) {
        descriptionLayout.removeComponent(descriptionLayout.getComponent(i));
    }
}

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

License:Open Source License

/**
 * Konkrete Ausprogrammierung der Darstellung eines einzelnen Projekts.
 * Ein Projekt wird durch ein VerticalLayout dargestellt, das ein Label
 * mit dem Projektname enthlt. Auerdem bekommt es einen ClickListener,
 * um ein Projekt als selektiert zu kennzeichnen und die Details zum Projekt
 * anzuzeigen.//w  w  w .  j av a 2s  . c  o m
 * 
 * @author Christian Scherer, Mirko Gpfrich, Marco Glaser
 * @param project
 *            das darzustellende Projekt und der aktuelle Index der Liste
 * @param i
 *            der Index der zu erstellenden Komponente (besonders fuer den
 *            Loeschbutton relevant)
 * @return ein VerticalLayout Objekt, das zur Eingliederung in das UI dient
 */
private VerticalLayout generateSingleProjectUI(Project project, int i) {

    final Project proj = project;
    final int a = i;
    //erzeugt eine Panel fr ein Projekt
    singleProject = new VerticalLayout();
    HorizontalLayout container = new HorizontalLayout();
    container.setSizeFull();
    if (i == 0) {
        singleProject.setStyleName("singleProjectSelected");
        presenter.projectSelected(project);
    } else {
        singleProject.setStyleName("singleProject");
    }
    Embedded icon = new Embedded(null,
            new ThemeResource("./images/icons/newIcons/1418828714_editor_open_folder-128.png"));
    icon.setHeight(40, UNITS_PIXELS);
    icon.setWidth(40, UNITS_PIXELS);
    Label gap1 = new Label();
    Label gap2 = new Label();
    Label gap3 = new Label();
    gap1.setWidth("15px");
    gap2.setWidth("15px");
    gap3.setSizeFull();
    Label projectName = new Label(project.getName());
    projectName.setWidth(Sizeable.SIZE_UNDEFINED, 0);
    projectName.setHeight(Sizeable.SIZE_UNDEFINED, 0);
    projectName.setStyleName("projectName");

    //Legt ein Layout fr das Projekt-Panel fest
    //panelContent.setSizeFull();
    container.addComponent(gap1);
    container.addComponent(icon);
    container.addComponent(gap2);
    container.addComponent(projectName);
    container.addComponent(gap3);
    container.setExpandRatio(gap3, 1.0f);

    singleProject.addComponent(container);
    singleProject.setWidth(100, UNITS_PERCENTAGE);
    singleProject.setHeight(70, UNITS_PIXELS);
    container.setComponentAlignment(icon, Alignment.MIDDLE_CENTER);
    container.setComponentAlignment(projectName, Alignment.MIDDLE_CENTER);

    singleProject.addListener(new LayoutClickListener() {

        private static final long serialVersionUID = 1L;

        @Override
        public void layoutClick(LayoutClickEvent event) {
            presenter.projectSelected(proj);
            switchProjectsStyle(a);

            eventBus.fireEvent(new SelectProjectEvent());
        }

    });

    //      singleProject.addListener(this);
    //      projectListPanel.addComponent(singleProject);
    logger.debug("Einzelnes Projektelement erzeugt");

    return singleProject;
}

From source file:dhbw.ka.mwi.businesshorizon2.ui.login.LogInScreenViewImpl.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  www .  j av a 2 s.  co  m*/
 * @author Christian Scherer
 */
private void generateUi() {
    setCaption("Business Horizon 2");
    logger.debug("berschrift fr Browser erstellt");

    vertical = new VerticalLayout();

    addStyleName("login_view");

    LoginForm 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"));

        }
    });

    vertical.addComponent(login);
    vertical.setComponentAlignment(login, Alignment.MIDDLE_CENTER);

    registerBtn = new Button("Registrieren", this);

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

    vertical.addComponent(registerBtn);
    vertical.setComponentAlignment(registerBtn, Alignment.MIDDLE_CENTER);
    //vertical.addComponent(passwordForgotBtn);
    //vertical.setComponentAlignment(passwordForgotBtn, Alignment.MIDDLE_CENTER);

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

    addComponent(vertical);
}

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

License:Open Source License

/**
 * Konkrete Erzeugung des Dialogfensters zur Registrierung eines neuen
 * Users.//from   www.  ja v a2 s  .com
 * 
 * @author Christian Scherer, Marcel Rosenberger, Annika Weis
 */
public void showRegisterUserDialog() {

    regDialog = new Window("Benutzer bei Business Horizon registrieren");
    regDialog.setModal(true);
    regDialog.setWidth(400, UNITS_PIXELS);
    regDialog.setResizable(false);
    regDialog.setDraggable(false);
    regDialog.setCaption("Registrierung eines neuen Benutzers");
    fl = new FormLayout();
    fl.setSpacing(true);
    fl.setMargin(true);
    regDialog.addComponent(fl);

    //Vorname
    textfieldFirstName = new TextField();
    textfieldFirstName.setCaption("Bitte Vornamen angeben: ");
    textfieldFirstName.setRequired(true);
    textfieldFirstName.setRequiredError("Pflichtfeld");
    fl.addComponent(textfieldFirstName);

    //Nachname
    textfieldLastName = new TextField();
    textfieldLastName.setCaption("Bitte Nachnamen angeben: ");
    textfieldLastName.setRequired(true);
    textfieldLastName.setRequiredError("Pflichtfeld");
    fl.addComponent(textfieldLastName);

    //Unternehmen
    textfieldCompany = new TextField();
    textfieldCompany.setCaption("Bitte Unternehmen angeben: ");
    textfieldCompany.setRequired(true);
    textfieldCompany.setRequiredError("Pflichtfeld");
    fl.addComponent(textfieldCompany);

    //Mailadresse
    textfieldEmailAdress = new TextField();
    textfieldEmailAdress.setCaption("Bitte Mailadresse angeben: ");
    textfieldEmailAdress.setRequired(true);
    textfieldEmailAdress.setRequiredError("Pflichtfeld");
    fl.addComponent(textfieldEmailAdress);

    //Passwort
    passwordFieldPassword = new PasswordField("Bitte Passwort whlen: ");
    passwordFieldPassword.setRequired(true);
    passwordFieldPassword.setRequiredError("Pflichtfeld");
    fl.addComponent(passwordFieldPassword);

    //Passwort WDH
    passwordFieldPasswordRep = new PasswordField("Bitte Passwort wiederholen:");
    passwordFieldPasswordRep.setRequired(true);
    passwordFieldPasswordRep.setRequiredError("Pflichtfeld");
    fl.addComponent(passwordFieldPasswordRep);

    VerticalLayout vl = new VerticalLayout();
    dialogRegBtn = new Button("Registrierung abschlieen", this);
    vl.addComponent(dialogRegBtn);
    vl.setComponentAlignment(dialogRegBtn, Alignment.MIDDLE_CENTER);
    regDialog.addComponent(vl);

    getWindow().addWindow(regDialog);

    logger.debug("Registrier-Dialog erzeugt");
}

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 v  a 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.process.navigation.NavigationViewImpl.java

License:Open Source License

private void addProjectName() {
    Label projectName = new Label("Sie bearbeiten derzeit das Projekt: " + presenter.getProjectName());
    projectName.setStyleName("projectname");
    this.full.addComponent(projectName);
    this.full.setComponentAlignment(projectName, Alignment.MIDDLE_CENTER);

}