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


001:        /*******************************************************************************
002:         * Copyright (c) 2004, 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.internal.presentations.defaultpresentation;
011:
012:        import org.eclipse.swt.SWT;
013:        import org.eclipse.swt.events.PaintEvent;
014:        import org.eclipse.swt.events.PaintListener;
015:        import org.eclipse.swt.graphics.Color;
016:        import org.eclipse.swt.graphics.Point;
017:        import org.eclipse.swt.graphics.Rectangle;
018:        import org.eclipse.swt.widgets.Composite;
019:        import org.eclipse.swt.widgets.Control;
020:        import org.eclipse.ui.internal.presentations.util.AbstractTabFolder;
021:        import org.eclipse.ui.internal.presentations.util.AbstractTabItem;
022:        import org.eclipse.ui.internal.presentations.util.EnhancedFillLayout;
023:        import org.eclipse.ui.internal.presentations.util.PartInfo;
024:
025:        /**
026:         * Implements the AbstractTabFolder interface, however this object only displays
027:         * the content of the currently selected part. There are no tabs, no title, no toolbar,
028:         * etc. There is no means to select a different part, unless it is done programmatically.
029:         * 
030:         * @since 3.1
031:         */
032:        public class EmptyTabFolder extends AbstractTabFolder {
033:
034:            private Composite control;
035:            private Control childControl;
036:            private Color borderColor;
037:
038:            public EmptyTabFolder(Composite parent, boolean showborder) {
039:                control = new Composite(parent, SWT.NONE);
040:                EnhancedFillLayout layout = new EnhancedFillLayout();
041:                control.setLayout(layout);
042:                borderColor = parent.getDisplay().getSystemColor(
043:                        SWT.COLOR_WIDGET_NORMAL_SHADOW);
044:                if (showborder) {
045:                    layout.xmargin = 1;
046:                    layout.ymargin = 1;
047:                    control.addPaintListener(new PaintListener() {
048:                        public void paintControl(PaintEvent e) {
049:                            e.gc.setForeground(borderColor);
050:                            Rectangle rect = control.getClientArea();
051:                            rect.width--;
052:                            rect.height--;
053:                            e.gc.drawRectangle(rect);
054:                        }
055:                    });
056:                }
057:            }
058:
059:            /* (non-Javadoc)
060:             * @see org.eclipse.ui.internal.presentations.util.AbstractTabFolder#computeSize(int, int)
061:             */
062:            public Point computeSize(int widthHint, int heightHint) {
063:                if (childControl != null) {
064:                    // Fix for bug 85899 [Perspectives] [RCP]Standalone view does not divide space in 
065:                    //   proper ratio with reference when added to IPageLayout with showTitle parameter false
066:                    // If the childControl is a content proxy (a Composite with no children -- see PresentablePartFolder constructor),
067:                    // then computeSize returns 64x64, which is inappropriate.
068:                    // Note that this happens even if the Composite has a Layout that returns 0@0.
069:                    // Instead, use the sizes of the margins.  This is equivalent to calling control.computeSize(...)
070:                    // if the childControl returned 0@0 for its preferred size.
071:                    if (childControl instanceof  Composite) {
072:                        Composite composite = (Composite) childControl;
073:                        if (composite.getChildren().length == 0) {
074:                            EnhancedFillLayout layout = (EnhancedFillLayout) control
075:                                    .getLayout();
076:                            int w = widthHint == SWT.DEFAULT ? layout.xmargin * 2
077:                                    : widthHint;
078:                            int h = heightHint == SWT.DEFAULT ? layout.ymargin * 2
079:                                    : heightHint;
080:                            return new Point(w, h);
081:                        }
082:                    }
083:                    return childControl.computeSize(widthHint, heightHint);
084:                }
085:                return new Point(0, 0);
086:            }
087:
088:            /* (non-Javadoc)
089:             * @see org.eclipse.ui.internal.presentations.util.AbstractTabFolder#add(int, int)
090:             */
091:            public AbstractTabItem add(int index, int flags) {
092:                return new EmptyTabItem();
093:            }
094:
095:            /* (non-Javadoc)
096:             * @see org.eclipse.ui.internal.presentations.util.AbstractTabFolder#getContentParent()
097:             */
098:            public Composite getContentParent() {
099:                return control;
100:            }
101:
102:            /* (non-Javadoc)
103:             * @see org.eclipse.ui.internal.presentations.util.AbstractTabFolder#setContent(org.eclipse.swt.widgets.Control)
104:             */
105:            public void setContent(Control newContent) {
106:                childControl = newContent;
107:            }
108:
109:            /* (non-Javadoc)
110:             * @see org.eclipse.ui.internal.presentations.util.AbstractTabFolder#getItems()
111:             */
112:            public AbstractTabItem[] getItems() {
113:                return new AbstractTabItem[0];
114:            }
115:
116:            /* (non-Javadoc)
117:             * @see org.eclipse.ui.internal.presentations.util.AbstractTabFolder#getSelection()
118:             */
119:            public AbstractTabItem getSelection() {
120:                return null;
121:            }
122:
123:            /* (non-Javadoc)
124:             * @see org.eclipse.ui.internal.presentations.util.AbstractTabFolder#setSelection(org.eclipse.ui.internal.presentations.util.AbstractTabItem)
125:             */
126:            public void setSelection(AbstractTabItem toSelect) {
127:
128:            }
129:
130:            public void setToolbar(Control toolbar) {
131:                if (toolbar != null) {
132:                    toolbar.setVisible(false);
133:                }
134:            }
135:
136:            public void layout(boolean flushCache) {
137:                super .layout(flushCache);
138:
139:                control.layout(flushCache);
140:            }
141:
142:            /* (non-Javadoc)
143:             * @see org.eclipse.ui.internal.presentations.util.AbstractTabFolder#setSelectedInfo(org.eclipse.ui.internal.presentations.util.PartInfo)
144:             */
145:            public void setSelectedInfo(PartInfo info) {
146:
147:            }
148:
149:            /* (non-Javadoc)
150:             * @see org.eclipse.ui.internal.presentations.util.AbstractTabFolder#enablePaneMenu(boolean)
151:             */
152:            public void enablePaneMenu(boolean enabled) {
153:
154:            }
155:
156:            /* (non-Javadoc)
157:             * @see org.eclipse.ui.internal.presentations.util.AbstractTabFolder#getToolbarParent()
158:             */
159:            public Composite getToolbarParent() {
160:                return control;
161:            }
162:
163:            /* (non-Javadoc)
164:             * @see org.eclipse.ui.internal.presentations.util.AbstractTabFolder#getControl()
165:             */
166:            public Control getControl() {
167:                return control;
168:            }
169:
170:            /* (non-Javadoc)
171:             * @see org.eclipse.ui.internal.presentations.util.AbstractTabFolder#getTabArea()
172:             */
173:            public Rectangle getTabArea() {
174:                return new Rectangle(0, 0, 0, 0);
175:            }
176:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.