This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 97183 - TableSelectPhaseListener - badly named, doesn't expose underlying Map & single purpose when it could easily be general purpose.
Summary: TableSelectPhaseListener - badly named, doesn't expose underlying Map & singl...
Status: NEW
Alias: None
Product: obsolete
Classification: Unclassified
Component: visualweb (show other bugs)
Version: 5.x
Hardware: PC All
: P3 blocker (vote)
Assignee: Mark Dey
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-03-05 09:05 UTC by yossarian
Modified: 2007-03-08 20:32 UTC (History)
0 users

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments
Sample TableValueHolder.java derived from TablePhaseListener (5.47 KB, text/plain)
2007-03-05 09:07 UTC, yossarian
Details

Note You need to log in before you can comment on or make changes to this bug.
Description yossarian 2007-03-05 09:05:27 UTC
TableSelectPhaseListener - badly named, doesn't expose underlying Map & single 
purpose when it could easily be general purpose.

The TableSelectPhaseListener is not, from a user's point of view, a phase 
listener.  While it participates in phase events internally this is not really 
of interest to the end user.  The Class is more accurately described as a 
ValueHolder.

The underlying HashMap is not visible to the end user which means that the 
component must be wired to a table using complicated setters and getters.  
Exposing the underlying Map would allow wiring the component directly to a 
table using EL and zero intervening Java code.

The selectedValue property is of dubious utility.  It forces the Class to store 
boolean type data when in fact the class could be useful to store any type of 
data.

I am unable to bind to the class's selected property presumably because it has 
both methods boolean isSelected(RowKey) and Object getSelected(RowKey)

RFE:  Change name of the class to TableColumnValueHolder.
RFE:  Add methods: Map getValues() and setValues(Map)
RFE:  review the SelectedValue logic and decide if it is sufficiently useful.
RFE:  Change boolean isSelected() and setSelelected (boolean) to Object 
getSelected() and setSelected(Object)

To see the class in use it's current form see Winston's Blog entry or the 
Calorie counter app produced by the Tutorial Divas.  Note: I can't follow the 
SelectedValue logic in either use case.  

Note: this constructor: TableSelectPhaseListener(true) is directly replaceable 
by a java.util.HashMap (I've tested this). Binding a checkBox or radiogroup's 
selected property to  #{xxxx.myHashMap[currentRow.tableRow]} achieves the same 
thing.

Attached is a file showing how I think it ought to look
Comment 1 yossarian 2007-03-05 09:07:55 UTC
Created attachment 39158 [details]
Sample TableValueHolder.java derived from TablePhaseListener
Comment 2 yossarian 2007-03-05 09:27:51 UTC
Ooops - should have been a RFE
Comment 3 yossarian 2007-03-08 20:32:20 UTC
>Binding a checkBox or radiogroup's 
>selected property to  #{xxxx.myHashMap[currentRow.tableRow]}

Should read:

#{xxxx.myHashMap[currentRow.tableRow.rowId]}

since RowKeys that refer to the same row are not always equal.