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:com.wintindustries.pfserver.interfaces.view.dashboard.ErrorView.java

public ErrorView() {
    setSizeUndefined(); // <-- This is the important part

    this.setStyleName("error-page");
    setSizeFull();//from  w  ww.j a  va 2 s . co m
    errorInfo = new VerticalLayout();
    this.addComponent(errorInfo);

    VerticalLayout errorTitle = new VerticalLayout();

    Label pagetitle = new Label("500");
    Label label = new Label("", Label.CONTENT_XHTML);

    label.setStyleName("error-page-line");
    label.setWidth("400px");
    pagetitle.setHeight("210px");
    Label errorType = new Label("Internal Server Error");
    pagetitle.setStyleName("error-page-title");
    errorTitle.addComponent(pagetitle);
    errorTitle.addComponent(label);
    errorTitle.setComponentAlignment(pagetitle, Alignment.BOTTOM_LEFT);
    errorTitle.setWidth("90%");
    errorInfo.setHeightUndefined();
    errorInfo.addComponent(errorTitle);
    errorInfo.setComponentAlignment(errorTitle, Alignment.BOTTOM_LEFT);

}

From source file:com.wintindustries.pfserver.interfaces.view.dashboard.LoginView.java

private Component buildFields() {
    HorizontalLayout fields = new HorizontalLayout();
    fields.setSpacing(true);//from ww w.j av a2 s .c  o m
    fields.addStyleName("fields");

    final TextField username = new TextField("Username");
    username.setIcon(FontAwesome.USER);
    username.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON);

    final PasswordField password = new PasswordField("Password");
    password.setIcon(FontAwesome.LOCK);
    password.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON);

    final Button signin = new Button("Sign In");
    signin.addStyleName(ValoTheme.BUTTON_PRIMARY);
    signin.setClickShortcut(KeyCode.ENTER);
    signin.focus();

    fields.addComponents(username, password, signin);
    fields.setComponentAlignment(signin, Alignment.BOTTOM_LEFT);

    signin.addClickListener(new ClickListener() {
        @Override
        public void buttonClick(final ClickEvent event) {

            System.out.println("TRIGGER LOGIN");
            DashboardEventBus.post(new UserLoginRequestedEvent(username.getValue(), password.getValue()));
        }
    });
    return fields;
}

From source file:de.catma.ui.tagmanager.TagsetTree.java

License:Open Source License

