Class | Line # | Actions | |||||
---|---|---|---|---|---|---|---|
LongTextClassFieldEditPane | 32 | 8 | 0% | 5 | 1 |
1 | /* | |
2 | * See the NOTICE file distributed with this work for additional | |
3 | * information regarding copyright ownership. | |
4 | * | |
5 | * This is free software; you can redistribute it and/or modify it | |
6 | * under the terms of the GNU Lesser General Public License as | |
7 | * published by the Free Software Foundation; either version 2.1 of | |
8 | * the License, or (at your option) any later version. | |
9 | * | |
10 | * This software is distributed in the hope that it will be useful, | |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 | * Lesser General Public License for more details. | |
14 | * | |
15 | * You should have received a copy of the GNU Lesser General Public | |
16 | * License along with this software; if not, write to the Free | |
17 | * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | |
18 | * 02110-1301 USA, or see the FSF site: http://www.fsf.org. | |
19 | */ | |
20 | package org.xwiki.appwithinminutes.test.po; | |
21 | ||
22 | import org.apache.commons.lang3.StringUtils; | |
23 | import org.openqa.selenium.WebElement; | |
24 | import org.openqa.selenium.support.ui.Select; | |
25 | ||
26 | /** | |
27 | * Represents the pane used to edit a 'Long Text' class field. | |
28 | * | |
29 | * @version $Id: 2a8ccad00f1d31eaa6a8f2e5decc218a853f4c87 $ | |
30 | * @since 4.2M1 | |
31 | */ | |
32 | public class LongTextClassFieldEditPane extends ClassFieldEditPane | |
33 | { | |
34 | /** | |
35 | * Creates a new instance. | |
36 | * | |
37 | * @param fieldName the name of the long text field | |
38 | */ | |
39 | 1 | ![]() |
40 | { | |
41 | 1 | super(fieldName); |
42 | } | |
43 | ||
44 | /** | |
45 | * Sets the number of rows. | |
46 | * | |
47 | * @param rows the new number of rows | |
48 | */ | |
49 | 1 | ![]() |
50 | { | |
51 | 1 | WebElement rowsInput = getPropertyInput("rows"); |
52 | 1 | rowsInput.clear(); |
53 | 1 | rowsInput.sendKeys(String.valueOf(rows)); |
54 | } | |
55 | ||
56 | /** | |
57 | * Sets the editor to be used to edit the value of the long text field. | |
58 | * | |
59 | * @param editor the editor to be used to edit the value of this field | |
60 | */ | |
61 | 1 | ![]() |
62 | { | |
63 | 1 | Select editorSelect = new Select(getPropertyInput("editor")); |
64 | 1 | editorSelect.selectByVisibleText(editor); |
65 | } | |
66 | ||
67 | /** | |
68 | * @return the value of the "rows" attribute on the text area used to input the default field value | |
69 | */ | |
70 | 1 | ![]() |
71 | { | |
72 | 1 | String rows = getDefaultValueInput().getAttribute("rows"); |
73 | 1 | return StringUtils.isEmpty(rows) ? -1 : Integer.parseInt(rows); |
74 | } | |
75 | } |