BrightSide Workbench Full Report + Source Code
org.turro.zkoss.grid.EditableGrid< V > Class Template Referenceabstract
Inheritance diagram for org.turro.zkoss.grid.EditableGrid< V >:
Collaboration diagram for org.turro.zkoss.grid.EditableGrid< V >:

Public Member Functions

 EditableGrid ()
 
boolean isAllowDeletions ()
 
void setAllowDeletions (boolean allowDeletions)
 
boolean isAllowInsertions ()
 
void setAllowInsertions (boolean allowInsertions)
 
EditableCell getCurrentCell ()
 
Row getLastRow ()
 
boolean isReadOnly ()
 
void setReadOnly (boolean readOnly)
 
boolean isSelectInput ()
 
void setSelectInput (boolean selectInput)
 
boolean isShowZeros ()
 
void setShowZeros (boolean showZeros)
 
void clearTable ()
 
void clearFoot ()
 
void clearRows ()
 
void clearValidRows ()
 
void clearColumns ()
 
List< V > getValues ()
 
List< V > getAllValues ()
 
EventListener getEditListener ()
 
EventListener getNextListener ()
 
EventListener getKeyListener ()
 
EventListener getBlurListener ()
 
EventListener getCancelListener ()
 
void processEdition (EditableCell editableCell)
 
void cancelEdition ()
 
HtmlBasedComponent getEditor (EditableCell editableCell)
 
Row appendValue ()
 
Row addNewRow ()
 
void deleteSelectedRow (final Row row)
 
void insertInSelectedRow (Row row)
 
Column getEditableColumn (int cellIndex)
 
void updateRow (Row row)
 
void updateRows ()
 
EditableColumn addColumn (String label, Class javaClass, String property, String format, int scale, boolean onlyDate, boolean readOnly)
 
EditableColumn addColumn (String label, String javaClass, String property, String format, int scale, boolean onlyDate, boolean readOnly) throws ClassNotFoundException
 
EditableColumn addColumn (String image, String tooltip, Class javaClass, String property, String format, int scale, boolean onlyDate, boolean readOnly)
 
EditableColumn addColumn (String image, String tooltip, String javaClass, String property, String format, int scale, boolean onlyDate, boolean readOnly) throws ClassNotFoundException
 
void afterCompose ()
 
- Public Member Functions inherited from org.turro.zkoss.grid.PagingGrid
void setColumns (int columns)
 
void setColumns (String hflexs)
 
void refine ()
 
boolean isDefaultBehavior ()
 
void setDefaultBehavior (boolean defaultBehavior)
 
String getRefineValue ()
 
void setRefineValue (String value)
 
int getMaxResults ()
 
void setMaxResults (int maxResults)
 
String getPagingMold ()
 
void setPagingMold (String pagingMold)
 
int getRowCount ()
 
void setRowCount (int rows)
 
void setHeadersVisible (boolean value)
 
boolean isHeadersVisible ()
 
String getVarColumns ()
 
void setVarColumns (String varColumns)
 
Collection< String > getVarColumnsList (String defaultCols)
 
void addDetailColumn ()
 
void addDetailColumn (HtmlBasedComponent caption)
 
void openDetails ()
 
boolean isEmpty ()
 
void clearEmptyGroups ()
 
Columns getColumns (boolean create)
 
Rows getRows (boolean create)
 
Foot getFoot (boolean create)
 
Foot createFoot ()
 
void exportToPdf ()
 

Public Attributes

EditEventListener editListener
 
NextEventListener nextListener
 
KeyEventListener keyListener
 
CancelEventListener cancelListener
 
BlurEventListener blurListener
 
boolean allowInsertions
 

Protected Member Functions

Object getCellValue (EditableCell editableCell)
 
Object getEditorValue (EditableCell editableCell)
 
void setCellValue (EditableCell editableCell, Object value)
 
String formatCell (EditableCell editableCell, Object value)
 
HtmlBasedComponent createEditor (EditableCell editableCell)
 
HtmlBasedComponent createRenderer (EditableCell editableCell)
 
void cellChanged (EditableCell editableCell, Object value)
 
boolean isCellValid (EditableCell editableCell, Object value)
 
boolean canDeleteRow (Row row)
 
boolean canEditRow (Row row)
 
abstract void initiateRow (Row row, V value)
 
abstract boolean deleteRow (Row row)
 
abstract void rowChanged (Row row)
 
abstract boolean isValid (V v)
 

Protected Attributes

EditableCell currentCell
 
String ctrlKeys
 
Row lastRow
 

Detailed Description

Author
Lluis Turró Cutiller lluis.nosp@m.@tur.nosp@m.ro.or.nosp@m.g

Definition at line 46 of file EditableGrid.java.

Constructor & Destructor Documentation

◆ EditableGrid()

Definition at line 63 of file EditableGrid.java.

63  {
64  setSclass("editableGrid");
65  }

Member Function Documentation

◆ addColumn() [1/4]

EditableColumn org.turro.zkoss.grid.EditableGrid< V >.addColumn ( String  image,
String  tooltip,
Class  javaClass,
String  property,
String  format,
int  scale,
boolean  onlyDate,
boolean  readOnly 
)

Definition at line 372 of file EditableGrid.java.

