KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > info > monitorenter > gui > chart > events > Trace2DActionZindexDecrease


1 /*
2  * Trace2DActionZindexDecrease, action to decrease the z-Index of an ITrace2D.
3  * Copyright (C) Achim Westermann, created on 10.12.2004, 13:48:55
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18  *
19  * If you modify or optimize the code in a useful way please let me know.
20  * Achim.Westermann@gmx.de
21  *
22  */

23 package info.monitorenter.gui.chart.events;
24
25 import info.monitorenter.gui.chart.ITrace2D;
26
27 import java.awt.event.ActionEvent JavaDoc;
28 import java.beans.PropertyChangeEvent JavaDoc;
29
30 /**
31  * <code>Action</code> that decreases the <code>zIndex</code> of the
32  * constructor-given <code>ITrace2D</code> by a constructor-given integer.
33  * <p>
34  *
35  * @author <a HREF="mailto:Achim.Westermann@gmx.de">Achim Westermann </a>
36  *
37  * @version $Revision: 1.2 $
38  */

39 public final class Trace2DActionZindexDecrease extends ATrace2DAction {
40
41   /**
42    * Generated <code>serialVersionUID</code>.
43    */

44   private static final long serialVersionUID = 3978986583057707570L;
45
46   /**
47    * The decrement to the trace's zIndex.
48    */

49   private int m_decrease;
50
51   /**
52    * Create an <code>Action</code> that accesses the trace and identifies
53    * itself with the given action String.
54    * <p>
55    *
56    * @param trace
57    * the target the action will work on.
58    *
59    * @param description
60    * the descriptive <code>String</code> that will be displayed by
61    * {@link javax.swing.AbstractButton} subclasses that get this
62    * <code>Action</code> assigned (
63    * {@link javax.swing.AbstractButton#setAction(javax.swing.Action)}).
64    *
65    * @param decrease
66    * the increment to the trace's zIndex (see
67    * {@link ITrace2D#setZIndex(Integer)}).
68    */

69   public Trace2DActionZindexDecrease(final ITrace2D trace, final String JavaDoc description,
70       final int decrease) {
71     super(trace, description);
72     this.m_decrease = decrease;
73   }
74
75   /**
76    * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
77    */

78   public void actionPerformed(final ActionEvent JavaDoc e) {
79     int value = this.m_trace.getZIndex().intValue();
80     this.m_trace.setZIndex(new Integer JavaDoc(value - this.m_decrease));
81   }
82
83   /**
84    * @see java.beans.PropertyChangeListener#propertyChange(java.beans.PropertyChangeEvent)
85    */

86   public void propertyChange(final PropertyChangeEvent JavaDoc evt) {
87     // nop as this action will not be used
88
// by checkbox or radio button menu items that have a state.
89
}
90 }
91
Popular Tags