Re: Re: Use of JTable and tree
| Newsgroups | gmane.comp.embedded.carlsbad-cubes |
|---|---|
| Organization | http://freemail.web.de/ |
| Message-ID | <[email protected]> |
Helo Philip,
I did not think of that, sorry.
You may try the following, which is handy for several
other things.
The idea is to have a render-finish-event. On creating
the table with a default layout register the table as
"RenderFinishListener". After the render()-call is done
in your calling class, inform the registered listeners
about the finished render process giving the swix-instance
as argument. I only needed the idmap in former projects so
the example given below has only this as parameter:
RenderPropertySupport rps = new RenderPropertySupport();
swingEngine se = new SwingEngine(...);
se.render(...);
rps.fireRenderFinish(se.getIdMap());
You must of course provide the rps to newly created
objects so this object must be getten in a static way.
In your table model, you have something like this:
public MyTableModel() implements RenderFinishListener {
public MyTableModel() {
RenderPropertySupport rps = MyMainClass.getRps();
rps.addRenderFinishListener(this);
}
// change to SwingEngine parameter
public void rendered(Map idMap) {
SwingEngine se = ...;
myTableHeader = new String[]{swix.getLocalizer().getString("mis_Exit"),...};
fireTableChanged(new TableModelEvent...);
}
...
}
Of course, you may just store the SwingEngine instance in
a static variable before you call render(...), thus accessing
it upon creation of the table model. I found the solution above
usable if one GUI component has to know another, perhaps
a later rendered one (e.g. Actions need to know a table
model).
I append the zip-file to this mail, Wolf, I hope this is ok?
Frank
List for Users of Carlsbad Cubes' Technologies and Products schrieb am 18.05.04 22:34:33:
>
> Frank,
> to get back to localising the table headers you suggested using something like
> swix.getLocalizer().getString("mis_Exit")
>
> As I see this then means instantiating the table model
> after creating the SwingEngine but before doing the
> rendering, so that I can then pass the engine instance
> as a parameter, and therefore no longer put the
> tablemodel in the initclass parameter which requires
> me to go back to finding the table and setting the
> model in code. Can you think of a way of doing it
> that doesn't require me to instantiate the model
> by hand? Not that it matters too much but the
> more work that can be done by defining the interface
> and the less written by hand the better.
>
> Is it possible to pass parameters when specifying an initclass?
>
> distinti saluti/best regards
> Philip Kerrigan
>
> Solutions Consulting - Business Acceleration Services
> tel +39 02-52029884
> fax +39 02-52029472
> mobile: +39 335-780-5151
>
> EDS Italia SpA
> Via Medici del Vascello, 26
> 20138 Milano
> ITALY
>
>
> _______________________________________________
> Forum mailing list
> [email protected]
> http://carlsbadcubes.com/mailman/listinfo/forum_carlsbadcubes.com
_______________________________________________
Forum mailing list
[email protected]
http://carlsbadcubes.com/mailman/listinfo/forum_carlsbadcubes.com
renderpc.zip
(application/zip, 1.1 KB) - not displayed