Skip to main content
PREV CLASS NEXT CLASS FRAMES NO FRAMES

 

Class 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
Constructor Attributes Constructor Name and Description
 
IlvAbstractSelectionManager(init, moveActionName, selectionActionName, deleteActionName)
Method Summary
Method Attributes Method Name and Description
 
Abort dragging of the selection.
 
Add a listener which is called when the selection has changed.
 
Applies a function to all rectangles.
 
Applies a function to all selection link.
 
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.
 
Activates an action that manages deleting the selected objects.
 
Queries a deselection of all the selected objects.
 
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.
 
Returns the current color of the selection rectangles.
 
Returns the line width of the selection rectangles.
 
Returns the modifier key used to perform multiple selections.
 
Returns the scroll position of this IlvRectangle.
 
Returns the current selection.
 
Returns the position of the attached view.
 
Hides all the selection rectangles.
 
Hides the selection for objects that cannot be moved.
 
Returns whether the selection rectangles are filled or hollow.
 
Returns whether a selection rectangle should be hidden while the current selection is dragged.
 
Returns true when the selection manager is in image mode, false otherwise.
 
Returns true if the rectangle is movable, false otherwise.
 
Returns true when the elements in the view can be moved.
 
Returns true if the event is a multiple selection event, false otherwise.
 
Returns true if the current selection contains at least one movable object, false otherwise.
 
Callback to process the response of the server after an update of the selection.
 
Query a new image.
 
Updates the server with the new image mode value.
 
recycle(id)
Recycles the rectangle identified by the ID passed as parameter.
 
Recycles all the selection rectangles.
 
Removes a listener that was installed with addSelectionChangedListener.
 
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.
 
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 movement of elements in the view.
 
Sets the modifier key used to perform multiple selections.
 
Sets the scroll position of the selection rectangles.
 
Shows all the selection rectangles.
 
Shows the selection rectangles for objects that are moveable, and hides the others.
 
Initializes the dragging of the selection.
 
Complete dragging of the selection and performs a server action if needed.
 
Queries a full selection update.
 
updateCapabilities(context, view)
Updates capabilities that have changed.
 
Queries the server for the selected objects and their properties.
 
Drags the selection.
Methods inherited from class IlvObject
dispose, getClassName, hashCode, instanceOf, invoke, registerDispose, registerDisposeByClientId, removeHTML, setClassName, superConstructor, superInvoke, toString, updateVisibility
Constructor Detail
IlvAbstractSelectionManager
IlvAbstractSelectionManager(init, moveActionName, selectionActionName, deleteActionName)
Parameters:
init - Whether to initialize the component or not. Subclasses must call the superConstructor method with true.
moveActionName - The server action name that will be triggered on translation of the current selection (if move is allowed). If the parameter is not set the action name is the default value: moveNode.
selectionActionName - The server action name that will be triggered on a new selection. If the parameter is not set the action name is the default value: selectNode.
deleteActionName - The server action name that will be triggered when the #deleteSelection() method is called. If the parameter is not set the action name is deleteObject.
Method Detail
abortDragging
abortDragging(e)
Abort dragging of the selection.
Parameters:
e - The event.

addSelectionChangedListener
addSelectionChangedListener(listener)
Add a listener which is 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.

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

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()
Activates an action that manages 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.
Parameters:
id

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.
Parameters:
r
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.
Parameters:
e

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 sent 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.
Parameters:
id

recycleAll
recycleAll()
Recycles all the selection rectangles.

removeSelectionChangedListener
removeSelectionChangedListener(listener)
Removes a listener that was 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.
mouseUp

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

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 meaningful 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 bounding 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.
Parameters:
lineWidth

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

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.
Parameters:
context
view

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)
Drags the selection.
Parameters:
e - The event.

©Copyright Rogue Wave Software Inc. 1997, 2018. All Rights Reserved.