[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Ozone and JTables



On 15 Apr 2001 11:46:55 -0400, Adrian R Brown wrote:
> I was just wondering what help of info you all had for listing and 
> representing the contents of an Ozone databse inside a Table or JTable?
> 
I have done some of this in the past...
the trick is to have methods within you Ozone objects that return
results as an Object[][].

As the docs(and much disscussion) point out the Ozone System works best
when looked at as a system of Java objects that Ozone "merely" provides
the persistence for
so if you have a system of objects..its' best to design the reporting
straight into that system....
an example totally out of context looks like this
its a method used to extract information about technicians in a System
model
and comes from a *Impl object

 
  public Object[][] getTechs() {
        int i = _SysTechs.size();
        Object[][] data = new Object[i][3];
        int j = 0;
        for(Iterator it = _SysTechs.iterator(); it.hasNext();)
            {
                Technician tech = (Technician)it.next();
                String ID = ("" + tech.getSYSID());
                String NAC;
                try{
                    NAC = ("" + tech.getNoAssignedCalls());
                } catch (Exception e) {
                    NAC = ("None");
                }
                data[j][0] = ID;
                data[j][1] = tech.getName();
                data[j][2] = NAC;
                j++;
        }
        return data;
 }

this method is called inside the client and then formatted as you need
to, normally using some form of TableModel -> JTable implementation..

hope this helps
Sean Allen