Subversion Repositories public

Rev

Rev 93 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 93 Rev 94
Line 1... Line 1...
1
/*
1
/*
2
 * TaskPropetiesDialog.java
2
 * TaskPropertiesDialog.java - task properties dialog
3
 *
3
 *
-
 
4
 * Copyright (c) 2008 Lukas Jelinek, http://www.aiken.cz
-
 
5
 *
-
 
6
 * ==========================================================================
-
 
7
 *
-
 
8
 * This program is free software; you can redistribute it and/or modify
-
 
9
 * it under the terms of the GNU General Public License Version 2 as
4
 * Created on 3. kv├Čten 2008, 20:16
10
 * published by the Free Software Foundation.
-
 
11
 *
-
 
12
 * This program is distributed in the hope that it will be useful,
-
 
13
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
-
 
14
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-
 
15
 * GNU General Public License for more details.
-
 
16
 *
-
 
17
 * You should have received a copy of the GNU General Public License
-
 
18
 * along with this program; if not, write to the Free Software
-
 
19
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-
 
20
 *
-
 
21
 * ==========================================================================
5
 */
22
 */
6
23
7
package cz.aiken.util.lwtt;
24
package cz.aiken.util.lwtt;
8
25
9
import javax.swing.JOptionPane;
26
import javax.swing.JOptionPane;
10
27
11
/**
28
/**
-
 
29
 * Task properties dialog class.
12
 *
30
 *
-
 
31
 * This class allows to set various properties of a task. Currently only
-
 
32
 * price per hour can be set.
-
 
33
 *
13
 * @author  luk
34
 * @author  luk
14
 */
35
 */
15
public class TaskPropetiesDialog extends javax.swing.JDialog {
36
public class TaskPropetiesDialog extends javax.swing.JDialog {
16
    /** A return status code - returned if Cancel button has been pressed */
37
    /** A return status code - returned if Cancel button has been pressed */
17
    public static final int RET_CANCEL = 0;
38
    public static final int RET_CANCEL = 0;
18
    /** A return status code - returned if OK button has been pressed */
39
    /** A return status code - returned if OK button has been pressed */
19
    public static final int RET_OK = 1;
40
    public static final int RET_OK = 1;
20
   
41
   
21
    private double price = 1;
42
    private double price = 1;
22
43
23
    /** Creates new form TaskPropetiesDialog */
44
    /** Creates a new TaskPropetiesDialog.
-
 
45
     * @param parent parent object for this dialog
-
 
46
     * @param modal modal dialog yes/no
-
 
47
     */
24
    public TaskPropetiesDialog(java.awt.Frame parent, boolean modal) {
48
    public TaskPropetiesDialog(java.awt.Frame parent, boolean modal) {
25
        super(parent, modal);
49
        super(parent, modal);
26
        initComponents();
50
        initComponents();
27
        priceText.setText(Double.toString(price));
51
        priceText.setText(Double.toString(price));
28
    }
52
    }
29
53
-
 
54
    /**
30
    /** @return the return status of this dialog - one of RET_OK or RET_CANCEL */
55
     * Returns the "return status" of this dialog - one of RET_OK or RET_CANCEL.
-
 
56
     *
-
 
57
     * @return return status
-
 
58
     */
31
    public int getReturnStatus() {
59
    public int getReturnStatus() {
32
        return returnStatus;
60
        return returnStatus;
33
    }
61
    }
34
   
62
   
-
 
63
    /**
-
 
64
     * Sets the price per hour.
-
 
65
     *
-
 
66
     * @param price new price per hour
-
 
67
     */
35
    public void setPrice(double price) {
68
    public void setPrice(double price) {
36
        this.price = price;
69
        this.price = price;
37
        priceText.setText(Double.toString(price));
70
        priceText.setText(Double.toString(price));
38
    }
71
    }
39
   
72
   
-
 
73
    /**
-
 
74
     * Returns the price per hour.
-
 
75
     *
-
 
76
     * @return price per hour
-
 
77
     */
40
    public double getPrice() {
78
    public double getPrice() {
41
        return price;
79
        return price;
42
    }
80
    }
43
           
81
           
44
82
Line 146... Line 184...
146
        setVisible(false);
184
        setVisible(false);
147
        dispose();
185
        dispose();
148
    }
186
    }
149
187
150
    /**
188
    /**
-
 
189
     * This method is only for testing purposes.
-
 
190
     *
151
    * @param args the command line arguments
191
     * @param args the command line arguments
152
    */
192
     */
153
    public static void main(String args[]) {
193
    public static void main(String args[]) {
154
        java.awt.EventQueue.invokeLater(new Runnable() {
194
        java.awt.EventQueue.invokeLater(new Runnable() {
155
            public void run() {
195
            public void run() {
156
                TaskPropetiesDialog dialog = new TaskPropetiesDialog(new javax.swing.JFrame(), true);
196
                TaskPropetiesDialog dialog = new TaskPropetiesDialog(new javax.swing.JFrame(), true);
157
                dialog.addWindowListener(new java.awt.event.WindowAdapter() {
197
                dialog.addWindowListener(new java.awt.event.WindowAdapter() {
-
 
198
                    @Override
158
                    public void windowClosing(java.awt.event.WindowEvent e) {
199
                    public void windowClosing(java.awt.event.WindowEvent e) {
159
                        System.exit(0);
200
                        System.exit(0);
160
                    }
201
                    }
161
                });
202
                });
162
                dialog.setVisible(true);
203
                dialog.setVisible(true);