18 package org.turro.zkoss.layout;
20 import org.turro.zkoss.grid.GroupExtended;
21 import org.turro.zkoss.label.StyledLabel;
22 import org.zkoss.zk.ui.Component;
23 import org.zkoss.zk.ui.HtmlBasedComponent;
24 import org.zkoss.zk.ui.ext.AfterCompose;
25 import org.zkoss.zul.*;
39 setSclass(
"grid-layout");
44 setSclass(
"grid-layout");
50 setSclass(
"grid-layout");
56 Columns cols = getColumns();
61 cols.getChildren().clear();
63 cols.setVisible(
false);
64 for(
int i = 0; i < columns; i++) {
65 Column col =
new Column();
67 cols.appendChild(col);
73 String hfs[] = hflexs.split(
",");
74 Columns cols = getColumns();
79 cols.getChildren().clear();
81 cols.setStyle(
"height:0px");
82 for(
int i = 0; i < hfs.length; i++) {
83 Column col =
new Column();
84 if(hfs[i].startsWith(
"right-")) {
85 col.setAlign(
"right");
86 setWidthFlex(col, hfs[i].substring(6));
88 setWidthFlex(col, hfs[i]);
90 cols.appendChild(col);
99 setSclass(
"grid-layout-head");
102 for(Component col : getColumns().getChildren()) {
103 ((Column)col).setLabel(captions[index++]);
105 getColumns().setStyle(
null);
109 getRows(
true).getChildren().clear();
116 getRows(
true).appendChild(group);
149 if(comp instanceof AfterCompose) {
150 ((AfterCompose) comp).afterCompose();
156 Cell cell =
new Cell();
157 cell.setColspan(cols);
158 cell.appendChild(comp);
160 if(comp instanceof AfterCompose) {
161 ((AfterCompose) comp).afterCompose();
167 Cell cell =
new Cell();
168 cell.setRowspan(rows);
169 cell.appendChild(comp);
171 if(comp instanceof AfterCompose) {
172 ((AfterCompose) comp).afterCompose();
191 Rows rows = super.getRows();
192 if(rows ==
null && create) {
207 private void setWidthFlex(Column col, String flex) {
208 if(flex.matches(
"[0-9]+(px|\\%)")) {
void setColCaptions(String captions)
void setColumns(String hflexs)
GridLayout addGroup(String title, boolean open)
void setColumns(int columns)
GridLayout addComponent(HtmlBasedComponent comp)
GridLayout insertBeforeRow(Row row)
Rows getRows(boolean create)
GridLayout addSpannedComponent(HtmlBasedComponent comp, int cols)
void setData(Object data)
GridLayout addCaption(String label)
void setColCaptions(String[] captions)
GridLayout addValue(String value)
GridLayout addBoldValue(String value)
GridLayout(String hflexs)
GridLayout addRowSpannedComponent(HtmlBasedComponent comp, int rows)