jdk/src/share/classes/java/awt/event/AdjustmentEvent.java
author dav
Tue, 08 Apr 2008 12:46:39 +0400
changeset 440 a3dac373f62d
parent 2 90ce3da70b43
child 715 f16baef3a20e
permissions -rw-r--r--
6520716: event classes lack info about parameters Summary: clarify allowed values for event constructors Reviewed-by: son, denis
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
     2
 * Copyright 1996-2007 Sun Microsystems, Inc.  All Rights Reserved.
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
90ce3da70b43 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.  Sun designates this
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
90ce3da70b43 Initial load
duke
parents:
diff changeset
     9
 * by Sun in the LICENSE file that accompanied this code.
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
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    21
 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    22
 * CA 95054 USA or visit www.sun.com if you need additional information or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    23
 * have any questions.
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;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
/**
440
a3dac373f62d 6520716: event classes lack info about parameters
dav
parents: 2
diff changeset
    32
 * The adjustment event emitted by Adjustable objects like
a3dac373f62d 6520716: event classes lack info about parameters
dav
parents: 2
diff changeset
    33
 * {@link java.awt.Scrollbar} and {@link java.awt.ScrollPane}.
a3dac373f62d 6520716: event classes lack info about parameters
dav
parents: 2
diff changeset
    34
 * When the user changes the value of the scrolling component,
a3dac373f62d 6520716: event classes lack info about parameters
dav
parents: 2
diff changeset
    35
 * it receives an instance of {@code AdjustmentEvent}.
a3dac373f62d 6520716: event classes lack info about parameters
dav
parents: 2
diff changeset
    36
 * <p>
a3dac373f62d 6520716: event classes lack info about parameters
dav
parents: 2
diff changeset
    37
 * An unspecified behavior will be caused if the {@code id} parameter
a3dac373f62d 6520716: event classes lack info about parameters
dav
parents: 2
diff changeset
    38
 * of any particular {@code AdjustmentEvent} instance is not
a3dac373f62d 6520716: event classes lack info about parameters
dav
parents: 2
diff changeset
    39
 * in the range from {@code ADJUSTMENT_FIRST} to {@code ADJUSTMENT_LAST}.
a3dac373f62d 6520716: event classes lack info about parameters
dav
parents: 2
diff changeset
    40
 * <p>
a3dac373f62d 6520716: event classes lack info about parameters
dav
parents: 2
diff changeset
    41
 * 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
    42
 * values:
a3dac373f62d 6520716: event classes lack info about parameters
dav
parents: 2
diff changeset
    43
 *                     <ul>
a3dac373f62d 6520716: event classes lack info about parameters
dav
parents: 2
diff changeset
    44
 *                     <li> {@code UNIT_INCREMENT}
a3dac373f62d 6520716: event classes lack info about parameters
dav
parents: 2
diff changeset
    45
 *                     <li> {@code UNIT_DECREMENT}
a3dac373f62d 6520716: event classes lack info about parameters
dav
parents: 2
diff changeset
    46
 *                     <li> {@code BLOCK_INCREMENT}
a3dac373f62d 6520716: event classes lack info about parameters
dav
parents: 2
diff changeset
    47
 *                     <li> {@code BLOCK_DECREMENT}
a3dac373f62d 6520716: event classes lack info about parameters
dav
parents: 2
diff changeset
    48
 *                     <li> {@code TRACK}
a3dac373f62d 6520716: event classes lack info about parameters
dav
parents: 2
diff changeset
    49
 *                     </ul>
a3dac373f62d 6520716: event classes lack info about parameters
dav
parents: 2
diff changeset
    50
 * Assigning the value different from listed above will cause an unspecified behavior.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
 * @see java.awt.Adjustable
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
 * @see AdjustmentListener
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
 * @author Amy Fowler
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
 * @since 1.1
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
public class AdjustmentEvent extends AWTEvent {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
     * Marks the first integer id for the range of adjustment event ids.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
    public static final int ADJUSTMENT_FIRST    = 601;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
     * Marks the last integer id for the range of adjustment event ids.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
    public static final int ADJUSTMENT_LAST     = 601;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
     * The adjustment value changed event.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
    public static final int ADJUSTMENT_VALUE_CHANGED = ADJUSTMENT_FIRST; //Event.SCROLL_LINE_UP
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
     * The unit increment adjustment type.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
    public static final int UNIT_INCREMENT      = 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
     * The unit decrement adjustment type.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
    public static final int UNIT_DECREMENT      = 2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
     * The block decrement adjustment type.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
    public static final int BLOCK_DECREMENT     = 3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
     * The block increment adjustment type.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
    public static final int BLOCK_INCREMENT     = 4;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
     * The absolute tracking adjustment type.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
    public static final int TRACK               = 5;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
     * The adjustable object that fired the event.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
     * @serial
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
     * @see #getAdjustable
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
    Adjustable adjustable;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
     * <code>value</code> will contain the new value of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
     * adjustable object.  This value will always be  in a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
     * range associated adjustable object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
     * @serial
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
     * @see #getValue
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
    int value;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
     * The <code>adjustmentType</code> describes how the adjustable
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
     * object value has changed.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
     * This value can be increased/decreased by a block or unit amount
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
     * where the block is associated with page increments/decrements,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
     * and a unit is associated with line increments/decrements.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
     * @serial
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
     * @see #getAdjustmentType
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
    int adjustmentType;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
     * The <code>isAdjusting</code> is true if the event is one
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
     * of the series of multiple adjustment events.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
     * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
     * @serial
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
     * @see #getValueIsAdjusting
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
    boolean isAdjusting;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
    /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
     * JDK 1.1 serialVersionUID
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
     private static final long serialVersionUID = 5700290645205279921L;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
     * Constructs an <code>AdjustmentEvent</code> object with the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
     * specified <code>Adjustable</code> source, event type,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
     * adjustment type, and value.
440
a3dac373f62d 6520716: event classes lack info about parameters
dav
parents: 2
diff changeset
   151
     * <p> This method throws an
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
     * <code>IllegalArgumentException</code> if <code>source</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
     * is <code>null</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
     *
440
a3dac373f62d 6520716: event classes lack info about parameters
dav
parents: 2
diff changeset
   155
     * @param source The <code>Adjustable</code> object where the
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
     *               event originated
440
a3dac373f62d 6520716: event classes lack info about parameters
dav
parents: 2
diff changeset
   157
     * @param id     An integer indicating the type of event.
a3dac373f62d 6520716: event classes lack info about parameters
dav
parents: 2
diff changeset
   158
     *                     For information on allowable values, see
a3dac373f62d 6520716: event classes lack info about parameters
dav
parents: 2
diff changeset
   159
     *                     the class description for {@link AdjustmentEvent}
a3dac373f62d 6520716: event classes lack info about parameters
dav
parents: 2
diff changeset
   160
     * @param type   An integer indicating the adjustment type.
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 value  The current value of the adjustment
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
     * @throws IllegalArgumentException if <code>source</code> is null
440
a3dac373f62d 6520716: event classes lack info about parameters
dav
parents: 2
diff changeset
   165
     * @see #getSource()
a3dac373f62d 6520716: event classes lack info about parameters
dav
parents: 2
diff changeset
   166
     * @see #getID()
a3dac373f62d 6520716: event classes lack info about parameters
dav
parents: 2
diff changeset
   167
     * @see #getAdjustmentType()
a3dac373f62d 6520716: event classes lack info about parameters
dav
parents: 2
diff changeset
   168
     * @see #getValue()
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
    public AdjustmentEvent(Adjustable source, int id, int type, int value) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
        this(source, id, type, value, false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
     * Constructs an <code>AdjustmentEvent</code> object with the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
     * specified Adjustable source, event type, adjustment type, and value.
440
a3dac373f62d 6520716: event classes lack info about parameters
dav
parents: 2
diff changeset
   177
     * <p> This method throws an
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
     * <code>IllegalArgumentException</code> if <code>source</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
     * is <code>null</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
     *
440
a3dac373f62d 6520716: event classes lack info about parameters
dav
parents: 2
diff changeset
   181
     * @param source The <code>Adjustable</code> object where the
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
     *               event originated
440
a3dac373f62d 6520716: event classes lack info about parameters
dav
parents: 2
diff changeset
   183
     * @param id     An integer indicating the type of event.
a3dac373f62d 6520716: event classes lack info about parameters
dav
parents: 2
diff changeset
   184
     *                     For information on allowable values, see
a3dac373f62d 6520716: event classes lack info about parameters
dav
parents: 2
diff changeset
   185
     *                     the class description for {@link AdjustmentEvent}
a3dac373f62d 6520716: event classes lack info about parameters
dav
parents: 2
diff changeset
   186
     * @param type   An integer indicating the adjustment type.
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 value  The current value of the adjustment
a3dac373f62d 6520716: event classes lack info about parameters
dav
parents: 2
diff changeset
   190
     * @param isAdjusting A boolean that equals <code>true</code> if the event is one
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
     *               of a series of multiple adjusting events,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
     *               otherwise <code>false</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
     * @throws IllegalArgumentException if <code>source</code> is null
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
     * @since 1.4
440
a3dac373f62d 6520716: event classes lack info about parameters
dav
parents: 2
diff changeset
   195
     * @see #getSource()
a3dac373f62d 6520716: event classes lack info about parameters
dav
parents: 2
diff changeset
   196
     * @see #getID()
a3dac373f62d 6520716: event classes lack info about parameters
dav
parents: 2
diff changeset
   197
     * @see #getAdjustmentType()
a3dac373f62d 6520716: event classes lack info about parameters
dav
parents: 2
diff changeset
   198
     * @see #getValue()
a3dac373f62d 6520716: event classes lack info about parameters
dav
parents: 2
diff changeset
   199
     * @see #getValueIsAdjusting()
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
    public AdjustmentEvent(Adjustable source, int id, int type, int value, boolean isAdjusting) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
        super(source, id);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
        adjustable = source;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
        this.adjustmentType = type;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
        this.value = value;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
        this.isAdjusting = isAdjusting;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
     * Returns the <code>Adjustable</code> object where this event originated.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
     * @return the <code>Adjustable</code> object where this event originated
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
    public Adjustable getAdjustable() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
        return adjustable;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
     * Returns the current value in the adjustment event.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
     * @return the current value in the adjustment event
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
    public int getValue() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
        return value;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
     * Returns the type of adjustment which caused the value changed
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
     * event.  It will have one of the following values:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
     * <ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
     * <li>{@link #UNIT_INCREMENT}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
     * <li>{@link #UNIT_DECREMENT}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
     * <li>{@link #BLOCK_INCREMENT}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
     * <li>{@link #BLOCK_DECREMENT}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
     * <li>{@link #TRACK}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
     * </ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
     * @return one of the adjustment values listed above
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
    public int getAdjustmentType() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
        return adjustmentType;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
     * Returns <code>true</code> if this is one of multiple
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
     * adjustment events.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
     * @return <code>true</code> if this is one of multiple
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
     *         adjustment events, otherwise returns <code>false</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
     * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
    public boolean getValueIsAdjusting() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
        return isAdjusting;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
    public String paramString() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
        String typeStr;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
        switch(id) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
          case ADJUSTMENT_VALUE_CHANGED:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
              typeStr = "ADJUSTMENT_VALUE_CHANGED";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
              break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
          default:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
              typeStr = "unknown type";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
        String adjTypeStr;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
        switch(adjustmentType) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
          case UNIT_INCREMENT:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
              adjTypeStr = "UNIT_INCREMENT";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
              break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
          case UNIT_DECREMENT:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
              adjTypeStr = "UNIT_DECREMENT";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
              break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
          case BLOCK_INCREMENT:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
              adjTypeStr = "BLOCK_INCREMENT";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
              break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
          case BLOCK_DECREMENT:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
              adjTypeStr = "BLOCK_DECREMENT";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
              break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
          case TRACK:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
              adjTypeStr = "TRACK";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
              break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
          default:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
              adjTypeStr = "unknown type";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
        return typeStr
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
            + ",adjType="+adjTypeStr
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
            + ",value="+value
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
            + ",isAdjusting="+isAdjusting;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
}