// if (tuples != null ){
if (tuples != null && getTupleCount() > 0 ){
jp = new JPanel();
jp.setBackground(AppColors.HIERARCHY_PANE_BACKGROUND);
// jp.setLayout(new BoxLayout(jp, BoxLayout.Y_AXIS));
GridBagLayoutRex gb = new GridBagLayoutRex();
jp.setLayout(gb);
tupleCount = getTupleCount();
memberCount = ((Tuple)tuples.elementAt(0)).getMemberCount();
// int panelPartCount = tupleCount/512;;
// JPanel[] panelPart = new JPanel[panelPartCount];
// for(i=0; i<panelPartCount; i++){
// gb[i] = new GridBagLayout();
// panelPart[i].setLayout(gb[i]);
// jp.add(panelPart[i]);
// }
GridBagConstraints c = new GridBagConstraints();
//Jules
Dimension dim = new Dimension(itemWidth, itemHeight);
//c.fill = GridBagConstraints.HORIZONTAL;
c.fill = GridBagConstraints.BOTH;
c.weightx = 1; // resizable in both ways
c.weighty = 1;
int[] memberSpan = new int[memberCount];
int[] currMemberX = new int[memberCount];
for(k=0; k < memberCount; k++) memberSpan[k] = 0;
for(k=0; k < memberCount; k++) currMemberX[k] = tupleCount;
for (i = tupleCount - 1; i >= 0; i--) {
for(j=0; j<memberCount; j++){
//S.out("i=" + i + " j=" + j + " memberSpan[j]=" + getTupleAt(i).getMemberAt(j).getMemberSpan() + " item=" + getTupleAt(i).getMemberAt(j));
if (memberSpan[j] == 0){
memberSpan[j] = getTupleAt(i).getMemberAt(j).getMemberSpan();
currMemberX[j] -= getTupleAt(i).getMemberAt(j).getMemberSpan();
// S.out("x=" + currMemberX[j]
// + "\ty=" + j
// + "\twidthy=" + getTupleAt(i).getMemberAt(j).getMemberSpan()
// + "\tmember=" + getTupleAt(i).getMemberAt(j));
item = new RowTupleMemberLabel("" + getTupleAt(i).getMemberAt(j)
, query
, getTupleAt(i)
, j
, i);
// setHierarchyLabelProperties(item);
item.setToolTipText(getTupleAt(i).getMemberAt(j).getToolTip());
//Jules
// item.setPreferredSize(new Dimension(itemWidth, itemHeight));
// item.setMinimumSize(new Dimension(itemWidth, itemHeight));
// item.setMaximumSize(new Dimension(itemWidth, itemHeight));
item.setPreferredSize(dim);
item.setMinimumSize(dim);
item.setMaximumSize(dim);
// add listener
c.gridx = j;
c.gridy = currMemberX[j];
c.gridwidth = 1;
c.gridheight = getTupleAt(i).getMemberAt(j).getMemberSpan();
// S.out("c.gridx=" + c.gridx
// + " c.gridy=" + c.gridy
// + " c.gridheight= "+ c.gridheight
// + " c.gridwidth=" + c.gridwidth
// + " item = " + item.getText()
// + " attrs=" + item);
gb.setConstraints(item, c);
jp.add(item);
}
memberSpan[j]--;
}
}
if (showColumnTotalsOn){
/**
* Copyright (C) 2006 CINCOM SYSTEMS, INC.
* All Rights Reserved
* Copyright (C) 2006 Igor Mekterovic
* All Rights Reserved
*/
/* implementing localization */
JLabel totalsLabel = lblSum; // new JLabel("<html><b>SUM:</b></html>", JLabel.RIGHT);
/* end of modification for I18n */
totalsLabel.setBackground(AppColors.CELL_TOTAL_SUM_BACKGROUND_COLOR);
totalsLabel.setBorder(AppColors.CELL_TOTAL_SUM_BORDER);
totalsLabel.setOpaque(true);
c.gridx = 0;
c.gridy = tupleCount;
c.gridwidth = memberCount;
c.gridheight = 1;
gb.setConstraints(totalsLabel, c);
jp.add(totalsLabel);
totalsLabel = lblAverage;//new JLabel("<html><b>AVERAGE:</b></html>", JLabel.RIGHT);
totalsLabel.setBackground(AppColors.CELL_TOTAL_AVERAGE_BACKGROUND_COLOR);
totalsLabel.setBorder(AppColors.CELL_TOTAL_AVERAGE_BORDER);
totalsLabel.setOpaque(true);
c.gridx = 0;
c.gridy = tupleCount + 1;
c.gridwidth = memberCount;
c.gridheight = 1;
gb.setConstraints(totalsLabel, c);
jp.add(totalsLabel);
}
// for(int comp = 0; comp<jp.getComponentCount(); comp++){
// S.out("comp[" + comp + "]=" + jp.getComponent(comp));