You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pivot.apache.org by rw...@apache.org on 2013/02/13 02:17:03 UTC
svn commit: r1445449 -
/pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/skin/TextAreaSkin.java
Author: rwhitcomb
Date: Wed Feb 13 01:17:02 2013
New Revision: 1445449
URL: http://svn.apache.org/r1445449
Log:
PIVOT-696 (part): More work with TAB characters in TextArea.
Add a style "acceptsTab" that changes the behavior of TAB and Ctrl-TAB
(actually reversing them). The default (false) means Ctrl-TAB inserts
spaces, while TAB shifts focus to next component. Setting the style
true means TAB does the insert while Ctrl-TAB shifts focus. The latter
is more in line with other applications.
Modified:
pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/skin/TextAreaSkin.java
Modified: pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/skin/TextAreaSkin.java
URL: http://svn.apache.org/viewvc/pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/skin/TextAreaSkin.java?rev=1445449&r1=1445448&r2=1445449&view=diff
==============================================================================
--- pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/skin/TextAreaSkin.java (original)
+++ pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/skin/TextAreaSkin.java Wed Feb 13 01:17:02 2013
@@ -135,6 +135,7 @@ public class TextAreaSkin extends Compon
private int tabWidth;
private int lineWidth;
private boolean acceptsEnter = true;
+ private boolean acceptsTab = false;
private Dimensions averageCharacterSize;
@@ -771,6 +772,34 @@ public class TextAreaSkin extends Compon
this.acceptsEnter = acceptsEnter;
}
+ /**
+ * Gets current value of style that determines the
+ * behavior of <tt>TAB</tt> and <tt>Ctrl-TAB</tt>
+ * characters.
+ * @return <tt>true</tt> if <tt>TAB</tt> inserts an
+ * appropriate number of spaces, while <tt>Ctrl-TAB</tt>
+ * shifts focus to next component. <tt>false</tt> (default)
+ * means <tt>TAB</tt> shifts focus and <tt>Ctrl-TAB</tt>
+ * inserts spaces.
+ */
+ public boolean getAcceptsTab() {
+ return acceptsTab;
+ }
+
+ /**
+ * Sets current value of style that determines the
+ * behavior of <tt>TAB</tt> and <tt>Ctrl-TAB</tt>
+ * characters.
+ * @param acceptsTab <tt>true</tt> if <tt>TAB</tt> inserts an
+ * appropriate number of spaces, while <tt>Ctrl-TAB</tt>
+ * shifts focus to next component. <tt>false</tt> (default)
+ * means <tt>TAB</tt> shifts focus and <tt>Ctrl-TAB</tt>
+ * inserts spaces.
+ */
+ public void setAcceptsTab(boolean acceptsTab) {
+ this.acceptsTab = acceptsTab;
+ }
+
@Override
public int getTabWidth() {
return tabWidth;
@@ -995,7 +1024,7 @@ public class TextAreaSkin extends Compon
consumed = true;
}
} else if (keyCode == Keyboard.KeyCode.TAB
- && Keyboard.isPressed(Keyboard.Modifier.CTRL)
+ && (acceptsTab != Keyboard.isPressed(Keyboard.Modifier.CTRL))
&& textArea.isEditable()) {
int selectionLength = textArea.getSelectionLength();