[sip-comm-dev] GSoC Introduction


#1

Hi, I'm Damian, a masters student currently attending Washington State
University. This is my first time in GSoC and I'm thrilled to be part of it!

My project consists of adding keybinding customization, integrating a spell
checker, and expanding the history search capabilities. I've added abstracts
and project descriptions to my development blog at:
www.atagar.com/misc/gsocBlog/

Like everyone I'm looking forward to getting started! -Damian

PS. The IRC channel seems to usually be fairly empty (on average around
three people). Is this normal or could it just be a timing issue (I'm in the
Pacific time-zone)? I can also be reached via Jabber at this address (
atagar1@gmail.com).


#2

Hi Damian,

Damian Johnson wrote:

Hi, I'm Damian, a masters student currently attending Washington State
University. This is my first time in GSoC and I'm thrilled to be part of it!

My project consists of adding keybinding customization, integrating a spell
checker, and expanding the history search capabilities. I've added abstracts
and project descriptions to my development blog at:
www.atagar.com/misc/gsocBlog/

Nice blog:)

Like everyone I'm looking forward to getting started! -Damian

We're also very excited:)

I thought that we could continue here our "conversation" from the GSoC web application. It could be interesting also for the others.

Damian wrote:

It looks like the spell checker could be implemented as a GUI plugin that adds a KeyListener to make the above changes via the UIService's getCurrentChat().addChatEditorKeyListener() method. However, this would still require access to the editorPane, which currently could be done by casting the Chat to a ChatPanel and calling getChatWritePanel().getEditorPane(). However, this obviously a rather poor solution since it depends on implementation details so I'm currently looking for a better one.

···

=================

I agree with you that it's not a good idea to make a solution that depends on the implementation. I've thought of adding some methods to the Chat interface that would allow us to make the whole painting (underline wrong words, highlight a word on right button click, or something else) in the user interface. Thus we would keep the implementation in the UI bundle. As for the implementation I've thought of using html, instead of a plain text in the write area. I know that JEditorPane could interpret html, so it should not be so difficult. What do you think about that?

=================

Damian wrote:

As for the popup menu, even with complete access to the ChatWritePanel I'm not spotting an elegant means of externally intercepting the mouse events to update the popup menu before it appears (if over a misspelled word). The best (or really 'least worst') solution I've come up with so far would be to add a 'ChatPopupMenuAwareComponent' interface (kinda like the ContactAwareComponent) with the following method:
   Collection <JMenu> addMenuEntries(ChatWindow window, Point clickCoord)
Which would allow plugins to offer additional menu options based on the context of clicks. However, this is still a rather hacky solution, being far too specific to the needs of the spell checker.

Actually it's possible without any hack. Have a look at the UIService and the implementation for example in the ContactListRightButtonMenu of the PluginComponentListener. It's a little complicated at the moment, as we have modified the gui plugin management lately (so you'd see a number of depricated methods in the UIService), but we could discuss it if you want and clear it up.

PS. The IRC channel seems to usually be fairly empty (on average around
three people). Is this normal or could it just be a timing issue (I'm in the
Pacific time-zone)? I can also be reached via Jabber at this address (
atagar1@gmail.com).

There's something true about the time-zone, most of the mentors are living in Europe, there's also some people in Japan, so may be this is the reason. However we try to be as responsive as possible on the mailing list and I personally stay late in the evening, so this should not be a problem.

Cheers,
Yana

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@sip-communicator.dev.java.net
For additional commands, e-mail: dev-help@sip-communicator.dev.java.net


#3

Nice blog:)

Thanks! :slight_smile:

I agree with you that it's not a good idea to make a solution that depends

on the implementation. I've thought of adding some methods to the Chat
interface that would allow us to make the whole painting (underline wrong
words, highlight a word on right button click, or something else) in the
user interface. Thus we would keep the implementation in the UI bundle.

It seems like the spell checker plugin would need the following
capabilities:
1. Notification of when a key is pressed (which requires adding a listener
to the editorPane or perhaps some Observer/Observable communication).
2. The ability to underline text after some key events when a misspelling is
made.
3. The current contents of the editorPane and the cursor position (since
changes made mid-word are different from those at the end).
4. Notification when the right click menu appears and some way of figuring
out which word (if any) was clicked.
5. The menu selection would need to make undoable corrections.

