IlvAbstractSelectionManager

IlvObject
  |
  +--IlvAbstractSelectionManager
Category:
Common component
JavaScript File:
IlvAbstractSelectionManager.js
Description:
The IlvAbstractSelectionManager class manages the selection of objects with or without querying an image update.

The selection is rendered as an updated image or by a rectangle that encloses the selected object on top of the view.

Additional information on selection is available in the properties property of each selection rectangle.


Constructor Summary
IlvAbstractSelectionManager(init, moveActionName, selectionActionName, deleteActionName)

Method Summary
abortDragging(e)
Abort dragging of the selection.
addSelectionChangedListener(listener)
Add a listener called when the selection has changed.
applyToAll(f)
Applies a function to all rectangles.
clipAll()
Reset the clip rectangle of all selection rectangles to match the new size of the view.
commitSelectionProperties(updateImage, oncompleted, onfailed)
Commits potential modifications of the selection objects properties to the server.
deleteSelection()
Fires an action that is in charge of deleting the selected objects.
deselectAll()
Queries a deselection of all the selected objects.
doSelect(e)
Performs a selection at the specified mouse click.
findById(id)
Returns the selection rectangle that corresponds to the selected object with the given id, null if none is found.
getLineColor()
Returns the current color of the selection rectangles.
getLineWidth()
Returns the line width of the selection rectangles.
getMultipleSelectionKey()
Returns the modifier key used to perform multiple selections.
getScrollPosition()
Returns the scroll position of this IlvRectangle.
getSelection()
Returns the current selection.
getViewPosition()
Returns the position of the attached view.
hideAll()
Hides all the selection rectangles.
hideNotMovable()
Hides the selection for objects that cannot be moved.
isFillOn()
Returns whether the selection rectangles are filled or hollow.
isHiddenWhenDragging(r)
Returns whether a selection rectangle should be hidden while the current selection is dragged.
isImageMode()
Returns true when the selection manager is in image mode, false otherwise.
isMovable(r)
Returns true if the rectangle is movable, false otherwise.
isMoveAllowed()
Returns true when the elements in the view can be moved.
isMultipleSelection(e)
Returns true if the event is a multiple selection event, false otherwise.
isSelectionMovable()
Returns true if the current selection contains at least one movable object, false otherwise.
onSelectionLoaded(context)
Callback to process the response of the server after an update of the selection.
performUpdateImage()
Query a new image.
performUpdateImageMode()
Updates the server with the new image mode value.
recycle(id)
Recycles the rectangle identified by the ID passed as parameter.
recycleAll()
Recycles all the selection rectangles.
removeSelectionChangedListener(listener)
Removes a listener installed with addSelectionChangedListener.
selectAll()
Queries a selection of all the objects.
selectById(id, extend)
Queries an update of the selection for a simple selection.
selectMulti(x, y)
Queries an update of the selection for an extension of the selection.
selectOne(x, y, mouseUp)
Queries an update of the selection for a simple selection.
sendRequest(request)
Sends a selection request to the server.
setFillOn(fillOn)
Defines whether the selection rectangles are filled or hollow.
setForceUpdateProperties(force)
Sets whether the selection manager should query the server for the current selection and the properties of the selected objects.
setImageMode(imageMode)
Activates or deactivates the image selection mode.
setLineColor(color)
Sets the color of the rectangles representing the current selection.
setLineWidth(lineWidth)
Sets the line width of the selection rectangles.
setMoveAllowed(moveAllowed)
Allows or forbids to move elements in the view.
setMultipleSelectionKey(key)
Sets the modifier key used to perform multiple selections.
setScrollPosition(x, y)
Sets the scroll position of the selection rectangles.
showAll()
Shows all the selection rectangles.
showMovable()
Shows the selection rectangles for objects that are moveable, and hides the others.
startDragging(e)
Initializes the dragging of the selection.
stopDragging(e)
Complete dragging of the selection and performs a server action if needed.
updateAll()
Queries a full selection update.
updateCapabilities(context, view)
Updates capabilities that have changed.
updateSelectionProperties()
Queries the server for the selected objects and their properties.
whileDragging(e)
Performs the dragging of the selection.

Constructor Detail

IlvAbstractSelectionManager

IlvAbstractSelectionManager(init, moveActionName, selectionActionName, deleteActionName)
Creates an instance of IlvAbstractSelectionManager.

Method Detail

abortDragging

abortDragging(e)
Abort dragging of the selection.
Parameters:
e - The event.

