}
});
buttonsPanel.removeAll();
final VariantNameVO varVO = (VariantNameVO)getVariantsMatrixVO().getManagedVariants()[0];
buttonsPanel.setLayout(new FlowLayout(FlowLayout.LEFT,5,5));
if (showButtons && vo.getManagedVariants().length>1) {
// create a buttons panel used to copy the same qty for all cells matching the same variant value...
for(int i=0;i<vo.getManagedVariants().length;i++) {
GenericButton btn = new GenericButton(new ImageIcon(ClientUtils.getImage("copy.gif")));
final VariantNameVO vnVO = (VariantNameVO)vo.getManagedVariants()[i];
btn.setButtonBehavior(Consts.BUTTON_IMAGE_AND_TEXT);
btn.setHorizontalTextPosition(SwingConstants.LEADING);
btn.setVerticalTextPosition(SwingConstants.CENTER);
btn.setText(vnVO.getDescriptionSYS10());
btn.setToolTipText(ClientSettings.getInstance().getResources().getResource("set the same value when matching the same")+" "+vnVO.getDescriptionSYS10());
btn.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (!onValidating)
grid.getTable().getGrid().stopCellEditing();
try {
int row = grid.getSelectedRow();
int col = grid.getTable().getGrid().getSelectedColumn();
if (row!=-1 && col!=-1 && grid.getTable().getGrid().getValueAt(row,col)!=null) {
BigDecimal qty = (BigDecimal)grid.getTable().getGrid().getValueAt(row,col);
VariantsMatrixRowVO currentRowVO = (VariantsMatrixRowVO)getVariantsMatrixVO().getRowDescriptors()[row];
VariantsMatrixColumnVO currentColVO = (VariantsMatrixColumnVO)getVariantsMatrixVO().getColumnDescriptors()[col-1];
String rowtype = null,rowcode = null;
String coltype = null,colcode = null;
String rowtypename = null,rowcodename = null;
String coltypename = null,colcodename = null;
if (getVariantsMatrixVO().getColumnDescriptors().length==0 ||
varVO.getTableName().equals(vnVO.getTableName())) {
rowtype = VariantsMatrixUtils.getVariantType(getVariantsMatrixVO(),currentRowVO);
rowcode = VariantsMatrixUtils.getVariantCode(getVariantsMatrixVO(),currentRowVO);
if (varVO.getTableName().equals("ITM11_VARIANTS_1")) {
rowtypename = "getVariantTypeITM06";
rowcodename = "getVariantCodeITM11";
}
else if (varVO.getTableName().equals("ITM12_VARIANTS_2")) {
rowtypename = "getVariantTypeITM07";
rowcodename = "getVariantCodeITM12";
}
else if (varVO.getTableName().equals("ITM13_VARIANTS_3")) {
rowtypename = "getVariantTypeITM08";
rowcodename = "getVariantCodeITM13";
}
else if (varVO.getTableName().equals("ITM14_VARIANTS_4")) {
rowtypename = "getVariantTypeITM09";
rowcodename = "getVariantCodeITM14";
}
else if (varVO.getTableName().equals("ITM15_VARIANTS_5")) {
rowtypename = "getVariantTypeITM10";
rowcodename = "getVariantCodeITM15";
}
}
else {
if (vnVO.getTableName().equals("ITM11_VARIANTS_1")) {
rowtype = currentRowVO.getVariantTypeITM06();
rowcode = currentRowVO.getVariantCodeITM11();
rowtypename = "getVariantTypeITM06";
rowcodename = "getVariantCodeITM11";
}
else if (vnVO.getTableName().equals("ITM12_VARIANTS_2")) {
coltype = currentColVO.getVariantTypeITM07();
colcode = currentColVO.getVariantCodeITM12();
coltypename = "getVariantTypeITM07";
colcodename = "getVariantCodeITM12";
}
else if (vnVO.getTableName().equals("ITM13_VARIANTS_3")) {
coltype = currentColVO.getVariantTypeITM08();
colcode = currentColVO.getVariantCodeITM13();
coltypename = "getVariantTypeITM08";
colcodename = "getVariantCodeITM13";
}
else if (vnVO.getTableName().equals("ITM14_VARIANTS_4")) {
coltype = currentColVO.getVariantTypeITM09();
colcode = currentColVO.getVariantCodeITM14();
coltypename = "getVariantTypeITM09";
colcodename = "getVariantCodeITM14";
}
else if (vnVO.getTableName().equals("ITM15_VARIANTS_5")) {
coltype = currentColVO.getVariantTypeITM10();
colcode = currentColVO.getVariantCodeITM15();
coltypename = "getVariantTypeITM10";
colcodename = "getVariantCodeITM15";
}