Class SelectionTool

    • Field Detail

      • SELECTION_COLOR

        public static final java.awt.Color SELECTION_COLOR
      • SELECTION_COLOR_FILL

        public static final java.awt.Color SELECTION_COLOR_FILL
      • toMove

        protected java.util.List<javax.swing.JComponent> toMove
        When doing a MOVE drag gesture, these are the objects that will be moved.
      • rotationPrimed

        protected boolean rotationPrimed
      • rotationInstalled

        protected boolean rotationInstalled
      • lastClick

        protected long lastClick
    • Constructor Detail

      • SelectionTool

        public SelectionTool()
    • Method Detail

      • initKeyboardActions

        protected void initKeyboardActions()
      • addKeyBinding

        protected void addKeyBinding​(int keyCode,
                                     int modifiers,
                                     javax.swing.Action action)
      • getCursor

        public java.awt.Cursor getCursor​(java.awt.Point point,
                                         int inputEventMask)
        Description copied from interface: IDesignTool
        The cursor to use given the current event mask, which can be used to detect what keys are being held down
        Specified by:
        getCursor in interface IDesignTool
        Overrides:
        getCursor in class AbstractDesignTool
      • addAlignmentActions

        protected void addAlignmentActions​(DesignerToolbar toolbar)
      • addZOrderActions

        protected void addZOrderActions​(DesignerToolbar toolbar)
      • getStatusBarText

        public java.lang.String getStatusBarText​(java.util.List<javax.swing.JComponent> selection,
                                                 java.awt.Point point,
                                                 int inputMask)
        Description copied from interface: IDesignTool
        Calculates the currently applicable status bar text for this tool
        Specified by:
        getStatusBarText in interface IDesignTool
        Overrides:
        getStatusBarText in class AbstractDesignTool
      • formatLocation

        protected java.lang.String formatLocation​(javax.swing.JComponent bean,
                                                  double x,
                                                  double y,
                                                  double width,
                                                  double height)
      • onClick

        public 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. Holding ALT will have the selection step down through the Z-order so that selecting things in the background is easier.
        Specified by:
        onClick in interface IDesignTool
        Overrides:
        onClick in class AbstractDesignTool
        Parameters:
        p - The point at which they clicked. Relative to the designable container.
        modifiers - A bitmask of modifiers. Comes from InputEvent.getModifiersEx()
      • onPopupTrigger

        public void onPopupTrigger​(java.awt.Point p,
                                   int modifiers)
        Description copied from interface: IDesignTool
        Called when the user issues a click that matches the current system's notion of a popup-menu trigger
        Specified by:
        onPopupTrigger in interface IDesignTool
        Overrides:
        onPopupTrigger in class AbstractDesignTool
      • onDragStart

        public void onDragStart​(java.awt.Point startPoint,
                                java.awt.Point lastPoint,
                                java.awt.Rectangle r,
                                int modifiers)
        Starting a drag gesture. Many different permutations of current state and key_down masks affect what the drag gesture means:

         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.
         
        Specified by:
        onDragStart in interface IDesignTool
        Overrides:
        onDragStart in class AbstractDesignTool
      • getDragMode

        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. Note, if the drag mode is Move, it also must fill the "toMove" collection
      • onDrag

        public void onDrag​(java.awt.Point startPoint,
                           java.awt.Point lastPoint,
                           java.awt.Rectangle r,
                           int modifiers)
        Description copied from class: AbstractDesignTool
        Called while the user is dragging. All coordinates are relative to the interaction panel and are in zoomed space.
        Specified by:
        onDrag in interface IDesignTool
        Overrides:
        onDrag in class AbstractDesignTool
      • onDragEnd

        public void onDragEnd​(java.awt.Point startPoint,
                              java.awt.Point lastPoint,
                              java.awt.Rectangle r,
                              int modifiers)
        Description copied from class: AbstractDesignTool
        Called when the user stops dragging. All coordinates are relative to the interaction panel and are in zoomed space.
        Specified by:
        onDragEnd in interface IDesignTool
        Overrides:
        onDragEnd in class AbstractDesignTool