public class ObjectScene extends Scene
It also manages object-oriented states and creates a object-specific action that could be assigned to widgets to provide functionality like object-based selection, object-based hovering, ...
Scene.SceneListener
Widget.Dependency
Constructor and Description |
---|
ObjectScene() |
Modifier and Type | Method and Description |
---|---|
void |
addObject(Object object,
Widget... widgets)
Adds a mapping between an object and a widget.
|
void |
addObjectSceneListener(ObjectSceneListener listener,
ObjectSceneEventType... types)
Adds object scene listener for specified object scene event types.
|
void |
clearObjectState(Object object)
Removes the object's state, removes the object from selection, hover etc.
|
WidgetAction |
createObjectHoverAction()
Returns a object-oriented hover action.
|
WidgetAction |
createSelectAction()
Creates a object-oriented select action.
|
Object |
findObject(Widget widget)
Returns an object which is assigned to a widget.
|
protected ObjectState |
findObjectState(Object o)
Finds the state for the given object.
|
Object |
findStoredObject(Object object)
Returns an instance of stored object.
|
Widget |
findWidget(Object object)
Returns the widget that is mapped to a specified object.
|
List<Widget> |
findWidgets(Object object)
Returns a list of all widgets that are mapped to a specified object.
|
Object |
getFocusedObject()
Returns a focused object.
|
Set<?> |
getHighlightedObjects()
Returns a set of highlighted objects.
|
Object |
getHoveredObject()
Returns a hovered object.
|
Comparable |
getIdentityCode(Object object)
This method returns an identity code.
|
Set<?> |
getObjects()
Returns a set of objects with registered mapping.
|
ObjectState |
getObjectState(Object object)
Returns an object-state of a specified object.
|
Set<?> |
getSelectedObjects()
Returns a set of selected objects.
|
boolean |
isObject(Object object)
Returns whether a specified object is registered.
|
void |
removeObject(Object object)
Removes a mapping for an object.
|
void |
removeObjectMapping(Object object)
Removes mapping for an object.
|
void |
removeObjectSceneListener(ObjectSceneListener listener,
ObjectSceneEventType... types)
Removes object scene listener for specified object scene event types.
|
void |
setFocusedObject(Object focusedObject)
Sets a focused object.
|
void |
setHighlightedObjects(Set<?> highlightedObjects)
Sets a set of highlighted objects.
|
void |
setHoveredObject(Object hoveredObject)
Sets a hovered object.
|
void |
setSelectedObjects(Set<?> selectedObjects)
Sets a set of selected objects.
|
void |
userSelectionSuggested(Set<?> suggestedSelectedObjects,
boolean invertSelection)
Set by actions for setting selected objects invoked by an user.
|
addSceneListener, convertSceneToView, convertSceneToView, convertViewToScene, convertViewToScene, createBirdView, createSatelliteView, createView, createWidgetHoverAction, getActiveTool, getDefaultFont, getFocusedWidget, getGraphics, getInputBindings, getKeyEventProcessingType, getLookFeel, getMaximumBounds, getPriorActions, getResourceTable, getSceneAnimator, getView, getZoomFactor, isRepaintRequiredForRevalidating, isValidated, paint, removeSceneListener, setActiveTool, setFocusedWidget, setKeyEventProcessingType, setLookFeel, setMaximumBounds, setResourceTable, setZoomFactor, validate, validate
addChild, addChild, addChild, addChild, addChildren, addDependency, bringToBack, bringToFront, calculateClientArea, convertLocalToScene, convertLocalToScene, convertSceneToLocal, convertSceneToLocal, createActions, equals, getAccessibleContext, getActions, getActions, getBackground, getBorder, getBounds, getChildConstraint, getChildren, getClientArea, getCursor, getCursorAt, getDependencies, getFont, getForeground, getLayout, getLocation, getLookup, getMaximumSize, getMinimumSize, getParentWidget, getPreferredBounds, getPreferredLocation, getPreferredSize, getScene, getState, getToolTipText, hashCode, isCheckClipping, isEnabled, isHitAt, isOpaque, isPreferredBoundsSet, isVisible, notifyAdded, notifyBackgroundChanged, notifyFontChanged, notifyForegroundChanged, notifyRemoved, notifyStateChanged, paint, paintBackground, paintBorder, paintChildren, paintWidget, removeChild, removeChildren, removeChildren, removeDependency, removeFromParent, repaint, resolveBounds, revalidate, revalidate, setAccessibleContext, setBackground, setBackgroundFromResource, setBorder, setBorder, setCheckClipping, setChildConstraint, setCursor, setEnabled, setFont, setFontFromResource, setForeground, setForegroundFromResource, setLayout, setMaximumSize, setMinimumSize, setOpaque, setPreferredBounds, setPreferredLocation, setPreferredSize, setState, setToolTipText, setVisible, updateResources
public final void addObject(Object object, Widget... widgets)
object
- the model object; the object must not be a Widgetwidgets
- the scene widgets; if it is empty or it is a single null value then the object is non-visual and does not have any widget assigned;
otherwise the widgets cannot contain null valuespublic final void removeObjectMapping(Object object)
As ObjectScene.addObject(java.lang.Object, org.netbeans.api.visual.widget.Widget...)
allows to add object-widget mapping as the user works with the scene,
this method allows to remove such mapping. Selection, highlight and other flags remain unchanged.
object
- object, whose mapping should be removedpublic void clearObjectState(Object object)
object
- to clearpublic final void removeObject(Object object)
object
- the object for which the mapping is removedpublic final Set<?> getObjects()
public final boolean isObject(Object object)
object
- the object to be checkedpublic final Set<?> getSelectedObjects()
public final void setSelectedObjects(Set<?> selectedObjects)
selectedObjects
- the set of selected objectspublic final Set<?> getHighlightedObjects()
public final void setHighlightedObjects(Set<?> highlightedObjects)
highlightedObjects
- the set of highlighted objectspublic final Object getHoveredObject()
public final void setHoveredObject(Object hoveredObject)
hoveredObject
- the hovered object; if null, then the scene does not have hovered objectpublic final Object getFocusedObject()
public final void setFocusedObject(Object focusedObject)
focusedObject
- the focused object; if null, then the scene does not have focused objectpublic final WidgetAction createSelectAction()
public final WidgetAction createObjectHoverAction()
public final Widget findWidget(Object object)
object
- the object; must not be a Widgetpublic final List<Widget> findWidgets(Object object)
object
- the object; must not be a Widgetpublic final Object findObject(Widget widget)
widget
- the widgetpublic final Object findStoredObject(Object object)
object
- the object that is equals (observed by calling the "equals" method on the instances stored in the class);
the object must not be a Widgetpublic final ObjectState getObjectState(Object object)
object
- the objectpublic void userSelectionSuggested(Set<?> suggestedSelectedObjects, boolean invertSelection)
suggestedSelectedObjects
- the selected objects suggested by an userinvertSelection
- the invert selection is specified by an userpublic Comparable getIdentityCode(Object object)
object
- the objectpublic final void addObjectSceneListener(ObjectSceneListener listener, ObjectSceneEventType... types)
listener
- the object scene listenertypes
- the object scene event typespublic final void removeObjectSceneListener(ObjectSceneListener listener, ObjectSceneEventType... types)
listener
- the object scene listenertypes
- the object scene event typesprotected ObjectState findObjectState(Object o) throws IllegalArgumentException
null
for instances that are not proper models for the scene. The default method returns ObjectState.createNormal()
for all inputs.
Note that even objects, which have currently no widgets can have ObjectState associated. For example objects, for which the widgets were not created yet, or whose widgets were removed.
o
- the objectnull
for objects that cannot be part of the model.IllegalArgumentException