Source Code Cross Referenced for XMLLocationPanel.java in  » Workflow-Engines » JaWE » org » enhydra » jawe » base » panel » panels » 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 » Workflow Engines » JaWE » org.enhydra.jawe.base.panel.panels 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package org.enhydra.jawe.base.panel.panels;
002:
003:        import java.awt.Color;
004:        import java.awt.Component;
005:        import java.awt.Dimension;
006:        import java.awt.event.ActionEvent;
007:        import java.awt.event.ActionListener;
008:        import java.awt.event.KeyAdapter;
009:        import java.awt.event.KeyEvent;
010:
011:        import javax.swing.Box;
012:        import javax.swing.JButton;
013:        import javax.swing.JLabel;
014:        import javax.swing.JTextField;
015:        import javax.swing.SwingConstants;
016:
017:        import org.enhydra.jawe.JaWEXMLUtil;
018:        import org.enhydra.jawe.ResourceManager;
019:        import org.enhydra.jawe.Settings;
020:        import org.enhydra.jawe.base.panel.PanelContainer;
021:        import org.enhydra.jawe.base.panel.PanelSettings;
022:        import org.enhydra.shark.xpdl.XMLElement;
023:
024:        /**
025:         * Creates panel with JLabel, JTextField and JButton, this panel is
026:         * used to set the file name from some choosed location.
027:         * @author Sasa Bojanic
028:         */
029:        public class XMLLocationPanel extends XMLBasicPanel {
030:
031:            private static Dimension fileButtonDimension = new Dimension(25, 20);
032:
033:            protected JTextField jtf;
034:            protected JLabel jl;
035:
036:            public XMLLocationPanel(PanelContainer pc, XMLElement myOwnerL,
037:                    boolean isEnabled) {
038:                this (pc, myOwnerL, isEnabled, -1);
039:            }
040:
041:            public XMLLocationPanel(PanelContainer pc, XMLElement myOwner,
042:                    boolean isEnabled, final int filteringMode) {
043:
044:                super (pc, myOwner, "", false, false, true);
045:
046:                boolean rightAllignment = false;
047:                Dimension textDim = new Dimension(250, 20);
048:
049:                Color bkgCol = new Color(245, 245, 245);
050:                if (pc != null) {
051:                    Settings settings = pc.getSettings();
052:
053:                    rightAllignment = settings
054:                            .getSettingBoolean("XMLBasicPanel.RightAllignment");
055:
056:                    textDim = new Dimension(settings
057:                            .getSettingInt("SimplePanelTextWidth"), settings
058:                            .getSettingInt("SimplePanelTextHeight"));
059:                    fileButtonDimension = new Dimension(
060:                            fileButtonDimension.width, textDim.height);
061:                    textDim.width = textDim.width - fileButtonDimension.width;
062:
063:                    if (settings instanceof  PanelSettings) {
064:                        bkgCol = ((PanelSettings) settings)
065:                                .getBackgroundColor();
066:                    }
067:
068:                    jl = new JLabel(pc.getLabelGenerator().getLabel(myOwner)
069:                            + ": ");
070:                } else {
071:                    jl = new JLabel(ResourceManager
072:                            .getLanguageDependentString(myOwner.toName()
073:                                    + "Key")
074:                            + ": ");
075:                }
076:
077:                jl.setAlignmentX(Component.LEFT_ALIGNMENT);
078:                jl.setAlignmentY(Component.BOTTOM_ALIGNMENT);
079:                jl.setHorizontalAlignment(SwingConstants.RIGHT);
080:                //jl.setMaximumSize(new Dimension(Short.MAX_VALUE,10));
081:
082:                jtf = new JTextField();
083:                jtf.setText(myOwner.toValue());
084:                jtf.setAlignmentX(Component.LEFT_ALIGNMENT);
085:                jtf.setAlignmentY(Component.BOTTOM_ALIGNMENT);
086:                jtf.setMinimumSize(new Dimension(textDim));
087:                jtf.setMaximumSize(new Dimension(textDim));
088:                jtf.setPreferredSize(new Dimension(textDim));
089:                jtf.setEnabled(isEnabled);
090:                jtf.setBackground(bkgCol);
091:
092:                //add key listener
093:                final XMLPanel p = this ;
094:                jtf.addKeyListener(new KeyAdapter() {
095:                    public void keyPressed(KeyEvent e) {
096:                        if (getPanelContainer() == null)
097:                            return;
098:                        if (PanelUtilities.isModifyingEvent(e)) {
099:                            getPanelContainer().panelChanged(p, e);
100:                        }
101:                    }
102:                });
103:
104:                JButton jb = new JButton("...");
105:                jb.setAlignmentX(Component.LEFT_ALIGNMENT);
106:                jb.setAlignmentY(Component.BOTTOM_ALIGNMENT);
107:                jb.setMinimumSize(new Dimension(fileButtonDimension));
108:                jb.setMaximumSize(new Dimension(fileButtonDimension));
109:                jb.setPreferredSize(new Dimension(fileButtonDimension));
110:                jb.setEnabled(isEnabled);
111:
112:                if (rightAllignment) {
113:                    add(Box.createHorizontalGlue());
114:                }
115:                add(jl);
116:                if (!rightAllignment) {
117:                    //         add(Box.createRigidArea(new Dimension(200-jl.getPreferredSize().width,1)));
118:                    add(Box.createHorizontalGlue());
119:
120:                }
121:                add(jtf);
122:                add(jb);
123:
124:                jb.addActionListener(new ActionListener() {
125:                    public void actionPerformed(ActionEvent ae) {
126:                        String fileName = "";
127:                        String message = ResourceManager
128:                                .getLanguageDependentString("DialogChooseFile");
129:                        fileName = JaWEXMLUtil.dialog(getWindow(), message, 0,
130:                                filteringMode, null);
131:                        if (fileName != null && fileName.length() > 0) {
132:                            jtf.setText(fileName);
133:                            if (getPanelContainer() == null)
134:                                return;
135:                            getPanelContainer().panelChanged(p, ae);
136:                        }
137:                    }
138:                });
139:            }
140:
141:            public boolean validateEntry() {
142:                if (isEmpty() && getOwner().isRequired()
143:                        && !getOwner().isReadOnly()) {
144:
145:                    //TODO CHECK THIS
146:                    XMLBasicPanel.defaultErrorMessage(this .getWindow(), jl
147:                            .getText());
148:                    jtf.requestFocus();
149:                    return false;
150:                }
151:                return true;
152:            }
153:
154:            public boolean isEmpty() {
155:                return getText().trim().equals("");
156:            }
157:
158:            public void setElements() {
159:                if (!getOwner().isReadOnly()) {
160:                    myOwner.setValue(getText().trim());
161:                }
162:            }
163:
164:            public String getText() {
165:                return jtf.getText();
166:            }
167:
168:            public Object getValue() {
169:                return getText();
170:            }
171:
172:            public void requestFocus() {
173:                jtf.requestFocus();
174:            }
175:
176:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.