Source Code Cross Referenced for MapStylePage.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:        /*
002:         *    uDig - User Friendly Desktop Internet GIS client
003:         *    http://udig.refractions.net
004:         *    (C) 2004, Refractions Research Inc.
005:         *
006:         *    This library is free software; you can redistribute it and/or
007:         *    modify it under the terms of the GNU Lesser General Public
008:         *    License as published by the Free Software Foundation;
009:         *    version 2.1 of the License.
010:         *
011:         *    This library is distributed in the hope that it will be useful,
012:         *    but WITHOUT ANY WARRANTY; without even the implied warranty of
013:         *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
014:         *    Lesser General Public License for more details.
015:         *
016:         */
017:        package net.refractions.udig.project.ui.internal;
018:
019:        import java.util.Collection;
020:        import java.util.HashMap;
021:        import java.util.List;
022:
023:        import net.refractions.udig.project.internal.Layer;
024:        import net.refractions.udig.project.internal.render.impl.Styling;
025:
026:        import org.eclipse.jface.viewers.ISelectionChangedListener;
027:        import org.eclipse.jface.viewers.IStructuredContentProvider;
028:        import org.eclipse.jface.viewers.IStructuredSelection;
029:        import org.eclipse.jface.viewers.LabelProvider;
030:        import org.eclipse.jface.viewers.ListViewer;
031:        import org.eclipse.jface.viewers.SelectionChangedEvent;
032:        import org.eclipse.jface.viewers.StructuredSelection;
033:        import org.eclipse.jface.viewers.Viewer;
034:        import org.eclipse.jface.wizard.WizardPage;
035:        import org.eclipse.swt.SWT;
036:        import org.eclipse.swt.layout.GridData;
037:        import org.eclipse.swt.layout.GridLayout;
038:        import org.eclipse.swt.widgets.Composite;
039:
040:        /**
041:         * A wizard page for choosing the layer's styles
042:         * 
043:         * @author jeichar
044:         * @since 0.3
045:         */
046:        public class MapStylePage extends WizardPage {
047:
048:            List layers;
049:            Layer currentLayer;
050:            HashMap map = new HashMap();
051:
052:            /**
053:             * Construct <code>MapNewPage</code>.
054:             * 
055:             * @param layers The selected layers
056:             */
057:            protected MapStylePage(List layers) {
058:                super (Messages.MapStylePage_editStyles,
059:                        Messages.MapStylePage_editStyles, Images
060:                                .getDescriptor(ImageConstants.NEWMAP_WIZBAN));
061:                setDescription(Messages.MapStylePage_editStyles_description);
062:                this .layers = layers;
063:            }
064:
065:            /**
066:             * TODO summary sentence for createControl ...
067:             * 
068:             * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
069:             * @param parent
070:             */
071:            public void createControl(Composite parent) {
072:                Composite composite = new Composite(parent, SWT.NONE);
073:                composite.setLayout(new GridLayout(2, false));
074:
075:                final ListViewer layersView = new ListViewer(composite,
076:                        SWT.BORDER);
077:                layersView.setContentProvider(new IStructuredContentProvider() {
078:
079:                    public Object[] getElements(Object inputElement) {
080:                        if (inputElement instanceof  List) {
081:                            return ((List) inputElement).toArray();
082:                        }
083:                        return null;
084:                    }
085:
086:                    public void dispose() {
087:                        // do nothing
088:                    }
089:
090:                    public void inputChanged(Viewer viewer, Object oldInput,
091:                            Object newInput) {
092:                        // do nothing
093:                    }
094:                });
095:
096:                layersView.setLabelProvider(new LabelProvider() {
097:                    /**
098:                     * @see org.eclipse.jface.viewers.LabelProvider#getText(java.lang.Object)
099:                     */
100:                    public String getText(Object element) {
101:                        if (element instanceof  Layer) {
102:                            return ((Layer) element).getName();
103:                        }
104:                        return null;
105:                    }
106:                });
107:                layersView.setInput(layers);
108:                layersView.getControl().setLayoutData(
109:                        new GridData(SWT.FILL, SWT.FILL, true, true));
110:
111:                final ListViewer styleView = new ListViewer(composite,
112:                        SWT.BORDER);
113:                styleView.setContentProvider(new IStructuredContentProvider() {
114:
115:                    public Object[] getElements(Object inputElement) {
116:                        if (inputElement instanceof  Collection) {
117:                            return ((Collection) inputElement).toArray();
118:                        }
119:                        return null;
120:                    }
121:
122:                    public void dispose() {
123:                        // do nothing
124:                    }
125:
126:                    public void inputChanged(Viewer viewer, Object oldInput,
127:                            Object newInput) {
128:                        viewer.refresh();
129:                    }
130:                });
131:                styleView.setLabelProvider(new LabelProvider() {
132:                    /**
133:                     * TODO summary sentence for getText ...
134:                     * 
135:                     * @see org.eclipse.jface.viewers.LabelProvider#getText(java.lang.Object)
136:                     * @param element
137:                     */
138:                    public String getText(Object element) {
139:                        if (element instanceof  String) {
140:                            return (String) element;
141:                        }
142:                        return null;
143:                    }
144:                });
145:                styleView
146:                        .addSelectionChangedListener(new ISelectionChangedListener() {
147:
148:                            public void selectionChanged(
149:                                    SelectionChangedEvent event) {
150:                                if (event.getSelection() instanceof  IStructuredSelection) {
151:                                    //IStructuredSelection sel = (IStructuredSelection) event.getSelection();
152:                                    /*
153:                                     * FIXME: Style is no longer used? for( Iterator iter = sel.iterator();
154:                                     * iter.hasNext(); ) { String styleName = (String) iter.next(); if(
155:                                     * styleName.equals("default")) return; StyleImpl style=(StyleImpl)
156:                                     * RenderFactory.eINSTANCE.createStyle(); style.setStyle(
157:                                     * Styling.getStyle(((Integer)Styling.STYLES.get(styleName)).intValue(),
158:                                     * currentLayer.getMetadata().getTypeName()) ); // currentLayer.setStyle(style);
159:                                     * map.put(currentLayer, styleName); }
160:                                     */
161:                                }
162:                            }
163:
164:                        });
165:                styleView.getControl().setLayoutData(
166:                        new GridData(SWT.FILL, SWT.FILL, true, true));
167:
168:                layersView
169:                        .addSelectionChangedListener(new ISelectionChangedListener() {
170:
171:                            public void selectionChanged(
172:                                    SelectionChangedEvent event) {
173:                                if (event.getSelection() instanceof  IStructuredSelection) {
174:                                    IStructuredSelection selection = (IStructuredSelection) event
175:                                            .getSelection();
176:                                    Object o = selection.getFirstElement();
177:                                    if (selection.size() > 1)
178:                                        layersView.setSelection(
179:                                                new StructuredSelection(o),
180:                                                true);
181:                                    currentLayer = (Layer) o;
182:                                    styleView.setInput(Styling
183:                                            .getStyleNames(currentLayer));
184:                                    Object s = map.get(currentLayer);
185:                                    if (s != null)
186:                                        styleView
187:                                                .setSelection(new StructuredSelection(
188:                                                        map.get(currentLayer)));
189:                                }
190:                            }
191:
192:                        });
193:                setControl(composite);
194:                setPageComplete(true);
195:            }
196:
197:            /**
198:             * @see org.eclipse.jface.wizard.WizardPage#canFlipToNextPage()
199:             */
200:            public boolean canFlipToNextPage() {
201:                return false;
202:            }
203:
204:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.