Source Code Cross Referenced for PopupOptionsView.java in  » Project-Management » borg » net » sf » borg » ui » popup » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Project Management » borg » net.sf.borg.ui.popup 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * This file is part of BORG.
003:         *
004:         * BORG is free software; you can redistribute it and/or modify it under the
005:         * terms of the GNU General Public License as published by the Free Software
006:         * Foundation; either version 2 of the License, or (at your option) any later
007:         * version.
008:         *
009:         * BORG is distributed in the hope that it will be useful, but WITHOUT ANY
010:         * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
011:         * A PARTICULAR PURPOSE. See the GNU General Public License for more details.
012:         *
013:         * You should have received a copy of the GNU General Public License along with
014:         * BORG; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
015:         * Suite 330, Boston, MA 02111-1307 USA
016:         *
017:         * Copyright 2003 by Mike Berger
018:         */
019:
020:        package net.sf.borg.ui.popup;
021:
022:        import java.awt.GridBagConstraints;
023:        import java.awt.GridBagLayout;
024:        import java.awt.Insets;
025:        import java.awt.event.ActionEvent;
026:        import java.awt.event.ActionListener;
027:        import java.awt.event.KeyEvent;
028:
029:        import javax.swing.ImageIcon;
030:        import javax.swing.JButton;
031:        import javax.swing.JCheckBox;
032:        import javax.swing.JComponent;
033:        import javax.swing.JDialog;
034:        import javax.swing.JLabel;
035:        import javax.swing.JPanel;
036:        import javax.swing.KeyStroke;
037:
038:        import net.sf.borg.common.Resource;
039:        import net.sf.borg.model.ReminderTimes;
040:        import net.sf.borg.ui.ResourceHelper;
041:        import net.sf.borg.ui.calendar.AppointmentPanel;
042:
043:        public class PopupOptionsView extends JDialog {
044:
045:            private javax.swing.JLabel jAlarmLabel;
046:            private javax.swing.JCheckBox[] alarmBoxes;
047:            private char[] remtimes_;
048:            private AppointmentPanel appPanel_;
049:            private JPanel jPanel = null;
050:            private JPanel checkpanel = null;
051:            private JPanel buttonPanel = null;
052:            private JButton saveButton = null;
053:            private JButton dismissButton = null;
054:            private JButton clearButton = null;
055:            private JButton allButton = null;
056:
057:            public PopupOptionsView(char[] remtimes, AppointmentPanel appPanel) {
058:                super ();
059:
060:                initialize();
061:
062:                ResourceHelper.setTitle(this , "Popup_Times");
063:                appPanel_ = appPanel;
064:                remtimes_ = remtimes;
065:
066:                jAlarmLabel = new JLabel();
067:                ResourceHelper.setText(jAlarmLabel, "custom_times_header");
068:                jAlarmLabel.setText(jAlarmLabel.getText() + " '"
069:                        + appPanel_.getText() + "'");
070:                alarmBoxes = new JCheckBox[ReminderTimes.getNum()];
071:                for (int i = 0; i < ReminderTimes.getNum(); ++i) {
072:                    alarmBoxes[i] = new JCheckBox(minutes_string(i));
073:                }
074:
075:                checkpanel = getCheckpanel();
076:                checkpanel.add(jAlarmLabel, new GridBagConstraints(0, 0, 2, 1,
077:                        0.0, 0.0, GridBagConstraints.CENTER,
078:                        GridBagConstraints.BOTH, new Insets(4, 4, 4, 4), 0, 0));
079:
080:                int colht = alarmBoxes.length / 2;
081:                for (int i = 0; i < colht; ++i) {
082:                    checkpanel.add(alarmBoxes[i], new GridBagConstraints(0,
083:                            i + 1, 1, 1, 0.0, 0.0, GridBagConstraints.WEST,
084:                            GridBagConstraints.BOTH, new Insets(4, 4, 4, 4), 0,
085:                            0));
086:
087:                    if (remtimes_[i] == 'Y') {
088:                        alarmBoxes[i].setSelected(true);
089:                    } else {
090:                        alarmBoxes[i].setSelected(false);
091:                    }
092:                }
093:
094:                for (int i = colht; i < alarmBoxes.length; ++i) {
095:                    checkpanel.add(alarmBoxes[i], new GridBagConstraints(1, i
096:                            - colht + 1, 1, 1, 0.0, 0.0,
097:                            GridBagConstraints.WEST, GridBagConstraints.BOTH,
098:                            new Insets(4, 4, 4, 4), 0, 0));
099:                    if (remtimes_[i] == 'Y') {
100:                        alarmBoxes[i].setSelected(true);
101:                    } else {
102:                        alarmBoxes[i].setSelected(false);
103:                    }
104:                }
105:
106:                pack();
107:
108:                this .setModal(true);
109:                //manageMySize(PrefName.POPVIEWSIZE);
110:
111:            }
112:
113:            /**
114:             * This method initializes this
115:             *
116:             * @return void
117:             */
118:            private void initialize() {
119:                this .setContentPane(getJPanel());
120:            }
121:
122:            public void destroy() {
123:                this .dispose();
124:            }
125:
126:            public void refresh() {
127:            }
128:
129:            private void saveButtonClicked(java.awt.event.ActionEvent evt) {
130:                for (int i = 0; i < ReminderTimes.getNum(); ++i) {
131:                    if (alarmBoxes[i].isSelected()) {
132:                        remtimes_[i] = 'Y';
133:                    } else {
134:                        remtimes_[i] = 'N';
135:                    }
136:
137:                }
138:
139:                appPanel_.setPopupTimesString();
140:                this .dispose();
141:            }
142:
143:            private void cancelButtonClicked(java.awt.event.ActionEvent evt) {
144:                this .dispose();
145:            }
146:
147:            private String minutes_string(int i) {
148:                int j = ReminderTimes.getTimes(i);
149:                int jj = (j >= 0 ? j : -j);
150:                int k = jj / 60;
151:                int l = jj % 60;
152:                String minStr;
153:                String hrStr;
154:                String minute = Resource.getResourceString("Minute");
155:                String minutes = Resource.getResourceString("Minutes");
156:                String hour = Resource.getResourceString("Hour");
157:                String hours = Resource.getResourceString("Hours");
158:                String before = Resource.getResourceString("Before");
159:                String after = Resource.getResourceString("After");
160:
161:                if (k > 1) {
162:                    hrStr = k + " " + hours;
163:                } else if (k > 0) {
164:                    hrStr = k + " " + hour;
165:                } else {
166:                    hrStr = "";
167:                }
168:
169:                if (l > 1) {
170:                    minStr = l + " " + minutes;
171:                } else if (l > 0) {
172:                    minStr = l + " " + minute;
173:                } else if (k >= 1) {
174:                    minStr = "";
175:                } else {
176:                    minStr = l + " " + minutes;
177:                }
178:
179:                if (!hrStr.equals("") && !minStr.equals(""))
180:                    minStr = " " + minStr;
181:
182:                String bef_aft;
183:                if (j > 0) {
184:                    bef_aft = " " + before;
185:                } else if (j == 0) {
186:                    bef_aft = "";
187:                } else {
188:                    bef_aft = " " + after;
189:                }
190:
191:                return hrStr + minStr + bef_aft;
192:            }
193:
194:            /**
195:             * This method initializes jPanel
196:             *
197:             * @return javax.swing.JPanel
198:             */
199:            private JPanel getJPanel() {
200:                if (jPanel == null) {
201:
202:                    jPanel = new JPanel();
203:                    jPanel.setLayout(new GridBagLayout());
204:                    GridBagConstraints gridBagConstraints6 = new GridBagConstraints();
205:                    GridBagConstraints gridBagConstraints5 = new GridBagConstraints();
206:                    gridBagConstraints5.gridx = 0;
207:                    gridBagConstraints5.gridy = 0;
208:                    gridBagConstraints5.insets = new java.awt.Insets(4, 4, 4, 4);
209:                    gridBagConstraints5.fill = java.awt.GridBagConstraints.BOTH;
210:                    gridBagConstraints5.weightx = 1.0D;
211:                    gridBagConstraints5.weighty = 1.0D;
212:                    gridBagConstraints6.gridx = 0;
213:                    gridBagConstraints6.gridy = 1;
214:                    gridBagConstraints6.weighty = 1.0D;
215:                    gridBagConstraints6.insets = new java.awt.Insets(4, 4, 4, 4);
216:                    gridBagConstraints6.fill = java.awt.GridBagConstraints.BOTH;
217:                    jPanel.add(getCheckpanel(), gridBagConstraints5);
218:                    jPanel.add(getButtonPanel(), gridBagConstraints6);
219:
220:                }
221:                return jPanel;
222:            }
223:
224:            /**
225:             * This method initializes checkpanel
226:             *
227:             * @return javax.swing.JPanel
228:             */
229:            private JPanel getCheckpanel() {
230:                if (checkpanel == null) {
231:                    checkpanel = new JPanel();
232:                    checkpanel.setLayout(new GridBagLayout());
233:                }
234:                return checkpanel;
235:            }
236:
237:            /**
238:             * This method initializes jPanel2
239:             *
240:             * @return javax.swing.JPanel
241:             */
242:            private JPanel getButtonPanel() {
243:                if (buttonPanel == null) {
244:                    buttonPanel = new JPanel();
245:                    buttonPanel.add(getSaveButton(), null);
246:                    buttonPanel.add(getClearButton(), null); // Generated
247:                    buttonPanel.add(getAllButton(), null); // Generated
248:                    buttonPanel.add(getJButton1(), null);
249:                }
250:                return buttonPanel;
251:            }
252:
253:            /**
254:             * This method initializes saveButton
255:             *
256:             * @return javax.swing.JButton
257:             */
258:            private JButton getSaveButton() {
259:                if (saveButton == null) {
260:                    saveButton = new JButton();
261:                    ResourceHelper.setText(saveButton, "Save");
262:                    saveButton.setIcon(new ImageIcon(getClass().getResource(
263:                            "/resource/Save16.gif")));
264:                    saveButton
265:                            .addActionListener(new java.awt.event.ActionListener() {
266:                                public void actionPerformed(
267:                                        java.awt.event.ActionEvent evt) {
268:                                    saveButtonClicked(evt);
269:                                }
270:                            });
271:                }
272:                return saveButton;
273:            }
274:
275:            /**
276:             * This method initializes jButton1
277:             *
278:             * @return javax.swing.JButton
279:             */
280:            private JButton getJButton1() {
281:                if (dismissButton == null) {
282:                    dismissButton = new JButton();
283:                    ResourceHelper.setText(dismissButton, "Dismiss");
284:                    dismissButton.setIcon(new ImageIcon(getClass().getResource(
285:                            "/resource/Stop16.gif")));
286:                    dismissButton
287:                            .addActionListener(new java.awt.event.ActionListener() {
288:                                public void actionPerformed(
289:                                        java.awt.event.ActionEvent evt) {
290:                                    cancelButtonClicked(evt);
291:                                }
292:                            });
293:                    getRootPane().registerKeyboardAction(new ActionListener() {
294:                        public final void actionPerformed(ActionEvent e) {
295:                            cancelButtonClicked(e);
296:                        }
297:                    }, KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0),
298:                            JComponent.WHEN_IN_FOCUSED_WINDOW);
299:                }
300:                return dismissButton;
301:            }
302:
303:            /**
304:             * This method initializes clearButton	
305:             * 	
306:             * @return javax.swing.JButton	
307:             */
308:            private JButton getClearButton() {
309:                if (clearButton == null) {
310:                    clearButton = new JButton();
311:                    ResourceHelper.setText(clearButton, "clear_all");
312:                    clearButton
313:                            .addActionListener(new java.awt.event.ActionListener() {
314:                                public void actionPerformed(
315:                                        java.awt.event.ActionEvent e) {
316:                                    for (int i = 0; i < ReminderTimes.getNum(); ++i) {
317:                                        alarmBoxes[i].setSelected(false);
318:                                    }
319:                                }
320:                            });
321:                }
322:                return clearButton;
323:            }
324:
325:            /**
326:             * This method initializes allButton	
327:             * 	
328:             * @return javax.swing.JButton	
329:             */
330:            private JButton getAllButton() {
331:                if (allButton == null) {
332:                    allButton = new JButton();
333:                    ResourceHelper.setText(allButton, "select_all");
334:                    allButton
335:                            .addActionListener(new java.awt.event.ActionListener() {
336:                                public void actionPerformed(
337:                                        java.awt.event.ActionEvent e) {
338:                                    for (int i = 0; i < ReminderTimes.getNum(); ++i) {
339:                                        alarmBoxes[i].setSelected(true);
340:                                    }
341:                                }
342:                            });
343:                }
344:                return allButton;
345:            }
346:        } //  @jve:decl-index=0:visual-constraint="10,10"
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.