OpenKeyWord  Build_ID: 457, Datum: 01.02.2020 07:45:48
Dont repeat yourself. - Do it once and only once!
SeInputText.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 import org.apache.commons.lang3.StringUtils;
44 import org.openqa.selenium.WebElement;
45 import okw.gui.OKWLocatorBase;
46 
47 
114 public class SeInputText extends SeAnyChildWindow
115 {
116 
120  public SeInputText( String Locator, OKWLocatorBase... Locators )
121  {
122  super( Locator, Locators );
123  }
124 
125 
138  @Override
139  public ArrayList<String> getCaption()
140  {
141  return getValue();
142  }
143 
144 
156  public Integer getMaxLength()
157  {
158  Integer lviReturn = 0;
159 
160  try
161  {
162  this.LogFunctionStartDebug( "getMaxLength" );
163 
164  // Warten auf das Objekt. Wenn es nicht existiert wird mit OKWGUIObjectNotFoundException beendet...
165  this.WaitForMe();
166 
167 
168  // The Attribute "MaxLength" auslesen...
169 
170  String lvsMaxLength = this.Me().getAttribute( "maxlength" );
171 
172  if ( !okw.OKW_Helper.isStringNullOrEmpty( lvsMaxLength) )
173  {
174  lviReturn = Integer.parseInt( lvsMaxLength );
175  }
176  }
177  finally
178  {
179  this.LogFunctionEndDebug( lviReturn.toString() );
180  }
181 
182  return lviReturn;
183  }
184 
185 
203  public ArrayList<String> getPlaceholder()
204  {
205  ArrayList<String> lvLsReturn = new ArrayList<String>();
206 
207  try
208  {
209  this.LogFunctionStartDebug( "getPlaceholder" );
210 
211  // Warten auf das Objekt. Wenn es nicht existiert wird mit OKWGUIObjectNotFoundException beendet...
212  this.WaitForMe();
213 
214  // The Attribute "placeholder" wird als Beschriftung angezeigt...
215  String myAttribute = this.Me().getAttribute( "placeholder" );
216  myAttribute = StringUtils.normalizeSpace( myAttribute );
217 
218  lvLsReturn.add( myAttribute );
219  }
220  finally
221  {
222  this.LogFunctionEndDebug( lvLsReturn );
223  }
224 
225  return lvLsReturn;
226  }
227 
228 
240  @Override
241  public ArrayList<String> getValue()
242  {
243  ArrayList<String> lvLsReturn = new ArrayList<String>();
244 
245  try
246  {
247  this.LogFunctionStartDebug( "GetValue" );
248 
249  // Warten auf das Objekt. Wenn es nicht existiert wird mit OKWGUIObjectNotFoundException beendet...
250  this.WaitForMe();
251 
252  // Get Value from TextField and put this into the return List<string>
253  String myValue = this.Me().getAttribute( "value" );
254 
255  if ( myValue != null )
256  {
257  lvLsReturn.add( this.Me().getAttribute( "value" ) );
258  }
259 
260  }
261  finally
262  {
263  this.LogFunctionEndDebug( lvLsReturn.toString() );
264  }
265 
266  return lvLsReturn;
267  }
268 
269 
273  @Override
274  public void SetValue( ArrayList<String> Val )
275  {
276 
277  try
278  {
279  this.LogFunctionStartDebug( "SetValue", "Val", Val.toString() );
280 
281  // Wenn GUI-Objekt nicht gefunden wird, mit OKWGUIObjectNotFoundException aussteigen
282  this.WaitForMe();
283 
284  WebElement myMe = this.Me();
285  myMe.clear();
286 
287  if ( Val.get( 0 ).equals( okw.OKW_Const_Sngltn.getInstance().GetOKWConst4Internalname( "DELETE" ) ) )
288  {
289  myMe.clear();
290  }
291  else
292  {
293  myMe.sendKeys( Val.get( 0 ) );
294  }
295  }
296  finally
297  {
298  this.LogFunctionEndDebug();
299  }
300  }
301 
302 }
okw.gui.OKWLocatorBase
Definition: OKWLocatorBase.java:3
okw.gui.adapter.selenium.SeAnyChildWindow.WaitForMe
Boolean WaitForMe()
Wartet auf das Objekt Wenn kein Fenster gefunden wird,.
Definition: SeAnyChildWindow.java:1582
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.SeInputText.getValue
ArrayList< String > getValue()
Ermittelt den Wert des Textfeldes, welches dem sichtbaren .
Definition: SeInputText.java:241
okw.gui.adapter.selenium.SeInputText.SeInputText
SeInputText(String Locator, OKWLocatorBase... Locators)
Definition: SeInputText.java:120
okw.gui.adapter.selenium.SeInputText.getCaption
ArrayList< String > getCaption()
Ermittelt den textuellen Inhalt der Überschrift eines Textfeldes.
Definition: SeInputText.java:139
okw.gui.adapter.selenium.SeInputText.SetValue
void SetValue(ArrayList< String > Val)
Definition: SeInputText.java:274
okw.gui.adapter.selenium.SeInputText
Definition: SeInputText.java:114
okw.gui.adapter.selenium.SeInputText.getPlaceholder
ArrayList< String > getPlaceholder()
Liest den Placeholder des input-Tags aus.
Definition: SeInputText.java:203
okw.gui.adapter.selenium.SeInputText.getMaxLength
Integer getMaxLength()
Ermittelt den textuellen Inhalt des Labels.
Definition: SeInputText.java:156
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