Search in sources :

Example 1 with FurmsFormLayout

use of io.imunity.furms.ui.components.FurmsFormLayout in project furms by unity-idm.

the class ProjectAllocationDashboardFormView method addForm.

private void addForm(DefaultNameField nameField) {
    final FormLayout formLayout = new FurmsFormLayout();
    final Label availableAmountLabel = new Label();
    formLayout.addFormItem(nameField, getTranslation("view.community-admin.project-allocation.form.field.name"));
    formLayout.addFormItem(projectsField(), getTranslation("view.community-admin.project-allocation.form.field.projects"));
    formLayout.addFormItem(resourceTypeField(), getTranslation("view.community-admin.project-allocation.form.field.resource_type"));
    formLayout.addFormItem(communityAllocation(availableAmountLabel), getTranslation("view.community-admin.project-allocation.form.field.community_allocation"));
    formLayout.addFormItem(amountField(), getTranslation("view.fenix-admin.resource-credits-allocation.form.field.amount"));
    formLayout.addFormItem(availableAmountLabel, "");
    getContent().add(formLayout);
}
Also used : FurmsFormLayout(io.imunity.furms.ui.components.FurmsFormLayout) FormLayout(com.vaadin.flow.component.formlayout.FormLayout) FurmsFormLayout(io.imunity.furms.ui.components.FurmsFormLayout) Label(com.vaadin.flow.component.html.Label)

Example 2 with FurmsFormLayout

use of io.imunity.furms.ui.components.FurmsFormLayout in project furms by unity-idm.

the class SitesAddView method addForm.

private void addForm() {
    FormLayout formLayout = new FurmsFormLayout();
    formLayout.setSizeFull();
    SiteCreationParam formData = new SiteCreationParam();
    Binder<SiteCreationParam> binder = new Binder<>(SiteCreationParam.class);
    binder.setBean(formData);
    name.setPlaceholder(getTranslation("view.sites.add.form.name.placeholder"));
    name.setRequiredIndicatorVisible(true);
    name.setValueChangeMode(EAGER);
    name.setMaxLength(NAME_MAX_LENGTH);
    Button cancel = new Button(getTranslation("view.sites.add.form.button.cancel"), e -> doCancelAction());
    cancel.addThemeVariants(LUMO_TERTIARY);
    Button save = new Button(getTranslation("view.sites.add.form.button.save"), e -> doSaveAction(formData, binder));
    save.addThemeVariants(LUMO_PRIMARY);
    save.addClickShortcut(Key.ENTER);
    FormButtons buttons = new FormButtons(cancel, save);
    binder.addStatusChangeListener(status -> save.setEnabled(!isBlank(name.getValue()) && !status.hasValidationErrors()));
    binder.forField(name).withValidator(getNotEmptyStringValidator(), getTranslation("view.sites.form.error.validation.field.name.required")).withValidator(siteService::isNamePresent, getTranslation("view.sites.form.error.validation.field.name.unique")).bind(SiteCreationParam::getName, SiteCreationParam::setName);
    formLayout.addFormItem(name, getTranslation("view.sites.add.form.name"));
    getContent().add(formLayout, buttons);
}
Also used : FurmsFormLayout(io.imunity.furms.ui.components.FurmsFormLayout) FormLayout(com.vaadin.flow.component.formlayout.FormLayout) Binder(com.vaadin.flow.data.binder.Binder) FurmsFormLayout(io.imunity.furms.ui.components.FurmsFormLayout) Button(com.vaadin.flow.component.button.Button) FormButtons(io.imunity.furms.ui.components.FormButtons)

Example 3 with FurmsFormLayout

use of io.imunity.furms.ui.components.FurmsFormLayout in project furms by unity-idm.

the class DashboardResourceAllocateFormView method addForm.

