Search in sources :

Example 1 with UIPanel

use of javax.faces.component.UIPanel in project acs-community-packaging by Alfresco.

the class UISearchCustomProperties method encodeBegin.

/**
 * @see javax.faces.component.UIComponentBase#encodeBegin(javax.faces.context.FacesContext)
 */
@SuppressWarnings("unchecked")
public void encodeBegin(FacesContext context) throws IOException {
    if (isRendered() == false) {
        return;
    }
    ResponseWriter out = context.getResponseWriter();
    if (getChildCount() == 0) {
        createComponentsFromConfig(context);
    }
    // encode the components in a 3 column table
    out.write("<table cellspacing=2 cellpadding=2 border=0");
    outputAttribute(out, getAttributes().get("styleClass"), "class");
    outputAttribute(out, getAttributes().get("style"), "style");
    out.write('>');
    List<UIComponent> children = getChildren();
    int colCounter = 0;
    for (int i = 0; i < children.size(); i++) {
        UIComponent component = children.get(i);
        if (component instanceof UIPanel) {
            out.write("<tr><td colspan=3>");
            Utils.encodeRecursive(context, component);
            out.write("</td></tr>");
            colCounter += 3;
        } else {
            if ((colCounter % 3) == 0) {
                out.write("<tr>");
            }
            out.write("<td>");
            Utils.encodeRecursive(context, component);
            out.write("</td>");
            if ((colCounter % 3) == 2) {
                out.write("</tr>");
            }
            colCounter++;
        }
    }
    out.write("</table>");
}
Also used : ResponseWriter(javax.faces.context.ResponseWriter) UIComponent(javax.faces.component.UIComponent) UIPanel(javax.faces.component.UIPanel) Constraint(org.alfresco.service.cmr.dictionary.Constraint) ListOfValuesConstraint(org.alfresco.repo.dictionary.constraint.ListOfValuesConstraint)

Aggregations

UIComponent (javax.faces.component.UIComponent)1 UIPanel (javax.faces.component.UIPanel)1 ResponseWriter (javax.faces.context.ResponseWriter)1 ListOfValuesConstraint (org.alfresco.repo.dictionary.constraint.ListOfValuesConstraint)1 Constraint (org.alfresco.service.cmr.dictionary.Constraint)1