Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / GUI / February 2006

Tip: Looking for answers? Try searching our database.

Editor / Renderer: data flow

Thread view: 
Denis - 23 Feb 2006 11:53 GMT
Hi all.

When I set an editor and a renderer to a jtable, which is the data
flow?

My editor return an Object from getCellEditorValue method. And then?
Which method proces that object?

I ask this cause I've set an editor with a comboBox to a jxtreetable
and when I click I see the comboBox. But when I select a value the
comboBox disappear and the cell remains as before...

Please help!

Thanks all,
DM
zero - 23 Feb 2006 19:37 GMT
"Denis" <denis.mazzucato@libero.it> wrote in news:1140695584.873035.240170
@f14g2000cwb.googlegroups.com:

> Hi all.
>
[quoted text clipped - 12 lines]
> Thanks all,
> DM

When the editor stops or cancels editing (fireEditingStopped or
fireEditingCanceled), the renderer takes over again.  Or, more accurately,
every cell is rendered by the renderer, and the editor only pops up when a
cell is being edited, and only for that duration.  If I understand
correctly, in your case you get the combobox editor when you click the
cell.  Then, when you select a value from the combobox, that value is set
in the table's model, and the (default?) renderer renders it.  Since the
renderer is not a combobox, the combobox disappears from the screen,
because editing has finished (stopped).  The same thing happens when
editing is cancelled (typically if the combobox loses focus or you cancel
with escape), only then the original value remains.

Does this answer your question?
Denis - 24 Feb 2006 08:32 GMT
Thanks!
My error was on the model.
I didn't implement method setValueAt(Object value, Object node, int
column) and so the model didn't change!

Ok. Now: I need to implement formula into the table referring to other
cells, and the table change dinamically.

I thought to add a custom-made listener to cells containing formula and
when a cell change I send to the listener an event like "dataChenged".
Is the correct approach?

DM
zero - 25 Feb 2006 22:08 GMT
"Denis" <denis.mazzucato@libero.it> wrote in news:1140769944.254545.278210
@u72g2000cwu.googlegroups.com:

> Thanks!
> My error was on the model.
[quoted text clipped - 9 lines]
>
> DM

This is a possibility, however I think you can get the same effect a lot
easier by using a TableModelListener, or a subclass of it.  You don't need
to define your own event & listener, and you don't need to add a listener
to each cell - if a lot of cells contain formulas, or if the user can add a
formula to any and all cells, this will be a lot more efficient.

Register a TableModelListener on the TableModel, and if a tableChanged
event is raised, check if any formulas depend on the changed cell(s), and
update as needed.  Checking which, if any, formulas depend on the changed
cell(s) can probably be optimised by subclassing TableModelListener, or
maybe a separate class can keep track of this info, depending on what best
fits your design.

Zero
Denis - 27 Feb 2006 08:01 GMT
>Register a TableModelListener on the TableModel, and if a tableChanged
>event is raised, check if any formulas depend on the changed cell(s), and
>update as needed.  Checking which, if any, formulas depend on the changed
>cell(s) can probably be optimised by subclassing TableModelListener, or
>maybe a separate class can keep track of this info, depending on what best
>fits your design.

But in this case I have to save all the information about any formula
on the model, right?
When an event tell me a cell is changed how can I find wich formula
need to be updated?
In my solution every cell involved in a formula have a Vector of
listeners (cells containing formula that require the current cell) to
inform. When a cell is updated, a message is send to all formulas to be
updated.

Is there an open source java grid to study?

Thanks.
DM


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.