Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Scout » How to delete row on TablePage
How to delete row on TablePage [message #1403549] Thu, 24 July 2014 10:55 Go to next message
barust Mising name is currently offline barust Mising nameFriend
Messages: 57
Registered: February 2014
Member
Perhaps it will help someone.

In our project we have a Patient TablePage with columns: PatientNr, Second_Name, First_Name, etc.
For the Patient TablePage we have related NewPatientMenu and EditPatientMenu, and we need to add DeletePatientMenu.

For do this we use PatientService and PatientTablePage.

Serice:
In Server#Services#PatientService open New Service Operation, same as:
http://i57.tinypic.com/2hx0z83.jpg

In Scout Explorer looks like this:
http://i59.tinypic.com/2cfxu8p.png

Source code for delete operation in PatientService.java file looks like this:
http://i62.tinypic.com/29n9cw7.png

TablePage:
In Client#All Pages#PatientTablePage#Menus create new menu like this:
http://i62.tinypic.com/of80u0.png

Source code for DeletePatientMenu in PatientTablePage.java file looks like this:
http://i61.tinypic.com/rw4g8g.png

where Message Box added for confirmation with showing SecondName column:
MessageBox.showDeleteConfirmationMessage(getSecondNameColumn().getSelectedValue())


Message Box with confirmation looks like this:
http://i61.tinypic.com/2hqzewi.png

That's all!

P.S.:
All source codes and implementation we took from:
https://github.com/BSI-Business-Systems-Integration-AG/org.eclipsescout.demo/tree/3.9/minicrm
and we say thanks to the guys from BSI AG !


Next, we have a few questions:

1) How we can customize the confirmation messages in MessageBox into another national languages? Like this:
http://i61.tinypic.com/2hqzewi.png

2)If our implementation for row deletion works fine, when we can use (Auto Discard On Delete) option on Table Advansed properties? Like this:
http://i59.tinypic.com/2lqqmg.png

Thanks!
Re: How to delete row on TablePage [message #1403620 is a reply to message #1403549] Thu, 24 July 2014 15:36 Go to previous messageGo to next message
Jeremie Bresson is currently offline Jeremie BressonFriend
Messages: 1252
Registered: October 2011
Senior Member
Bahtiyor Ruzimatov wrote on Thu, 24 July 2014 12:55
we say thanks to the guys from BSI AG !

You're welcome.
Thank you for this detailed question.

Bahtiyor Ruzimatov wrote on Thu, 24 July 2014 12:55
1) How we can customize the confirmation messages in MessageBox into another national languages?


This is because the translations files in Scout RT are not complete. If the localized message for a given key is not found, the english fallback is used.

The current files were translated a long time ago by an external company. We do not have the skills to keep those file up to date without the community (people speaking the language). We need help in this area!

You can add the missing or the wrong translations in your application.
Have a look at the code in MessageBox.showDeleteConfirmationMessage(String, Object)
    String intro = null;
    String action = null;
    if (itemType != null) {
      intro = (n > 0 ? ScoutTexts.get("DeleteConfirmationTextX", itemType) : ScoutTexts.get("DeleteConfirmationTextNoItemListX", itemType));
      action = (n > 0 ? t.toString() : null);
    }
    else {
      intro = (n > 0 ? ScoutTexts.get("DeleteConfirmationText") : ScoutTexts.get("DeleteConfirmationTextNoItemList"));
      action = (n > 0 ? t.toString() : null);
    }
    MessageBox mbox = new MessageBox(
        ScoutTexts.get("DeleteConfirmationTitle"),
        intro,
        action,
        ScoutTexts.get("YesButton"),
        ScoutTexts.get("NoButton"),
        null
        );

DeleteConfirmationTextX, DeleteConfirmationText, DeleteConfirmationTitle are the keys of the messages you are looking for.

