Search in sources :

Example 1 with Decorator

use of com.revolsys.ui.html.decorator.Decorator in project com.revolsys.open by revolsys.

the class UiBuilderObjectForm method initialize.

@Override
public void initialize(final HttpServletRequest request) {
    for (final String key : this.fieldKeys) {
        if (!getFieldNames().contains(key)) {
            final Element field = this.builder.getAttribute(request, key);
            if (field instanceof SetObject) {
                ((SetObject) field).setObject(this.object);
            }
            if (field != null) {
                if (!getElements().contains(field)) {
                    if (field instanceof HiddenField) {
                        final HiddenField hiddenField = (HiddenField) field;
                        add(hiddenField);
                    } else {
                        final Decorator label = this.builder.getAttributeFormGroupLabel(key, field);
                        this.fieldContainer.add(field, label);
                    }
                }
            }
        }
    }
    this.builder.initializeForm(this, request);
    super.initialize(request);
}
Also used : Decorator(com.revolsys.ui.html.decorator.Decorator) Element(com.revolsys.ui.html.view.Element) HiddenField(com.revolsys.ui.html.fields.HiddenField) SetObject(com.revolsys.ui.html.view.SetObject)

Example 2 with Decorator

use of com.revolsys.ui.html.decorator.Decorator in project com.revolsys.open by revolsys.

the class HtmlUiBuilderObjectForm method initialize.

@Override
public void initialize(final HttpServletRequest request) {
    for (final String key : this.fieldKeys) {
        if (!getFieldNames().contains(key)) {
            final Element field = this.builder.getAttribute(request, key);
            if (field instanceof SetObject) {
                ((SetObject) field).setObject(this.object);
            }
            if (field != null) {
                if (!getElements().contains(field)) {
                    final Decorator label = this.builder.getAttributeLabel(key, field);
                    add(field, label);
                }
            }
        }
    }
    this.builder.initializeForm(this, request);
    super.initialize(request);
}
Also used : Decorator(com.revolsys.ui.html.decorator.Decorator) Element(com.revolsys.ui.html.view.Element) SetObject(com.revolsys.ui.html.view.SetObject)

Example 3 with Decorator

use of com.revolsys.ui.html.decorator.Decorator in project com.revolsys.open by revolsys.

the class HtmlUiBuilder method getAttributeLabel.

public Decorator getAttributeLabel(final String key, final Element element) {
    final Map<String, Decorator> fieldLabels = getAttributeLabels();
    Decorator fieldLabel = fieldLabels.get(key);
    if (fieldLabel == null) {
        final String label = getLabel(key, element);
        final String instructions = getAttributeInstruction(key);
        if (element instanceof Field) {
            fieldLabel = new FieldLabelDecorator(label, instructions);
        } else {
            fieldLabel = new ElementLabel(label, instructions);
        }
        fieldLabels.put(key, fieldLabel);
    }
    return fieldLabel;
}
Also used : FieldLabelDecorator(com.revolsys.ui.html.decorator.FieldLabelDecorator) FormGroupDecorator(com.revolsys.ui.html.decorator.FormGroupDecorator) Decorator(com.revolsys.ui.html.decorator.Decorator) LongField(com.revolsys.ui.html.fields.LongField) TextField(com.revolsys.ui.html.fields.TextField) Field(com.revolsys.ui.html.fields.Field) FieldLabelDecorator(com.revolsys.ui.html.decorator.FieldLabelDecorator) ElementLabel(com.revolsys.ui.html.view.ElementLabel)

Aggregations

Decorator (com.revolsys.ui.html.decorator.Decorator)3 Element (com.revolsys.ui.html.view.Element)2 SetObject (com.revolsys.ui.html.view.SetObject)2 FieldLabelDecorator (com.revolsys.ui.html.decorator.FieldLabelDecorator)1 FormGroupDecorator (com.revolsys.ui.html.decorator.FormGroupDecorator)1 Field (com.revolsys.ui.html.fields.Field)1 HiddenField (com.revolsys.ui.html.fields.HiddenField)1 LongField (com.revolsys.ui.html.fields.LongField)1 TextField (com.revolsys.ui.html.fields.TextField)1 ElementLabel (com.revolsys.ui.html.view.ElementLabel)1