Example usage for com.vaadin.ui AbstractField setEnabled

List of usage examples for com.vaadin.ui AbstractField setEnabled

Introduction

In this page you can find the example usage for com.vaadin.ui AbstractField setEnabled.

Prototype

@Override
    public void setEnabled(boolean enabled) 

Source Link

Usage

From source file:fr.amapj.view.engine.popup.formpopup.fieldlink.FieldLink.java

License:Open Source License

private void valueChanged() {
    boolean actif = isActif();

    for (AbstractField<?> field : fields) {
        // Activation - desactivation 
        if (field instanceof CKEditorTextField) {
            // Attention : il y a un bug dans le wrapper ckeditor, le setEnabled ne fonctionne pas
            ((CKEditorTextField) field).setViewWithoutEditor(!actif);
        } else {/*from  w  w w  .  ja v a  2s  . co  m*/
            field.setEnabled(actif);
        }

        // Remise  zro si ncessaire
        if (actif == false) {
            if (field instanceof TextField) {
                // Tres important : sinon la desactivation des IntegerTextField ne fonctionne pas 
                ((TextField) field).setValue("");
            } else {
                field.setValue(null);
            }
        }
    }

    // On passe ensuite aux FieldLink fils
    for (FieldLink child : childs) {
        child.valueChanged();
    }

}

From source file:fr.amapj.view.views.parametres.PopupSaisieParametres.java

License:Open Source License

private void addFieldMailInfo() {
    // Titre/*from w ww.  j a v a 2s . c  om*/
    setStepTitle("information sur l'envoi des mails");

    AbstractField b = addComboEnumField("Type du serveur de mail", "smtpType", new NotNullValidator());
    b.setEnabled(adminFull);

    b = addTextField("Adresse mail qui enverra les messages", "sendingMailUsername");
    b.setEnabled(allowedModifyMailSender);

    b = addPasswordTextField("Password de l'adresse mail qui enverra les messages", "sendingMailPassword");
    b.setEnabled(allowedModifyMailSender);

    b = addIntegerField("Nombre maximum de mail par jour", "sendingMailNbMax");
    b.setEnabled(adminFull);

    b = addTextField("URL de l'application utilise dans les mails", "url");
    b.setEnabled(adminFull);

    addTextField("Adresse mail qui sera en copie de tous les mails envoys par le logiciel", "mailCopyTo");

    addTextField("Adresse mail du destinataire des sauvegardes quotidiennes", "backupReceiver");

}

From source file:nz.co.senanque.vaadinsupport.HintsImpl.java

License:Apache License

public void setCommonProperties(final AbstractField ret, final MaduraPropertyWrapper property,
        final MessageSource messageSource) {
    ret.setWidth(getWidth());/*from  w w w  . j  av  a2 s.  c om*/
    ret.setReadThrough(true);
    ret.setPropertyDataSource(property);
    ret.setCaption(property.getLabel());
    ret.setRequired(property.isRequired());
    if (property.isRequired()) {
        ret.setInvalidCommitted(true);
    }
    if (property.isReadOnly()) {
        ret.setReadOnly(true);
    }
    ret.setEnabled(property.isEnabled());
    ret.setVisible(property.isVisible());
    ret.setImmediate(m_forceImmediate);
    ret.setLocale(LocaleContextHolder.getLocale());
    MessageSourceAccessor messageSourceAccessor = new MessageSourceAccessor(messageSource);
    ret.setDescription(
            messageSourceAccessor.getMessage(property.getDescription(), null, property.getDescription()));
    if (property.isNumeric()) {
        ret.addStyleName("v-textfield-align-right");
    }
    ret.setErrorHandler(new ComponentErrorHandler() {

        private static final long serialVersionUID = -1393935533100204195L;

        public boolean handleComponentError(ComponentErrorEvent event) {
            Throwable t = event.getThrowable();
            while (t != null) {
                if (t instanceof ValidationException) {
                    ret.setComponentError(new UserError(((ValidationException) t).getMessage()));
                    return true;
                }
                t = t.getCause();
            }
            return false;
        }
    });

}

From source file:nz.co.senanque.vaadinsupport.TouchkitHintsImpl.java

License:Apache License

public void setCommonProperties(final AbstractField ret, final MaduraPropertyWrapper property,
        final MessageSource messageSource) {
    ret.setWidth(getWidth());//from w w w.jav  a2  s. co  m
    ret.setReadThrough(true);
    ret.setPropertyDataSource(property);
    ret.setCaption(property.getLabel());
    ret.setRequired(property.isRequired());
    if (property.isRequired()) {
        ret.setInvalidCommitted(true);
    }
    ret.setReadOnly(property.isReadOnly());
    ret.setEnabled(property.isEnabled());
    ret.setVisible(property.isVisible());
    ret.setImmediate(m_forceImmediate);
    ret.setLocale(LocaleContextHolder.getLocale());
    MessageSourceAccessor messageSourceAccessor = new MessageSourceAccessor(messageSource);
    ret.setDescription(
            messageSourceAccessor.getMessage(property.getDescription(), null, property.getDescription()));
    if (property.isNumeric()) {
        ret.addStyleName("v-textfield-align-right");
    }
    ret.setErrorHandler(new ComponentErrorHandler() {

        private static final long serialVersionUID = -1393935533100204195L;

        public boolean handleComponentError(ComponentErrorEvent event) {
            Throwable t = event.getThrowable();
            while (t != null) {
                if (t instanceof ValidationException) {
                    ret.setComponentError(new UserError(((ValidationException) t).getMessage()));
                    return true;
                }
                t = t.getCause();
            }
            return false;
        }
    });

}

From source file:org.hip.vif.web.util.ConfigViewHelper.java

License:Open Source License

/** Decorates a UI field instance with <code>is required</code> and error indicators.
 *
 * @param inInput AbstractField&lt;?> the field to decorate
 * @param inEnable boolean <code>true</code> to set the field enabled
 * @param inMessages {@link IMessages}//from   w w  w  . j  a va  2  s.com
 * @param inFieldName String the field label
 * @return AbstractField&lt;?> */
private AbstractField<?> decorateField(final AbstractField<?> inInput, final boolean inEnable,
        final IMessages inMessages, final String inFieldName) {
    inInput.setRequired(inEnable);
    inInput.setRequiredError(inMessages.getFormattedMessage("errmsg.field.not.empty", inFieldName)); //$NON-NLS-1$
    inInput.setEnabled(inEnable);
    inInput.setImmediate(true);
    return inInput;
}