'Change icon in navbar at runtime

I am working on a chat module within an application. We use a navbar to allow the user to navigate between modules. When the user receives unread messages in the chat module, I want to replace the normal chat bubble icon of the chat module by one with a red dot on top, indicating that there are unread messages. I have written a EventEmitter in angular, which our chat module is written in, that I listen to in GWT. Our navpanel extends the composite class.

Is there a programmatic way to replace the icon during runtime?

One approach could also be to replace the icon URL using javascript (JSNI). My img-tag looks like that with no specific id/class hat would allow me to identify the object. Is it possible to add id/class during definition of the item?

<img class="gwt-Image" src="./appname/images/apps/chat-nav-bar-new-message-120x80.png">
gwt


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source