Source Code Cross Referenced for SelectMapPage.java in  » GIS » udig-1.1 » net » refractions » udig » project » ui » internal » 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 » GIS » udig 1.1 » net.refractions.udig.project.ui.internal 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package net.refractions.udig.project.ui.internal;
002:
003:        import java.util.List;
004:
005:        import net.refractions.udig.project.internal.ContextModel;
006:        import net.refractions.udig.project.internal.Layer;
007:        import net.refractions.udig.project.internal.Map;
008:        import net.refractions.udig.project.internal.Project;
009:        import net.refractions.udig.project.internal.ProjectPlugin;
010:        import net.refractions.udig.project.internal.render.RenderManager;
011:        import net.refractions.udig.project.internal.render.ViewportModel;
012:
013:        import org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider;
014:        import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;
015:        import org.eclipse.jface.viewers.ISelectionChangedListener;
016:        import org.eclipse.jface.viewers.IStructuredSelection;
017:        import org.eclipse.jface.viewers.SelectionChangedEvent;
018:        import org.eclipse.jface.viewers.StructuredSelection;
019:        import org.eclipse.jface.viewers.TreeViewer;
020:        import org.eclipse.jface.wizard.WizardPage;
021:        import org.eclipse.swt.SWT;
022:        import org.eclipse.swt.layout.GridData;
023:        import org.eclipse.swt.layout.GridLayout;
024:        import org.eclipse.swt.widgets.Composite;
025:        import org.eclipse.swt.widgets.Label;
026:
027:        /**
028:         * A Wizard page for selecting a map. Part of the New Layer wizard.
029:         * 
030:         * @author Richard Gould
031:         */
032:        public class SelectMapPage extends WizardPage implements 
033:                ISelectionChangedListener {
034:
035:            Map selectedMap;
036:
037:            private TreeViewer tree;
038:
039:            private IStructuredSelection selection;
040:
041:            protected SelectMapPage() {
042:                super (Messages.SelectMapPage_page_title);
043:                setDescription(Messages.SelectMapPage_page_description);
044:            }
045:
046:            /**
047:             * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
048:             */
049:            public void createControl(Composite parent) {
050:
051:                Composite composite = new Composite(parent, SWT.NULL);
052:
053:                GridLayout gridLayout = new GridLayout(2, false);
054:                composite.setLayout(gridLayout);
055:
056:                Label label = new Label(composite, SWT.NONE);
057:                label.setText(Messages.SelectMapPage_label_selectAMap_text);
058:                label
059:                        .setLayoutData(new GridData(SWT.END, SWT.TOP, false,
060:                                false));
061:                label.setToolTipText(Messages.SelectMapPage_page_description);
062:
063:                tree = new TreeViewer(composite, SWT.SINGLE);
064:
065:                tree.setAutoExpandLevel(2);
066:                tree.setContentProvider(new AdapterFactoryContentProvider(
067:                        ProjectExplorer.getProjectExplorer()
068:                                .getAdapterFactory()));
069:
070:                tree.setLabelProvider(new AdapterFactoryLabelProvider(
071:                        ProjectExplorer.getProjectExplorer()
072:                                .getAdapterFactory()));
073:                tree.setInput(ProjectPlugin.getPlugin().getProjectRegistry());
074:
075:                tree.getControl().setLayoutData(
076:                        new GridData(SWT.FILL, SWT.FILL, true, true));
077:
078:                tree.addSelectionChangedListener(this );
079:
080:                setControl(composite);
081:                setPageComplete(true);
082:            }
083:
084:            /**
085:             * @see org.eclipse.jface.viewers.ISelectionChangedListener#selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent)
086:             */
087:            public void selectionChanged(SelectionChangedEvent event) {
088:                selection = (IStructuredSelection) event.getSelection();
089:                Object obj = selection.getFirstElement();
090:                if (obj instanceof  Map) {
091:                    getWizard().getContainer().updateButtons();
092:                    return;
093:                } else if (obj instanceof  Project) {
094:                    List maps = ((Project) obj).getElements(Map.class);
095:                    selection = new StructuredSelection(maps.size() > 0 ? maps
096:                            .get(0) : obj);
097:                } else if (obj instanceof  ContextModel) {
098:                    selection = new StructuredSelection(((ContextModel) obj)
099:                            .getMap());
100:                } else if (obj instanceof  ViewportModel) {
101:                    selection = new StructuredSelection(((ViewportModel) obj)
102:                            .getMapInternal());
103:                } else if (obj instanceof  RenderManager) {
104:                    selection = new StructuredSelection(((RenderManager) obj)
105:                            .getMapInternal());
106:                } else if (obj instanceof  Layer) {
107:                    selection = new StructuredSelection(((Layer) obj)
108:                            .getContextModel().getMap());
109:                } else
110:                    return;
111:                tree.setSelection(selection, true);
112:                getWizard().getContainer().updateButtons();
113:
114:            }
115:
116:            /**
117:             * @see org.eclipse.jface.wizard.IWizardPage#canFlipToNextPage()
118:             */
119:            public boolean canFlipToNextPage() {
120:                // TODO Auto-generated method stub
121:                return isPageComplete();
122:            }
123:
124:            /**
125:             * @see org.eclipse.jface.wizard.IWizardPage#isPageComplete()
126:             */
127:            public boolean isPageComplete() {
128:                if (selection == null) {
129:                    return false;
130:                }
131:                if (selection.isEmpty()) {
132:                    return false;
133:                }
134:                if (selection.getFirstElement() instanceof  Map) {
135:                    selectedMap = (Map) selection.getFirstElement();
136:                    System.out.println(selectedMap);
137:                    return true;
138:                }
139:                return false;
140:            }
141:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.