0

My question is:

  1. how to display a table information in prefuse? I found GridLayout might be relevant. But I don't know how to exactly draw a table using prefuse, like a JTable looking and the typical functions like getRow, selectColumn, mouseClick for each cell et al.
  2. my table table is a little complicated, each column has different data type. I suppose I need to add two data separately into m_vis. But can they work fine together in a single table view? And I just add different listeners for different data groups?

To add details about my data:

I have an implementation using JTable in java swing to show a list of documents which each row contains 10 columns showing different variable values associate with this document. The table structure is not uniform, in a sense that the first two rows show other information, each cell in the first row is a comboBox to do selection and each cell in the second row is a bar chart showing distribution for the variable shown in this column( each bar is a JPanel display with mouse click event enabled).

Given such table model, I am also not sure how to put the first two rows into Data in prefuse since they are drawn using Graphics2D in java swing. The data type(.class) cannot even be specified, right?

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
AnneS
  • 1,493
  • 3
  • 14
  • 19

1 Answers1

1

The data type (.class) cannot even be specified, right?

No. As discussed in How to Use Tables, the table model's getColumnClass() implementation can specify the type of data for each cell as a class literal. The type is one way JTable uses to select a suitable renderer. Icons and small images are a reasonable choice for display in situ, but a ListSelectionListener can be used to display larger elements in an adjacent component.

trashgod
  • 203,806
  • 29
  • 246
  • 1,045
  • THanks. But actually I already implemented it using JTable, specifying the getValueAt() to return the different information for different cells. And my question here is how to build this in Table in Prefuse, since I didn't find examples on visualizing table-based information in a table-format. Would you have any suggestions? – AnneS Oct 24 '13 at 19:51
  • Sorry, no. A `TableModelListener` will let you see any changes to the `TableModel`, but see these [examples](http://stackoverflow.com/a/13628183/230513) for caveats regarding `getValueAt()`. – trashgod Oct 24 '13 at 20:00