001: /* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
002: /*
003: /* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
004: *
005: /* The contents of this file are subject to the terms of either the GNU
006: /* General Public License Version 2 only ("GPL") or the Common
007: /* Development and Distribution License("CDDL") (collectively, the
008: /* "License"). You may not use this file except in compliance with the
009: /* License. You can obtain a copy of the License at
010: /* http://www.netbeans.org/cddl-gplv2.html
011: /* or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
012: /* specific language governing permissions and limitations under the
013: /* License. When distributing the software, include this License Header
014: /* Notice in each file and include the License file at
015: /* nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
016: /* particular file as subject to the "Classpath" exception as provided
017: /* by Sun in the GPL Version 2 section of the License file that
018: /* accompanied this code. If applicable, add the following below the
019: /* License Header, with the fields enclosed by brackets [] replaced by
020: /* your own identifying information:
021: /* "Portions Copyrighted [year] [name of copyright owner]"
022: /*
023: /* Contributor(s):
024: *
025: * The Original Software is NetBeans. The Initial Developer of the Original
026: * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
027: * Microsystems, Inc. All Rights Reserved.
028: /*
029: /* If you wish your version of this file to be governed by only the CDDL
030: /* or only the GPL Version 2, indicate your decision by adding
031: /* "[Contributor] elects to include this software in this distribution
032: /* under the [CDDL or GPL Version 2] license." If you do not indicate a
033: /* single choice of license, a recipient has the option to distribute
034: /* your version of this file under either the CDDL, the GPL Version 2 or
035: /* to extend the choice of license to its licensees as provided above.
036: /* However, if you add GPL Version 2 code and therefore, elected the GPL
037: /* Version 2 license, then the option applies only if the new code is
038: /* made subject to such option by the copyright holder.
039: */
040:
041: package org.netbeans.modules.visualweb.gravy.navigation;
042:
043: //import org.netbeans.modules.web.jsf.navigation.NavigationView;
044: //import org.netbeans.modules.visualweb.navigation.archive.Page;
045: import org.netbeans.jemmy.Waiter;
046: import org.netbeans.jemmy.Waitable;
047: import org.netbeans.jemmy.operators.JPopupMenuOperator;
048:
049: /**
050: * Operator for pages onto "Page Navigation" pane.
051: */
052:
053: public class PageOperator {
054: private NavigatorOperator nav = null;
055: private String name = null;
056:
057: public PageOperator(NavigatorOperator navOperator, String name) {
058: nav = navOperator;
059: this .name = name;
060: // findPage();
061: }
062:
063: // /**
064: // * Push given item of popup menu.
065: // * @param menuText Name of given item.
066: // */
067: // public void pushPopup(String menuText) {
068: // clickForPopup();
069: // new JPopupMenuOperator().pushMenu(menuText);
070: // }
071: //
072: // /**
073: // * Call popup menu on page.
074: // */
075: // public void clickForPopup() {
076: // nav.clickForPopup(getX()+3,getY()+3);
077: // }
078: //
079: // /**
080: // * Double click on page.
081: // */
082: // public void mouseDoubleClick() {
083: // nav.clickMouse(getX()+3,getY()+3, 2);
084: // }
085: //
086: // /**
087: // * Select this page.
088: // */
089: // public void select() {
090: // nav.clickMouse(getX(), getY());
091: // }
092: //
093: // /**
094: // * Get x-coordinate of this page.
095: // * return x-coordinate of the page.
096: // */
097: // public int getX() {
098: // return findPage().x();
099: // }
100: //
101: // /**
102: // * Get y-coordinate of this page.
103: // * return y-coordinate of the page.
104: // */
105: // public int getY() {
106: // return findPage().y();
107: // }
108: //
109: // /**
110: // * Get width of this page.
111: // * return Width of the page.
112: // */
113: // public int getWidth() {
114: // return findPage().w();
115: // }
116: //
117: // /**
118: // * Get height of this page.
119: // * return Height of the page.
120: // */
121: // public int getHeight() {
122: // return findPage().h();
123: // }
124: //
125: // /**
126: // * Get necessary page.
127: // * return Page.
128: // */
129: // private Page findPage() {
130: // Page page = waitPage();
131: // / return page;
132: // }
133: //
134: // private Page waitPage() {
135: // Waiter waiter = new Waiter (new Waitable() {
136: // public Object actionProduced(Object obj) {
137: // //TODO: Uncommnet once naviation module refactory complete
138: //// if(nav != null) {
139: //// NavigationModel navModel = ((NavigationView)nav.getSource()).getNavigationModel();
140: //// List<Page> pages = navModel.getPages();
141: //// if(pages.size() == 0) {
142: //// return null;
143: //// }
144: //// for(int i=0;i <pages.size(); i++) {
145: //// Page p = (Page)pages.get(i);
146: //// if((p.toString()).indexOf(name) >= 0) {
147: //// return p;
148: //// }
149: //// }
150: //// }
151: // return null;
152: // }
153: // public String getDescription() {
154: // return "Waiting for navigation Page";
155: // }
156: // });
157: // try {
158: // Page page = (Page)waiter.waitAction(null);
159: // return page;
160: // } catch (InterruptedException e) {
161: // return null;
162: // }
163: // }
164: }
|