Source Code Cross Referenced for InfoForm.java in  » IDE-Eclipse » ui-workbench » org » eclipse » ui » texteditor » 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 » IDE Eclipse » ui workbench » org.eclipse.ui.texteditor 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*******************************************************************************
002:         * Copyright (c) 2000, 2005 IBM Corporation and others.
003:         * All rights reserved. This program and the accompanying materials
004:         * are made available under the terms of the Eclipse Public License v1.0
005:         * which accompanies this distribution, and is available at
006:         * http://www.eclipse.org/legal/epl-v10.html
007:         *
008:         * Contributors:
009:         *     IBM Corporation - initial API and implementation
010:         *******************************************************************************/package org.eclipse.ui.texteditor;
011:
012:        import org.eclipse.swt.SWT;
013:        import org.eclipse.swt.custom.ScrolledComposite;
014:        import org.eclipse.swt.events.DisposeEvent;
015:        import org.eclipse.swt.events.DisposeListener;
016:        import org.eclipse.swt.graphics.Color;
017:        import org.eclipse.swt.layout.GridData;
018:        import org.eclipse.swt.layout.GridLayout;
019:        import org.eclipse.swt.widgets.Composite;
020:        import org.eclipse.swt.widgets.Control;
021:        import org.eclipse.swt.widgets.Display;
022:        import org.eclipse.swt.widgets.Label;
023:
024:        import org.eclipse.jface.resource.JFaceResources;
025:        import org.eclipse.jface.util.IPropertyChangeListener;
026:        import org.eclipse.jface.util.PropertyChangeEvent;
027:
028:        /**
029:         * A form consisting of a title, a banner, and a info text. Banner and info text are
030:         * separated by a separator line. This form must be handled like a SWT widget.
031:         *
032:         * @since 2.0
033:         * @deprecated since 3.0. there is no replacement, use org.eclipse.ui.forms to define a component with a similar look and function.
034:         */
035:        public class InfoForm {
036:
037:            /** The form's root widget */
038:            private ScrolledComposite fScrolledComposite;
039:            /** The background color */
040:            private Color fBackgroundColor;
041:            /** The foreground color */
042:            private Color fForegroundColor;
043:            /** The separator's color */
044:            private Color fSeparatorColor;
045:            /** The form header */
046:            private Label fHeader;
047:            /** The form banner */
048:            private Label fBanner;
049:            /** The form text */
050:            private Label fText;
051:            /** The preference change listener */
052:            private IPropertyChangeListener fPropertyChangeListener;
053:
054:            /**
055:             * Creates a new info form.
056:             * @param parent the parent composite
057:             */
058:            public InfoForm(Composite parent) {
059:
060:                Display display = parent.getDisplay();
061:                fBackgroundColor = display
062:                        .getSystemColor(SWT.COLOR_LIST_BACKGROUND);
063:                fForegroundColor = display
064:                        .getSystemColor(SWT.COLOR_LIST_FOREGROUND);
065:                fSeparatorColor = new Color(display, 152, 170, 203);
066:
067:                fPropertyChangeListener = new IPropertyChangeListener() {
068:                    public void propertyChange(PropertyChangeEvent event) {
069:                        handlePropertyChange(event);
070:                    }
071:                };
072:                JFaceResources.getFontRegistry().addListener(
073:                        fPropertyChangeListener);
074:
075:                fScrolledComposite = new ScrolledComposite(parent, SWT.H_SCROLL
076:                        | SWT.V_SCROLL);
077:                fScrolledComposite.setAlwaysShowScrollBars(false);
078:                fScrolledComposite.setExpandHorizontal(true);
079:                fScrolledComposite.setExpandVertical(true);
080:                fScrolledComposite.addDisposeListener(new DisposeListener() {
081:                    public void widgetDisposed(DisposeEvent e) {
082:                        JFaceResources.getFontRegistry().removeListener(
083:                                fPropertyChangeListener);
084:                        fScrolledComposite = null;
085:                        fSeparatorColor.dispose();
086:                        fSeparatorColor = null;
087:                        fHeader = null;
088:                        fBanner = null;
089:                        fText = null;
090:                    }
091:                });
092:
093:                Composite composite = createComposite(fScrolledComposite);
094:                composite.setLayout(new GridLayout());
095:
096:                fHeader = createHeader(composite, null);
097:                createLabel(composite, null);
098:                createLabel(composite, null);
099:
100:                fBanner = createBanner(composite, null);
101:
102:                Composite separator = createCompositeSeparator(composite);
103:                GridData data = new GridData(GridData.FILL_HORIZONTAL);
104:                data.heightHint = 2;
105:                separator.setLayoutData(data);
106:
107:                fText = createLabel(composite, null);
108:                createLabel(composite, null);
109:
110:                fScrolledComposite.setContent(composite);
111:                fScrolledComposite.setMinSize(composite.computeSize(
112:                        SWT.DEFAULT, SWT.DEFAULT));
113:
114:                createActionControls(composite);
115:            }
116:
117:            /**
118:             * Hook method for creating an appropriate action control.
119:             * @param parent the action control's parent control
120:             */
121:            protected void createActionControls(Composite parent) {
122:            }
123:
124:            /**
125:             * Returns the control of this form.
126:             * @return the root control of this form
127:             */
128:            public Control getControl() {
129:                return fScrolledComposite;
130:            }
131:
132:            /**
133:             * Sets the header text of this info form.
134:             * @param header the header text
135:             */
136:            public void setHeaderText(String header) {
137:                fHeader.setText(header);
138:            }
139:
140:            /**
141:             * Sets the banner text of this info form.
142:             * @param banner the banner text
143:             */
144:            public void setBannerText(String banner) {
145:                fBanner.setText(banner);
146:            }
147:
148:            /**
149:             * Sets the info of this info form
150:             * @param info the info text
151:             */
152:            public void setInfo(String info) {
153:                fText.setText(info);
154:            }
155:
156:            /*
157:             * @see IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent)
158:             */
159:            protected void handlePropertyChange(PropertyChangeEvent event) {
160:
161:                if (fHeader != null)
162:                    fHeader.setFont(JFaceResources.getHeaderFont());
163:
164:                if (fBanner != null)
165:                    fBanner.setFont(JFaceResources.getBannerFont());
166:
167:                Control control = fScrolledComposite.getContent();
168:                fScrolledComposite.setMinSize(control.computeSize(SWT.DEFAULT,
169:                        SWT.DEFAULT));
170:                fScrolledComposite.setContent(control);
171:
172:                fScrolledComposite.layout(true);
173:                fScrolledComposite.redraw();
174:            }
175:
176:            /*
177:             * @see org.eclipse.update.ui.forms.internal.FormWidgetFactory#createComposite(Composite)
178:             */
179:            private Composite createComposite(Composite parent) {
180:                Composite composite = new Composite(parent, SWT.NONE);
181:                composite.setBackground(fBackgroundColor);
182:                return composite;
183:            }
184:
185:            /*
186:             * @see org.eclipse.update.ui.forms.internal.FormWidgetFactory#createCompositeSeparator(Composite)
187:             */
188:            private Composite createCompositeSeparator(Composite parent) {
189:                Composite composite = new Composite(parent, SWT.NONE);
190:                composite.setBackground(fSeparatorColor);
191:                return composite;
192:            }
193:
194:            /*
195:             * @see org.eclipse.update.ui.forms.internal.FormWidgetFactory#createLabel(Composite, String)
196:             */
197:            private Label createLabel(Composite parent, String text) {
198:                Label label = new Label(parent, SWT.NONE);
199:                GridData data = new GridData(GridData.FILL_HORIZONTAL);
200:                label.setLayoutData(data);
201:
202:                if (text != null)
203:                    label.setText(text);
204:                label.setBackground(fBackgroundColor);
205:                label.setForeground(fForegroundColor);
206:                return label;
207:            }
208:
209:            /*
210:             * @see org.eclipse.update.ui.forms.internal.FormWidgetFactory#createHeader(Composite, String)
211:             */
212:            private Label createHeader(Composite parent, String text) {
213:                Label label = new Label(parent, SWT.NONE);
214:                GridData data = new GridData(GridData.FILL_HORIZONTAL);
215:                label.setLayoutData(data);
216:
217:                if (text != null)
218:                    label.setText(text);
219:                label.setBackground(fBackgroundColor);
220:                label.setForeground(fForegroundColor);
221:                label.setFont(JFaceResources.getHeaderFont());
222:                return label;
223:            }
224:
225:            /*
226:             * @see org.eclipse.update.ui.forms.internal.FormWidgetFactory#createBanner(Composite, String)
227:             */
228:            private Label createBanner(Composite parent, String text) {
229:                Label label = new Label(parent, SWT.NONE);
230:                if (text != null)
231:                    label.setText(text);
232:                label.setBackground(fBackgroundColor);
233:                label.setForeground(fForegroundColor);
234:                label.setFont(JFaceResources.getBannerFont());
235:                return label;
236:            }
237:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.