Example usage for com.vaadin.ui Alignment BOTTOM_LEFT

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

Introduction

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

Prototype

Alignment BOTTOM_LEFT

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

Click Source Link

Usage

From source file:de.symeda.sormas.ui.login.LoginScreen.java

License:Open Source License

private CssLayout buildLoginInformation() {
    CssLayout loginInformation = new CssLayout();
    loginInformation.setStyleName("login-information");

    VerticalLayout innerLayout = new VerticalLayout();
    innerLayout.setSizeFull();/*from w  ww  .  j a  v  a2  s  . c  om*/

    Image img = new Image(null, new ThemeResource("img/sormas-logo-big.png"));
    img.setHeight(240, Unit.PIXELS);
    innerLayout.addComponent(img);
    innerLayout.setComponentAlignment(img, Alignment.TOP_CENTER);
    innerLayout.setExpandRatio(img, 0);

    Label loginInfoText = new Label("<h1>SORMAS</h1>"
            + "<h2 style='color:white'>Surveillance, Outbreak Response Management and Analysis System</h2>"
            + "<h3 style='color:white; text-transform:uppercase'>&#9679; Disease Prevention<br>&#9679; Disease Detection<br>&#9679; Outbreak Response</h3>",
            ContentMode.HTML);
    loginInfoText.setWidth(100, Unit.PERCENTAGE);
    innerLayout.addComponent(loginInfoText);
    innerLayout.setExpandRatio(loginInfoText, 1);

    Label loginInfoCopyright = new Label(" 2019 SORMAS. All Rights Reserved.");
    loginInfoCopyright.setWidth(100, Unit.PERCENTAGE);
    innerLayout.addComponent(loginInfoCopyright);
    innerLayout.setExpandRatio(loginInfoCopyright, 0);
    innerLayout.setComponentAlignment(loginInfoCopyright, Alignment.BOTTOM_LEFT);

    loginInformation.addComponent(innerLayout);
    return loginInformation;
}

From source file:de.symeda.sormas.ui.samples.SampleController.java

License:Open Source License

public CommitDiscardWrapperComponent<SampleEditForm> getSampleEditComponent(final String sampleUuid) {
    SampleEditForm form = new SampleEditForm(UserRight.SAMPLE_EDIT);
    form.setWidth(form.getWidth() * 10 / 12, Unit.PIXELS);
    SampleDto dto = FacadeProvider.getSampleFacade().getSampleByUuid(sampleUuid);
    form.setValue(dto);// w  w  w .  java 2s . co m
    final CommitDiscardWrapperComponent<SampleEditForm> editView = new CommitDiscardWrapperComponent<SampleEditForm>(
            form, form.getFieldGroup());

    editView.addCommitListener(new CommitListener() {
        @Override
        public void onCommit() {
            if (!form.getFieldGroup().isModified()) {
                SampleDto dto = form.getValue();
                SampleDto originalDto = FacadeProvider.getSampleFacade().getSampleByUuid(dto.getUuid());
                FacadeProvider.getSampleFacade().saveSample(dto);
                SormasUI.refreshView();

                if (dto.getSpecimenCondition() != originalDto.getSpecimenCondition()
                        && dto.getSpecimenCondition() == SpecimenCondition.NOT_ADEQUATE
                        && UserProvider.getCurrent().hasUserRight(UserRight.TASK_CREATE)) {
                    requestSampleCollectionTaskCreation(dto, form);
                } else {
                    Notification.show(I18nProperties.getString(Strings.messageSampleSaved),
                            Type.TRAY_NOTIFICATION);
                }
            }
        }
    });

    if (UserProvider.getCurrent().hasUserRole(UserRole.ADMIN)) {
        editView.addDeleteListener(new DeleteListener() {
            @Override
            public void onDelete() {
                FacadeProvider.getSampleFacade().deleteSample(dto.toReference(),
                        UserProvider.getCurrent().getUserReference().getUuid());
                UI.getCurrent().getNavigator().navigateTo(SamplesView.VIEW_NAME);
            }
        }, I18nProperties.getString(Strings.entitySample));
    }

    // Initialize 'Refer to another laboratory' button or link to referred sample
    Button referOrLinkToOtherLabButton = new Button();
    referOrLinkToOtherLabButton.addStyleName(ValoTheme.BUTTON_LINK);
    if (dto.getReferredTo() == null) {
        if (UserProvider.getCurrent().hasUserRight(UserRight.SAMPLE_TRANSFER)) {
            referOrLinkToOtherLabButton.setCaption(I18nProperties.getCaption(Captions.sampleRefer));
            referOrLinkToOtherLabButton.addClickListener(new ClickListener() {
                private static final long serialVersionUID = 1L;

                @Override
                public void buttonClick(ClickEvent event) {
                    try {
                        form.commit();
                        SampleDto sampleDto = form.getValue();
                        sampleDto = FacadeProvider.getSampleFacade().saveSample(sampleDto);
                        createReferral(sampleDto);
                    } catch (SourceException | InvalidValueException e) {
                        Notification.show(I18nProperties.getString(Strings.messageSampleErrors),
                                Type.ERROR_MESSAGE);
                    }
                }
            });

            editView.getButtonsPanel().addComponentAsFirst(referOrLinkToOtherLabButton);
            editView.getButtonsPanel().setComponentAlignment(referOrLinkToOtherLabButton,
                    Alignment.BOTTOM_LEFT);
        }
    } else {
        SampleDto referredDto = FacadeProvider.getSampleFacade().getSampleByUuid(dto.getReferredTo().getUuid());
        referOrLinkToOtherLabButton.setCaption(
                I18nProperties.getCaption(Captions.sampleReferredTo) + " " + referredDto.getLab().toString());
        referOrLinkToOtherLabButton.addClickListener(new ClickListener() {
            private static final long serialVersionUID = 1L;

            @Override
            public void buttonClick(ClickEvent event) {
                navigateToData(dto.getReferredTo().getUuid());
            }
        });

        editView.getButtonsPanel().addComponentAsFirst(referOrLinkToOtherLabButton);
        editView.getButtonsPanel().setComponentAlignment(referOrLinkToOtherLabButton, Alignment.BOTTOM_LEFT);
    }

    return editView;
}

