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);
}
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);
}
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);
}
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);
}
}
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;
}
Aggregations