Source Code Cross Referenced for TimeZoneDialog.java in  » Report » iReport-2.0.5 » it » businesslogic » ireport » gui » locale » 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 » Report » iReport 2.0.5 » it.businesslogic.ireport.gui.locale 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright (C) 2005 - 2008 JasperSoft Corporation.  All rights reserved. 
003:         * http://www.jaspersoft.com.
004:         *
005:         * Unless you have purchased a commercial license agreement from JasperSoft,
006:         * the following license terms apply:
007:         *
008:         * This program is free software; you can redistribute it and/or modify
009:         * it under the terms of the GNU General Public License version 2 as published by
010:         * the Free Software Foundation.
011:         *
012:         * This program is distributed WITHOUT ANY WARRANTY; and without the
013:         * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
014:         * See the GNU General Public License for more details.
015:         *
016:         * You should have received a copy of the GNU General Public License
017:         * along with this program; if not, see http://www.gnu.org/licenses/gpl.txt
018:         * or write to:
019:         *
020:         * Free Software Foundation, Inc.,
021:         * 59 Temple Place - Suite 330,
022:         * Boston, MA  USA  02111-1307
023:         *
024:         *
025:         *
026:         *
027:         * TimeZoneDialog.java
028:         * 
029:         * Created on 17 novembre 2004, 1.07
030:         *
031:         */
032:
033:        package it.businesslogic.ireport.gui.locale;
034:
035:        import it.businesslogic.ireport.util.I18n;
036:        import java.util.Vector;
037:
038:        /**
039:         * 
040:         * @author  Administrator
041:         */
042:        public class TimeZoneDialog extends javax.swing.JDialog {
043:
044:            private int dialogResult = javax.swing.JOptionPane.CANCEL_OPTION;
045:
046:            private String reportTimeZoneId = null;
047:
048:            /** Creates new form NewLocaleFileDialog */
049:            public TimeZoneDialog(java.awt.Dialog parent, boolean modal) {
050:                super (parent, modal);
051:                initAll();
052:            }
053:
054:            public TimeZoneDialog(java.awt.Frame parent, boolean modal) {
055:                super (parent, modal);
056:                initAll();
057:            }
058:
059:            public void initAll() {
060:                initComponents();
061:
062:                String[] tzids = java.util.TimeZone.getAvailableIDs();
063:
064:                java.util.Arrays.sort(tzids);
065:
066:                Vector v = new Vector();
067:                v.add(I18n.getString("timezone.default", "Default"));
068:                for (int i = 0; i < tzids.length; ++i) {
069:                    java.util.TimeZone tz = java.util.TimeZone
070:                            .getTimeZone(tzids[i]);
071:                    v.add(new TimeZoneWrapper(tz));
072:                }
073:
074:                jListTimeZones.setListData(v);
075:
076:                jListTimeZones.setSelectedIndex(0);
077:
078:                it.businesslogic.ireport.util.Misc.centerFrame(this );
079:
080:                javax.swing.KeyStroke escape = javax.swing.KeyStroke
081:                        .getKeyStroke(java.awt.event.KeyEvent.VK_ESCAPE, 0,
082:                                false);
083:                javax.swing.Action escapeAction = new javax.swing.AbstractAction() {
084:                    public void actionPerformed(java.awt.event.ActionEvent e) {
085:                        jButton2ActionPerformed(e);
086:                    }
087:                };
088:
089:                getRootPane().getInputMap(
090:                        javax.swing.JComponent.WHEN_IN_FOCUSED_WINDOW).put(
091:                        escape, "ESCAPE");
092:                getRootPane().getActionMap().put("ESCAPE", escapeAction);
093:
094:                applyI18n();
095:                //to make the default button ...
096:                this .getRootPane().setDefaultButton(this .jButton1);
097:            }
098:
099:            public int getDialogResult() {
100:                return dialogResult;
101:            }
102:
103:            public void setDialogResult(int dialogResult) {
104:                this .dialogResult = dialogResult;
105:            }
106:
107:            public String getReportTimeZoneId() {
108:                return reportTimeZoneId;
109:            }
110:
111:            /** This method is called from within the constructor to
112:             * initialize the form.
113:             * WARNING: Do NOT modify this code. The content of this method is
114:             * always regenerated by the Form Editor.
115:             */
116:            // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
117:            private void initComponents() {
118:                java.awt.GridBagConstraints gridBagConstraints;
119:
120:                jPanel2 = new javax.swing.JPanel();
121:                jScrollPane1 = new javax.swing.JScrollPane();
122:                jListTimeZones = new javax.swing.JList();
123:                jPanel1 = new javax.swing.JPanel();
124:                jButton1 = new javax.swing.JButton();
125:                jButton2 = new javax.swing.JButton();
126:
127:                getContentPane().setLayout(new java.awt.GridBagLayout());
128:
129:                setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
130:                jPanel2.setLayout(new java.awt.GridBagLayout());
131:
132:                jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder(
133:                        javax.swing.BorderFactory.createEtchedBorder(),
134:                        "Time Zone",
135:                        javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,
136:                        javax.swing.border.TitledBorder.DEFAULT_POSITION,
137:                        new java.awt.Font("Dialog", 0, 11)));
138:                jPanel2.setMinimumSize(new java.awt.Dimension(350, 80));
139:                jPanel2.setPreferredSize(new java.awt.Dimension(400, 300));
140:                jListTimeZones
141:                        .addListSelectionListener(new javax.swing.event.ListSelectionListener() {
142:                            public void valueChanged(
143:                                    javax.swing.event.ListSelectionEvent evt) {
144:                                jListTimeZonesValueChanged(evt);
145:                            }
146:                        });
147:
148:                jScrollPane1.setViewportView(jListTimeZones);
149:
150:                gridBagConstraints = new java.awt.GridBagConstraints();
151:                gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
152:                gridBagConstraints.weightx = 1.0;
153:                gridBagConstraints.weighty = 1.0;
154:                jPanel2.add(jScrollPane1, gridBagConstraints);
155:
156:                gridBagConstraints = new java.awt.GridBagConstraints();
157:                gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
158:                gridBagConstraints.ipadx = 4;
159:                gridBagConstraints.ipady = 4;
160:                gridBagConstraints.weightx = 1.0;
161:                gridBagConstraints.weighty = 1.0;
162:                gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);
163:                getContentPane().add(jPanel2, gridBagConstraints);
164:
165:                jPanel1.setLayout(new java.awt.GridBagLayout());
166:
167:                jButton1.setText("OK");
168:                jButton1.setEnabled(false);
169:                jButton1.addActionListener(new java.awt.event.ActionListener() {
170:                    public void actionPerformed(java.awt.event.ActionEvent evt) {
171:                        jButton1ActionPerformed(evt);
172:                    }
173:                });
174:
175:                gridBagConstraints = new java.awt.GridBagConstraints();
176:                gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
177:                gridBagConstraints.weightx = 1.0;
178:                gridBagConstraints.insets = new java.awt.Insets(4, 0, 4, 4);
179:                jPanel1.add(jButton1, gridBagConstraints);
180:
181:                jButton2.setText("Cancel");
182:                jButton2.addActionListener(new java.awt.event.ActionListener() {
183:                    public void actionPerformed(java.awt.event.ActionEvent evt) {
184:                        jButton2ActionPerformed(evt);
185:                    }
186:                });
187:
188:                gridBagConstraints = new java.awt.GridBagConstraints();
189:                gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
190:                gridBagConstraints.insets = new java.awt.Insets(4, 0, 4, 4);
191:                jPanel1.add(jButton2, gridBagConstraints);
192:
193:                gridBagConstraints = new java.awt.GridBagConstraints();
194:                gridBagConstraints.gridx = 0;
195:                gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
196:                gridBagConstraints.weightx = 1.0;
197:                getContentPane().add(jPanel1, gridBagConstraints);
198:
199:                pack();
200:            }// </editor-fold>//GEN-END:initComponents
201:
202:            private void jListTimeZonesValueChanged(
203:                    javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_jListTimeZonesValueChanged
204:
205:                if (jListTimeZones.getSelectedIndex() >= 0)
206:                    jButton1.setEnabled(true);
207:
208:            }//GEN-LAST:event_jListTimeZonesValueChanged
209:
210:            private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
211:                this .setDialogResult(javax.swing.JOptionPane.CANCEL_OPTION);
212:                this .setVisible(false);
213:                this .dispose();
214:            }//GEN-LAST:event_jButton2ActionPerformed
215:
216:            private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
217:
218:                if (jListTimeZones.getSelectedIndex() <= 0) {
219:                    this .reportTimeZoneId = null;
220:                } else {
221:                    this .reportTimeZoneId = ((TimeZoneWrapper) jListTimeZones
222:                            .getSelectedValue()).getTimeZone().getID();
223:                }
224:
225:                this .setDialogResult(javax.swing.JOptionPane.OK_OPTION);
226:
227:                this .setVisible(false);
228:                this .dispose();
229:            }//GEN-LAST:event_jButton1ActionPerformed
230:
231:            public void setReportTimeZoneId(String reportTimeZoneId) {
232:                this .reportTimeZoneId = reportTimeZoneId;
233:
234:                for (int i = 1; i < jListTimeZones.getModel().getSize(); ++i) {
235:                    TimeZoneWrapper tzw = (TimeZoneWrapper) jListTimeZones
236:                            .getModel().getElementAt(i);
237:                    if (tzw.getTimeZone().getID().equals(reportTimeZoneId)) {
238:                        jListTimeZones.setSelectedIndex(i);
239:                        jListTimeZones.ensureIndexIsVisible(i);
240:                        return;
241:                    }
242:                }
243:
244:                if (jListTimeZones.getModel().getSize() > 0)
245:                    jListTimeZones.setSelectedIndex(0);
246:            }
247:
248:            // Variables declaration - do not modify//GEN-BEGIN:variables
249:            private javax.swing.JButton jButton1;
250:            private javax.swing.JButton jButton2;
251:            private javax.swing.JList jListTimeZones;
252:            private javax.swing.JPanel jPanel1;
253:            private javax.swing.JPanel jPanel2;
254:            private javax.swing.JScrollPane jScrollPane1;
255:
256:            // End of variables declaration//GEN-END:variables
257:
258:            public void applyI18n() {
259:                // Start autogenerated code ----------------------
260:                jButton1
261:                        .setText(I18n.getString("timeZoneDialog.button1", "OK"));
262:                jButton2.setText(I18n.getString("timeZoneDialog.button2",
263:                        "Cancel"));
264:                // End autogenerated code ----------------------
265:                ((javax.swing.border.TitledBorder) jPanel2.getBorder())
266:                        .setTitle(it.businesslogic.ireport.util.I18n.getString(
267:                                "timeZoneDialog.panelBorder.TimeZone",
268:                                "Time Zone"));
269:
270:                jButton1.setMnemonic(I18n.getString(
271:                        "timeZoneDialog.button1Mnemonic", "o").charAt(0));
272:                jButton2.setMnemonic(I18n.getString(
273:                        "timeZoneDialog.button2Mnemonic", "c").charAt(0));
274:            }
275:
276:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.