addSelectionChangedListener

addSelectionChangedListener(listener)
Add a listener called when the selection has changed.
Parameters:
listener - The listener function, which must have the following parameter:
  • rectangleList: The list of rectangles representing the current selection.

applyToAll

applyToAll(f)
Applies a function to all rectangles.
Parameters:
f - The function, which must have the following parameters:
  • selectionManager: The selection manager.
  • rectangle: The current rectangle.

clipAll

clipAll()
Reset the clip rectangle of all selection rectangles to match the new size of the view.

commitSelectionProperties

commitSelectionProperties(updateImage, oncompleted, onfailed)
Commits potential modifications of the selection objects properties to the server. The commit is done using an asynchronous request. These changes are taken into account when the server IlvSelectionSupport handles such requests.
Parameters:
updateImage - When true update the view image once the properties have been updated.
oncompleted - An optional handler that will be executed when the the commit response has been sent back by the server. The handler can take as parameter an array of IlvSelectionPropertiesError objects. The this value is the IlvAbstractSelectionManager. No error is send if the model is not editable.
onfailed - An optional handler that will be executed when the commit did not occur because of network problems, in which case you might consider re-submitting the commit. The this value is the IlvAbstractSelectionManager.

Since:
JViews 8.0


deleteSelection

deleteSelection()
Fires an action that is in charge of deleting the selected objects.

Since:
JViews 8.0


deselectAll

deselectAll()
Queries a deselection of all the selected objects.

To use this method, the server side selection support must support this selection type.

Since:
JViews 8.1


doSelect

doSelect(e)
Performs a selection at the specified mouse click.

This methods handles multiple selections (using multiple selection key).

Parameters:
e - The MouseEvent that triggers the selection.

See also:
#setMultipleSelectionKey


findById

findById(id)
Returns the selection rectangle that corresponds to the selected object with the given id, null if none is found.

getLineColor

getLineColor()
Returns the current color of the selection rectangles.
Returns:
The selection rectangle color.

getLineWidth

getLineWidth()
Returns the line width of the selection rectangles.

getMultipleSelectionKey

getMultipleSelectionKey()
Returns the modifier key used to perform multiple selections.

getScrollPosition

getScrollPosition()
Returns the scroll position of this IlvRectangle. Note: You are not allowed to modify the object returned by this method. To modify the scroll position of a panel, use the setScrollPosition method.
Returns:
An object with two properties: x and y.

getSelection

getSelection()
Returns the current selection.
Returns:
The current selection as an array of IlvSelectionRectangle instances. When additional properties are defined they can be retrieved using the getProperties() method. The selection could be null.

See also:
IlvSelectionRectangle#getProperties()


getViewPosition

getViewPosition()
Returns the position of the attached view.

hideAll

hideAll()
Hides all the selection rectangles.

hideNotMovable

hideNotMovable()
Hides the selection for objects that cannot be moved.

isFillOn

isFillOn()
Returns whether the selection rectangles are filled or hollow.
Returns:
true when the selection rectangles are filled.

isHiddenWhenDragging

isHiddenWhenDragging(r)
Returns whether a selection rectangle should be hidden while the current selection is dragged. This implementation returns false, redefine this method when necessary.

Since:
JViews 8.0


isImageMode

isImageMode()
Returns true when the selection manager is in image mode, false otherwise.

See setImageMode for more details on image mode.


isMovable

isMovable(r)
Returns true if the rectangle is movable, false otherwise.
Parameters:
r - The selection rectangle.

isMoveAllowed

isMoveAllowed()
Returns true when the elements in the view can be moved.

isMultipleSelection

isMultipleSelection(e)
Returns true if the event is a multiple selection event, false otherwise.

isSelectionMovable

isSelectionMovable()
Returns true if the current selection contains at least one movable object, false otherwise.

onSelectionLoaded

onSelectionLoaded(context)
Callback to process the response of the server after an update of the selection.
Parameters:
context - the context containing JavaScript variables send by the server.

performUpdateImage

performUpdateImage()
Query a new image.

performUpdateImageMode

performUpdateImageMode()
Updates the server with the new image mode value.

recycle

recycle(id)
Recycles the rectangle identified by the ID passed as parameter.

recycleAll

recycleAll()
Recycles all the selection rectangles.

removeSelectionChangedListener

removeSelectionChangedListener(listener)
Removes a listener installed with addSelectionChangedListener.
Parameters:
listener - The listener to remove.

