src/java.desktop/share/classes/java/awt/event/AdjustmentEvent.java
author darcy
Tue, 24 Sep 2019 18:25:54 -0700
changeset 58309 c6f8b2c3dc66
parent 47216 71c04702a3d5
permissions -rw-r--r--
8231334: Suppress warnings on non-serializable instance fields in client libs serializable classes Reviewed-by: prr
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
16734
da1901d79073 8000406: change files using @GenerateNativeHeader to use @Native
dxu
parents: 12813
diff changeset
     2
 * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 715
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 715
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 715
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 715
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 715
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
package java.awt.event;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
import java.awt.Adjustable;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
import java.awt.AWTEvent;
16734
da1901d79073 8000406: change files using @GenerateNativeHeader to use @Native
dxu
parents: 12813
diff changeset
    30
import java.lang.annotation.Native;
12813
c10ab96dcf41 7170969: Add @GenerateNativeHeader to classes whose fields need to be exported for JNI
erikj
parents: 5506
diff changeset
    31
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
/**
440
a3dac373f62d 6520716: event classes lack info about parameters
dav
parents: 2
diff changeset
    34
 * The adjustment event emitted by Adjustable objects like
a3dac373f62d 6520716: event classes lack info about parameters
dav
parents: 2
diff changeset
    35
 * {@link java.awt.Scrollbar} and {@link java.awt.ScrollPane}.
a3dac373f62d 6520716: event classes lack info about parameters
dav
parents: 2
diff changeset
    36
 * When the user changes the value of the scrolling component,
a3dac373f62d 6520716: event classes lack info about parameters
dav
parents: 2
diff changeset
    37
 * it receives an instance of {@code AdjustmentEvent}.
a3dac373f62d 6520716: event classes lack info about parameters
dav
parents: 2
diff changeset
    38
 * <p>
a3dac373f62d 6520716: event classes lack info about parameters
dav
parents: 2
diff changeset
    39
 * An unspecified behavior will be caused if the {@code id} parameter
a3dac373f62d 6520716: event classes lack info about parameters
dav
parents: 2
diff changeset
    40
 * of any particular {@code AdjustmentEvent} instance is not
a3dac373f62d 6520716: event classes lack info about parameters
dav
parents: 2
diff changeset
    41
 * in the range from {@code ADJUSTMENT_FIRST} to {@code ADJUSTMENT_LAST}.
a3dac373f62d 6520716: event classes lack info about parameters
dav
parents: 2
diff changeset
    42
 * <p>
a3dac373f62d 6520716: event classes lack info about parameters
dav
parents: 2
diff changeset
    43
 * The {@code type} of any {@code AdjustmentEvent} instance takes one of the following
a3dac373f62d 6520716: event classes lack info about parameters
dav
parents: 2
diff changeset
    44
 * values:
a3dac373f62d 6520716: event classes lack info about parameters
dav
parents: 2
diff changeset
    45
 *                     <ul>
a3dac373f62d 6520716: event classes lack info about parameters
dav
parents: 2
diff changeset
    46
 *                     <li> {@code UNIT_INCREMENT}
a3dac373f62d 6520716: event classes lack info about parameters
dav
parents: 2
diff changeset
    47
 *                     <li> {@code UNIT_DECREMENT}
a3dac373f62d 6520716: event classes lack info about parameters
dav
parents: 2
diff changeset
    48
 *                     <li> {@code BLOCK_INCREMENT}
a3dac373f62d 6520716: event classes lack info about parameters
dav
parents: 2
diff changeset
    49
 *                     <li> {@code BLOCK_DECREMENT}
a3dac373f62d 6520716: event classes lack info about parameters
dav
parents: 2
diff changeset
    50
 *                     <li> {@code TRACK}
a3dac373f62d 6520716: event classes lack info about parameters
dav
parents: 2
diff changeset
    51
 *                     </ul>
a3dac373f62d 6520716: event classes lack info about parameters
dav
parents: 2
diff changeset
    52
 * Assigning the value different from listed above will cause an unspecified behavior.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
 * @see java.awt.Adjustable
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
 * @see AdjustmentListener
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
 * @author Amy Fowler
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
 * @since 1.1
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
public class AdjustmentEvent extends AWTEvent {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
     * Marks the first integer id for the range of adjustment event ids.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
    public static final int ADJUSTMENT_FIRST    = 601;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
     * Marks the last integer id for the range of adjustment event ids.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
    public static final int ADJUSTMENT_LAST     = 601;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
     * The adjustment value changed event.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
    public static final int ADJUSTMENT_VALUE_CHANGED = ADJUSTMENT_FIRST; //Event.SCROLL_LINE_UP
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
     * The unit increment adjustment type.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
     */
16734
da1901d79073 8000406: change files using @GenerateNativeHeader to use @Native
dxu
parents: 12813
diff changeset
    79
    @Native public static final int UNIT_INCREMENT      = 1;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
     * The unit decrement adjustment type.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
     */
