Source Code Cross Referenced for LocaleEditorDialog.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:         * LocaleEditorDialog.java
028:         * 
029:         * Created on 17 novembre 2004, 0.56
030:         *
031:         */
032:
033:        package it.businesslogic.ireport.gui.locale;
034:
035:        import org.syntax.jedit.*;
036:        import java.io.*;
037:        import it.businesslogic.ireport.util.I18n;
038:
039:        /**
040:         *
041:         * @author  Administrator
042:         */
043:        public class LocaleEditorDialog extends javax.swing.JDialog {
044:
045:            private JEditTextArea textArea;
046:            private File file = null;
047:
048:            /** Creates new form LocaleEditorDialog */
049:            public LocaleEditorDialog(java.awt.Frame parent, boolean modal) {
050:                super (parent, modal);
051:                initComponents();
052:                applyI18n();
053:                textArea = new JEditTextArea();
054:                textArea.getPainter().setLineHighlightColor(
055:                        java.awt.Color.WHITE);
056:                textArea.setDocument(new SyntaxDocument());
057:                textArea
058:                        .setTokenMarker(new org.syntax.jedit.tokenmarker.PropsTokenMarker());
059:
060:                java.awt.GridBagConstraints gridBagConstraints = new java.awt.GridBagConstraints();
061:                gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
062:                gridBagConstraints.gridx = 0;
063:                gridBagConstraints.gridy = 0;
064:                gridBagConstraints.weightx = 1.0;
065:                gridBagConstraints.weighty = 1.0;
066:                gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 0);
067:                textArea.setBorder(new javax.swing.border.BevelBorder(
068:                        javax.swing.border.BevelBorder.LOWERED));
069:                jPanel1.add(textArea, gridBagConstraints);
070:
071:                this .setSize(700, 600);
072:                it.businesslogic.ireport.util.Misc.centerFrame(this );
073:
074:                javax.swing.KeyStroke escape = javax.swing.KeyStroke
075:                        .getKeyStroke(java.awt.event.KeyEvent.VK_ESCAPE, 0,
076:                                false);
077:                javax.swing.Action escapeAction = new javax.swing.AbstractAction() {
078:                    public void actionPerformed(java.awt.event.ActionEvent e) {
079:                        jButtonCloseActionPerformed(e);
080:                    }
081:                };
082:
083:                getRootPane().getInputMap(
084:                        javax.swing.JComponent.WHEN_IN_FOCUSED_WINDOW).put(
085:                        escape, "ESCAPE");
086:                getRootPane().getActionMap().put("ESCAPE", escapeAction);
087:
088:                //to make the default button ...
089:                this .getRootPane().setDefaultButton(this .jButtonSave);
090:            }
091:
092:            public void setFile(File file) {
093:                this .file = file;
094:                String str = "";
095:
096:                try {
097:                    FileInputStream fis = new FileInputStream(file);
098:                    byte[] buffer = new byte[1024];
099:                    int read = 0;
100:                    while ((read = fis.read(buffer)) > 0) {
101:                        str += new String(buffer, 0, read);
102:                    }
103:                    fis.close();
104:                } catch (Exception ex) {
105:                }
106:                textArea.setText(str);
107:                textArea.setCaretPosition(0);
108:                textArea.updateScrollBars();
109:                textArea.updateUI();
110:            }
111:
112:            /** This method is called from within the constructor to
113:             * initialize the form.
114:             * WARNING: Do NOT modify this code. The content of this method is
115:             * always regenerated by the Form Editor.
116:             */
117:            // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
118:            private void initComponents() {
119:                java.awt.GridBagConstraints gridBagConstraints;
120:
121:                jPanelData = new javax.swing.JPanel();
122:                jPanel1 = new javax.swing.JPanel();
123:                jPanel2 = new javax.swing.JPanel();
124:                jButtonSave = new javax.swing.JButton();
125:                jButtonRevertToSaved = new javax.swing.JButton();
126:                jButtonGetKeys = new javax.swing.JButton();
127:                jPanel3 = new javax.swing.JPanel();
128:                jButtonClose = new javax.swing.JButton();
129:
130:                setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
131:                jPanelData.setLayout(new java.awt.GridBagLayout());
132:
133:                jPanel1.setLayout(new java.awt.GridBagLayout());
134:
135:                jPanel1
136:                        .addComponentListener(new java.awt.event.ComponentAdapter() {
137:                            public void componentResized(
138:                                    java.awt.event.ComponentEvent evt) {
139:                                jPanel1ComponentResized(evt);
140:                            }
141:                        });
142:
143:                gridBagConstraints = new java.awt.GridBagConstraints();
144:                gridBagConstraints.gridx = 0;
145:                gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
146:                gridBagConstraints.weightx = 1.0;
147:                gridBagConstraints.weighty = 1.0;
148:                gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);
149:                jPanelData.add(jPanel1, gridBagConstraints);
150:
151:                jPanel2.setLayout(new java.awt.GridBagLayout());
152:
153:                jPanel2.setMinimumSize(new java.awt.Dimension(140, 151));
154:                jPanel2.setPreferredSize(new java.awt.Dimension(140, 100));
155:                jButtonSave.setText("Save");
156:                jButtonSave
157:                        .addActionListener(new java.awt.event.ActionListener() {
158:                            public void actionPerformed(
159:                                    java.awt.event.ActionEvent evt) {
160:                                jButtonSaveActionPerformed(evt);
161:                            }
162:                        });
163:
164:                gridBagConstraints = new java.awt.GridBagConstraints();
165:                gridBagConstraints.gridx = 0;
166:                gridBagConstraints.gridy = 1;
167:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
168:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
169:                gridBagConstraints.weightx = 1.0;
170:                jPanel2.add(jButtonSave, gridBagConstraints);
171:
172:                jButtonRevertToSaved.setText("Revert to saved");
173:                jButtonRevertToSaved.setActionCommand("Modify locale");
174:                jButtonRevertToSaved
175:                        .addActionListener(new java.awt.event.ActionListener() {
176:                            public void actionPerformed(
177:                                    java.awt.event.ActionEvent evt) {
178:                                jButtonRevertToSavedActionPerformed(evt);
179:                            }
180:                        });
181:
182:                gridBagConstraints = new java.awt.GridBagConstraints();
183:                gridBagConstraints.gridx = 0;
184:                gridBagConstraints.gridy = 4;
185:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
186:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
187:                gridBagConstraints.weightx = 1.0;
188:                gridBagConstraints.insets = new java.awt.Insets(4, 0, 0, 0);
189:                jPanel2.add(jButtonRevertToSaved, gridBagConstraints);
190:
191:                jButtonGetKeys.setText("Get keys from default");
192:                jButtonGetKeys.setActionCommand("Modify locale");
193:                gridBagConstraints = new java.awt.GridBagConstraints();
194:                gridBagConstraints.gridx = 0;
195:                gridBagConstraints.gridy = 5;
196:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
197:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
198:                gridBagConstraints.weightx = 1.0;
199:                gridBagConstraints.insets = new java.awt.Insets(4, 0, 0, 0);
200:                jPanel2.add(jButtonGetKeys, gridBagConstraints);
201:
202:                gridBagConstraints = new java.awt.GridBagConstraints();
203:                gridBagConstraints.gridx = 0;
204:                gridBagConstraints.gridy = 10;
205:                gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
206:                gridBagConstraints.weightx = 1.0;
207:                gridBagConstraints.weighty = 1.0;
208:                jPanel2.add(jPanel3, gridBagConstraints);
209:
210:                jButtonClose.setText("Close");
211:                jButtonClose
212:                        .addActionListener(new java.awt.event.ActionListener() {
213:                            public void actionPerformed(
214:                                    java.awt.event.ActionEvent evt) {
215:                                jButtonCloseActionPerformed(evt);
216:                            }
217:                        });
218:
219:                gridBagConstraints = new java.awt.GridBagConstraints();
220:                gridBagConstraints.gridx = 0;
221:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
222:                gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
223:                gridBagConstraints.weightx = 1.0;
224:                jPanel2.add(jButtonClose, gridBagConstraints);
225:
226:                gridBagConstraints = new java.awt.GridBagConstraints();
227:                gridBagConstraints.gridx = 1;
228:                gridBagConstraints.gridy = 0;
229:                gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
230:                gridBagConstraints.insets = new java.awt.Insets(4, 0, 4, 4);
231:                jPanelData.add(jPanel2, gridBagConstraints);
232:
233:                getContentPane().add(jPanelData, java.awt.BorderLayout.CENTER);
234:
235:                pack();
236:            }// </editor-fold>//GEN-END:initComponents
237:
238:            private void jButtonCloseActionPerformed(
239:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonCloseActionPerformed
240:                this .setVisible(false);
241:                this .dispose();
242:            }//GEN-LAST:event_jButtonCloseActionPerformed
243:
244:            private void jPanel1ComponentResized(
245:                    java.awt.event.ComponentEvent evt) {//GEN-FIRST:event_jPanel1ComponentResized
246:                textArea.updateScrollBars();
247:                if (textArea.getVisibleLines() >= textArea.getLineCount()) {
248:                    textArea.setFirstLine(0);
249:                }
250:            }//GEN-LAST:event_jPanel1ComponentResized
251:
252:            private void jButtonRevertToSavedActionPerformed(
253:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonRevertToSavedActionPerformed
254:                setFile(file);
255:            }//GEN-LAST:event_jButtonRevertToSavedActionPerformed
256:
257:            private void jButtonSaveActionPerformed(
258:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonSaveActionPerformed
259:
260:                try {
261:                    FileOutputStream fos = new FileOutputStream(file);
262:                    fos.write(textArea.getText().getBytes());
263:                    fos.close();
264:                } catch (Exception ex) {
265:                    javax.swing.JOptionPane.showMessageDialog(this , I18n
266:                            .getFormattedString(
267:                                    "messages.localeEditorDialog.errorSaving",
268:                                    "Error saving {0}:\n{1}", new Object[] {
269:                                            file.getName(), ex.getMessage() }));
270:                }
271:            }//GEN-LAST:event_jButtonSaveActionPerformed
272:
273:            // Variables declaration - do not modify//GEN-BEGIN:variables
274:            private javax.swing.JButton jButtonClose;
275:            private javax.swing.JButton jButtonGetKeys;
276:            private javax.swing.JButton jButtonRevertToSaved;
277:            private javax.swing.JButton jButtonSave;
278:            private javax.swing.JPanel jPanel1;
279:            private javax.swing.JPanel jPanel2;
280:            private javax.swing.JPanel jPanel3;
281:            private javax.swing.JPanel jPanelData;
282:
283:            // End of variables declaration//GEN-END:variables
284:
285:            public void applyI18n() {
286:                // Start autogenerated code ----------------------
287:                jButtonClose.setText(I18n.getString(
288:                        "localeEditorDialog.buttonClose", "Close"));
289:                jButtonGetKeys.setText(I18n.getString(
290:                        "localeEditorDialog.buttonGetKeys",
291:                        "Get keys from default"));
292:                jButtonRevertToSaved.setText(I18n.getString(
293:                        "localeEditorDialog.buttonRevertToSaved",
294:                        "Revert to saved"));
295:                jButtonSave.setText(I18n.getString(
296:                        "localeEditorDialog.buttonSave", "Save"));
297:                // End autogenerated code ----------------------
298:            }
299:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.