Re: ResultsTable questions
Posted by
Fernando Sales on
Jun 03, 2009; 9:32pm
URL: http://imagej.273.s1.nabble.com/ResultsTable-questions-tp3692278p3692280.html
Michael,
i was writing my reply and Johannes has just described what i was
thinking...
Try to use the Singleton Pattern (
http://www.javacamp.org/designPattern/).
This is a "standard" solution to the problem of (writing / accessing) a
(file / database / ... ) from multiple sources.
The main idea is to develop a private method for creation of a unique
ResultsTable.
Best Regards,
Fernando
On Wed, Jun 3, 2009 at 6:17 PM, Johannes Schindelin <
[hidden email]> wrote:
> Hi,
>
> On Wed, 3 Jun 2009, Michael Doube wrote:
>
> > 1. Is there a value other than 0 that represents an empty cell? At the
> > moment, if no value is entered for a cell when another cell in the
> > same row is updated, 0 is shown in the table. This is not the same
> > as 'no data' - null seems more appropriate.
>
> AFAICT no, there is no way... ResultsTable can only contain doubles, and
> there is no null double...
>
> > 2. I can create a new results table and call it "Measurements" like
> > this: ResultsTable rt = new ResultsTable();
> > rt.show("Measurements"); But how do I check whether the
> > "Measurements" table already exists, and write to it instead of
> > overwriting it with a new instance each time? This is trivial if I
> > use the system Results table, ResultsTable rt =
> > ResultsTable.getResultsTable(); but I want to leave the "Results"
> > table free for other stuff and have a dedicated table for my plugins'
> > results.
>
> The only way I could imagine to do this is to look through
> WindowManager.getNonImageWindows().
>
> But if the table could only be constructed by _your_ code, you could make
> it a singleton... (i.e. private static ResultsTable measurements; [...] if
> (measurements == null) [...])
>
> Ciao,
> Dscho
>
--
**************************************************
Fernando José Ribeiro Sales
**************************************************
Email:
[hidden email]
Tel: (11) 82020303
**************************************************