16734
da1901d79073 8000406: change files using @GenerateNativeHeader to use @Native
dxu
parents: 12813
diff changeset
    84
    @Native public static final int UNIT_DECREMENT      = 2;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
     * The block decrement adjustment type.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
     */
16734
da1901d79073 8000406: change files using @GenerateNativeHeader to use @Native
dxu
parents: 12813
diff changeset
    89
    @Native public static final int BLOCK_DECREMENT     = 3;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
     * The block increment adjustment type.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
     */
16734
da1901d79073 8000406: change files using @GenerateNativeHeader to use @Native
dxu
parents: 12813
diff changeset
    94
    @Native public static final int BLOCK_INCREMENT     = 4;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
     * The absolute tracking adjustment type.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
     */
16734
da1901d79073 8000406: change files using @GenerateNativeHeader to use @Native
dxu
parents: 12813
diff changeset
    99
    @Native public static final int TRACK               = 5;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
     * The adjustable object that fired the event.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
     * @serial
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
     * @see #getAdjustable
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
     */
58309
c6f8b2c3dc66 8231334: Suppress warnings on non-serializable instance fields in client libs serializable classes
darcy
parents: 47216
diff changeset
   107
    @SuppressWarnings("serial") // Not statically typed as Serializable
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
    Adjustable adjustable;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
    /**
35667
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   111
     * {@code value} will contain the new value of the
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
     * adjustable object.  This value will always be  in a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
     * range associated adjustable object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
     * @serial
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
     * @see #getValue
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
    int value;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
    /**
35667
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   121
     * The {@code adjustmentType} describes how the adjustable
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
     * object value has changed.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
     * This value can be increased/decreased by a block or unit amount
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
     * where the block is associated with page increments/decrements,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
     * and a unit is associated with line increments/decrements.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
     * @serial
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
     * @see #getAdjustmentType
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
    int adjustmentType;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
    /**
35667
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   134
     * The {@code isAdjusting} is true if the event is one
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
     * of the series of multiple adjustment events.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
     * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
     * @serial
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
     * @see #getValueIsAdjusting
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
    boolean isAdjusting;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
    /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
     * JDK 1.1 serialVersionUID
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
     private static final long serialVersionUID = 5700290645205279921L;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
    /**
35667
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   151
     * Constructs an {@code AdjustmentEvent} object with the
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   152
     * specified {@code Adjustable} source, event type,
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
     * adjustment type, and value.
440
a3dac373f62d 6520716: event classes lack info about parameters
dav
parents: 2
diff changeset
   154
     * <p> This method throws an
35667
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   155
     * {@code IllegalArgumentException} if {@code source}
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   156
     * is {@code null}.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
     *
35667
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   158
     * @param source The {@code Adjustable} object where the
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
     *               event originated
440
a3dac373f62d 6520716: event classes lack info about parameters
dav
parents: 2
diff changeset
   160
     * @param id     An integer indicating the type of event.
a3dac373f62d 6520716: event classes lack info about parameters
dav
parents: 2
diff changeset
   161
     *                     For information on allowable values, see
a3dac373f62d 6520716: event classes lack info about parameters
dav
parents: 2
diff changeset
   162
     *                     the class description for {@link AdjustmentEvent}
a3dac373f62d 6520716: event classes lack info about parameters
dav
parents: 2
diff changeset
   163
     * @param type   An integer indicating the adjustment type.
a3dac373f62d 6520716: event classes lack info about parameters
dav
parents: 2
diff changeset
   164
     *                     For information on allowable values, see
a3dac373f62d 6520716: event classes lack info about parameters
dav
parents: 2
diff changeset
   165
     *                     the class description for {@link AdjustmentEvent}
a3dac373f62d 6520716: event classes lack info about parameters
dav
parents: 2
diff changeset
   166
     * @param value  The current value of the adjustment
35667
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   167
     * @throws IllegalArgumentException if {@code source} is null
440
a3dac373f62d 6520716: event classes lack info about parameters
dav
parents: 2
diff changeset
   168
     * @see #getSource()
a3dac373f62d 6520716: event classes lack info about parameters
dav
parents: 2
diff changeset
   169
     * @see #getID()
a3dac373f62d 6520716: event classes lack info about parameters
dav
parents: 2
diff changeset
   170
     * @see #getAdjustmentType()
a3dac373f62d 6520716: event classes lack info about parameters
dav
parents: 2
diff changeset
   171
     * @see #getValue()
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
    public AdjustmentEvent(Adjustable source, int id, int type, int value) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
        this(source, id, type, value, false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
    /**
35667
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   178
     * Constructs an {@code AdjustmentEvent} object with the
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
     * specified Adjustable source, event type, adjustment type, and value.
440
a3dac373f62d 6520716: event classes lack info about parameters
dav
parents: 2
diff changeset
   180
     * <p> This method throws an
35667
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   181
     * {@code IllegalArgumentException} if {@code source}
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   182
     * is {@code null}.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
     *
35667
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   184
     * @param source The {@code Adjustable} object where the
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
     *               event originated
440
a3dac373f62d 6520716: event classes lack info about parameters
dav
parents: 2
diff changeset
   186
     * @param id     An integer indicating the type of event.
a3dac373f62d 6520716: event classes lack info about parameters
dav
parents: 2
diff changeset
   187
     *                     For information on allowable values, see
a3dac373f62d 6520716: event classes lack info about parameters
dav
parents: 2
diff changeset
   188
     *                     the class description for {@link AdjustmentEvent}
a3dac373f62d 6520716: event classes lack info about parameters
dav
parents: 2
diff changeset
   189
     * @param type   An integer indicating the adjustment type.
a3dac373f62d 6520716: event classes lack info about parameters
dav
parents: 2
diff changeset
   190
     *                     For information on allowable values, see
a3dac373f62d 6520716: event classes lack info about parameters
dav
parents: 2
diff changeset
   191
     *                     the class description for {@link AdjustmentEvent}
a3dac373f62d 6520716: event classes lack info about parameters
dav
parents: 2
diff changeset
   192
     * @param value  The current value of the adjustment
35667
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   193
     * @param isAdjusting A boolean that equals {@code true} if the event is one
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
     *               of a series of multiple adjusting events,
35667
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   195
     *               otherwise {@code false}
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   196
     * @throws IllegalArgumentException if {@code source} is null
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
     * @since 1.4
440
a3dac373f62d 6520716: event classes lack info about parameters
dav
parents: 2
diff changeset
   198
     * @see #getSource()
a3dac373f62d 6520716: event classes lack info about parameters
dav
parents: 2
diff changeset
   199
     * @see #getID()
a3dac373f62d 6520716: event classes lack info about parameters
dav
parents: 2
diff changeset
   200
     * @see #getAdjustmentType()
a3dac373f62d 6520716: event classes lack info about parameters
dav
parents: 2
diff changeset
   201
     * @see #getValue()
a3dac373f62d 6520716: event classes lack info about parameters
dav
parents: 2
diff changeset
   202
     * @see #getValueIsAdjusting()
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
    public AdjustmentEvent(Adjustable source, int id, int type, int value, boolean isAdjusting) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
        super(source, id);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
        adjustable = source;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
        this.adjustmentType = type;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
        this.value = value;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
        this.isAdjusting = isAdjusting;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
    /**
35667
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   213
     * Returns the {@code Adjustable} object where this event originated.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
     *
35667
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   215
     * @return the {@code Adjustable} object where this event originated
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
    public Adjustable getAdjustable() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
        return adjustable;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
     * Returns the current value in the adjustment event.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
     * @return the current value in the adjustment event
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
    public int getValue() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
        return value;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
     * Returns the type of adjustment which caused the value changed
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
     * event.  It will have one of the following values:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
     * <ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
     * <li>{@link #UNIT_INCREMENT}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
     * <li>{@link #UNIT_DECREMENT}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
     * <li>{@link #BLOCK_INCREMENT}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
     * <li>{@link #BLOCK_DECREMENT}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
     * <li>{@link #TRACK}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
     * </ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
     * @return one of the adjustment values listed above
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
    public int getAdjustmentType() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
        return adjustmentType;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
    /**
35667
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   247
     * Returns {@code true} if this is one of multiple
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
     * adjustment events.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
     *
35667
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   250
     * @return {@code true} if this is one of multiple
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   251
     *         adjustment events, otherwise returns {@code false}
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
     * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
    public boolean getValueIsAdjusting() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
        return isAdjusting;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
    public String paramString() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
        String typeStr;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
        switch(id) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
          case ADJUSTMENT_VALUE_CHANGED:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
              typeStr = "ADJUSTMENT_VALUE_CHANGED";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
              break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
          default:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
              typeStr = "unknown type";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
        String adjTypeStr;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
        switch(adjustmentType) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
          case UNIT_INCREMENT:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
              adjTypeStr = "UNIT_INCREMENT";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
              break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
          case UNIT_DECREMENT:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
              adjTypeStr = "UNIT_DECREMENT";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
              break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
          case BLOCK_INCREMENT:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
              adjTypeStr = "BLOCK_INCREMENT";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
              break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
          case BLOCK_DECREMENT:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
              adjTypeStr = "BLOCK_DECREMENT";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
              break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
          case TRACK:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
              adjTypeStr = "TRACK";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
              break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
          default:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
              adjTypeStr = "unknown type";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
        return typeStr
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
            + ",adjType="+adjTypeStr
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
            + ",value="+value
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
            + ",isAdjusting="+isAdjusting;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
}