[ xframe-Bugs-1200208 ] URGENT: Problem grouping headers

"SourceForge.net" <[email protected]> Wed, 11 May 2005 15:07:26 -0700
Newsgroups gmane.text.xml.xframe.xsddoc
Message-ID <[email protected]>
Bugs item #1200208, was opened at 2005-05-11 17:07
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=454391&aid=1200208&group_id=48863

Category: JXTable
Group: swing
Status: Open
Resolution: None
Priority: 5
Submitted By: Iñaqui Medina (inaquimj)
Assigned to: Nobody/Anonymous (nobody)
Summary: URGENT: Problem grouping headers

Initial Comment:
I need to fix an urgent problem and I don't have a clue. 
Any ideas?

I was using an old code that is something like:

public class GroupableTableHeader extends 
JTableHeader 
{
  protected Vector columnGroups = null;
    
  public GroupableTableHeader(TableColumnModel 
model) {
    super(model);
    setUI(new GroupableTableHeaderUI());
    setReorderingAllowed(false);

    setBackground(ECDividerPanel.gContentBgColor);
    setForeground(ECPanel.DARK_TEXT_COLOR);
    
    setFont(GUIConstants.standardFont);
  }
  
  public void setReorderingAllowed(boolean b) {
    reorderingAllowed = false;
  }
    
  public void addColumnGroup(ECColumnGroup g) {
    if (columnGroups == null) {
      columnGroups = new Vector();
    }
    columnGroups.addElement(g);
  }

  public Enumeration getColumnGroups(TableColumn 
col) {
    if (columnGroups == null) return null;
    Enumeration enum = columnGroups.elements();
    while (enum.hasMoreElements()) {
      ColumnGroup cGroup = (ColumnGroup)
enum.nextElement();
      Vector v_ret = cGroup.getColumnGroups(col,new 
Vector());
      if (v_ret != null) { 
	return v_ret.elements();
      }
    }
    return null;
  }
  
  public void setColumnMargin() {
    if (columnGroups == null) return;
    int columnMargin = getColumnModel
().getColumnMargin();
    Enumeration enum = columnGroups.elements();
    while (enum.hasMoreElements()) {
      ColumnGroup cGroup = (ColumnGroup)
enum.nextElement();
      cGroup.setColumnMargin(columnMargin);
    }
  } 
}



I know this is not the best code ever (I didn't write it) but 
it used to work and now it doesn't work with JXTables... I 
get:

java.lang.NullPointerException
	at 
net.sf.xframe.swing.table.DefaultColumnGroupHeaderRe
nderer.getTableCellRendererComponent
(DefaultColumnGroupHeaderRenderer.java:52)
	at 
net.sf.xframe.swing.table.ColumnGroupHeaderUI.paintCe
ll(ColumnGroupHeaderUI.java:118)
	at 
net.sf.xframe.swing.table.ColumnGroupHeaderUI.paint
(ColumnGroupHeaderUI.java:95)

Anything you can tell me about why this is happening I 
would really appreciate it.


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=454391&aid=1200208&group_id=48863


-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_id=7393&alloc_id=16281&op=click