When you add a contact which is already in your contact list, the contact is renamed according to the name you chose while adding. Instead, there should be a prompt or so to say that the contact is already added.
We are trying to fix the bug but we can not reproduce it. When we try to add a contact whose jabber ID
is already in our contact list, it does not effect the contact list (See
attached image). But when the new contact has a new jabber ID and a
existing nickname, this new contact is added without renaming to the
contact list and you have the nick name twice.
As already stated on the mailing list, this bug has the "HTML" tag, which means it refers to the new GUI rather than the old one. Your screenshot clearly shows the old SWT interface.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
We have thought about a solution approach, which we would present you:
This is the chain of calls, if you add a new contact with the HTML GUI:
de.fu_berlin.inf.dpp.ui.frontend\html\js\views.js: addContact();
→ de.fu_berlin.inf.dpp.ui.frontend\html\js\models\contact.js: create()
→ de.fu_berlin.inf.dpp.ui.frontend\html\js\saros-api.js: addContact()
→ de.fu_berlin.inf.dpp.ui.core_facades.StateFacade.java: addContact()
The last called function is a java function. Because the HTML code is written only for view and to add a contact is a business logic task, we fix the problem in the java function. There we ask if this contact is already existing. If yes, it would open a message dialog like "Contact exists already: " + [jid]" with the swing function JoptionPane.showMessageDialog(). If not, the contact will be added.
If the approach fits to conventions and other rules of the project we would implement it. We will be also happy about suggestions for improvement.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
If you going to use the DialogManger to show a new window you would also need to provide a html page that only contain the information “the Contact name already exist, please chose another one to add” (or something similar). Therefor you would need to implement a BrowserPage that contain the location of this html document. For any interaction in this page (like a “close” or “okay” button” you also need to create a (very simple) BrowserFunctions.
Long story short: It’s a lot of busy work to solve this with a new HTML page dialog (and this might also not be the best user expirence). The better, and probably easier, way would be to use the JavaScriptEvent "showError":
This would show an message in the current browser (aka in the “open dialog” like the MainPage). You can find an example in the SessionWizardPageBrowserFunctions.java (line 64)
If you want more information about this approach you can contact me. There is also a patch in the review (sadly not yet finished) which will make the usage of these JavaScriptEvents easier.
Last edit: Matthias Bohnstedt 2015-11-09
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
We are trying to fix the bug but we can not reproduce it. When we try to add a contact whose jabber ID
is already in our contact list, it does not effect the contact list (See
attached image). But when the new contact has a new jabber ID and a
existing nickname, this new contact is added without renaming to the
contact list and you have the nick name twice.
As already stated on the mailing list, this bug has the "HTML" tag, which means it refers to the new GUI rather than the old one. Your screenshot clearly shows the old SWT interface.
We have thought about a solution approach, which we would present you:
This is the chain of calls, if you add a new contact with the HTML GUI:
de.fu_berlin.inf.dpp.ui.frontend\html\js\views.js: addContact();
→ de.fu_berlin.inf.dpp.ui.frontend\html\js\models\contact.js: create()
→ de.fu_berlin.inf.dpp.ui.frontend\html\js\saros-api.js: addContact()
→ de.fu_berlin.inf.dpp.ui.core_facades.StateFacade.java: addContact()
The last called function is a java function. Because the HTML code is written only for view and to add a contact is a business logic task, we fix the problem in the java function. There we ask if this contact is already existing. If yes, it would open a message dialog like "Contact exists already: " + [jid]" with the swing function JoptionPane.showMessageDialog(). If not, the contact will be added.
If the approach fits to conventions and other rules of the project we would implement it. We will be also happy about suggestions for improvement.
You cannot open a JOptionsPane in Eclipse.
Indeed, you should not rely on Swing. But judging from its name, the DialogManager should be worth looking into.
If you going to use the DialogManger to show a new window you would also need to provide a html page that only contain the information “the Contact name already exist, please chose another one to add” (or something similar). Therefor you would need to implement a BrowserPage that contain the location of this html document. For any interaction in this page (like a “close” or “okay” button” you also need to create a (very simple) BrowserFunctions.
Long story short: It’s a lot of busy work to solve this with a new HTML page dialog (and this might also not be the best user expirence). The better, and probably easier, way would be to use the JavaScriptEvent "showError":
Browser.run("SarosApi.trigger(‘showError’," + errorMessage + ")").
This would show an message in the current browser (aka in the “open dialog” like the MainPage). You can find an example in the SessionWizardPageBrowserFunctions.java (line 64)
If you want more information about this approach you can contact me. There is also a patch in the review (sadly not yet finished) which will make the usage of these JavaScriptEvents easier.
Last edit: Matthias Bohnstedt 2015-11-09
The patch for using the Javascript-API: http://saros-build.imp.fu-berlin.de/gerrit/#/c/2780/
would make the call you looking for like "JavaScriptAPI.showError(String msg)";