}
//System.out.println("Clause " + clauseIndex);
//System.out.println(MPPUtility.hexdump(groupVarData, offset, 71, false, 16, ""));
GroupClause clause = new GroupClause();
group.addGroupClause(clause);
int fieldID = MPPUtility.getInt(groupVarData, offset);
FieldType type = FieldTypeUtility.getInstance14(fieldID);
clause.setField(type);
// from byte 0 2 byte short int - field type
// byte 3 - entity type 0b/0c
// 4th byte in clause is 1=asc 0=desc
// offset+8=font index, from font bases
// offset+12=color, byte
// offset+13=pattern, byte
boolean ascending = (MPPUtility.getByte(groupVarData, offset + 4) != 0);
clause.setAscending(ascending);
int fontIndex = MPPUtility.getByte(groupVarData, offset + 8);
FontBase fontBase = fontBases.get(Integer.valueOf(fontIndex));
int style = MPPUtility.getByte(groupVarData, offset + 9);
boolean bold = ((style & 0x01) != 0);
boolean italic = ((style & 0x02) != 0);
boolean underline = ((style & 0x04) != 0);
Color fontColor = MPPUtility.getColor(groupVarData, offset + 10);
FontStyle fontStyle = new FontStyle(fontBase, italic, bold, underline, false, fontColor, null, BackgroundPattern.SOLID);
clause.setFont(fontStyle);
clause.setCellBackgroundColor(MPPUtility.getColor(groupVarData, offset + 22));
clause.setPattern(BackgroundPattern.getInstance(MPPUtility.getByte(groupVarData, offset + 34) & 0x0F));
// offset+14=group on
int groupOn = MPPUtility.getByte(groupVarData, offset + 38);
clause.setGroupOn(groupOn);
// offset+24=start at
// offset+40=group interval
Object startAt = null;
Object groupInterval = null;
if (type != null)
{
switch (type.getDataType())
{
case DURATION :
case NUMERIC :
case CURRENCY :
{
startAt = Double.valueOf(MPPUtility.getDouble(groupVarData, offset + 47));
groupInterval = Double.valueOf(MPPUtility.getDouble(groupVarData, offset + 63));
break;
}
case PERCENTAGE :
{
startAt = Integer.valueOf(MPPUtility.getInt(groupVarData, offset + 47));
groupInterval = Integer.valueOf(MPPUtility.getInt(groupVarData, offset + 63));
break;
}
case BOOLEAN :
{
startAt = (MPPUtility.getShort(groupVarData, offset + 47) == 1 ? Boolean.TRUE : Boolean.FALSE);
break;
}
case DATE :
{
startAt = MPPUtility.getTimestamp(groupVarData, offset + 47);
groupInterval = Integer.valueOf(MPPUtility.getInt(groupVarData, offset + 63));
break;
}
default :
{
break;
}
}
}
clause.setStartAt(startAt);
clause.setGroupInterval(groupInterval);
offset += 71;
}
//System.out.println(group);