Example usage for com.vaadin.server FontAwesome TIMES

List of usage examples for com.vaadin.server FontAwesome TIMES

Introduction

In this page you can find the example usage for com.vaadin.server FontAwesome TIMES.

Prototype

FontAwesome TIMES

To view the source code for com.vaadin.server FontAwesome TIMES.

Click Source Link

Usage

From source file:fr.univlorraine.mondossierweb.views.windows.PreferencesApplicationWindow.java

License:Apache License

/**
 * Cre une fentre d'dition des preferences applicative
 * @param prfrence  diter// www . j a  v a 2  s .  co  m
 */
public PreferencesApplicationWindow(PreferencesApplication prefApp) {
    /* Style */
    setModal(true);
    setResizable(false);
    setClosable(false);
    setWidth("50%");

    /* Layout */
    VerticalLayout layout = new VerticalLayout();
    layout.setMargin(true);
    layout.setSpacing(true);
    layout.setWidth("100%");
    setContent(layout);

    /* Titre */
    setCaption(applicationContext.getMessage(NAME + ".title", null, getLocale()));

    /* Formulaire */
    fieldGroup = new BeanFieldGroup<>(PreferencesApplication.class);
    fieldGroup.setItemDataSource(prefApp);

    fieldGroup.setFieldFactory(new FieldGroupFieldFactory() {
        private static final long serialVersionUID = 1L;

        @Override
        @SuppressWarnings("rawtypes")
        public <T extends Field> T createField(Class<?> dataType, Class<T> fieldType) {
            if (fieldType == NativeSelect.class) {
                final NativeSelect field = new NativeSelect();
                field.addItem("true");
                field.addItem("false");
                field.setNullSelectionAllowed(false);
                field.setImmediate(true);
                //field.setValue(centre.getTemSrv());
                field.addValueChangeListener(new ValueChangeListener() {
                    @Override
                    public void valueChange(ValueChangeEvent event) {
                        field.setValue(event.getProperty().getValue());
                    }
                });
                return fieldType.cast(field);
            } else {
                final TextField field = new TextField();
                field.setImmediate(true);
                field.addTextChangeListener(new FieldEvents.TextChangeListener() {
                    private static final long serialVersionUID = 1L;

                    @Override
                    public void textChange(TextChangeEvent event) {
                        if (!field.isReadOnly()) {
                            field.setValue(event.getText());
                        }
                    }
                });
                return fieldType.cast(field);
            }

        }
    });

    FormLayout formLayout = new FormLayout();
    formLayout.setSpacing(true);
    formLayout.setSizeUndefined();
    formLayout.setWidth("100%");
    for (String fieldName : CONF_APP_FIELDS_ORDER) {
        String caption = applicationContext.getMessage(NAME + ".confAppTable." + fieldName, null, getLocale());
        //Si on est sur un parametre booleen
        if (fieldName.equals("valeur") && estUneValeurBooleenne(prefApp.getValeur())) {
            //On forme le nativeSelect
            Field<?> field = fieldGroup.buildAndBind(caption, fieldName, NativeSelect.class);
            formLayout.addComponent(field);
        } else {
            Field<?> field = fieldGroup.buildAndBind(caption, fieldName);
            if (field instanceof AbstractTextField) {
                ((AbstractTextField) field).setNullRepresentation("");
                field.setWidth("100%");
            }
            formLayout.addComponent(field);
        }
    }

    fieldGroup.getField("prefId").setReadOnly(prefApp.getPrefId() != null);
    fieldGroup.getField("prefDesc").setReadOnly(prefApp.getPrefDesc() != null);

    layout.addComponent(formLayout);

    /* Ajoute les boutons */
    HorizontalLayout buttonsLayout = new HorizontalLayout();
    buttonsLayout.setWidth(100, Unit.PERCENTAGE);
    buttonsLayout.setSpacing(true);
    buttonsLayout.setMargin(true);
    layout.addComponent(buttonsLayout);

    btnAnnuler = new Button(applicationContext.getMessage(NAME + ".btnAnnuler", null, getLocale()),
            FontAwesome.TIMES);
    btnAnnuler.addClickListener(e -> close());
    buttonsLayout.addComponent(btnAnnuler);
    buttonsLayout.setComponentAlignment(btnAnnuler, Alignment.MIDDLE_LEFT);

    btnEnregistrer = new Button(applicationContext.getMessage(NAME + ".btnSave", null, getLocale()),
            FontAwesome.SAVE);
    btnEnregistrer.addStyleName(ValoTheme.BUTTON_PRIMARY);
    btnEnregistrer.addClickListener(e -> {
        try {
            /* Valide la saisie */
            fieldGroup.commit();
            /* Enregistre la conf saisie */
            configController.saveAppParameter(prefApp);
            /* Ferme la fentre */
            close();
        } catch (CommitException ce) {
        }
    });
    buttonsLayout.addComponent(btnEnregistrer);
    buttonsLayout.setComponentAlignment(btnEnregistrer, Alignment.MIDDLE_RIGHT);

    /* Centre la fentre */
    center();
}

