Source Code Cross Referenced for JListBinding.java in  » Installer » launch4j » net » sf » launch4j » binding » 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 » Installer » launch4j » net.sf.launch4j.binding 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:        	Launch4j (http://launch4j.sourceforge.net/)
003:        	Cross-platform Java application wrapper for creating Windows native executables.
004:
005:        	Copyright (c) 2004, 2007 Grzegorz Kowal
006:
007:        	All rights reserved.
008:
009:        	Redistribution and use in source and binary forms, with or without modification,
010:        	are permitted provided that the following conditions are met:
011:
012:         * Redistributions of source code must retain the above copyright notice,
013:        	      this list of conditions and the following disclaimer.
014:         * Redistributions in binary form must reproduce the above copyright notice,
015:        	      this list of conditions and the following disclaimer in the documentation
016:        	      and/or other materials provided with the distribution.
017:         * Neither the name of the Launch4j nor the names of its contributors
018:        	      may be used to endorse or promote products derived from this software without
019:        	      specific prior written permission.
020:
021:        	THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
022:        	"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
023:        	LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
024:        	A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
025:        	CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
026:        	EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
027:        	PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
028:        	PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
029:        	LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
030:        	NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
031:        	SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
032:         */
033:
034:        /*
035:         * Created on May 1, 2006
036:         */
037:        package net.sf.launch4j.binding;
038:
039:        import java.awt.Color;
040:        import java.util.ArrayList;
041:        import java.util.Iterator;
042:        import java.util.List;
043:
044:        import javax.swing.DefaultListModel;
045:        import javax.swing.JList;
046:
047:        import org.apache.commons.beanutils.PropertyUtils;
048:
049:        /**
050:         * @author Copyright (C) 2006 Grzegorz Kowal
051:         */
052:        public class JListBinding implements  Binding {
053:            private final String _property;
054:            private final JList _list;
055:            private final Color _validColor;
056:
057:            public JListBinding(String property, JList list) {
058:                if (property == null || list == null) {
059:                    throw new NullPointerException();
060:                }
061:                if (property.equals("")) {
062:                    throw new IllegalArgumentException();
063:                }
064:                _property = property;
065:                _list = list;
066:                _validColor = _list.getBackground();
067:            }
068:
069:            public String getProperty() {
070:                return _property;
071:            }
072:
073:            public void clear(IValidatable bean) {
074:                _list.setModel(new DefaultListModel());
075:            }
076:
077:            public void put(IValidatable bean) {
078:                try {
079:                    DefaultListModel model = new DefaultListModel();
080:                    List list = (List) PropertyUtils.getProperty(bean,
081:                            _property);
082:                    if (list != null) {
083:                        for (Iterator iter = list.iterator(); iter.hasNext();) {
084:                            model.addElement(iter.next());
085:                        }
086:                    }
087:                    _list.setModel(model);
088:                } catch (Exception e) {
089:                    throw new BindingException(e);
090:                }
091:            }
092:
093:            public void get(IValidatable bean) {
094:                try {
095:                    DefaultListModel model = (DefaultListModel) _list
096:                            .getModel();
097:                    final int size = model.getSize();
098:                    List list = new ArrayList(size);
099:                    for (int i = 0; i < size; i++) {
100:                        list.add(model.get(i));
101:                    }
102:                    PropertyUtils.setProperty(bean, _property, list);
103:                } catch (Exception e) {
104:                    throw new BindingException(e);
105:                }
106:            }
107:
108:            public void markValid() {
109:                _list.setBackground(_validColor);
110:                _list.requestFocusInWindow();
111:            }
112:
113:            public void markInvalid() {
114:                _list.setBackground(Binding.INVALID_COLOR);
115:            }
116:
117:            public void setEnabled(boolean enabled) {
118:                _list.setEnabled(enabled);
119:            }
120:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.