373  {
374  EditableColumn ec = new EditableColumn();
375  ec.setImage(image);
376  ec.setTooltiptext(tooltip);
377  ec.setFormat(format);
378  ec.setJavaClass(javaClass);
379  ec.setOnlyDate(onlyDate);
380  ec.setProperty(property);
381  ec.setReadOnly(readOnly);
382  ec.setScale(scale);
383  if(ec.isNumber()) {
384  ec.setAlign("right");
385  if(Strings.isBlank(format)) {
386  ec.setFormat(DecimalFormats.getStringFormat(ec.getScale()));
387  }
388  }
389  getColumns(true).appendChild(ec);
390  return ec;
391  }
Columns getColumns(boolean create)
Here is the call graph for this function:

◆ addColumn() [2/4]

EditableColumn org.turro.zkoss.grid.EditableGrid< V >.addColumn ( String  image,
String  tooltip,
String  javaClass,
String  property,
String  format,
int  scale,
boolean  onlyDate,
boolean  readOnly 
) throws ClassNotFoundException

Definition at line 393 of file EditableGrid.java.

394  {
395  EditableColumn ec = new EditableColumn();
396  ec.setImage(image);
397  ec.setTooltiptext(tooltip);
398  ec.setFormat(format);
399  ec.setJavaClass(javaClass);
400  ec.setOnlyDate(onlyDate);
401  ec.setProperty(property);
402  ec.setReadOnly(readOnly);
403  ec.setScale(scale);
404  if(ec.isNumber()) {
405  ec.setAlign("right");
406  if(Strings.isBlank(format)) {
407  ec.setFormat(DecimalFormats.getStringFormat(ec.getScale()));
408  }
409  }
410  getColumns(true).appendChild(ec);
411  return ec;
412  }
Here is the call graph for this function:

◆ addColumn() [3/4]

EditableColumn org.turro.zkoss.grid.EditableGrid< V >.addColumn ( String  label,
Class  javaClass,
String  property,
String  format,
int  scale,
boolean  onlyDate,
boolean  readOnly 
)

Definition at line 332 of file EditableGrid.java.

