Source Code Cross Referenced for PropertySheetTabOperator.java in  » IDE-Netbeans » visualweb.api.designer » org » netbeans » modules » visualweb » gravy » properties » 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 Netbeans » visualweb.api.designer » org.netbeans.modules.visualweb.gravy.properties 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003:         *
004:         * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005:         *
006:         * The contents of this file are subject to the terms of either the GNU
007:         * General Public License Version 2 only ("GPL") or the Common
008:         * Development and Distribution License("CDDL") (collectively, the
009:         * "License"). You may not use this file except in compliance with the
010:         * License. You can obtain a copy of the License at
011:         * http://www.netbeans.org/cddl-gplv2.html
012:         * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013:         * specific language governing permissions and limitations under the
014:         * License.  When distributing the software, include this License Header
015:         * Notice in each file and include the License file at
016:         * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
017:         * particular file as subject to the "Classpath" exception as provided
018:         * by Sun in the GPL Version 2 section of the License file that
019:         * accompanied this code. If applicable, add the following below the
020:         * License Header, with the fields enclosed by brackets [] replaced by
021:         * your own identifying information:
022:         * "Portions Copyrighted [year] [name of copyright owner]"
023:         *
024:         * Contributor(s):
025:         *
026:         * The Original Software is NetBeans. The Initial Developer of the Original
027:         * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
028:         * Microsystems, Inc. All Rights Reserved.
029:         *
030:         * If you wish your version of this file to be governed by only the CDDL
031:         * or only the GPL Version 2, indicate your decision by adding
032:         * "[Contributor] elects to include this software in this distribution
033:         * under the [CDDL or GPL Version 2] license." If you do not indicate a
034:         * single choice of license, a recipient has the option to distribute
035:         * your version of this file under either the CDDL, the GPL Version 2 or
036:         * to extend the choice of license to its licensees as provided above.
037:         * However, if you add GPL Version 2 code and therefore, elected the GPL
038:         * Version 2 license, then the option applies only if the new code is
039:         * made subject to such option by the copyright holder.
040:         */
041:
042:        package org.netbeans.modules.visualweb.gravy.properties;
043:
044:        import java.awt.Component;
045:        import java.awt.Container;
046:        import javax.swing.JComponent;
047:        import javax.swing.JTabbedPane;
048:        import org.netbeans.jellytools.Bundle;
049:        import org.netbeans.jemmy.ComponentChooser;
050:        import org.netbeans.jemmy.ComponentSearcher;
051:        import org.netbeans.jemmy.JemmyException;
052:        import org.netbeans.jemmy.JemmyProperties;
053:        import org.netbeans.jemmy.TestOut;
054:        import org.netbeans.jemmy.Waitable;
055:        import org.netbeans.jemmy.Waiter;
056:        import org.netbeans.jemmy.operators.ContainerOperator;
057:        import org.netbeans.jemmy.operators.JComponentOperator;
058:        import org.netbeans.jemmy.operators.JTabbedPaneOperator;
059:
060:        /**
061:         * Handles org.openide.explorer.propertysheet.PropertySheetTab which
062:         * represents a single tab of properties in a IDE property sheet.
063:         * PropertySheetTab extends JPanel in IDE.
064:         * <p>
065:         * Usage:<br>
066:         * <pre>
067:         *      PropertySheetOperator pso = new PropertySheetOperator("Properties of MyClass");
068:         *      PropertySheetTabOperator psto = new PropertySheetTabOperator(pso);
069:         *      Property pr = new Property(psto, "Template");
070:         *      System.out.println("\nProperty name="+pr.getName());
071:         *      System.out.println("\nProperty value="+pr.getValue());
072:         *      PropertySheetTabOperator psto = new PropertySheetTabOperator(pso, "Other Properties");
073:         * </pre>
074:         *
075:         * @deprecated Use {@link PropertySheetOperator} instead
076:         */
077:        public class PropertySheetTabOperator extends ContainerOperator {//JComponentOperator {
078:
079:            /** Waits for PropertySheetTab with given name in specified container. If tab
080:             * exist and it is not active, it selects it.
081:             * @param contOper where to find
082:             * @param tabName name of tab
083:             * @deprecated Use {@link PropertySheetOperator} instead
084:             */
085:            public PropertySheetTabOperator(ContainerOperator contOper,
086:                    String tabName) {
087:                super (resolveParent(contOper));
088:                //super(contOper.getParent());
089:                //super((Container)contOper.getSource());
090:                /*super(waitPropertySheetTab(contOper, tabName));
091:                copyEnvironment(contOper);*/
092:            }
093:
094:            /** Waits for PropertySheetTab with name "Properties" in specified container. 
095:             * If tab exist and it is not active, it selects it.
096:             * @param contOper where to find
097:             * @deprecated Use {@link PropertySheetOperator} instead
098:             */
099:            public PropertySheetTabOperator(ContainerOperator contOper) {
100:                super (resolveParent(contOper));
101:                //super(contOper.getParent());
102:                //super((Container)contOper.getSource());
103:                /*super(waitPropertySheetTab(contOper, 
104:                            Bundle.getString("org.openide.nodes.Bundle", "Properties")));
105:                copyEnvironment(contOper);*/
106:            }
107:
108:            /** In case contOper is operator of PropertySheet instance we need to 
109:             * return parent because in Property we search for PropertySheet in that
110:             * parent.
111:             */
112:            private static Container resolveParent(ContainerOperator contOper) {
113:                if (contOper.getParent() == null) {
114:                    return (Container) contOper.getSource();
115:                } else {
116:                    return contOper.getParent();
117:                }
118:            }
119:
120:            /** Finds org.openide.explorer.propertysheet.PropertySheetTab in given
121:             * container. On its parent (JTabbedPane) find a pane with given tabName
122:             * and select that tab.
123:             * @return JComponent representing PropertySheetTab, null if not found.
124:             */
125:            private static JComponent findPropertySheetTab(
126:                    ContainerOperator contOper, String tabName) {
127:                ComponentChooser chooser = new PropertySheetTabChooser();
128:                ComponentSearcher searcher = new ComponentSearcher(
129:                        (Container) contOper.getSource());
130:                searcher.setOutput(TestOut.getNullOutput());
131:                Component comp = searcher.findComponent(chooser);
132:                if (comp == null) {
133:                    return null;
134:                }
135:                JTabbedPaneOperator tabbed = new JTabbedPaneOperator(
136:                        (JTabbedPane) comp.getParent());
137:                int count = tabbed.getTabCount();
138:                for (int i = 0; i < count; i++) {
139:                    if (contOper.getComparator().equals(tabbed.getTitleAt(i),
140:                            tabName)) {
141:                        tabbed.selectPage(i);
142:                        return (JComponent) tabbed.getSelectedComponent();
143:                    }
144:                }
145:                return null;
146:            }
147:
148:            /** Waits for PropertySheetTab.
149:             * @see #findPropertySheetTab()
150:             */
151:            private static JComponent waitPropertySheetTab(
152:                    final ContainerOperator contOper, final String tabName) {
153:                try {
154:                    Waiter waiter = new Waiter(new Waitable() {
155:                        public Object actionProduced(Object obj) {
156:                            return findPropertySheetTab(contOper, tabName);
157:                        }
158:
159:                        public String getDescription() {
160:                            return ("Wait PropertySheetTab \"" + tabName + "\".");
161:                        }
162:                    });
163:                    waiter.setOutput(JemmyProperties.getCurrentOutput());
164:                    return ((JComponent) waiter.waitAction(null));
165:                } catch (InterruptedException e) {
166:                    throw new JemmyException(
167:                            "Interrupted waiting for PropertySheetTab");
168:                }
169:            }
170:
171:            /** Chooser to find any instance of
172:             * org.openide.explorer.propertysheet.PropertySheetTab.
173:             */
174:            private static class PropertySheetTabChooser implements 
175:                    ComponentChooser {
176:                public PropertySheetTabChooser() {
177:                }
178:
179:                public boolean checkComponent(Component comp) {
180:                    return comp.getClass().getName().equals(
181:                            "org.openide.explorer.propertysheet.SheetTable");
182:                }
183:
184:                public String getDescription() {
185:                    return "SheetTable";
186:                }
187:            }
188:
189:            /** Count number of properties on the tab.
190:             * @return number or properties
191:             * @deprecated Use {@link PropertySheetOperator} instead
192:             */
193:            public int getCount() {
194:                throw new JemmyException(
195:                        "Don't use this! No JTabbedPane is used in property sheet.");
196:                /*// Trying to find non sense name it goes through all properties and
197:                // returned index represents the count.
198:                SheetButtonOperator.SheetButtonChooser chooser = 
199:                        new SheetButtonOperator.SheetButtonChooser("Nonsense name @#$%^&", getComparator());
200:                findComponent((Container)getSource(), chooser);
201:                return chooser.getIndex()+1;*/
202:            }
203:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.