I have described how you can override a text entry from the framework in an Eclipse Scout application in StackOverflow. I hope you can use it to add the missing keys for your language. (You can skip the last part where I mention Bug 439590, because you can save the Dialog even if a warning is displayed). If you need more help, feel free to continue the discussion here.

When your translation is working as expected it would be great to share it with other eclipse scout users. You can help us by improving the default translation files provided by the Eclipse Scout framework.

I have given some inputs on how you can contribute translations back to the scout framework. If you are interested, feel free to ask anything you need to be able to contribute those files. I will guide you through the process to make it Happen. I do not see any other way to improve the localization of Eclipse Scout. We need contributions from native speaker, from people using those translations.


Bahtiyor Ruzimatov wrote on Thu, 24 July 2014 12:55
2)If our implementation for row deletion works fine, when we can use (Auto Discard On Delete)

I have try to explain the difference between delete and discard Row in the wiki: Delete a row from the table

If you have the property AutoDiscardOnDelete set to true, the row will be discarded when you call deleteRow(..). This matters only when you send the content of your table, back to the server, like in a TableField in a form. In this case you will read the TableData on the server-side you are interesting in persisting the deletion operation corresponding to each row with the state ITableHolder.STATUS_DELETED

I really like your approach where you call reloadPage() after the deletion. This way you are sure that the user gets an updated state that really correspond to the database state.

