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:
TLspSelectMode.REPLACE
and TLspSelectMode.ADD
.TLspSelectMode.REMOVE
.TLspSelectMode.INVERT
.
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.
Constructor and Description |
---|
TLspPopupMenuSelectionCandidateHandler() |
Modifier and Type | Method and Description |
---|---|
int |
getPopupDeltaX()
Returns the x value of the popup location offset.
|
int |
getPopupDeltaY()
Returns the y value of the popup location offset.
|
ILcdFormatter |
getSelectionCandidateFormatter()
Returns the current object formatter used to format selection candidates.
|
protected void |
handleMenuItemHoverChange(ALspSelectInput aInput,
TLspSelectMode aSelectMode,
TLspDomainObjectContext aContext,
boolean aMenuItemHoverActive)
Handle a hover state change on a menu item.
|
protected void |
handleMenuItemSelected(ALspSelectInput aInput,
TLspSelectMode aSelectMode,
TLspDomainObjectContext aContext)
Handle a menu item selection.
|
void |
handleSelectionCandidates(ALspSelectInput aInput,
TLspSelectMode aMode,
ILspView aView,
List<TLspDomainObjectContext> aSelectionCandidates)
Handles which objects change their selection from a list of selection candidates.
|
boolean |
isGroupByLayer()
Return whether or not selection candidates are displayed in sub-menus by layer.
|
void |
setGroupByLayer(boolean aGroupByLayer)
Sets the group by layer property.
|
void |
setPopupDeltaX(int aPopupDeltaX)
Sets the x value of the popup location offset.
|
void |
setPopupDeltaY(int aPopupDeltaY)
Sets the y value of the popup location offset.
|
void |
setSelectionCandidateFormatter(ILcdFormatter aObjectFormatter)
Sets the object formatter used to transform the selection candidates to a
String . |
public TLspPopupMenuSelectionCandidateHandler()
public int getPopupDeltaX()
public void setPopupDeltaX(int aPopupDeltaX)
handleSelectionCandidates
. The default value is 0.aPopupDeltaX
- the new x value of the popup location offsetpublic int getPopupDeltaY()
public void setPopupDeltaY(int aPopupDeltaY)
handleSelectionCandidates
. The default value is 0.aPopupDeltaY
- the new x value of the popup location offsetpublic ILcdFormatter getSelectionCandidateFormatter()
public void setSelectionCandidateFormatter(ILcdFormatter aObjectFormatter)
String
.
The objects offered for formatting will be instances of TLspDomainObjectContext
.
The default formatter use toString()
on the domain object contained in the
TLspSelectionCandidate and take the first 50 characters of the resulting String
.aObjectFormatter
- the new object formatter for selection candidates.public boolean isGroupByLayer()
public void setGroupByLayer(boolean aGroupByLayer)
aGroupByLayer
- the group by layer property.public void handleSelectionCandidates(ALspSelectInput aInput, TLspSelectMode aMode, ILspView aView, List<TLspDomainObjectContext> aSelectionCandidates)
ILspSelectionCandidateHandler
ILcdLayer.fireCollectedSelectionChanges()
method on the layers of which the selection was updated.handleSelectionCandidates
in interface ILspSelectionCandidateHandler
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.protected void handleMenuItemHoverChange(ALspSelectInput aInput, TLspSelectMode aSelectMode, TLspDomainObjectContext aContext, boolean aMenuItemHoverActive)
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).protected void handleMenuItemSelected(ALspSelectInput aInput, TLspSelectMode aSelectMode, TLspDomainObjectContext aContext)
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.