Source Code Cross Referenced for PageFormWithNavigation.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, 2007 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.graphics.Image;
014:        import org.eclipse.swt.layout.GridData;
015:        import org.eclipse.swt.layout.GridLayout;
016:        import org.eclipse.swt.widgets.Composite;
017:        import org.eclipse.swt.widgets.Control;
018:        import org.eclipse.swt.widgets.Label;
019:        import org.eclipse.ui.forms.IFormColors;
020:        import org.eclipse.ui.forms.widgets.Form;
021:        import org.eclipse.ui.forms.widgets.FormToolkit;
022:        import org.eclipse.ui.forms.widgets.ImageHyperlink;
023:        import org.eclipse.ui.forms.widgets.ScrolledPageBook;
024:        import org.eclipse.ui.internal.intro.impl.model.IntroLink;
025:        import org.eclipse.ui.internal.intro.impl.model.IntroModelRoot;
026:        import org.eclipse.ui.internal.intro.impl.util.ImageUtil;
027:
028:        /**
029:         * Extends the UI of a PageForm and adds a navigation toolbar UI for the root
030:         * page links.
031:         */
032:        public class PageFormWithNavigation extends PageForm {
033:
034:            private PageStyleManager rootPageStyleManager;
035:
036:            // Id to this page. There is only a single instance of this page in the
037:            // main page book.
038:            public static String PAGE_FORM_WITH_NAVIGATION_ID = "pageFormWithNavigationId"; //$NON-NLS-1$
039:
040:            /**
041:             * 
042:             */
043:            public PageFormWithNavigation(FormToolkit toolkit,
044:                    IntroModelRoot modelRoot, Form parentForm) {
045:                super (toolkit, modelRoot, parentForm);
046:            }
047:
048:            /**
049:             * Extend parent behavior and add navigation.
050:             * 
051:             * @param pageBook
052:             */
053:            public void createPartControl(ScrolledPageBook mainPageBook,
054:                    SharedStyleManager sharedStyleManager) {
055:
056:                super .createPartControl(mainPageBook, sharedStyleManager);
057:
058:                // Create a style manager from shared style manager. We only need it
059:                // for the UI navigation composite.
060:                rootPageStyleManager = new PageStyleManager(
061:                        model.getHomePage(), sharedStyleManager.getProperties());
062:
063:                // Now create Navigation bar.
064:                Composite navigationComposite = toolkit
065:                        .createComposite(pageForm.getBody());
066:                navigationComposite.setLayoutData(new GridData(
067:                        GridData.HORIZONTAL_ALIGN_CENTER));
068:                int numberOfLinks = model.getHomePage().getLinks().length;
069:                GridLayout layout = new GridLayout();
070:                layout.numColumns = numberOfLinks;
071:                navigationComposite.setLayout(layout);
072:                createSmallNavigator(navigationComposite, model.getHomePage()
073:                        .getLinks());
074:
075:                pageForm.setText(rootPageStyleManager.getPageSubTitle());
076:            }
077:
078:            /**
079:             * Override parent id.
080:             */
081:            protected String getId() {
082:                return PAGE_FORM_WITH_NAVIGATION_ID;
083:            }
084:
085:            private void createSmallNavigator(Composite parent,
086:                    IntroLink[] links) {
087:                for (int i = 0; i < links.length; i++) {
088:                    Control c = createImageHyperlink(parent, links[i]);
089:                    c.setLayoutData(new GridData(
090:                            GridData.HORIZONTAL_ALIGN_CENTER));
091:                }
092:                for (int i = 0; i < links.length; i++) {
093:                    Label text = toolkit.createLabel(parent, links[i]
094:                            .getLabel());
095:                    text.setLayoutData(new GridData(
096:                            GridData.HORIZONTAL_ALIGN_CENTER));
097:                    text.setForeground(toolkit.getColors().getColor(
098:                            IFormColors.TITLE));
099:                }
100:            }
101:
102:            /**
103:             * Creates an Image Hyperlink from an IntroLink. Model object is NOT cached.
104:             * 
105:             * @param body
106:             * @param link
107:             */
108:            private Control createImageHyperlink(Composite body, IntroLink link) {
109:                ImageHyperlink imageLink = toolkit.createImageHyperlink(body,
110:                        SWT.NULL);
111:
112:                // set link image.
113:                Image image = rootPageStyleManager.getImage(link,
114:                        "small-link-icon", //$NON-NLS-1$
115:                        ImageUtil.DEFAULT_SMALL_ROOT_LINK);
116:                imageLink.setImage(image);
117:
118:                // set link hover image.
119:                image = rootPageStyleManager.getImage(link,
120:                        "small-hover-icon", null); //$NON-NLS-1$
121:                imageLink.setHoverImage(image);
122:                imageLink.setToolTipText(link.getLabel());
123:                // each link is centered in cell.
124:                GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_CENTER);
125:                imageLink.setLayoutData(gd);
126:                imageLink.setHref(link.getUrl());
127:                imageLink.addHyperlinkListener(hyperlinkAdapter);
128:                return imageLink;
129:            }
130:
131:        }
www_.__j__a_v___a2__s___._co_m__ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.