OpenKeyWord  Build_ID: 457, Datum: 01.02.2020 07:45:48
Dont repeat yourself. - Do it once and only once!
SeInputCheckbox.java
1 /*
2  ==============================================================================
3  Author: Zoltán Hrabovszki <zh@openkeyword.de>
4 
5  Copyright © 2012 - 2019 IT-Beratung Hrabovszki
6  www.OpenKeyWord.de
7  ==============================================================================
8 
9  This file is part of OpenKeyWord.
10 
11  OpenKeyWord is free software: you can redistribute it and/or modify
12  it under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenKeyWord is distributed in the hope that it will be useful,
17  but WITHOUT ANY WARRANTY; without even the implied warranty of
18  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  GNU General Public License for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenKeyWord. If not, see <http://www.gnu.org/licenses/>.
23 
24  Diese Datei ist Teil von OpenKeyWord.
25 
26  OpenKeyWord ist Freie Software: Sie können es unter den Bedingungen
27  der GNU General Public License, wie von der Free Software Foundation,
28  Version 3 der Lizenz oder (nach Ihrer Wahl) jeder späteren
29  veröffentlichten Version, weiterverbreiten und/oder modifizieren.
30 
31  OpenKeyWord wird in der Hoffnung, dass es nützlich sein wird, aber
32  OHNE JEDE GEWÄHRLEISTUNG, bereitgestellt; sogar ohne die implizite
33  Gewährleistung der MARKTFÄHIGKEIT oder EIGNUNG FÜR EINEN BESTIMMTEN ZWECK.
34  Siehe die GNU General Public License für weitere Details.
35 
36  Sie sollten eine Kopie der GNU General Public License zusammen mit
37  OpenKeyWord erhalten haben. Wenn nicht, siehe <http://www.gnu.org/licenses/>.
38 */
39 
40 package okw.gui.adapter.selenium;
41 
42 import java.util.ArrayList;
43 
44 import okw.LogMessenger;
45 import okw.OKW_Const_Sngltn;
46 import okw.exceptions.OKWNotAllowedValueException;
47 import okw.gui.*;
48 
113  public class SeInputCheckbox extends SeAnyChildWindow
114  {
115 
116  private OKW_Const_Sngltn myOKW_Const = null;
117 
123  public SeInputCheckbox( String Locator, OKWLocatorBase... Locators )
124  {
125  super(Locator, Locators);
126  this.LM = new LogMessenger("GUI");
127  myOKW_Const = OKW_Const_Sngltn.getInstance();
128  }
129 
130 
147  public Boolean getIsSelected()
148  {
149  Boolean lvbReturn = false;
150 
151  try
152  {
153  LogFunctionStartDebug("getIsSelected");
154 
155  // Hole Zusand: "Häkschen" oder kein "Häkschen", das ist hier die Frage...
156  lvbReturn = this.Me().isSelected();
157  }
158  finally
159  {
160  LogFunctionEndDebug(lvbReturn);
161  }
162  return lvbReturn;
163  }
164 
165 
178  public void checking()
179  {
180 
181  try
182  {
183  LogFunctionStartDebug("checking");
184 
185  // Hab ich ein Häckchen?
186  if (!this.getIsSelected())
187  {
188  this.ClickOn();
189  }
190  }
191  finally
192  {
194  }
195  }
196 
212  @Override
213  public ArrayList<String> getValue()
214  {
215  ArrayList<String> lvls_Return = new ArrayList<String>();
216  try
217  {
218  this.LogFunctionStartDebug("getValue");
219 
220  // Warten auf das Objekt. Wenn es nicht existiert wird mit OKWGUIObjectNotFoundException beendet...
221  this.WaitForMe();
222 
223  if (this.getIsSelected())
224  {
225  String lvsValue = myOKW_Const.GetConst4Internalname("CHECKED");
226  lvls_Return.add(lvsValue);
227  }
228  else
229  {
230  String lvsValue = myOKW_Const.GetConst4Internalname("UNCHECKED");
231  lvls_Return.add(lvsValue);
232  }
233  }
234  finally
235  {
236  LogFunctionEndDebug(lvls_Return);
237  }
238 
239  return lvls_Return;
240  }
241 
252  @Override
253  public void SetValue(ArrayList<String> fps_Values)
254  {
255 
256  try
257  {
258  this.LogFunctionStartDebug("SetValue", "fps_Values", fps_Values.toString());
259 
260  // Warten auf das Objekt. Wenn es nicht existiert wird mit OKWGUIObjectNotFoundException beendet...
261  this.WaitForMe();
262 
263  // Sprachabhängige Werte holen
264  String lvsCHECKED = myOKW_Const.GetConst4Internalname("CHECKED");
265  String lvsUNCHECKED = myOKW_Const.GetConst4Internalname("UNCHECKED");
266 
267  if ( fps_Values.get(0).equalsIgnoreCase( lvsCHECKED ) )
268  {
269  this.checking();
270  }
271  else if (fps_Values.get(0).equalsIgnoreCase( lvsUNCHECKED ) )
272  {
273  this.unchecking();
274  }
275  else
276  {
277  // LANGUAGE: Exceptionmeldungen in eine Eigene xml Auslagern.
278  String lvsLM = this.LM.GetMessage("Common", "OKWNotAllowedValueException", fps_Values.get(0));
279  throw new OKWNotAllowedValueException(lvsLM);
280  }
281  }
282  finally
283  {
284  this.LogFunctionEndDebug();
285  }
286  }
287 
302  @Override
303  public void Select(ArrayList<String> fps_Values)
304  {
305  this.LogFunctionStartDebug("Select", "fps_Values", fps_Values.toString());
306 
307  try
308  {
309  // Warten auf das Objekt. Wenn es nicht existiert wird mit OKWGUIObjectNotFoundException beendet...
310  this.WaitForMe();
311 
312  // Sprachabhängige Werte holen
313  String lvsCHECKED = myOKW_Const.GetConst4Internalname("CHECKED");
314  String lvsUNCHECKED = myOKW_Const.GetConst4Internalname("UNCHECKED");
315 
316  if (fps_Values.get(0).equalsIgnoreCase( lvsCHECKED ) )
317  {
318  checking();
319  }
320  else if (fps_Values.get(0).equalsIgnoreCase( lvsUNCHECKED ) )
321  {
322  unchecking();
323  }
324  else
325  {
326  // LANGUAGE: Exceptionmeldungen in eine Eigene xml Auslagern.
327  String lvsLM = this.LM.GetMessage("Common", "OKWNotAllowedValueException", fps_Values.get(0));
328  throw new OKWNotAllowedValueException(lvsLM);
329  }
330  }
331  finally
332  {
333  this.LogFunctionEndDebug();
334  }
335  }
336 
337 
349  public void unchecking()
350  {
351  try
352  {
353  this.LogFunctionStartDebug("UnChecking");
354 
355  // Hab ich ein Häckchen?
356  if (this.getIsSelected())
357  {
358  // yep! - Dann klicken und Häckchen weg...
359  this.ClickOn();
360  }
361  }
362  finally
363  {
364  this.LogFunctionEndDebug();
365  }
366  }
367 }
okw.gui.OKWLocatorBase
Definition: OKWLocatorBase.java:3
okw.gui.adapter.selenium.SeInputCheckbox.getIsSelected
Boolean getIsSelected()
Method liefert den aktuellen Zustand der Checkbox, "angehakt" oder "nicht angehakt".
Definition: SeInputCheckbox.java:147
okw.gui.adapter.selenium.SeAnyChildWindow.WaitForMe
Boolean WaitForMe()
Wartet auf das Objekt Wenn kein Fenster gefunden wird,.
Definition: SeAnyChildWindow.java:1582
okw.LogMessenger
LogMessenger liest Log-Meldungen sprachspezifisch für die im Konstruktor gegeben Klasse aus der Zugeh...
Definition: LogMessenger.java:84
okw.OKW_Const_Sngltn.GetConst4Internalname
String GetConst4Internalname(String fpsInternalname)
Methode ermittelt für Internalname und der aktuell eingestellten Sprache den Wert für Const.
Definition: OKW_Const_Sngltn.java:524
okw.gui.adapter.selenium.SeInputCheckbox.Select
void Select(ArrayList< String > fps_Values)
Erlaubte Werte sind sprachabhängig CHECKED/UNCHECKED.
Definition: SeInputCheckbox.java:303
okw.gui.AnyWinBase.LogFunctionEndDebug
void LogFunctionEndDebug()
Methode ruft die Methode Logger.Instance.LogFunctionEndDebug() auf.
Definition: AnyWinBase.java:298
okw.gui.adapter.selenium.SeAnyChildWindow
Definition: SeAnyChildWindow.java:74
okw.gui.adapter.selenium.SeInputCheckbox.getValue
ArrayList< String > getValue()
Ermittelt/holt den aktuellen Wert der CheckBox.
Definition: SeInputCheckbox.java:213
okw.gui.adapter.selenium.SeInputCheckbox.checking
void checking()
Method verlässt die Checkbox immer angehakt, egal ob diese vorher angehakt war oder nicht.
Definition: SeInputCheckbox.java:178
okw.LogMessenger.GetMessage
String GetMessage(String MethodName, String TextKey)
Holt die Log-Meldung für MethodeNmae/Textkey ohne weitere Parameter.
Definition: LogMessenger.java:137
okw.OKW_Const_Sngltn.getInstance
static OKW_Const_Sngltn getInstance()
Holt die einzige Instanz dieser Klasse.
Definition: OKW_Const_Sngltn.java:277
okw.OKW_Const_Sngltn
OKW_Const verwaltet die sprachabhängigen OKW-Konstanten.
Definition: OKW_Const_Sngltn.java:127
okw.gui.adapter.selenium.SeAnyChildWindow.Me
WebElement Me()
Ermittelt aus dem gegebenen Locator das DOM-Elelement, welches das Objekt representiert.
Definition: SeAnyChildWindow.java:751
okw.gui.AnyWinBase.LogFunctionStartDebug
void LogFunctionStartDebug(String fpsMethodName)
Methode ruft die Methode Logger.Instance.LogFunctionStartDebug(fps_FunctionName), und erweitert den g...
Definition: AnyWinBase.java:212
okw.exceptions.OKWNotAllowedValueException
OKWNotAllowedValueException-Ausnahme wird ausgelöst, wenn ein gegebener Wert im Schlüsselwort nicht e...
Definition: OKWNotAllowedValueException.java:63
okw.gui.adapter.selenium.SeAnyChildWindow.ClickOn
void ClickOn()
Das ist die GUI-Adapter Methode, die durch das Schlüsselwort ClickOn( FN ) aufgerufen wird.
Definition: SeAnyChildWindow.java:168
okw.gui.adapter.selenium.SeInputCheckbox.SetValue
void SetValue(ArrayList< String > fps_Values)
Definition: SeInputCheckbox.java:253
okw.gui.adapter.selenium.SeInputCheckbox.SeInputCheckbox
SeInputCheckbox(String Locator, OKWLocatorBase... Locators)
Definition: SeInputCheckbox.java:123
okw.gui.adapter.selenium.SeInputCheckbox.unchecking
void unchecking()
Method verlässt die Checkbox immer unangehakt, egal ob sie vorher angehakt war oder nicht.
Definition: SeInputCheckbox.java:349
okw.gui.adapter.selenium.SeInputCheckbox
Definition: SeInputCheckbox.java:113