BrightSide Workbench Full Report + Source Code
org.turro.erp.purchase.HoursGrid Class Reference
Inheritance diagram for org.turro.erp.purchase.HoursGrid:
Collaboration diagram for org.turro.erp.purchase.HoursGrid:

Public Member Functions

 HoursGrid ()
 
boolean isReceipt ()
 
void setReceipt (boolean receipt)
 
void setDocumentDate (Date documentDate)
 
void refreshUsing (HumanResource humanResource, String documentNumber, Date documentDate)
 
- 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)
 
void afterCompose ()
 
- 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, HoursItem value)
 
boolean deleteRow (Row row)
 
boolean isValid (HoursItem v)
 
HtmlBasedComponent createEditor (final EditableCell editableCell)
 
String formatCell (EditableCell editableCell, Object value)
 
void cellChanged (EditableCell editableCell, Object value)
 
boolean isCellValid (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 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 55 of file HoursGrid.java.

Constructor & Destructor Documentation

◆ HoursGrid()

org.turro.erp.purchase.HoursGrid.HoursGrid ( )

Definition at line 65 of file HoursGrid.java.

65  {
66  addColumns();
67  }

Member Function Documentation

◆ cellChanged()

void org.turro.erp.purchase.HoursGrid.cellChanged ( EditableCell  editableCell,
Object  value 
)
protected

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

Definition at line 184 of file HoursGrid.java.

184  {
185  if(editableCell.getColumn() instanceof EditableColumn) {
186  EditableColumn ec = (EditableColumn) editableCell.getColumn();
187  if(ec.getLabel().equals(Application.getString("lAutomatic"))) {
188  updateRow(editableCell.getRow());
189  }
190  }
191  super.cellChanged(editableCell, value);
192  }
Here is the call graph for this function:

◆ createEditor()

HtmlBasedComponent org.turro.erp.purchase.HoursGrid.createEditor ( final EditableCell  editableCell)
protected

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

Definition at line 109 of file HoursGrid.java.

109  {
110  if(editableCell.getColumn() instanceof EditableColumn) {
111  final HoursItem hoursItem = (HoursItem) editableCell.getRow().getValue();
112  if(hoursItem.getStartWorking() == null) {
113  hoursItem.setStartWorking(lastDate);
114  }
115  EditableColumn ec = (EditableColumn) editableCell.getColumn();
116  if(ec.getLabel().equals(Application.getString("lReference"))) {
117  Object value = getCellValue(editableCell);
118  final OrderReferencePositionListbox orplb = new OrderReferencePositionListbox();
119  orplb.setMold("select");
120  orplb.setAllowNull(true);
121  orplb.setNullAtBottom(true);
122  orplb.setNullLabel("lNewReference");
123  orplb.setWorkOrder(hoursItem.getWorkOrder());
124  // line value must update with new selection
125  orplb.addEventListener(Events.ON_SELECT, new EventListener() {
126  @Override
127  public void onEvent(Event event) throws Exception {
128  Integer oref = orplb.getObjectValue();
129  if(oref != null) {
130  hoursItem.setOrderRef(oref);
131  Events.postEvent(new Event(Events.ON_CHANGING, HoursGrid.this, editableCell));
132  }
133  }
134  });
135  if(value != null) orplb.setObjectValue((Integer) value);
136  return orplb;
137  } else if(ec.getJavaClass().equals(Task.class)) {
138  Object value = getCellValue(editableCell);
139  TaskListbox tlb = new TaskListbox();
140  tlb.setMold("select");
141  tlb.setAllowNull(true);
142  tlb.setNullAtBottom(true);
143  tlb.setNullLabel("lNewTask");
144  tlb.setOrderReference(hoursItem.getOrderReference());
145  if(value != null) tlb.setObjectValue((Task) value);
146  return tlb;
147  } else if(ec.getJavaClass().equals(ResourceAptitude.class)) {
148  Object value = getCellValue(editableCell);
149  ResourceAptitudeCombobox racb = new ResourceAptitudeCombobox();
150  if(value != null) racb.setObjectValue((ResourceAptitude) value);
151  return racb;
152  } else if(ec.getLabel().equals(Application.getString("lDedication"))) {
153  Object value = getCellValue(editableCell);
154  Percentbox pc = new Percentbox();
155  if(value != null) pc.setValue((Double) value);
156  return pc;
157  }
158  }
159  return super.createEditor(editableCell);
160  }
Object getCellValue(EditableCell editableCell)
Here is the call graph for this function:

◆ deleteRow()

boolean org.turro.erp.purchase.HoursGrid.deleteRow ( Row  row)
protected

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

Definition at line 99 of file HoursGrid.java.

99  {
100  return true;
101  }

◆ formatCell()

String org.turro.erp.purchase.HoursGrid.formatCell ( EditableCell  editableCell,
Object  value 
)
protected

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

Definition at line 163 of file HoursGrid.java.

163  {
164  HoursItem hoursItem = (HoursItem) editableCell.getRow().getValue();
165  lastWorkOrderId = hoursItem.getWorkOrderId();
166  lastOrderRef = hoursItem.getOrderRef();
167  lastDate = hoursItem.getStartWorking();
168  lastTask = hoursItem.getTask();
169  lastResource = hoursItem.getResourceAptitude();
170  lastConcept = hoursItem.getConcept();
171  if(value instanceof Task) {
172  Task t = ((Task) value);
173  return t.getName();
174  } else if(value instanceof ResourceAptitude) {
175  ResourceAptitude r = ((ResourceAptitude) value);
176  return r.getName();
177  } else if(editableCell.getColumn().getLabel().equals(Application.getString("lDedication"))) {
178  return DecimalFormats.format(((Double) value) * 100.0) + "%";
179  }
180  return super.formatCell(editableCell, value);
181  }
Here is the call graph for this function:

◆ initiateRow()

void org.turro.erp.purchase.HoursGrid.initiateRow ( Row  row,
HoursItem  value 
)
protected

Definition at line 84 of file HoursGrid.java.

84  {
85  if(value == null) {
86  value = new HoursItem();
87  value.setDedication(1.0);
88  value.setWorkOrderId(lastWorkOrderId);
89  value.setOrderRef(lastOrderRef);
90  value.setStartWorking(lastDate);
91  value.setTask(lastTask);
92  value.setConcept(lastConcept);
93  value.setResourceAptitude(lastResource);
94  }
95  row.setValue(value);
96  }
Here is the call graph for this function:

◆ isCellValid()

boolean org.turro.erp.purchase.HoursGrid.isCellValid ( EditableCell  editableCell,
Object  value 
)
protected

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

Definition at line 195 of file HoursGrid.java.

195  {
196  if(editableCell.getColumn() instanceof EditableColumn) {
197  EditableColumn ec = (EditableColumn) editableCell.getColumn();
198  if(ec.getLabel().equals(Application.getString("lWorkOrder"))) {
199  return WorkOrder.getByWorkOrderId((Long) value) != null;
200  }
201  }
202  return super.isCellValid(editableCell, value);
203  }
Here is the call graph for this function:

◆ isReceipt()

boolean org.turro.erp.purchase.HoursGrid.isReceipt ( )

Definition at line 69 of file HoursGrid.java.

69  {
70  return receipt;
71  }
Here is the caller graph for this function:

◆ isValid()

boolean org.turro.erp.purchase.HoursGrid.isValid ( HoursItem  v)
protected

Definition at line 104 of file HoursGrid.java.

104  {
105  return v.isValid();
106  }

◆ refreshUsing()

void org.turro.erp.purchase.HoursGrid.refreshUsing ( HumanResource  humanResource,
String  documentNumber,
Date  documentDate 
)

Definition at line 222 of file HoursGrid.java.

222  {
223  Dao dao = new ErpPU();
224  List<HoursItem> l = new ArrayList<HoursItem>();
225 // for(HoursReceipt hr : (List<HoursReceipt>) dao.getResultList(
226 // "select hr from HoursReceipt as hr where humanReceipt.draftOrder.humanResourceUsage.humanResource = ? and documentNumber = ? and documentDate = ?",
227 // new Object[] { humanResource, documentNumber, documentDate })) {
228 // l.add(new HoursItem(hr));
229 // }
230 // for(HoursReceipt hr : (List<HoursReceipt>) dao.getResultList(
231 // "select hr from HoursReceipt as hr where resourceReceipt.draftOrder.resourceUsage.support = ? and documentNumber = ? and documentDate = ?",
232 // new Object[] { humanResource, documentNumber, documentDate })) {
233 // l.add(new HoursItem(hr));
234 // }
235  updateCollection(l);
236  }
void updateCollection(Collection< V > collection)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setDocumentDate()

void org.turro.erp.purchase.HoursGrid.setDocumentDate ( Date  documentDate)

Definition at line 77 of file HoursGrid.java.

77  {
78  if(lastDate == null) {
79  lastDate = new CheckDate(documentDate).setHour(8).setMinute(0).setSecond(0).getDate();
80  }
81  }
Here is the caller graph for this function:

◆ setReceipt()

void org.turro.erp.purchase.HoursGrid.setReceipt ( boolean  receipt)

Definition at line 73 of file HoursGrid.java.

73  {
74  this.receipt = receipt;
75  }

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