From source file:fr.univlorraine.mondossierweb.views.windows.SwapUtilisateurWindow.java

License:Apache License

/**
 * Cre une fentre d'dition du swap utilisateur
 * @param swap utilisateur  diter// ww w  .j a va 2s .c  o m
 */
public SwapUtilisateurWindow(UtilisateurSwap swap, boolean ajout) {
    /* Style */
    setModal(true);
    setResizable(false);
    setClosable(false);
    setWidth("50%");

    /* Layout */
    VerticalLayout layout = new VerticalLayout();
    layout.setMargin(true);
    layout.setSpacing(true);
    layout.setWidth("100%");
    setContent(layout);

    /* Titre */
    if (ajout) {
        setCaption(applicationContext.getMessage(NAME + ".title.ajout", null, getLocale()));
    } else {
        setCaption(applicationContext.getMessage(NAME + ".title", null, getLocale()));
    }

    /* Formulaire */
    fieldGroup = new BeanFieldGroup<>(UtilisateurSwap.class);
    fieldGroup.setItemDataSource(swap);
    FormLayout formLayout = new FormLayout();
    formLayout.setSpacing(true);
    formLayout.setSizeUndefined();
    formLayout.setWidth("100%");
    for (String fieldName : CONF_APP_FIELDS_ORDER) {
        String caption = applicationContext.getMessage(NAME + ".swapUserTable." + fieldName, null, getLocale());
        Field<?> field = fieldGroup.buildAndBind(caption, fieldName);
        if (field instanceof AbstractTextField) {
            ((AbstractTextField) field).setNullRepresentation("");
            field.setWidth("100%");
        }
        if (field instanceof DateField) {
            ((DateField) field).setResolution(DateField.RESOLUTION_MIN);
        }
        formLayout.addComponent(field);
    }

    //fieldGroup.getField("loginCible").setReadOnly(swap.getLoginCible() != null);
    fieldGroup.getField("loginSource").setReadOnly(swap.getLoginSource() != null);

    layout.addComponent(formLayout);

    /* Ajoute les boutons */
    HorizontalLayout buttonsLayout = new HorizontalLayout();
    buttonsLayout.setWidth(100, Unit.PERCENTAGE);
    buttonsLayout.setSpacing(true);
    buttonsLayout.setMargin(true);
    layout.addComponent(buttonsLayout);

    btnAnnuler = new Button(applicationContext.getMessage(NAME + ".btnAnnuler", null, getLocale()),
            FontAwesome.TIMES);
    btnAnnuler.addClickListener(e -> close());
    buttonsLayout.addComponent(btnAnnuler);
    buttonsLayout.setComponentAlignment(btnAnnuler, Alignment.MIDDLE_LEFT);

    btnEnregistrer = new Button(applicationContext.getMessage(NAME + ".btnSave", null, getLocale()),
            FontAwesome.SAVE);
    btnEnregistrer.addStyleName(ValoTheme.BUTTON_PRIMARY);
    btnEnregistrer.addClickListener(e -> {
        try {
            /* Valide la saisie */
            fieldGroup.commit();
            boolean commitok = true;
            if (ajout) {
                //On regarde si le login source n'est pas dj dans la table
                String loginSource = (String) fieldGroup.getField("loginSource").getValue();
                if (configController.getSwapUtilisateur(loginSource) != null) {
                    commitok = false;
                    //afficher message d'erreur
                    Notification.show(applicationContext.getMessage(NAME + ".error.loginexistant", null,
                            UI.getCurrent().getLocale()), Notification.Type.ERROR_MESSAGE);
                }
            }
            if (commitok) {
                /* Enregistre le swap saisie */
                configController.saveSwap(swap);

                /* Ferme la fentre */
                close();
            }
        } catch (CommitException ce) {
        }
    });
    buttonsLayout.addComponent(btnEnregistrer);
    buttonsLayout.setComponentAlignment(btnEnregistrer, Alignment.MIDDLE_RIGHT);

    /* Centre la fentre */
    center();
}

