< prev index next >

modules/javafx.graphics/src/main/java/javafx/scene/input/TouchEvent.java

Print this page




 112         super(source, target, eventType);
 113         this.touchPoints = touchPoints != null ? Collections.unmodifiableList(touchPoints) : null;
 114         this.eventSetId = eventSetId;
 115         this.shiftDown = shiftDown;
 116         this.controlDown = controlDown;
 117         this.altDown = altDown;
 118         this.metaDown = metaDown;
 119         this.touchPoint = touchPoint;
 120     }
 121 
 122     /**
 123      * Constructs new TouchEvent event with null source and target.
 124      * @param eventType The type of the event.
 125      * @param touchPoint the touch point of this event
 126      * @param touchPoints set of touch points for the multi-touch action
 127      * @param eventSetId set id of the multi-touch action
 128      * @param shiftDown true if shift modifier was pressed.
 129      * @param controlDown true if control modifier was pressed.
 130      * @param altDown true if alt modifier was pressed.
 131      * @param metaDown true if meta modifier was pressed.
 132      * @param direct true if the event was caused by direct input device. See {@link #isDirect() }
 133      * @since JavaFX 8.0
 134      */
 135     public TouchEvent(@NamedArg("eventType") EventType<TouchEvent> eventType,
 136             @NamedArg("touchPoint") TouchPoint touchPoint, @NamedArg("touchPoints") List<TouchPoint> touchPoints, @NamedArg("eventSetId") int eventSetId,
 137             @NamedArg("shiftDown") boolean shiftDown, @NamedArg("controlDown") boolean controlDown, @NamedArg("altDown") boolean altDown,
 138             @NamedArg("metaDown") boolean metaDown) {
 139         this(null, null, eventType, touchPoint, touchPoints, eventSetId,
 140                 shiftDown, controlDown, altDown, metaDown);
 141     }
 142 
 143     /**
 144      * Returns number of touch points represented by this touch event set.
 145      * The returned number matches the size of the {@code touchPoints} list.
 146      * @return The number of touch points represented by this touch event set.
 147      */
 148     public int getTouchCount() {
 149         return touchPoints.size();
 150     }
 151 
 152     /**


 159             Object newSource) {
 160 
 161         for (TouchPoint tp : event.touchPoints) {
 162             tp.recomputeToSource(oldSource, newSource);
 163         }
 164     }
 165 
 166 
 167     /**
 168      * @inheritDoc
 169      */
 170     @Override
 171     public TouchEvent copyFor(Object newSource, EventTarget newTarget) {
 172         TouchEvent e = (TouchEvent) super.copyFor(newSource, newTarget);
 173         recomputeToSource(e, getSource(), newSource);
 174         return e;
 175     }
 176 
 177     /**
 178      * Creates a copy of the given event with the given fields substituted.
 179      * @param source the new source of the copied event
 180      * @param target the new target of the copied event
 181      * @param eventType the new eventType
 182      * @return the event copy with the fields substituted
 183      * @since JavaFX 8.0
 184      */
 185     public TouchEvent copyFor(Object newSource, EventTarget newTarget, EventType<TouchEvent> type) {
 186         TouchEvent e = copyFor(newSource, newTarget);
 187         e.eventType = type;
 188         return e;
 189     }
 190 
 191     @Override
 192     public EventType<TouchEvent> getEventType() {
 193         return (EventType<TouchEvent>) super.getEventType();
 194     }
 195 
 196     private final int eventSetId;
 197 
 198     /**
 199      * Gets sequential number of the set of touch events representing the same
 200      * multi-touch action. For a multi-touch user action, number of touch points
 201      * may exist; each of them produces a touch event, each of those touch




 112         super(source, target, eventType);
 113         this.touchPoints = touchPoints != null ? Collections.unmodifiableList(touchPoints) : null;
 114         this.eventSetId = eventSetId;
 115         this.shiftDown = shiftDown;
 116         this.controlDown = controlDown;
 117         this.altDown = altDown;
 118         this.metaDown = metaDown;
 119         this.touchPoint = touchPoint;
 120     }
 121 
 122     /**
 123      * Constructs new TouchEvent event with null source and target.
 124      * @param eventType The type of the event.
 125      * @param touchPoint the touch point of this event
 126      * @param touchPoints set of touch points for the multi-touch action
 127      * @param eventSetId set id of the multi-touch action
 128      * @param shiftDown true if shift modifier was pressed.
 129      * @param controlDown true if control modifier was pressed.
 130      * @param altDown true if alt modifier was pressed.
 131      * @param metaDown true if meta modifier was pressed.

 132      * @since JavaFX 8.0
 133      */
 134     public TouchEvent(@NamedArg("eventType") EventType<TouchEvent> eventType,
 135             @NamedArg("touchPoint") TouchPoint touchPoint, @NamedArg("touchPoints") List<TouchPoint> touchPoints, @NamedArg("eventSetId") int eventSetId,
 136             @NamedArg("shiftDown") boolean shiftDown, @NamedArg("controlDown") boolean controlDown, @NamedArg("altDown") boolean altDown,
 137             @NamedArg("metaDown") boolean metaDown) {
 138         this(null, null, eventType, touchPoint, touchPoints, eventSetId,
 139                 shiftDown, controlDown, altDown, metaDown);
 140     }
 141 
 142     /**
 143      * Returns number of touch points represented by this touch event set.
 144      * The returned number matches the size of the {@code touchPoints} list.
 145      * @return The number of touch points represented by this touch event set.
 146      */
 147     public int getTouchCount() {
 148         return touchPoints.size();
 149     }
 150 
 151     /**


 158             Object newSource) {
 159 
 160         for (TouchPoint tp : event.touchPoints) {
 161             tp.recomputeToSource(oldSource, newSource);
 162         }
 163     }
 164 
 165 
 166     /**
 167      * @inheritDoc
 168      */
 169     @Override
 170     public TouchEvent copyFor(Object newSource, EventTarget newTarget) {
 171         TouchEvent e = (TouchEvent) super.copyFor(newSource, newTarget);
 172         recomputeToSource(e, getSource(), newSource);
 173         return e;
 174     }
 175 
 176     /**
 177      * Creates a copy of the given event with the given fields substituted.
 178      * @param newSource the new source of the copied event
 179      * @param newTarget the new target of the copied event
 180      * @param type the new eventType
 181      * @return the event copy with the fields substituted
 182      * @since JavaFX 8.0
 183      */
 184     public TouchEvent copyFor(Object newSource, EventTarget newTarget, EventType<TouchEvent> type) {
 185         TouchEvent e = copyFor(newSource, newTarget);
 186         e.eventType = type;
 187         return e;
 188     }
 189 
 190     @Override
 191     public EventType<TouchEvent> getEventType() {
 192         return (EventType<TouchEvent>) super.getEventType();
 193     }
 194 
 195     private final int eventSetId;
 196 
 197     /**
 198      * Gets sequential number of the set of touch events representing the same
 199      * multi-touch action. For a multi-touch user action, number of touch points
 200      * may exist; each of them produces a touch event, each of those touch


< prev index next >