From source file:de.unioninvestment.eai.portal.portlet.crud.mvp.views.DefaultFormView.java

License:Apache License

private void addFieldToLayout(FormField field, Field<?> vaadinField) {

    fieldLayout.addComponent(vaadinField);

    if (fieldLayout instanceof GridLayout) {
        vaadinField.setWidth("100%");
        if (field.getTitle().length() > 15) {
            if (vaadinField instanceof AbstractComponent) {
                ((AbstractComponent) vaadinField).setDescription(field.getTitle());
            }//from  w w  w.  j a  va2s  .com
        }
        ((GridLayout) fieldLayout).setComponentAlignment(vaadinField, Alignment.BOTTOM_LEFT);
    }
}

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

License:Open Source License

/**
 * Methode zum Darstellen der Userdaten im Header
 *
 * @param username//from w  ww . jav  a 2  s  . c o  m
 * Der angezeigte Username
 * @author Mirko Gpfrich
 */
public void showUserData(String username) {
    /*
     * Wenn schon ein UserData-String angezeigt wird, muss dieser zunaechst entfernt werden.
     * Ansonsten werden mehrere UserData-Strings angezeigt, wenn zwischen Projektuebersicht
     * und Prozesssicht gesprungen wird.
     */
    Label userInfo = new Label("Sie sind angemeldet als: ");
    middle.addComponent(userInfo);
    middle.setComponentAlignment(userInfo, Alignment.BOTTOM_LEFT);

    if (userData != null) {
        middle.removeComponent(userData);
        middle.removeComponent(userInfo);
    }

    userData = new Label(username);
    userData.setContentMode(Label.CONTENT_XHTML);
    userData.setVisible(true);
    middle.addComponent(userData);
    middle.setComponentAlignment(userData, Alignment.BOTTOM_LEFT);
    ;
}

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

License:Open Source License

/**
* Methode zum Darstellen der Userdaten im Header
*
* @param username/*  w w  w .ja  v a2  s . c om*/
* Der angezeigte Username
* @author Mirko Gpfrich
*/
public void showUserData(String username) {
    /*
    * Wenn schon ein UserData-String angezeigt wird, muss dieser zunaechst entfernt werden.
    * Ansonsten werden mehrere UserData-Strings angezeigt, wenn zwischen Projektuebersicht
    * und Prozesssicht gesprungen wird.
    */
    Label userInfo = new Label("Sie sind angemeldet als: ");
    middle.addComponent(userInfo);
    middle.setComponentAlignment(userInfo, Alignment.BOTTOM_LEFT);

    if (userData != null) {
        middle.removeComponent(userData);
        middle.removeComponent(userInfo);
    }

    userData = new Label(username);
    userData.setContentMode(Label.CONTENT_XHTML);
    userData.setVisible(true);
    middle.addComponent(userData);
    middle.setComponentAlignment(userData, Alignment.BOTTOM_LEFT);
    ;
}

From source file:edu.kit.dama.ui.admin.administration.usergroup.GroupMembershipEditorWindow.java

License:Apache License