From source file:lifetime.component.welcome.register.CancelButton.java

License:Apache License

public CancelButton(String language) {
    super(null, language, "Cancel", FontAwesome.TIMES);
    setCaption(getDescription());
}

From source file:me.uni.emuseo.view.common.helpers.ImagePreviewWindow.java

License:Open Source License

protected void buildButtons() {

    cancelButton = new Button();
    cancelButton.addStyleName("primary");
    cancelButton.setIcon(FontAwesome.TIMES);
    cancelButton.addClickListener(new ClickListener() {

        private static final long serialVersionUID = 7610746471261080892L;

        @Override//from  w ww.  j av  a 2s.co  m
        public void buttonClick(ClickEvent event) {
            onCancel();
        }

    });

    buttonLayout = new HorizontalLayout();
    buttonLayout.addComponent(cancelButton);
    buttonLayout.setSpacing(true);
    buttonLayout.addStyleName("form-buttons");
}

From source file:my.vaadin.app.MyUI.java

@Override
protected void init(VaadinRequest vaadinRequest) {
    final VerticalLayout layout = new VerticalLayout();

    filterText.setPlaceholder("filter by name...");
    filterText.addValueChangeListener(e -> updateList());
    filterText.setValueChangeMode(ValueChangeMode.LAZY);

    Button clearFilterTextBtn = new Button(FontAwesome.TIMES);
    clearFilterTextBtn.setDescription("Clear the current filter");
    clearFilterTextBtn.addClickListener(e -> filterText.clear());

    CssLayout filtering = new CssLayout();
    filtering.addComponents(filterText, clearFilterTextBtn);
    filtering.setStyleName(ValoTheme.LAYOUT_COMPONENT_GROUP);

    Button addCustomerBtn = new Button("Add new customer");
    addCustomerBtn.addClickListener(e -> {
        grid.asSingleSelect().clear();//from  w w w . ja va2  s  .c om
        form.setCustomer(new Customer());
    });

    HorizontalLayout toolbar = new HorizontalLayout(filtering, addCustomerBtn);

    grid.setColumns("firstName", "lastName", "email");

    HorizontalLayout main = new HorizontalLayout(grid, form);
    main.setSizeFull();
    grid.setSizeFull();
    main.setExpandRatio(grid, 1);

    layout.addComponents(toolbar, main);

    // fetch list of Customers from service and assign it to Grid
    updateList();

    setContent(layout);

    form.setVisible(false);

    grid.asSingleSelect().addValueChangeListener(event -> {
        if (event.getValue() == null) {
            form.setVisible(false);
        } else {
            form.setCustomer(event.getValue());
        }
    });
}

From source file:org.balisunrise.vaadin.components.ActionsLine.java

License:Open Source License

private void init() {
    setStyleName("b-actions-line");
    setWidth("100%");
    setHeightUndefined();/*from ww  w . j av a 2 s .  c  o  m*/

    confirmButton = new Button("Confirmar");
    confirmButton.setIcon(FontAwesome.CHECK, "");
    cancelButton = new Button("Cancelar");
    cancelButton.setIcon(FontAwesome.TIMES, "");

    center = new HorizontalLayout();
    center.setSpacing(true);

    addComponent(confirmButton);
    setComponentAlignment(confirmButton, Alignment.MIDDLE_RIGHT);

    addComponent(center);
    setComponentAlignment(center, Alignment.MIDDLE_CENTER);

    addComponent(cancelButton);
    setComponentAlignment(cancelButton, Alignment.MIDDLE_LEFT);

}

