Source Code Cross Referenced for DockingPanel.java in  » Mail-Clients » columba-1.4 » org » columba » core » gui » 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 » Mail Clients » columba 1.4 » org.columba.core.gui.docking 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package org.columba.core.gui.docking;
002:
003:        import java.awt.BorderLayout;
004:        import java.awt.Color;
005:        import java.awt.Component;
006:
007:        import javax.swing.JComponent;
008:        import javax.swing.JPanel;
009:        import javax.swing.UIManager;
010:
011:        import org.columba.core.gui.base.ShadowBorder;
012:        import org.flexdock.docking.DockingManager;
013:        import org.flexdock.docking.DockingStub;
014:
015:        class DockingPanel extends JPanel implements  DockingStub {
016:
017:            public static Color ACTIVE_MID_COLOR = UIManager.getColor(
018:                    "Menu.selectionBackground").brighter();
019:
020:            public static Color ACTIVE_FILL_COLOR = UIManager
021:                    .getColor("Menu.selectionBackground");
022:
023:            public static Color ACTIVE_START_COLOR = UIManager
024:                    .getColor("Menu.selectionBackground");
025:
026:            public static Color INACTIVE_FILL_COLOR = UIManager
027:                    .getColor("control");
028:
029:            public static Color INACTIVE_MID_COLOR = UIManager
030:                    .getColor("control");
031:
032:            public static Color INACTIVE_START_COLOR = UIManager
033:                    .getColor("controlHighlight");
034:
035:            public static Color INACTIVE_LABEL_COLOR = UIManager
036:                    .getColor("Menu.selectionForeground");
037:
038:            public static Color ACTIVE_LABEL_COLOR = UIManager
039:                    .getColor("Menu.selectionForeground");
040:
041:            protected TitleBar titlebar;
042:
043:            private JPanel contentPanel;
044:
045:            private String dockingId;
046:
047:            public DockingPanel(String id, String title) {
048:                super ();
049:
050:                this .dockingId = id;
051:
052:                this .titlebar = new TitleBar(title, INACTIVE_MID_COLOR,
053:                        INACTIVE_FILL_COLOR);
054:
055:                setLayout(new BorderLayout());
056:
057:                add(this .titlebar, BorderLayout.NORTH);
058:
059:                contentPanel = new JPanel();
060:                contentPanel.setLayout(new BorderLayout());
061:                add(contentPanel, BorderLayout.CENTER);
062:
063:                setContentPane(createContentPane());
064:
065:                setBorder(new ShadowBorder());
066:
067:                //		titlebar.setMidColor(INACTIVE_MID_COLOR);
068:                //		titlebar.setFillColor(INACTIVE_FILL_COLOR);
069:                //
070:                //		titlebar.setTitleColor(INACTIVE_LABEL_COLOR, INACTIVE_MID_COLOR, false);
071:
072:            }
073:
074:            public void setActive(boolean active) {
075:
076:                if (active) {
077:                    // contentPanel.setBorder(new LineBorder(ACTIVE_BORDER_COLOR, 1));
078:
079:                    titlebar.setMidColor(ACTIVE_MID_COLOR);
080:                    titlebar.setFillColor(ACTIVE_FILL_COLOR);
081:
082:                    titlebar.setTitleColor(ACTIVE_LABEL_COLOR,
083:                            ACTIVE_FILL_COLOR, true);
084:                } else {
085:                    titlebar.setMidColor(INACTIVE_MID_COLOR);
086:                    titlebar.setFillColor(INACTIVE_FILL_COLOR);
087:
088:                    titlebar.setTitleColor(INACTIVE_LABEL_COLOR,
089:                            INACTIVE_FILL_COLOR, false);
090:                }
091:
092:                contentPanel.repaint();
093:                titlebar.repaint();
094:            }
095:
096:            public void dock(DockingPanel otherPanel) {
097:                DockingManager.dock(otherPanel, this );
098:            }
099:
100:            public void dock(DockingPanel otherPanel, String region) {
101:                DockingManager.dock(otherPanel, this , region);
102:            }
103:
104:            public void dock(DockingPanel otherPanel, String region, float ratio) {
105:                DockingManager.dock(otherPanel, this , region, ratio);
106:            }
107:
108:            protected JComponent createContentPane() {
109:                JPanel panel = new JPanel();
110:                return panel;
111:            }
112:
113:            public String getTitle() {
114:                return titlebar.getTitle();
115:            }
116:
117:            public void setTitle(String title) {
118:                titlebar.setTitle(title);
119:            }
120:
121:            public TitleBar getTitleBar() {
122:                return titlebar;
123:            }
124:
125:            public void setContentPane(JComponent comp) {
126:                contentPanel.removeAll();
127:
128:                if (comp != null)
129:                    contentPanel.add(comp, BorderLayout.CENTER);
130:
131:                // this.contentPane = comp;
132:
133:                // Color color = UIManager.getColor("controlDkShadow");
134:                //
135:                // if (comp != null)
136:                // contentPane.setBorder(new LineBorder(color));
137:            }
138:
139:            public void setTitleBar(JPanel panel) {
140:                add(panel, BorderLayout.NORTH);
141:            }
142:
143:            public Component getDragSource() {
144:                return getTitleBar();
145:            }
146:
147:            public Component getFrameDragSource() {
148:                return getTitleBar();
149:            }
150:
151:            public String getPersistentId() {
152:                return dockingId;
153:            }
154:
155:            public String getTabText() {
156:                return getTitle();
157:            }
158:
159:            public void updateUI() {
160:                super .updateUI();
161:
162:                ACTIVE_MID_COLOR = alpha(UIManager
163:                        .getColor("Menu.selectionBackground"), 200);
164:
165:                ACTIVE_FILL_COLOR = alpha(UIManager
166:                        .getColor("Menu.selectionBackground"), 125);
167:
168:                ACTIVE_START_COLOR = brighter(UIManager
169:                        .getColor("Menu.selectionBackground"));
170:
171:                INACTIVE_FILL_COLOR = UIManager.getColor("control");
172:
173:                INACTIVE_MID_COLOR = UIManager.getColor("control");
174:
175:                INACTIVE_START_COLOR = UIManager.getColor("control");
176:
177:                INACTIVE_LABEL_COLOR = UIManager.getColor("Menu.foreground");
178:
179:                ACTIVE_LABEL_COLOR = UIManager
180:                        .getColor("Menu.selectionForeground");
181:
182:            }
183:
184:            public Color alpha(Color c, int alpha) {
185:                return new Color(c.getRed(), c.getGreen(), c.getBlue(), alpha);
186:
187:            }
188:
189:            private final static double FACTOR = 0.75;
190:
191:            public Color darker(Color c) {
192:                return new Color(Math.max((int) (c.getRed() * FACTOR), 0), Math
193:                        .max((int) (c.getGreen() * FACTOR), 0), Math.max(
194:                        (int) (c.getBlue() * FACTOR), 0));
195:            }
196:
197:            private Color brighter(Color c) {
198:                int r = c.getRed();
199:                int g = c.getGreen();
200:                int b = c.getBlue();
201:
202:                return new Color(Math.min((int) (r / FACTOR), 255), Math.min(
203:                        (int) (g / FACTOR), 255), Math.min((int) (b / FACTOR),
204:                        255));
205:            }
206:
207:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.