private GridLayout getMainLayout() throws AuthorizationException, UnsupportedEnumException {
    if (mainPanel == null) {
        String id = "mainPanel";
        LOGGER.debug("Building " + DEBUG_ID_PREFIX + id + " ...");
        UIUtils7.GridLayoutBuilder builder = new UIUtils7.GridLayoutBuilder(2, 2);
        //add table and exclude button
        builder.addComponent(getMembersTable(), 0, 0).addComponent(getExcludeMembersButton(),
                Alignment.BOTTOM_LEFT, 0, 1, 1, 1);

        Label l = new Label(
                "To add members select them in the list below and click <i>'Add Member(s)'</i>. To exclude members select them in the table and click <i>'Exclude Member(s)'</i>",
                ContentMode.HTML);

        Button closeButton = new Button("Close");
        closeButton.addClickListener((event) -> {
            close();//from  w  w w . j a  va  2s .  c o m
        });

        VerticalLayout actionLayout = new VerticalLayout(l, getUserSelector(), getAddMembersButton());
        actionLayout.setComponentAlignment(l, Alignment.TOP_CENTER);
        actionLayout.setComponentAlignment(getUserSelector(), Alignment.TOP_RIGHT);
        actionLayout.setComponentAlignment(getAddMembersButton(), Alignment.TOP_RIGHT);
        actionLayout.setExpandRatio(getUserSelector(), 1.0f);
        actionLayout.setSpacing(true);
        actionLayout.setSizeFull();

        builder.addComponent(actionLayout, 1, 0, 1, 1).addComponent(closeButton, Alignment.BOTTOM_RIGHT, 1, 1,
                1, 1);

        mainPanel = builder.getLayout();
        mainPanel.setId(DEBUG_ID_PREFIX + id);
        mainPanel.setSizeFull();

        mainPanel.setColumnExpandRatio(0, .7f);
        mainPanel.setColumnExpandRatio(1, .3f);
        mainPanel.setRowExpandRatio(0, .99f);
        mainPanel.setRowExpandRatio(1, .01f);
        mainPanel.setSpacing(true);
        mainPanel.setMargin(true);

        updateMainPanel();
    }
    return mainPanel;
}

From source file:edu.kit.dama.ui.admin.login.AbstractLoginComponent.java

License:Apache License

/**
 * Basic initialization of components./*ww w . j  a  v a  2  s. c om*/
 */
private void initializeLayout() {
    registrationFormView.setWidth("400px");
    loginButton = new Button("Login");
    loginButton.setClickShortcut(ShortcutAction.KeyCode.ENTER);
    loginButton.setWidth("100px");
    loginButton.addClickListener(this);

    registerButton = new Button("Register");
    registerButton.setWidth("100px");
    registerButton.addClickListener(this);
    mainLayout = new UIUtils7.GridLayoutBuilder(2, 2).addComponent(getLoginForm(), 0, 0, 2, 1)
            .addComponent(registerButton, 0, 1, 1, 1).addComponent(loginButton, 1, 1, 1, 1).getLayout();

    mainLayout.setComponentAlignment(getLoginForm(), Alignment.TOP_CENTER);
    mainLayout.setComponentAlignment(loginButton, Alignment.BOTTOM_RIGHT);
    mainLayout.setSpacing(true);
    mainLayout.setMargin(false);
    mainLayout.setComponentAlignment(registerButton, Alignment.BOTTOM_LEFT);
    VerticalLayout vLayout = new VerticalLayout(mainLayout);
    vLayout.setImmediate(true);
    vLayout.setComponentAlignment(mainLayout, Alignment.MIDDLE_CENTER);
    setCompositionRoot(vLayout);
}

From source file:edu.kit.dama.ui.admin.MainControlPanel.java

License:Apache License

/**
 * Build the main layout.//from w  w w  . j  av a  2  s  . c  o  m
 */