selectAll

selectAll()
Queries a selection of all the objects.

To use this method, the server side selection support must support this selection type.

Since:
JViews 8.1


selectById

selectById(id, extend)
Queries an update of the selection for a simple selection. The selection behavior is determined by the extend parameter value:
  • false (default value): the current selection is cleared and the object specified by the id identifier is selected, if found.
  • true: the current selection is kept and
    • if the object specified by the id identifier is already selected, it is removed from the current selection.
    • Otherwise, it's added to the current selection.

To use this method, the server side selection support must support this selection type.

Parameters:
id - The identifier of the object to select or deselect.
extend - Whether extend/reduce the selection with the object specified by the identifier.

The default value is false if this parameter is omitted.

Since:
JViews 8.1


selectMulti

selectMulti(x, y)
Queries an update of the selection for an extension of the selection. This method is invoked when the user has clicked with the multiple selection modifier active.
Parameters:
x - The x coordinate of the clicked point in image coordinates.
y - The x coordinate of the clicked point in image coordinates.

selectOne

selectOne(x, y, mouseUp)
Queries an update of the selection for a simple selection.
Parameters:
x - The x coordinate of the clicked point in image coordinates.
y - The x coordinate of the clicked point in image coordinates.

sendRequest

sendRequest(request)
Sends a selection request to the server.

setFillOn

setFillOn(fillOn)
Defines whether the selection rectangles are filled or hollow. The default value is true -- the selection rectangles are filled. The fill color is the line color with an transparency of 50%.
Parameters:
fillOn - true when the selection rectangles are filled.

setForceUpdateProperties

setForceUpdateProperties(force)
Sets whether the selection manager should query the server for the current selection and the properties of the selected objects. This property is meaningfull only in image mode; when not in image mode the selection and the selected object properties are always uploaded from the server.
Parameters:
force - true to have the selection objects and their properties uploaded from the server in image mode.

false, the default, to reduce the number of requests to the server when you don't need to manipulate the selection or the properties of the selected objects on the client.


setImageMode

setImageMode(imageMode)
Activates or deactivates the image selection mode.

When the image selection mode is active, the selection is rendered by the server as an updated image. Each change in the selection results in a query for an updated image. Additional information and selection listener are disabled until updateAll() is invoked.

When the image selection mode is inactive, the selection is rendered as rectangles around the selected objects. Changes in the selection result in queries for the bouding box of objects and additional informations.

The image selection mode is active by default.

Parameters:
imageMode - true to activate the image selection mode; false to deactivate it.

setLineColor

setLineColor(color)
Sets the color of the rectangles representing the current selection. The default value is black.
Parameters:
color - The color to set.

setLineWidth

setLineWidth(lineWidth)
Sets the line width of the selection rectangles. The default value is 1.

setMoveAllowed

setMoveAllowed(moveAllowed)
Allows or forbids to move elements in the view. A server action must be registered with the action name specified in the property moveNodeAction to handle moving elements.

setMultipleSelectionKey

setMultipleSelectionKey(key)
Sets the modifier key used to perform multiple selections. Possible values are 'ctrl' and 'shift'.
Parameters:
key - The modifier key to activate the multiple selection.

setScrollPosition

setScrollPosition(x, y)
Sets the scroll position of the selection rectangles.
Parameters:
x - The scroll position along the x-axis, relative to the top of the panel.
y - The scroll position along the y-axis, relative to the left side of the panel.

Since:
JViews 7.5


showAll

showAll()
Shows all the selection rectangles.

showMovable

showMovable()
Shows the selection rectangles for objects that are moveable, and hides the others.

startDragging

startDragging(e)
Initializes the dragging of the selection.
Parameters:
e - The event.

stopDragging

stopDragging(e)
Complete dragging of the selection and performs a server action if needed.
Parameters:
e - The event.

updateAll

updateAll()
Queries a full selection update.

updateCapabilities

updateCapabilities(context, view)
Updates capabilities that have changed.

updateSelectionProperties

updateSelectionProperties()
Queries the server for the selected objects and their properties.

The selection listener will be triggered when the information is available.

This method should be used in image mode.


whileDragging

whileDragging(e)
Performs the dragging of the selection.
Parameters:
e - The event.

Inherited Methods from IlvObject
callDispose, dispose, getClassName, hashCode, inherits, instanceOf, invoke, registerDispose, removeHTML, setClassName, superConstructor, superInvoke, toString, updateVisibility