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 org.openoffice.test.vcl.client.Constant; 27 28 29 /** 30 * 31 * Button/CheckBox/RadioBox/TriStateBox 32 * 33 */ 34 public class VclButton extends VclControl { 35 VclButton(VclApp app, String id)36 public VclButton(VclApp app, String id) { 37 super(app, id); 38 } 39 40 /** 41 * 42 * Click the check box 43 */ click()44 public void click() { 45 invoke(Constant.M_Click); 46 } 47 48 /** 49 * Check if the check box is tristate 50 */ isTristate()51 public boolean isTristate() { 52 return (Boolean)invoke(Constant.M_IsTristate); 53 } 54 55 /** 56 * Set the check box to triState status 57 */ triState()58 public void triState() { 59 invoke(Constant.M_TriState); 60 } 61 62 /** 63 * Check if the check box is checked 64 */ isChecked()65 public boolean isChecked() { 66 return (Boolean) invoke(Constant.M_IsChecked); 67 } 68 69 /** 70 * Set the check box to checked status 71 * 72 */ check()73 public void check() { 74 invoke(Constant.M_Check); 75 } 76 77 /** 78 * Set the check box to unchecked status 79 */ uncheck()80 public void uncheck() { 81 invoke(Constant.M_UnCheck); 82 } 83 84 /** 85 * Set the status to checked or unchecked 86 * @param checked 87 */ setChecked(boolean checked)88 public void setChecked(boolean checked) { 89 if (checked) 90 this.check(); 91 else 92 this.uncheck(); 93 } 94 } 95