From source file:org.eclipse.hawkbit.ui.artifacts.upload.UploadProgressInfoWindow.java

License:Open Source License

private Button getCloseButton() {
    final Button closeBtn = SPUIComponentProvider.getButton(
            UIComponentIdProvider.UPLOAD_STATUS_POPUP_CLOSE_BUTTON_ID, "", "", "", true, FontAwesome.TIMES,
            SPUIButtonStyleNoBorder.class);
    closeBtn.addStyleName(ValoTheme.BUTTON_BORDERLESS);
    closeBtn.addClickListener(event -> onClose());
    return closeBtn;
}

From source file:org.eclipse.hawkbit.ui.artifacts.upload.UploadStatusInfoWindow.java

License:Open Source License

private Button getCloseButton() {
    final Button closeBtn = SPUIComponentProvider.getButton(
            UIComponentIdProvider.UPLOAD_STATUS_POPUP_CLOSE_BUTTON_ID, "", "", "", true, FontAwesome.TIMES,
            SPUIButtonStyleSmallNoBorder.class);
    closeBtn.addStyleName(ValoTheme.BUTTON_BORDERLESS);
    closeBtn.addClickListener(event -> onClose());
    return closeBtn;
}

From source file:org.eclipse.hawkbit.ui.common.CommonDialogWindow.java

License:Open Source License

private void createCancelButton() {
    cancelButton = SPUIComponentProvider.getButton(UIComponentIdProvider.CANCEL_BUTTON,
            i18n.getMessage(UIMessageIdProvider.BUTTON_CANCEL), "", "", true, FontAwesome.TIMES,
            SPUIButtonStyleNoBorderWithIcon.class);
    cancelButton.setSizeUndefined();//from  www. j a  v  a2s .  com
    cancelButton.addStyleName("default-color");
    addCloseListenerForCancelButton();
    if (cancelButtonClickListener != null) {
        cancelButton.addClickListener(cancelButtonClickListener);
    }

    buttonsLayout.addComponent(cancelButton);
    buttonsLayout.setComponentAlignment(cancelButton, Alignment.MIDDLE_LEFT);
    buttonsLayout.setExpandRatio(cancelButton, 1.0F);
}

From source file:org.eclipse.hawkbit.ui.common.detailslayout.SoftwareModuleDetailsTable.java

License:Open Source License

private VerticalLayout createSoftModuleLayout(final SoftwareModuleType swModType,
        final DistributionSet distributionSet, final Set<SoftwareModule> alreadyAssignedSwModules) {
    final VerticalLayout verticalLayout = new VerticalLayout();
    for (final SoftwareModule sw : alreadyAssignedSwModules) {
        if (swModType.getKey().equals(sw.getType().getKey())) {
            final HorizontalLayout horizontalLayout = new HorizontalLayout();
            horizontalLayout.setSizeFull();
            final Label softwareModule = HawkbitCommonUtil.getFormatedLabel("");
            final Button reassignSoftModule = SPUIComponentProvider.getButton(sw.getName(), "", "", "", true,
                    FontAwesome.TIMES, SPUIButtonStyleNoBorder.class);
            reassignSoftModule/*from w  w  w  . j  a v  a 2s.  c  o  m*/
                    .addClickListener(event -> unassignSW(event, distributionSet, alreadyAssignedSwModules));
            final String softwareModNameVersion = HawkbitCommonUtil.getFormattedNameVersion(sw.getName(),
                    sw.getVersion());
            softwareModule.setValue(softwareModNameVersion);
            softwareModule.setDescription(softwareModNameVersion);
            softwareModule.setId(sw.getName() + "-label");
            horizontalLayout.addComponent(softwareModule);
            horizontalLayout.setExpandRatio(softwareModule, 1F);
            if (isUnassignSoftModAllowed && permissionChecker.hasUpdateRepositoryPermission()
                    && !isTargetAssigned
                    && (isSoftModAvaiableForSoftType(alreadyAssignedSwModules, swModType))) {
                horizontalLayout.addComponent(reassignSoftModule);
            }
            verticalLayout.addComponent(horizontalLayout);
        }

    }

    return verticalLayout;
}