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 package mod._forms;
24 
25 import com.sun.star.beans.NamedValue;
26 import com.sun.star.beans.PropertyValue;
27 import java.io.PrintWriter;
28 
29 import lib.TestEnvironment;
30 import lib.TestParameters;
31 import util.DBTools;
32 
33 
34 
35 /**
36 * Test for object which is represented by service
37 * <code>com.sun.star.form.component.RadioButton</code>. <p>
38 *
39 * Object implements the following interfaces :
40 * <ul>
41 *  <li> <code>com::sun::star::io::XPersistObject</code></li>
42 *  <li> <code>com::sun::star::form::component::RadioButton</code></li>
43 *  <li> <code>com::sun::star::form::XReset</code></li>
44 *  <li> <code>com::sun::star::form::XBoundComponent</code></li>
45 *  <li> <code>com::sun::star::form::FormComponent</code></li>
46 *  <li> <code>com::sun::star::beans::XFastPropertySet</code></li>
47 *  <li> <code>com::sun::star::beans::XMultiPropertySet</code></li>
48 *  <li> <code>com::sun::star::form::XUpdateBroadcaster</code></li>
49 *  <li> <code>com::sun::star::form::DataAwareControlModel</code></li>
50 *  <li> <code>com::sun::star::awt::UnoControlRadioButtonModel</code></li>
51 *  <li> <code>com::sun::star::beans::XPropertyState</code></li>
52 *  <li> <code>com::sun::star::form::FormControlModel</code></li>
53 *  <li> <code>com::sun::star::container::XNamed</code></li>
54 *  <li> <code>com::sun::star::lang::XComponent</code></li>
55 *  <li> <code>com::sun::star::lang::XEventListener</code></li>
56 *  <li> <code>com::sun::star::beans::XPropertyAccess</code></li>
57 *  <li> <code>com::sun::star::beans::XPropertyContainer</code></li>
58 *  <li> <code>com::sun::star::beans::XPropertySet</code></li>
59 *  <li> <code>com::sun::star::form::XLoadListener</code></li>
60 *  <li> <code>com::sun::star::container::XChild</code></li>
61 * </ul> <p>
62 * This object test <b> is NOT </b> designed to be run in several
63 * threads concurently.
64 * @see com.sun.star.io.XPersistObject
65 * @see com.sun.star.form.component.RadioButton
66 * @see com.sun.star.form.XReset
67 * @see com.sun.star.form.XBoundComponent
68 * @see com.sun.star.form.FormComponent
69 * @see com.sun.star.beans.XFastPropertySet
70 * @see com.sun.star.beans.XMultiPropertySet
71 * @see com.sun.star.form.XUpdateBroadcaster
72 * @see com.sun.star.form.DataAwareControlModel
73 * @see com.sun.star.awt.UnoControlRadioButtonModel
74 * @see com.sun.star.beans.XPropertyState
75 * @see com.sun.star.form
76 * @see com.sun.star.container.XNamed
77 * @see com.sun.star.lang.XComponent
78 * @see com.sun.star.lang.XEventListener
79 * @see com.sun.star.beans.XPropertyAccess
80 * @see com.sun.star.beans.XPropertyContainer
81 * @see com.sun.star.beans.XPropertySet
82 * @see com.sun.star.form.XLoadListener
83 * @see com.sun.star.container.XChild
84 * @see ifc.io._XPersistObject
85 * @see ifc.form.component._RadioButton
86 * @see ifc.form._XReset
87 * @see ifc.form._XBoundComponent
88 * @see ifc.form._FormComponent
89 * @see ifc.beans._XFastPropertySet
90 * @see ifc.beans._XMultiPropertySet
91 * @see ifc.form._XUpdateBroadcaster
92 * @see ifc.form._DataAwareControlModel
93 * @see ifc.awt._UnoControlRadioButtonModel
94 * @see ifc.beans._XPropertyState
95 * @see ifc.form._FormControlModel
96 * @see ifc.container._XNamed
97 * @see ifc.lang._XComponent
98 * @see ifc.lang._XEventListener
99 * @see ifc.beans._XPropertySet
100 * @see ifc.form._XLoadListener
101 * @see ifc.container._XChild
102 */
103 public class ORadioButtonModel extends GenericModelTest {
104 
105     /**
106      * Set some member variable of the super class <CODE>GenericModelTest</CODE>:
107      * <pre>
108      *    super.m_ChangePropertyName</CODE> = "State";
109      *    super.m_kindOfControl</CODE>="RadioButton";
110      *    super.m_ObjectName</CODE> = "RadioButton";
111      *    NamedValue myProp = new NamedValue();
112      *        myProp.Name = "DataField";
113      *        myProp.Value = DBTools.TST_STRING_F;
114      *        super.m_propertiesToSet.add(myProp);
115      *    super.m_LCShape_Type = "GroupBox";
116      * </pre>
117      * Then <CODE>super.initialize()</CODE> was called.
118      * @param tParam the test parameter
119      * @param log the log writer
120      */
121 
initialize(TestParameters tParam, PrintWriter log)122     protected void initialize(TestParameters tParam, PrintWriter log) {
123 
124         super.initialize(tParam, log);
125         super.m_ChangePropertyName = "State";
126 
127         super.m_kindOfControl="RadioButton";
128 
129         super.m_ObjectName = "stardiv.one.form.component.RadioButton";
130 
131         NamedValue myProp = new NamedValue();
132         myProp.Name = "DataField";
133         myProp.Value = DBTools.TST_STRING_F;
134         super.m_propertiesToSet.add(myProp);
135 
136         super.m_LCShape_Type = "GroupBox";
137 
138     }
139     /**
140      * calls <CODE>cleanup()</CODE> from it's super class
141      * @param tParam the test parameter
142      * @param log the log writer
143      */
cleanup(TestParameters tParam, PrintWriter log)144     protected void cleanup(TestParameters tParam, PrintWriter log) {
145         super.cleanup(tParam, log);
146     }
147 
148 
149     /**
150      * calls <CODE>createTestEnvironment()</CODE> from it's super class
151      * @param Param the test parameter
152      * @param log the log writer
153      * @return lib.TestEnvironment
154      */
createTestEnvironment(TestParameters Param, PrintWriter log)155     protected synchronized TestEnvironment createTestEnvironment(TestParameters Param,
156                                                                  PrintWriter log) {
157         TestEnvironment tEnv = super.createTestEnvironment(Param, log);
158         tEnv.addObjRelation("DataAwareControlModel.NewFieldName",
159                             DBTools.TST_INT_F);
160         PropertyValue prop = new PropertyValue();
161         prop.Name = "HelpText";
162         prop.Value = "new Help Text since XPropertyAccess";
163         tEnv.addObjRelation("XPropertyAccess.propertyToChange", prop);
164         tEnv.addObjRelation("XPropertyContainer.propertyNotRemovable", "HelpText");
165 
166         return tEnv;
167     }
168 
169 } // finish class ORadioButtonModel
170