Package org.zkoss.zul

Examples of org.zkoss.zul.Row


  }
 
  //-- RowRendererExt --//
  public Row newRow(Grid grid) {
    //clone from template
    final Row clone = (Row)_template.clone();
   
    //avoid duplicate id error, will set to new id when render()
    //Bug #1962153: Data binding generates duplicate id in some case (add "_")
    if (clone.getId().length() > 0) {
      clone.setId(null);
    }
         
    //link cloned component with template
    //each Row and its decendants share the same templatemap
    Map templatemap = new HashMap(7);
    linkTemplates(clone, _template, templatemap);
   
    //link this template map to parent templatemap (Grid in Grid)
    Map parenttemplatemap = (Map) grid.getAttribute(DataBinder.TEMPLATEMAP);
    if (parenttemplatemap != null) {
      templatemap.put(DataBinder.TEMPLATEMAP, parenttemplatemap);
    }
    //kept clone kids somewhere to avoid create too many components in browser
    final List kids = new ArrayList(clone.getChildren());
    clone.setAttribute(KIDS, kids);
    clone.getChildren().clear();
    return clone;
  }
View Full Code Here


    return (Component) getItems(comp).get(index);
  }

  public Component getComponentCollectionOwner(Component comp) {
    if (comp instanceof Row) {
      final Row row = (Row) comp;
      return row.getGrid();
    } else {
      throw new UiException("Unsupported type for RowCollectionItem: "
          + comp);
    }
  }
View Full Code Here

    }
  }

  public void setupBindingRenderer(Component comp, DataBinder binder) {
    if (comp instanceof Row) {
      final Row row = (Row) comp;
      final Grid grid = row.getGrid();
      if (grid.getRowRenderer() == null) {
        grid.setRowRenderer(new BindingRowRenderer(row, binder));
      }
    }
  }
View Full Code Here

 
  /** Creates a new and unloaded row. */
  protected Component newUnloadedItem(Object renderer, int index) {
    final RowRenderer renderer0 = (RowRenderer) renderer;
    final ListModel model = ((Grid)getOwner()).getModel();
    Row row = null;
    if (model instanceof GroupsListModel) {
      final GroupsListModel gmodel = (GroupsListModel) model;
      final GroupDataInfo info = gmodel.getDataInfo(index);
      switch(info.type){
      case GroupDataInfo.GROUP:
View Full Code Here

    newUnloadedCell(renderer0, row);
    return row;
  }
 
  private Row newRow(RowRenderer renderer) {
    Row row = null;
    if (renderer instanceof RowRendererExt)
      row = ((RowRendererExt)renderer).newRow((Grid)getOwner());
    if (row == null) {
      row = new Row();
      row.applyProperties();
    }
    return row;
  }
View Full Code Here

  }
 
  protected Set getAvailableAtClient(int offset, int limit) {
    final Set avail = new LinkedHashSet(32);
    final Rows rows = _grid.getRows();
    Row row = (Row) rows.getFirstChild();
    while(row != null) {
      if (limit == 0) break;
      if (row.isVisible()) {
        if (--offset < 0) {
          --limit;
          avail.add(row);
        }
      }
      if (row instanceof Group) {
        final Group g = (Group) row;
        if (!g.isOpen()) {
          for (int j = 0, len = g.getItemCount(); j < len && row != null; j++)
            row = (Row) row.getNextSibling();
        }
      }
      if (row != null)
        row = (Row) row.getNextSibling();
    }
    return avail;
  }
View Full Code Here

    column1.setParent(columns);

    final Rows rows = new Rows();
    rows.setParent(grid);

    final Row row = new Row();
    row.setParent(rows);

    this.Vbox_Buttons = new Vbox();
    this.Vbox_Buttons.setParent(panelchildren);

    this.div_Buttons = new Div();
View Full Code Here

   * @param tableName
   * @param value
   */
  private void addNewRow(Rows rowParent, String tableName, Object value) {

    Row row = new Row();

    Html html_TableName = new Html(tableName);
    html_TableName.setStyle("padding-left: 5px;");
    Div divKey = new Div();
    divKey.setAlign("left");
    divKey.appendChild(html_TableName);

    Html html_RecordCount = null;

    if (value instanceof BigDecimal) {
      BigDecimal myDec = (BigDecimal) value;
      myDec = myDec.setScale(2, BigDecimal.ROUND_HALF_UP);

      // Format the value to money
      NumberFormat formatter = new DecimalFormat("#,##0.00");
      String money = formatter.format(myDec);

      html_RecordCount = new Html(money);
    } else if (value instanceof Integer) {
      // Format the value
      NumberFormat formatter = new DecimalFormat("###,###.###");
      String formattedInteger = formatter.format(value);
      html_RecordCount = new Html(String.valueOf(value));
    } else
      html_RecordCount = new Html(String.valueOf(value));

    html_RecordCount.setStyle("padding-right: 5px;");
    Div divValue = new Div();
    divValue.setAlign("right");
    divValue.appendChild(html_RecordCount);

    row.appendChild(divKey);
    row.appendChild(divValue);
    row.setParent(rowParent);

  }
View Full Code Here

   * @param value
   * @param color
   */
  private void addNewRow(Rows rowParent, String tableName, Object value, String color) {

    Row row = new Row();

    Html html_TableName = new Html(tableName);
    html_TableName.setStyle("padding-left: 5px; color: " + color + ";");
    Div divKey = new Div();
    divKey.setAlign("left");
    divKey.appendChild(html_TableName);

    Html html_RecordCount = null;

    if (value instanceof BigDecimal) {
      BigDecimal myDec = (BigDecimal) value;
      myDec = myDec.setScale(2, BigDecimal.ROUND_HALF_UP);

      // Format the value to money
      NumberFormat formatter = new DecimalFormat("#,##0.00");

      String money = formatter.format(myDec);

      html_RecordCount = new Html(money);
    } else if (value instanceof Integer) {
      // Format the value
      NumberFormat formatter = new DecimalFormat("###,###.###");
      String formattedInteger = formatter.format(value);
      html_RecordCount = new Html(String.valueOf(value));
    } else
      html_RecordCount = new Html(String.valueOf(value));

    html_RecordCount.setStyle("padding-right: 5px; color: " + color + ";");
    Div divValue = new Div();
    divValue.setAlign("right");
    divValue.appendChild(html_RecordCount);

    row.appendChild(divKey);
    row.appendChild(divValue);
    row.setParent(rowParent);

  }
View Full Code Here

   * org.zkoss.zk.ui.util.GenericComposer#doBeforeCompose(org.zkoss.zk.ui.
   * Page, org.zkoss.zk.ui.Component, org.zkoss.zk.ui.metainfo.ComponentInfo)
   */
  @Override
  public ComponentInfo doBeforeCompose(Page page, Component parent, ComponentInfo compInfo) {
    final Row row = (Row) parent.getParent();
    final HibernateStatistics hibernateStatistics = (HibernateStatistics) row.getValue();

    this.guiHibernateStatisticsService.initDetails(hibernateStatistics);

    parent.setAttribute("hs", hibernateStatistics, false);

View Full Code Here

TOP

Related Classes of org.zkoss.zul.Row

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.