* @return <code>true</code> if the current row must be expanded, <code>false</code> otherwise
*/
public boolean isRowExpandable(VOListTableModel model,int rowNum) {
DocumentTrackingVO vo = (DocumentTrackingVO)model.getObjectForRow(rowNum);
String docTypeDescr = vo.getDocTypeDescr();
Resources res = ClientSettings.getInstance().getResources();
if (docTypeDescr.equals(res.getResource("purchase invoice")) ||
docTypeDescr.equals(res.getResource("purchase invoice from delivery notes")) ||
docTypeDescr.equals(res.getResource("purchase invoice from purchase document")) ||
docTypeDescr.equals(res.getResource("debiting note")) ||
docTypeDescr.equals(res.getResource("purchase generic document")))
return false;
if (docTypeDescr.equals(res.getResource("purchase order")))
return true;
else if (docTypeDescr.equals(res.getResource("sale invoice")) ||
docTypeDescr.equals(res.getResource("sale invoice from delivery notes")) ||
docTypeDescr.equals(res.getResource("sale invoice from sale document")) ||
docTypeDescr.equals(res.getResource("credit note")) ||
docTypeDescr.equals(res.getResource("sale generic document")))
return false;
if (docTypeDescr.equals(res.getResource("sale order")) ||
docTypeDescr.equals(res.getResource("sale contract")) ||
docTypeDescr.equals(res.getResource("desk selling")) ||
docTypeDescr.equals(res.getResource("sale estimate")) ||
docTypeDescr.equals(res.getResource("delivery request")))
return true;
return false;
}
/**
* @param model grid model
* @param rowNum the current row number
* @return JComponent to show when expanding row; null to do not show anything
*/
public JComponent getComponentToShow(VOListTableModel model,int rowNum) {
DocumentTrackingVO vo = (DocumentTrackingVO)model.getObjectForRow(rowNum); // this is the v.o. associared to grid
OrderTrackingGridPanel p = new OrderTrackingGridPanel(
new Color(
color.getRed()+15,
color.getGreen()+15,
color.getBlue()+15
)
);
p.getGrid().getOtherGridParams().put(ApplicationConsts.PROPERTIES_FILTER,vo);
p.getGrid().setAutoLoadData(true);
p.setPreferredSize(
new Dimension(
OrderTrackingGridPanel.this.getWidth()-50,
OrderTrackingGridPanel.this.getHeight()>250?250:Math.max(OrderTrackingGridPanel.this.getHeight()-110,100)
)
);
return p;
}
});
grid.setController(new GridController() {
/**
* Method used to define the background color for each cell of the grid.
* @param rowNumber selected row index
* @param attributeName attribute name related to the column currently selected
* @param value object contained in the selected cell
* @return background color of the selected cell
*/
public Color getBackgroundColor(int row,String attributeName,Object value) {
return color;
}
/**
* Callback method invoked when the user has double clicked on the selected row of the grid.
* @param rowNumber selected row index
* @param persistentObject v.o. related to the selected row
*/
public void doubleClick(int rowNumber,ValueObject persistentObject) {
DocumentTrackingVO vo = (DocumentTrackingVO)persistentObject;
String docTypeDescr = vo.getDocTypeDescr();
Resources res = ClientSettings.getInstance().getResources();
if (docTypeDescr.equals(res.getResource("debiting note"))) {
new PurchaseDebitingDocController(
null,
new PurchaseDocPK(
vo.getCompanyCodeSYS01(),
vo.getDocType(),
vo.getDocYear(),
vo.getDocNumber()
)
);
}
else if (docTypeDescr.equals(res.getResource("purchase invoice")) ||
docTypeDescr.equals(res.getResource("purchase generic document"))) {
new PurchaseInvoiceDocController(
null,
new PurchaseDocPK(
vo.getCompanyCodeSYS01(),
vo.getDocType(),
vo.getDocYear(),
vo.getDocNumber()
)
);
}
else if (docTypeDescr.equals(res.getResource("purchase invoice from delivery notes"))) {
new PurchaseInvoiceDocFromDelivNotesController(
null,
new PurchaseDocPK(
vo.getCompanyCodeSYS01(),
vo.getDocType(),
vo.getDocYear(),
vo.getDocNumber()
)
);
}
else if (docTypeDescr.equals(res.getResource("purchase invoice from purchase document"))) {
new PurchaseInvoiceDocFromPurchaseDocController(
null,
new PurchaseDocPK(
vo.getCompanyCodeSYS01(),
vo.getDocType(),
vo.getDocYear(),
vo.getDocNumber()
)
);
}
else if (docTypeDescr.equals(res.getResource("purchase order"))) {
new PurchaseDocController(
null,
new PurchaseDocPK(
vo.getCompanyCodeSYS01(),
vo.getDocType(),
vo.getDocYear(),
vo.getDocNumber()
)
);
}
else if (docTypeDescr.equals(res.getResource("sale invoice")) ||
docTypeDescr.equals(res.getResource("sale generic document"))) {
new SaleInvoiceDocController(
null,
new SaleDocPK(
vo.getCompanyCodeSYS01(),
vo.getDocType(),
vo.getDocYear(),
vo.getDocNumber()
)
);
}
else if (docTypeDescr.equals(res.getResource("sale invoice from delivery notes"))) {
new SaleInvoiceDocFromDelivNotesController(
null,
new SaleDocPK(
vo.getCompanyCodeSYS01(),
vo.getDocType(),
vo.getDocYear(),
vo.getDocNumber()
)
);
}
else if (docTypeDescr.equals(res.getResource("sale invoice from sale document"))) {
new SaleInvoiceDocFromSaleDocController(
null,
new SaleDocPK(
vo.getCompanyCodeSYS01(),
vo.getDocType(),
vo.getDocYear(),
vo.getDocNumber()
)
);
}
else if (docTypeDescr.equals(res.getResource("credit note"))) {
new SaleCreditDocController(
null,
new SaleDocPK(
vo.getCompanyCodeSYS01(),
vo.getDocType(),
vo.getDocYear(),
vo.getDocNumber()
)
);
}
else if (docTypeDescr.equals(res.getResource("sale order"))) {
new SaleOrderDocController(
null,
new SaleDocPK(
vo.getCompanyCodeSYS01(),
vo.getDocType(),
vo.getDocYear(),
vo.getDocNumber()
)
);
}
else if (docTypeDescr.equals(res.getResource("sale contract"))) {
new SaleContractDocController(
null,
new SaleDocPK(
vo.getCompanyCodeSYS01(),
vo.getDocType(),
vo.getDocYear(),
vo.getDocNumber()
)
);
}
else if (docTypeDescr.equals(res.getResource("desk selling"))) {
new SaleDeskDocController(
null,
new SaleDocPK(
vo.getCompanyCodeSYS01(),
vo.getDocType(),
vo.getDocYear(),
vo.getDocNumber()
)
);
}
else if (docTypeDescr.equals(res.getResource("sale estimate"))) {
new SaleEstimateDocController(
null,
new SaleDocPK(
vo.getCompanyCodeSYS01(),
vo.getDocType(),
vo.getDocYear(),
vo.getDocNumber()
)
);
}
else if (docTypeDescr.equals(res.getResource("in delivery note"))) {
new InDeliveryNoteController(
null,
new DeliveryNotePK(
vo.getCompanyCodeSYS01(),
vo.getDocType(),
vo.getDocYear(),
vo.getDocNumber()
)
);
}
else if (docTypeDescr.equals(res.getResource("out delivery note"))) {
new OutDeliveryNoteController(
null,
new DeliveryNotePK(
vo.getCompanyCodeSYS01(),
vo.getDocType(),
vo.getDocYear(),
vo.getDocNumber()
)
);
}
else if (docTypeDescr.equals(res.getResource("delivery request"))) {
new DeliveryRequestController(
null,
new SaleDocPK(
vo.getCompanyCodeSYS01(),
vo.getDocType(),