I'm not yet very familiar with the services available to plugins but it
looks like most of these will either require hacks or adding some
capabilities to the interfaces available to the plugins. Perhaps the first
version should simply get something working with the casting hack, followed
by the changes necessary to get rid of its reliance on having an instance of
the ChatPanel?

As for the implementation I've thought of using html, instead of a plain
text in the write area. I know that JEditorPane could interpret html, so it
should not be so difficult. What do you think about that?

Switching to html would solve the current rich text formatting issue but it
would complicate use of the editorPane a bit. Instead of providing direct
access to the editorPane in the ChatWritePanel it should probably use
getters/setters for the content that do something like the following:

  private JEditorPane editorPane = new JEditorPane("text/html", "");

  public String getText(boolean stripHtml) {
    StringBuilder text = new StringBuilder(editorPane.getText());

    // Restricts to content in the body tag
    text.delete(0, text.indexOf("<body>") + 6);
    text.delete(text.indexOf("</body>"), text.length());

    if (stripHtml) {
      // Strips out html tags
      for (int tagStart = text.indexOf("<"); tagStart != -1; tagStart =
text.indexOf("<")) {
        int tagEnd = text.indexOf(">") + 1;
        text.delete(tagStart, tagEnd);
      }

      // TODO: Unescape characters like &nbsp; and &gt;
      // This isn't terribly hard. Examples are
here<http://www.rgagnon.com/javadetails/java-0307.html>and Apache has
a util package for this
here<http://commons.apache.org/lang/api/org/apache/commons/lang/StringEscapeUtils.html>
    }

    return text.toString().trim(); // Gets rid of any white space introduced
for pretty formatting
  }

The JEditorPane automatically escapes user input so this is certainly a
viable solution.

Actually it's possible without any hack. Have a look at the UIService and

the implementation for example in the ContactListRightButtonMenu of the
PluginComponentListener. It's a little complicated at the moment, as we have
modified the gui plugin management lately (so you'd see a number of
depricated methods in the UIService), but we could discuss it if you want
and clear it up.

I think you mean the 'ContactRightButtonMenu' (I was spooked when a grep
didn't find any matches...). Just to make sure that I'm following, you're
suggesting making the WritePanelRightButtonMenu implement the
PluginComponentListener so events can be passed to it from the spell
checker, right? If so then the communication would be going the wrong
direction since the menu needs to be able to check with the plugin for
corrections when being displayed. I hope I'm not too far off track...

Now off to sleep... cheers! -Damian

···

On Fri, Apr 25, 2008 at 7:11 AM, Yana Stamcheva <yana@sip-communicator.org> wrote:

Hi Damian,

Damian Johnson wrote:

> Hi, I'm Damian, a masters student currently attending Washington State
> University. This is my first time in GSoC and I'm thrilled to be part of
> it!
>
> My project consists of adding keybinding customization, integrating a
> spell
> checker, and expanding the history search capabilities. I've added
> abstracts
> and project descriptions to my development blog at:
> www.atagar.com/misc/gsocBlog/
>

Nice blog:)

> Like everyone I'm looking forward to getting started! -Damian
>

We're also very excited:)

I thought that we could continue here our "conversation" from the GSoC web
application. It could be interesting also for the others.

Damian wrote:

It looks like the spell checker could be implemented as a GUI plugin that
adds a KeyListener to make the above changes via the UIService's
getCurrentChat().addChatEditorKeyListener() method. However, this would
still require access to the editorPane, which currently could be done by
casting the Chat to a ChatPanel and calling
getChatWritePanel().getEditorPane(). However, this obviously a rather poor
solution since it depends on implementation details so I'm currently looking
for a better one.

=================

I agree with you that it's not a good idea to make a solution that depends
on the implementation. I've thought of adding some methods to the Chat
interface that would allow us to make the whole painting (underline wrong
words, highlight a word on right button click, or something else) in the
user interface. Thus we would keep the implementation in the UI bundle. As
for the implementation I've thought of using html, instead of a plain text
in the write area. I know that JEditorPane could interpret html, so it
should not be so difficult. What do you think about that?

=================

Damian wrote:

