public class MouseDirectManipulation extends MouseWidgetAction
Modifier and Type | Field and Description |
---|---|
private ColorRgb |
boxColor
Color for selection box.
|
protected boolean |
boxSelecting
Flag indicating box selection mode was activated.
|
protected boolean |
clickExpected
Flag to suppress the click events handling after mouse release with some conditions.
|
protected 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.
|
protected boolean |
isFrame
Flag to separate frames and dialogs from other widgets.
|
protected boolean |
isWindow
Flag to indicate we are looking at the frame from window point of view.
|
private MousePtrWrapper |
mousePtr
The widget's custom mouse pointer (if any).
|
protected 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
North 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
West resize direction.
|
static int |
RESIZE_HANDLE_SIZE
Resize handle size.
|
protected int |
resizeDirection
Resize direction.
|
protected int |
resizedRowNumber
Resized row number for browse widget.
|
protected boolean |
rowResizing
Flag indicating browse widget row resizing mode was activated.
|
protected NativePoint |
startPoint
Point where drag operation is starting.
|
protected Widget<?> |
widgetEff
Actual widget whose component is attached to handler.
|
protected boolean |
widgetResizing
Flag indicating widget resizing mode was activated.
|
protected boolean |
widgetsMoving
Flag indicating widgets moving mode was activated.
|
protected Widget<?> |
widgetToResize
Widget reference to resize.
|
protected Container<?> |
windowWorkSpace
Parent window workspace for widget the handler is attached too.
|
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 NativePoint |
adjustCoordsToLimits(NativeDimension widgetDim,
NativePoint point)
Adjusts the given point to the limits given by the parent container.
|
private int |
alignToGrid(int coord,
boolean isVertical)
Makes coordinate alignment according to grid line network position.
|
private static NativeRectangle[] |
buildResizeHandles(NativePoint pos,
NativeDimension dim)
Builds the widget resize handles bounds for area with given position and size.
|
private void |
deselectEverything()
Deselect all selected widget inside the current container, including container itself.
|
private void |
deselectEverythingExcept(Widget<?> except)
Deselect all selected widget inside the current container, including container itself.
|
private static void |
deselectFrameWidgets(Frame<?> frame)
Deselect all
|
private static void |
deselectFrameWidgetsExcept(Frame<?> frame,
Widget<?> except)
Deselect all
|
private static void |
deselectNestedFrames(Frame<?> frame)
If widget is a nested frame (has a parent frame) deselect all widgets within parent frame.
|
private static void |
deselectNestedFramesExcept(Frame<?> frame,
Widget<?> except)
If widget is a nested frame (has a parent frame) deselect all widgets within parent frame.
|
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 static NativeRectangle[] |
getFrameResizeHandles(Widget<?> frResize)
Collects the widget resize handles bounds for selected resizable widget.
|
protected 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 static 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.
|
protected boolean |
isDirectManipulationValid() |
private static boolean |
isExtended(java.awt.event.MouseEvent e)
Checks if the mouse event is extended or not.
|
protected boolean |
isFrameResizing()
Checks if the current mode is widget resizing and widget under resize is a frame.
|
protected boolean |
isGridSnapOn()
Checks if the grid snap mode is active.
|
private boolean |
isInsideFrameResizeHandle(NativePoint np)
Checks if the given point is over the frame's resize handle.
|
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(java.awt.event.MouseEvent event)
Checks if the given point is over the browse widget's row resize area.
|
private int |
limitRowHeight(int h,
BrowseGuiImpl browse)
Return row height trimmed according to its minimum and maximum allowed values.
|
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.
|
void |
processDrag(java.awt.event.MouseEvent evt,
boolean firstCall)
Handling drag mouse event for generic Swing client case.
|
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
protected NativePoint startPoint
protected boolean isFrame
protected Container<?> parentContainer
protected Widget<?> widgetEff
protected boolean boxSelecting
protected boolean widgetsMoving
protected boolean widgetResizing
protected boolean rowResizing
protected boolean clickExpected
protected Widget<?> widgetToResize
protected int resizedRowNumber
protected int resizeDirection
private int xOld
private int yOld
private int wOld
private int hOld
private ColorRgb boxColor
private MousePtrWrapper ptrCurr
protected boolean dragInProgress
private int eventNoApply
protected Container<?> windowWorkSpace
protected boolean isWindow
private MousePtrWrapper mousePtr
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.public void processDrag(java.awt.event.MouseEvent evt, boolean firstCall)
evt
- The mouse event details.firstCall
- Flag indicating first call in a current drag session.private int limitRowHeight(int h, BrowseGuiImpl browse)
h
- Row height.browse
- Browse which contains the resized row.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 NativePoint adjustCoordsToLimits(NativeDimension widgetDim, NativePoint point)
widgetDim
- The dimension of the widget where point belongs to.point
- The location to adjust.private static 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 isInsideFrameResizeHandle(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(java.awt.event.MouseEvent event)
The method remember the widget and resize direction if the point is over resize handle.
event
- Mouse event.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 deselectEverythingExcept(Widget<?> except)
except
- A widget to be skipped by the deselection. This can be null
.private void deselectEverything()
private static void deselectFrameWidgetsExcept(Frame<?> frame, Widget<?> except)
selectable
widgets alreadyselected
within a frame.frame
- Frame widget.except
- A widget to be skipped by the deselection. This can be null
private static void deselectFrameWidgets(Frame<?> frame)
selectable
widgets alreadyselected
within a frame.frame
- Frame widget.
FIXME: this private method is never used and should probably be removed.private static void deselectNestedFramesExcept(Frame<?> frame, Widget<?> except)
Get a list of all parent frames of this frame. The first element in the list, at index 0, is the frame it self. If frame is nested it parent frame is located at index 1.
frame
- Frame widgetexcept
- A widget to be skipped by the deselection. This can be null
private static void deselectNestedFrames(Frame<?> frame)
Get a list of all parent frames of this frame. The first element in the list, at index 0, is the frame it self. If frame is nested it parent frame is located at index 1.
frame
- Frame widget
FIXME: this private method is never used and should probably be removed.private static NativeRectangle[] getResizeHandles(Widget<?> widResize)
widResize
- The resizable widget to compute handles coordinates.NativeRectangle
elements.private static NativeRectangle[] getFrameResizeHandles(Widget<?> frResize)
frResize
- The resizable frame to compute handles coordinates.NativeRectangle
elements.private static NativeRectangle[] buildResizeHandles(NativePoint pos, NativeDimension dim)
pos
- The area top-left location to compute handles array.dim
- The area dimension to compute handles array.NativeRectangle
elements.protected 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.protected boolean isGridSnapOn()
TRUE
if the grid snap is active, FALSE
otherwise.protected boolean isFrameResizing()
TRUE
if the currently frame widget is resizing,
FALSE
otherwise.protected boolean isDirectManipulationValid()