private void initComponents() {
    setSizeFull();/*from w  w  w. j  a  va2s.  c om*/

    tagTree = new EndorsedTreeTable();
    tagTree.setImmediate(true);
    tagTree.setSizeFull();
    tagTree.setSelectable(true);
    tagTree.setMultiSelect(false);

    tagTree.setContainerDataSource(new HierarchicalContainer());

    tagTree.addContainerProperty(TagTreePropertyName.caption, String.class, null);
    tagTree.setColumnHeader(TagTreePropertyName.caption, "Tagsets");

    tagTree.addContainerProperty(TagTreePropertyName.icon, Resource.class, null);

    tagTree.setItemCaptionPropertyId(TagTreePropertyName.caption);
    tagTree.setItemIconPropertyId(TagTreePropertyName.icon);
    tagTree.setItemCaptionMode(Tree.ITEM_CAPTION_MODE_PROPERTY);

    tagTree.setVisibleColumns(new Object[] { TagTreePropertyName.caption });

    if (colorButtonListener != null) {
        tagTree.addGeneratedColumn(TagTreePropertyName.color,
                new ColorButtonColumnGenerator(colorButtonListener));
        tagTree.setColumnReorderingAllowed(true);
    } else {
        tagTree.addGeneratedColumn(TagTreePropertyName.color, new ColorLabelColumnGenerator());
    }
    tagTree.setColumnHeader(TagTreePropertyName.color, "Tag Color");
    addComponent(tagTree);
    setExpandRatio(tagTree, 2);

    GridLayout buttonGrid = new GridLayout(1, 19);
    buttonGrid.setMargin(true);
    buttonGrid.setSpacing(true);

    buttonGrid.addStyleName("taglibrary-action-grid");
    int buttonGridRowCount = 0;

    if (withTagsetButtons) {
        btReload = new Button("");
        btReload.setIcon(new ClassResource("ui/resources/icon-reload.gif", getApplication()));
        btReload.addStyleName("icon-button");
        buttonGrid.addComponent(btReload);
        buttonGrid.setComponentAlignment(btReload, Alignment.MIDDLE_RIGHT);
        buttonGridRowCount++;

        Label tagsetLabel = new Label();
        tagsetLabel.setIcon(new ClassResource("ui/tagmanager/resources/grndiamd.gif", application));
        tagsetLabel.setCaption("Tagset");

        buttonGrid.addComponent(tagsetLabel);
        buttonGridRowCount++;

        btInsertTagset = new Button("Create Tagset");
        btInsertTagset.setEnabled(true);
        btInsertTagset.setWidth("100%");
        buttonGrid.addComponent(btInsertTagset);
        buttonGridRowCount++;

        btRemoveTagset = new Button("Remove Tagset");
        btRemoveTagset.setWidth("100%");
        buttonGrid.addComponent(btRemoveTagset);
        buttonGridRowCount++;

        btEditTagset = new Button("Edit Tagset");
        btEditTagset.setWidth("100%");
        buttonGrid.addComponent(btEditTagset);
        buttonGridRowCount++;
    }

    Label tagLabel = new Label();
    tagLabel.setIcon(new ClassResource("ui/tagmanager/resources/reddiamd.gif", application));
    tagLabel.setCaption("Tag");

    buttonGrid.addComponent(tagLabel, 0, buttonGridRowCount, 0, buttonGridRowCount + 4);
    buttonGridRowCount += 5;

    buttonGrid.setComponentAlignment(tagLabel, Alignment.BOTTOM_LEFT);

    btInsertTag = new Button("Create Tag");
    btInsertTag.setWidth("100%");
    if (withTagsetButtons) {
        btInsertTag.setEnabled(true);
    }
    buttonGrid.addComponent(btInsertTag);
    buttonGridRowCount++;

    btRemoveTag = new Button("Remove Tag");
    btRemoveTag.setWidth("100%");
    buttonGrid.addComponent(btRemoveTag);
    buttonGridRowCount++;

    btEditTag = new Button("Edit Tag");
    btEditTag.setWidth("100%");
    buttonGrid.addComponent(btEditTag);
    buttonGridRowCount++;

    Label propertyLabel = new Label();
    propertyLabel.setIcon(new ClassResource("ui/tagmanager/resources/ylwdiamd.gif", application));
    propertyLabel.setCaption("Property");

    buttonGrid.addComponent(propertyLabel, 0, buttonGridRowCount, 0, buttonGridRowCount + 4);
    buttonGridRowCount += 5;

    buttonGrid.setComponentAlignment(propertyLabel, Alignment.BOTTOM_LEFT);

    btInsertProperty = new Button("Create Property");
    btInsertProperty.setWidth("100%");
    buttonGrid.addComponent(btInsertProperty);
    buttonGridRowCount++;

    btRemoveProperty = new Button("Remove Property");
    // commented out on purpose: somehow this forces all the other buttons to 
    // show up in natural size...
    //      btRemoveProperty.setWidth("100%");
    buttonGrid.addComponent(btRemoveProperty);
    buttonGridRowCount++;

    btEditProperty = new Button("Edit Property");
    btEditProperty.setWidth("100%");
    buttonGrid.addComponent(btEditProperty);
    buttonGridRowCount++;

    addComponent(buttonGrid);
    setExpandRatio(buttonGrid, 0);

    if (!withButtonPanel) {
        buttonGrid.setVisible(false);
    }

}

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

License:Apache License

