Source Code Cross Referenced for CustomSelectWizardPage.java in  » ESB » cbesb-1.2 » com » bostechcorp » cbesb » ui » componentflow » componentFlowEditor » diagram » wizards » 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 » ESB » cbesb 1.2 » com.bostechcorp.cbesb.ui.componentflow.componentFlowEditor.diagram.wizards 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package com.bostechcorp.cbesb.ui.componentflow.componentFlowEditor.diagram.wizards;
002:
003:        import java.io.InputStream;
004:        import java.util.HashMap;
005:        import java.util.List;
006:
007:        import org.eclipse.core.runtime.Path;
008:        import org.eclipse.jface.wizard.IWizardPage;
009:        import org.eclipse.swt.SWT;
010:        import org.eclipse.swt.custom.TableEditor;
011:        import org.eclipse.swt.events.SelectionAdapter;
012:        import org.eclipse.swt.events.SelectionEvent;
013:        import org.eclipse.swt.graphics.Image;
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.Display;
019:        import org.eclipse.swt.widgets.Label;
020:        import org.eclipse.swt.widgets.Table;
021:        import org.eclipse.swt.widgets.TableColumn;
022:        import org.eclipse.swt.widgets.TableItem;
023:
024:        import com.bostechcorp.cbesb.common.i18n.I18N;
025:        import com.bostechcorp.cbesb.common.i18n.Messages;
026:        import com.bostechcorp.cbesb.common.util.EsbPathHelper;
027:        import com.bostechcorp.cbesb.common.util.custcomponent.ICustComponent;
028:        import com.bostechcorp.cbesb.ui.componentflow.componentFlowEditor.Custom;
029:        import com.bostechcorp.cbesb.ui.componentflow.componentFlowEditor.diagram.custom.ModelInfoPass;
030:        import com.bostechcorp.cbesb.ui.util.ucm.CustCompClassLoader;
031:
032:        public class CustomSelectWizardPage extends PropertyWizardPage {
033:
034:            private List<ICustComponent> customList;
035:
036:            private HashMap<Button, ICustComponent> map = new HashMap<Button, ICustComponent>();
037:
038:            ICustComponent custCom;
039:
040:            final int COLUMN_WIDTH = 100;
041:            // Set the table column property names
042:            private final String RADIO_COLUMN = I18N
043:                    .getString(Messages.COMMON_CHOICE);
044:
045:            private final String NAME_COLUMN = I18N
046:                    .getString(Messages.MDL_COMMON_NAME);
047:
048:            private final String ICON_COLUMN = I18N
049:                    .getString(Messages.MDL_COMMON_ICON);
050:
051:            private final String VENDOR_COLUMN = I18N
052:                    .getString(Messages.MDL_COMMON_VENDOR);
053:
054:            private final String VERSION_COLUMN = I18N
055:                    .getString(Messages.MDL_COMMON_VERSION);
056:
057:            // Set column names
058:            private String[] columnNames = new String[] { RADIO_COLUMN,
059:                    NAME_COLUMN, ICON_COLUMN, VENDOR_COLUMN, VERSION_COLUMN };
060:
061:            private String CBESB_HOME = (new Path(EsbPathHelper
062:                    .getCbesbHomeDir())).toString();
063:
064:            Custom custom;
065:
066:            private CustCompClassLoader classLoader;
067:
068:            protected CustomSelectWizardPage(String pageName, Custom custom,
069:                    List<ICustComponent> customList,
070:                    CustCompClassLoader classLoader) {
071:                super (pageName);
072:                this .custom = custom;
073:                this .customList = customList;
074:                setTitle(I18N.getString(Messages.CUSTOM_COM_WIZ));
075:                setDescription(I18N.getString(Messages.CUS_PAGE_MAIN_DES));
076:                this .classLoader = classLoader;
077:            }
078:
079:            public void createControl(Composite parent) {
080:
081:                final Composite topLevel = new Composite(parent, SWT.NONE);
082:                final GridLayout gridLayout = new GridLayout();
083:                gridLayout.horizontalSpacing = 10;
084:                gridLayout.numColumns = 2;
085:                topLevel.setLayout(gridLayout);
086:                topLevel.setLayoutData(new GridData(
087:                        GridData.VERTICAL_ALIGN_FILL
088:                                | GridData.HORIZONTAL_ALIGN_FILL));
089:                topLevel.setFont(parent.getFont());
090:                this .setControl(topLevel);
091:
092:                dynamicCompList(topLevel, customList);
093:
094:                this .setPageComplete(false);
095:                if (customList.size() < 1) {
096:                    this 
097:                            .setErrorMessage(I18N
098:                                    .getString(Messages.NO_CUSTOM_COM));
099:                } else {
100:                    this .setErrorMessage(I18N
101:                            .getString(Messages.CUS_PAGE_MAIN_DES));
102:                }
103:            }
104:
105:            public void dynamicCompList(Composite composite,
106:                    List<ICustComponent> customList) {
107:
108:                this .customList = customList;
109:                // Create a composite to hold the children
110:                GridData gridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL
111:                        | GridData.FILL_BOTH);
112:                composite.setLayoutData(gridData);
113:
114:                // Set numColumns to 3 for the buttons
115:                GridLayout layout = new GridLayout(3, false);
116:                layout.marginWidth = 4;
117:                composite.setLayout(layout);
118:
119:                // Create the table
120:                createTable(composite);
121:
122:            }
123:
124:            /**
125:             * Create the Table
126:             */
127:            private void createTable(Composite parent) {
128:
129:                int style = SWT.SINGLE | SWT.BORDER | SWT.H_SCROLL
130:                        | SWT.V_SCROLL | SWT.FULL_SELECTION
131:                        | SWT.HIDE_SELECTION;
132:
133:                final Table table = new Table(parent, style);
134:                final GridData gridData = new GridData(GridData.FILL_BOTH);
135:                gridData.grabExcessVerticalSpace = true;
136:                gridData.horizontalSpan = 3;
137:                table.setLayoutData(gridData);
138:
139:                table.setHeaderVisible(true);
140:                table.setLinesVisible(true);
141:                table.setBounds(new org.eclipse.swt.graphics.Rectangle(47, 67,
142:                        90, 70));
143:
144:                final TableColumn tableColumn = new TableColumn(table, SWT.NONE);
145:                tableColumn.setWidth(COLUMN_WIDTH);
146:                tableColumn.setText(RADIO_COLUMN);
147:                tableColumn.setResizable(true);
148:
149:                final TableColumn tableColumn1 = new TableColumn(table,
150:                        SWT.NONE);
151:                tableColumn1.setWidth(COLUMN_WIDTH);
152:                tableColumn1.setText(NAME_COLUMN);
153:                tableColumn1.setResizable(true);
154:
155:                final TableColumn tableColumn2 = new TableColumn(table,
156:                        SWT.NONE);
157:                tableColumn2.setWidth(COLUMN_WIDTH);
158:                tableColumn2.setText(ICON_COLUMN);
159:                tableColumn2.setResizable(true);
160:
161:                final TableColumn tableColumn3 = new TableColumn(table,
162:                        SWT.NONE);
163:                tableColumn3.setWidth(COLUMN_WIDTH);
164:                tableColumn3.setText(VENDOR_COLUMN);
165:                tableColumn3.setResizable(true);
166:
167:                final TableColumn tableColumn4 = new TableColumn(table,
168:                        SWT.NONE);
169:                tableColumn4.setWidth(COLUMN_WIDTH);
170:                tableColumn4.setText(VERSION_COLUMN);
171:                tableColumn4.setResizable(true);
172:
173:                final TableItem[] tableItem = new TableItem[customList.size()];
174:                final TableEditor[] editor = new TableEditor[customList.size()];
175:                final Button checkButton[] = new Button[customList.size()];
176:                final Label[] label_name = new Label[customList.size()];
177:                final Label[] label_icon = new Label[customList.size()];
178:                final Label[] label_vendor = new Label[customList.size()];
179:                final Label[] label_version = new Label[customList.size()];
180:
181:                for (int i = 0; i < customList.size(); i++) {
182:
183:                    tableItem[i] = new TableItem(table, SWT.NONE);
184:                    editor[i] = new TableEditor(table);
185:
186:                    checkButton[i] = new Button(table, SWT.RADIO);
187:                    map.put(checkButton[i], customList.get(i));
188:                    checkButton[i].pack();
189:
190:                    editor[i].minimumWidth = checkButton[i].getSize().x;
191:                    editor[i].horizontalAlignment = SWT.CENTER;
192:                    editor[i].setEditor(checkButton[i], tableItem[i], 0);
193:
194:                    editor[i] = new TableEditor(table);
195:
196:                    label_name[i] = new Label(table, SWT.NONE);
197:                    label_name[i].setText(customList.get(i).getName());
198:                    label_name[i].pack();
199:
200:                    editor[i].minimumWidth = label_name[i].getSize().x;
201:                    editor[i].horizontalAlignment = SWT.CENTER;
202:                    editor[i].setEditor(label_name[i], tableItem[i], 1);
203:
204:                    editor[i] = new TableEditor(table);
205:
206:                    label_icon[i] = new Label(table, SWT.ICON);
207:
208:                    String icon_path = customList.get(i)
209:                            .getBigIconResourceLocation();
210:                    if (!icon_path.startsWith(CBESB_HOME)) {
211:                        icon_path = CBESB_HOME + "/" + icon_path;
212:                    }
213:                    try {
214:                        InputStream stream = classLoader
215:                                .getInputStream(customList.get(i)
216:                                        .getSmallIconResourceLocation());
217:                        Display display = Display.getCurrent();
218:                        label_icon[i].setImage(new Image(display, stream));
219:                    } catch (Exception e) {
220:                        e.printStackTrace();
221:                    }
222:                    label_icon[i].pack();
223:
224:                    editor[i].minimumWidth = label_icon[i].getSize().x;
225:                    editor[i].horizontalAlignment = SWT.CENTER;
226:                    editor[i].setEditor(label_icon[i], tableItem[i], 2);
227:
228:                    editor[i] = new TableEditor(table);
229:                    label_vendor[i] = new Label(table, SWT.ICON);
230:                    label_vendor[i].setText(customList.get(i).getVendor());
231:                    label_vendor[i].pack();
232:                    editor[i].minimumWidth = label_vendor[i].getSize().x;
233:                    editor[i].horizontalAlignment = SWT.CENTER;
234:                    editor[i].setEditor(label_vendor[i], tableItem[i], 3);
235:
236:                    editor[i] = new TableEditor(table);
237:                    label_version[i] = new Label(table, SWT.ICON);
238:                    label_version[i].setText(customList.get(i).getVersion());
239:                    label_version[i].pack();
240:                    editor[i].minimumWidth = label_version[i].getSize().x;
241:                    editor[i].horizontalAlignment = SWT.CENTER;
242:                    editor[i].setEditor(label_version[i], tableItem[i], 4);
243:                }
244:
245:                for (int i = 0; i < customList.size(); i++) {
246:                    checkButton[i].addSelectionListener(new SelectionAdapter() {
247:
248:                        public void widgetSelected(SelectionEvent ev) {
249:
250:                            custCom = map.get(ev.getSource());
251:                            updatePage();
252:
253:                        }
254:                    });
255:                }
256:
257:            }
258:
259:            private void updatePage() {
260:
261:                ModelInfoPass.modeltoFlow(custom, custCom);
262:                ((CustomPropertyPageMain) getWizard().getPage("CommonProperty"))
263:                        .setCustom(custom);
264:                ((CustomPropertyPageMain) getWizard().getPage("CommonProperty"))
265:                        .getCustom().setCustomComponent(custCom);
266:
267:                if (custCom != null) {
268:                    this .setPageComplete(true);
269:                    ((CustomPropertyPageMain) getWizard().getPage(
270:                            "CommonProperty")).inforPass();
271:                    ((CustomPropertyPageMain) getWizard().getPage(
272:                            "CommonProperty")).addDynPages();
273:                    this .setErrorMessage(null);
274:                }
275:
276:                else {
277:                    this .setPageComplete(false);
278:                }
279:
280:            }
281:
282:            public IWizardPage getNextPage() {
283:                return getWizard().getPage("CommonProperty");
284:            }
285:
286:            @Override
287:            public void controlToModels() {
288:
289:            }
290:
291:            @Override
292:            public void modelsToControl() {
293:
294:            }
295:
296:        }
w___w_w_._jav_a_2s_.c___o_m__ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.