public void onOk() {
   final NormalFilterModel modelFilter = new NormalFilterModel();
   for (RowModel row : rows) {
     modelFilter.add(row.getModel());
   }
   org.zkoss.zk.ui.event.Events.postEvent(
       new Event("onSave", self, clearFilterModel(modelFilter)));
   self.detach();
 }
 public void onRenderComponents(final Row row) {
   final Component lastChild = row.getLastChild(); // image button remove
   final RowModel model = getModelFromComponent(row);
   for (int i = 0; i < DLFilterOperator.MAX_ARITY; ++i) { // remove all
     lastChild.getPreviousSibling().setParent(null);
   }
   for (int i = 0; i < DLFilterOperator.MAX_ARITY; ++i) { // insert all
     row.insertBefore(model.getPosition(i + 1), lastChild);
   }
   LOGGER.debug("Components have been rendered.");
 }
 public void refreshComponents(final Row row) {
   final RowModel model = getModelFromComponent(row);
   final int oldArity = model.getRenderedArity();
   final int newArity = model.getModel().getOperator().getArity();
   if (model.isRerender()) {
     for (int i = 1; i <= newArity; ++i) {
       model.setPosition(i, createComponent(model.getModel(), i));
     }
     for (int i = newArity + 1; i <= DLFilterOperator.MAX_ARITY; ++i) {
       model.setPosition(i, new Space());
     }
     model.rendered(newArity);
     Events.postEvent("onRenderComponents", row, null);
     LOGGER.debug("Components have been regenerated due to factory changed.");
   } else if (oldArity != newArity) {
     for (int i = oldArity + 1; i <= newArity; ++i) {
       model.setPosition(i, createComponent(model.getModel(), i));
     }
     for (int i = newArity + 1; i <= oldArity; ++i) {
       model.setPosition(i, new Space());
       model.getModel().setValue(i, null); // uncomment of this row
       // causes that the value will be reset after the component is hidden
       // now the value persists till the factory is not changed
     }
     model.rendered(newArity);
     Events.postEvent("onRenderComponents", row, null);
     LOGGER.debug("Components have been modified due to arity changed.");
   }
 }