public class DraggableBox
extends javafx.scene.layout.StackPane
Consists of background and border Rectangle classes inside a StackPane. For the purposes of laying
out children, it behaves like a StackPane. The size of the draggable box should always be set via its border
rectangle.
| Type | Property and Description |
|---|---|
javafx.beans.property.BooleanProperty |
dragEnabledX
The property for whether dragging of the box is enabled in the x (horizontal) direction.
|
javafx.beans.property.BooleanProperty |
dragEnabledY
The property for whether dragging of the box is enabled in the y (vertical) direction.
|
backgroundProperty, borderProperty, cacheShapeProperty, centerShapeProperty, heightProperty, insetsProperty, maxHeightProperty, maxWidthProperty, minHeightProperty, minWidthProperty, opaqueInsetsProperty, paddingProperty, prefHeightProperty, prefWidthProperty, scaleShapeProperty, shapeProperty, snapToPixelProperty, widthPropertyimpl_traversalEngineProperty, needsLayoutPropertyblendModeProperty, boundsInLocalProperty, boundsInParentProperty, cacheHintProperty, cacheProperty, clipProperty, cursorProperty, depthTestProperty, disabledProperty, disableProperty, effectiveNodeOrientationProperty, effectProperty, eventDispatcherProperty, focusedProperty, focusTraversableProperty, hoverProperty, idProperty, impl_showMnemonicsProperty, impl_treeVisibleProperty, inputMethodRequestsProperty, layoutBoundsProperty, layoutXProperty, layoutYProperty, localToParentTransformProperty, localToSceneTransformProperty, managedProperty, mouseTransparentProperty, nodeOrientationProperty, onContextMenuRequestedProperty, onDragDetectedProperty, onDragDoneProperty, onDragDroppedProperty, onDragEnteredProperty, onDragExitedProperty, onDragOverProperty, onInputMethodTextChangedProperty, onKeyPressedProperty, onKeyReleasedProperty, onKeyTypedProperty, onMouseClickedProperty, onMouseDragEnteredProperty, onMouseDragExitedProperty, onMouseDraggedProperty, onMouseDragOverProperty, onMouseDragReleasedProperty, onMouseEnteredProperty, onMouseExitedProperty, onMouseMovedProperty, onMousePressedProperty, onMouseReleasedProperty, onRotateProperty, onRotationFinishedProperty, onRotationStartedProperty, onScrollFinishedProperty, onScrollProperty, onScrollStartedProperty, onSwipeDownProperty, onSwipeLeftProperty, onSwipeRightProperty, onSwipeUpProperty, onTouchMovedProperty, onTouchPressedProperty, onTouchReleasedProperty, onTouchStationaryProperty, onZoomFinishedProperty, onZoomProperty, onZoomStartedProperty, opacityProperty, parentProperty, pickOnBoundsProperty, pressedProperty, rotateProperty, rotationAxisProperty, scaleXProperty, scaleYProperty, scaleZProperty, sceneProperty, styleProperty, translateXProperty, translateYProperty, translateZProperty, visibleProperty| Modifier and Type | Field and Description |
|---|---|
protected double |
absoluteMaxHeight |
protected double |
absoluteMaxWidth |
protected boolean |
dragActive |
protected GraphEditorProperties |
editorProperties |
protected double |
lastLayoutX |
protected double |
lastLayoutY |
protected double |
lastMouseX |
protected double |
lastMouseY |
protected double |
lastParentHeight |
protected double |
lastParentWidth |
| Constructor and Description |
|---|
DraggableBox()
Creates an empty draggable box.
|
| Modifier and Type | Method and Description |
|---|---|
javafx.beans.property.BooleanProperty |
dragEnabledXProperty()
The property for whether dragging of the box is enabled in the x (horizontal) direction.
|
javafx.beans.property.BooleanProperty |
dragEnabledYProperty()
The property for whether dragging of the box is enabled in the y (vertical) direction.
|
java.util.List<java.lang.Double> |
getAlignmentTargetsX()
Gets the set of x values that the box will align to when dragged close enough.
|
java.util.List<java.lang.Double> |
getAlignmentTargetsY()
Gets the set of y values that the box will align to when dragged close enough.
|
double |
getAlignmentThreshold()
Gets the alignment threshold value.
|
javafx.scene.shape.Rectangle |
getBackgroundRectangle()
Gets the background
Rectangle. |
javafx.scene.shape.Rectangle |
getBorderRectangle()
Gets the border
Rectangle. |
javafx.geometry.Point2D |
getSnapToGridOffset()
Gets the offset that the box will snap to when a drag finishes and snap-to-grid is active.
|
boolean |
isDragEnabledX()
Gets whether dragging of the box is enabled in the x (horizontal) direction.
|
boolean |
isDragEnabledY()
Gets whether dragging of the box is enabled in the y (vertical) direction.
|
protected double |
roundToGridSpacing(double value)
Rounds some value to the nearest multiple of the grid spacing.
|
void |
setAlignmentTargetsX(java.util.List<java.lang.Double> alignmentTargetsX)
Sets the set of x values that the box will align to when dragged close enough.
|
void |
setAlignmentTargetsY(java.util.List<java.lang.Double> alignmentTargetsY)
Sets the set of y values that the box will align to when dragged close enough.
|
void |
setAlignmentThreshold(double alignmentThreshold)
Sets the alignment threshold value.
|
void |
setCacheWhenStationary(boolean cacheWhenStationary)
Sets whether the box will be cached when it is not being dragged.
|
void |
setDragEnabledX(boolean dragEnabledX)
Sets whether dragging of the box is enabled in the x (horizontal) direction.
|
void |
setDragEnabledY(boolean dragEnabledY)
Sets whether dragging of the box is enabled in the y (vertical) direction.
|
void |
setEditorProperties(GraphEditorProperties editorProperties)
Sets the editor properties object that the drag logic should respect.
|
void |
setSnapToGridOffset(javafx.geometry.Point2D snapToGridOffset)
Sets the offset that the box will snap to when a drag finishes and snap-to-grid is active.
|
protected void |
storeClickValuesForDrag(double x,
double y)
Stores relevant layout values at the time of the last mouse click (mouse-pressed event).
|
alignmentProperty, clearConstraints, computeMinHeight, computeMinWidth, computePrefHeight, computePrefWidth, getAlignment, getAlignment, getClassCssMetaData, getContentBias, getCssMetaData, getMargin, layoutChildren, requestLayout, setAlignment, setAlignment, setMarginbackgroundProperty, borderProperty, cacheShapeProperty, centerShapeProperty, computeMaxHeight, computeMaxWidth, getBackground, getBorder, getHeight, getInsets, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getOpaqueInsets, getPadding, getPrefHeight, getPrefWidth, getShape, getWidth, heightProperty, impl_computeContains, impl_computeGeomBounds, impl_computeLayoutBounds, impl_createPeer, impl_notifyLayoutBoundsChanged, impl_pickNodeLocal, impl_updatePeer, insetsProperty, isCacheShape, isCenterShape, isResizable, isScaleShape, isSnapToPixel, layoutInArea, layoutInArea, layoutInArea, layoutInArea, maxHeight, maxHeightProperty, maxWidth, maxWidthProperty, minHeight, minHeightProperty, minWidth, minWidthProperty, opaqueInsetsProperty, paddingProperty, positionInArea, positionInArea, prefHeight, prefHeightProperty, prefWidth, prefWidthProperty, resize, scaleShapeProperty, setBackground, setBorder, setCacheShape, setCenterShape, setHeight, setMaxHeight, setMaxSize, setMaxWidth, setMinHeight, setMinSize, setMinWidth, setOpaqueInsets, setPadding, setPrefHeight, setPrefSize, setPrefWidth, setScaleShape, setShape, setSnapToPixel, setWidth, shapeProperty, snappedBottomInset, snappedLeftInset, snappedRightInset, snappedTopInset, snapPosition, snapSize, snapSpace, snapToPixelProperty, widthPropertygetBaselineOffset, getChildrenUnmodifiable, getImpl_traversalEngine, getManagedChildren, getStylesheets, impl_getAllParentStylesheets, impl_processCSS, impl_processMXNode, impl_traversalEngineProperty, isNeedsLayout, layout, lookup, needsLayoutProperty, requestParentLayout, setImpl_traversalEngine, setNeedsLayout, updateBoundsaddEventFilter, addEventHandler, applyCss, autosize, blendModeProperty, boundsInLocalProperty, boundsInParentProperty, buildEventDispatchChain, cacheHintProperty, cacheProperty, clipProperty, computeAreaInScreen, contains, contains, containsBounds, cursorProperty, depthTestProperty, disabledProperty, disableProperty, effectiveNodeOrientationProperty, effectProperty, eventDispatcherProperty, fireEvent, focusedProperty, focusTraversableProperty, getBlendMode, getBoundsInLocal, getBoundsInParent, getCacheHint, getClip, getCursor, getDepthTest, getEffect, getEffectiveNodeOrientation, getEventDispatcher, getId, getInputMethodRequests, getLayoutBounds, getLayoutX, getLayoutY, getLocalToParentTransform, getLocalToSceneTransform, getNodeOrientation, getOnContextMenuRequested, getOnDragDetected, getOnDragDone, getOnDragDropped, getOnDragEntered, getOnDragExited, getOnDragOver, getOnInputMethodTextChanged, getOnKeyPressed, getOnKeyReleased, getOnKeyTyped, getOnMouseClicked, getOnMouseDragEntered, getOnMouseDragExited, getOnMouseDragged, getOnMouseDragOver, getOnMouseDragReleased, getOnMouseEntered, getOnMouseExited, getOnMouseMoved, getOnMousePressed, getOnMouseReleased, getOnRotate, getOnRotationFinished, getOnRotationStarted, getOnScroll, getOnScrollFinished, getOnScrollStarted, getOnSwipeDown, getOnSwipeLeft, getOnSwipeRight, getOnSwipeUp, getOnTouchMoved, getOnTouchPressed, getOnTouchReleased, getOnTouchStationary, getOnZoom, getOnZoomFinished, getOnZoomStarted, getOpacity, getParent, getProperties, getPseudoClassStates, getRotate, getRotationAxis, getScaleX, getScaleY, getScaleZ, getScene, getStyle, getStyleableParent, getStyleClass, getTransforms, getTranslateX, getTranslateY, getTranslateZ, getTypeSelector, getUserData, hasProperties, hoverProperty, idProperty, impl_clearDirty, impl_computeIntersects, impl_cssGetCursorInitialValue, impl_cssGetFocusTraversableInitialValue, impl_findStyles, impl_geomChanged, impl_getLeafTransform, impl_getMatchingStyles, impl_getPeer, impl_getPivotX, impl_getPivotY, impl_getPivotZ, impl_getStyleMap, impl_hasTransforms, impl_intersects, impl_intersectsBounds, impl_isDirty, impl_isDirtyEmpty, impl_isShowMnemonics, impl_isTreeVisible, impl_layoutBoundsChanged, impl_markDirty, impl_pickNode, impl_processCSS, impl_reapplyCSS, impl_setShowMnemonics, impl_setStyleMap, impl_showMnemonicsProperty, impl_syncPeer, impl_transformsChanged, impl_traverse, impl_treeVisibleProperty, inputMethodRequestsProperty, intersects, intersects, isCache, isDisable, isDisabled, isFocused, isFocusTraversable, isHover, isManaged, isMouseTransparent, isPickOnBounds, isPressed, isVisible, layoutBoundsProperty, layoutXProperty, layoutYProperty, localToParent, localToParent, localToParent, localToParent, localToParent, localToParentTransformProperty, localToScene, localToScene, localToScene, localToScene, localToScene, localToSceneTransformProperty, localToScreen, localToScreen, localToScreen, localToScreen, localToScreen, lookupAll, managedProperty, mouseTransparentProperty, nodeOrientationProperty, onContextMenuRequestedProperty, onDragDetectedProperty, onDragDoneProperty, onDragDroppedProperty, onDragEnteredProperty, onDragExitedProperty, onDragOverProperty, onInputMethodTextChangedProperty, onKeyPressedProperty, onKeyReleasedProperty, onKeyTypedProperty, onMouseClickedProperty, onMouseDragEnteredProperty, onMouseDragExitedProperty, onMouseDraggedProperty, onMouseDragOverProperty, onMouseDragReleasedProperty, onMouseEnteredProperty, onMouseExitedProperty, onMouseMovedProperty, onMousePressedProperty, onMouseReleasedProperty, onRotateProperty, onRotationFinishedProperty, onRotationStartedProperty, onScrollFinishedProperty, onScrollProperty, onScrollStartedProperty, onSwipeDownProperty, onSwipeLeftProperty, onSwipeRightProperty, onSwipeUpProperty, onTouchMovedProperty, onTouchPressedProperty, onTouchReleasedProperty, onTouchStationaryProperty, onZoomFinishedProperty, onZoomProperty, onZoomStartedProperty, opacityProperty, parentProperty, parentToLocal, parentToLocal, parentToLocal, parentToLocal, parentToLocal, pickOnBoundsProperty, pressedProperty, pseudoClassStateChanged, relocate, removeEventFilter, removeEventHandler, requestFocus, resizeRelocate, rotateProperty, rotationAxisProperty, scaleXProperty, scaleYProperty, scaleZProperty, sceneProperty, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, screenToLocal, screenToLocal, screenToLocal, setBlendMode, setCache, setCacheHint, setClip, setCursor, setDepthTest, setDisable, setDisabled, setEffect, setEventDispatcher, setEventHandler, setFocused, setFocusTraversable, setHover, setId, setInputMethodRequests, setLayoutX, setLayoutY, setManaged, setMouseTransparent, setNodeOrientation, setOnContextMenuRequested, setOnDragDetected, setOnDragDone, setOnDragDropped, setOnDragEntered, setOnDragExited, setOnDragOver, setOnInputMethodTextChanged, setOnKeyPressed, setOnKeyReleased, setOnKeyTyped, setOnMouseClicked, setOnMouseDragEntered, setOnMouseDragExited, setOnMouseDragged, setOnMouseDragOver, setOnMouseDragReleased, setOnMouseEntered, setOnMouseExited, setOnMouseMoved, setOnMousePressed, setOnMouseReleased, setOnRotate, setOnRotationFinished, setOnRotationStarted, setOnScroll, setOnScrollFinished, setOnScrollStarted, setOnSwipeDown, setOnSwipeLeft, setOnSwipeRight, setOnSwipeUp, setOnTouchMoved, setOnTouchPressed, setOnTouchReleased, setOnTouchStationary, setOnZoom, setOnZoomFinished, setOnZoomStarted, setOpacity, setPickOnBounds, setPressed, setRotate, setRotationAxis, setScaleX, setScaleY, setScaleZ, setStyle, setTranslateX, setTranslateY, setTranslateZ, setUserData, setVisible, snapshot, snapshot, startDragAndDrop, startFullDrag, styleProperty, toBack, toFront, toString, translateXProperty, translateYProperty, translateZProperty, usesMirroring, visiblePropertypublic javafx.beans.property.BooleanProperty dragEnabledXProperty
isDragEnabledX(),
setDragEnabledX(boolean)public javafx.beans.property.BooleanProperty dragEnabledYProperty
isDragEnabledY(),
setDragEnabledY(boolean)protected boolean dragActive
protected double lastLayoutX
protected double lastLayoutY
protected double lastMouseX
protected double lastMouseY
protected double lastParentWidth
protected double lastParentHeight
protected double absoluteMaxWidth
protected double absoluteMaxHeight
protected GraphEditorProperties editorProperties
public javafx.scene.shape.Rectangle getBorderRectangle()
Rectangle.
The width and height of the draggable box should be set via this rectangle.
Rectanglepublic javafx.scene.shape.Rectangle getBackgroundRectangle()
Rectangle.
The size of this rectangle is bound. Do not try to change it.
Rectanglepublic void setEditorProperties(GraphEditorProperties editorProperties)
This method is called by the framework. Custom skins should not call it. Editor properties should instead
be set via the GraphEditor instance.
editorProperties - the GraphEditorProperties instance for the graph editorpublic boolean isDragEnabledX()
true if dragging is enabled in the x direction, false if notpublic void setDragEnabledX(boolean dragEnabledX)
dragEnabledX - true if dragging is enabled in the x direction, false if notpublic javafx.beans.property.BooleanProperty dragEnabledXProperty()
isDragEnabledX(),
setDragEnabledX(boolean)public boolean isDragEnabledY()
true if dragging is enabled in the y direction, false if notpublic void setDragEnabledY(boolean dragEnabledY)
dragEnabledY - true if dragging is enabled in the y direction, false if notpublic javafx.beans.property.BooleanProperty dragEnabledYProperty()
isDragEnabledY(),
setDragEnabledY(boolean)public java.util.List<java.lang.Double> getAlignmentTargetsX()
This mechanism will be active if the list is not null and not empty. If both this mechanism and
snap-to-grid are active, snap-to-grid will take priority.
nullpublic void setAlignmentTargetsX(java.util.List<java.lang.Double> alignmentTargetsX)
This mechanism will be active if the list is not null and not empty. If both this mechanism and
snap-to-grid are active, snap-to-grid will take priority.
alignmentTargetsX - a list of x values that the box will align to when dragged, or nullpublic java.util.List<java.lang.Double> getAlignmentTargetsY()
This mechanism will be active if the list is not null and not empty. If both this mechanism and
snap-to-grid are active, snap-to-grid will take priority.
nullpublic void setAlignmentTargetsY(java.util.List<java.lang.Double> alignmentTargetsY)
This mechanism will be active if the list is not null and not empty. If both this mechanism and
snap-to-grid are active, snap-to-grid will take priority.
alignmentTargetsY - a list of y values that the box will align to when dragged, or nullpublic double getAlignmentThreshold()
If the distance between the box and an alignment value is less than or equal to this threshold, the box will move to the alignment value.
public void setAlignmentThreshold(double alignmentThreshold)
If the distance between the box and an alignment target is lower than this threshold, the box will move to the alignment target.
alignmentThreshold - the alignment threshold valuepublic javafx.geometry.Point2D getSnapToGridOffset()
public void setSnapToGridOffset(javafx.geometry.Point2D snapToGridOffset)
The offset is taken from the top-left corner and is (0, 0) by default. If the default value is used, the top-left corner of the box will snap exactly onto a grid line.
snapToGridOffset - the snap offset for snap-to-grid calculationspublic void setCacheWhenStationary(boolean cacheWhenStationary)
If this is set to true, the box will be cached except for in-between mouse-pressed and mouse-released events (i.e. while it is being dragged). Should improve performance for large graphs in cases where drawing the box and its contents is expensive (shadows etc).
Currently false by default because it leads to poor performance while panning when zoomed-in.
protected void storeClickValuesForDrag(double x,
double y)
x - the scene-x position of the click eventy - the scene-y position of the click eventprotected double roundToGridSpacing(double value)
value - a double valueCopyright © 2014 TESIS DYNAware. All Rights Reserved.