private void addForm(DefaultNameField nameField) {
    final FormLayout formLayout = new FurmsFormLayout();
    final Label availableAmountLabel = new Label();
    formLayout.addFormItem(nameField, getTranslation("view.fenix-admin.resource-credits-allocation.form.field.name"));
    formLayout.addFormItem(siteField(), getTranslation("view.fenix-admin.resource-credits-allocation.form.field.site"));
    formLayout.addFormItem(communityField(), getTranslation("view.fenix-admin.resource-credits-allocation.form.field.community"));
    formLayout.addFormItem(resourceTypeField(), getTranslation("view.fenix-admin.resource-credits-allocation.form.field.resource_type"));
    formLayout.addFormItem(resourceCreditField(availableAmountLabel), getTranslation("view.fenix-admin.resource-credits-allocation.form.field.resource_credit"));
    formLayout.addFormItem(amountField(), getTranslation("view.fenix-admin.resource-credits-allocation.form.field.amount"));
    formLayout.addFormItem(availableAmountLabel, "");
    getContent().add(formLayout);
}
Also used : FurmsFormLayout(io.imunity.furms.ui.components.FurmsFormLayout) FormLayout(com.vaadin.flow.component.formlayout.FormLayout) FurmsFormLayout(io.imunity.furms.ui.components.FurmsFormLayout) Label(com.vaadin.flow.component.html.Label)

Example 4 with FurmsFormLayout

use of io.imunity.furms.ui.components.FurmsFormLayout in project furms by unity-idm.

the class SettingsView method addForm.

private void addForm(SiteSettingsDto dto) {
    FormLayout formLayout = new FurmsFormLayout();
    Binder<SiteSettingsDto> binder = new Binder<>(SiteSettingsDto.class);
    binder.setBean(dto);
    formLayout.add(furmsIdRow(binder.getBean().getId(), getTranslation("view.site-admin.settings.form.furms-id")));
    formLayout.addFormItem(externalIdRow(binder), getTranslation("view.site-admin.settings.form.external-id"));
    formLayout.addFormItem(nameRow(binder), getTranslation("view.site-admin.settings.form.name"));
    formLayout.addFormItem(oauthClientIdRow(binder), getTranslation("view.site-admin.settings.form.oauth-client"));
    formLayout.addFormItem(connectionInfoRow(binder), getTranslation("view.site-admin.settings.form.info"));
    formLayout.addFormItem(sshKeyFromMandatory(binder), "");
    formLayout.addFormItem(prohibitOldSSHKey(binder), "");
    formLayout.addFormItem(uploadRow(binder), getTranslation("view.site-admin.settings.form.logo"));
    formLayout.addFormItem(policyRow(binder), getTranslation("view.site-admin.settings.form.policy"));
    formLayout.add(buttonsRow(binder));
    getContent().add(formLayout);
}
Also used : FurmsFormLayout(io.imunity.furms.ui.components.FurmsFormLayout) FormLayout(com.vaadin.flow.component.formlayout.FormLayout) Binder(com.vaadin.flow.data.binder.Binder) FurmsFormLayout(io.imunity.furms.ui.components.FurmsFormLayout)

Example 5 with FurmsFormLayout

use of io.imunity.furms.ui.components.FurmsFormLayout in project furms by unity-idm.

the class SitesView method addConnectionInfoPanel.

private void addConnectionInfoPanel() {
    connectionInfo = new Div();
    connectionInfo.setVisible(false);
    connectionInfo.addClassName("user-sites-connection-info-content");
    connectionInfoLabel = new H4("");
    connectionInfoLabel.setVisible(false);
    final FurmsFormLayout formLayout = new FurmsFormLayout();
    formLayout.addClassName("user-sites-connection-info");
    formLayout.addFormItem(connectionInfo, connectionInfoLabel);
    connectionInfo.addClickListener(event -> {
        if (event.getClickCount() == DOUBLECLICK) {
            connectionInfoLabel.setText("");
            connectionInfo.setText("");
            connectionInfo.setVisible(false);
            connectionInfoLabel.setVisible(false);
        }
    });
    getContent().add(formLayout);
}
Also used : Div(com.vaadin.flow.component.html.Div) FurmsFormLayout(io.imunity.furms.ui.components.FurmsFormLayout) H4(com.vaadin.flow.component.html.H4)

Aggregations

FurmsFormLayout (io.imunity.furms.ui.components.FurmsFormLayout)5 FormLayout (com.vaadin.flow.component.formlayout.FormLayout)4 Label (com.vaadin.flow.component.html.Label)2 Binder (com.vaadin.flow.data.binder.Binder)2 Button (com.vaadin.flow.component.button.Button)1 Div (com.vaadin.flow.component.html.Div)1 H4 (com.vaadin.flow.component.html.H4)1 FormButtons (io.imunity.furms.ui.components.FormButtons)1