Class TLspPopupMenuSelectionCandidateHandler
java.lang.Object
com.luciad.view.lightspeed.controller.selection.TLspPopupMenuSelectionCandidateHandler
- All Implemented Interfaces:
ILspSelectionCandidateHandler
public class TLspPopupMenuSelectionCandidateHandler
extends Object
implements ILspSelectionCandidateHandler
ILspSelectionCandidateHandler that shows a pop-up menu from which a user can chose a single selection candidate.
It is used by the TLspSelectControllerModel to update the selection for TLspSelectChoice.CHOOSE.
The single selection candidate chosen by the user will:
- get selected for
TLspSelectMode.REPLACEandTLspSelectMode.ADD. - get deselected for
TLspSelectMode.REMOVE. - get selected if it was previously unselected or deselected when it was previously selected for
TLspSelectMode.INVERT.
Customizing the string representation of the domain objects
The domain objects in the pop-up menu are by default represented by their toString implementation.
This can be changed by configuring a custom ILcdFormatter on this handler.
- Since:
- 2012.0
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintReturns the x value of the popup location offset.intReturns the y value of the popup location offset.Returns the current object formatter used to format selection candidates.protected voidhandleMenuItemHoverChange(ALspSelectInput aInput, TLspSelectMode aSelectMode, TLspDomainObjectContext aContext, boolean aMenuItemHoverActive) Handle a hover state change on a menu item.protected voidhandleMenuItemSelected(ALspSelectInput aInput, TLspSelectMode aSelectMode, TLspDomainObjectContext aContext) Handle a menu item selection.voidhandleSelectionCandidates(ALspSelectInput aInput, TLspSelectMode aMode, ILspView aView, List<TLspDomainObjectContext> aSelectionCandidates) Handles which objects change their selection from a list of selection candidates.booleanReturn whether or not selection candidates are displayed in sub-menus by layer.voidsetGroupByLayer(boolean aGroupByLayer) Sets the group by layer property.voidsetPopupDeltaX(int aPopupDeltaX) Sets the x value of the popup location offset.voidsetPopupDeltaY(int aPopupDeltaY) Sets the y value of the popup location offset.voidsetSelectionCandidateFormatter(ILcdFormatter aObjectFormatter) Sets the object formatter used to transform the selection candidates to aString.
-
Constructor Details
-
TLspPopupMenuSelectionCandidateHandler
public TLspPopupMenuSelectionCandidateHandler()
-
-
Method Details
-
getPopupDeltaX
public int getPopupDeltaX()Returns the x value of the popup location offset.- Returns:
- the x value of the popup location offset.
-
setPopupDeltaX
public void setPopupDeltaX(int aPopupDeltaX) Sets the x value of the popup location offset. The upper left corner of the popup will be located at the position in the view corresponding to this offset added to the view point passed inhandleSelectionCandidates. The default value is 0.- Parameters:
aPopupDeltaX- the new x value of the popup location offset
-
getPopupDeltaY
public int getPopupDeltaY()Returns the y value of the popup location offset.- Returns:
- the y value of the popup location offset.
-
setPopupDeltaY
public void setPopupDeltaY(int aPopupDeltaY) Sets the y value of the popup location offset. The upper left corner of the popup will be located at the position in the view corresponding to this offset added to the view point passed inhandleSelectionCandidates. The default value is 0.- Parameters:
aPopupDeltaY- the new x value of the popup location offset
-
getSelectionCandidateFormatter
Returns the current object formatter used to format selection candidates.- Returns:
- the current selection candidate formatter.
-
setSelectionCandidateFormatter
Sets the object formatter used to transform the selection candidates to aString. The objects offered for formatting will be instances ofTLspDomainObjectContext. The default formatter usetoString()on the domain object contained in the TLspSelectionCandidate and take the first 50 characters of the resultingString.- Parameters:
aObjectFormatter- the new object formatter for selection candidates.
-
isGroupByLayer
public boolean isGroupByLayer()Return whether or not selection candidates are displayed in sub-menus by layer.- Returns:
- true of selection candidates are grouped by layer, false otherwise.
-
setGroupByLayer
public void setGroupByLayer(boolean aGroupByLayer) Sets the group by layer property. If true, selection candidates from the same layer will be displayed in a submenu. The default is true.- Parameters:
aGroupByLayer- the group by layer property.
-
handleSelectionCandidates
public void handleSelectionCandidates(ALspSelectInput aInput, TLspSelectMode aMode, ILspView aView, List<TLspDomainObjectContext> aSelectionCandidates) Description copied from interface:ILspSelectionCandidateHandlerHandles which objects change their selection from a list of selection candidates. It is the responsibility of this method to:- Update the selection on the layer(s) of the view.
- Trigger the
ILcdLayer.fireCollectedSelectionChanges()method on the layers of which the selection was updated.
- Specified by:
handleSelectionCandidatesin interfaceILspSelectionCandidateHandler- Parameters:
aInput- the selection input.aMode- the mode, this controls how the selection is adapted for the remaining selection candidates.aView- the view for which this selection candidate handler was invoked. The view can be used to retrieve the layers and the currently selected objects.aSelectionCandidates- the list of potential selection candidates whose selection will be handled.
-
handleMenuItemHoverChange
protected void handleMenuItemHoverChange(ALspSelectInput aInput, TLspSelectMode aSelectMode, TLspDomainObjectContext aContext, boolean aMenuItemHoverActive) Handle a hover state change on a menu item. The default implementation will add/remove/replace the object that is being hovered on to the selection (depending on aSelectMode).- Parameters:
aInput- The input that triggered the opening of the pop-up menu.aSelectMode- The current selection mode.aContext- The context for which to handle the menu item hover change.aMenuItemHoverActive- Indicates if the menu item is being hovered on (true) or the hover has disappeared (false).
-
handleMenuItemSelected
protected void handleMenuItemSelected(ALspSelectInput aInput, TLspSelectMode aSelectMode, TLspDomainObjectContext aContext) Handle a menu item selection. The default implementation will add/remove/replace the object that is being selected in the menu, on to the layer selection (depending on the current selection mode).- Parameters:
aInput- The input that triggered the opening of the pop-up menu.aSelectMode- The current selection mode.aContext- The context for which to handle the menu item selection.
-