Could the editor be written today in the latest GWT with no Javascript?

15 views
Skip to first unread message

UncleBob

unread,
Jun 27, 2010, 3:09:00 PM6/27/10
to GWT Rich-Text Editor
I have hoped that GWT would get to the point that some really good
apps could be created that stay entirely within GWT.

Would GWT able to do that, in its latest incarnation?

My Java skills are solid, so I was hoping to build on them.

I don't know Javascript and I'm hoping I won't have to learn it.

As professor, I have quite a collection of duties - I don't have
endless hours to spend learning a variety of different software
technologies.

- Bob

Yegor

unread,
Jun 28, 2010, 12:11:30 AM6/28/10
to GWT Rich-Text Editor
Hi, Bob,

JSNI and JavaScript are major parts of GWT, always have been and will
remain so in the foreseeable future. Everything eventually ends up as
JavaScript either through compiler or JSNI and a lot of GWT's core
APIs are implemented as JSNI. If you want to do serious work with GWT
you should learn a thing or two about JavaScript and JSNI. GWT will
allow you to write 99% of your code in Java with static typing and
compiler optimizations. A lot of complex applications can be written
100% in Java. However, it is not uncommon that you have to resort to
JSNI once in a while (e.g. you need a very rare, unimplemented or non-
standard browser feature, such as text selection).

Yegor

UncleBob

unread,
Jul 5, 2010, 10:07:48 PM7/5/10
to GWT Rich-Text Editor
I appreciate what you're saying, but the RichTextEditor with a toolbar
that I found in the Showcase examples buried in my SDK appears to be
written with no Javascript at all and works fine.

I would like some guidance on how to go about designing an app that
would do things such as the following:

The server downloads text, as an array (Collection) of tokens
(Strings), which would be displayed in the text area.
Other arrays of information would be downloaded that could be used to
decorate the text.
For example, say we downloaded information about which of the tokens
or token groups are the names of companies.
The user would have a menu that includes the item "Companies".
When that menu item is selected, the text for the companies would be
highlighted in red.

The basic question for this type of app is: How do I access particular
Strings and alter their styling?
Is DOM the way to go?

In the dual problem, how would I discover a String that the user has
selected and designated as a company - one that was not on the
original list?
The String chosen would be returned to the server to update its list
of company names.

This type of application is typical of many apps that would be of
great benefit to researchers in natural language processing.
There are about 600 members on the mailing list at my site,
bionlp.org, many of who would be interested in such apps.

Any and all suggestions, leads, etc., most welcome.

- Bob

Yegor

unread,
Jul 6, 2010, 11:37:06 AM7/6/10
to GWT Rich-Text Editor
If I understand correctly you do not need to be able to edit the text
but only annotate it with metadata, e.g. "substring [15,25] is a
company name; substring [30,45] is a verb; etc". Coincidentally I am
working on a similar application. I have a piece of text with some
styling and layout (tables, images, etc) and the user must be able to
select substrings using the mouse and add some metadata to those
substrings. Because editing text is not a requirement I render text
using regular HTML (<div>, <table>, <img>). I was able to adapt Rocket
GWT's Selection API to my needs (http://code.google.com/p/rocket-
gwt/). Unfortunately the project lacks activity. It seems the
developer got discouraged after most of the features were implemented
in core GWT libraries. However, text selection API is still unique to
Rocket GWT. A little warning though, it has some bugs that can pop-up
in some corner cases (especially in IE) so you may need to dive into
the code (a lot of it is JSNI).

Hope this helps.

Yegor

UncleBob

unread,
Jul 6, 2010, 11:55:00 AM7/6/10
to GWT Rich-Text Editor
Thanks for your reply.

But if text is created in the editor window by a user, how is it
supposed to be accessed? Is that something DOM can do? In the
RichTextEditor, toolbar events and alter the attributes of selected
text, so the toolbar somehow has access to selected items. Not sure
how all this happens.

- Bob
Reply all
Reply to author
Forward
0 new messages