private void buildMainLayout() {
    infoCell = createCell("img/128x128/information2.png", Alignment.TOP_RIGHT, 0,
            "<p>Show/edit your profile and personel settings.</p>", "help-right");
    profileCell = createCell("img/128x128/preferences.png", Alignment.TOP_LEFT, 1,
            "<p>Get information on how you use this KIT Data Manager instance.</p>", "help-left");
    administrationCell = createCell("img/128x128/gears_preferences.png", Alignment.BOTTOM_RIGHT, 2,
            "<p>Logout.</p>", "help-right");
    logoutCell = createCell("img/128x128/exit.png", Alignment.BOTTOM_LEFT, 3,
            "<p>Show KIT Data Manager settings.<br/>This view is only available for administrators and group manager</p>.",
            "help-left");

    GridLayout actionCellLayout = new UIUtils7.GridLayoutBuilder(2, 2)
            .addComponent(infoCell, Alignment.BOTTOM_RIGHT, 0, 0, 1, 1)
            .addComponent(profileCell, Alignment.BOTTOM_LEFT, 1, 0, 1, 1)
            .addComponent(administrationCell, Alignment.TOP_RIGHT, 0, 1, 1, 1)
            .addComponent(logoutCell, Alignment.TOP_LEFT, 1, 1, 1, 1).getLayout();
    actionCellLayout.setSpacing(true);
    actionCellLayout.setMargin(true);
    actionCellLayout.setSizeFull();

    actionCellLayout.addLayoutClickListener(new LayoutEvents.LayoutClickListener() {

        @Override
        public void layoutClick(LayoutEvents.LayoutClickEvent event) {
            if (event.getClickedComponent() instanceof Image) {
                // Check if childComponent is disabled
                if (!event.getChildComponent().isEnabled()) {
                    return;
                }
                Image img = (Image) event.getClickedComponent();
                if ("image0".equals(img.getId())) {
                    parent.updateView(AdminUIMainView.VIEW.INFORMATION);
                } else if ("image1".equals(img.getId())) {
                    parent.updateView(AdminUIMainView.VIEW.PROFILE);
                } else if ("image2".equals(img.getId())) {
                    parent.updateView(AdminUIMainView.VIEW.SETTINGS);
                } else if ("image3".equals(img.getId())) {
                    parent.logout();
                }
            }
        }
    });

    mainLayout = new VerticalLayout(actionCellLayout);
    mainLayout.setSizeFull();
}

From source file:edu.kit.dama.ui.admin.schedule.JobScheduleConfigurationTab.java

License:Apache License

/**
 * Build the main layout.//from   ww  w  . j a  v a 2  s.c om
 *
 * @return The main layout.
 */
@Override
public GridLayout buildMainLayout() {
    String id = "mainLayout";
    LOGGER.debug("Building " + DEBUG_ID_PREFIX + id + " ...");

    UIUtils7.GridLayoutBuilder mainLayoutBuilder = new UIUtils7.GridLayoutBuilder(3, 3);

    // Add components to mainLayout
    mainLayoutBuilder.fillColumn(getElementList(), 0, 0, 1);
    mainLayoutBuilder.addComponent(getImplementationClassField(), 1, 0, 1, 1)
            .addComponent(getLoadImplementationClassButton(), Alignment.BOTTOM_RIGHT, 2, 0, 1, 1);
    mainLayoutBuilder.fillRow(getPropertiesPanel(), 1, 1, 1);
    mainLayoutBuilder.addComponent(getNavigateButton(), Alignment.BOTTOM_LEFT, 1, 2, 1, 1)
            .addComponent(getCommitChangesButton(), Alignment.BOTTOM_RIGHT, 2, 2, 1, 1);

    mainLayout = mainLayoutBuilder.getLayout();
    mainLayout.setId(DEBUG_ID_PREFIX + id);
    mainLayout.setSizeFull();
    mainLayout.setSpacing(true);
    mainLayout.setMargin(true);

    mainLayout.setColumnExpandRatio(1, 1f);
    mainLayout.setRowExpandRatio(1, 1f);

    return mainLayout;
}

From source file:edu.kit.dama.ui.admin.staging.accesspoints.StagingAccessPointConfigurationTab.java

License:Apache License

@Override
public GridLayout buildMainLayout() {
    String id = "mainLayout";
    LOGGER.debug("Building " + DEBUG_ID_PREFIX + id + " ...");

    UIUtils7.GridLayoutBuilder mainLayoutBuilder = new UIUtils7.GridLayoutBuilder(3, 3);

    // Add components to mainLayout
    mainLayoutBuilder.fillColumn(getElementList(), 0, 0, 1);
    mainLayoutBuilder.addComponent(getImplementationClassField(), 1, 0, 1, 1)
            .addComponent(getLoadImplementationClassButton(), Alignment.BOTTOM_RIGHT, 2, 0, 1, 1);
    mainLayoutBuilder.fillRow(getPropertiesPanel(), 1, 1, 1);
    mainLayoutBuilder.addComponent(getNavigateButton(), Alignment.BOTTOM_LEFT, 1, 2, 1, 1)
            .addComponent(getCommitChangesButton(), Alignment.BOTTOM_RIGHT, 2, 2, 1, 1);

    mainLayout = mainLayoutBuilder.getLayout();
    mainLayout.setId(DEBUG_ID_PREFIX + id);
    mainLayout.setSizeFull();/*from  w  w w. j  ava 2  s  .  co m*/
    mainLayout.setSpacing(true);
    mainLayout.setMargin(true);

    mainLayout.setColumnExpandRatio(1, 1f);
    mainLayout.setRowExpandRatio(1, 1f);

    return mainLayout;
}