Source Code Cross Referenced for PageContentForm.java in  » IDE-Eclipse » ui » org » eclipse » ui » internal » intro » impl » swt » 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 » org.eclipse.ui.internal.intro.impl.swt 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*******************************************************************************
002:         * Copyright (c) 2004, 2006 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.internal.intro.impl.swt;
011:
012:        import org.eclipse.swt.SWT;
013:        import org.eclipse.swt.widgets.Composite;
014:        import org.eclipse.swt.widgets.Label;
015:        import org.eclipse.ui.forms.widgets.FormToolkit;
016:        import org.eclipse.ui.forms.widgets.ScrolledPageBook;
017:        import org.eclipse.ui.forms.widgets.TableWrapData;
018:        import org.eclipse.ui.forms.widgets.TableWrapLayout;
019:        import org.eclipse.ui.internal.intro.impl.IIntroConstants;
020:        import org.eclipse.ui.internal.intro.impl.model.AbstractIntroElement;
021:        import org.eclipse.ui.internal.intro.impl.model.AbstractIntroPage;
022:        import org.eclipse.ui.internal.intro.impl.model.IntroModelRoot;
023:        import org.eclipse.ui.intro.config.IIntroContentProviderSite;
024:
025:        /**
026:         * A Composite that represents the content of an Intro Page. It is swapped in
027:         * the categories page book in the PageForm class.
028:         */
029:        public class PageContentForm implements  IIntroConstants {
030:
031:            private FormToolkit toolkit;
032:            private IntroModelRoot model;
033:            private PageStyleManager styleManager;
034:            // composite to control reflow.
035:            private Composite contentComposite;
036:
037:            // the page we are modeling here.
038:            private AbstractIntroPage page;
039:
040:            // site is cached to hand down to the PageWidgetFactory for creating the UI
041:            // for content providers..
042:            private IIntroContentProviderSite site;
043:
044:            public PageContentForm(FormToolkit toolkit, IntroModelRoot modelRoot) {
045:                this .toolkit = toolkit;
046:                this .model = modelRoot;
047:                page = model.getCurrentPage();
048:            }
049:
050:            public PageContentForm(FormToolkit toolkit,
051:                    IntroModelRoot modelRoot, AbstractIntroPage page) {
052:                this (toolkit, modelRoot);
053:                this .page = page;
054:            }
055:
056:            /**
057:             * Create the form for the root page. Number of columns there is equal to
058:             * the number of links. Every image link does not cache a model object for
059:             * data retrieval..
060:             * 
061:             * @param pageBook
062:             */
063:            public void createPartControl(ScrolledPageBook contentPageBook,
064:                    PageStyleManager pageStyleManager) {
065:                styleManager = pageStyleManager;
066:
067:                // categoriesComposite has Table Layout with one col. Holds page
068:                // description and composite with all other children.
069:                contentComposite = contentPageBook.createPage(page.getId());
070:                // Util.highlight(contentComposite, SWT.COLOR_GREEN);
071:                TableWrapLayout layout = new TableWrapLayout();
072:                layout.topMargin = 15;
073:                layout.leftMargin = 15;
074:                layout.rightMargin = 15;
075:                layout.bottomMargin = 15;
076:                layout.verticalSpacing = 15;
077:                contentComposite.setLayout(layout);
078:
079:                if (styleManager.getPageDescription() != null) {
080:                    Label label = toolkit.createLabel(contentComposite,
081:                            styleManager.getPageDescription(), SWT.WRAP);
082:                    label.setFont(PageStyleManager.getBannerFont());
083:                    TableWrapData td = new TableWrapData();
084:                    td.align = TableWrapData.FILL;
085:                    label.setLayoutData(td);
086:                }
087:
088:                // Store the sub-title data for this composite from this page's
089:                // subtitle. Make sure you do this before creating the page content to
090:                // filter out page sub-title from content area.
091:                contentComposite.setData(PAGE_SUBTITLE, styleManager
092:                        .getPageSubTitle());
093:
094:                createPageChildren(page, contentComposite);
095:
096:                styleManager = null;
097:            }
098:
099:            private void createPageChildren(AbstractIntroPage page,
100:                    Composite parent) {
101:                // setup page composite/layout
102:                PageWidgetFactory factory = new PageWidgetFactory(toolkit,
103:                        styleManager);
104:                factory.setContentProviderSite(site);
105:                Composite pageComposite = createPageTableComposite(factory,
106:                        toolkit, styleManager, parent);
107:                // now add all children
108:                AbstractIntroElement[] children = page.getChildren();
109:                for (int i = 0; i < children.length; i++)
110:                    factory.createIntroElement(pageComposite, children[i]);
111:
112:            }
113:
114:            /**
115:             * Creates a composite with TableWrapLayout to hold all page children. The
116:             * default number of columns is 1.
117:             * 
118:             * @param parent
119:             * @return
120:             */
121:            static Composite createPageTableComposite(
122:                    PageWidgetFactory factory, FormToolkit toolkit,
123:                    PageStyleManager styleManager, Composite parent) {
124:                Composite client = toolkit.createComposite(parent);
125:                TableWrapLayout layout = new TableWrapLayout();
126:                layout.topMargin = 0;
127:                layout.bottomMargin = 0;
128:                layout.leftMargin = 0;
129:                layout.rightMargin = 0;
130:                int numColumns = styleManager.getPageNumberOfColumns();
131:                layout.numColumns = numColumns == 0 ? 1 : numColumns;
132:                layout.horizontalSpacing = styleManager
133:                        .getPageHorizantalSpacing();
134:                layout.verticalSpacing = styleManager.getPageVerticalSpacing();
135:                client.setLayout(layout);
136:
137:                // parent has TableWrapLayout, and so update layout of this child.
138:                TableWrapData td = new TableWrapData(TableWrapData.FILL,
139:                        TableWrapData.FILL);
140:                // td.align = TableWrapData.FILL;
141:                td.grabHorizontal = true;
142:                client.setLayoutData(td);
143:                return client;
144:            }
145:
146:            public void setContentProviderSite(IIntroContentProviderSite site) {
147:                this.site = site;
148:            }
149:
150:        }
w_w_w.j__av___a___2__s_.__c___o_m_ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.