/**
 * This method initializes the components of the system settings component.
 *//*from w  w w. jav a  2 s . c om*/
private void init() {
    settingsForm = new Form();
    settingsForm.setWriteThrough(true);
    settingsForm.setImmediate(true);
    settingsItem = new BeanItem<SystemSettings>(systemSettings);
    settingsForm.setItemDataSource(settingsItem);
    Object[] visiblePropertyIds = new Object[] { "autoAcceptNewTenants", "logLevel",
            "changeEmailRequestLifetimeSeconds", "baseUrl", "invitationLifetimeSeconds",
            "maxAttachmentsPerEmail", "maxUploadFileSizeBytes", "maxUploadFileSizeBytes", "mtaHostname",
            "emailClientHostname", "mtaPassword", "mtaPort", "mtaUsername", "mtaUseTls",
            "passwordResetRequestLifetimeSeconds", "registrationRequestLifetimeSeconds", "systemName",
            "systemEmailAddress", "monitorUpdateIntervalSeconds", "monitorAveragingPeriodSeconds",
            "serverPoolInstances", "minServerLoadForLock", "maxServerLoadForUnlock", "maxServerLoadForShutdown",
            "minUnlockedServers", "minWorkflowInstancesForLock", "maxWorkflowInstancesForUnlock",
            "maxWorkflowInstancesForShutdown" };
    settingsForm.setVisibleItemProperties(visiblePropertyIds);

    verticalLayout = new VerticalLayout();
    verticalLayout.setSpacing(true);

    saveButton = new Button("Save", new SaveSystemSettingsAction(this));

    setCompositionRoot(verticalLayout);
    setCaption("System Setting");

    verticalLayout.addComponent(settingsForm);
    verticalLayout.addComponent(saveButton);
    verticalLayout.setComponentAlignment(saveButton, Alignment.BOTTOM_LEFT);
}

From source file:de.symeda.sormas.ui.caze.AbstractTableField.java

License:Open Source License

@Override
protected Component initContent() {

    this.addStyleName(CssStyles.CAPTION_HIDDEN);
    this.addStyleName(CssStyles.VSPACE_2);

    layout = new VerticalLayout();
    layout.setSpacing(false);/*from   w  ww .j  a v a 2 s. com*/

    HorizontalLayout headerLayout = new HorizontalLayout();
    {
        headerLayout.setWidth(100, Unit.PERCENTAGE);

        captionLabel = new Label(getCaption());
        captionLabel.setSizeUndefined();
        headerLayout.addComponent(captionLabel);
        headerLayout.setComponentAlignment(captionLabel, Alignment.BOTTOM_LEFT);
        headerLayout.setExpandRatio(captionLabel, 0);

        addButton = createAddButton();
        headerLayout.addComponent(addButton);
        headerLayout.setComponentAlignment(addButton, Alignment.BOTTOM_RIGHT);
        headerLayout.setExpandRatio(addButton, 1);
    }
    layout.addComponent(headerLayout);

    table = createTable();
    table.addItemSetChangeListener(new ItemSetChangeListener() {
        @Override
        public void containerItemSetChange(ItemSetChangeEvent event) {
            applyTablePageLength();
        }
    });
    layout.addComponent(table);

    return layout;
}

From source file:de.symeda.sormas.ui.caze.CaseController.java

License:Open Source License

