Lines 2066-2094
Link Here
|
2066 |
* </ul> |
2066 |
* </ul> |
2067 |
*/ |
2067 |
*/ |
2068 |
public void setText (String string) { |
2068 |
public void setText (String string) { |
2069 |
checkWidget (); |
2069 |
java.text.SimpleDateFormat simpleDateFormat = new java.text.SimpleDateFormat("HH:mm:ss:SSS"); |
2070 |
if (string == null) error (SWT.ERROR_NULL_ARGUMENT); |
2070 |
System.out.println(simpleDateFormat.format(new java.util.Date()) +" setText() called on (" +hashCode() +"). OldValue: " +new String(getEditText()) +", NewValue: " +string); |
2071 |
if (hooks (SWT.Verify) || filters (SWT.Verify)) { |
2071 |
checkWidget (); |
2072 |
string = verifyText (string, 0, getCharCount (), null); |
2072 |
if (string == null) error (SWT.ERROR_NULL_ARGUMENT); |
2073 |
if (string == null) return; |
2073 |
if (hooks (SWT.Verify) || filters (SWT.Verify)) { |
2074 |
} |
2074 |
string = verifyText (string, 0, getCharCount (), null); |
2075 |
if ((style & SWT.SINGLE) != 0) { |
2075 |
if (string == null) return; |
2076 |
setEditText (string); |
2076 |
} |
2077 |
NSText fieldEditor = ((NSControl)view).currentEditor(); |
2077 |
if ((style & SWT.SINGLE) != 0) { |
2078 |
if (fieldEditor != null) { |
2078 |
setEditText (string); |
2079 |
NSRange range = new NSRange(); |
2079 |
NSText fieldEditor = ((NSControl)view).currentEditor(); |
2080 |
fieldEditor.setSelectedRange (range); |
2080 |
if (fieldEditor != null) { |
2081 |
fieldEditor.scrollRangeToVisible (range); |
2081 |
NSRange range = new NSRange(); |
2082 |
} |
2082 |
fieldEditor.setSelectedRange (range); |
2083 |
} else { |
2083 |
fieldEditor.scrollRangeToVisible (range); |
2084 |
NSTextView widget = (NSTextView)view; |
2084 |
} |
2085 |
char[] buffer = new char [Math.min(string.length (), textLimit)]; |
2085 |
} else { |
2086 |
string.getChars (0, buffer.length, buffer, 0); |
2086 |
NSTextView widget = (NSTextView)view; |
2087 |
NSString str = NSString.stringWithCharacters(buffer, buffer.length); |
2087 |
char[] buffer = new char [Math.min(string.length (), textLimit)]; |
2088 |
widget.setString (str); |
2088 |
string.getChars (0, buffer.length, buffer, 0); |
2089 |
widget.setSelectedRange(new NSRange()); |
2089 |
NSString str = NSString.stringWithCharacters(buffer, buffer.length); |
2090 |
} |
2090 |
widget.setString (str); |
2091 |
sendEvent (SWT.Modify); |
2091 |
widget.setSelectedRange(new NSRange()); |
|
|
2092 |
} |
2093 |
sendEvent (SWT.Modify); |
2092 |
} |
2094 |
} |
2093 |
|
2095 |
|
2094 |
/** |
2096 |
/** |
Lines 2111-2140
Link Here
|
2111 |
* @since 3.7 |
2113 |
* @since 3.7 |
2112 |
*/ |
2114 |
*/ |
2113 |
public void setTextChars (char[] text) { |
2115 |
public void setTextChars (char[] text) { |
2114 |
checkWidget (); |
2116 |
java.text.SimpleDateFormat simpleDateFormat = new java.text.SimpleDateFormat("HH:mm:ss:SSS"); |
2115 |
if (text == null) error (SWT.ERROR_NULL_ARGUMENT); |
2117 |
System.out.println(simpleDateFormat.format(new java.util.Date()) +" setTextChars() called on (" +hashCode() +"). OldValue: " +new String(getEditText()) +", NewValue: " +new String(text)); |
2116 |
if (hooks (SWT.Verify) || filters (SWT.Verify)) { |
2118 |
checkWidget (); |
2117 |
String string = verifyText (new String (text), 0, getCharCount (), null); |
2119 |
if (text == null) error (SWT.ERROR_NULL_ARGUMENT); |
2118 |
if (string == null) return; |
2120 |
if (hooks (SWT.Verify) || filters (SWT.Verify)) { |
2119 |
text = new char [string.length()]; |
2121 |
String string = verifyText (new String (text), 0, getCharCount (), null); |
2120 |
string.getChars (0, text.length, text, 0); |
2122 |
if (string == null) return; |
2121 |
} |
2123 |
text = new char [string.length()]; |
2122 |
if ((style & SWT.SINGLE) != 0) { |
2124 |
string.getChars (0, text.length, text, 0); |
2123 |
setEditText (text); |
2125 |
} |
2124 |
NSText fieldEditor = ((NSControl)view).currentEditor(); |
2126 |
if ((style & SWT.SINGLE) != 0) { |
2125 |
if (fieldEditor != null) { |
2127 |
setEditText (text); |
2126 |
NSRange range = new NSRange(); |
2128 |
NSText fieldEditor = ((NSControl)view).currentEditor(); |
2127 |
fieldEditor.setSelectedRange (range); |
2129 |
if (fieldEditor != null) { |
2128 |
fieldEditor.scrollRangeToVisible (range); |
2130 |
NSRange range = new NSRange(); |
2129 |
} |
2131 |
fieldEditor.setSelectedRange (range); |
2130 |
} else { |
2132 |
fieldEditor.scrollRangeToVisible (range); |
2131 |
NSTextView widget = (NSTextView)view; |
2133 |
} |
2132 |
int length = Math.min(text.length, textLimit); |
2134 |
} else { |
2133 |
NSString str = NSString.stringWithCharacters(text, length); |
2135 |
NSTextView widget = (NSTextView)view; |
2134 |
widget.setString (str); |
2136 |
int length = Math.min(text.length, textLimit); |
2135 |
widget.setSelectedRange(new NSRange()); |
2137 |
NSString str = NSString.stringWithCharacters(text, length); |
2136 |
} |
2138 |
widget.setString (str); |
2137 |
sendEvent (SWT.Modify); |
2139 |
widget.setSelectedRange(new NSRange()); |
|
|
2140 |
} |
2141 |
sendEvent (SWT.Modify); |
2138 |
} |
2142 |
} |
2139 |
|
2143 |
|
2140 |
/** |
2144 |
/** |