1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package io.github.tonywasher.joceanus.tethys.swing.control;
18
19 import javax.swing.JTextArea;
20
21 import io.github.tonywasher.joceanus.tethys.core.factory.TethysUICoreFactory;
22 import io.github.tonywasher.joceanus.tethys.core.control.TethysUICoreTextArea;
23 import io.github.tonywasher.joceanus.tethys.swing.base.TethysUISwingNode;
24
25
26
27
28 public class TethysUISwingTextArea
29 extends TethysUICoreTextArea {
30
31
32
33 private final TethysUISwingNode theNode;
34
35
36
37
38 private final JTextArea theArea;
39
40
41
42
43
44
45 TethysUISwingTextArea(final TethysUICoreFactory<?> pFactory) {
46
47 super(pFactory);
48 theArea = new JTextArea();
49 theArea.setEditable(false);
50 theNode = new TethysUISwingNode(theArea);
51 }
52
53 @Override
54 public TethysUISwingNode getNode() {
55 return theNode;
56 }
57
58 @Override
59 public void setEnabled(final boolean pEnabled) {
60 theArea.setEnabled(pEnabled);
61 }
62
63 @Override
64 public void setVisible(final boolean pVisible) {
65 theArea.setVisible(pVisible);
66 }
67
68 @Override
69 public void setPreferredWidth(final Integer pWidth) {
70 theNode.setPreferredWidth(pWidth);
71 }
72
73 @Override
74 public void setPreferredHeight(final Integer pHeight) {
75 theNode.setPreferredHeight(pHeight);
76 }
77
78 @Override
79 public void setBorderPadding(final Integer pPadding) {
80 super.setBorderPadding(pPadding);
81 theNode.createWrapperPane(getBorderTitle(), getBorderPadding());
82 }
83
84 @Override
85 public void setBorderTitle(final String pTitle) {
86 super.setBorderTitle(pTitle);
87 theNode.createWrapperPane(getBorderTitle(), getBorderPadding());
88 }
89
90 @Override
91 public void setText(final String pText) {
92 theArea.setText(pText);
93 }
94
95 @Override
96 public void appendText(final String pText) {
97 theArea.append(pText);
98 }
99
100 @Override
101 public void insertText(final String pText,
102 final int pPos) {
103 theArea.insert(pText, pPos);
104 }
105
106 @Override
107 public void replaceText(final String pText,
108 final int pStart,
109 final int pEnd) {
110 theArea.replaceRange(pText, pStart, pEnd);
111 }
112
113 @Override
114 public void setCaretPosition(final int pPos) {
115 theArea.setCaretPosition(pPos);
116 }
117
118 @Override
119 public int getCaretPosition() {
120 return theArea.getCaretPosition();
121 }
122
123 @Override
124 public int getTextLength() {
125 return theArea.getText().length();
126 }
127 }