private void appendSpecialCommands(CaseDataDto caze,
        CommitDiscardWrapperComponent<? extends Component> editView) {
    if (UserProvider.getCurrent().hasUserRole(UserRole.ADMIN)) {
        editView.addDeleteListener(new DeleteListener() {
            @Override//w  w w  . jav  a  2 s.co m
            public void onDelete() {
                FacadeProvider.getCaseFacade().deleteCase(caze.toReference(),
                        UserProvider.getCurrent().getUserReference().getUuid());
                UI.getCurrent().getNavigator().navigateTo(CasesView.VIEW_NAME);
            }
        }, I18nProperties.getString(Strings.entityCase));
    }

    // Initialize 'Archive' button
    if (UserProvider.getCurrent().hasUserRight(UserRight.CASE_ARCHIVE)) {
        boolean archived = FacadeProvider.getCaseFacade().isArchived(caze.getUuid());
        Button archiveCaseButton = new Button();
        archiveCaseButton.addStyleName(ValoTheme.BUTTON_LINK);
        if (archived) {
            archiveCaseButton.setCaption(I18nProperties.getCaption(Captions.actionDearchive));
        } else {
            archiveCaseButton.setCaption(I18nProperties.getCaption(Captions.actionArchive));
        }
        archiveCaseButton.addClickListener(e -> {
            editView.commit();
            archiveOrDearchiveCase(caze.getUuid(), !archived);
        });

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

    // Initialize 'Transfer case' button
    if (UserProvider.getCurrent().hasUserRight(UserRight.CASE_TRANSFER) && !caze.isUnreferredPortHealthCase()) {
        Button transferCaseButton = new Button();
        transferCaseButton.setCaption(I18nProperties.getCaption(Captions.caseTransferCase));
        transferCaseButton.addClickListener(new ClickListener() {
            private static final long serialVersionUID = 1L;

            @Override
            public void buttonClick(ClickEvent event) {
                editView.commit();
                CaseDataDto cazeDto = findCase(caze.getUuid());
                transferCase(cazeDto);
            }
        });

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

    if (UserProvider.getCurrent().hasUserRight(UserRight.CASE_REFER_FROM_POE)
            && caze.isUnreferredPortHealthCase()) {
        Button btnReferToFacility = new Button();
        btnReferToFacility.setCaption(I18nProperties.getCaption(Captions.caseReferToFacility));
        btnReferToFacility.addClickListener(e -> {
            editView.commit();
            CaseDataDto caseDto = findCase(caze.getUuid());
            referFromPointOfEntry(caseDto);
        });

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

From source file:de.symeda.sormas.ui.dashboard.diagram.AbstractEpiCurveComponent.java

License:Open Source License

private HorizontalLayout createHeader() {
    HorizontalLayout epiCurveHeaderLayout = new HorizontalLayout();
    epiCurveHeaderLayout.setWidth(100, Unit.PERCENTAGE);
    epiCurveHeaderLayout.setSpacing(true);
    CssStyles.style(epiCurveHeaderLayout, CssStyles.VSPACE_4);

    epiCurveLabel = new Label(I18nProperties.getString(Strings.headingEpiCurve));
    epiCurveLabel.setSizeUndefined();//from ww w. j  a va 2s .  co  m
    CssStyles.style(epiCurveLabel, CssStyles.H2, CssStyles.VSPACE_4, CssStyles.VSPACE_TOP_NONE);

    epiCurveHeaderLayout.addComponent(epiCurveLabel);
    epiCurveHeaderLayout.setComponentAlignment(epiCurveLabel, Alignment.BOTTOM_LEFT);
    epiCurveHeaderLayout.setExpandRatio(epiCurveLabel, 1);

    // "Expand" and "Collapse" buttons
    Button expandEpiCurveButton = new Button("", VaadinIcons.EXPAND);
    CssStyles.style(expandEpiCurveButton, CssStyles.BUTTON_SUBTLE);
    expandEpiCurveButton.addStyleName(CssStyles.VSPACE_NONE);
    Button collapseEpiCurveButton = new Button("", VaadinIcons.COMPRESS);
    CssStyles.style(collapseEpiCurveButton, CssStyles.BUTTON_SUBTLE);
    collapseEpiCurveButton.addStyleName(CssStyles.VSPACE_NONE);

    expandEpiCurveButton.addClickListener(e -> {
        externalExpandListener.accept(true);
        epiCurveHeaderLayout.removeComponent(expandEpiCurveButton);
        epiCurveHeaderLayout.addComponent(collapseEpiCurveButton);
        epiCurveHeaderLayout.setComponentAlignment(collapseEpiCurveButton, Alignment.MIDDLE_RIGHT);
    });
    collapseEpiCurveButton.addClickListener(e -> {
        externalExpandListener.accept(false);
        epiCurveHeaderLayout.removeComponent(collapseEpiCurveButton);
        epiCurveHeaderLayout.addComponent(expandEpiCurveButton);
        epiCurveHeaderLayout.setComponentAlignment(expandEpiCurveButton, Alignment.MIDDLE_RIGHT);
    });
    epiCurveHeaderLayout.addComponent(expandEpiCurveButton);
    epiCurveHeaderLayout.setComponentAlignment(expandEpiCurveButton, Alignment.MIDDLE_RIGHT);

    return epiCurveHeaderLayout;
}

From source file:de.symeda.sormas.ui.dashboard.map.DashboardMapComponent.java

License:Open Source License

private HorizontalLayout createHeader() {
    HorizontalLayout mapHeaderLayout = new HorizontalLayout();
    mapHeaderLayout.setWidth(100, Unit.PERCENTAGE);
    mapHeaderLayout.setSpacing(true);//w w  w.j  a va 2 s  .com
    CssStyles.style(mapHeaderLayout, CssStyles.VSPACE_4);

    Label mapLabel = new Label();
    if (dashboardDataProvider.getDashboardType() == DashboardType.SURVEILLANCE) {
        mapLabel.setValue(I18nProperties.getString(Strings.headingCaseStatusMap));
    } else {
        mapLabel.setValue(I18nProperties.getString(Strings.headingContactMap));
    }
    mapLabel.setSizeUndefined();
    CssStyles.style(mapLabel, CssStyles.H2, CssStyles.VSPACE_4, CssStyles.VSPACE_TOP_NONE);

    mapHeaderLayout.addComponent(mapLabel);
    mapHeaderLayout.setComponentAlignment(mapLabel, Alignment.BOTTOM_LEFT);
    mapHeaderLayout.setExpandRatio(mapLabel, 1);

    // "Expand" and "Collapse" buttons
    Button expandMapButton = new Button("", VaadinIcons.EXPAND);
    CssStyles.style(expandMapButton, CssStyles.BUTTON_SUBTLE);
    expandMapButton.addStyleName(CssStyles.VSPACE_NONE);
    Button collapseMapButton = new Button("", VaadinIcons.COMPRESS);
    CssStyles.style(collapseMapButton, CssStyles.BUTTON_SUBTLE);
    collapseMapButton.addStyleName(CssStyles.VSPACE_NONE);

    expandMapButton.addClickListener(e -> {
        externalExpandListener.accept(true);
        mapHeaderLayout.removeComponent(expandMapButton);
        mapHeaderLayout.addComponent(collapseMapButton);
        mapHeaderLayout.setComponentAlignment(collapseMapButton, Alignment.MIDDLE_RIGHT);
    });
    collapseMapButton.addClickListener(e -> {
        externalExpandListener.accept(false);
        mapHeaderLayout.removeComponent(collapseMapButton);
        mapHeaderLayout.addComponent(expandMapButton);
        mapHeaderLayout.setComponentAlignment(expandMapButton, Alignment.MIDDLE_RIGHT);
    });
    mapHeaderLayout.addComponent(expandMapButton);
    mapHeaderLayout.setComponentAlignment(expandMapButton, Alignment.MIDDLE_RIGHT);

    return mapHeaderLayout;
}

From source file:de.symeda.sormas.ui.dashboard.statistics.DashboardStatisticsSubComponent.java

License:Open Source License

public void addHeader(String headline, Image icon, boolean showTotalCount) {
    HorizontalLayout headerLayout = new HorizontalLayout();
    headerLayout.setWidth(100, Unit.PERCENTAGE);
    headerLayout.setSpacing(true);// w  w w . j a v  a  2 s . c  o m
    headerLayout.setMargin(false);
    CssStyles.style(headerLayout, CssStyles.VSPACE_4);

    VerticalLayout labelAndTotalLayout = new VerticalLayout();
    {
        labelAndTotalLayout.setMargin(false);
        labelAndTotalLayout.setSpacing(false);
        Label headlineLabel = new Label(headline);
        CssStyles.style(headlineLabel, CssStyles.H2, CssStyles.VSPACE_4, CssStyles.VSPACE_TOP_NONE);
        labelAndTotalLayout.addComponent(headlineLabel);

        if (showTotalCount) {
            totalCountLabel = new Label();
            CssStyles.style(totalCountLabel, CssStyles.LABEL_PRIMARY, CssStyles.LABEL_XXXLARGE,
                    CssStyles.LABEL_BOLD, CssStyles.VSPACE_4, CssStyles.VSPACE_TOP_NONE);
            labelAndTotalLayout.addComponent(totalCountLabel);
        } else {
            CssStyles.style(labelAndTotalLayout, CssStyles.VSPACE_4);
        }

    }
    headerLayout.addComponent(labelAndTotalLayout);
    headerLayout.setComponentAlignment(labelAndTotalLayout, Alignment.BOTTOM_LEFT);
    headerLayout.setHeightUndefined();
    headerLayout.setExpandRatio(labelAndTotalLayout, 1);

    if (icon != null) {
        headerLayout.addComponent(icon);
        headerLayout.setComponentAlignment(icon, Alignment.TOP_RIGHT);
    }

    addComponent(headerLayout);
    setExpandRatio(headerLayout, 0);
}

From source file:de.symeda.sormas.ui.events.EventController.java

License:Open Source License

public CommitDiscardWrapperComponent<EventDataForm> getEventDataEditComponent(final String eventUuid) {
    EventDto event = findEvent(eventUuid);
    EventDataForm eventEditForm = new EventDataForm(false, UserRight.EVENT_EDIT);
    eventEditForm.setValue(event);//  w  w w. j a  va2 s  . c  o  m
    final CommitDiscardWrapperComponent<EventDataForm> editView = new CommitDiscardWrapperComponent<EventDataForm>(
            eventEditForm, eventEditForm.getFieldGroup());

    editView.addCommitListener(new CommitListener() {
        @Override
        public void onCommit() {
            if (!eventEditForm.getFieldGroup().isModified()) {
                EventDto eventDto = eventEditForm.getValue();
                eventDto = FacadeProvider.getEventFacade().saveEvent(eventDto);
                Notification.show(I18nProperties.getString(Strings.messageEventSaved), Type.WARNING_MESSAGE);
                SormasUI.refreshView();
            }
        }
    });

    if (UserProvider.getCurrent().hasUserRole(UserRole.ADMIN)) {
        editView.addDeleteListener(new DeleteListener() {
            @Override
            public void onDelete() {
                FacadeProvider.getEventFacade().deleteEvent(event.toReference(),
                        UserProvider.getCurrent().getUserReference().getUuid());
                UI.getCurrent().getNavigator().navigateTo(EventsView.VIEW_NAME);
            }
        }, I18nProperties.getString(Strings.entityEvent));
    }

    // Initialize 'Archive' button
    if (UserProvider.getCurrent().hasUserRight(UserRight.EVENT_ARCHIVE)) {
        boolean archived = FacadeProvider.getEventFacade().isArchived(eventUuid);
        Button archiveEventButton = new Button();
        archiveEventButton.addStyleName(ValoTheme.BUTTON_LINK);
        if (archived) {
            archiveEventButton.setCaption(I18nProperties.getCaption(Captions.actionDearchive));
        } else {
            archiveEventButton.setCaption(I18nProperties.getCaption(Captions.actionArchive));
        }
        archiveEventButton.addClickListener(e -> {
            editView.commit();
            archiveOrDearchiveEvent(eventUuid, !archived);
        });

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

    return editView;
}