mkristofic@1583
|
1 |
/*
|
mkristofic@1583
|
2 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
|
mkristofic@1583
|
3 |
*
|
mkristofic@1583
|
4 |
* Copyright 2009-2017 Oracle and/or its affiliates. All rights reserved.
|
mkristofic@1583
|
5 |
*
|
mkristofic@1583
|
6 |
* Oracle and Java are registered trademarks of Oracle and/or its affiliates.
|
mkristofic@1583
|
7 |
* Other names may be trademarks of their respective owners.
|
mkristofic@1583
|
8 |
*
|
mkristofic@1583
|
9 |
* The contents of this file are subject to the terms of either the GNU
|
mkristofic@1583
|
10 |
* General Public License Version 2 only ("GPL") or the Common
|
mkristofic@1583
|
11 |
* Development and Distribution License("CDDL") (collectively, the
|
mkristofic@1583
|
12 |
* "License"). You may not use this file except in compliance with the
|
mkristofic@1583
|
13 |
* License. You can obtain a copy of the License at
|
mkristofic@1583
|
14 |
* http://www.netbeans.org/cddl-gplv2.html
|
mkristofic@1583
|
15 |
* or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
|
mkristofic@1583
|
16 |
* specific language governing permissions and limitations under the
|
mkristofic@1583
|
17 |
* License. When distributing the software, include this License Header
|
mkristofic@1583
|
18 |
* Notice in each file and include the License file at
|
mkristofic@1583
|
19 |
* nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
|
mkristofic@1583
|
20 |
* particular file as subject to the "Classpath" exception as provided
|
mkristofic@1583
|
21 |
* by Oracle in the GPL Version 2 section of the License file that
|
mkristofic@1583
|
22 |
* accompanied this code. If applicable, add the following below the
|
mkristofic@1583
|
23 |
* License Header, with the fields enclosed by brackets [] replaced by
|
mkristofic@1583
|
24 |
* your own identifying information:
|
mkristofic@1583
|
25 |
* "Portions Copyrighted [year] [name of copyright owner]"
|
mkristofic@1583
|
26 |
*
|
mkristofic@1583
|
27 |
* Contributor(s):
|
mkristofic@1583
|
28 |
*
|
mkristofic@1583
|
29 |
* The Original Software is NetBeans. The Initial Developer of the Original
|
mkristofic@1583
|
30 |
* Software is Sun Microsystems, Inc. Portions Copyright 2009-2010 Sun
|
mkristofic@1583
|
31 |
* Microsystems, Inc. All Rights Reserved.
|
mkristofic@1583
|
32 |
*
|
mkristofic@1583
|
33 |
* If you wish your version of this file to be governed by only the CDDL
|
mkristofic@1583
|
34 |
* or only the GPL Version 2, indicate your decision by adding
|
mkristofic@1583
|
35 |
* "[Contributor] elects to include this software in this distribution
|
mkristofic@1583
|
36 |
* under the [CDDL or GPL Version 2] license." If you do not indicate a
|
mkristofic@1583
|
37 |
* single choice of license, a recipient has the option to distribute
|
mkristofic@1583
|
38 |
* your version of this file under either the CDDL, the GPL Version 2 or
|
mkristofic@1583
|
39 |
* to extend the choice of license to its licensees as provided above.
|
mkristofic@1583
|
40 |
* However, if you add GPL Version 2 code and therefore, elected the GPL
|
mkristofic@1583
|
41 |
* Version 2 license, then the option applies only if the new code is
|
mkristofic@1583
|
42 |
* made subject to such option by the copyright holder.
|
mkristofic@1583
|
43 |
*/
|
mikhailmatveev@890
|
44 |
/*
|
mikhailmatveev@890
|
45 |
* To change this template, choose Tools | Templates
|
mikhailmatveev@890
|
46 |
* and open the template in the editor.
|
mikhailmatveev@890
|
47 |
*/
|
mikhailmatveev@890
|
48 |
|
mikhailmatveev@890
|
49 |
package org.netbeans.test.xml.schema.abe;
|
mikhailmatveev@890
|
50 |
|
mikhailmatveev@890
|
51 |
import org.netbeans.test.xml.schema.*;
|
mikhailmatveev@890
|
52 |
import java.awt.Container;
|
mikhailmatveev@890
|
53 |
import java.awt.event.KeyEvent;
|
mikhailmatveev@890
|
54 |
import org.netbeans.jemmy.operators.ContainerOperator;
|
mikhailmatveev@890
|
55 |
import org.netbeans.jemmy.operators.JPopupMenuOperator;
|
mikhailmatveev@890
|
56 |
import org.netbeans.modules.xml.schema.abe.ElementPanel;
|
mikhailmatveev@890
|
57 |
import org.netbeans.test.xml.schema.lib.util.Helpers;
|
mikhailmatveev@890
|
58 |
|
mikhailmatveev@890
|
59 |
/**
|
mikhailmatveev@890
|
60 |
*
|
mikhailmatveev@890
|
61 |
* @author Mikhail Matveev
|
mikhailmatveev@890
|
62 |
*/
|
mikhailmatveev@890
|
63 |
public class DVNodeOperator extends DVGenericNodeOperator{
|
mikhailmatveev@890
|
64 |
|
mikhailmatveev@890
|
65 |
private ElementPanel m_panel=null;
|
mikhailmatveev@890
|
66 |
|
mikhailmatveev@890
|
67 |
public DVNodeOperator(Container comp){
|
mikhailmatveev@890
|
68 |
super(comp);
|
mikhailmatveev@890
|
69 |
m_panel=(ElementPanel)comp;
|
mikhailmatveev@890
|
70 |
}
|
mikhailmatveev@890
|
71 |
|
mikhailmatveev@890
|
72 |
public DVNodeOperator(ContainerOperator parent, String text){
|
mikhailmatveev@890
|
73 |
|
mikhailmatveev@890
|
74 |
this(parent,text,null);
|
mikhailmatveev@890
|
75 |
}
|
mikhailmatveev@890
|
76 |
|
mikhailmatveev@890
|
77 |
public DVNodeOperator(ContainerOperator parent, String text, boolean ce, boolean ccs){
|
mikhailmatveev@890
|
78 |
|
mikhailmatveev@890
|
79 |
this(parent,text,new DefaultStringComparator(ce,ccs));
|
mikhailmatveev@890
|
80 |
}
|
mikhailmatveev@890
|
81 |
|
mikhailmatveev@890
|
82 |
public DVNodeOperator(ContainerOperator parent, String text, StringComparator comparator){
|
mikhailmatveev@890
|
83 |
|
mikhailmatveev@890
|
84 |
super(parent,text,comparator);
|
mikhailmatveev@890
|
85 |
m_panel=(ElementPanel)m_label.getSource().getParent().getParent();
|
mikhailmatveev@890
|
86 |
}
|
mikhailmatveev@890
|
87 |
|
mikhailmatveev@890
|
88 |
public boolean isExpanded() {
|
mikhailmatveev@890
|
89 |
return m_panel.isExpanded();
|
mikhailmatveev@890
|
90 |
}
|
mikhailmatveev@890
|
91 |
|
mikhailmatveev@890
|
92 |
public void setExpanded(boolean value) {
|
mikhailmatveev@890
|
93 |
m_panel.setExpanded(value);
|
mikhailmatveev@890
|
94 |
if (value){
|
mikhailmatveev@890
|
95 |
m_panel.expandChild();
|
mikhailmatveev@890
|
96 |
}
|
mikhailmatveev@890
|
97 |
}
|
mikhailmatveev@890
|
98 |
|
mikhailmatveev@890
|
99 |
public ElementPanel getElementPanel() {
|
mikhailmatveev@890
|
100 |
return m_panel;
|
mikhailmatveev@890
|
101 |
}
|
mikhailmatveev@890
|
102 |
|
mikhailmatveev@890
|
103 |
public void renameRefactor(String name){
|
mikhailmatveev@890
|
104 |
clickForPopupRobot();
|
mikhailmatveev@890
|
105 |
Helpers.waitNoEvent();
|
mikhailmatveev@890
|
106 |
new JPopupMenuOperator().pushMenuNoBlock("Refactor|Rename...");
|
mikhailmatveev@890
|
107 |
Helpers.waitNoEvent();
|
mikhailmatveev@890
|
108 |
new RefactoringDialogOperator(name).refactorImmediately();
|
mikhailmatveev@890
|
109 |
}
|
mikhailmatveev@890
|
110 |
|
mikhailmatveev@890
|
111 |
public void deleteRefactor(){
|
mikhailmatveev@890
|
112 |
clickForPopupRobot();
|
mikhailmatveev@890
|
113 |
Helpers.waitNoEvent();
|
mikhailmatveev@890
|
114 |
new JPopupMenuOperator().pushMenuNoBlock("Refactor|Safe Delete...");
|
mikhailmatveev@890
|
115 |
Helpers.waitNoEvent();
|
mikhailmatveev@890
|
116 |
new RefactoringDialogOperator(null).refactorImmediately();
|
mikhailmatveev@890
|
117 |
}
|
mikhailmatveev@890
|
118 |
|
mikhailmatveev@890
|
119 |
public void delete(){
|
mikhailmatveev@890
|
120 |
clickForPopupRobot();
|
mikhailmatveev@890
|
121 |
Helpers.waitNoEvent();
|
mikhailmatveev@890
|
122 |
new JPopupMenuOperator().pushMenuNoBlock("Delete");
|
mikhailmatveev@890
|
123 |
Helpers.waitNoEvent();
|
mikhailmatveev@890
|
124 |
new RefactoringDialogOperator(null).refactorImmediately();
|
mikhailmatveev@890
|
125 |
}
|
mikhailmatveev@890
|
126 |
|
mikhailmatveev@890
|
127 |
public DVGenericNodeOperator addAttribute(String name){
|
mikhailmatveev@890
|
128 |
clickForPopupRobot();
|
mikhailmatveev@890
|
129 |
new JPopupMenuOperator().pushMenu("Add|Attribute");
|
mikhailmatveev@890
|
130 |
|
mikhailmatveev@890
|
131 |
DVGenericNodeOperator res=new DVGenericNodeOperator(this, DesignViewOperator.defaultAttributeName, true, true);
|
mikhailmatveev@890
|
132 |
res.getLabel().setText(name);
|
mikhailmatveev@890
|
133 |
res.pushKey(KeyEvent.VK_ENTER);
|
mikhailmatveev@890
|
134 |
return res;
|
mikhailmatveev@890
|
135 |
}
|
mikhailmatveev@890
|
136 |
|
mikhailmatveev@890
|
137 |
|
mikhailmatveev@890
|
138 |
}
|