Skip to main content

Lost in realization space ...

2 replies [Last post]
Anonymous

My problem:

With the table reference removed from the TableColumnExt it's necessary
to trigger column's size calculation "some" time after setting the
prototype. That's done in my patch via table.layoutColumns() - no
problem if doing so in code. But when loading the resource from a .jdnc,
it has to be done _after_ the columns are realized.

I suspect that would be done somewhere in the TableElement code but
where exactly?

Greetings
Jeanette

---------------------------------------------------------------------
To unsubscribe, e-mail: jdnc-unsubscribe@jdnc.dev.java.net
For additional commands, e-mail: jdnc-help@jdnc.dev.java.net

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Kleopatra

that was a typical one - shortly after posting .... :-)

>
> I suspect that would be done somewhere in the TableElement code but
> where exactly?
>

What I did is change the TableElement.tableColumnsAssimilator:

public static final ElementAssimilator tableColumnsAssimilator = new
ElementAssimilator() {
public void assimilate(Realizable parent, Realizable child) {
JNTable table = (JNTable) parent.getObject();
TableColumnModel columnModel = (TableColumnModel)
child.getObject();
table.getTable().setAutoCreateColumnsFromModel(false);
table.getTable().setColumnModel(columnModel);
for(int i = 0; i < columnModel.getColumnCount() ; i++) {
TableColumn column = columnModel.getColumn(i);
// if (column instanceof TableColumnExt) {
// ( (TableColumnExt) column).setTable(table.getTable());
// }
if (column.getModelIndex() == -1) {
column.setModelIndex(i);
}
}
if (table.getTable() instanceof JXTable) {
((JXTable) table.getTable()).layoutColumns();
}
}
};

Seems to work - just to be sure: is it the correct place to do it?

Greetings
Jeanette

---------------------------------------------------------------------
To unsubscribe, e-mail: jdnc-unsubscribe@jdnc.dev.java.net
For additional commands, e-mail: jdnc-help@jdnc.dev.java.net

rameshgupta
Offline
Joined: 2004-06-04

[snip]

> if (table.getTable() instanceof JXTable) {
> ((JXTable) table.getTable()).layoutColumns();
> }
>
> Seems to work -

Although you could safely drop the instanceof test and the typecast that follows :-)

> just to be sure: is it the correct place to do it?
>
> Greetings
> Jeanette

Yes, that is the correct place! I am impressed with the speed with which you are combing our code! Any chance you can help some of the people on the forum with "How do I ..." kind of questions? That would be *highly* appreciated ;-) Many thanks!

Ramesh