Re: Re: Use of JTable and tree

<[email protected]>
Newsgroups gmane.comp.embedded.carlsbad-cubes
Organization http://freemail.web.de/
Message-ID <[email protected]>
List for Users of Carlsbad Cubes' Technologies and Products schrieb am 07.05.04 01:34:10:
> 
> Wolf,
> 
> I tried out the suggestion but I get a Swixapplet
> not found error and a blank page. However it
> doesn't matter as it still doesn't explain how
> to use tree and table. For example I ran the
>  localisation sample program which has a tree
> defined and it showed a structure including the
> category sports and the item basketball, but I
> couldn't find how or where this was being set.

Ok, the sport tree is the default content if nothing
else is set. You need to specify a TreeModel. In
Swixml you may do this through the initclass attribute
refering to a classname you want to have as
TreeModel.

> 
> When I tried to use table the GUI simply didn't
> show anything. With a bit of trial and error I
> managed to come up with the following code:
> 
>  new AssetTable ((JTable)swix.find("table"));
> 
> where AssetTable is a class that contains
>           table.setModel(new MyTableModel());
> 
> and the XML contains
>     <scrollPane >
>       <table id="table" name="table" AutoCreateColumnsFromModel="true" />
>     </scrollPane>

This should place a scrollpane around your table.
But you may create your tablemodel like this:

<table id="table" name="table" AutoCreateColumnsFromModel="true"
         initclass="MyTableModel"/>

> 
> This shows the data from my model in the GUI but I still have 2 problems:
> 
> 1. There are no scrollbars even though the table is too large to
> be displayed completely.

Perhaps the reason lies somewhere else. Can you provide us
with some more XML/Java code?


> 2. The headers are shown from the table, but I would like to
> localise them. Any recommendations?

Yes. You have to get a ResourceBundle suitable for the current
locale (a set of property-files like loc.properties,
loc_it.properties, loc_de.properties, ... there are basically).
Have a look at the
docu of java.util.ResourceBundle for this. Then you call
resourceBundle.get("header-key") if a table header is queried.
Note: if you change the (default) locale, you have to refetch
your resource bundle again, now using the new locale.

Hope to have helped,

Frank

> 
> 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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.