Source Code Cross Referenced for SkeletonProperties.java in  » Installer » jsmooth » net » charabia » jsmoothgen » application » gui » editors » 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 » jsmooth » net.charabia.jsmoothgen.application.gui.editors 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:          JSmooth: a VM wrapper toolkit for Windows
003:          Copyright (C) 2003 Rodrigo Reyes <reyes@charabia.net>
004:         
005:          This program is free software; you can redistribute it and/or modify
006:          it under the terms of the GNU General Public License as published by
007:          the Free Software Foundation; either version 2 of the License, or
008:          (at your option) any later version.
009:         
010:          This program is distributed in the hope that it will be useful,
011:          but WITHOUT ANY WARRANTY; without even the implied warranty of
012:          MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
013:          GNU General Public License for more details.
014:         
015:          You should have received a copy of the GNU General Public License
016:          along with this program; if not, write to the Free Software
017:          Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
018:         
019:         */
020:
021:        package net.charabia.jsmoothgen.application.gui.editors;
022:
023:        import net.charabia.jsmoothgen.skeleton.*;
024:        import net.charabia.jsmoothgen.application.*;
025:        import net.charabia.jsmoothgen.application.gui.*;
026:        import net.charabia.jsmoothgen.application.gui.util.*;
027:        import javax.swing.*;
028:        import java.awt.*;
029:        import java.util.*;
030:        import com.l2fprod.common.swing.*;
031:        import com.l2fprod.common.propertysheet.*;
032:
033:        public class SkeletonProperties extends Editor implements 
034:                JSmoothModelBean.SkeletonChangedListener {
035:            private PropertySheetPanel m_skelprops = new PropertySheetPanel();
036:            private String m_currentSkelName = null;
037:            private SkeletonBean m_skel = null;
038:
039:            protected String[] m_autourls = new String[] {
040:                    "JRE 1.5.0",
041:                    "http://java.sun.com/update/1.5.0/jinstall-1_5_0-windows-i586.cab",
042:                    "JRE 1.4.2_03",
043:                    "http://java.sun.com/update/1.4.2/jinstall-1_4_2_03-windows-i586.cab",
044:                    "JRE 1.4.2_02",
045:                    "http://java.sun.com/update/1.4.2/jinstall-1_4_2_02-windows-i586.cab",
046:                    "JRE 1.4.2_01",
047:                    "http://java.sun.com/update/1.4.2/jinstall-1_4_2_01-windows-i586.cab",
048:                    "JRE 1.4.2",
049:                    "http://java.sun.com/products/plugin/autodl/jinstall-1_4_2-windows-i586.cab",
050:                    "JRE 1.4.1_03",
051:                    "http://java.sun.com/products/plugin/autodl/jinstall-1_4_1_03-windows-i586.cab",
052:                    "JRE 1.4.1_02",
053:                    "http://java.sun.com/products/plugin/autodl/jinstall-1_4_1_02-windows-i586.cab",
054:                    "JRE 1.4.1_01",
055:                    "http://java.sun.com/products/plugin/autodl/jinstall-1_4_1_01-windows-i586.cab",
056:                    "JRE 1.4.1",
057:                    "http://java.sun.com/products/plugin/autodl/jinstall-1_4_1-windows-i586.cab",
058:                    "JRE 1.4.0_04",
059:                    "http://java.sun.com/products/plugin/autodl/jinstall-1_4_0_04-win.cab",
060:                    "JRE 1.4.0_03",
061:                    "http://java.sun.com/products/plugin/autodl/jinstall-1_4_0_03-win.cab",
062:                    "JRE 1.4.0_02",
063:                    "http://java.sun.com/products/plugin/autodl/jinstall-1_4_0_02-win.cab",
064:                    "JRE 1.4.0_01",
065:                    "http://java.sun.com/products/plugin/autodl/jinstall-1_4_0_01-win.cab",
066:                    "JRE 1.4.0",
067:                    "http://java.sun.com/products/plugin/autodl/jinstall-1_4_0-win.cab",
068:                    "JRE 1.3.1_08",
069:                    "http://java.sun.com/products/plugin/autodl/jinstall-1_3_1_08-windows-i586.cab",
070:                    "JRE 1.3.1_07",
071:                    "http://java.sun.com/products/plugin/autodl/jinstall-1_3_1_07-windows-i586.cab",
072:                    "JRE 1.3.1_06",
073:                    "http://java.sun.com/products/plugin/autodl/jinstall-1_3_1_06-windows-i586.cab",
074:                    "JRE 1.3.1_05",
075:                    "http://java.sun.com/products/plugin/autodl/jinstall-1_3_1_05-windows-i586.cab",
076:                    "JRE 1.3.1_04",
077:                    "http://java.sun.com/products/plugin/autodl/jinstall-1_3_1_04-win.cab",
078:                    "JRE 1.3.1_03",
079:                    "http://java.sun.com/products/plugin/autodl/jinstall-1_3_1_03-win.cab",
080:                    "JRE 1.3.1_02",
081:                    "http://java.sun.com/products/plugin/autodl/jinstall-1_3_1_02-win.cab",
082:                    "JRE 1.3.1_01",
083:                    "http://java.sun.com/products/plugin/autodl/jinstall-1_3_1_01-win.cab",
084:                    "JRE 1.3.0_05",
085:                    "http://java.sun.com/products/plugin/autodl/jinstall-1_3_0_05-win.cab" };
086:
087:            public class SkelEditorFactory implements 
088:                    com.l2fprod.common.propertysheet.PropertyEditorFactory {
089:
090:                public java.beans.PropertyEditor createPropertyEditor(
091:                        Property property) {
092:                    if (property instanceof  SkeletonPropertyProxy) {
093:                        SkeletonPropertyProxy spp = (SkeletonPropertyProxy) property;
094:                        String pname = spp.getTypeName();
095:
096:                        if (pname.equals("boolean"))
097:                            new com.l2fprod.common.beans.editor.BooleanAsCheckBoxPropertyEditor();
098:                        else if (pname.equals("textarea"))
099:                            return new com.l2fprod.common.beans.editor.StringPropertyEditor();
100:                        else if (pname.equals("string"))
101:                            return new com.l2fprod.common.beans.editor.StringPropertyEditor();
102:                        else if (pname.equals("autodownloadurl")) {
103:                            com.l2fprod.common.beans.editor.ComboBoxPropertyEditor ed = new com.l2fprod.common.beans.editor.ComboBoxPropertyEditor();
104:                            Object values[] = new Object[m_autourls.length / 2];
105:                            for (int i = 0; i < m_autourls.length; i += 2) {
106:                                values[(i + 1) / 2] = new com.l2fprod.common.beans.editor.ComboBoxPropertyEditor.Value(
107:                                        m_autourls[i + 1], m_autourls[i]);
108:                            }
109:                            ed.setAvailableValues(values);
110:                            return ed;
111:                        }
112:                        return new com.l2fprod.common.beans.editor.BooleanAsCheckBoxPropertyEditor();
113:                    } else {
114:                        return new com.l2fprod.common.beans.editor.BooleanAsCheckBoxPropertyEditor();
115:                    }
116:                }
117:            }
118:
119:            public class SkeletonPropertyProxy extends DefaultProperty {
120:                SkeletonProperty m_property;
121:
122:                public SkeletonPropertyProxy(SkeletonProperty prop) {
123:                    m_property = prop;
124:                }
125:
126:                public String getDisplayName() {
127:                    return m_property.getLabel();
128:                }
129:
130:                public String getName() {
131:                    System.out.println("proxy, getname "
132:                            + m_property.getIdName());
133:                    return m_property.getIdName();
134:                }
135:
136:                public String getShortDescription() {
137:                    return m_property.getDescription();
138:                }
139:
140:                public Class getType() {
141:                    if (m_property.getType().equals("boolean"))
142:                        return Boolean.class;
143:                    else if (m_property.getType().equals("textarea"))
144:                        return String.class;
145:                    else if (m_property.getType().equals("string"))
146:                        return String.class;
147:                    else if (m_property.getType().equals("autodownloadurl"))
148:                        return String.class;
149:
150:                    return String.class;
151:                }
152:
153:                public String getTypeName() {
154:                    return m_property.getType();
155:                }
156:
157:                public boolean isEditable() {
158:                    return true;
159:                }
160:
161:                public Object getValue() {
162:                    if (m_property.getType().equals("boolean"))
163:                        return new Boolean(m_property.getValue().equals("1"));
164:                    return m_property.getValue();
165:                }
166:
167:                public void setValue(Object o) {
168:                    System.out.println("SET VALUE " + o);
169:                    if (o instanceof  Boolean) {
170:                        if (((Boolean) o).booleanValue() == true)
171:                            m_property.setValue("1");
172:                        else
173:                            m_property.setValue("0");
174:                    } else {
175:                        m_property.setValue(o.toString());
176:                    }
177:                }
178:            }
179:
180:            public SkeletonProperties() {
181:                setLayout(new BorderLayout());
182:
183:                add(BorderLayout.CENTER, m_skelprops);
184:                m_skelprops.setDescriptionVisible(true);
185:                m_skelprops.setToolBarVisible(false);
186:            }
187:
188:            public Dimension getPreferredSize() {
189:                return new Dimension(100, 200);
190:            }
191:
192:            public void setProperties() {
193:                m_skel = null;
194:                if (m_currentSkelName != null)
195:                    m_skel = Main.SKELETONS.getSkeleton(m_currentSkelName);
196:
197:                SkeletonProperty[] sprops = null;
198:                if (m_skel != null)
199:                    sprops = m_skel.getSkeletonProperties();
200:                else
201:                    sprops = new SkeletonProperty[0];
202:
203:                m_skelprops.setEditorFactory(new SkelEditorFactory());
204:                SkeletonPropertyProxy[] proxy = new SkeletonPropertyProxy[sprops.length];
205:                for (int i = 0; i < sprops.length; i++) {
206:                    proxy[i] = new SkeletonPropertyProxy(sprops[i]);
207:                    System.out
208:                            .println("Added property " + sprops[i].getLabel());
209:                }
210:
211:                JSmoothModelBean.Property[] jsprop = m_model
212:                        .getSkeletonProperties();
213:                if (jsprop != null) {
214:                    for (int i = 0; i < jsprop.length; i++) {
215:                        // search for the proxy and set the value
216:                        for (int j = 0; j < proxy.length; j++) {
217:                            if (proxy[j].getName().equals(jsprop[i].getKey())) {
218:                                proxy[j].setValue(jsprop[i].getValue());
219:                                break;
220:                            }
221:                        }
222:                    }
223:                }
224:
225:                m_skelprops.setProperties(proxy);
226:            }
227:
228:            public void dataChanged() {
229:                System.out.println("SkeletonProperties: data changed, "
230:                        + m_model.getSkeletonName());
231:                if (m_model.getSkeletonName() == null) {
232:                    m_currentSkelName = null;
233:                    setProperties();
234:                    return;
235:                }
236:                if (!m_model.getSkeletonName().equalsIgnoreCase(
237:                        m_currentSkelName)) {
238:                    m_currentSkelName = m_model.getSkeletonName();
239:                    setProperties();
240:                }
241:            }
242:
243:            public void updateModel() {
244:                if (m_skel != null) {
245:                    SkeletonProperty[] sp = m_skel.getSkeletonProperties();
246:                    JSmoothModelBean.Property[] props = new JSmoothModelBean.Property[sp.length];
247:                    for (int i = 0; i < sp.length; i++) {
248:                        props[i] = new JSmoothModelBean.Property();
249:                        props[i].setKey(sp[i].getIdName());
250:                        props[i].setValue(sp[i].getValue());
251:                        System.out.println(props[i]);
252:                    }
253:                    m_model.setSkeletonProperties(props);
254:                }
255:            }
256:
257:            public void skeletonChanged() {
258:                dataChanged();
259:            }
260:
261:            public String getLabel() {
262:                return "SKELETONPROPERTIES_LABEL";
263:            }
264:
265:            public String getDescription() {
266:                return "SKELETONPROPERTIES_HELP";
267:            }
268:
269:            public boolean needsBigSpace() {
270:                return true;
271:            }
272:
273:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.