Source Code Cross Referenced for JSplitPaneComponent.java in  » XML-UI » SwingML » org » swingml » component » 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 » XML UI » SwingML » org.swingml.component 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * SwingML Copyright (C) 2002 Robert Morris.
003:         * 
004:         * This library is free software; you can redistribute it and/or modify it under
005:         * the terms of the GNU Lesser General Public License as published by the Free
006:         * Software Foundation; either version 2 of the License, or (at your option) any
007:         * later version.
008:         * 
009:         * This library is distributed in the hope that it will be useful, but WITHOUT
010:         * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011:         * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012:         * details.
013:         * 
014:         * You should have received a copy of the GNU Lesser General Public License
015:         * along with this library; if not, write to the Free Software Foundation, Inc.,
016:         * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
017:         * 
018:         * Authors: Robert Morris <robertj@morris.net>
019:         * 
020:         */
021:        package org.swingml.component;
022:
023:        import java.awt.*;
024:
025:        import javax.swing.*;
026:
027:        import org.swingml.*;
028:        import org.swingml.model.*;
029:        import org.swingml.system.*;
030:
031:        public class JSplitPaneComponent extends JSplitPane implements 
032:                XMLStateTranslatable {
033:
034:            private boolean m_isLeft = false;
035:
036:            /**
037:             * Class constructor
038:             * 
039:             * @param model
040:             *            A reference to a valid JSplitPaneModel instance. This
041:             *            reference is used to properly instantiate the JSplitPane
042:             *            component with information provided by the JSplitPaneModel
043:             *            instance.
044:             */
045:            public JSplitPaneComponent(JSplitPaneModel aModel) {
046:                super (
047:                        (aModel.getType().equalsIgnoreCase(
048:                                Constants.SPLIT_HORIZONTAL) ? JSplitPane.HORIZONTAL_SPLIT
049:                                : JSplitPane.VERTICAL_SPLIT));
050:                super .setDividerSize(aModel.getSize());
051:                super .setName(aModel.getName());
052:                super .setToolTipText(aModel.getTooltip());
053:
054:                if (aModel.getLocation() instanceof  Integer) {
055:                    super .setDividerLocation(((Integer) aModel.getLocation())
056:                            .intValue());
057:                } else if (aModel.getLocation() instanceof  Double) {
058:                    double theNewLocation = ((Double) aModel.getLocation())
059:                            .doubleValue();
060:                    if (theNewLocation < 1 || theNewLocation > 100) {
061:                        SwingMLLogger.getInstance().log(
062:                                "Syntax Error: LOCATION % for SPLITTER ["
063:                                        + aModel.getName()
064:                                        + "] can only be between 1 and 100");
065:                        // Set a default value of 50%.
066:                        theNewLocation = 0.5;
067:                    } else {
068:                        theNewLocation *= 0.01;
069:                        super .setResizeWeight(theNewLocation);
070:                    }
071:
072:                    super .setDividerLocation(theNewLocation);
073:                }
074:                super .setOneTouchExpandable(aModel.isExpandable());
075:
076:            }
077:
078:            /**
079:             * Performs the necessary checking to make sure that a SwingML component is
080:             * properly added to the JSplitPane. Forces Left vs. Right additions. The
081:             * designation of "left" component and "right" component alternates with
082:             * each additional add. Therefore, the first component is the left
083:             * component, the second component added is the right component. If a third
084:             * were added, it it would be the left component, and the fourth would
085:             * become the right component.
086:             * 
087:             * @param component
088:             *            The component to add to the JSplitPaneComponent.
089:             */
090:            public Component add(Component aComponent) {
091:                this .m_isLeft = !this .m_isLeft;
092:                if (this .m_isLeft) {
093:                    super .add(aComponent, JSplitPane.LEFT);
094:                } else {
095:                    super .add(aComponent, JSplitPane.RIGHT);
096:                }
097:                return aComponent;
098:            }
099:
100:            public String getXMLState() {
101:                StringBuffer buffer = new StringBuffer();
102:                buffer.append("<SPLITPANE ");
103:                buffer.append(Constants.NAME);
104:                buffer.append("=\"");
105:                buffer.append(getName());
106:                buffer.append("\" ");
107:                buffer.append(Constants.SIZE);
108:                buffer.append("=\"");
109:                buffer.append(getSize());
110:                buffer.append("\" ");
111:                buffer.append(Constants.LOCATION);
112:                buffer.append("=\"");
113:                buffer.append(getDividerLocation());
114:                buffer.append("\" ");
115:                buffer.append(Constants.EXPANDABLE);
116:                buffer.append("=\"");
117:                buffer.append(isOneTouchExpandable());
118:                buffer.append("\" />");
119:                return buffer.toString();
120:            }
121:
122:            public boolean hasState() {
123:                return true;
124:            }
125:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.