Source Code Cross Referenced for WindowBar.java in  » Swing-Library » InfoNode-Docking-Windows » net » infonode » docking » 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 » Swing Library » InfoNode Docking Windows » net.infonode.docking 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright (C) 2004 NNL Technology AB
003:         * Visit www.infonode.net for information about InfoNode(R) 
004:         * products and how to contact NNL Technology AB.
005:         *
006:         * This program is free software; you can redistribute it and/or
007:         * modify it under the terms of the GNU General Public License
008:         * as published by the Free Software Foundation; either version 2
009:         * of the License, or (at your option) any later version.
010:         *
011:         * This program is distributed in the hope that it will be useful,
012:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
013:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
014:         * GNU General Public License for more details.
015:         *
016:         * You should have received a copy of the GNU General Public License
017:         * along with this program; if not, write to the Free Software
018:         * Foundation, Inc., 59 Temple Place - Suite 330, Boston, 
019:         * MA 02111-1307, USA.
020:         */
021:
022:        // $Id: WindowBar.java,v 1.68 2007/01/28 21:25:10 jesper Exp $
023:        package net.infonode.docking;
024:
025:        import net.infonode.docking.internal.HeavyWeightContainer;
026:        import net.infonode.docking.internal.ReadContext;
027:        import net.infonode.docking.internal.WriteContext;
028:        import net.infonode.docking.internalutil.DropAction;
029:        import net.infonode.docking.model.ViewReader;
030:        import net.infonode.docking.model.ViewWriter;
031:        import net.infonode.docking.model.WindowBarItem;
032:        import net.infonode.docking.properties.TabWindowProperties;
033:        import net.infonode.docking.properties.WindowBarProperties;
034:        import net.infonode.docking.util.DockingUtil;
035:        import net.infonode.gui.panel.BaseContainerUtil;
036:        import net.infonode.gui.panel.ResizablePanel;
037:        import net.infonode.properties.base.Property;
038:        import net.infonode.properties.gui.util.ShapedPanelProperties;
039:        import net.infonode.properties.propertymap.PropertyMap;
040:        import net.infonode.properties.propertymap.PropertyMapWeakListenerManager;
041:        import net.infonode.properties.util.PropertyChangeListener;
042:        import net.infonode.tabbedpanel.TabContentPanel;
043:        import net.infonode.tabbedpanel.TabbedPanelContentPanel;
044:        import net.infonode.util.Direction;
045:
046:        import java.awt.*;
047:        import java.awt.event.ComponentAdapter;
048:        import java.awt.event.ComponentEvent;
049:        import java.io.IOException;
050:        import java.io.ObjectInputStream;
051:        import java.io.ObjectOutputStream;
052:
053:        /**
054:         * A window bar is located at the edge of a root window.
055:         * It's a tabbed panel where the content panel is dynamically shown and hidden.
056:         * A window bar is enabled and disabled using the {@link Component#setEnabled} method.
057:         *
058:         * @author $Author: jesper $
059:         * @version $Revision: 1.68 $
060:         */
061:        public class WindowBar extends AbstractTabWindow {
062:            private RootWindow rootWindow;
063:            private Direction direction;
064:            private TabbedPanelContentPanel contentPanel;
065:            private ResizablePanel edgePanel;
066:            private HeavyWeightContainer heavyWeightEdgePanel;
067:
068:            private PropertyChangeListener opaqueListener = new PropertyChangeListener() {
069:                public void propertyChanged(Property property,
070:                        Object valueContainer, Object oldValue, Object newValue) {
071:                    updateEdgePanelOpaque();
072:                }
073:            };
074:
075:            WindowBar(RootWindow rootWindow, Direction direction) {
076:                super (false, new WindowBarItem());
077:
078:                initMouseListener();
079:
080:                this .rootWindow = rootWindow;
081:                contentPanel = new TabbedPanelContentPanel(getTabbedPanel(),
082:                        new TabContentPanel(getTabbedPanel()) {
083:                            public Dimension getMinimumSize() {
084:                                if (getWindowBarProperties()
085:                                        .getTabWindowProperties()
086:                                        .getRespectChildWindowMinimumSize())
087:                                    return super .getMinimumSize();
088:
089:                                return new Dimension(0, 0);
090:                            }
091:                        });
092:
093:                this .direction = direction;
094:
095:                {
096:                    WindowBarProperties properties = new WindowBarProperties();
097:                    properties.getTabWindowProperties().addSuperObject(
098:                            rootWindow.getRootWindowProperties()
099:                                    .getTabWindowProperties());
100:
101:                    ((WindowBarItem) getWindowItem())
102:                            .setWindowBarProperties(new WindowBarProperties(
103:                                    properties));
104:                    getWindowBarProperties().addSuperObject(
105:                            rootWindow.getRootWindowProperties()
106:                                    .getWindowBarProperties());
107:                    getWindowBarProperties().addSuperObject(
108:                            WindowBarProperties.createDefault(this .direction));
109:                }
110:
111:                edgePanel = new ResizablePanel(rootWindow
112:                        .isHeavyweightSupported(),
113:                        this .direction.getOpposite(), contentPanel);
114:                edgePanel.setPreferredSize(new Dimension(200, 200));
115:                //edgePanel.setVisible(false);
116:                edgePanel.setComponent(contentPanel);
117:                edgePanel.setLayeredPane(rootWindow.getLayeredPane());
118:                edgePanel.setInnerArea(rootWindow.getWindowPanel());
119:
120:                updateEdgePanelOpaque();
121:
122:                PropertyMapWeakListenerManager.addWeakPropertyChangeListener(
123:                        contentPanel.getProperties().getShapedPanelProperties()
124:                                .getMap(), ShapedPanelProperties.OPAQUE,
125:                        opaqueListener);
126:
127:                if (rootWindow.isHeavyweightSupported()) {
128:                    edgePanel.addComponentListener(new ComponentAdapter() {
129:                        public void componentResized(ComponentEvent e) {
130:                            if (edgePanel.getParent() != null)
131:                                edgePanel.getParent().repaint();
132:                        }
133:                    });
134:                }
135:
136:                getEdgePanel().setVisible(false);
137:
138:                setTabWindowProperties(getWindowBarProperties()
139:                        .getTabWindowProperties());
140:
141:                init();
142:            }
143:
144:            public TabWindowProperties getTabWindowProperties() {
145:                return getWindowBarProperties().getTabWindowProperties();
146:            }
147:
148:            /**
149:             * Returns the property values for this window bar.
150:             *
151:             * @return the property values for this window bar
152:             */
153:            public WindowBarProperties getWindowBarProperties() {
154:                return ((WindowBarItem) getWindowItem())
155:                        .getWindowBarProperties();
156:            }
157:
158:            protected int addTabNoSelect(DockingWindow window, int index) {
159:                index = super .addTabNoSelect(window, index);
160:                window.setLastMinimizedDirection(direction);
161:                return index;
162:            }
163:
164:            /**
165:             * Sets the size of the content panel.
166:             * If the window bar is located on the left or right side, the panel width is set otherwise the panel height.
167:             *
168:             * @param size the content panel size
169:             */
170:            public void setContentPanelSize(int size) {
171:                edgePanel
172:                        .setPreferredSize(direction.isHorizontal() ? new Dimension(
173:                                size, 0)
174:                                : new Dimension(0, size));
175:            }
176:
177:            /**
178:             * Returns the size of the content panel.
179:             * If the window bar is located on the left or right side, the panel width is returned otherwise the panel height.
180:             *
181:             * @return the size of the content panel
182:             */
183:            public int getContentPanelSize() {
184:                Dimension size = edgePanel.getPreferredSize();
185:                return direction.isHorizontal() ? size.width : size.height;
186:            }
187:
188:            /**
189:             * Returns the window bar direction in the root window it is a member of
190:             *
191:             * @return window bar direction in root window
192:             * @since IDW 1.4.0
193:             */
194:            public Direction getDirection() {
195:                return direction;
196:            }
197:
198:            public RootWindow getRootWindow() {
199:                return rootWindow;
200:            }
201:
202:            protected void showChildWindow(DockingWindow window) {
203:                int index = getChildWindowIndex(window);
204:
205:                if (index != -1)
206:                    setSelectedTab(index);
207:
208:                super .showChildWindow(window);
209:            }
210:
211:            Component getEdgePanel() {
212:                if (!rootWindow.isHeavyweightSupported())
213:                    return edgePanel;
214:
215:                if (heavyWeightEdgePanel == null) {
216:                    //edgePanel.setOpaque(true);
217:                    heavyWeightEdgePanel = new HeavyWeightContainer(edgePanel);
218:                    heavyWeightEdgePanel.setVisible(false);
219:                }
220:
221:                return heavyWeightEdgePanel;
222:            }
223:
224:            protected void update() {
225:                edgePanel.setResizeWidth(getWindowBarProperties()
226:                        .getContentPanelEdgeResizeDistance());
227:                edgePanel.setContinuousLayout(getWindowBarProperties()
228:                        .getContinuousLayoutEnabled());
229:                edgePanel.setDragIndicatorColor(getWindowBarProperties()
230:                        .getDragIndicatorColor());
231:                getWindowBarProperties().getComponentProperties().applyTo(this ,
232:                        direction.getNextCW());
233:            }
234:
235:            private void updateEdgePanelOpaque() {
236:                if (edgePanel != null)
237:                    BaseContainerUtil.setForcedOpaque(edgePanel, rootWindow
238:                            .isHeavyweightSupported()
239:                            || contentPanel.getProperties()
240:                                    .getShapedPanelProperties().getOpaque());
241:                //edgePanel.setForcedOpaque(rootWindow.isHeavyweightSupported() ? true : contentPanel.getProperties().getShapedPanelProperties().getOpaque());
242:            }
243:
244:            public Dimension getPreferredSize() {
245:                if (isEnabled()) {
246:                    Dimension size = super .getPreferredSize();
247:                    int minWidth = getWindowBarProperties().getMinimumWidth();
248:                    return new Dimension(Math.max(minWidth, size.width), Math
249:                            .max(minWidth, size.height));
250:                } else
251:                    return new Dimension(0, 0);
252:            }
253:
254:            protected void tabSelected(WindowTab tab) {
255:                getEdgePanel().setVisible(tab != null);
256:                //edgePanel.setVisible(tab != null);
257:                super .tabSelected(tab);
258:            }
259:
260:            protected boolean isInsideTabArea(Point p2) {
261:                return true;
262:            }
263:
264:            protected void clearFocus(View view) {
265:                super .clearFocus(view);
266:
267:                if (view != null && !DockingUtil.isAncestor(this , view)) {
268:                    getTabbedPanel().setSelectedTab(null);
269:                }
270:            }
271:
272:            public boolean isMinimized() {
273:                return true;
274:            }
275:
276:            protected boolean acceptsSplitWith(DockingWindow window) {
277:                return false;
278:            }
279:
280:            DropAction acceptDrop(Point p, DockingWindow window) {
281:                return isEnabled() ? super .acceptDrop(p, window) : null;
282:            }
283:
284:            protected PropertyMap getPropertyObject() {
285:                return getWindowBarProperties().getMap();
286:            }
287:
288:            protected PropertyMap createPropertyObject() {
289:                return new WindowBarProperties().getMap();
290:            }
291:
292:            protected void write(ObjectOutputStream out, WriteContext context,
293:                    ViewWriter viewWriter) throws IOException {
294:                out.writeInt(getContentPanelSize());
295:                out.writeBoolean(isEnabled());
296:                getWindowItem().writeSettings(out, context);
297:                super .write(out, context, viewWriter);
298:            }
299:
300:            protected DockingWindow newRead(ObjectInputStream in,
301:                    ReadContext context, ViewReader viewReader)
302:                    throws IOException {
303:                setContentPanelSize(in.readInt());
304:                setEnabled(in.readBoolean());
305:                getWindowItem().readSettings(in, context);
306:                super .newRead(in, context, viewReader);
307:                return this ;
308:            }
309:
310:            protected DockingWindow oldRead(ObjectInputStream in,
311:                    ReadContext context) throws IOException {
312:                super.oldRead(in, context);
313:                setContentPanelSize(in.readInt());
314:                setEnabled(in.readBoolean());
315:                return this;
316:            }
317:
318:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.