333  {
334  EditableColumn ec = new EditableColumn();
335  ec.setLabel(label);
336  ec.setFormat(format);
337  ec.setJavaClass(javaClass);
338  ec.setOnlyDate(onlyDate);
339  ec.setProperty(property);
340  ec.setReadOnly(readOnly);
341  ec.setScale(scale);
342  if(ec.isNumber()) {
343  ec.setAlign("right");
344  if(Strings.isBlank(format)) {
345  ec.setFormat(DecimalFormats.getStringFormat(ec.getScale()));
346  }
347  }
348  getColumns(true).appendChild(ec);
349  return ec;
350  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ addColumn() [4/4]

EditableColumn org.turro.zkoss.grid.EditableGrid< V >.addColumn ( String  label,
String  javaClass,
String  property,
String  format,
int  scale,
boolean  onlyDate,
boolean  readOnly 
) throws ClassNotFoundException

Definition at line 352 of file EditableGrid.java.

353  {
354  EditableColumn ec = new EditableColumn();
355  ec.setLabel(label);
356  ec.setFormat(format);
357  ec.setJavaClass(javaClass);
358  ec.setOnlyDate(onlyDate);
359  ec.setProperty(property);
360  ec.setReadOnly(readOnly);
361  ec.setScale(scale);
362  if(ec.isNumber()) {
363  ec.setAlign("right");
364  if(Strings.isBlank(format)) {
365  ec.setFormat(DecimalFormats.getStringFormat(ec.getScale()));
366  }
367  }
368  getColumns(true).appendChild(ec);
369  return ec;
370  }
Here is the call graph for this function:

◆ addNewRow()

Row org.turro.zkoss.grid.EditableGrid< V >.addNewRow ( )

Definition at line 271 of file EditableGrid.java.

271  {
272  Row row = new Row();
273  row.setSclass("invalid");
274  if(getRows().appendChild(row)) {
275  setRowCount(getRows().getChildren().size());
276  initiateRow(row, null);
277  initiateRowListeners(row);
278  return row;
279  }
280  return null;
281  }
abstract void initiateRow(Row row, V value)
Rows getRows(boolean create)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ afterCompose()

◆ appendValue()

Row org.turro.zkoss.grid.EditableGrid< V >.appendValue ( )

Definition at line 263 of file EditableGrid.java.

263  {
264  Row row = (Row) getRows().getLastChild();
265  if(row != null && !isValid((V) row.getValue())) {
266  return row;
267  }
268  return addNewRow();
269  }
abstract boolean isValid(V v)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ cancelEdition()

void org.turro.zkoss.grid.EditableGrid< V >.cancelEdition ( )

Definition at line 230 of file EditableGrid.java.

230  {
231  if(currentCell != null) {
233  currentCell = null;
234  }
235  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ canDeleteRow()

boolean org.turro.zkoss.grid.EditableGrid< V >.canDeleteRow ( Row  row)
protected

Reimplemented in org.turro.erp.sales.CustomerOrderLinesGrid, and org.turro.erp.reference.OrderReferenceGrid.

Definition at line 587 of file EditableGrid.java.

587  {
588  return true;
589  }
Here is the caller graph for this function:

◆ canEditRow()

boolean org.turro.zkoss.grid.EditableGrid< V >.canEditRow ( Row  row)
protected

Reimplemented in org.turro.erp.sales.CustomerOrderLinesGrid, and org.turro.erp.reference.OrderReferenceGrid.

Definition at line 591 of file EditableGrid.java.

591  {
592  return true;
593  }
Here is the caller graph for this function:

◆ cellChanged()

void org.turro.zkoss.grid.EditableGrid< V >.cellChanged ( EditableCell  editableCell,
Object  value 
)
protected

◆ clearColumns()

void org.turro.zkoss.grid.EditableGrid< V >.clearColumns ( )

Reimplemented from org.turro.zkoss.grid.PagingGrid.

Definition at line 145 of file EditableGrid.java.

145  {
146  if(getColumns() != null) {
147  getColumns().getChildren().clear();
148  }
149  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ clearFoot()

void org.turro.zkoss.grid.EditableGrid< V >.clearFoot ( )

Definition at line 121 of file EditableGrid.java.

121  {
122  if(getFoot() != null) {
123  getFoot().getChildren().clear();
124  }
125  }
Foot getFoot(boolean create)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ clearRows()

void org.turro.zkoss.grid.EditableGrid< V >.clearRows ( )

Reimplemented from org.turro.zkoss.grid.PagingGrid.

Definition at line 127 of file EditableGrid.java.

127  {
128  if(getRows() != null) {
129  getRows().getChildren().clear();
130  }
131  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ clearTable()

void org.turro.zkoss.grid.EditableGrid< V >.clearTable ( )

Reimplemented in org.turro.zkoss.grid.CollectionGrid< V >.

Definition at line 115 of file EditableGrid.java.

Here is the call graph for this function:

◆ clearValidRows()

void org.turro.zkoss.grid.EditableGrid< V >.clearValidRows ( )

Definition at line 133 of file EditableGrid.java.

133  {
134  if(getRows() != null) {
135  Iterator it = getRows().getChildren().iterator();
136  while(it.hasNext()) {
137  Row r = (Row) it.next();
138  if(isValid((V) r.getValue())) {
139  it.remove();
140  }
141  }
142  }
143  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ createEditor()

HtmlBasedComponent org.turro.zkoss.grid.EditableGrid< V >.createEditor ( EditableCell  editableCell)
protected

Reimplemented in org.turro.erp.purchase.ProductsGrid, org.turro.erp.purchase.HoursGrid, org.turro.skills.RootSkillsGrid, org.turro.polls.PollOptionGrid, org.turro.dossier.zul.issue.IssueParticipantGrid, org.turro.dossier.zul.dossier.WorthDefinitionGrid, org.turro.dossier.zul.dossier.DossierVersionGrid, org.turro.dossier.zul.dossier.DossierParticipantGrid, org.turro.dossier.zul.dossier.DescriptorDefinitionGrid, org.turro.dossier.zul.dossier.CategoryParticipantGrid, org.turro.crm.zul.vendor.FormulaGrid, org.turro.crm.zul.sale.VendorProspectGrid, org.turro.crm.zul.sale.CampaignVendorGrid, org.turro.crm.zul.customer.CustomerOwnersGrid, org.turro.zul.groupit.GroupedGrid, org.turro.zul.fieldit.FieldItGrid, org.turro.contacts.zul.contact.ConnectorGrid, org.turro.contacts.form.RelationGrid, org.turro.contacts.form.ConnectorGrid, org.turro.contacts.form.AddressGrid, org.turro.financials.register.MultiRegisterGrid, org.turro.financials.product.ProductContractorGrid, org.turro.financials.payroll.PayrollExpiriesGrid, org.turro.financials.linetype.LineTypeAccountGrid, org.turro.financials.document.RelatedStoreDefinitionGrid, org.turro.financials.document.RelatedLineTypeGrid, org.turro.financials.document.RelatedColumnGrid, org.turro.financials.document.DocumentLinesGrid, org.turro.financials.document.DocumentExpiriesGrid, org.turro.financials.contract.RelatedDocumentGrid, org.turro.financials.contract.RelatedContractStoreGrid, org.turro.financials.contract.ProductGrid, org.turro.financials.contract.DocumentWorkflowGrid, org.turro.financials.contract.ContractTaxesGrid, org.turro.financials.contract.ContractParticipantGrid, org.turro.financials.contract.ContractExpiriesGrid, org.turro.financials.contract.ContractedGrid, org.turro.financials.business.ServiceGrid, org.turro.financials.business.HeadquartersGrid, org.turro.financials.business.DepartmentGrid, org.turro.financials.business.CompanyGrid, org.turro.financials.account.MajorAccountGrid, org.turro.financials.account.MajorAccountDetailGrid, org.turro.erp.task.usage.UsageGrid, org.turro.erp.task.usage.ReceiptGrid, org.turro.erp.sales.CustomerOrderLinesGrid, and org.turro.erp.reference.OrderReferenceGrid.

Definition at line 509 of file EditableGrid.java.

509  {
510  Object value = getCellValue(editableCell);
511  if(editableCell.isBoolean()) {
512  Checkbox cb = new Checkbox();
513  if(!editableCell.isReadOnly() &&
514  editableCell.getRenderer() instanceof Checkbox &&
515  canEditRow(editableCell.getRow())) {
516  cb.setChecked(((Checkbox)editableCell.getRenderer()).isChecked());
517  } else {
518  cb.setChecked(value != null ? (Boolean) value : false);
519  }
520  //TODO: http://www.zkoss.org/forum/listComment/12889;jsessionid=9462603FC918116CEAC38826F5F75066.zkzh
521  //cb.setWidgetOverride("focus", "function () {this.$n('real').focus();}");
522  return cb;
523  } else if(editableCell.isNumber()) {
524  ExpressionInput ei = new ExpressionInput();
525  ei.setValue(value);
526  //ei.setStyle("padding:0px;margin:0px;");
527  ei.setReadonly(editableCell.isReadOnly());
528  return ei;
529 // Decimalbox db = new Decimalbox((BigDecimal) StringParser.convertToClass(BigDecimal.class, value));
530 // db.setRoundingMode(BigDecimal.ROUND_HALF_EVEN);
531 // db.setFormat(editableCell.getFormat());
532 // db.setStyle("padding:0px;margin:0px;");
533 // db.setWidth("100%");
534 // db.setReadonly(editableCell.isReadOnly());
535 // return db;
536  } else if(editableCell.isDate()) {
537  if(editableCell.isOnlyTime()) {
538  Timebox tb = new Timebox((Date) value);
539  tb.setFormat(editableCell.getFormat());
540  tb.setReadonly(editableCell.isReadOnly());
541  tb.setButtonVisible(false);
542  return tb;
543  } else {
544  DateboxShort db = new DateboxShort((Date) value);
545  db.setWithTime(!editableCell.isOnlyDate());
546  db.setFormat(editableCell.getFormat());
547  db.setReadonly(editableCell.isReadOnly());
548  return db;
549  }
550  } else if(editableCell.getScale() > 0) {
551  Multilinebox mb = new Multilinebox((String) value, editableCell.getScale());
552  mb.setReadonly(editableCell.isReadOnly() || mb.isReadonly());
553  return mb;
554  } else {
555  Textbox tb = new Textbox((String) value);
556  //tb.setStyle("padding:0px;margin:0px;");
557  tb.setReadonly(editableCell.isReadOnly());
558  tb.setMaxlength(255);
559  return tb;
560  }
561  }
Object getCellValue(EditableCell editableCell)
void setWithTime(boolean withTime)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ createRenderer()

HtmlBasedComponent org.turro.zkoss.grid.EditableGrid< V >.createRenderer ( EditableCell  editableCell)
protected

Reimplemented in org.turro.crm.zul.vendor.FormulaGrid, org.turro.financials.register.StatementGrid, org.turro.financials.register.EntriesGrid, org.turro.financials.portfolio.PortfolioDisagreementsGrid, org.turro.financials.contract.ContractDisagreementsGrid, org.turro.erp.task.usage.UsageGrid, org.turro.erp.task.usage.ReceiptGrid, and org.turro.erp.reference.OrderReferenceGrid.

Definition at line 564 of file EditableGrid.java.

564  {
565  Object value = getCellValue(editableCell);
566  if(value instanceof Boolean) {
567  Checkbox cb = new Checkbox();
568  cb.setChecked((Boolean) value);
569  return cb;
570  } else {
571  Label l = new Label(formatCell(editableCell, value));
572  //l.setMultiline(true);
573  makeItEditable(l);
574  return l;
575  }
576  }
String formatCell(EditableCell editableCell, Object value)
Here is the call graph for this function:

◆ deleteRow()

abstract boolean org.turro.zkoss.grid.EditableGrid< V >.deleteRow ( Row  row)
abstractprotected

Reimplemented in org.turro.polls.PollOptionGrid, org.turro.jpa.grid.JpaGrid< V >, org.turro.dossier.zul.issue.IssueParticipantGrid, org.turro.dossier.zul.dossier.WorthDefinitionGrid, org.turro.dossier.zul.dossier.DossierVersionGrid, org.turro.dossier.zul.dossier.DossierParticipantGrid, org.turro.dossier.zul.dossier.DescriptorDefinitionGrid, org.turro.dossier.zul.dossier.CategoryParticipantGrid, org.turro.crm.zul.sector.TechnologyGrid, org.turro.crm.zul.sector.ActivitySectorGrid, org.turro.crm.zul.sale.VendorProspectGrid, org.turro.crm.zul.sale.CampaignVendorGrid, org.turro.crm.zul.customer.CustomerOwnersGrid, org.turro.zul.groupit.GroupedGrid, org.turro.zul.fieldit.FieldItGrid, org.turro.contacts.zul.contact.ConnectorGrid, org.turro.contacts.form.RelationGrid, org.turro.contacts.form.ConnectorGrid, org.turro.contacts.form.CommentsGrid, org.turro.contacts.form.AddressGrid, org.turro.financials.register.StatementGrid, org.turro.financials.register.MultiRegisterGrid, org.turro.financials.register.EntriesGrid, org.turro.financials.product.ProductContractorGrid, org.turro.financials.portfolio.PortfolioDisagreementsGrid, org.turro.financials.payroll.PayrollExpiriesGrid, org.turro.financials.linetype.LineTypeAccountGrid, org.turro.financials.document.RelatedStoreDefinitionGrid, org.turro.financials.document.RelatedLineTypeGrid, org.turro.financials.document.RelatedColumnGrid, org.turro.financials.document.DocumentRegisterView, org.turro.financials.document.DocumentRegistersGrid, org.turro.financials.document.DocumentLinesGrid, org.turro.financials.document.DocumentExpiriesGrid, org.turro.financials.document.DocumentAmountsGrid, org.turro.financials.contract.RelatedDocumentGrid, org.turro.financials.contract.RelatedContractStoreGrid, org.turro.financials.contract.ProductGrid, org.turro.financials.contract.DocumentWorkflowGrid, org.turro.financials.contract.ContractTaxesGrid, org.turro.financials.contract.ContractPreferencesGrid, org.turro.financials.contract.ContractParticipantGrid, org.turro.financials.contract.ContractExpiriesGrid, org.turro.financials.contract.ContractedGrid, org.turro.financials.contract.ContractDisagreementsGrid, org.turro.financials.business.StoreGrid, org.turro.financials.business.ServiceGrid, org.turro.financials.business.HeadquartersGrid, org.turro.financials.business.DepartmentGrid, org.turro.financials.assets.DepreciationsGrid, org.turro.financials.account.MajorAccountDetailGrid, org.turro.erp.task.usage.UsageGrid, org.turro.erp.task.usage.ReceiptGrid, org.turro.erp.sales.CustomerOrderLinesGrid, org.turro.erp.reference.OrderReferenceGrid, org.turro.erp.reference.BreakdownGrid, org.turro.erp.purchase.ProductsGrid, org.turro.erp.purchase.HoursGrid, and org.turro.erp.aptitude.AptitudeDegreeGrid.

Here is the caller graph for this function:

◆ deleteSelectedRow()

void org.turro.zkoss.grid.EditableGrid< V >.deleteSelectedRow ( final Row  row)

Reimplemented in org.turro.zkoss.grid.CollectionGrid< V >.

Definition at line 283 of file EditableGrid.java.

283  {
284  if(canDeleteRow(row)) {
285  Messages.confirmDeletion().show(() -> {
286  if(deleteRow(row)) {
287  row.detach();
288  Events.postEvent(new Event(Events.ON_CHANGE, EditableGrid.this));
289  }
290  });
291  }
292  }
static Messages confirmDeletion()
Definition: Messages.java:87
abstract boolean deleteRow(Row row)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ formatCell()

String org.turro.zkoss.grid.EditableGrid< V >.formatCell ( EditableCell  editableCell,
Object  value 
)
protected

Reimplemented in org.turro.polls.PollOptionGrid, org.turro.dossier.zul.issue.IssueParticipantGrid, org.turro.dossier.zul.dossier.WorthDefinitionGrid, org.turro.dossier.zul.dossier.DossierParticipantGrid, org.turro.dossier.zul.dossier.DescriptorDefinitionGrid, org.turro.dossier.zul.dossier.CategoryParticipantGrid, org.turro.crm.zul.sale.VendorProspectGrid, org.turro.crm.zul.sale.CampaignVendorGrid, org.turro.crm.zul.customer.CustomerOwnersGrid, org.turro.zul.groupit.GroupedGrid, org.turro.zul.fieldit.FieldItGrid, org.turro.contacts.form.RelationGrid, org.turro.financials.register.MultiRegisterGrid, org.turro.financials.product.ProductContractorGrid, org.turro.financials.payroll.PayrollExpiriesGrid, org.turro.financials.linetype.LineTypeAccountGrid, org.turro.financials.document.RelatedStoreDefinitionGrid, org.turro.financials.document.RelatedLineTypeGrid, org.turro.financials.document.RelatedColumnGrid, org.turro.financials.document.DocumentRegisterView, org.turro.financials.document.DocumentRegistersGrid, org.turro.financials.document.DocumentLinesGrid, org.turro.financials.document.DocumentExpiriesGrid, org.turro.financials.contract.RelatedDocumentGrid, org.turro.financials.contract.RelatedContractStoreGrid, org.turro.financials.contract.ProductGrid, org.turro.financials.contract.DocumentWorkflowGrid, org.turro.financials.contract.ContractTaxesGrid, org.turro.financials.contract.ContractParticipantGrid, org.turro.financials.contract.ContractExpiriesGrid, org.turro.financials.contract.ContractedGrid, org.turro.financials.business.ServiceGrid, org.turro.financials.business.HeadquartersGrid, org.turro.financials.business.DepartmentGrid, org.turro.financials.business.CompanyGrid, org.turro.financials.account.MajorAccountGrid, org.turro.financials.account.MajorAccountDetailGrid, org.turro.erp.task.usage.UsageGrid, org.turro.erp.task.usage.ReceiptGrid, org.turro.erp.sales.CustomerOrderLinesGrid, org.turro.erp.reference.OrderReferenceGrid, org.turro.erp.purchase.ProductsGrid, and org.turro.erp.purchase.HoursGrid.

Definition at line 483 of file EditableGrid.java.

483  {
484  if(value instanceof Boolean) {
485  return BooleanFormats.format((Boolean) value);
486  } else if(value instanceof Number) {
487  if(((Number) value).doubleValue() == 0 && showZeros == false) {
488  return "";
489  }
490  return editableCell.getFormat() != null ?
491  DecimalFormats.format((Number) value, editableCell.getFormat()) :
492  DecimalFormats.format((Number) value);
493  } else if(value instanceof Date) {
494  if(editableCell.isOnlyTime()) {
495  return DateFormats.formatTime((Date) value);
496  } else {
497  return DateFormats.format((Date) value, editableCell.isOnlyDate());
498  }
499  } else if(value instanceof Enum) {
500  return I_.byKey(((Enum) value).toString());
501  } else if(editableCell.getScale() > 0) {
502  return Multilinebox.formatValue((String) value);
503  } else {
504  return (String) value;
505  }
506  }
static final String format(Date d, boolean dateOnly)
static String formatTime(Date d)
static String byKey(String key)
Definition: I_.java:83
static String formatValue(String value)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getAllValues()

List<V> org.turro.zkoss.grid.EditableGrid< V >.getAllValues ( )

Definition at line 161 of file EditableGrid.java.

161  {
162  List<V> l = new ArrayList<V>();
163  for(Component row : getRows().getChildren()) {
164  l.add((V) ((Row)row).getValue());
165  }
166  return l;
167  }
Here is the call graph for this function:

◆ getBlurListener()

EventListener org.turro.zkoss.grid.EditableGrid< V >.getBlurListener ( )

Definition at line 190 of file EditableGrid.java.

190  {
191  if(blurListener == null) {
192  blurListener = new BlurEventListener(this);
193  }
194  return blurListener;
195  }
Here is the caller graph for this function:

◆ getCancelListener()

EventListener org.turro.zkoss.grid.EditableGrid< V >.getCancelListener ( )

Definition at line 197 of file EditableGrid.java.

197  {
198  if(cancelListener == null) {
199  cancelListener = new CancelEventListener(this);
200  }
201  return cancelListener;
202  }
CancelEventListener cancelListener
Here is the caller graph for this function:

◆ getCellValue()

Object org.turro.zkoss.grid.EditableGrid< V >.getCellValue ( EditableCell  editableCell)
protected

Definition at line 415 of file EditableGrid.java.

415  {
416  if(editableCell.getRow().getValue() != null) {
417  return StringParser.getValueFrom(editableCell.getProperty(), editableCell.getRow().getValue());
418  } else {
419  HtmlBasedComponent hbc = (HtmlBasedComponent) editableCell.getRenderer();
420  if(hbc instanceof Checkbox) {
421  return ((Checkbox) hbc).isChecked();
422  } else if(hbc instanceof Label) {
423  return ((Label) hbc).getValue();
424  }
425  }
426  return null;
427  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getCurrentCell()

Definition at line 83 of file EditableGrid.java.

83  {
84  return currentCell;
85  }
Here is the caller graph for this function:

◆ getEditableColumn()

Column org.turro.zkoss.grid.EditableGrid< V >.getEditableColumn ( int  cellIndex)

Definition at line 303 of file EditableGrid.java.

303  {
304  Columns cols = getColumns(true);
305  if(cols != null && cellIndex < cols.getChildren().size()) {
306  return (Column) cols.getChildren().get(cellIndex);
307  }
308  return null;
309  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getEditListener()

EventListener org.turro.zkoss.grid.EditableGrid< V >.getEditListener ( )

Definition at line 169 of file EditableGrid.java.

169  {
170  if(editListener == null) {
171  editListener = new EditEventListener(this);
172  }
173  return editListener;
174  }

◆ getEditor()

HtmlBasedComponent org.turro.zkoss.grid.EditableGrid< V >.getEditor ( EditableCell  editableCell)

Definition at line 237 of file EditableGrid.java.

237  {
238  HtmlBasedComponent hbc = createEditor(editableCell);
239  hbc.setSclass("grid-editor");
240  hbc.addEventListener(Events.ON_OK, getNextListener());
241  hbc.addEventListener(Events.ON_CANCEL, getCancelListener());
242  hbc.addEventListener(Events.ON_BLUR, getBlurListener());
243  hbc.addEventListener(Events.ON_CTRL_KEY, getKeyListener());
244  hbc.setWidgetListener("onKeyDown", "if(event.keyCode == 9 && !(event.ctrlKey || event.shiftKey)) event.keyCode = 13;");
245  ((XulElement) hbc).setCtrlKeys(
246  (!Strings.isBlank(ctrlKeys) ? ctrlKeys : "") +
247  (hbc instanceof Listbox ? "" : "#down#up"));
248  if(!canEditRow(editableCell.getRow())) {
249  if(hbc instanceof Datebox) {
250  ((Datebox) hbc).setButtonVisible(false);
251  ((InputElement) hbc).setReadonly(true);
252  } else if(hbc instanceof InputElement) {
253  ((InputElement) hbc).setReadonly(true);
254  } else if(hbc instanceof Listbox) {
255  ((Listbox) hbc).setDisabled(true);
256  } else if(hbc instanceof Checkbox) {
257  ((Checkbox) hbc).setDisabled(true);
258  }
259  }
260  return hbc;
261  }
HtmlBasedComponent createEditor(EditableCell editableCell)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getEditorValue()

Object org.turro.zkoss.grid.EditableGrid< V >.getEditorValue ( EditableCell  editableCell)
protected

Reimplemented in org.turro.dossier.zul.issue.IssueParticipantGrid, org.turro.dossier.zul.dossier.DossierParticipantGrid, org.turro.dossier.zul.dossier.CategoryParticipantGrid, org.turro.zul.groupit.GroupedGrid, org.turro.zul.fieldit.FieldItGrid, org.turro.contacts.form.RelationGrid, org.turro.financials.document.DocumentLinesGrid, org.turro.financials.contract.ContractParticipantGrid, org.turro.financials.contract.ContractExpiriesGrid, org.turro.financials.business.HeadquartersGrid, org.turro.financials.business.CompanyGrid, org.turro.erp.task.usage.UsageGrid, and org.turro.erp.task.usage.ReceiptGrid.

Definition at line 430 of file EditableGrid.java.

430  {
431  HtmlBasedComponent hbc = (HtmlBasedComponent) editableCell.getEditor();
432  if(hbc instanceof Checkbox) {
433  return ((Checkbox) hbc).isChecked();
434  } else if(hbc instanceof Percentbox) {
435  return ((Percentbox) hbc).getValue();
436  } else if(hbc instanceof Decimalbox) {
437  return StringParser.convertToClass(editableCell.getJavaClass(), ((Decimalbox) hbc).getValue());
438  } else if(hbc instanceof ExpressionInput) {
439  return StringParser.convertToClass(editableCell.getJavaClass(), ((ExpressionInput) hbc).getNumber(editableCell.getScale()));
440  } else if(hbc instanceof Longbox) {
441  return StringParser.convertToClass(editableCell.getJavaClass(), ((Longbox) hbc).getValue());
442  } else if(hbc instanceof Datebox) {
443  return ((Datebox) hbc).getValue();
444  } else if(hbc instanceof Timebox) {
445  return ((Timebox) hbc).getValue();
446  } else if(hbc instanceof KnowsID) {
447  return ((KnowsID) hbc).getObjectId();
448  } else if(hbc instanceof GenericListbox) {
449  return ((GenericListbox) hbc).getObjectValue();
450  } else if(hbc instanceof GenericCombobox) {
451  return ((GenericCombobox) hbc).getObjectValue();
452  } else if(hbc instanceof GenericBandbox) {
453  return ((GenericBandbox) hbc).getObjectValue();
454  } else if(hbc instanceof Listbox) {
455  return ((Listbox) hbc).getSelectedItem().getValue();
456  } else if(hbc instanceof Textbox) {
457  return ((Textbox) hbc).getValue();
458  } else {
459  return null;
460  }
461  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getKeyListener()

EventListener org.turro.zkoss.grid.EditableGrid< V >.getKeyListener ( )

Definition at line 183 of file EditableGrid.java.

183  {
184  if(keyListener == null) {
185  keyListener = new KeyEventListener(this);
186  }
187  return keyListener;
188  }
Here is the caller graph for this function:

◆ getLastRow()

Row org.turro.zkoss.grid.EditableGrid< V >.getLastRow ( )

Definition at line 87 of file EditableGrid.java.

87  {
88  return lastRow;
89  }
Here is the caller graph for this function:

◆ getNextListener()

EventListener org.turro.zkoss.grid.EditableGrid< V >.getNextListener ( )

Definition at line 176 of file EditableGrid.java.

176  {
177  if(nextListener == null) {
178  nextListener = new NextEventListener(this);
179  }
180  return nextListener;
181  }
Here is the caller graph for this function:

◆ getValues()

List<V> org.turro.zkoss.grid.EditableGrid< V >.getValues ( )

Definition at line 151 of file EditableGrid.java.

151  {
152  List<V> l = new ArrayList<V>();
153  for(Component row : getRows().getChildren()) {
154  if(isValid((V) ((Row)row).getValue())) {
155  l.add((V) ((Row)row).getValue());
156  }
157  }
158  return l;
159  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ initiateRow()

abstract void org.turro.zkoss.grid.EditableGrid< V >.initiateRow ( Row  row,
value 
)
abstractprotected
Here is the caller graph for this function:

◆ insertInSelectedRow()

void org.turro.zkoss.grid.EditableGrid< V >.insertInSelectedRow ( Row  row)

Definition at line 294 of file EditableGrid.java.

294  {
295  Row newRow = new Row();
296  newRow.setSclass("invalid");
297  getRows().insertBefore(newRow, row);
298  initiateRow(newRow, null);
299  initiateRowListeners(newRow);
300  setRowCount(getRows().getChildren().size());
301  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ isAllowDeletions()

boolean org.turro.zkoss.grid.EditableGrid< V >.isAllowDeletions ( )

Definition at line 67 of file EditableGrid.java.

67  {
68  return allowDeletions;
69  }
Here is the caller graph for this function:

◆ isAllowInsertions()

boolean org.turro.zkoss.grid.EditableGrid< V >.isAllowInsertions ( )

Definition at line 75 of file EditableGrid.java.

75  {
76  return allowInsertions;
77  }
Here is the caller graph for this function:

◆ isCellValid()

boolean org.turro.zkoss.grid.EditableGrid< V >.isCellValid ( EditableCell  editableCell,
Object  value 
)
protected

Reimplemented in org.turro.erp.purchase.ProductsGrid, and org.turro.erp.purchase.HoursGrid.

Definition at line 583 of file EditableGrid.java.

583  {
584  return true;
585  }
Here is the caller graph for this function:

◆ isReadOnly()

boolean org.turro.zkoss.grid.EditableGrid< V >.isReadOnly ( )

Definition at line 91 of file EditableGrid.java.

91  {
92  return readOnly;
93  }
Here is the caller graph for this function:

◆ isSelectInput()

boolean org.turro.zkoss.grid.EditableGrid< V >.isSelectInput ( )

Definition at line 99 of file EditableGrid.java.

99  {
100  return selectInput;
101  }
Here is the caller graph for this function:

◆ isShowZeros()

boolean org.turro.zkoss.grid.EditableGrid< V >.isShowZeros ( )

Definition at line 107 of file EditableGrid.java.

107  {
108  return showZeros;
109  }

◆ isValid()

abstract boolean org.turro.zkoss.grid.EditableGrid< V >.isValid ( v)
abstractprotected
Here is the caller graph for this function:

◆ processEdition()

void org.turro.zkoss.grid.EditableGrid< V >.processEdition ( EditableCell  editableCell)

Definition at line 204 of file EditableGrid.java.

204  {
205  if(currentCell != null) {
206  if(currentCell.getEditor() != null && !currentCell.isReadOnly()) {
207  Object value = getEditorValue(currentCell);
208  if(isCellValid(currentCell, value)) {
209  setCellValue(currentCell, value);
210  } else {
211  return;
212  }
213  }
215  if(editableCell == null || !lastRow.equals(editableCell.getRow())) {
216  Events.postEvent(new Event(Events.ON_CHANGE, this, editableCell));
217  processRowSclass(lastRow);
219  lastRow = null;
220  }
221  currentCell = null;
222  }
223  if(editableCell != null) {
224  currentCell = editableCell;
225  currentCell.edit();
227  }
228  }
void setCellValue(EditableCell editableCell, Object value)
Object getEditorValue(EditableCell editableCell)
abstract void rowChanged(Row row)
boolean isCellValid(EditableCell editableCell, Object value)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rowChanged()

◆ setAllowDeletions()

void org.turro.zkoss.grid.EditableGrid< V >.setAllowDeletions ( boolean  allowDeletions)

Definition at line 71 of file EditableGrid.java.

71  {
72  this.allowDeletions = allowDeletions;
73  }
Here is the caller graph for this function:

◆ setAllowInsertions()

void org.turro.zkoss.grid.EditableGrid< V >.setAllowInsertions ( boolean  allowInsertions)

Definition at line 79 of file EditableGrid.java.

79  {
81  }
Here is the caller graph for this function:

◆ setCellValue()

void org.turro.zkoss.grid.EditableGrid< V >.setCellValue ( EditableCell  editableCell,
Object  value 
)
protected

Reimplemented in org.turro.polls.PollOptionGrid.

Definition at line 464 of file EditableGrid.java.

464  {
465  if(!onlyRenderer) {
466  if(editableCell.getProperty() != null && editableCell.getRow().getValue() != null) {
467  StringParser.setValueFrom(editableCell.getProperty(), editableCell.getRow().getValue(),
468  editableCell.getJavaClass(), value);
469  }
470  }
471  HtmlBasedComponent hbc = (HtmlBasedComponent) editableCell.getRenderer();
472  if(hbc instanceof Checkbox) {
473  ((Checkbox) hbc).setChecked((Boolean) value);
474  } else if(hbc instanceof Label) {
475  ((Label) hbc).setValue((String) formatCell(editableCell, value));
476  makeItEditable(hbc);
477  }
478  if(!onlyRenderer) {
479  cellChanged(editableCell, value);
480  }
481  }
void cellChanged(EditableCell editableCell, Object value)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setReadOnly()

void org.turro.zkoss.grid.EditableGrid< V >.setReadOnly ( boolean  readOnly)

Definition at line 95 of file EditableGrid.java.

95  {
96  this.readOnly = readOnly;
97  }
Here is the caller graph for this function:

◆ setSelectInput()

void org.turro.zkoss.grid.EditableGrid< V >.setSelectInput ( boolean  selectInput)

Definition at line 103 of file EditableGrid.java.

103  {
104  this.selectInput = selectInput;
105  }

◆ setShowZeros()

void org.turro.zkoss.grid.EditableGrid< V >.setShowZeros ( boolean  showZeros)

Definition at line 111 of file EditableGrid.java.

111  {
112  this.showZeros = showZeros;
113  }
Here is the caller graph for this function:

◆ updateRow()

void org.turro.zkoss.grid.EditableGrid< V >.updateRow ( Row  row)

Definition at line 311 of file EditableGrid.java.

311  {
312  onlyRenderer = true;
313  processRowSclass(row);
314  try {
315  for(Component c : (List<Component>) row.getChildren()) {
316  if(!(c instanceof Detail)) {
317  EditableCell ec = new EditableCell(this, row, c);
318  setCellValue(ec, getCellValue(ec));
319  }
320  }
321  } finally {
322  onlyRenderer = false;
323  }
324  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ updateRows()

void org.turro.zkoss.grid.EditableGrid< V >.updateRows ( )

Definition at line 326 of file EditableGrid.java.

326  {
327  for(Component row : getRows().getChildren()) {
328  updateRow(((Row)row));
329  }
330  }
Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ allowInsertions

boolean org.turro.zkoss.grid.EditableGrid< V >.allowInsertions

Definition at line 53 of file EditableGrid.java.

◆ blurListener

Definition at line 52 of file EditableGrid.java.

◆ cancelListener

Definition at line 51 of file EditableGrid.java.

◆ ctrlKeys

String org.turro.zkoss.grid.EditableGrid< V >.ctrlKeys
protected

Definition at line 58 of file EditableGrid.java.

◆ currentCell

EditableCell org.turro.zkoss.grid.EditableGrid< V >.currentCell
protected

Definition at line 57 of file EditableGrid.java.

◆ editListener

Definition at line 48 of file EditableGrid.java.

◆ keyListener

Definition at line 50 of file EditableGrid.java.

◆ lastRow

Row org.turro.zkoss.grid.EditableGrid< V >.lastRow
protected

Definition at line 59 of file EditableGrid.java.

◆ nextListener

Definition at line 49 of file EditableGrid.java.


The documentation for this class was generated from the following file: