From: <no...@so...> - 2002-03-01 15:22:21
|
Patch, fixes and other code item #524038, was opened at 2002-02-28 15:55 You can respond by visiting: http://sourceforge.net/tracker/?func=detail&atid=426285&aid=524038&group_id=4091 Category: None Group: None Status: Open Priority: 5 Submitted By: Philip Crotwell (crotwell) Assigned to: Nobody/Anonymous (nobody) Summary: ability to lock selections in theme Initial Comment: I needed the ability to select items out of one theme, and then select items out of a second theme without effecting the first selections. My solution make a few minor modifications to Theme.java to allow the selections within a Theme to be "locked" so that future selections from the Viewer would not change the selections in the current theme. Unlocking the Theme would allow the selections to again be changed. I have done some simple testing, and it seems to work. I added the following to Theme: private boolean selectionLock = false; /** * * @return value of selectionLock. */ public boolean isSelectionLock() { return selectionLock; } /** * Set the value of selectionLock. If selectionLock is true, then the * current selections within this Theme are not allowed to change in * response to selection events from the View. This * allows items to be selected from one Theme, then locked in their * selection state while items are selected from other Themes. * * @param v Value to assign to selectionLock. */ public void setSelectionLock(boolean v) { this.selectionLock = v; } and then update the two methods that can change the selection to be the following, so that selection events only have an effect if there is not a selection lock. public void selectionRegionChanged(SelectionRegionChangedEvent srce){ if(selectionMgr != null && ! isSelectionLock()){ selectionMgr.setSelection(layer.getIDs(srce.getRegion(),selectionMgr .CONTAINS)); } } and public void selectionPositionChanged(SelectionPositionChangedEvent spce){ //System.out.println("T--->("+name+")Received selection position changed event"); if(selectionMgr != null && ! isSelectionLock()){ selectionMgr.toggleSelection(layer.getID(spce.getLocation())); // int[] id = {layer.getID(spce.getLocation())}; // selectionMgr.setSelection(id); } } I have also attached an example applet (a very bad hack of one of the existing demos, sorry) that illustrates the concept. Hopefully this is useful to others... thanks, Philip ---------------------------------------------------------------------- >Comment By: Philip Crotwell (crotwell) Date: 2002-03-01 10:22 Message: Logged In: YES user_id=118526 I had one additional thought, do you think it would be better to lock the selection manager instead of the theme? ---------------------------------------------------------------------- Comment By: James Macgill (jmacgill) Date: 2002-03-01 08:39 Message: Logged In: YES user_id=9731 Thanks for the code, I was about to pen a responce to you sugesting something along the above lines, but it looks like you got there directly. I'll review the code a little more cloesly, but I suspect it can slot into Theme as is. Many thanks for contributing it so promtly James ---------------------------------------------------------------------- You can respond by visiting: http://sourceforge.net/tracker/?func=detail&atid=426285&aid=524038&group_id=4091 |