Source Code Cross Referenced for HeaderPage.java in  » Report » pentaho-report » org » pentaho » designstudio » editors » actionsequence » pages » 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 » Report » pentaho report » org.pentaho.designstudio.editors.actionsequence.pages 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2006 Pentaho Corporation.  All rights reserved. 
003:         * This software was developed by Pentaho Corporation and is provided under the terms 
004:         * of the Mozilla Public License, Version 1.1, or any later version. You may not use 
005:         * this file except in compliance with the license. If you need a copy of the license, 
006:         * please go to http://www.mozilla.org/MPL/MPL-1.1.txt. The Original Code is the Pentaho 
007:         * BI Platform.  The Initial Developer is Pentaho Corporation.
008:         *
009:         * Software distributed under the Mozilla Public License is distributed on an "AS IS" 
010:         * basis, WITHOUT WARRANTY OF ANY KIND, either express or  implied. Please refer to 
011:         * the license for the specific language governing your rights and limitations.
012:         *
013:         * @created Oct 27, 2005 
014:         * @author dmoran
015:         */
016:
017:        package org.pentaho.designstudio.editors.actionsequence.pages;
018:
019:        import org.eclipse.core.resources.IFile;
020:        import org.eclipse.core.resources.IResource;
021:        import org.eclipse.core.runtime.IPath;
022:        import org.eclipse.core.runtime.Path;
023:        import org.eclipse.jface.dialogs.MessageDialog;
024:        import org.eclipse.swt.SWT;
025:        import org.eclipse.swt.dnd.DND;
026:        import org.eclipse.swt.dnd.DropTarget;
027:        import org.eclipse.swt.dnd.DropTargetEvent;
028:        import org.eclipse.swt.dnd.DropTargetListener;
029:        import org.eclipse.swt.dnd.TextTransfer;
030:        import org.eclipse.swt.dnd.Transfer;
031:        import org.eclipse.swt.events.FocusEvent;
032:        import org.eclipse.swt.events.FocusListener;
033:        import org.eclipse.swt.events.ModifyEvent;
034:        import org.eclipse.swt.events.ModifyListener;
035:        import org.eclipse.swt.events.SelectionEvent;
036:        import org.eclipse.swt.events.SelectionListener;
037:        import org.eclipse.swt.graphics.Image;
038:        import org.eclipse.swt.graphics.ImageData;
039:        import org.eclipse.swt.layout.FillLayout;
040:        import org.eclipse.swt.layout.GridData;
041:        import org.eclipse.swt.layout.GridLayout;
042:        import org.eclipse.swt.widgets.Button;
043:        import org.eclipse.swt.widgets.Combo;
044:        import org.eclipse.swt.widgets.Composite;
045:        import org.eclipse.swt.widgets.FileDialog;
046:        import org.eclipse.swt.widgets.Label;
047:        import org.eclipse.swt.widgets.Text;
048:        import org.eclipse.ui.IEditorInput;
049:        import org.eclipse.ui.IPathEditorInput;
050:        import org.eclipse.ui.forms.IManagedForm;
051:        import org.eclipse.ui.forms.editor.FormEditor;
052:        import org.eclipse.ui.forms.editor.FormPage;
053:        import org.eclipse.ui.forms.widgets.TableWrapData;
054:        import org.eclipse.ui.forms.widgets.TableWrapLayout;
055:        import org.eclipse.ui.part.FileEditorInput;
056:        import org.eclipse.ui.part.ResourceTransfer;
057:        import org.pentaho.actionsequence.dom.ActionSequenceDocument;
058:        import org.pentaho.designstudio.controls.WidgetFactory;
059:        import org.pentaho.designstudio.editors.actionsequence.ActionSequenceDocumentProvider;
060:        import org.pentaho.designstudio.messages.Messages;
061:
062:        /**
063:         * Page used to display the details of the summary and documentation elements within an action sequence.
064:         * 
065:         * @author Doug Moran
066:         *
067:         */
068:        public class HeaderPage extends FormPage implements  FocusListener,
069:                SelectionListener, ModifyListener {
070:
071:            public class IconDropTargetListener implements  DropTargetListener {
072:                Text iconText;
073:
074:                public IconDropTargetListener(Text iconText) {
075:                    super ();
076:                    this .iconText = iconText;
077:                }
078:
079:                public void dragEnter(DropTargetEvent event) {
080:                    if (event.detail == DND.DROP_DEFAULT) {
081:                        if ((event.operations & DND.DROP_COPY) != 0) {
082:                            event.detail = DND.DROP_COPY;
083:                        } else {
084:                            event.detail = DND.DROP_NONE;
085:                        }
086:                    }
087:                }
088:
089:                public void dragOver(DropTargetEvent event) {
090:                }
091:
092:                public void dragOperationChanged(DropTargetEvent event) {
093:                }
094:
095:                public void dragLeave(DropTargetEvent event) {
096:                }
097:
098:                public void dropAccept(DropTargetEvent event) {
099:                }
100:
101:                public void drop(DropTargetEvent event) {
102:                    if (resourceTransfer.isSupportedType(event.currentDataType)) {
103:                        IResource[] resources = (IResource[]) event.data;
104:                        if ((resources.length == 1)
105:                                && (resources[0] instanceof  IFile)) {
106:                            performDrop(iconText, (IFile) resources[0]);
107:                        }
108:                    }
109:                }
110:            }
111:
112:            protected ActionSequenceDocumentProvider actSeqDocProvider;
113:
114:            Text titleXA;
115:
116:            Text verXA;
117:
118:            Combo loggingXA;
119:
120:            Text authorXA;
121:
122:            Text descXA;
123:
124:            Text helpXA;
125:
126:            Text resultXA;
127:
128:            Text iconLocationXA;
129:
130:            Text flyoverIconLocationXA;
131:
132:            Button isVisible;
133:
134:            boolean iconLocationChanged = false;
135:
136:            boolean flyoverIconLocationChanged = false;
137:
138:            Label iconImage;
139:
140:            Label flyoverIconImage;
141:
142:            Button browserBtn;
143:
144:            Button flyoverBrowserBtn;
145:
146:            DropTarget iconLocationDropTarget;
147:
148:            DropTarget flyoverLocationDropTarget;
149:
150:            DropTarget iconDropTarget;
151:
152:            DropTarget flyoverIconDropTarget;
153:
154:            DropTarget iconCompositeDropTarget;
155:
156:            DropTarget flyoverCompositeDropTarget;
157:
158:            Label resultTypeLabel;
159:
160:            ResourceTransfer resourceTransfer = ResourceTransfer.getInstance();
161:            TextTransfer textTransfer = TextTransfer.getInstance();
162:
163:            /** 
164:             * Creates a header page.
165:             * @param editor the form editor of which this page is a part.
166:             * @param actSeqDocProvider the provider of the XML document.
167:             */
168:            public HeaderPage(FormEditor editor,
169:                    ActionSequenceDocumentProvider actSeqDocProvider) {
170:                super (
171:                        editor,
172:                        "HeaderPage", Messages.getString("HeaderPage.UI_GENERAL_TAB_LABEL")); //$NON-NLS-1$ //$NON-NLS-2$
173:                this .actSeqDocProvider = actSeqDocProvider;
174:            }
175:
176:            /* (non-Javadoc)
177:             * @see org.eclipse.ui.forms.editor.FormPage#createFormContent(org.eclipse.ui.forms.IManagedForm)
178:             */
179:            protected void createFormContent(IManagedForm managedForm) {
180:                managedForm.getForm().getBody().setLayout(new FillLayout());
181:
182:                Composite formBody = WidgetFactory.createComposite(managedForm
183:                        .getForm().getBody());
184:
185:                TableWrapLayout layout = new TableWrapLayout();
186:                layout.numColumns = 1;
187:                formBody.setLayout(layout);
188:
189:                Composite topComposite = new Composite(formBody, SWT.NONE);
190:                GridLayout gridLayout = new GridLayout(4, false);
191:                gridLayout.horizontalSpacing = 10;
192:                topComposite.setLayout(gridLayout);
193:                topComposite.setLayoutData(new TableWrapData(
194:                        TableWrapData.FILL_GRAB));
195:
196:                Label label = WidgetFactory.createLabel(topComposite, Messages
197:                        .getString("HeaderPage.ACTION_SEQUENCE_TITLE")); //$NON-NLS-1$
198:                label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
199:
200:                WidgetFactory.createLabel(topComposite, "  "); //$NON-NLS-1$
201:
202:                WidgetFactory.createLabel(topComposite, Messages
203:                        .getString("HeaderPage.UI_GENERAL_TAB_ICON_LABEL")); //$NON-NLS-1$
204:
205:                WidgetFactory.createLabel(topComposite, Messages
206:                        .getString("HeaderPage.UI_GENERAL_TAB_ICON_LOCATION")); //$NON-NLS-1$
207:
208:                titleXA = WidgetFactory.createText(topComposite, ""); //$NON-NLS-1$
209:                titleXA.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
210:                titleXA.addModifyListener(this );
211:
212:                WidgetFactory.createLabel(topComposite, "  "); //$NON-NLS-1$
213:
214:                Composite iconComposite = WidgetFactory.createComposite(
215:                        topComposite, SWT.BORDER);
216:                GridData layoutData = new GridData();
217:                layoutData.verticalSpan = 5;
218:                layoutData.widthHint = 100;
219:                layoutData.heightHint = 100;
220:                layoutData.verticalAlignment = GridData.BEGINNING;
221:                iconComposite.setLayoutData(layoutData);
222:                iconComposite.setLayout(new GridLayout());
223:
224:                iconImage = WidgetFactory.createLabel(iconComposite, ""); //$NON-NLS-1$
225:
226:                iconLocationXA = WidgetFactory.createText(topComposite, ""); //$NON-NLS-1$
227:                layoutData = new GridData();
228:                layoutData.widthHint = 250;
229:                iconLocationXA.setLayoutData(layoutData);
230:                iconLocationXA.addModifyListener(this );
231:
232:                label = WidgetFactory.createLabel(topComposite, Messages
233:                        .getString("HeaderPage.ACTION_SEQUENCE_VERSION")); //$NON-NLS-1$
234:                WidgetFactory.createLabel(topComposite, "  "); //$NON-NLS-1$
235:
236:                browserBtn = WidgetFactory
237:                        .createButton(
238:                                topComposite,
239:                                Messages
240:                                        .getString("HeaderPage.UI_GENERAL_TAB_BROWSE_LINK"), SWT.FLAT); //$NON-NLS-1$
241:                browserBtn.addSelectionListener(this );
242:                layoutData = new GridData();
243:                layoutData.verticalSpan = 4;
244:                layoutData.verticalAlignment = GridData.BEGINNING;
245:                layoutData.horizontalAlignment = GridData.END;
246:                browserBtn.setLayoutData(layoutData);
247:
248:                verXA = WidgetFactory.createText(topComposite, ""); //$NON-NLS-1$
249:                verXA.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
250:                verXA.addModifyListener(this );
251:                WidgetFactory.createLabel(topComposite, "  "); //$NON-NLS-1$
252:
253:                label = WidgetFactory.createLabel(topComposite, Messages
254:                        .getString("HeaderPage.ERROR_LOGGING_LEVEL")); //$NON-NLS-1$
255:                WidgetFactory.createLabel(topComposite, "  "); //$NON-NLS-1$
256:
257:                loggingXA = WidgetFactory.createCombo(topComposite, SWT.NONE);
258:                loggingXA.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
259:                loggingXA.setItems(ActionSequenceDocument.LOGGING_LEVELS);
260:                loggingXA.addModifyListener(this );
261:                WidgetFactory.createLabel(topComposite, "  "); //$NON-NLS-1$
262:
263:                label = WidgetFactory.createLabel(topComposite, Messages
264:                        .getString("HeaderPage.ACTION_SEQUENCE_AUTHOR")); //$NON-NLS-1$
265:                WidgetFactory.createLabel(topComposite, "  "); //$NON-NLS-1$
266:
267:                WidgetFactory.createLabel(topComposite, Messages
268:                        .getString("HeaderPage.FLYOVER_ICON")); //$NON-NLS-1$
269:
270:                WidgetFactory.createLabel(topComposite, Messages
271:                        .getString("HeaderPage.FLYOVER_ICON_LOCATION")); //$NON-NLS-1$
272:
273:                authorXA = WidgetFactory.createText(topComposite, ""); //$NON-NLS-1$
274:                authorXA.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
275:                authorXA.addModifyListener(this );
276:                WidgetFactory.createLabel(topComposite, "  "); //$NON-NLS-1$
277:
278:                Composite flyoverIconComposite = WidgetFactory.createComposite(
279:                        topComposite, SWT.BORDER);
280:                layoutData = new GridData();
281:                layoutData.verticalSpan = 4;
282:                layoutData.widthHint = 100;
283:                layoutData.heightHint = 100;
284:                layoutData.verticalAlignment = GridData.BEGINNING;
285:                flyoverIconComposite.setLayoutData(layoutData);
286:                flyoverIconComposite.setLayout(new GridLayout());
287:
288:                flyoverIconImage = WidgetFactory.createLabel(
289:                        flyoverIconComposite, ""); //$NON-NLS-1$
290:
291:                flyoverIconLocationXA = WidgetFactory.createText(topComposite,
292:                        ""); //$NON-NLS-1$
293:                layoutData = new GridData();
294:                layoutData.widthHint = 250;
295:                flyoverIconLocationXA.setLayoutData(layoutData);
296:                flyoverIconLocationXA.addModifyListener(this );
297:
298:                resultTypeLabel = WidgetFactory
299:                        .createLabel(
300:                                topComposite,
301:                                Messages
302:                                        .getString("HeaderPage.ACTION_SEQUENCE_RESULT_TYPE")); //$NON-NLS-1$
303:                WidgetFactory.createLabel(topComposite, "  "); //$NON-NLS-1$
304:
305:                flyoverBrowserBtn = WidgetFactory
306:                        .createButton(
307:                                topComposite,
308:                                Messages
309:                                        .getString("HeaderPage.UI_GENERAL_TAB_BROWSE_LINK"), SWT.FLAT); //$NON-NLS-1$
310:                flyoverBrowserBtn.addSelectionListener(this );
311:                layoutData = new GridData();
312:                layoutData.verticalSpan = 3;
313:                layoutData.verticalAlignment = GridData.BEGINNING;
314:                layoutData.horizontalAlignment = GridData.END;
315:                flyoverBrowserBtn.setLayoutData(layoutData);
316:
317:                resultXA = WidgetFactory.createText(topComposite, ""); //$NON-NLS-1$
318:                layoutData = new GridData(GridData.FILL_HORIZONTAL);
319:                layoutData.verticalAlignment = GridData.BEGINNING;
320:                resultXA.setLayoutData(layoutData);
321:                resultXA.addModifyListener(this );
322:
323:                WidgetFactory.createLabel(topComposite, "  "); //$NON-NLS-1$
324:
325:                isVisible = WidgetFactory.createButton(topComposite, Messages
326:                        .getString("HeaderPage.IS_VISIBLE"), SWT.CHECK); //$NON-NLS-1$
327:                layoutData = new GridData();
328:                layoutData.grabExcessVerticalSpace = true;
329:                layoutData.verticalAlignment = GridData.END;
330:                layoutData.horizontalSpan = 4;
331:                isVisible.setLayoutData(layoutData);
332:                isVisible.addSelectionListener(this );
333:
334:                label = WidgetFactory.createLabel(topComposite, ""); //$NON-NLS-1$
335:                layoutData = new GridData();
336:                layoutData.horizontalSpan = 4;
337:                label.setLayoutData(layoutData);
338:
339:                Label sep = WidgetFactory.createSeparator(topComposite);
340:                layoutData = new GridData(GridData.FILL_HORIZONTAL);
341:                layoutData.horizontalSpan = 4;
342:                sep.setLayoutData(layoutData);
343:
344:                label = WidgetFactory.createLabel(topComposite, ""); //$NON-NLS-1$
345:                layoutData = new GridData();
346:                layoutData.horizontalSpan = 4;
347:                label.setLayoutData(layoutData);
348:
349:                label = WidgetFactory.createLabel(topComposite, Messages
350:                        .getString("HeaderPage.ACTION_SEQUENCE_DESCRIPTION")); //$NON-NLS-1$
351:                layoutData = new GridData();
352:                layoutData.horizontalSpan = 4;
353:                label.setLayoutData(layoutData);
354:
355:                layoutData = new GridData(GridData.FILL_HORIZONTAL);
356:                layoutData.horizontalSpan = 4;
357:                layoutData.heightHint = 100;
358:                if (System.getProperty("os.name").startsWith("Mac")) {
359:                    Composite composite = WidgetFactory.createComposite(
360:                            topComposite, SWT.BORDER);
361:                    composite.setLayoutData(layoutData);
362:                    composite.setLayout(new FillLayout());
363:                    descXA = WidgetFactory
364:                            .createText(
365:                                    composite,
366:                                    "", SWT.MULTI | SWT.WRAP | SWT.V_SCROLL | SWT.BORDER); //$NON-NLS-1$
367:                } else {
368:                    descXA = WidgetFactory
369:                            .createText(
370:                                    topComposite,
371:                                    "", SWT.MULTI | SWT.WRAP | SWT.V_SCROLL | SWT.BORDER); //$NON-NLS-1$
372:                    descXA.setLayoutData(layoutData);
373:                }
374:                descXA.addModifyListener(this );
375:
376:                label = WidgetFactory.createLabel(topComposite, Messages
377:                        .getString("HeaderPage.ACTION_SEQUENCE_HELP")); //$NON-NLS-1$
378:                layoutData = new GridData();
379:                layoutData.horizontalSpan = 4;
380:                label.setLayoutData(layoutData);
381:
382:                layoutData = new GridData(GridData.FILL_HORIZONTAL);
383:                layoutData.horizontalSpan = 4;
384:                layoutData.heightHint = 100;
385:                if (System.getProperty("os.name").startsWith("Mac")) {
386:                    Composite composite = WidgetFactory.createComposite(
387:                            topComposite, SWT.BORDER);
388:                    composite.setLayoutData(layoutData);
389:                    composite.setLayout(new FillLayout());
390:                    helpXA = WidgetFactory
391:                            .createText(
392:                                    composite,
393:                                    "", SWT.MULTI | SWT.WRAP | SWT.V_SCROLL | SWT.BORDER); //$NON-NLS-1$
394:                } else {
395:                    helpXA = WidgetFactory
396:                            .createText(
397:                                    topComposite,
398:                                    "", SWT.MULTI | SWT.WRAP | SWT.V_SCROLL | SWT.BORDER); //$NON-NLS-1$
399:                    helpXA.setLayoutData(layoutData);
400:                }
401:                helpXA.addModifyListener(this );
402:
403:                iconLocationDropTarget = new DropTarget(iconLocationXA,
404:                        DND.DROP_MOVE | DND.DROP_COPY | DND.DROP_DEFAULT);
405:                iconLocationDropTarget.setTransfer(new Transfer[] {
406:                        resourceTransfer, textTransfer });
407:                iconLocationDropTarget
408:                        .addDropListener(new IconDropTargetListener(
409:                                iconLocationXA));
410:
411:                flyoverLocationDropTarget = new DropTarget(
412:                        flyoverIconLocationXA, DND.DROP_MOVE | DND.DROP_COPY
413:                                | DND.DROP_DEFAULT);
414:                flyoverLocationDropTarget.setTransfer(new Transfer[] {
415:                        resourceTransfer, textTransfer });
416:                flyoverLocationDropTarget
417:                        .addDropListener(new IconDropTargetListener(
418:                                flyoverIconLocationXA));
419:
420:                iconDropTarget = new DropTarget(iconImage, DND.DROP_MOVE
421:                        | DND.DROP_COPY | DND.DROP_DEFAULT);
422:                iconDropTarget.setTransfer(new Transfer[] { resourceTransfer,
423:                        textTransfer });
424:                iconDropTarget.addDropListener(new IconDropTargetListener(
425:                        iconLocationXA));
426:
427:                flyoverIconDropTarget = new DropTarget(flyoverIconImage,
428:                        DND.DROP_MOVE | DND.DROP_COPY | DND.DROP_DEFAULT);
429:                flyoverIconDropTarget.setTransfer(new Transfer[] {
430:                        resourceTransfer, textTransfer });
431:                flyoverIconDropTarget
432:                        .addDropListener(new IconDropTargetListener(
433:                                flyoverIconLocationXA));
434:
435:                iconCompositeDropTarget = new DropTarget(iconComposite,
436:                        DND.DROP_MOVE | DND.DROP_COPY | DND.DROP_DEFAULT);
437:                iconCompositeDropTarget.setTransfer(new Transfer[] {
438:                        resourceTransfer, textTransfer });
439:                iconCompositeDropTarget
440:                        .addDropListener(new IconDropTargetListener(
441:                                iconLocationXA));
442:
443:                flyoverCompositeDropTarget = new DropTarget(
444:                        flyoverIconComposite, DND.DROP_MOVE | DND.DROP_COPY
445:                                | DND.DROP_DEFAULT);
446:                flyoverCompositeDropTarget.setTransfer(new Transfer[] {
447:                        resourceTransfer, textTransfer });
448:                flyoverCompositeDropTarget
449:                        .addDropListener(new IconDropTargetListener(
450:                                flyoverIconLocationXA));
451:
452:                iconLocationXA.addFocusListener(this );
453:                iconLocationXA.addSelectionListener(this );
454:                flyoverIconLocationXA.addFocusListener(this );
455:                flyoverIconLocationXA.addSelectionListener(this );
456:            }
457:
458:            /* (non-Javadoc)
459:             * @see org.pentaho.designstudio.editors.actionsequence.pages.ActSeqBasePage#refreshPage(org.dom4j.Document)
460:             */
461:            protected void refresh() {
462:
463:                titleXA.removeModifyListener(this );
464:                verXA.removeModifyListener(this );
465:                loggingXA.removeModifyListener(this );
466:                authorXA.removeModifyListener(this );
467:                descXA.removeModifyListener(this );
468:                helpXA.removeModifyListener(this );
469:                resultXA.removeModifyListener(this );
470:                iconLocationXA.removeModifyListener(this );
471:                flyoverIconLocationXA.removeModifyListener(this );
472:                isVisible.removeSelectionListener(this );
473:
474:                titleXA.setText(actSeqDocProvider.getActionSequence()
475:                        .getTitle());
476:                verXA.setText(actSeqDocProvider.getActionSequence()
477:                        .getVersion());
478:                loggingXA.setText(actSeqDocProvider.getActionSequence()
479:                        .getLoggingLevel());
480:                authorXA.setText(actSeqDocProvider.getActionSequence()
481:                        .getAuthor());
482:                descXA.setText(actSeqDocProvider.getActionSequence()
483:                        .getDescription());
484:                helpXA.setText(actSeqDocProvider.getActionSequence().getHelp());
485:                resultXA.setText(actSeqDocProvider.getActionSequence()
486:                        .getResultType() != null ? actSeqDocProvider
487:                        .getActionSequence().getResultType() : "none"); //$NON-NLS-1$
488:                iconLocationXA.setText(actSeqDocProvider.getActionSequence()
489:                        .getIconLocation());
490:                flyoverIconLocationXA.setText(actSeqDocProvider
491:                        .getActionSequence().getFlyoverIconLocation());
492:                isVisible
493:                        .setSelection((actSeqDocProvider.getActionSequence()
494:                                .getResultType() != null)
495:                                && (!"none".equalsIgnoreCase(actSeqDocProvider.getActionSequence().getResultType()))); //$NON-NLS-1$
496:                refreshIcon(iconLocationXA);
497:                refreshIcon(flyoverIconLocationXA);
498:
499:                titleXA.addModifyListener(this );
500:                verXA.addModifyListener(this );
501:                loggingXA.addModifyListener(this );
502:                authorXA.addModifyListener(this );
503:                descXA.addModifyListener(this );
504:                helpXA.addModifyListener(this );
505:                resultXA.addModifyListener(this );
506:                iconLocationXA.addModifyListener(this );
507:                flyoverIconLocationXA.addModifyListener(this );
508:                isVisible.addSelectionListener(this );
509:
510:                getManagedForm().reflow(true);
511:            }
512:
513:            private void refreshIcon(Text locationText) {
514:                String pathName = locationText.getText();
515:                Label imageLabel = (locationText == iconLocationXA ? iconImage
516:                        : flyoverIconImage);
517:                IPath iconPath = null;
518:                try {
519:                    if ((pathName != null) && (pathName.trim().length() > 0)) {
520:                        IPath path = new Path(pathName);
521:                        if (!path.isAbsolute()) {
522:                            iconPath = getBasePath().append(path);
523:                        } else {
524:                            iconPath = path;
525:                        }
526:                    }
527:                } catch (Exception ex) {
528:                    iconPath = null;
529:                }
530:
531:                if (iconPath != null) {
532:                    try {
533:                        ImageData imageData = new ImageData(iconPath.toString());
534:                        imageLabel.setImage(new Image(iconImage.getDisplay(),
535:                                imageData));
536:                        imageLabel.pack();
537:                    } catch (Exception ex) {
538:                        System.err
539:                                .println(Messages
540:                                        .getString(
541:                                                "HeaderPage.UI_ICON_LOAD_ERROR_MSG", iconPath.toString())); //$NON-NLS-1$
542:                    }
543:                } else {
544:                    imageLabel.setImage(null);
545:                }
546:                if (locationText == iconLocationXA) {
547:                    iconLocationChanged = false;
548:                } else {
549:                    flyoverIconLocationChanged = false;
550:                }
551:            }
552:
553:            public void focusGained(FocusEvent e) {
554:                if (e.getSource() == iconLocationXA) {
555:                    iconLocationChanged = false;
556:                } else if (e.getSource() == flyoverIconLocationXA) {
557:                    flyoverIconLocationChanged = false;
558:                }
559:            }
560:
561:            public void focusLost(FocusEvent e) {
562:                if ((e.getSource() == iconLocationXA) && iconLocationChanged) {
563:                    refreshIcon(iconLocationXA);
564:                } else if ((e.getSource() == flyoverIconLocationXA)
565:                        && flyoverIconLocationChanged) {
566:                    refreshIcon(flyoverIconLocationXA);
567:                }
568:            }
569:
570:            public void widgetDefaultSelected(SelectionEvent e) {
571:                if ((e.getSource() == iconLocationXA) && iconLocationChanged) {
572:                    refreshIcon(iconLocationXA);
573:                } else if ((e.getSource() == flyoverIconLocationXA)
574:                        && flyoverIconLocationChanged) {
575:                    refreshIcon(flyoverIconLocationXA);
576:                } else if (e.getSource() == isVisible) {
577:                    resultXA.removeModifyListener(this );
578:                    if (isVisible.getSelection()) {
579:                        actSeqDocProvider.getActionSequence().setResultType(""); //$NON-NLS-1$
580:                        resultXA.setText(""); //$NON-NLS-1$
581:                    } else {
582:                        actSeqDocProvider.getActionSequence().setResultType(
583:                                "none"); //$NON-NLS-1$
584:                        resultXA.setText("none"); //$NON-NLS-1$
585:                    }
586:                    resultXA.addModifyListener(this );
587:                }
588:            }
589:
590:            public void widgetSelected(SelectionEvent e) {
591:                if (e.getSource() == isVisible) {
592:                    resultXA.removeModifyListener(this );
593:                    if (isVisible.getSelection()) {
594:                        actSeqDocProvider.getActionSequence().setResultType(""); //$NON-NLS-1$
595:                        resultXA.setText(""); //$NON-NLS-1$
596:                    } else {
597:                        actSeqDocProvider.getActionSequence().setResultType(
598:                                "none"); //$NON-NLS-1$
599:                        resultXA.setText("none"); //$NON-NLS-1$
600:                    }
601:                    resultXA.addModifyListener(this );
602:                } else if ((e.getSource() == browserBtn)
603:                        || (e.getSource() == flyoverBrowserBtn)) {
604:                    FileDialog fileChooser = new FileDialog(((Button) e
605:                            .getSource()).getShell(), SWT.OPEN);
606:                    fileChooser
607:                            .setText(Messages
608:                                    .getString("HeaderPage.UI_GENERAL_TAB_SELECT_IMAGE")); //$NON-NLS-1$
609:                    fileChooser
610:                            .setFilterExtensions(new String[] { Messages
611:                                    .getString("BrowserHyperlink.UI_FILE_FILTER_EXTENSION") }); //$NON-NLS-1$
612:                    fileChooser.setFilterNames(new String[] { Messages
613:                            .getString("BrowserHyperlink.UI_ALL_FILES") }); //$NON-NLS-1$
614:                    fileChooser.setFilterPath(getBasePath().toString());
615:                    String filename = fileChooser.open();
616:                    if (filename != null) {
617:                        IPath basePath = getBasePath();
618:                        IPath filePath = new Path(filename);
619:                        if (basePath.isPrefixOf(filePath)) {
620:                            IPath relativePath = filePath
621:                                    .removeFirstSegments(filePath
622:                                            .matchingFirstSegments(basePath));
623:                            relativePath = relativePath.setDevice(null);
624:                            if (e.getSource() == browserBtn) {
625:                                iconLocationXA.setText(relativePath.toString());
626:                                refreshIcon(iconLocationXA);
627:                            } else {
628:                                flyoverIconLocationXA.setText(relativePath
629:                                        .toString());
630:                                refreshIcon(flyoverIconLocationXA);
631:                            }
632:                        } else {
633:                            MessageDialog
634:                                    .openError(
635:                                            browserBtn.getShell(),
636:                                            Messages
637:                                                    .getString("HeaderPage.INVALID_ICON_LOCATION"), Messages.getString("HeaderPage.INVALID_ICON_MESSAGE")); //$NON-NLS-1$ //$NON-NLS-2$
638:                        }
639:                    }
640:                }
641:            }
642:
643:            public void modifyText(ModifyEvent e) {
644:                if (e.getSource() == titleXA) {
645:                    actSeqDocProvider.getActionSequence().setTitle(
646:                            titleXA.getText());
647:                } else if (e.getSource() == verXA) {
648:                    actSeqDocProvider.getActionSequence().setVersion(
649:                            verXA.getText());
650:                } else if (e.getSource() == authorXA) {
651:                    actSeqDocProvider.getActionSequence().setAuthor(
652:                            authorXA.getText());
653:                } else if (e.getSource() == descXA) {
654:                    actSeqDocProvider.getActionSequence().setDescription(
655:                            descXA.getText());
656:                } else if (e.getSource() == helpXA) {
657:                    actSeqDocProvider.getActionSequence().setHelp(
658:                            helpXA.getText());
659:                } else if (e.getSource() == resultXA) {
660:                    String resultType = resultXA.getText().trim();
661:                    isVisible.removeSelectionListener(this );
662:                    isVisible
663:                            .setSelection(!"none".equalsIgnoreCase(resultType)); //$NON-NLS-1$
664:                    isVisible.addSelectionListener(this );
665:                    actSeqDocProvider.getActionSequence().setResultType(
666:                            resultType);
667:                } else if (e.getSource() == iconLocationXA) {
668:                    actSeqDocProvider.getActionSequence().setIconLocation(
669:                            iconLocationXA.getText());
670:                    iconLocationChanged = true;
671:                    iconImage.setImage(null);
672:                } else if (e.getSource() == flyoverIconLocationXA) {
673:                    actSeqDocProvider.getActionSequence()
674:                            .setFlyoverIconLocation(
675:                                    flyoverIconLocationXA.getText());
676:                    flyoverIconLocationChanged = true;
677:                    flyoverIconImage.setImage(null);
678:                } else if (e.getSource() == loggingXA) {
679:                    actSeqDocProvider.getActionSequence().setLoggingLevel(
680:                            loggingXA.getText());
681:                }
682:            }
683:
684:            private IPath getBasePath() {
685:                IEditorInput edInput = getEditorInput();
686:                IPath basePath = null;
687:                if (edInput instanceof  FileEditorInput) {
688:                    basePath = ((FileEditorInput) edInput).getFile()
689:                            .getLocation().removeLastSegments(1);
690:                } else if (edInput instanceof  IPathEditorInput) {
691:                    basePath = ((IPathEditorInput) edInput).getPath()
692:                            .removeLastSegments(1);
693:                }
694:                return basePath;
695:            }
696:
697:            protected void performDrop(Text iconText, IFile file) {
698:                String fileName = file.getRawLocation().toString();
699:                IPath basePath = getBasePath();
700:                IPath filePath = new Path(fileName);
701:                if (basePath.isPrefixOf(filePath)) {
702:                    IPath relativePath = filePath.removeFirstSegments(filePath
703:                            .matchingFirstSegments(basePath));
704:                    relativePath = relativePath.setDevice(null);
705:                    iconText.setText(relativePath.toString());
706:                    if (iconText == iconLocationXA) {
707:                        refreshIcon(iconLocationXA);
708:                    } else {
709:                        refreshIcon(flyoverIconLocationXA);
710:                    }
711:                } else {
712:                    MessageDialog
713:                            .openError(
714:                                    iconText.getShell(),
715:                                    Messages
716:                                            .getString("HeaderPage.INVALID_ICON_LOCATION"), Messages.getString("HeaderPage.INVALID_ICON_MESSAGE")); //$NON-NLS-1$ //$NON-NLS-2$
717:                }
718:            }
719:
720:            public void setActive(boolean active) {
721:                if (active) {
722:                    refresh();
723:                }
724:                super.setActive(active);
725:            }
726:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.