BrightSide Workbench Full Report + Source Code
org.turro.financials.document.DocumentExpiriesGrid Class Reference
Inheritance diagram for org.turro.financials.document.DocumentExpiriesGrid:
Collaboration diagram for org.turro.financials.document.DocumentExpiriesGrid:

Public Member Functions

 DocumentExpiriesGrid ()
 
Collection< DocumentRelationgetRelations ()
 
Document getDocument ()
 
void setDocument (Document document)
 
void notifyChange ()
 
void updateLines ()
 
void afterCompose ()
 
- Public Member Functions inherited from org.turro.zkoss.grid.CollectionGrid< V >
 CollectionGrid ()
 
 CollectionGrid (Collection< V > collection)
 
Collection< V > getCollection ()
 
void setCollection (Collection< V > collection)
 
void updateCollection (Collection< V > collection)
 
Row getDependingRow ()
 
void setDependingRow (Row dependingRow)
 
void clearTable ()
 
void deleteSelectedRow (Row row)
 
- Public Member Functions inherited from org.turro.zkoss.grid.EditableGrid< V >
 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 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 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
 
- 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 ()
 

Protected Member Functions

void initiateRow (Row row, SingleLineDocumentWrapper value)
 
boolean deleteRow (Row row)
 
boolean isValid (SingleLineDocumentWrapper v)
 
String formatCell (EditableCell editableCell, Object value)
 
HtmlBasedComponent createEditor (EditableCell editableCell)
 
void cellChanged (EditableCell editableCell, Object value)
 
- Protected Member Functions inherited from org.turro.zkoss.grid.CollectionGrid< V >
void rowChanged (Row row)
 
boolean filterValue (V v)
 
- Protected Member Functions inherited from org.turro.zkoss.grid.EditableGrid< V >
Object getCellValue (EditableCell editableCell)
 
Object getEditorValue (EditableCell editableCell)
 
void setCellValue (EditableCell editableCell, Object value)
 
HtmlBasedComponent createRenderer (EditableCell editableCell)
 
boolean isCellValid (EditableCell editableCell, Object value)
 
boolean canDeleteRow (Row row)
 
boolean canEditRow (Row row)
 
abstract void initiateRow (Row row, V value)
 
abstract boolean isValid (V v)
 

Additional Inherited Members

- Public Attributes inherited from org.turro.zkoss.grid.EditableGrid< V >
EditEventListener editListener
 
NextEventListener nextListener
 
KeyEventListener keyListener
 
CancelEventListener cancelListener
 
BlurEventListener blurListener
 
boolean allowInsertions
 
- Protected Attributes inherited from org.turro.zkoss.grid.CollectionGrid< V >
Row dependingRow
 
- Protected Attributes inherited from org.turro.zkoss.grid.EditableGrid< V >
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 51 of file DocumentExpiriesGrid.java.

Constructor & Destructor Documentation

◆ DocumentExpiriesGrid()

org.turro.financials.document.DocumentExpiriesGrid.DocumentExpiriesGrid ( )

Definition at line 60 of file DocumentExpiriesGrid.java.

60  {
61  super();
62  }

Member Function Documentation

◆ afterCompose()

void org.turro.financials.document.DocumentExpiriesGrid.afterCompose ( )

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

Definition at line 155 of file DocumentExpiriesGrid.java.

155  {
156  if(expiryDefinitions != null && !expiryDefinitions.isEmpty()) {
157  setReadOnly(false);
158  try {
159  addColumns();
160  invalidate();
161  } catch (ClassNotFoundException ex) {
162  Logger.getLogger(DocumentExpiriesGrid.class.getName()).log(Level.SEVERE, ElephantContext.logMsg(null), ex);
163  }
164  } else {
165  setReadOnly(true);
166  }
167  super.afterCompose();
168  }
void setReadOnly(boolean readOnly)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ cellChanged()

void org.turro.financials.document.DocumentExpiriesGrid.cellChanged ( EditableCell  editableCell,
Object  value 
)
protected

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

Definition at line 257 of file DocumentExpiriesGrid.java.