I hope this helps. Otherwise fell free to continue the discussion.
Re: How to delete row on TablePage [message #1403688 is a reply to message #1403620] Fri, 25 July 2014 11:01 Go to previous messageGo to next message
barust Mising name is currently offline barust Mising nameFriend
Messages: 57
Registered: February 2014
Member
Your advice on StackOverflow by customizing the confirmation message really help me. Thanks! It's work fine.
Moreover, I am willing to help with translation and contribute to Eclipse Scout. Following your advice by translation of the text, I can translate the already existing default texts in Eclipse Scout framework to Russian then from next time to Uzbek languages. Now when I have finished the translation into Russian, I'll let you know about it so that to contribute.

About AutoDiskardOnDelete all became clear to me, thank you.


But as a consequence, the following question arises:

How to delete several selected rows on TablePage?.

For example, there are a lot of rows on TablePage and I want to delete selectively several rows (for example first, third and fifth rows of TablePage). By right clicking mouse button on several selected rows, context menu not appear (not reacting). How to activate context menu on several selected rows? Are there alternative methods to remove a few selected rows?
Thanks!
Re: How to delete row on TablePage [message #1403691 is a reply to message #1403688] Fri, 25 July 2014 11:34 Go to previous messageGo to next message
Jeremie Bresson is currently offline Jeremie BressonFriend
Messages: 1252
Registered: October 2011
Senior Member
You need to change the types of your delete menu:

index.php/fa/18636/0/

I think you will need:
- SingleSelection
- MultiSelection

You also need to modify the execAction: use ".getSelectedValues()" instead of ".getSelectedValue()".

@Order(30.0)
public class DeleteMenu extends AbstractExtensibleMenu {

  @Override
  protected Set<? extends IMenuType> getConfiguredMenuTypes() {
    return CollectionUtility.<IMenuType> hashSet(TableMenuType.MultiSelection, TableMenuType.SingleSelection);
  }

  @Override
  protected void execAction() throws ProcessingException {
    if (MessageBox.showDeleteConfirmationMessage(getNameColumn().getSelectedValues())) {
      SERVICES.getService(IStandardOutlineService.class).deleteItems(getIdColumn().getSelectedValues());
      reloadPage();
    }
  }
}


You will need to modify the signature of IPatientService#delete(..). It should accept a List as parameter. Of course you we need to adapt your implementation server-side.

.
  • Attachment: MenuTypes.png
    (Size: 54.90KB, Downloaded 828 times)
Re: How to delete row on TablePage [message #1403694 is a reply to message #1403691] Fri, 25 July 2014 12:10 Go to previous messageGo to next message
barust Mising name is currently offline barust Mising nameFriend
Messages: 57
Registered: February 2014
Member
For a single row delete confirmation MessageBox is right:
MessageBox.showDeleteConfirmationMessage(getSecondNameColumn().getSelectedValue())

But what about several selected rows,because confirmation MessageBox must will be show several selected row data? Accordingly, my translation text for multiple lines deletion on Confirmation MessageBox should be different.
Re: How to delete row on TablePage [message #1403696 is a reply to message #1403694] Fri, 25 July 2014 12:25 Go to previous messageGo to next message
Jeremie Bresson is currently offline Jeremie BressonFriend
Messages: 1252
Registered: October 2011
Senior Member
Bahtiyor Ruzimatov wrote on Fri, 25 July 2014 14:10
But what about several selected rows,because confirmation MessageBox must will be show several selected row data? Accordingly, my translation text for multiple lines deletion on Confirmation MessageBox should be different.


Yes... I just noticed when I was playing with the example I have proposed.

This is a regression introduced with Luna: Bug 440433.

You can use the workarround. I will try to propose a fix ASAP. You can use the workaround described in the Bug.

.
Re: How to delete row on TablePage [message #1403697 is a reply to message #1403696] Fri, 25 July 2014 12:32 Go to previous messageGo to next message
barust Mising name is currently offline barust Mising nameFriend
Messages: 57
Registered: February 2014
Member
Thank you again for your advice!
Re: How to delete row on TablePage [message #1403759 is a reply to message #1403688] Sat, 26 July 2014 06:42 Go to previous messageGo to next message
Jeremie Bresson is currently offline Jeremie BressonFriend
Messages: 1252
Registered: October 2011
Senior Member
Bahtiyor Ruzimatov wrote on Fri, 25 July 2014 13:01
Moreover, I am willing to help with translation and contribute to Eclipse Scout. Following your advice by translation of the text, I can translate the already existing default texts in Eclipse Scout framework to Russian then from next time to Uzbek languages. Now when I have finished the translation into Russian, I'll let you know about it so that to contribute.


This is great news! Start with opening a bug in bugzilla and let me know.

.
Re: How to delete row on TablePage [message #1403760 is a reply to message #1403759] Sat, 26 July 2014 07:06 Go to previous messageGo to next message
barust Mising name is currently offline barust Mising nameFriend
Messages: 57
Registered: February 2014
Member
Yes.
I have already begun to translate default NLS text, but a question arises:
- Each user wishes to use their preferred translation. For example, the word 'Standard' (in Russian literally as 'standard') in my case I would translate as 'Main' (in Russian literally means 'main'). It all depends on the task/project being solved. What do you think?
Re: How to delete row on TablePage [message #1403762 is a reply to message #1403760] Sat, 26 July 2014 09:07 Go to previous messageGo to next message
Jeremie Bresson is currently offline Jeremie BressonFriend
Messages: 1252
Registered: October 2011
Senior Member
I do not speak Russian and I cannot tell. Try to use the translation that will be suitable for the most of the cases.

I see it like this:
you are willing to contribute something, you are the first that step up to do so, you can decide. All you can contribute in this domain will be better as what we have now. No one from the scout team will be able to review your proposition (we can review the form but not the translation itself).

In the future, when there is more users and contributors that work in Russian, I hope there will be discussions about what is good for eclipse scout (working in most of the cases) and what is too specific (and need to be solved in each scout project). Until then you have the lead on this.

.
Re: How to delete row on TablePage [message #1403763 is a reply to message #1403760] Sat, 26 July 2014 09:29 Go to previous message
barust Mising name is currently offline barust Mising nameFriend
Messages: 57
Registered: February 2014
Member
Opened Bug 440473
Previous Topic:Swing Browser
Next Topic:Wrong bundle is used as server bundle
Goto Forum:
  


Current Time: Thu Mar 28 21:09:10 GMT 2024

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

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

Back to the top