Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » RichTextEditor handling of Focus and Traversal Events(Need help with correct detection of Focus events when traversing between RichText and standard widgets.)
RichTextEditor handling of Focus and Traversal Events [message #1742522] Fri, 02 September 2016 16:43 Go to next message
Gunnar Adams is currently offline Gunnar AdamsFriend
Messages: 49
Registered: May 2016
Member
Hi,

our application depends on the detection of FocusOut and FocusIn events.
Our backend server application needs to be notified about field changes which can occur both due to keyboard and mouse navigation. We use the corresponding Focus events to determine things like "Change from field A into field B".

This works fine for standard widgets like the Text widget, but after integrating a new field type which makes use of the RichTextEditor widget (which is based on CKEDITOR), I found, that the RichTextEditor does not generate any focus (or mouse) events. At least a FocusListener attached to the server-side widget is not called.
I tried to register event handlers on the client side in order to be notified when the CKEDITOR instance gets the focus:

rwt.widgets.RichTextEditor = function( properties ) {
bindAll( this, [ "layout", "onReady", "onSend", "onRender", "destroy", "focusInHandler", "focusOutHandler" ] );
this.parent = rap.getObject( properties.parent );
this.element = document.createElement( "div" );
this.parent.append( this.element );
this.parent.addListener( "Resize", this.layout );
this.parent.addListener( "Dispose", this.destroy );
rap.on( "render", this.onRender );
};

onReady : function() {
this.ready = true;
this.layout();
if( this._text ) {
this.setText( this._text );
delete this._text;
}
if( this._font ) {
this.setFont( this._font );
delete this._font;
}
if( typeof this._editable !== "undefined" ) {
this.setEditable( this._editable );
delete this._editable;
}
this.editor.on('focus', this.focusInHandler);
this.editor.on('blur', this.focusOutHandler);
},

focusInHandler : function(evt) {
rap.getRemoteObject(this).notify("FocusIn");
},

focusOutHandler : function(evt) {
rap.getRemoteObject(this).notify("FocusOut");
},
...

After implementation of the OperationHandler.handleNotify() method in RichTextEditor.java, the corresponding notifications about FocusIn (focus) and FocusOut (blur) events in CKEDITOR now arrive on the server-side.

This seems to be only part of the solution, though, because the RAP client does not know about the change of focus (or active widget) to the RichTextEditor widget: No corresponding focusOut event on the previously active component is generated (the caret is removed, though). I know that this is probably due to the usage of an iframe in the RichTextEditor component. When the next widget is activated, it looks like the previously active component still generated the FocusOut event.

What needs to be done in order to integrate the RichTextEditor into the focus management for both activation by mouse and keyboard? Generating Traversal events for Shift+TAB and TAB in CKEDITOR will probably be another issue.

Do I need to use some function in EventHandlerUtil instead of sending the focus events? I took a look at the mouse activation code in the client javascript code.
Is the active/focus field determined on the Javascript or Java side of RAP?

We are using the current RAP 3.1 release.

Best regards,
Gunnar





Re: RichTextEditor handling of Focus and Traversal Events [message #1742633 is a reply to message #1742522] Tue, 06 September 2016 08:49 Go to previous message
Ivan Furnadjiev is currently offline Ivan FurnadjievFriend
Messages: 2426
Registered: July 2009
Location: Sofia, Bulgaria
Senior Member
Hi Gunnar,
there is no simple answer to your questions. All custom widgets in RAP are based on Composites and they are not focusable. Maybe this is the root of the problem. Please file an enhancement request and create a Gerrit change with your current progress. We can than discuss the issue there based on your suggestion.
Regards,
Ivan
Previous Topic:How to build and deploy war file of e4 RAP application with tycho
Next Topic:Read HTTP Post Parameter
Goto Forum:
  


Current Time: Thu Mar 28 22:21:22 GMT 2024

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

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

Back to the top