257  {
258  super.cellChanged(editableCell, value);
259  updateRow(editableCell.getRow());
260  if(value instanceof DocumentDefinition) {
261  SingleLineDocumentWrapper sldw = (SingleLineDocumentWrapper) editableCell.getRow().getValue();
262  if(((DocumentDefinition) value).getId() != lastDocDef.getId()) {
263  lastDocDef = (DocumentDefinition) value;
264  sldw.getExpiryDefinition();
265  sldw.setExpiryDefinition(lastDocDef);
266  sldw.setStore(null);
267  sldw.setLineType(null);
268  }
269  } else if(value instanceof Contract) {
270  SingleLineDocumentWrapper sldw = (SingleLineDocumentWrapper) editableCell.getRow().getValue();
271  lastStoreMap.put(sldw.getExpiryDefinition(), (Contract) value);
272  }
273  }
Here is the call graph for this function:

◆ createEditor()

HtmlBasedComponent org.turro.financials.document.DocumentExpiriesGrid.createEditor ( EditableCell  editableCell)
protected

Reimplemented from org.turro.zkoss.grid.EditableGrid< V >.

Definition at line 192 of file DocumentExpiriesGrid.java.

192  {
193  if(editableCell.getColumn() instanceof EditableColumn) {
194  EditableColumn ec = (EditableColumn) editableCell.getColumn();
195  if(ec.getJavaClass().equals(DocumentDefinition.class)) {
196  Object value = getCellValue(editableCell);
197  DocumentDefinitionListbox ddl = new DocumentDefinitionListbox();
198  ddl.setCollection(expiryDefinitions);
199  if(value != null) {
200  ddl.setObjectValue((DocumentDefinition) value);
201  lastDocDef = (DocumentDefinition) value;
202  }
203  ddl.setMold("select");
204  return ddl;
205  } else if(ec.getJavaClass().equals(Product.class)) {
206  Object value = getCellValue(editableCell);
207  ProductCombobox pc = new ProductCombobox();
208  if(value != null) pc.setObjectValue((Product) value);
209  return pc;
210  } else if(ec.getJavaClass().equals(ProductByContractor.class)) {
211  Object value = getCellValue(editableCell);
212  ProductByContractorCombobox pbpc = new ProductByContractorCombobox(document.getContract());
213  if(value != null) pbpc.setObjectValue((ProductByContractor) value);
214  return pbpc;
215  } else if(ec.getJavaClass().equals(LineType.class)) {
216  SingleLineDocumentWrapper sldw = (SingleLineDocumentWrapper) editableCell.getRow().getValue();
217  Object value = getCellValue(editableCell);
218  LineTypePreferenceListbox ltl = new LineTypePreferenceListbox(document, sldw.getExpiryDefinition());
219  if(value != null) {
220  //TODO: check whether is preferable to assign preferences from document line
221  //((LineType) value).setContractPreference(sldw.getContractPreference());
222  ltl.setObjectValue((LineType) value);
223  }
224  ltl.setMold("select");
225  return ltl;
226  } else if(ec.getJavaClass().equals(Contract.class)) {
227  SingleLineDocumentWrapper sldw = (SingleLineDocumentWrapper) editableCell.getRow().getValue();
228  Object value = getCellValue(editableCell);
229  ContractListbox slb = new ContractListbox(
230  new ContractUsualSet(storeMap.get(sldw.getExpiryDefinition().getId()), true,
231  sldw.getTarget().getUsualPath() + "st:"));
232  if(value != null) {
233  slb.setObjectValue((Contract) value);
234  }
235  slb.setMold("select");
236  return slb;
237  } else if(ec.getJavaClass().equals(String.class) && "concept".equals(ec.getProperty())) {
238  SingleLineDocumentWrapper sldw = (SingleLineDocumentWrapper) editableCell.getRow().getValue();
239  Object value = getCellValue(editableCell);
240  ConceptCombobox slb = new ConceptCombobox();
241  slb.setObjectValue(UsualUsages.getMostUsedvalue(sldw.getTarget().getUsualPath() + "cp:"));
242  slb.setDocumentDefinition(sldw.getExpiryDefinition());
243  if(value != null) slb.setObjectValue((String) value);
244  return slb;
245  } else if("price".equals(ec.getProperty())) {
246  SingleLineDocumentWrapper sldw = (SingleLineDocumentWrapper) editableCell.getRow().getValue();
247  if(sldw.getTotal() == 0) {
248  sldw.setPrice(getCurrentDifference());
249  }
250  return super.createEditor(editableCell);
251  }
252  }
253  return super.createEditor(editableCell);
254  }
Object getCellValue(EditableCell editableCell)
Here is the call graph for this function:

◆ deleteRow()

boolean org.turro.financials.document.DocumentExpiriesGrid.deleteRow ( Row  row)
protected

Reimplemented from org.turro.zkoss.grid.EditableGrid< V >.

Definition at line 143 of file DocumentExpiriesGrid.java.

143  {
144  SingleLineDocumentWrapper dr = (SingleLineDocumentWrapper) row.getValue();
145  dr.removeRelation();
146  return true;
147  }
Here is the call graph for this function:

◆ formatCell()

String org.turro.financials.document.DocumentExpiriesGrid.formatCell ( EditableCell  editableCell,
Object  value 
)
protected

Reimplemented from org.turro.zkoss.grid.EditableGrid< V >.

Definition at line 171 of file DocumentExpiriesGrid.java.

171  {
172  if(value instanceof DocumentDefinition) {
174  return dd.getName();
175  } else if(value instanceof Product) {
176  Product p = ((Product) value);
177  return "#" + p.getProductCodeStr() + " " + p.getDescription();
178  } else if(value instanceof ProductByContractor) {
180  return "#" + pbp.getContractorCode() + " " + pbp.getProduct().getDescription();
181  } else if(value instanceof LineType) {
182  LineType lt = ((LineType) value);
183  return lt.getComposedName();
184  } else if(value instanceof Contract) {
185  Contract ctc = ((Contract) value);
186  return ctc.getPartialDescription();
187  }
188  return super.formatCell(editableCell, value);
189  }
Here is the call graph for this function:

◆ getDocument()

Document org.turro.financials.document.DocumentExpiriesGrid.getDocument ( )

Definition at line 72 of file DocumentExpiriesGrid.java.

72  {
73  return document;
74  }

◆ getRelations()

Collection<DocumentRelation> org.turro.financials.document.DocumentExpiriesGrid.getRelations ( )

Definition at line 64 of file DocumentExpiriesGrid.java.

64  {
65  ArrayList<DocumentRelation> list = new ArrayList<>();
66  for(SingleLineDocumentWrapper sldw : getValues()) {
67  list.add(sldw.getRelation());
68  }
69  return list;
70  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ initiateRow()

void org.turro.financials.document.DocumentExpiriesGrid.initiateRow ( Row  row,
SingleLineDocumentWrapper  value 
)
protected

Definition at line 130 of file DocumentExpiriesGrid.java.

130  {
131  if(value == null && expiryDefinitions != null && !expiryDefinitions.isEmpty()) {
132  value = new SingleLineDocumentWrapper(document, lastDocDef);
133  //value.setStore(lastStoreMap.get(value.getExpiryDefinition()));
134  if(!Strings.isBlank(document.getDocumentNumber())) {
135  value.setDocumentNumber(document.getDocumentNumber() + "/" + getRowCount());
136  }
137  value.setLineType(null);
138  }
139  row.setValue(value);
140  }
Here is the call graph for this function:

◆ isValid()

boolean org.turro.financials.document.DocumentExpiriesGrid.isValid ( SingleLineDocumentWrapper  v)
protected

Definition at line 150 of file DocumentExpiriesGrid.java.

150  {
151  return v != null && v.isValid();
152  }
Here is the call graph for this function:

◆ notifyChange()

void org.turro.financials.document.DocumentExpiriesGrid.notifyChange ( )

Definition at line 113 of file DocumentExpiriesGrid.java.

113  {
114  Events.postEvent(new Event(Events.ON_CHANGE, this));
115  updateDocument();
116  afterCompose();
117  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setDocument()

void org.turro.financials.document.DocumentExpiriesGrid.setDocument ( Document  document)

Definition at line 76 of file DocumentExpiriesGrid.java.

76  {
77  this.document = document;
78  }

◆ updateLines()

void org.turro.financials.document.DocumentExpiriesGrid.updateLines ( )

Definition at line 119 of file DocumentExpiriesGrid.java.

119  {
120  if(document == null || getValues().isEmpty()) {
121  updateDocument();
122  } else {
123  clearRows();
124  setCollection(SingleLineDocumentWrapper.adapt(document, document.getDescendants()));
125  super.afterCompose();
126  }
127  }
Set< DocumentRelation > getDescendants()
Definition: Document.java:139
void setCollection(Collection< V > collection)
Here is the call graph for this function:
Here is the caller graph for this function:

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