1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 package org.openoffice.test.vcl.widgets; 25 26 import java.awt.Point; 27 28 import org.openoffice.test.vcl.client.Constant; 29 30 /** 31 * Proxy to access a VCL window. 32 * 33 */ 34 public class VclWindow extends VclControl { 35 VclWindow(VclApp app, String id)36 public VclWindow(VclApp app, String id) { 37 super(app, id); 38 } 39 40 41 /** 42 * Get the title of the window 43 * @return 44 */ getText()45 public String getText() { 46 return getCaption(); 47 } 48 49 /** 50 * Presses the Help button to open the help topic for the window 51 * 52 */ help()53 public void help() { 54 invoke(Constant.M_Help); 55 } 56 57 /** 58 * Closes a window with the Close button. 59 */ close()60 public void close() { 61 invoke(Constant.M_Close); 62 } 63 64 /** 65 * Move the window by percent 66 * 67 * @param x 68 * @param y 69 */ move(int x, int y)70 public void move(int x, int y) { 71 invoke(Constant.M_Move, new Object[]{new Integer(x), new Integer(y)}); 72 } 73 74 /** 75 * Move the window by pixel 76 * @param p 77 */ move(Point p)78 public void move(Point p) { 79 move(p.x, p.y); 80 } 81 82 83 84 /** 85 * Returns the state of the window (maximize or minimize). 86 * <p> 87 * 88 * @return Returns TRUE if the window is maximized, otherwise FALSE is 89 * returned. 90 */ isMax()91 public boolean isMax() { 92 return (Boolean)invoke(Constant.M_IsMax); 93 } 94 95 /** 96 * Maximizes a window so that the contents of the window are visible. 97 */ maximize()98 public void maximize() { 99 invoke(Constant.M_Maximize); 100 } 101 102 /** 103 * Minimizes a window so that only the title bar of the window is visible 104 */ minimize()105 public void minimize() { 106 invoke(Constant.M_Minimize); 107 } 108 109 110 /** 111 * Resize the window 112 * @param x 113 * @param y 114 */ resize(int x, int y)115 public void resize(int x, int y) { 116 invoke(Constant.M_Size, new Object[]{new Integer(x), new Integer(y)}); 117 } 118 119 /** 120 * Restore the window 121 * 122 */ restore()123 public void restore() { 124 invoke(Constant.M_Restore); 125 } 126 127 /** 128 * Activate the window 129 */ activate()130 public void activate() { 131 // focus it 132 focus(); 133 } 134 } 135