Skip to main content



      Home
Home » Archived » Visual Editor (VE) » Tables
Tables [message #114349] Fri, 30 December 2005 11:53 Go to next message
Eclipse UserFriend
When I put a JTable on a JPane, the table appears in the VE design
screen if I do not set a TableModel. However, it seems that the table
disappears from design view as soon as I set any TableModel. Either way
the Table appears as expected when I run the code. Can the VE display
a Table with a TableModel?

This displays in the VE:

private JTable getMyTable() {
myTable = new JTable();
myTableModel = null;
myTable.setModel(myTableModel);
return myTable;
}

This does not display in the VE:

private JTable getMyTable() {
myTable = new JTable();
myTableModel = new DefaultTableModel();
myTable.setModel(myTableModel);
return myTable;
}


--
Robert Emmons, Aurigen Inc.
remmons@aurigen.com, http://www.aurigen.com
Re: Tables [message #114362 is a reply to message #114349] Fri, 30 December 2005 13:48 Go to previous message
Eclipse UserFriend
Robert,

Yes, in most cases, the Visual Editor can display table models. In fact,
with your code below, it's actually displaying the model you set - since
the model does not have any elements the table is displayed as blank.
When no table model is specified (or it's null) the VE displays the
table with a mock table model (0x0, 0x1, etc).

If you're having problems displaying your custom table model, make sure
that the methods to retrieve values from the model work in design time
(may need some external initialization, connection to a database, etc).
Alternatively, you can return your own mock data from your data model
when being used in design time using the following pattern:

public Object getValueAt(int rowIndex, int columnIndex) {
if (java.beans.Beans.isDesignTime()) {
return "value " + rowIndex + "," + columnIndex;
} else {
return getRealData(rowIndex, columnIndex);
}
}

Hope this helps,
- Jeff
Re: Tables [message #611712 is a reply to message #114349] Fri, 30 December 2005 13:48 Go to previous message
Eclipse UserFriend
Robert,

Yes, in most cases, the Visual Editor can display table models. In fact,
with your code below, it's actually displaying the model you set - since
the model does not have any elements the table is displayed as blank.
When no table model is specified (or it's null) the VE displays the
table with a mock table model (0x0, 0x1, etc).

If you're having problems displaying your custom table model, make sure
that the methods to retrieve values from the model work in design time
(may need some external initialization, connection to a database, etc).
Alternatively, you can return your own mock data from your data model
when being used in design time using the following pattern:

public Object getValueAt(int rowIndex, int columnIndex) {
if (java.beans.Beans.isDesignTime()) {
return "value " + rowIndex + "," + columnIndex;
} else {
return getRealData(rowIndex, columnIndex);
}
}

Hope this helps,
- Jeff
Previous Topic:Tables
Next Topic:Edit existing sourcefiles with VE
Goto Forum:
  


Current Time: Sun May 11 15:55:34 EDT 2025

Powered by FUDForum. Page generated in 0.03217 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top