Source Code Cross Referenced for MachineTranslationDialog.java in  » XML-UI » xui32 » com » xoetrope » carousel » langed » 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 » XML UI » xui32 » com.xoetrope.carousel.langed 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package com.xoetrope.carousel.langed;
002:
003:        import java.awt.BorderLayout;
004:        import java.awt.Color;
005:        import java.awt.Dimension;
006:        import java.awt.GridLayout;
007:        import java.awt.Window;
008:        import java.awt.event.ActionEvent;
009:        import java.awt.event.ActionListener;
010:        import java.awt.event.WindowEvent;
011:        import java.util.Enumeration;
012:        import java.util.Hashtable;
013:        import java.util.prefs.Preferences;
014:
015:        import javax.swing.BorderFactory;
016:        import javax.swing.JButton;
017:        import javax.swing.JComboBox;
018:        import javax.swing.JDialog;
019:        import javax.swing.JFrame;
020:        import javax.swing.JLabel;
021:        import javax.swing.JPanel;
022:        import javax.swing.JTextField;
023:        import javax.swing.SwingConstants;
024:        import javax.swing.border.Border;
025:        import javax.swing.border.TitledBorder;
026:
027:        /**
028:         * <p>Title: LanguageEditor</p>
029:         * <p>Description: Language Resource Translation Utility</p>
030:         * <p> Copyright (c) Xoetrope Ltd., 2001-2006, This software is licensed under
031:         * the GNU Public License (GPL), please see license.txt for more details. If
032:         * you make commercial use of this software you must purchase a commercial
033:         * license from Xoetrope.</p>
034:         * <p> $Revision: 1.5 $</p>
035:         * @author Luan O'Carroll
036:         */
037:
038:        public class MachineTranslationDialog extends JDialog implements 
039:                ActionListener {
040:            private JPanel jPanel2 = new JPanel();
041:            private JPanel jPanel3 = new JPanel();
042:            private BorderLayout borderLayout2 = new BorderLayout();
043:            private TitledBorder titledBorder1;
044:            private Border border1;
045:            private Border border2;
046:            private Border border3;
047:
048:            private boolean isOk = false;
049:            private Hashtable langTable = new Hashtable();
050:            private JPanel jPanel4 = new JPanel();
051:            private JLabel jLabel1 = new JLabel();
052:            private JLabel jLabel2 = new JLabel();
053:            private JLabel jLabel3 = new JLabel();
054:            private JLabel jLabel4 = new JLabel();
055:            private JLabel jLabel6 = new JLabel();
056:            private JLabel jLabel5 = new JLabel();
057:            private BorderLayout borderLayout3 = new BorderLayout();
058:            private GridLayout gridLayout2 = new GridLayout();
059:            private JTextField srcPrefix = new JTextField();
060:            private JTextField urlField = new JTextField();
061:            private JPanel jPanel1 = new JPanel();
062:            private JTextField directionPrefix = new JTextField();
063:            private GridLayout gridLayout1 = new GridLayout();
064:            private JTextField resultTag = new JTextField();
065:            private JComboBox languageChoice = new JComboBox();
066:            private JTextField endResultTag = new JTextField();
067:            private JPanel jPanel5 = new JPanel();
068:            private JButton cancelBtn = new JButton();
069:            private JButton okBtn = new JButton();
070:            private Border border4;
071:
072:            private Preferences prefs = Preferences
073:                    .userNodeForPackage(LangEdDesktop.class);
074:
075:            public MachineTranslationDialog(String title, boolean modal) {
076:                super ((JFrame) null);
077:                setTitle(title);
078:                setModal(modal);
079:                try {
080:                    jbInit();
081:                    LanguageEditorApplication.setDefaultFont(this );
082:                    pack();
083:                } catch (Exception ex) {
084:                    ex.printStackTrace();
085:                }
086:            }
087:
088:            public MachineTranslationDialog() {
089:                super ((JFrame) null);
090:                setTitle("");
091:                setModal(false);
092:            }
093:
094:            private void jbInit() throws Exception {
095:                isOk = false;
096:
097:                titledBorder1 = new TitledBorder("");
098:                border1 = BorderFactory.createCompoundBorder(BorderFactory
099:                        .createEtchedBorder(Color.white, new Color(165, 163,
100:                                151)), BorderFactory.createEmptyBorder(6, 6, 6,
101:                        6));
102:                border2 = BorderFactory.createEmptyBorder(2, 2, 2, 2);
103:                border3 = BorderFactory.createEmptyBorder(6, 6, 6, 6);
104:                border4 = BorderFactory.createCompoundBorder(BorderFactory
105:                        .createEtchedBorder(Color.white, new Color(165, 163,
106:                                151)), BorderFactory.createEmptyBorder(6, 6, 6,
107:                        6));
108:                jPanel3.setLayout(borderLayout2);
109:
110:                langTable.put("English to German", "en_de");
111:                langTable.put("English to Chinese", "en_zh");
112:                langTable.put("English to French", "en_fr");
113:                langTable.put("English to Italian", "en_it");
114:                langTable.put("English to Japanese", "en_ja");
115:                langTable.put("English to Korean", "en_ko");
116:                langTable.put("English to Portuguese", "en_pt");
117:                langTable.put("English to Spanish", "en_es");
118:                langTable.put("Chinese to English", "zh_en");
119:                langTable.put("French to English", "fr_en");
120:                langTable.put("French to German", "fr_de");
121:                langTable.put("German to English", "de_en");
122:                langTable.put("German to French", "de_fr");
123:                langTable.put("Italian to English", "it_en");
124:                langTable.put("Japanese to English", "ja_en");
125:                langTable.put("Korean to English", "ko_en");
126:                langTable.put("Portuguese to English", "pt_en");
127:                langTable.put("Russian to English", "ru_en");
128:                langTable.put("Spanish to English", "es_en");
129:                Enumeration enumeration = langTable.keys();
130:                while (enumeration.hasMoreElements())
131:                    languageChoice.addItem((String) enumeration.nextElement());
132:
133:                directionPrefix.setText(prefs.get("directionPrefix", "lp="));
134:                endResultTag.setText(prefs.get("endResultTag", "</div>"));
135:                urlField.setText(prefs.get("urlField",
136:                        "http://babelfish.altavista.com/babelfish/tr"));
137:                urlField.setMinimumSize(new Dimension(300, 20));
138:                urlField.setPreferredSize(new Dimension(300, 20));
139:                resultTag.setText(prefs.get("resultTag",
140:                        "<Div style=padding:10px;>"));
141:                srcPrefix.setText(prefs.get("srcPrefix", "&urltext="));
142:                borderLayout2.setHgap(2);
143:                borderLayout2.setVgap(2);
144:                jPanel3.setBorder(border3);
145:                jPanel4.setLayout(gridLayout2);
146:                jLabel1.setHorizontalAlignment(SwingConstants.RIGHT);
147:                jLabel1.setText("URL");
148:                jLabel2.setHorizontalAlignment(SwingConstants.RIGHT);
149:                jLabel2.setText("Direction prefix");
150:                jLabel3.setHorizontalAlignment(SwingConstants.RIGHT);
151:                jLabel3.setText("Direction");
152:                jLabel4.setHorizontalAlignment(SwingConstants.RIGHT);
153:                jLabel4.setText("Text prefix");
154:                jLabel6.setHorizontalAlignment(SwingConstants.RIGHT);
155:                jLabel6.setText("Output end tag");
156:                jLabel5.setHorizontalAlignment(SwingConstants.RIGHT);
157:                jLabel5.setText("Output tag");
158:                jPanel2.setLayout(borderLayout3);
159:                gridLayout2.setColumns(1);
160:                gridLayout2.setHgap(2);
161:                gridLayout2.setRows(6);
162:                gridLayout2.setVgap(2);
163:                jPanel1.setLayout(gridLayout1);
164:                jPanel1.setBorder(border2);
165:                gridLayout1.setColumns(4);
166:                gridLayout1.setHgap(2);
167:                gridLayout1.setRows(6);
168:                gridLayout1.setVgap(2);
169:                cancelBtn.setMnemonic('C');
170:                cancelBtn.setText("Cancel");
171:                cancelBtn.addActionListener(this );
172:                okBtn.setMnemonic('O');
173:                okBtn.setText("OK");
174:                okBtn.addActionListener(this );
175:                jPanel2.setBorder(border4);
176:                jPanel2.setMinimumSize(new Dimension(322, 156));
177:                getContentPane().add(jPanel3);
178:                jPanel3.add(jPanel2, BorderLayout.NORTH);
179:                this .getContentPane().add(jPanel3, BorderLayout.NORTH);
180:                jPanel2.add(jPanel4, BorderLayout.WEST);
181:                jPanel4.add(jLabel1, null);
182:                jPanel4.add(jLabel3, null);
183:                jPanel4.add(jLabel2, null);
184:                jPanel4.add(jLabel5, null);
185:                jPanel4.add(jLabel4, null);
186:                jPanel4.add(jLabel6, null);
187:                jPanel2.add(jPanel1, BorderLayout.CENTER);
188:                jPanel1.add(urlField, null);
189:                jPanel1.add(directionPrefix, null);
190:                jPanel1.add(languageChoice, null);
191:                jPanel1.add(srcPrefix, null);
192:                jPanel1.add(resultTag, null);
193:                jPanel1.add(endResultTag, null);
194:                jPanel3.add(jPanel5, BorderLayout.SOUTH);
195:                jPanel5.add(cancelBtn, null);
196:                jPanel5.add(okBtn, null);
197:            }
198:
199:            //Overridden so we can exit when window is closed
200:            protected void processWindowEvent(WindowEvent e) {
201:                if (e.getID() == WindowEvent.WINDOW_CLOSING) {
202:                    cancel();
203:                }
204:                super .processWindowEvent(e);
205:            }
206:
207:            //Close the dialog
208:            void cancel() {
209:                dispose();
210:            }
211:
212:            public boolean isOk() {
213:                return isOk;
214:            }
215:
216:            //Close the dialog on a button event
217:            public void actionPerformed(ActionEvent e) {
218:                if (e.getSource() == cancelBtn) {
219:                    cancel();
220:                } else if (e.getSource() == okBtn) {
221:                    isOk = true;
222:                    prefs.put("resultTag", resultTag.getText());
223:                    prefs.put("endResultTag", endResultTag.getText());
224:                    prefs.put("urlField", urlField.getText());
225:                    prefs.put("directionPrefix", directionPrefix.getText());
226:                    prefs.put("srcPrefix", srcPrefix.getText());
227:
228:                    setVisible(false);
229:                }
230:            }
231:
232:            public String getDirection() {
233:                String choice = languageChoice.getSelectedItem().toString();
234:                return (String) langTable.get(choice);
235:            }
236:
237:            public String getUrl() {
238:                return urlField.getText();
239:            }
240:
241:            public String getDirectionPrefix() {
242:                return directionPrefix.getText();
243:            }
244:
245:            public String getSrcPrefix() {
246:                return srcPrefix.getText();
247:            }
248:
249:            public String getStartOfResultTag() {
250:                return resultTag.getText();
251:            }
252:
253:            public String getEndOfResultTag() {
254:                return endResultTag.getText();
255:            }
256:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.