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


001:        /*
002:         * Created on May 15, 2004
003:         */
004:        package net.charabia.jsmoothgen.application.swtgui;
005:
006:        import java.util.Iterator;
007:        import java.util.List;
008:        import java.util.Vector;
009:
010:        import net.charabia.jsmoothgen.skeleton.SkeletonProperty;
011:
012:        import org.eclipse.jface.dialogs.Dialog;
013:        import org.eclipse.swt.SWT;
014:        import org.eclipse.swt.layout.GridData;
015:        import org.eclipse.swt.layout.GridLayout;
016:        import org.eclipse.swt.widgets.Button;
017:        import org.eclipse.swt.widgets.Composite;
018:        import org.eclipse.swt.widgets.Control;
019:        import org.eclipse.swt.widgets.Group;
020:        import org.eclipse.swt.widgets.Text;
021:
022:        /**
023:         * @author Dumon
024:         */
025:        public class SkeletonPropertiesDialog extends Dialog {
026:            private Text text;
027:            private Button check;
028:            private List controls = new Vector();
029:            private SkeletonPage page;
030:            private JSmoothApplication app;
031:
032:            public SkeletonPropertiesDialog(SkeletonPage page) {
033:                super (page.getApplication().getShell());
034:                this .page = page;
035:            }
036:
037:            protected Control createDialogArea(Composite parent) {
038:                Composite cmpDlgArea = new Composite(parent, SWT.NONE);
039:                cmpDlgArea.setLayout(new GridLayout());
040:
041:                SkeletonProperty[] props = page.getApplication()
042:                        .getSkeletonProperties();
043:                for (int i = 0; i < props.length; i++) {
044:                    System.out.println("[DEBUG] Loading skeleton property: "
045:                            + props[i].getIdName() + "=" + props[i].getValue());
046:                }
047:
048:                for (int i = 0; i < props.length; i++) {
049:                    Control c = createPropertyControl(cmpDlgArea, props[i]);
050:                    c.setData(props[i]);
051:                    controls.add(c);
052:                }
053:
054:                return cmpDlgArea;
055:            }
056:
057:            private Control createPropertyControl(Composite wParent,
058:                    SkeletonProperty prop) {
059:                Group group = null;
060:                GridData grid = null;
061:                if (prop.getType().equals(SkeletonProperty.TYPE_STRING)) {
062:                    group = new Group(wParent, SWT.NONE);
063:                    grid = new GridData(GridData.FILL);
064:                    grid.widthHint = 400;
065:                    group.setLayoutData(grid);
066:                    group.setLayout(new GridLayout());
067:                    group.setText(prop.getLabel());
068:
069:                    text = new Text(group, SWT.SINGLE | SWT.BORDER);
070:                    grid = new GridData(GridData.FILL_BOTH);
071:                    text.setLayoutData(grid);
072:                    text.setText(prop.getValue());
073:
074:                    return text;
075:                } else if (prop.getType()
076:                        .equals(SkeletonProperty.TYPE_TEXTAREA)) {
077:                    group = new Group(wParent, SWT.NONE);
078:                    grid = new GridData(GridData.FILL);
079:                    grid.widthHint = 400;
080:                    grid.heightHint = 100;
081:                    group.setLayoutData(grid);
082:                    group.setLayout(new GridLayout());
083:                    group.setText(prop.getLabel());
084:
085:                    text = new Text(group, SWT.MULTI | SWT.BORDER
086:                            | SWT.H_SCROLL | SWT.V_SCROLL);
087:                    grid = new GridData(GridData.FILL_BOTH);
088:                    text.setLayoutData(grid);
089:                    text.setText(prop.getValue());
090:
091:                    return text;
092:                } else if (prop.getType().equals(SkeletonProperty.TYPE_BOOLEAN)) {
093:                    Button chk = new Button(wParent, SWT.CHECK);
094:                    chk.setText(prop.getLabel());
095:                    chk.setSelection("1".equals(prop.getValue()));
096:
097:                    return chk;
098:                } else {
099:                    throw new UnsupportedOperationException(
100:                            "Unknown skeleton property type.");
101:                }
102:            }
103:
104:            protected void okPressed() {
105:                Iterator it = controls.iterator();
106:
107:                JSmoothApplication app = page.getApplication();
108:                Control ctrl = null;
109:                String value = null;
110:                SkeletonProperty prop = null;
111:                while (it.hasNext()) {
112:                    ctrl = (Control) it.next();
113:                    prop = (SkeletonProperty) ctrl.getData();
114:                    if (prop.getType().equals(SkeletonProperty.TYPE_STRING)) {
115:                        value = ((Text) ctrl).getText();
116:                        prop.setValue(value);
117:                    } else if (prop.getType().equals(
118:                            SkeletonProperty.TYPE_TEXTAREA)) {
119:                        value = ((Text) ctrl).getText();
120:                        prop.setValue(value);
121:                    } else if (prop.getType().equals(
122:                            SkeletonProperty.TYPE_BOOLEAN)) {
123:                        boolean b = ((Button) ctrl).getSelection();
124:                        value = (b == true) ? "1" : "0";
125:                        prop.setValue(value);
126:                    }
127:                    app.setSkeletonProperty(prop);
128:                }
129:
130:                super.okPressed();
131:            }
132:
133:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.