Search in sources :

Example 11 with Element

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

the class TableBodyLayout method serializeTbody.

private void serializeTbody(final XmlWriter out, final ElementContainer container) {
    out.startTag(HtmlElem.TBODY);
    if (this.cssClass != null) {
        out.attribute(HtmlAttr.CLASS, this.cssClass);
    }
    final List<Element> elementList = container.getElements();
    int i = 0;
    int rowNum = 0;
    final int numElements = elementList.size();
    final int lastRow = (numElements - 1) / this.numColumns;
    for (final Element element : elementList) {
        final int col = i % this.numColumns;
        String colCss = 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)

Example 12 with Element

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

the class UnorderedListLayout method serialize.

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

Example 13 with Element

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

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

the class RawLayout method serialize.

@Override
public void serialize(final XmlWriter out, final ElementContainer container) {
    for (final Object element2 : container.getElements()) {
        final Element element = (Element) element2;
        element.serialize(out);
    }
}
Also used : Element(com.revolsys.ui.html.view.Element)

Example 15 with Element

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

the class DisplayElementTag method doStartTag.

@Override
public int doStartTag() throws JspException {
    if (this.name != null) {
        final HttpServletRequest request = (HttpServletRequest) this.pageContext.getRequest();
        try {
            final Element element = (Element) request.getAttribute(this.name);
            if (element != null) {
                final Writer out = this.pageContext.getOut();
                element.serialize(out, this.useNamespaces);
            }
        } catch (final Throwable t) {
            HttpServletLogUtil.logRequestException(this, request, t);
            throw new JspException(t.getMessage(), t);
        }
    }
    return SKIP_BODY;
}
Also used : HttpServletRequest(javax.servlet.http.HttpServletRequest) JspException(javax.servlet.jsp.JspException) Element(com.revolsys.ui.html.view.Element) Writer(java.io.Writer)

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