PDA

View Full Version : Populate table with arraylist


afinemetsfan
07-01-2006, 11:44 AM
I have an arraylist which I would like to import to a table column, whats the best way to do this? I know that i need to create some sort of getarraylist method - but what should be in it?

Thanks:)

GKusnick
07-01-2006, 01:34 PM
For a vertical 1D table, just feed the list to the Table widget (i.e. put an action widget above the table, with an expression that yields the list as its value).

For a column of a 2D table, you'll need code in your Cell component chain to calculate the correct cell contents based on row and column indices.

The tutorial STV is worth a look if you haven't already done so. There are working examples of both kinds of table in there.

afinemetsfan
07-01-2006, 03:15 PM
Ive looked through the tutorial, but Im not really sure how GetRecodingQualities() works. Can you give me an example of an expression which yields the list as its value? Do I need to call a method which returns the list?

Thanks

Opus4
07-01-2006, 03:19 PM
GetRecodingQualities() returns a list that can be used for a table & is used in the default STV if you want to see sample code for it. The default STV contains example usage of a LOT of API calls. :)

- Andy

afinemetsfan
07-02-2006, 10:39 AM
Can I feed a list into a table. or does it have to be an array? If im calling Get Title(). will it work with a Table? I am having trouble populating the list into sage though...any suggestions would be great.

EDIT: problem solved, I was assuming that the main method of a class got called, when it never did.

:) Thanks






static List Title = new ArrayList<String>(); //decaled above main

//In main method
...
Title.add(dnload.getChild("TORRENT").getChild("NAME").getText());
...

public static List<String> GetTitle()
{
return Title;
}