As for the popup menu, even with complete access to the ChatWritePanel I'm
not spotting an elegant means of externally intercepting the mouse events to
update the popup menu before it appears (if over a misspelled word). The
best (or really 'least worst') solution I've come up with so far would be to
add a 'ChatPopupMenuAwareComponent' interface (kinda like the
ContactAwareComponent) with the following method:
Collection <JMenu> addMenuEntries(ChatWindow window, Point clickCoord)
Which would allow plugins to offer additional menu options based on the
context of clicks. However, this is still a rather hacky solution, being far
too specific to the needs of the spell checker.

Actually it's possible without any hack. Have a look at the UIService and
the implementation for example in the ContactListRightButtonMenu of the
PluginComponentListener. It's a little complicated at the moment, as we have
modified the gui plugin management lately (so you'd see a number of
depricated methods in the UIService), but we could discuss it if you want
and clear it up.

> PS. The IRC channel seems to usually be fairly empty (on average around
> three people). Is this normal or could it just be a timing issue (I'm in
> the
> Pacific time-zone)? I can also be reached via Jabber at this address (
> atagar1@gmail.com).
>

There's something true about the time-zone, most of the mentors are living
in Europe, there's also some people in Japan, so may be this is the reason.
However we try to be as responsive as possible on the mailing list and I
personally stay late in the evening, so this should not be a problem.

Cheers,
Yana

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@sip-communicator.dev.java.net
For additional commands, e-mail: dev-help@sip-communicator.dev.java.net


#4

Hi Damian,

sorry for the lag. I was quite busy last week.

(more inline)

Damian Johnson wrote:

It seems like the spell checker plugin would need the following
capabilities:
1. Notification of when a key is pressed (which requires adding a listener
to the editorPane or perhaps some Observer/Observable communication).

Right. Actually if you have a look to the UIService. There's a method getCurrentChat() and then to the obtained Chat we could add a Key listener.

2. The ability to underline text after some key events when a misspelling is
made.

Right.

3. The current contents of the editorPane and the cursor position (since
changes made mid-word are different from those at the end).

We could get the current content by calling getMessage of the same Chat interface.

The possibility of getting the cursor position is a good point. You could go ahead and add this.

4. Notification when the right click menu appears and some way of figuring
out which word (if any) was clicked.

Right, good point.

5. The menu selection would need to make undoable corrections.

You mean we should be able to replace a wrong word by the selected new one, right?

I'm not yet very familiar with the services available to plugins but it
looks like most of these will either require hacks or adding some
capabilities to the interfaces available to the plugins. Perhaps the first
version should simply get something working with the casting hack, followed
by the changes necessary to get rid of its reliance on having an instance of
the ChatPanel?

I agree, we should add some new methods in the ui bundle before implementing the spellchecker plugin. I think we should keep all communication with the ChatPanel through the Chat interface. You could have a look at the UIService and Chat interfaces and see where and what methods we'll need there. I think that you could go ahead and add what you think is needed and then we could review it together. If you need any guidance at any time don't hesitate to ask.

As for the implementation I've thought of using html, instead of a plain
text in the write area. I know that JEditorPane could interpret html, so it
should not be so difficult. What do you think about that?

Switching to html would solve the current rich text formatting issue but it
would complicate use of the editorPane a bit. Instead of providing direct
access to the editorPane in the ChatWritePanel it should probably use
getters/setters for the content that do something like the following:

  private JEditorPane editorPane = new JEditorPane("text/html", "");

  public String getText(boolean stripHtml) {
    StringBuilder text = new StringBuilder(editorPane.getText());

    // Restricts to content in the body tag
    text.delete(0, text.indexOf("<body>") + 6);
    text.delete(text.indexOf("</body>"), text.length());

    if (stripHtml) {
      // Strips out html tags
      for (int tagStart = text.indexOf("<"); tagStart != -1; tagStart =
text.indexOf("<")) {
        int tagEnd = text.indexOf(">") + 1;
        text.delete(tagStart, tagEnd);
      }

      // TODO: Unescape characters like &nbsp; and &gt;
      // This isn't terribly hard. Examples are
here<http://www.rgagnon.com/javadetails/java-0307.html>and Apache has
a util package for this
here<http://commons.apache.org/lang/api/org/apache/commons/lang/StringEscapeUtils.html>
    }

    return text.toString().trim(); // Gets rid of any white space introduced
for pretty formatting
  }

