KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > ca > mcgill > sable > soot > ui > BooleanOptionWidget


1 /* Soot - a J*va Optimization Framework
2  * Copyright (C) 2003 Jennifer Lhotak
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */

19
20 package ca.mcgill.sable.soot.ui;
21
22 import java.util.*;
23 import org.eclipse.swt.widgets.*;
24 import org.eclipse.swt.*;
25
26 public class BooleanOptionWidget implements ISootOptionWidget {
27
28     private Button button;
29     private String JavaDoc alias;
30     private String JavaDoc labelText;
31     private Composite dialogParent;
32     private OptionData data;
33
34     
35     public BooleanOptionWidget(Composite parent, int style,
36      OptionData data){
37         
38         setAlias(data.getRealAlias());
39         setData(data);
40         
41         setButton(new Button(parent, SWT.CHECK));
42         
43         getButton().setSelection(data.isDefaultVal());
44         getButton().setText(data.getText());
45         getButton().setToolTipText(data.getTooltip().trim());
46         
47     }
48     
49     public ArrayList getControls() {
50         ArrayList controls = new ArrayList();
51         controls.add(getButton());
52         return controls;
53     }
54     
55     public String JavaDoc getId(){
56         return getAlias();
57     }
58     
59
60     /**
61      * Returns the button.
62      * @return Button
63      */

64     public Button getButton() {
65         return button;
66     }
67
68     /**
69      * Sets the button.
70      * @param button The button to set
71      */

72     public void setButton(Button button) {
73         this.button = button;
74     }
75
76     /**
77      * Returns the alias.
78      * @return String
79      */

80     public String JavaDoc getAlias() {
81         return alias;
82     }
83
84     /**
85      * Sets the alias.
86      * @param alias The alias to set
87      */

88     public void setAlias(String JavaDoc alias) {
89         this.alias = alias;
90     }
91
92     /**
93      * Returns the labelText.
94      * @return String
95      */

96     public String JavaDoc getLabelText() {
97         return labelText;
98     }
99
100     /**
101      * Sets the labelText.
102      * @param labelText The labelText to set
103      */

104     public void setLabelText(String JavaDoc labelText) {
105         this.labelText = labelText;
106     }
107
108     /**
109      * @return
110      */

111     public OptionData getData() {
112         return data;
113     }
114
115     /**
116      * @param data
117      */

118     public void setData(OptionData data) {
119         this.data = data;
120     }
121
122 }
123
Popular Tags