double nameSize = 0;
double valSize = 0;
AlignmentType atype = null;
for (Map.Entry<String, Object> entry : efields) {
ExtraField val = (ExtraField) entry.getValue();
nameSize = Math.max(nameSize, getFieldLenght(val.getNNFieldName()));
valSize = Math.max(valSize, getFieldLenght(val.getNNFieldData() + val.getNNFieldSufix()));
atype = val.alignmentType;
}
if (nameSize + valSize > destingWidth){
if (nameSize > (double)destingWidth / 3d){
//nameSize = (double)destingWidth / 3d;
valSize = ((double)destingWidth * 2) / 3d;
nameSize = (double)destingWidth - valSize;
}
else{
valSize = (double)destingWidth - nameSize;
}
}
double leftPos = 0;
switch (atype){
case dataInOneColoumnByRight:
case dataInOneColoumnByRightAndRigthAlign:
case dataInOneColoumnByRightAndHalfRigthAlign:
leftPos = (double)destingWidth - nameSize - valSize;
break;
case dataInOneColoumnByLeft:
valSize = (double) destingWidth - nameSize;
break;
}
for (Map.Entry<String, Object> entry : efields){
ExtraField val = (ExtraField) entry.getValue();
JRDesignExpression nameExp = createExpression(expressionFieldName(val, false));
JRDesignExpression dataExp = createFieldExpression(entry);
JRDesignTextField nameField = createItem(FieldTypes.firstPrage,
(int)Math.round(leftPos), 0,
(int)Math.round(nameSize), (int)Math.round(getFieldHeigth()), nameExp);