Example usage for com.vaadin.ui AbstractField setVisible

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

Introduction

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

Prototype

@Override
    public void setVisible(boolean visible) 

Source Link

Usage

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());//  w  w  w  . j a  v a 2s.c o  m
    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 ww w .j  av  a  2s .com*/
    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;
        }
    });

}