Search in sources :

Example 1 with HtmlPanelGrid

use of javax.faces.component.html.HtmlPanelGrid in project liferay-faces-alloy by liferay.

the class ColumnRenderer method encodeBegin.

@Override
public void encodeBegin(FacesContext facesContext, UIComponent uiComponent) throws IOException {
    ResponseWriter responseWriter = facesContext.getResponseWriter();
    UIComponent parent = uiComponent.getParent();
    if (!((parent instanceof HtmlDataTable) || (parent instanceof HtmlPanelGrid))) {
        responseWriter.startElement("div", uiComponent);
        String clientId = uiComponent.getClientId(facesContext);
        responseWriter.writeAttribute("id", clientId, null);
        Column column = (Column) uiComponent;
        StringBuilder classNames = new StringBuilder();
        String size = column.getSize();
        size = getColumnCSSClassSize(size);
        Integer span = column.getSpan();
        if (span != null) {
            if ((span < 1) || (span > Column.COLUMNS)) {
                throw new IOException("span number must be between 1 and " + Column.COLUMNS);
            }
        }
        Integer width = column.getWidth();
        if (width != null) {
            if ((width < 1) || (width > 100)) {
                throw new IOException("width must be between 1 and 100");
            }
            span = getColumnUnitSize(width);
        }
        classNames.append("col-");
        classNames.append(size);
        classNames.append("-");
        classNames.append(span);
        Integer offset = column.getOffset();
        if (offset != null) {
            if ((offset < 1) || (offset > Column.COLUMNS)) {
                throw new IOException("offset must be between 1 and " + Column.COLUMNS);
            }
        }
        Integer offsetWidth = column.getOffsetWidth();
        if (offsetWidth != null) {
            if ((offsetWidth < 1) || (offsetWidth > 100)) {
                throw new IOException("offsetWidth must be between 1 and 100");
            }
            offset = getColumnUnitSize(offsetWidth);
        }
        if (offset != null) {
            classNames.append(" ");
            classNames.append("col-");
            classNames.append(size);
            classNames.append("-offset-");
            classNames.append(offset);
        }
        RendererUtil.encodeStyleable(responseWriter, column, classNames.toString());
    }
}
Also used : HtmlDataTable(javax.faces.component.html.HtmlDataTable) ResponseWriter(javax.faces.context.ResponseWriter) Column(com.liferay.faces.alloy.component.column.Column) UIComponent(javax.faces.component.UIComponent) HtmlPanelGrid(javax.faces.component.html.HtmlPanelGrid) IOException(java.io.IOException)

Example 2 with HtmlPanelGrid

use of javax.faces.component.html.HtmlPanelGrid in project gdmatrix by gdmatrix.

the class WidgetTestBean method loadPanel.

private void loadPanel() {
    panel = new HtmlPanelGrid();
    panel.setId("panel_id");
    // Add output
    HtmlPanelGroup group = new HtmlPanelGroup();
    group.setId("group_id");
    HtmlOutputText output = new HtmlOutputText();
    output.setId("output_id");
    output.setValue("Hoy es: ");
    group.getChildren().add(output);
    HtmlCalendar cal = new HtmlCalendar();
    cal.setId("cal_id");
    cal.setValue(TextUtils.formatDate(new Date(), "dd/MM/yyyy"));
    group.getChildren().add(cal);
    panel.getChildren().add(group);
}
Also used : HtmlPanelGroup(javax.faces.component.html.HtmlPanelGroup) HtmlPanelGrid(javax.faces.component.html.HtmlPanelGrid) HtmlOutputText(javax.faces.component.html.HtmlOutputText) HtmlCalendar(org.santfeliu.faces.component.HtmlCalendar) Date(java.util.Date)

Example 3 with HtmlPanelGrid

use of javax.faces.component.html.HtmlPanelGrid in project liferay-faces-alloy by liferay.

the class ColumnRenderer method encodeEnd.

@Override
public void encodeEnd(FacesContext facesContext, UIComponent uiComponent) throws IOException {
    ResponseWriter responseWriter = facesContext.getResponseWriter();
    UIComponent parent = uiComponent.getParent();
    if (!((parent instanceof HtmlDataTable) || (parent instanceof HtmlPanelGrid))) {
        responseWriter.endElement("div");
    }
}
Also used : HtmlDataTable(javax.faces.component.html.HtmlDataTable) ResponseWriter(javax.faces.context.ResponseWriter) UIComponent(javax.faces.component.UIComponent) HtmlPanelGrid(javax.faces.component.html.HtmlPanelGrid)

Aggregations

HtmlPanelGrid (javax.faces.component.html.HtmlPanelGrid)3 UIComponent (javax.faces.component.UIComponent)2 HtmlDataTable (javax.faces.component.html.HtmlDataTable)2 ResponseWriter (javax.faces.context.ResponseWriter)2 Column (com.liferay.faces.alloy.component.column.Column)1 IOException (java.io.IOException)1 Date (java.util.Date)1 HtmlOutputText (javax.faces.component.html.HtmlOutputText)1 HtmlPanelGroup (javax.faces.component.html.HtmlPanelGroup)1 HtmlCalendar (org.santfeliu.faces.component.HtmlCalendar)1