public class SelectionTool extends AbstractLayoutTool implements IDesignTool.ToolbarInitializer
Modifier and Type | Class and Description |
---|---|
protected static class |
SelectionTool.DragMode |
AbstractLayoutTool.AbstractAlignmentAction, AbstractLayoutTool.AbstractNudgeAction, AbstractLayoutTool.AbstractZOrderAction, AbstractLayoutTool.AlignEdge, AbstractLayoutTool.CenterAction, AbstractLayoutTool.MoveNudgeAction, AbstractLayoutTool.MoveToTopOrBottomAction, AbstractLayoutTool.MoveUpOrDownAction, AbstractLayoutTool.Rotate90Action, AbstractLayoutTool.RowStackAction, AbstractLayoutTool.ScaleNudgeAction, AbstractLayoutTool.ZOrderChangeUndoAction
IDesignTool.ToolbarInitializer
Modifier and Type | Field and Description |
---|---|
protected long |
lastClick |
protected boolean |
rotationInstalled |
protected boolean |
rotationPrimed |
static java.awt.Color |
SELECTION_COLOR |
static java.awt.Color |
SELECTION_COLOR_FILL |
protected java.util.List<javax.swing.JComponent> |
toMove
When doing a MOVE drag gesture, these are the objects that will be moved.
|
ALIGN_AS_ROW, ALIGN_AS_ROW_NORMALIZE, ALIGN_AS_STACK, ALIGN_AS_STACK_NORMALIZE, ALIGN_BOTTOM, ALIGN_CENTER_HORIZONTAL, ALIGN_CENTER_VERTICAL, ALIGN_CENTERSH, ALIGN_CENTERSV, ALIGN_LEFT, ALIGN_RIGHT, ALIGN_TOP, MOVE_BACKWARD, MOVE_FORWARD, MOVE_TO_BACK, MOVE_TO_FRONT, ROTATE_LEFT, ROTATE_RIGHT
actionMap, changeSupport, designable, HANDLES_PROPERTY, inputMap, interactionLayer, panel, workspace
Constructor and Description |
---|
SelectionTool() |
Modifier and Type | Method and Description |
---|---|
protected void |
addAlignmentActions(DesignerToolbar toolbar) |
protected void |
addKeyBinding(int keyCode,
int modifiers,
javax.swing.Action action) |
protected void |
addZOrderActions(DesignerToolbar toolbar) |
protected java.lang.String |
formatLocation(javax.swing.JComponent bean,
double x,
double y,
double width,
double height) |
java.awt.Cursor |
getCursor(java.awt.Point point,
int inputEventMask)
The cursor to use given the current event mask, which can be used to detect what keys are being held down
|
IHighlight |
getDragHighlight()
Called while dragging as an easy way for a tool to install a highlight while dragging.
|
protected SelectionTool.DragMode |
getDragMode(java.awt.Point startPoint,
int modifiers,
DesignableDelegate delegate,
java.util.List<javax.swing.JComponent> selected,
javax.swing.JComponent underMouse)
Get the drag mode for the given conditions.
|
java.lang.String |
getStatusBarText(java.util.List<javax.swing.JComponent> selection,
java.awt.Point point,
int inputMask)
Calculates the currently applicable status bar text for this tool
|
IDesignTool.ToolbarInitializer |
getToolbarInitializer() |
void |
initializeToolbar(DesignerToolbar toolbar) |
protected void |
initKeyboardActions() |
boolean |
isRelevantFor(javax.swing.JComponent component) |
protected ISelectionControl |
newRotationControl() |
protected ISelectionControl |
newScaleControl() |
ISelectionControl |
newSelectionControl()
Gives the tool a chance to create a new selection control object to install handles on the selection.
|
void |
onClick(java.awt.Point p,
int modifiers)
A normal click will select (or toggle selection - use CTRL) for the component that is under the click.
|
void |
onDoubleClick(java.awt.Point p,
int mofidiers)
Called when the user double-clicks
|
void |
onDrag(java.awt.Point startPoint,
java.awt.Point lastPoint,
java.awt.Rectangle r,
int modifiers)
Called while the user is dragging.
|
void |
onDragEnd(java.awt.Point startPoint,
java.awt.Point lastPoint,
java.awt.Rectangle r,
int modifiers)
Called when the user stops dragging.
|
void |
onDragStart(java.awt.Point startPoint,
java.awt.Point lastPoint,
java.awt.Rectangle r,
int modifiers)
Starting a drag gesture.
|
void |
onPopupTrigger(java.awt.Point p,
int modifiers)
Called when the user issues a click that matches the current system's notion of a popup-menu trigger
|
componentsAreSiblings, convertBoundsToParent, evaluateEnabled, install, removeDescendents
addAction, addKeyBinding, addKeyBinding, addPropertyChangeListener, createCursor, findDropContainer, getAction, getOffsettingBounds, getOriginalBounds, isInstalled, itemMovable, movable, newToolbarSpinner, newToolbarSpinner, newToolbarSpinner, onClickAlterSelection, onKeyEvent, onMove, onPress, onRelease, onRightClickSwitchToSelectionTool, removePropertyChangeListener, uninstall
public static final java.awt.Color SELECTION_COLOR
public static final java.awt.Color SELECTION_COLOR_FILL
protected java.util.List<javax.swing.JComponent> toMove
protected boolean rotationPrimed
protected boolean rotationInstalled
protected long lastClick
public boolean isRelevantFor(javax.swing.JComponent component)
isRelevantFor
in class AbstractDesignTool
protected void initKeyboardActions()
protected void addKeyBinding(int keyCode, int modifiers, javax.swing.Action action)
public java.awt.Cursor getCursor(java.awt.Point point, int inputEventMask)
IDesignTool
getCursor
in interface IDesignTool
getCursor
in class AbstractDesignTool
public void initializeToolbar(DesignerToolbar toolbar)
initializeToolbar
in interface IDesignTool.ToolbarInitializer
protected void addAlignmentActions(DesignerToolbar toolbar)
protected void addZOrderActions(DesignerToolbar toolbar)
public IDesignTool.ToolbarInitializer getToolbarInitializer()
getToolbarInitializer
in interface IDesignTool
getToolbarInitializer
in class AbstractDesignTool
public ISelectionControl newSelectionControl()
IDesignTool
newSelectionControl
in interface IDesignTool
newSelectionControl
in class AbstractDesignTool
protected ISelectionControl newScaleControl()
protected ISelectionControl newRotationControl()
public java.lang.String getStatusBarText(java.util.List<javax.swing.JComponent> selection, java.awt.Point point, int inputMask)
IDesignTool
getStatusBarText
in interface IDesignTool
getStatusBarText
in class AbstractDesignTool
protected java.lang.String formatLocation(javax.swing.JComponent bean, double x, double y, double width, double height)
public void onClick(java.awt.Point p, int modifiers)
onClick
in interface IDesignTool
onClick
in class AbstractDesignTool
p
- The point at which they clicked. Relative to the designable container.modifiers
- A bitmask of modifiers. Comes from InputEvent.getModifiersEx()
public void onDoubleClick(java.awt.Point p, int mofidiers)
IDesignTool
onDoubleClick
in interface IDesignTool
onDoubleClick
in class AbstractDesignTool
public void onPopupTrigger(java.awt.Point p, int modifiers)
IDesignTool
onPopupTrigger
in interface IDesignTool
onPopupTrigger
in class AbstractDesignTool
public void onDragStart(java.awt.Point startPoint, java.awt.Point lastPoint, java.awt.Rectangle r, int modifiers)
1. If the mouse is over a non-container, and SHIFT is not down, the under-mouse object will be MOVED. 2. If the current item selection is movable, and ALT is down, the current selection will be MOVED. 3. Otherwise a SELECTION DRAG will start. ALT will turn the drag into FENCE SELECTION at any time, otherwise it will be a MARQUEE selection.
onDragStart
in interface IDesignTool
onDragStart
in class AbstractDesignTool
protected SelectionTool.DragMode getDragMode(java.awt.Point startPoint, int modifiers, DesignableDelegate delegate, java.util.List<javax.swing.JComponent> selected, javax.swing.JComponent underMouse)
public void onDrag(java.awt.Point startPoint, java.awt.Point lastPoint, java.awt.Rectangle r, int modifiers)
AbstractDesignTool
onDrag
in interface IDesignTool
onDrag
in class AbstractDesignTool
public void onDragEnd(java.awt.Point startPoint, java.awt.Point lastPoint, java.awt.Rectangle r, int modifiers)
AbstractDesignTool
onDragEnd
in interface IDesignTool
onDragEnd
in class AbstractDesignTool
public IHighlight getDragHighlight()
IDesignTool
getDragHighlight
in interface IDesignTool
getDragHighlight
in class AbstractDesignTool