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


001:        package net.refractions.udig.internal.ui;
002:
003:        import net.refractions.udig.ui.UIUtilities;
004:        import net.refractions.udig.ui.preferences.PreferenceConstants;
005:
006:        import org.eclipse.jface.dialogs.IDialogConstants;
007:        import org.eclipse.jface.dialogs.IconAndMessageDialog;
008:        import org.eclipse.jface.preference.IPreferenceStore;
009:        import org.eclipse.jface.resource.JFaceResources;
010:        import org.eclipse.swt.SWT;
011:        import org.eclipse.swt.accessibility.AccessibleAdapter;
012:        import org.eclipse.swt.accessibility.AccessibleEvent;
013:        import org.eclipse.swt.custom.StyledText;
014:        import org.eclipse.swt.graphics.Image;
015:        import org.eclipse.swt.layout.GridData;
016:        import org.eclipse.swt.layout.GridLayout;
017:        import org.eclipse.swt.widgets.Button;
018:        import org.eclipse.swt.widgets.Composite;
019:        import org.eclipse.swt.widgets.Control;
020:        import org.eclipse.swt.widgets.Event;
021:        import org.eclipse.swt.widgets.Label;
022:        import org.eclipse.swt.widgets.Link;
023:        import org.eclipse.swt.widgets.Listener;
024:        import org.eclipse.swt.widgets.Shell;
025:
026:        public class LinuxAdvancedDialog extends IconAndMessageDialog {
027:
028:            private StyledText styledMessage;
029:            private Link linkedMessage;
030:            private String url = "http://jira.codehaus.org/browse/UDIG-1110";
031:
032:            public LinuxAdvancedDialog(Shell parentShell) {
033:                super (parentShell);
034:                setShellStyle(getShellStyle() | SWT.RESIZE);
035:                this .message = "Some Linux users have experienced issues with map display being slow or strange artifacts on some versions of Linux. "
036:                        + "This is a bug with SWT. For more information please see JIRA bug "
037:                        + "<a href=\""
038:                        + url
039:                        + "\">UDIG-1110</a>. There is a "
040:                        + "link there to <a href=\"https://bugs.eclipse.org/bugs/show_bug.cgi?id=163069\">the SWT bug</a>. Please vote for it!\n\n"
041:                        + "A workaround is available by disabling advanced graphics. You may do so now, or you may "
042:                        + "toggle this later under preferences.\n\n"
043:                        + "Advanced graphics are used in the interface itself, such as the zoom tool for example.";
044:            }
045:
046:            @Override
047:            protected Image getImage() {
048:                return getWarningImage();
049:            }
050:
051:            protected Control createMessageArea(Composite composite) {
052:                // create composite
053:                // create image
054:                Image image = getImage();
055:                if (image != null) {
056:                    imageLabel = new Label(composite, SWT.NULL);
057:                    image.setBackground(imageLabel.getBackground());
058:                    imageLabel.setImage(image);
059:                    addAccessibleListeners(imageLabel, image);
060:                    imageLabel.setLayoutData(new GridData(
061:                            GridData.HORIZONTAL_ALIGN_CENTER
062:                                    | GridData.VERTICAL_ALIGN_BEGINNING));
063:                }
064:                // create message
065:                if (message != null) {
066:                    linkedMessage = new Link(composite, getMessageLabelStyle());
067:                    //            styledMessage = new StyledText(composite, getLinMessageLabelStyle());
068:                    linkedMessage.setText(message);
069:                    linkedMessage.setToolTipText("Open in web browser: " + url);
070:                    GridData data = new GridData(GridData.GRAB_HORIZONTAL
071:                            | GridData.HORIZONTAL_ALIGN_FILL
072:                            | GridData.VERTICAL_ALIGN_BEGINNING);
073:                    data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
074:                    linkedMessage.setLayoutData(data);
075:                    linkedMessage.addListener(SWT.Selection, new Listener() {
076:
077:                        public void handleEvent(Event event) {
078:                            UIUtilities.openLink(event.text);
079:                        }
080:
081:                    });
082:                }
083:                return composite;
084:            }
085:
086:            private void addAccessibleListeners(Label label, final Image image) {
087:                label.getAccessible().addAccessibleListener(
088:                        new AccessibleAdapter() {
089:                            public void getName(AccessibleEvent event) {
090:                                final String accessibleMessage = getAccessibleMessageFor(image);
091:                                if (accessibleMessage == null) {
092:                                    return;
093:                                }
094:                                event.result = accessibleMessage;
095:                            }
096:                        });
097:            }
098:
099:            private String getAccessibleMessageFor(Image image) {
100:                if (image.equals(getErrorImage())) {
101:                    return JFaceResources.getString("error");//$NON-NLS-1$
102:                }
103:
104:                if (image.equals(getWarningImage())) {
105:                    return JFaceResources.getString("warning");//$NON-NLS-1$
106:                }
107:
108:                if (image.equals(getInfoImage())) {
109:                    return JFaceResources.getString("info");//$NON-NLS-1$
110:                }
111:
112:                if (image.equals(getQuestionImage())) {
113:                    return JFaceResources.getString("question"); //$NON-NLS-1$
114:                }
115:
116:                return null;
117:            }
118:
119:            @Override
120:            protected Control createDialogArea(Composite parent) {
121:
122:                Composite composite = (Composite) super 
123:                        .createDialogArea(parent);
124:                ((GridLayout) composite.getLayout()).numColumns = 2;
125:                ((GridLayout) composite.getLayout()).makeColumnsEqualWidth = false;
126:
127:                createMessageArea(composite);
128:
129:                return composite;
130:            }
131:
132:            protected void createButtonsForButtonBar(Composite parent) {
133:                // create OK and Cancel buttons by default
134:                Button b = createButton(parent, IDialogConstants.OK_ID,
135:                        "Disable Advanced Graphics", true);
136:                createButton(parent, IDialogConstants.CANCEL_ID, "Do Nothing",
137:                        false);
138:                b.setFocus();
139:            }
140:
141:            protected void configureShell(Shell newShell) {
142:                newShell.setText("Possible Linux Issue");
143:                newShell.setImage(UiPlugin.getDefault()
144:                        .create("icon32.gif").createImage()); //$NON-NLS-1$
145:            }
146:
147:            protected void okPressed() {
148:                IPreferenceStore store = UiPlugin.getDefault()
149:                        .getPreferenceStore();
150:                boolean useAdvancedGraphics = store
151:                        .getBoolean(net.refractions.udig.ui.preferences.PreferenceConstants.P_ADVANCED_GRAPHICS);
152:
153:                if (useAdvancedGraphics) {
154:                    store.setValue(PreferenceConstants.P_ADVANCED_GRAPHICS,
155:                            false);
156:                }
157:
158:                super.okPressed();
159:            }
160:
161:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.