You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pivot.apache.org by gb...@apache.org on 2009/12/02 23:18:19 UTC
svn commit: r886325 - in /incubator/pivot/trunk:
web/src/org/apache/pivot/web/ wtk-terra/src/org/apache/pivot/wtk/skin/terra/
wtk/src/org/apache/pivot/wtk/ wtk/src/org/apache/pivot/wtk/skin/
Author: gbrown
Date: Wed Dec 2 22:18:15 2009
New Revision: 886325
URL: http://svn.apache.org/viewvc?rev=886325&view=rev
Log:
Various minor fixes and updates.
Modified:
incubator/pivot/trunk/web/src/org/apache/pivot/web/BasicAuthentication.java
incubator/pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTextInputSkin.java
incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Component.java
incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Container.java
incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextAreaSkin.java
Modified: incubator/pivot/trunk/web/src/org/apache/pivot/web/BasicAuthentication.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/web/src/org/apache/pivot/web/BasicAuthentication.java?rev=886325&r1=886324&r2=886325&view=diff
==============================================================================
--- incubator/pivot/trunk/web/src/org/apache/pivot/web/BasicAuthentication.java (original)
+++ incubator/pivot/trunk/web/src/org/apache/pivot/web/BasicAuthentication.java Wed Dec 2 22:18:15 2009
@@ -28,26 +28,26 @@
private String password;
public BasicAuthentication(String username, String password) {
- setUsername(username);
- setPassword(password);
+ if (username == null) {
+ throw new IllegalArgumentException();
+ }
+
+ if (password == null) {
+ throw new IllegalArgumentException();
+ }
+
+ this.username = username;
+ this.password = password;
}
public String getUsername() {
return username;
}
- public void setUsername(String username) {
- this.username = (username == null) ? "" : username;
- }
-
public String getPassword() {
return password;
}
- public void setPassword(String password) {
- this.password = (password == null) ? "" : password;
- }
-
@Override
public void authenticate(Query<?> query) {
String credentials = username + ":" + password;
Modified: incubator/pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTextInputSkin.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTextInputSkin.java?rev=886325&r1=886324&r2=886325&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTextInputSkin.java (original)
+++ incubator/pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTextInputSkin.java Wed Dec 2 22:18:15 2009
@@ -1140,26 +1140,28 @@
// Add all preceding text to the selection
selectionLength = selectionStart + selectionLength;
selectionStart = 0;
+ consumed = true;
} else if (Keyboard.isPressed(Keyboard.Modifier.SHIFT)) {
// Add the previous character to the selection
if (selectionStart > 0) {
selectionStart--;
selectionLength++;
}
+
+ consumed = true;
} else if (Keyboard.isPressed(Keyboard.Modifier.CTRL)) {
// Clear the selection and move the caret to the beginning of
// the text
selectionStart = 0;
selectionLength = 0;
+ consumed = true;
} else {
// Clear the selection and move the caret back by one
// character
- if (selectionLength == 0) {
- if (selectionStart > 0) {
- selectionStart--;
- } else {
- consumed = false;
- }
+ if (selectionLength == 0
+ && selectionStart > 0) {
+ selectionStart--;
+ consumed = true;
}
selectionLength = 0;
@@ -1172,8 +1174,6 @@
} else {
setScrollLeft(0);
}
-
- consumed = true;
} else if (keyCode == Keyboard.KeyCode.RIGHT) {
int selectionStart = textInput.getSelectionStart();
int selectionLength = textInput.getSelectionLength();
@@ -1182,27 +1182,29 @@
&& Keyboard.isPressed(Keyboard.Modifier.CTRL)) {
// Add all subsequent text to the selection
selectionLength = textNode.getCharacterCount() - selectionStart;
+ consumed = true;
} else if (Keyboard.isPressed(Keyboard.Modifier.SHIFT)) {
// Add the next character to the selection
if (selectionStart + selectionLength < textNode.getCharacterCount()) {
selectionLength++;
}
+
+ consumed = true;
} else if (Keyboard.isPressed(Keyboard.Modifier.CTRL)) {
// Clear the selection and move the caret to the end of
// the text
selectionStart = textNode.getCharacterCount();
selectionLength = 0;
+ consumed = true;
} else {
// Clear the selection and move the caret forward by one
// character
selectionStart += selectionLength;
- if (selectionLength == 0) {
- if (selectionStart < textNode.getCharacterCount()) {
- selectionStart++;
- } else {
- consumed = false;
- }
+ if (selectionLength == 0
+ && selectionStart < textNode.getCharacterCount()) {
+ selectionStart++;
+ consumed = true;
}
selectionLength = 0;
@@ -1216,8 +1218,6 @@
scrollLeft = 0;
updateSelection();
}
-
- consumed = true;
} else if (keyCode == Keyboard.KeyCode.HOME) {
// Move the caret to the beginning of the text
if (Keyboard.isPressed(Keyboard.Modifier.SHIFT)) {
Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Component.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Component.java?rev=886325&r1=886324&r2=886325&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Component.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Component.java Wed Dec 2 22:18:15 2009
@@ -1897,12 +1897,19 @@
public void validate() {
if (!valid
&& visible) {
- skin.layout();
+ layout();
valid = true;
}
}
/**
+ * Called to lay out the component.
+ */
+ protected void layout() {
+ skin.layout();
+ }
+
+ /**
* Flags the entire component as needing to be repainted.
*/
public final void repaint() {
Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Container.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Container.java?rev=886325&r1=886324&r2=886325&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Container.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Container.java Wed Dec 2 22:18:15 2009
@@ -331,15 +331,12 @@
}
@Override
- public void validate() {
- if (!isValid()
- && isVisible()) {
- super.validate();
-
- for (int i = 0, n = components.getLength(); i < n; i++) {
- Component component = components.get(i);
- component.validate();
- }
+ protected void layout() {
+ super.layout();
+
+ for (int i = 0, n = components.getLength(); i < n; i++) {
+ Component component = components.get(i);
+ component.validate();
}
}
Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextAreaSkin.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextAreaSkin.java?rev=886325&r1=886324&r2=886325&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextAreaSkin.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextAreaSkin.java Wed Dec 2 22:18:15 2009
@@ -205,8 +205,6 @@
}
public void setBreakWidth(int breakWidth) {
- assert (breakWidth > 0);
-
int previousBreakWidth = this.breakWidth;
if (previousBreakWidth != breakWidth) {