IDEMPIERE-69 Product Attribute Grid - Cols and rows always missing one entry

This commit is contained in:
Dirk Niemeyer 2011-09-18 11:07:24 -05:00
parent fc7bce6434
commit 628b436cdf
2 changed files with 12 additions and 12 deletions

View File

@ -329,7 +329,7 @@ public class VAttributeGrid extends CPanel
xValues = m_attributes[indexAttr1-1].getMAttributeValues(); xValues = m_attributes[indexAttr1-1].getMAttributeValues();
if (xValues != null) if (xValues != null)
{ {
cols = xValues.length; cols = xValues.length + 1;
log.info("X - " + m_attributes[indexAttr1-1].getName() + " #" + xValues.length); log.info("X - " + m_attributes[indexAttr1-1].getName() + " #" + xValues.length);
} }
@ -340,7 +340,7 @@ public class VAttributeGrid extends CPanel
yValues = m_attributes[indexAttr2-1].getMAttributeValues(); yValues = m_attributes[indexAttr2-1].getMAttributeValues();
if (yValues != null) if (yValues != null)
{ {
rows = yValues.length; rows = yValues.length + 1;
log.info("Y - " + m_attributes[indexAttr2-1].getName() + " #" + yValues.length); log.info("Y - " + m_attributes[indexAttr2-1].getName() + " #" + yValues.length);
} }
@ -356,11 +356,11 @@ public class VAttributeGrid extends CPanel
for (int col = 0; col < cols; col++) for (int col = 0; col < cols; col++)
{ {
MAttributeValue xValue = null; MAttributeValue xValue = null;
if (xValues != null) if (xValues != null && col > 0)
xValue = xValues[col]; xValue = xValues[col - 1];
MAttributeValue yValue = null; MAttributeValue yValue = null;
if (yValues != null) if (yValues != null && row > 0)
yValue = yValues[row]; yValue = yValues[row - 1];
// log.fine("Row=" + row + " - Col=" + col); // log.fine("Row=" + row + " - Col=" + col);
// //
if (row == 0 && col == 0) if (row == 0 && col == 0)

View File

@ -405,7 +405,7 @@ public class WAttributeGrid extends ADForm implements EventListener
} }
} }
if (xValues != null) if (xValues != null)
noOfCols = xValues.length; noOfCols = xValues.length + 1;
// y dimension // y dimension
int noOfRows = 2; int noOfRows = 2;
@ -426,7 +426,7 @@ public class WAttributeGrid extends ADForm implements EventListener
} }
if (yValues != null) if (yValues != null)
noOfRows = yValues.length; noOfRows = yValues.length + 1;
gridView.getChildren().clear(); gridView.getChildren().clear();
@ -443,11 +443,11 @@ public class WAttributeGrid extends ADForm implements EventListener
for (int colIndex = 0; colIndex < noOfCols; colIndex++) for (int colIndex = 0; colIndex < noOfCols; colIndex++)
{ {
MAttributeValue xValue = null; MAttributeValue xValue = null;
if (xValues != null) if (xValues != null && colIndex > 0)
xValue = xValues[colIndex]; xValue = xValues[colIndex - 1];
MAttributeValue yValue = null; MAttributeValue yValue = null;
if (yValues != null) if (yValues != null && rowIndex > 0)
yValue = yValues[rowIndex]; yValue = yValues[rowIndex - 1];
if (rowIndex == 0 && colIndex == 0) if (rowIndex == 0 && colIndex == 0)
{ {