Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » Text widget on Linux with russian characters
Text widget on Linux with russian characters [message #66982] Wed, 19 December 2007 06:09 Go to next message
Eclipse UserFriend
Originally posted by: sergeyaldonin.gmail.com

Hello,

We use RAP (build rap-1.0.1-R-target-3.3-20071207-1851) and we have a
problem.
We use "Text" widget:

Composite composite = new Composite(parent, SWT.NONE);
composite.setLayout(new GridLayout());

Text text = new Text(composite, SWT.BORDER);

text.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent event) {
System.out.println(">>" + ((Text) event.widget).getText());
}
});


If RAP client started on Linux (we tried Firefox, Opera browsers) and
input any russian characters into Text widget - listener not notify.

If input english characters - all right.
If client RAP started on Windows and input russian or english characters
- all right.

Help solve this problem, please.
Thanks
Re: Text widget on Linux with russian characters [message #67004 is a reply to message #66982] Wed, 19 December 2007 07:50 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: benjamin.wolff.web.de

hm, sounds like a localization problem. don't know much about linux but is
the language installed and configurated in the browser under linux?
Re: Text widget on Linux with russian characters [message #67194 is a reply to message #66982] Fri, 21 December 2007 11:48 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: rherrmann.innoopract.com

Sergey,

just a wild guess: do you copy & paste the Russian characters? I am
aware that some people reported that when *pasting* text it may happen
that it is not sent to the server. But we couldn't reproduce the problem
until now.
Can you tell whether a request is sent at all? And if so, what it contains?

Cheers,
Rüdiger

Sergey A. wrote:
> Hello,
>
> We use RAP (build rap-1.0.1-R-target-3.3-20071207-1851) and we have a
> problem.
> We use "Text" widget:
>
> Composite composite = new Composite(parent, SWT.NONE);
> composite.setLayout(new GridLayout());
>
> Text text = new Text(composite, SWT.BORDER);
>
> text.addModifyListener(new ModifyListener() {
> public void modifyText(ModifyEvent event) {
> System.out.println(">>" + ((Text) event.widget).getText());
> }
> });
>
>
> If RAP client started on Linux (we tried Firefox, Opera browsers) and
> input any russian characters into Text widget - listener not notify.
>
> If input english characters - all right.
> If client RAP started on Windows and input russian or english characters
> - all right.
>
> Help solve this problem, please.
> Thanks
Re: Text widget on Linux with russian characters [message #67254 is a reply to message #67194] Mon, 24 December 2007 09:25 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: sergeyaldonin.gmail.com

Hi Rüdiger,

Thanks for your attention for our problem.

We don't do copy & paste russian characters (but we try copy & paste -
request is not sent to the server).
We just input russian characters to the Text widget.
Well, we inspect requests at the Firebug plugin for Firefox. Request is
not sent to the server.

If we input string that contains any not russian characters (english
characters, numbers, "space" and other special symbols) - request sent
to the server. And on server then we have full string (with russian and
not russian characters).

Well, we have problem when use russian characters only.

Maybe we have some problems with RAP javascript code? Or some specific
preferences for linux browsers.

Best regards

Rüdiger Herrmann wrote:
> Sergey,
>
> just a wild guess: do you copy & paste the Russian characters? I am
> aware that some people reported that when *pasting* text it may happen
> that it is not sent to the server. But we couldn't reproduce the
> problem until now.
> Can you tell whether a request is sent at all? And if so, what it
> contains?
>
> Cheers,
> Rüdiger
Re: Text widget on Linux with russian characters [message #67264 is a reply to message #67254] Mon, 24 December 2007 10:17 Go to previous messageGo to next message
Benjamin Muskalla is currently offline Benjamin MuskallaFriend
Messages: 237
Registered: July 2009
Senior Member
Hi,

just to be sure: did you ever tried it on a windows client? Are there
the same problems? Just wondering if it's the RAP js implementation or
maybe really a os-related thing.

Greets
Benny

Sergey A. wrote:
> Hi Rüdiger,
>
> Thanks for your attention for our problem.
>
> We don't do copy & paste russian characters (but we try copy & paste -
> request is not sent to the server).
> We just input russian characters to the Text widget.
> Well, we inspect requests at the Firebug plugin for Firefox. Request is
> not sent to the server.
>
> If we input string that contains any not russian characters (english
> characters, numbers, "space" and other special symbols) - request sent
> to the server. And on server then we have full string (with russian and
> not russian characters).
>
> Well, we have problem when use russian characters only.
>
> Maybe we have some problems with RAP javascript code? Or some specific
> preferences for linux browsers.
>
> Best regards
>
> Rüdiger Herrmann wrote:
>> Sergey,
>>
>> just a wild guess: do you copy & paste the Russian characters? I am
>> aware that some people reported that when *pasting* text it may happen
>> that it is not sent to the server. But we couldn't reproduce the
>> problem until now.
>> Can you tell whether a request is sent at all? And if so, what it
>> contains?
>>
>> Cheers,
>> Rüdiger
Re: Text widget on Linux with russian characters [message #67274 is a reply to message #67264] Mon, 24 December 2007 13:04 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: sergeyaldonin.gmail.com

Hi,

Yes, we tried it on a windows client. There are no problem.

Best regards

Benjamin Muskalla wrote:
> Hi,
>
> just to be sure: did you ever tried it on a windows client? Are there
> the same problems? Just wondering if it's the RAP js implementation or
> maybe really a os-related thing.
>
> Greets
> Benny
Re: Text widget on Linux with russian characters [message #68096 is a reply to message #67274] Wed, 02 January 2008 17:54 Go to previous message
Eclipse UserFriend
Originally posted by: rherrmann.innoopract.com

This is a multi-part message in MIME format.
--------------070003010901000303000001
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit

Sergey,

to me this sounds like a client-side problem. It would help to know
whether the JavaScript keystroke-listener that RAP uses in order to send
the modify-event is ever triggered.
As I neither have a Linux at hand nor a Russian keyboard I attached a
version of TextUtil.js with debug messages. If you replace the original
one (located in the ...rwt plug-in, in js/org/eclipse/swt/TextUtil.js)
with this one, you should see at least see "modifyTextAction" in the
debug window/Firebug console.
Please note that you need to have debug messages enabled by launching
the application with "-Dorg.eclipse.rwt.clientLogLevel=ALL".

Cheers,
Rüdiger

Sergey A. wrote:
> Hi,
>
> Yes, we tried it on a windows client. There are no problem.
>
> Best regards
>
> Benjamin Muskalla wrote:
>> Hi,
>>
>> just to be sure: did you ever tried it on a windows client? Are there
>> the same problems? Just wondering if it's the RAP js implementation or
>> maybe really a os-related thing.
>>
>> Greets
>> Benny


--------------070003010901000303000001
Content-Type: application/x-javascript;
name="TextUtil.js"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="TextUtil.js"

/*********************************************************** ********************
* Copyright (c) 2007 Innoopract Informationssysteme GmbH.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Innoopract Informationssysteme GmbH - initial API and implementation
************************************************************ ******************/

qx.Class.define( "org.eclipse.swt.TextUtil", {

statics : {

// TODO [rh] workaround for https://bugs.eclipse.org/bugs/show_bug.cgi?id=201080
// the fix is to exchange the _onblur implementation of qx.ui.forms.Text
// with our own one, that checks parent != null before calling
// setSelectionLength
hijack : function( text ) {
text.removeEventListener( "blur", text._onblur );
text._onblur = function() {
var vValue = this.getComputedValue().toString();
if( this._textOnFocus != vValue ) {
this.setValue( vValue );
}
if( this.getParent() != null ) {
this.setSelectionLength( 0 );
}
};
text.addEventListener( "blur", text._onblur );
},

//////////////////////////////////////////////////////////// ///
// Functions for ModifyEvents and maintenance of the text/value

modifyText : function( evt ) {
var text = evt.getTarget();
if( !org_eclipse_rap_rwt_EventUtil_suspend
&& org.eclipse.swt.TextUtil._isModifyingKey( evt.getKeyIdentifier() ) )
{
// if not yet done, register an event listener that adds a request param
// with the text widgets' content just before the request is sent
if( !org.eclipse.swt.TextUtil._isModified( text ) ) {
var req = org.eclipse.swt.Request.getInstance();
req.addEventListener( "send", org.eclipse.swt.TextUtil._onSend, text );
org.eclipse.swt.TextUtil._setModified( text, true );
}
}
org.eclipse.swt.TextUtil.updateSelection( text, null );
},

/**
* This function gets assigned to the 'keyup' event of a text widget if
* there was a server-side ModifyListener registered.
*/
modifyTextAction : function( evt ) {
var text = evt.getTarget();
text.debug( "modifyTextAction" );
if( !org_eclipse_rap_rwt_EventUtil_suspend
&& !org.eclipse.swt.TextUtil._isModified( text )
&& org.eclipse.swt.TextUtil._isModifyingKey( evt.getKeyIdentifier() ) )
{
text.debug( "modifyTextAction: first modifying key" );
var req = org.eclipse.swt.Request.getInstance();
// Register 'send'-listener that adds a request param with current text
if( !org.eclipse.swt.TextUtil._isModified( text ) ) {
req.addEventListener( "send", org.eclipse.swt.TextUtil._onSend, text );
org.eclipse.swt.TextUtil._setModified( text, true );
text.debug( "modifyTextAction: register send-listener" );
}
// add modifyText-event with sender-id to request parameters
var widgetManager = org.eclipse.swt.WidgetManager.getInstance();
var id = widgetManager.findIdByWidget(text);
req.addEvent( "org.eclipse.swt.events.modifyText", id );
// register listener that is notified when a request is sent
qx.client.Timer.once( org.eclipse.swt.TextUtil._delayedModifyText,
text,
500 );
}
org.eclipse.swt.TextUtil.updateSelection( text, null );
},

/**
* This function gets assigned to the 'blur' event of a text widget if there
* was a server-side ModifyListener registered.
*/
modifyTextOnBlur : function( evt ) {
if( !org_eclipse_rap_rwt_EventUtil_suspend
&& org.eclipse.swt.TextUtil._isModified( evt.getTarget() ) )
{
var widgetManager = org.eclipse.swt.WidgetManager.getInstance();
var id = widgetManager.findIdByWidget( evt.getTarget() );
var req = org.eclipse.swt.Request.getInstance();
req.addEvent( "org.eclipse.swt.events.modifyText", id );
req.send();
}
},

_onSend : function( evt ) {
// NOTE: 'this' references the text widget
var widgetManager = org.eclipse.swt.WidgetManager.getInstance();
var id = widgetManager.findIdByWidget( this );
var req = org.eclipse.swt.Request.getInstance();
req.addParameter( id + ".text", this.getComputedValue() );
// remove the _onSend listener and change the text widget state to 'unmodified'
req.removeEventListener( "send", org.eclipse.swt.TextUtil._onSend, this );
org.eclipse.swt.TextUtil._setModified( this, false );
// Update the value property (which is qooxdoo-wise only updated on
// focus-lost) to be in sync with server-side
if( this.getFocused() ) {
this.setValue( this.getComputedValue() );
}
},

_delayedModifyText : function( evt ) {
// NOTE: this references the text widget (see qx.client.Timer.once above)
if( org.eclipse.swt.TextUtil._isModified( this ) ) {
var req = org.eclipse.swt.Request.getInstance();
req.send();
}
},

_isModified : function( widget ) {
return widget.getUserData("modified") == true;
},

_setModified : function( widget, modified ) {
return widget.setUserData("modified", modified);
},

/**
* Determines whether the given keyIdentifier potentially modifies the
* content of a text widget.
*/
_isModifyingKey : function( keyIdentifier ) {
var result = false;
switch( keyIdentifier ) {
// Modifier keys
case "Shift":
case "Control":
case "Alt":
case "Meta":
case "Win":
// Navigation keys
case "Up":
case "Down":
case "Left":
case "Right":
case "Home":
case "End":
case "PageUp":
case "PageDown":
case "Tab":
// Context menu key
case "Apps":
//
case "Escape":
case "Insert":
case "Enter":
//
case "CapsLock":
case "NumLock":
case "Scroll":
case "PrintScreen":
// Function keys 1 - 12
case "F1":
case "F2":
case "F3":
case "F4":
case "F5":
case "F6":
case "F7":
case "F8":
case "F9":
case "F10":
case "F11":
case "F12":
break;
default:
result = true;
}
return result;
},

//////////////////////////////////////////////////////////// ///////
// Functions to maintain the selection-start and -length properties

onMouseUp : function( evt ) {
if( !org_eclipse_rap_rwt_EventUtil_suspend ) {
var text = evt.getTarget();
org.eclipse.swt.TextUtil.updateSelection( text, null );
}
},

updateSelection : function( text, enclosingWidget ) {
// TODO [rh] executing the code below for a TextArea leads to Illegal
// Argument
if( text.classname != "qx.ui.form.TextArea" ) {
var widget = enclosingWidget != null ? enclosingWidget : text;
var start = text.getSelectionStart();
var length = text.getSelectionLength();
if( text.getUserData( "selectionStart" ) != start ) {
text.setUserData( "selectionStart", start );
org.eclipse.swt.TextUtil._setPropertyParam( widget,
"selectionStart",
start );
}
if( text.getUserData( "selectionLength" ) != length ) {
text.setUserData( "selectionLength", length );
org.eclipse.swt.TextUtil._setPropertyParam( widget,
"selectionCount",
length );
}
}
},

// TODO [rst] not text specific, move this function to Request
_setPropertyParam : function( widget, name, value ) {
var widgetManager = org.eclipse.swt.WidgetManager.getInstance();
var id = widgetManager.findIdByWidget( widget );
var req = org.eclipse.swt.Request.getInstance();
req.addParameter( id + "." + name, value );
},

setSelection : function( text, start, length ) {
if( text.isCreated() && !text.getUserData( "pooled" ) ) {
org.eclipse.swt.TextUtil._doSetSelection( text, start, length );
}
else {
text.setUserData( "onAppear.selectionStart", start );
text.setUserData( "onAppear.selectionLength", length );
text.addEventListener( "appear",
org.eclipse.swt.TextUtil._onAppearSetSelection );
}
},

_onAppearSetSelection : function( evt ) {
var text = evt.getTarget();
var start = text.getUserData( "onAppear.selectionStart" );
var length = text.getUserData( "onAppear.selectionLength" );
org.eclipse.swt.TextUtil._doSetSelection( text, start, length );
text.removeEventListener( "appear",
org.eclipse.swt.TextUtil._onAppearSetSelection );
},

_doSetSelection : function( text, start, length ) {
text.setUserData( "selectionStart", start );
text.setSelectionStart( start );
text.setUserData( "selectionLength", length );
text.setSelectionLength( length );
},

// TODO [rst] Workaround for pooling problems with wrap property in IE.
// These methods can probably be dropped once qx bug 300 is fixed.
setWrap : function( text, wrap ) {
if( text.isCreated() && !text.getUserData( "pooled" ) ) {
text.setWrap( wrap );
} else {
text.setUserData( "onAppear.wrap", wrap );
text.addEventListener( "appear",
org.eclipse.swt.TextUtil._onAppearSetWrap );
}
},

_onAppearSetWrap : function( evt ) {
var text = evt.getTarget();
var wrap = text.getUserData( "onAppear.wrap" );
text.setUserData( "onAppear.wrap", undefined );
text.setWrap( wrap );
text.removeEventListener( "appear",
org.eclipse.swt.TextUtil._onAppearSetWrap );
},

////////////////////////////
// SelectionListener support

/**
* This function is registered server-side if a SelectionListener should
* be notified about the widgetDefaultSelection event that occurs when
* Enter was pressed.
*/
widgetDefaultSelected : function( evt ) {
if( !org_eclipse_rap_rwt_EventUtil_suspend ) {
if( evt.getKeyIdentifier() == "Enter"
&& !evt.isShiftPressed()
&& !evt.isAltPressed()
&& !evt.isCtrlPressed()
&& !evt.isMetaPressed() )
{
evt.setPropagationStopped( true );
var widgetManager = org.eclipse.swt.WidgetManager.getInstance();
var id = widgetManager.findIdByWidget( evt.getTarget() );
var req = org.eclipse.swt.Request.getInstance();
req.addEvent( "org.eclipse.swt.events.widgetDefaultSelected", id );
req.send();
}
}
}

}
});

--------------070003010901000303000001--
Previous Topic:Resource management
Next Topic:Is RAP Production Ready?
Goto Forum:
  


Current Time: Sat Sep 21 02:49:55 GMT 2024

Powered by FUDForum. Page generated in 0.03926 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top