Package snap.view

Class ViewEvent

java.lang.Object
snap.view.ViewEvent
All Implemented Interfaces:
Cloneable
Direct Known Subclasses:
SwingEvent

public abstract class ViewEvent extends Object implements Cloneable
Represents node UI events sent to a Views for input events.
  • Field Details

  • Constructor Details

    • ViewEvent

      public ViewEvent()
  • Method Details

    • getView

      public View getView()
      Returns the node associated with this event.
    • getView

      public <T> T getView(Class<T> aClass)
      Returns the event node as given class.
    • setView

      public void setView(View aView)
      Returns the node associated with this event.
    • getEvent

      public Object getEvent()
      Returns the platform specific event, if available.
    • setEvent

      public void setEvent(Object anEvent)
      Sets the platform specific event, if available.
    • getEvent

      public <T> T getEvent(Class<T> aClass)
      Returns the platform specific event as given class.
    • getName

      public String getName()
      Returns the name of the event (or the name of the Event Target).
    • setName

      public void setName(String aName)
      Returns the name of the event (or the name of the Event Target).
    • getType

      public ViewEvent.Type getType()
      Returns the event type.
    • getTypeImpl

      protected abstract ViewEvent.Type getTypeImpl()
      Returns the event type.
    • setType

      public void setType(ViewEvent.Type aType)
      Sets the event type.
    • getParentEvent

      public ViewEvent getParentEvent()
      Sets the event that precipitated this event (optional).
    • setParentEvent

      protected void setParentEvent(ViewEvent anEvent)
      Sets the event that precipitated this event (optional).
    • getRootEvent

      public ViewEvent getRootEvent()
      Sets the event that precipitated this event (optional).
    • getWhen

      public long getWhen()
      Returns the time the event was sent.
    • isActionEvent

      public boolean isActionEvent()
      Returns whether event is action event.
    • isMouseEvent

      public boolean isMouseEvent()
      Returns whether event is mouse event.
    • isMousePress

      public boolean isMousePress()
      Returns whether event is mouse pressed.
    • isMouseDrag

      public boolean isMouseDrag()
      Returns whether event is mouse dragged.
    • isMouseRelease

      public boolean isMouseRelease()
      Returns whether event is mouse released.
    • isMouseClick

      public boolean isMouseClick()
      Returns whether event is mouse clicked.
    • isEventWithinTimeAndDist

      public boolean isEventWithinTimeAndDist(int timeMillis, double aDist)
      Returns whether event is mouse clicked.
    • isClickCandidate

      public boolean isClickCandidate()
      Returns whether event is mouse event in mouse click range (within half second of down
    • isMouseEnter

      public boolean isMouseEnter()
      Returns whether event is mouse entered.
    • isMouseMove

      public boolean isMouseMove()
      Returns whether event is mouse moved.
    • isMouseExit

      public boolean isMouseExit()
      Returns whether event is mouse exited.
    • isKeyEvent

      public boolean isKeyEvent()
      Returns whether event is key event.
    • isKeyPress

      public boolean isKeyPress()
      Returns whether event is key pressed.
    • isKeyRelease

      public boolean isKeyRelease()
      Returns whether event is key released.
    • isKeyType

      public boolean isKeyType()
      Returns whether event is key typed.
    • isScroll

      public boolean isScroll()
      Returns whether event is scroll.
    • isDragEvent

      public boolean isDragEvent()
      Returns whether event is any drag event.
    • isDragEnter

      public boolean isDragEnter()
      Returns whether event is drag enter.
    • isDragOver

      public boolean isDragOver()
      Returns whether event is drag over.
    • isDragExit

      public boolean isDragExit()
      Returns whether event is drag exit.
    • isDragDrop

      public boolean isDragDrop()
      Returns whether event is drop event.
    • isDragDropEvent

      public boolean isDragDropEvent()
      Returns whether event is drop event.
    • isDragSourceEvent

      public boolean isDragSourceEvent()
      Returns whether event is drag source event.
    • isDragGesture

      public boolean isDragGesture()
      Returns whether event is DragGesture event.
    • isDragSourceEnter

      public boolean isDragSourceEnter()
      Returns whether event is DragSourceEnter event.
    • isDragSourceExit

      public boolean isDragSourceExit()
      Returns whether event is DragSourceExit event.
    • isDragSourceEnd

      public boolean isDragSourceEnd()
      Returns whether event is DragSourceEnd event.
    • isWinOpen

      public boolean isWinOpen()
      Returns whether event is WinOpened.
    • isWinClose

      public boolean isWinClose()
      Returns whether event is WinClosing.
    • getValue

      public Object getValue()
      Returns the value encapsulated by the event widget.
    • setValue

      public void setValue(Object aValue)
      Sets the value encapsulated by the event widget.
    • getStringValue

      public String getStringValue()
      Returns the String value encapsulated by the event widget.
    • getBoolValue

      public boolean getBoolValue()
      Returns the Boolean value encapsulated by the event widget.
    • getBooleanValue

      public Boolean getBooleanValue()
      Returns the Boolean value encapsulated by the event widget.
    • getIntValue

      public Integer getIntValue()
      Returns the Integer value encapsulated by the event widget.
    • getFloatValue

      public Float getFloatValue()
      Returns the Float value encapsulated by the event widget.
    • getText

      public String getText()
      Returns text for encapsulated widget.
    • getSelIndex

      public int getSelIndex()
      Returns the selected index for encapsulated widget.
    • getSelItem

      public Object getSelItem()
      Returns the selected item for encapsulated widget.
    • isShiftDown

      public boolean isShiftDown()
      Returns whether shift key is down.
    • isControlDown

      public boolean isControlDown()
      Returns whether control key is down.
    • isAltDown

      public boolean isAltDown()
      Returns whether alt key is down.
    • isMetaDown

      public boolean isMetaDown()
      Returns whether "meta" key is down (the command key on Mac with no equivalent on Windows).
    • isShortcutDown

      public boolean isShortcutDown()
      Returns whether shortcut key is pressed.
    • getKeyCombo

      public KeyCombo getKeyCombo()
      Returns the key combo.
    • isPopupTrigger

      public boolean isPopupTrigger()
      Returns whether popup trigger is down.
    • getClickCount

      public int getClickCount()
      Returns the click count for a mouse event.
    • setClickCount

      public void setClickCount(int aValue)
      Sets the click count for a mouse event.
    • getX

      public double getX()
      Returns the mouse event x.
    • getY

      public double getY()
      Returns the mouse event y.
    • setXY

      protected void setXY(double aX, double aY)
      Sets the x/y.
    • getPoint

      public Point getPoint()
      Returns the event location.
    • getPointImpl

      protected Point getPointImpl()
      Returns the event location.
    • getPoint

      public Point getPoint(View aView)
      Returns the event location in coords of given view.
    • getScrollX

      public double getScrollX()
      Returns the scroll amount X.
    • getScrollY

      public double getScrollY()
      Returns the scroll amount Y.
    • getKeyCode

      public int getKeyCode()
      Returns the event keycode.
    • getKeyChar

      public char getKeyChar()
      Returns the event key char.
    • getKeyString

      public String getKeyString()
      Returns the event key char.
    • isLeftArrow

      public boolean isLeftArrow()
      Returns whether key is left arrow.
    • isRightArrow

      public boolean isRightArrow()
      Returns whether key is right arrow.
    • isUpArrow

      public boolean isUpArrow()
      Returns whether key is up arrow.
    • isDownArrow

      public boolean isDownArrow()
      Returns whether key is down arrow.
    • isBackSpaceKey

      public boolean isBackSpaceKey()
      Returns whether key is delete key.
    • isDeleteKey

      public boolean isDeleteKey()
      Returns whether key is delete key.
    • isEnterKey

      public boolean isEnterKey()
      Returns whether key is enter key.
    • isTabKey

      public boolean isTabKey()
      Returns whether key is tab key.
    • isEscapeKey

      public boolean isEscapeKey()
      Returns whether key is escape key.
    • isSpaceKey

      public boolean isSpaceKey()
      Returns whether key is escape key.
    • isControlChar

      public boolean isControlChar()
      Returns whether key is ISO control character.
    • getClipboard

      public Clipboard getClipboard()
      Returns the Drag Clipboard for this event, if appropriate.
    • acceptDrag

      public void acceptDrag()
      Called to indicate that drop is accepted.
    • dropComplete

      public void dropComplete()
      Called to indicate that drop is complete.
    • isConsumed

      public boolean isConsumed()
      Returns whether event was consumed.
    • consume

      public void consume()
      Consume event.
    • copyForView

      public ViewEvent copyForView(View aView)
      Returns a ViewEvent at new point.
    • copyForPoint

      public ViewEvent copyForPoint(double aX, double aY)
      Returns a ViewEvent at new point.
    • copyForClickCount

      public ViewEvent copyForClickCount(int aClickCount)
      Returns a ViewEvent at new click count.
    • copyForViewPoint

      public ViewEvent copyForViewPoint(View aView, double aX, double aY, int aClickCount)
      Returns a ViewEvent at new point.
    • clone

      public ViewEvent clone()
      Copy event.
      Overrides:
      clone in class Object
    • is

      public boolean is(String aName)
      Returns whether event represents component with given name.
    • equals

      public boolean equals(String aName)
      Returns whether widget is equal to given name.
    • equals

      public boolean equals(Object anObj)
      Returns whether widget is equal to given object.
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Standard toString implementation.
      Overrides:
      toString in class Object
    • createEvent

      public static ViewEvent createEvent(View aView, Object anEvent, ViewEvent.Type aType, String aName)
      Creates an Event.