File: AbstractButtonAction.java

package info (click to toggle)
libswidgets-java 0.1.4-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k, lenny, squeeze
  • size: 356 kB
  • ctags: 667
  • sloc: java: 3,436; xml: 64; makefile: 11
file content (104 lines) | stat: -rw-r--r-- 2,779 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
// $Id: AbstractButtonAction.java,v 1.1 2004/11/03 18:30:04 bobtarling Exp $

/*
 * AbstractButtonAction.java
 *
 * Created on 02 March 2003, 00:26
 */

package org.tigris.swidgets;

import javax.swing.AbstractAction;
import javax.swing.Icon;

/**
 *
 * @author Bob Tarling
 */
public abstract class AbstractButtonAction
    extends AbstractAction
    implements ButtonAction
{
    
    private boolean modal;
    private int lockMethod = NONE;
    
    /**
     * Possible ways in which a user can lock a button: <code>NONE</code>
     */
    public static final int NONE = 0;
    
    /**
     * Possible ways in which a user can lock a button:
     *  <code>DOUBLE_CLICK</code>
     */
    public static final int DOUBLE_CLICK = 1;
    
    /**
     * Creates a new instance of AbstractButtonAction
     *
     * @param name the name of the action
     * @param icon the icon for the action
     */
    public AbstractButtonAction(String name, Icon icon) {
        super(name, icon);
    }

    /**
     * Creates a new instance of AbstractButtonAction
     *
     * @param name the name of the action
     * @param icon the icon of the action
     * @param isModal modal = the user is obliged to answer this action 
     *              before doing anything else
     */
    public AbstractButtonAction(String name, Icon icon, boolean isModal) {
        super(name, icon);
        this.modal = isModal;
    }

    /**
     * Creates a new instance of AbstractButtonAction
     *
     * @param name the name of the action
     * @param icon the icon of the action
     * @param isModal modal = the user is obliged to answer this action 
     *              before doing anything else
     * @param theLockMethod purpose: action buttons can remain depressed 
     *                      so that they can be used multiple times
     */
    public AbstractButtonAction(String name, Icon icon,
				boolean isModal, int theLockMethod) {
        super(name, icon);
        this.modal = isModal;
        this.lockMethod = theLockMethod;
    }
    
    /**
     * @see org.argouml.swingext.ButtonAction#setModal(boolean)
     */
    public void setModal(boolean isModal) {
        this.modal = isModal;
    }
    
    /**
     * @see org.argouml.swingext.ButtonAction#isModal()
     */
    public boolean isModal() {
        return modal;
    }
    
    /**
     * @see org.argouml.swingext.ButtonAction#setLockMethod(int)
     */
    public void setLockMethod(int theLockMethod) {
        this.lockMethod = theLockMethod;
    }
    
    /**
     * @see org.argouml.swingext.ButtonAction#getLockMethod()
     */
    public int getLockMethod() {
        return lockMethod;
    }
}