Search in sources :

Example 6 with Element

use of com.revolsys.ui.html.view.Element 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 7 with Element

use of com.revolsys.ui.html.view.Element in project com.revolsys.open by revolsys.

the class DivLayout method serialize.

@Override
public void serialize(final XmlWriter out, final ElementContainer container) {
    out.startTag(HtmlElem.DIV);
    if (this.cssClass != null) {
        out.attribute(HtmlAttr.CLASS, this.cssClass);
    }
    for (final Element element : container.getElements()) {
        out.startTag(HtmlElem.DIV);
        element.serialize(out);
        out.endTag(HtmlElem.DIV);
    }
    out.endTag(HtmlElem.DIV);
}
Also used : Element(com.revolsys.ui.html.view.Element)

Example 8 with Element

use of com.revolsys.ui.html.view.Element in project com.revolsys.open by revolsys.

the class TableLayout method serializeTbody.

private void serializeTbody(final XmlWriter out, final ElementContainer container) {
    out.startTag(HtmlElem.TBODY);
    final List elementList = container.getElements();
    int i = 0;
    int rowNum = 0;
    final int numElements = elementList.size();
    final int lastRow = (numElements - 1) / this.numColumns;
    for (final Iterator elements = elementList.iterator(); elements.hasNext(); ) {
        final Element element = (Element) elements.next();
        final int col = i % this.numColumns;
        String colCss = (String) this.cssClasses.get(col);
        final boolean firstCol = col == 0;
        final boolean lastCol = (i + 1) % this.numColumns == 0 || i == numElements - 1;
        if (firstCol) {
            out.startTag(HtmlElem.TR);
            String rowCss = "";
            if (rowNum == 0) {
                rowCss += " firstRow";
            }
            if (rowNum == lastRow) {
                rowCss += " lastRow";
            }
            if (rowCss.length() > 0) {
                out.attribute(HtmlAttr.CLASS, rowCss);
            }
            colCss += " firstCol";
        }
        if (lastCol) {
            colCss += " lastCol";
        }
        out.startTag(HtmlElem.TD);
        if (colCss.length() > 0) {
            out.attribute(HtmlAttr.CLASS, colCss);
        }
        element.serialize(out);
        out.endTag(HtmlElem.TD);
        i++;
        if (lastCol) {
            out.endTag(HtmlElem.TR);
            rowNum++;
        }
    }
    out.endTag(HtmlElem.TBODY);
}
Also used : Element(com.revolsys.ui.html.view.Element) Iterator(java.util.Iterator) List(java.util.List) ArrayList(java.util.ArrayList)

Example 9 with Element

use of com.revolsys.ui.html.view.Element in project com.revolsys.open by revolsys.

the class AbstractElementTag method serializeElements.

/**
 * Write out the HTML tags for each element.
 *
 * @param out The writer.
 * @param elements The elements to write.
 * @throws IOException If there was an error writing the elements.
 */
private void serializeElements(final Writer out, final Collection elements) throws IOException {
    final Iterator elementIter = elements.iterator();
    while (elementIter.hasNext()) {
        final Element element = (Element) elementIter.next();
        element.serialize(out, false);
    }
}
Also used : Element(com.revolsys.ui.html.view.Element) Iterator(java.util.Iterator)

Example 10 with Element

use of com.revolsys.ui.html.view.Element in project com.revolsys.open by revolsys.

the class DefinitionListLayout method serialize.

@Override
public void serialize(final XmlWriter out, final ElementContainer container) {
    out.startTag(HtmlElem.DL);
    if (this.cssClass != null) {
        out.attribute(HtmlAttr.CLASS, this.cssClass);
    }
    for (final Iterator elements = container.getElements().iterator(); elements.hasNext(); ) {
        Element element = (Element) elements.next();
        out.startTag(HtmlElem.DT);
        element.serialize(out);
        out.endTag(HtmlElem.DT);
        out.startTag(HtmlElem.DD);
        if (elements.hasNext()) {
            element = (Element) elements.next();
            element.serialize(out);
        } else {
            out.entityRef("nbsp");
        }
        out.endTag(HtmlElem.DD);
    }
    out.endTag(HtmlElem.DL);
}
Also used : Element(com.revolsys.ui.html.view.Element) Iterator(java.util.Iterator)

Aggregations

Element (com.revolsys.ui.html.view.Element)15 Iterator (java.util.Iterator)4 HttpServletRequest (javax.servlet.http.HttpServletRequest)3 Decorator (com.revolsys.ui.html.decorator.Decorator)2 SetObject (com.revolsys.ui.html.view.SetObject)2 Writer (java.io.Writer)2 XmlWriter (com.revolsys.record.io.format.xml.XmlWriter)1 HiddenField (com.revolsys.ui.html.fields.HiddenField)1 KeySerializer (com.revolsys.ui.html.serializer.key.KeySerializer)1 ButtonsToolbarElement (com.revolsys.ui.html.view.ButtonsToolbarElement)1 ElementContainer (com.revolsys.ui.html.view.ElementContainer)1 TabElementContainer (com.revolsys.ui.html.view.TabElementContainer)1 DocInfo (com.revolsys.ui.model.DocInfo)1 Menu (com.revolsys.ui.model.Menu)1 PageInfo (com.revolsys.ui.model.PageInfo)1 Page (com.revolsys.ui.web.config.Page)1 PageNotFoundException (com.revolsys.ui.web.exception.PageNotFoundException)1 PrintWriter (java.io.PrintWriter)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1