xref: /AOO41X/test/testcommon/source/org/openoffice/test/vcl/widgets/VclTabControl.java (revision 57caf934cc4bd0c33eda07ea95aabaebabf812db)
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  * Proxy to access VCL tab control
30  *
31  */
32 public class VclTabControl extends VclControl {
33 
VclTabControl(VclApp app)34     public VclTabControl(VclApp app) {
35         super(app, Constant.UID_ACTIVE);
36     }
37 
VclTabControl(VclApp app, String id)38     public VclTabControl(VclApp app, String id) {
39         super(app, id);
40     }
41 
42     /**
43      * Get the current page
44      * @return
45      */
getPage()46     public int getPage() {
47         return ((Long) invoke(Constant.M_GetPage)).intValue();
48     }
49 
50     /**
51      * Returns the number of tab pages in the TabControl.
52      * <p>
53      *
54      * @return number of tab pages in the dialog. -1 : Return value error
55      *         <p>
56      */
getPageCount()57     public int getPageCount() {
58         return ((Long) invoke(Constant.M_GetPageCount)).intValue();
59     }
60 
61     /**
62      * Returns the TabpageID of current Tab Page in the Tab dialog. This not the
63      * UniqueID and is only needed for the SetPageID instruction..
64      * <p>
65      *
66      * @return TabpageID used in SetPageID instruction; -1 : Return value error
67      *         <p>
68      */
getPageId()69     public int getPageId() {
70         return ((Long) invoke(Constant.M_GetPageId)).intValue();
71     }
72 
73     /**
74      * Returns the TabpageID of specified Tab page in the Tab dialog. This not
75      * the UniqueID and is only needed for the SetPageID instruction..
76      * <p>
77      *
78      * @param nTabID :
79      *            Specified Tab Page which order from 1. eg. A tab dialog have
80      *            two Tab pages, nTabID is 2 if you want to get the TabpageID of
81      *            second Tab page
82      * @return TabpageID used in SetPageID instruction; -1 : Return value error
83      *         <p>
84      */
getPageId(short nTabID)85     public int getPageId(short nTabID) {
86         return ((Long) invoke(Constant.M_GetPageId, new Object[] { nTabID }))
87                 .intValue();
88     }
89 
90     /**
91      * Changes to the tab page that has the TabpageID that you specify.
92      * <p>
93      *
94      * @param id
95      *            TabpageID of tab page
96      */
setPageId(int id)97     public void setPageId(int id) {
98         invoke(Constant.M_SetPageId, new Object[] { id });
99     }
100 
101     /**
102      * Change to the tab page you specify
103      * <p>
104      *
105      * @param nTabResID
106      *            The resource ID of the specified Tab page in Tab Dialog
107      */
setPage(String id)108     public void setPage(String id) {
109         invoke(Constant.M_SetPage, new Object[] {id});
110     }
111 }
112