Source Code Cross Referenced for PageForm.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.layout.GridData;
014:        import org.eclipse.swt.layout.GridLayout;
015:        import org.eclipse.swt.widgets.Composite;
016:        import org.eclipse.swt.widgets.Control;
017:        import org.eclipse.ui.forms.events.HyperlinkAdapter;
018:        import org.eclipse.ui.forms.events.HyperlinkEvent;
019:        import org.eclipse.ui.forms.widgets.Form;
020:        import org.eclipse.ui.forms.widgets.FormToolkit;
021:        import org.eclipse.ui.forms.widgets.ScrolledPageBook;
022:        import org.eclipse.ui.internal.intro.impl.IIntroConstants;
023:        import org.eclipse.ui.internal.intro.impl.Messages;
024:        import org.eclipse.ui.internal.intro.impl.model.AbstractIntroPage;
025:        import org.eclipse.ui.internal.intro.impl.model.IntroModelRoot;
026:        import org.eclipse.ui.internal.intro.impl.model.url.IntroURLParser;
027:        import org.eclipse.ui.internal.intro.impl.util.DialogUtil;
028:        import org.eclipse.ui.internal.intro.impl.util.Util;
029:        import org.eclipse.ui.intro.config.IIntroContentProviderSite;
030:
031:        /**
032:         * A Form that represents an Intro Page. It is swapped in the main page book in
033:         * the FormIntroPartImplementation class. It has a page book for swapping in
034:         * categories (content) of Intro Pages.
035:         */
036:        public class PageForm implements  IIntroConstants {
037:
038:            protected FormToolkit toolkit;
039:            private ScrolledPageBook categoryPageBook;
040:            protected IntroModelRoot model;
041:            private Form parentForm;
042:            protected Form pageForm;
043:            // private SharedStyleManager sharedStyleManager;
044:
045:            // Id to this page. There is only a single instance of this page in the
046:            // main page book.
047:            public static String PAGE_FORM_ID = "pageFormId"; //$NON-NLS-1$
048:
049:            // site is cached to hand down to the PageWidgetFactory for creating the UI
050:            // for content providers..
051:            private IIntroContentProviderSite site;
052:
053:            protected HyperlinkAdapter hyperlinkAdapter = new HyperlinkAdapter() {
054:
055:                public void linkActivated(HyperlinkEvent e) {
056:                    String url = (String) e.getHref();
057:                    IntroURLParser parser = new IntroURLParser(url);
058:                    if (parser.hasIntroUrl()) {
059:                        // execute the action embedded in the IntroURL
060:                        parser.getIntroURL().execute();
061:                        return;
062:                    } else if (parser.hasProtocol()) {
063:                        Util.openBrowser(url);
064:                        return;
065:                    }
066:                    DialogUtil.displayInfoMessage(((Control) e.getSource())
067:                            .getShell(), Messages.HyperlinkAdapter_urlIs
068:                            + " " + url); //$NON-NLS-1$
069:                }
070:
071:                public void linkEntered(HyperlinkEvent e) {
072:                }
073:
074:                public void linkExited(HyperlinkEvent e) {
075:                }
076:            };
077:
078:            /**
079:             * 
080:             */
081:            public PageForm(FormToolkit toolkit, IntroModelRoot modelRoot,
082:                    Form parentForm) {
083:                this .toolkit = toolkit;
084:                this .model = modelRoot;
085:                this .parentForm = parentForm;
086:            }
087:
088:            /**
089:             * Create a Form for holding pages without navigation.
090:             * 
091:             * @param pageBook
092:             */
093:            public void createPartControl(ScrolledPageBook mainPageBook,
094:                    SharedStyleManager sharedStyleManager) {
095:
096:                // Cash the shared style manager. We need to pass it around to category
097:                // forms. So, do not null it!
098:                // this.sharedStyleManager = sharedStyleManager;
099:
100:                // creating page in Main page book.
101:                pageForm = toolkit.createForm(mainPageBook.getContainer());
102:                mainPageBook.registerPage(getId(), pageForm);
103:                GridLayout layout = new GridLayout();
104:                layout.marginWidth = 0;
105:                layout.marginHeight = 0;
106:                pageForm.getBody().setLayout(layout);
107:                // Util.highlight(pageForm.getBody(), SWT.COLOR_RED);
108:
109:                // Get form body. Form body is one column grid layout. Add page book
110:                // and navigation UI to it.
111:                categoryPageBook = toolkit.createPageBook(pageForm.getBody(),
112:                        SWT.H_SCROLL | SWT.V_SCROLL);
113:                categoryPageBook
114:                        .setLayoutData(new GridData(GridData.FILL_BOTH));
115:
116:                // pageForm.setText(rootPageStyleManager.getPageSubTitle());
117:            }
118:
119:            protected String getId() {
120:                return PAGE_FORM_ID;
121:            }
122:
123:            /**
124:             * This method is called when the current page changes. It creates the
125:             * PageContentForm if necessary, and handles showing the page in the Page
126:             * Book. It creates a model PageContentForm for the current page.
127:             * 
128:             * @param pageID
129:             */
130:            public void showPage(AbstractIntroPage page,
131:                    SharedStyleManager sharedStyleManager) {
132:
133:                if (!categoryPageBook.hasPage(page.getId())) {
134:                    // if we do not have a category form for this page create one.
135:                    PageContentForm categoryForm = new PageContentForm(toolkit,
136:                            model, page);
137:                    categoryForm.setContentProviderSite(site);
138:                    // load style manager only once, here.
139:                    PageStyleManager styleManager = new PageStyleManager(page,
140:                            sharedStyleManager.getProperties());
141:                    categoryForm.createPartControl(categoryPageBook,
142:                            styleManager);
143:                }
144:                categoryPageBook.showPage(page.getId());
145:
146:                // Get cached page subtitle from control data.
147:                Composite pageComposite = (Composite) categoryPageBook
148:                        .getCurrentPage();
149:                // update main Form title.
150:                parentForm.setText(model.getCurrentPage().getTitle());
151:                // update this page form's title, ie: Page subtitle, if it exists.
152:                pageForm.setText((String) pageComposite.getData(PAGE_SUBTITLE));
153:
154:                // TODO need to transfer focus to the first link in
155:                // the page somehow; we may need IIntroPage interface with
156:                // a few methods like 'setFocus()' etc.
157:                // DG
158:            }
159:
160:            public void reflow() {
161:                categoryPageBook.reflow(true);
162:            }
163:
164:            public boolean hasPage(String pageId) {
165:                return categoryPageBook.hasPage(pageId);
166:            }
167:
168:            public void removePage(String pageId) {
169:                categoryPageBook.removePage(pageId);
170:            }
171:
172:            public void setContentProviderSite(IIntroContentProviderSite site) {
173:                this.site = site;
174:            }
175:
176:        }
w___ww_.__j__a___v_a___2_s_.co__m___ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.