Hello,
I have a problem : I want to update matrix model by script and it doesn't work...
The non working function is : matrix.createHeaderCell ( MatrixHeaderCell cellToInsertBefore, ObjDef objDef, int symbol, int size, boolean rowHeader )
See script code below :
function MiseAJourMatrice(tabObj_objLigne, tabObj_Colonne, matrice, numSymb_Ligne, numSymb_Colonne){
var matrice = matrice.getMatrixModel();
//Récupère les entêtes (en ligne et en colonne) de la matrice
var rowHeader = matrice.getHeader(true);
var columnHeader = matrice.getHeader(false);
var rowCells = rowHeader.getCells();
var columnCells = columnHeader.getCells();
for (cptligne = 0; cptligne < tabObj_objLigne.length; cptligne++)
{
var result = new Array();
result = getMatrixHeaderCellByObjDef(tabObj_objLigne[cptligne],matrice,true);
if(result[0] == 1)
{
// matrice.deleteHeaderCell(result[1]); // deleteHeaderCell correctly works, if matriching ObjDef founded, the row is deleted
// only for testing and debugging
} else
{// If Object not founded, a new row in the HeaderCell should be created but it doesn't works
var cellLigne = matrice.createHeaderCell( null , tabObj_objLigne[cptligne], -1, -1, true);
}
}
for(var cptcol = 0; cptcol < tabObj_Colonne.length; cptcol++)
{
var result = new Array();
result = getMatrixHeaderCellByObjDef(tabObj_Colonne[cptcol],matrice,false);
if(result[0] == 1)
{
// matrice.deleteHeaderCell(result[1]);
// only for debugging, deleteHeaderCell correctly works, if Object if founded, the column is deleted
} else
{
var CellCol = matrice.createHeaderCell( null , tabObj_Colonne[cptcol], -1 , -1, false);
var toto = "stop"; // Break point for checking variables during debug
}
}
return matrice;
}
function getMatrixHeaderCellByObjDef(objDef,matrice,isRow){
var result = new Array();
result[0] = 0;
matrice = matrice.getMatrixModel();
var header = matrice.getHeader(isRow);
var headerCells = new Array();
headerCells = header.getCells();
for(var i = 0; i < headerCells.length; i++)
{
if (headerCells[i].getDefinition().IsEqual(objDef))
{
result[1] = headerCells[i];
result[0]++;
break;
}
}
return result;
}
When I put a break point on bold line
CellCol : com.idsscheer.aris.server.bl.common.reportobjects.aris.logic.AMatrixHeaderCell@51252b39
CellCol.getDefinition() : Wrapped java.lang.NullPointerException
tabObj_Colonne[cptcol] : ObjDef ID=cut###22e###p##
I understand that the HeaderCell is created but with empty content (nullPointerException)
I tried to change null parameter with an existing HeaderCell, -1 Symbol and -1 Size with Object Symbol or Column Size, the result is allways the same, it doesn't work...
Is there any bug known with ceateHeaderCell function or is there anything wrong on my code ?
Can you help me ?
Thank's