The JEditorPane automatically escapes user input so this is certainly a
viable solution.

Ok, it complicates the things, but it looks feasible. If you're ok with this solution, let's go for it. You could try implementing a simple example either in a separate project or directly in the ui package, as you wish.

Actually it's possible without any hack. Have a look at the UIService and

the implementation for example in the ContactListRightButtonMenu of the
PluginComponentListener. It's a little complicated at the moment, as we have
modified the gui plugin management lately (so you'd see a number of
depricated methods in the UIService), but we could discuss it if you want
and clear it up.

I think you mean the 'ContactRightButtonMenu' (I was spooked when a grep
didn't find any matches...). Just to make sure that I'm following, you're
suggesting making the WritePanelRightButtonMenu implement the
PluginComponentListener so events can be passed to it from the spell
checker, right? If so then the communication would be going the wrong
direction since the menu needs to be able to check with the plugin for
corrections when being displayed. I hope I'm not too far off track...

You're absolutely right, we have a problem here. I should think some more for this one.

Cheers,
Yana

···

Now off to sleep... cheers! -Damian

On Fri, Apr 25, 2008 at 7:11 AM, Yana Stamcheva <yana@sip-communicator.org> > wrote:

Hi Damian,

Damian Johnson wrote:

Hi, I'm Damian, a masters student currently attending Washington State
University. This is my first time in GSoC and I'm thrilled to be part of
it!

My project consists of adding keybinding customization, integrating a
spell
checker, and expanding the history search capabilities. I've added
abstracts
and project descriptions to my development blog at:
www.atagar.com/misc/gsocBlog/

Nice blog:)

Like everyone I'm looking forward to getting started! -Damian

We're also very excited:)

I thought that we could continue here our "conversation" from the GSoC web
application. It could be interesting also for the others.

Damian wrote:

It looks like the spell checker could be implemented as a GUI plugin that
adds a KeyListener to make the above changes via the UIService's
getCurrentChat().addChatEditorKeyListener() method. However, this would
still require access to the editorPane, which currently could be done by
casting the Chat to a ChatPanel and calling
getChatWritePanel().getEditorPane(). However, this obviously a rather poor
solution since it depends on implementation details so I'm currently looking
for a better one.

=================

I agree with you that it's not a good idea to make a solution that depends
on the implementation. I've thought of adding some methods to the Chat
interface that would allow us to make the whole painting (underline wrong
words, highlight a word on right button click, or something else) in the
user interface. Thus we would keep the implementation in the UI bundle. As
for the implementation I've thought of using html, instead of a plain text
in the write area. I know that JEditorPane could interpret html, so it
should not be so difficult. What do you think about that?

=================

Damian wrote:

As for the popup menu, even with complete access to the ChatWritePanel I'm
not spotting an elegant means of externally intercepting the mouse events to
update the popup menu before it appears (if over a misspelled word). The
best (or really 'least worst') solution I've come up with so far would be to
add a 'ChatPopupMenuAwareComponent' interface (kinda like the
ContactAwareComponent) with the following method:
Collection <JMenu> addMenuEntries(ChatWindow window, Point clickCoord)
Which would allow plugins to offer additional menu options based on the
context of clicks. However, this is still a rather hacky solution, being far
too specific to the needs of the spell checker.

Actually it's possible without any hack. Have a look at the UIService and
the implementation for example in the ContactListRightButtonMenu of the
PluginComponentListener. It's a little complicated at the moment, as we have
modified the gui plugin management lately (so you'd see a number of
depricated methods in the UIService), but we could discuss it if you want
and clear it up.

PS. The IRC channel seems to usually be fairly empty (on average around
three people). Is this normal or could it just be a timing issue (I'm in
the
Pacific time-zone)? I can also be reached via Jabber at this address (
atagar1@gmail.com).

There's something true about the time-zone, most of the mentors are living
in Europe, there's also some people in Japan, so may be this is the reason.
However we try to be as responsive as possible on the mailing list and I
personally stay late in the evening, so this should not be a problem.

Cheers,
Yana

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@sip-communicator.dev.java.net
For additional commands, e-mail: dev-help@sip-communicator.dev.java.net

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@sip-communicator.dev.java.net
For additional commands, e-mail: dev-help@sip-communicator.dev.java.net