public class MouseDirectManipulation extends MouseWidgetAction
Modifier and Type | Field and Description |
---|---|
private ColorRgb |
boxColor
Color for selection box.
|
private boolean |
boxSelecting
Flag indicating box selection mode was activated.
|
private boolean |
clickExpected
Flag to suppress the click events handling after mouse release with some conditions.
|
private boolean |
dragInProgress
Flag used to control first drag event in sequential drag operations.
|
private int |
eventNoApply
Event code recently consumed as result of the 4GL NO-APPLY trigger execution.
|
private int |
hOld
Cache for rectangle height.
|
private boolean |
isFrame
Flag to separate frames and dialogs from other widgets.
|
private Container<?> |
parentContainer
Parent container for widget the handler is attached to.
|
private MousePtrWrapper |
ptrCurr
The mouse pointer currently in use.
|
static int |
RESIZE_DIRECTION_E
East resize direction.
|
static int |
RESIZE_DIRECTION_N
West resize direction.
|
static int |
RESIZE_DIRECTION_NE
North-East resize direction.
|
static int |
RESIZE_DIRECTION_NW
North-West resize direction.
|
static int |
RESIZE_DIRECTION_S
South resize direction.
|
static int |
RESIZE_DIRECTION_SE
South-East resize direction.
|
static int |
RESIZE_DIRECTION_SW
South-West resize direction.
|
private static int |
RESIZE_DIRECTION_UNDEF
Definition for possible resize directions.
|
static int |
RESIZE_DIRECTION_W
Resize direction.
|
static int |
RESIZE_HANDLE_SIZE
Resize handle size.
|
private int |
resizeDirection
Resize direction.
|
private int |
resizedRowNumber
Resized row number for browse widget.
|
private boolean |
rowResizing
Flag indicating browse widget row resizing mode was activated.
|
private NativePoint |
startPoint
Point where drag operation is starting.
|
private Widget<?> |
widgetEff
Actual widget whose component is attached to handler.
|
private boolean |
widgetResizing
Flag indicating widget resizing mode was activated.
|
private boolean |
widgetsMoving
Flag indicating widgets moving mode was activated.
|
private Widget<?> |
widgetToResize
Widget reference to resize.
|
private int |
wOld
Cache for rectangle width.
|
private int |
xOld
Cache for X mouse coordinate.
|
private int |
yOld
Cache for Y mouse coordinate.
|
gd, mouseActions, widget
Constructor and Description |
---|
MouseDirectManipulation(Widget<?> widget)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
private int |
alignToGrid(int coord,
boolean isVertical)
Makes coordinate alignment according to grid line network position.
|
private void |
deselectEverything()
Deselects all selected widget inside the current container, including container itself.
|
private void |
drawMovableWidgetsBounds(int xDistance,
int yDistance,
boolean clear)
Immediate drawing the rectangular dotted line bounds for movable selected widgets.
|
private void |
drawSelectionBox(Widget<?> widBase,
int x,
int y,
int w,
int h,
boolean clear)
Immediate drawing the selection box area with dashed line style.
|
private NativeRectangle[] |
getMovableWidgetsBounds()
Collects the widget bounds for selected movable widgets belonging to current container.
|
private MousePtrWrapper |
getNewPointer(java.awt.event.MouseEvent e)
Checks if new mouse pointer is need to be used.
|
private NativeRectangle[] |
getResizeHandles(Widget<?> widResize)
Collects the widget resize handles bounds for selected resizable widget.
|
private MousePtrWrapper |
getRowResizePointer(java.awt.event.MouseEvent e)
Checks if new mouse pointer for browse row resize is need to be used.
|
private Widget<?>[] |
getWidgetsToMove()
Collects the widgets to be moved, selected movable widgets belonging to current container.
|
private boolean |
isExtended(java.awt.event.MouseEvent e)
Checks if the mouse event is extended or not.
|
private boolean |
isGridSnapOn()
Checks if the grid snap mode is active.
|
private boolean |
isInsideMovable(java.awt.event.MouseEvent e)
Checks if the mouse event is inside movable widget.
|
private boolean |
isInsideResizeHandle(NativePoint np)
Checks if the given point is over the widget's resize handle.
|
private boolean |
isInsideRowResizable()
Checks if inside the row resizable widget.
|
private boolean |
isInsideRowResizeArea(NativePoint np)
Checks if the given point is over the browse widget's row resize area.
|
void |
mouseClicked(java.awt.event.MouseEvent e)
Notification of a mouse clicked event occurred for this widget.
|
void |
mouseDragged(java.awt.event.MouseEvent e)
Notification of a mouse dragged event occurred for this widget.
|
void |
mouseMoved(java.awt.event.MouseEvent e)
Notification of a mouse moved event occurred for this widget.
|
void |
mousePressed(java.awt.event.MouseEvent e)
Notification of a mouse pressed event occurred for this widget.
|
void |
mouseReleased(java.awt.event.MouseEvent e)
Notification of a mouse released event occurred for this widget.
|
private void |
selectSingleWidget()
Selects single widget the current handler is attached to.
|
private void |
selectSingleWidget(boolean repaintParent)
Selects single widget the current handler is attached to.
|
void |
setNoApplyEvent(int code)
Saves the message code consumed by the trigger.
|
getEventId, hasEvent
private static final int RESIZE_DIRECTION_UNDEF
public static final int RESIZE_DIRECTION_NW
public static final int RESIZE_DIRECTION_N
public static final int RESIZE_DIRECTION_NE
public static final int RESIZE_DIRECTION_E
public static final int RESIZE_DIRECTION_SE
public static final int RESIZE_DIRECTION_S
public static final int RESIZE_DIRECTION_SW
public static final int RESIZE_DIRECTION_W
public static final int RESIZE_HANDLE_SIZE
private NativePoint startPoint
private boolean isFrame
private Container<?> parentContainer
private Widget<?> widgetEff
private boolean boxSelecting
private boolean widgetsMoving
private boolean widgetResizing
private boolean rowResizing
private boolean clickExpected
private Widget<?> widgetToResize
private int resizedRowNumber
private int resizeDirection
private int xOld
private int yOld
private int wOld
private int hOld
private ColorRgb boxColor
private MousePtrWrapper ptrCurr
private boolean dragInProgress
private int eventNoApply
public MouseDirectManipulation(Widget<?> widget)
widget
- The widget which contains the objects for direct manipulation.public void mouseDragged(java.awt.event.MouseEvent e)
mouseDragged
in interface java.awt.event.MouseMotionListener
mouseDragged
in class java.awt.event.MouseAdapter
e
- The mouse event.public void mouseMoved(java.awt.event.MouseEvent e)
mouseMoved
in interface java.awt.event.MouseMotionListener
mouseMoved
in class java.awt.event.MouseAdapter
e
- The mouse event.public void mouseClicked(java.awt.event.MouseEvent e)
In GUI mode, if the widget has a popup-menu attached, it will display it.
mouseClicked
in interface java.awt.event.MouseListener
mouseClicked
in class java.awt.event.MouseAdapter
e
- The mouse event.public void mousePressed(java.awt.event.MouseEvent e)
mousePressed
in interface java.awt.event.MouseListener
mousePressed
in class java.awt.event.MouseAdapter
e
- The mouse event.public void mouseReleased(java.awt.event.MouseEvent e)
mouseReleased
in interface java.awt.event.MouseListener
mouseReleased
in class java.awt.event.MouseAdapter
e
- The mouse event.public void setNoApplyEvent(int code)
code
- The event code that was consumed.private void drawSelectionBox(Widget<?> widBase, int x, int y, int w, int h, boolean clear)
widBase
- The widget which context will be used for drawing.x
- The X starting coordinate.y
- The Y starting coordinate.w
- The width of the area.h
- The height of the area.clear
- TRUE
means clean up area instead of drawing selections.private void drawMovableWidgetsBounds(int xDistance, int yDistance, boolean clear)
xDistance
- The X direction distance to move from original position.yDistance
- The Y direction distance to move from original position.clear
- TRUE
means clean up area instead of drawing selections.private boolean isExtended(java.awt.event.MouseEvent e)
Ctrl
key pressing
turns extended key mode on.e
- The mouse event to check.TRUE
if mouse event is extended, FALSE
otherwise.private boolean isInsideMovable(java.awt.event.MouseEvent e)
e
- The mouse event to check.TRUE
if mouse event is inside movable widget,
FALSE
otherwise.private boolean isInsideResizeHandle(NativePoint np)
The method remember the widget and resize direction if the point is over resize handle.
np
- The native point to check.TRUE
if the point is inside resize handle,
FALSE
otherwise.private boolean isInsideRowResizeArea(NativePoint np)
The method remember the widget and resize direction if the point is over resize handle.
np
- The native point to check related to widget origin.TRUE
if the point is inside row resize area,
FALSE
otherwise.private boolean isInsideRowResizable()
TRUE
if the point is inside row resizable widget,
FALSE
otherwise.private void selectSingleWidget()
private void selectSingleWidget(boolean repaintParent)
repaintParent
- If TRUE
the parent repaint should be performed after message
processing.private void deselectEverything()
private NativeRectangle[] getResizeHandles(Widget<?> widResize)
widResize
- The resizable widget to compute handles coordinates.NativeRectangle
elements.private NativeRectangle[] getMovableWidgetsBounds()
NativeRectangle
elements.private Widget<?>[] getWidgetsToMove()
Widget
elements to be moved.private MousePtrWrapper getNewPointer(java.awt.event.MouseEvent e)
e
- The mouse event to check.MousePtrWrapper
.private MousePtrWrapper getRowResizePointer(java.awt.event.MouseEvent e)
e
- The mouse event to check.MousePtrWrapper
.private int alignToGrid(int coord, boolean isVertical)
coord
- The coordinate to process.isVertical
- Flag indicating if the given coordinate is in vertical direction or horizontal.private boolean isGridSnapOn()
TRUE
if the grid snap is active, FALSE
otherwise.