-
Notifications
You must be signed in to change notification settings - Fork 47
/
TextArea.java
65 lines (58 loc) · 2.07 KB
/
TextArea.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
package com.epam.jdi.light.ui.html.elements.common;
import com.epam.jdi.light.common.JDIAction;
import com.epam.jdi.light.elements.base.UIBaseElement;
import com.epam.jdi.light.elements.interfaces.base.HasLabel;
import com.epam.jdi.light.elements.interfaces.base.HasPlaceholder;
import com.epam.jdi.light.elements.interfaces.base.SetValue;
import com.epam.jdi.light.elements.interfaces.common.IsInput;
import com.epam.jdi.light.ui.html.asserts.TextAreaAssert;
import java.util.List;
import static com.epam.jdi.light.logger.LogLevels.DEBUG;
import static com.epam.jdi.light.ui.html.HtmlUtils.getInt;
import static com.epam.jdi.tools.PrintUtils.print;
import static java.util.Arrays.asList;
public class TextArea extends UIBaseElement<TextAreaAssert>
implements HasLabel, SetValue, HasPlaceholder, IsInput {
// region Actions
@JDIAction("Set lines '{0}' in '{name}'")
public void setLines(String... lines) {
setText(print(asList(lines), "\\n"));
}
@JDIAction("Get '{name}' lines")
public List<String> getLines() {
return asList(getText().split("\\n"));
}
@JDIAction(level = DEBUG)
public int rows() { return getInt("rows", uiElement); }
@JDIAction(level = DEBUG)
public int cols() { return getInt("cols", uiElement); }
@JDIAction(level = DEBUG)
public int minlength() { return getInt("minlength", uiElement); }
@JDIAction(level = DEBUG)
public int maxlength() { return getInt("maxlength", uiElement); }
@JDIAction("Add ne line '{0}' in '{name}'")
public void addNewLine(String line) {
String newLine = line;
if (isNotEmpty()) {
newLine = "\n" + newLine;
}
sendKeys(newLine);
}
// endregion
// region Set and get value for Forms
public void setValue(String value) {
input(value);
}
public String getValue() {
return getText();
}
@Override
public String getText() {
return core().attr("value");
}
// endregion
@Override
public TextAreaAssert is() {
return new TextAreaAssert().set(this);
}
}