|
From: Geoffrey De S. (JIRA) <no...@at...> - 2006-01-17 12:47:48
|
Master/detail hooks on commands: delete, save, update, ...
----------------------------------------------------------
Key: RCP-264
URL: http://opensource.atlassian.com/projects/spring/browse/RCP-264
Project: Spring Framework Rich Client Project
Type: Improvement
Components: Helper Classes
Reporter: Geoffrey De Smet
Assigned to: Oliver Hutchison
Currently it's hard to hook in a myService.deleteMyObject(myObject) on a delete command without disturbing all the logic already in spring rich.
The only way I see is by overriding deleteSelectedItems() with an almost exact implementation.
It would be nice if it was like this in AbstractMasterForm:
/**
* Delete the detail item at the specified index.
* @param index Index of item to delete
*/
protected void deleteSelectedItems() {
ListSelectionModel sm = getSelectionModel();
if( sm.isSelectionEmpty() ) {
return;
}
_detailForm.reset();
int min = sm.getMinSelectionIndex();
int max = sm.getMaxSelectionIndex();
// Loop backwards and delete each selected item in the interval
for( int index = max; index >= min; index-- ) {
if( sm.isSelectedIndex( index ) ) {
deleteItem(getMasterEventList().getElementAt(index));
getMasterEventList().remove( index );
}
}
}
/**
* Template method, hook for service calls.
* @param o the object to delete
*/
protected void deleteItem(Object o) {
}
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/spring/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
|
|
From: Geoffrey De S. (JIRA) <no...@at...> - 2006-01-17 14:17:43
|
[ http://opensource.atlassian.com/projects/spring/browse/RCP-264?page=comments#action_16096 ] Geoffrey De Smet commented on RCP-264: -------------------------------------- This won't work decently in many cases. Just adding deleteItem(getMasterEventList().getElementAt(index)); before getMasterEventList().remove( index ); will not suffice. For example, in my case I wanted to a call to my service layer, but after it I need to refresh my parent object. However refreshing my parent object in the middle of that code is a bad idea. Seems I would require a "postDelete". > Master/detail hooks on commands: delete, save, update, ... > ---------------------------------------------------------- > > Key: RCP-264 > URL: http://opensource.atlassian.com/projects/spring/browse/RCP-264 > Project: Spring Framework Rich Client Project > Type: Improvement > Components: Helper Classes > Reporter: Geoffrey De Smet > Assignee: Oliver Hutchison > > Currently it's hard to hook in a myService.deleteMyObject(myObject) on a delete command without disturbing all the logic already in spring rich. > The only way I see is by overriding deleteSelectedItems() with an almost exact implementation. > It would be nice if it was like this in AbstractMasterForm: > /** > * Delete the detail item at the specified index. > * @param index Index of item to delete > */ > protected void deleteSelectedItems() { > ListSelectionModel sm = getSelectionModel(); > if( sm.isSelectionEmpty() ) { > return; > } > _detailForm.reset(); > int min = sm.getMinSelectionIndex(); > int max = sm.getMaxSelectionIndex(); > // Loop backwards and delete each selected item in the interval > for( int index = max; index >= min; index-- ) { > if( sm.isSelectedIndex( index ) ) { > deleteItem(getMasterEventList().getElementAt(index)); > getMasterEventList().remove( index ); > } > } > } > /** > * Template method, hook for service calls. > * @param o the object to delete > */ > protected void deleteItem(Object o) { > } -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/spring/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |
|
From: Lieven D. (JIRA) <no...@sp...> - 2008-10-09 20:21:20
|
[ http://jira.springframework.org/browse/RCP-264?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Lieven Doclo updated RCP-264:
-----------------------------
Fix Version/s: 1.x
> Master/detail hooks on commands: delete, save, update, ...
> ----------------------------------------------------------
>
> Key: RCP-264
> URL: http://jira.springframework.org/browse/RCP-264
> Project: Spring Framework Rich Client Project
> Issue Type: Improvement
> Components: Helper Classes
> Reporter: Geoffrey De Smet
> Assignee: Oliver Hutchison
> Fix For: 1.x
>
>
> Currently it's hard to hook in a myService.deleteMyObject(myObject) on a delete command without disturbing all the logic already in spring rich.
> The only way I see is by overriding deleteSelectedItems() with an almost exact implementation.
> It would be nice if it was like this in AbstractMasterForm:
> /**
> * Delete the detail item at the specified index.
> * @param index Index of item to delete
> */
> protected void deleteSelectedItems() {
> ListSelectionModel sm = getSelectionModel();
> if( sm.isSelectionEmpty() ) {
> return;
> }
> _detailForm.reset();
> int min = sm.getMinSelectionIndex();
> int max = sm.getMaxSelectionIndex();
> // Loop backwards and delete each selected item in the interval
> for( int index = max; index >= min; index-- ) {
> if( sm.isSelectedIndex( index ) ) {
> deleteItem(getMasterEventList().getElementAt(index));
> getMasterEventList().remove( index );
> }
> }
> }
> /**
> * Template method, hook for service calls.
> * @param o the object to delete
> */
> protected void deleteItem(Object o) {
> }
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.springframework.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
|