Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » scout » table row context menu when table is empty
table row context menu when table is empty [message #1349420] Mon, 12 May 2014 07:25 Go to next message
davide . is currently offline davide .Friend
Messages: 12
Registered: March 2014
Junior Member
Hi all. Following the minicrm tutorial, I've added a context menu to the person table row (adding a subclass of AbstractExtensibleMenu to the subclass of AbstractExtensibleTable that implements the table) so that when I right click on a table row a context menu appears enabling the user to choose the "EDIT selected" person or adding a "NEW" person.
so far so good.
unfortunately, when the originating database table is empty, no row is displayed on the table, and right-clicking on the empty table does not show the context menu. This way I cannot add any new row to the table. Is there any way to overcome this situation?

Maybe is is possible to attache the context menu not to the table row, but to the originating table (maybe a different menu)?

Maybe I can add an item to the main menu, spawnig a new person form, but in this case how to be aware of the fact that maybe there's a person table shown that needs to be notified that the user added person information, pressed the ok button in the new person form to store the new database row?

thanks in advance!
Re: table row context menu when table is empty [message #1349429 is a reply to message #1349420] Mon, 12 May 2014 07:31 Go to previous messageGo to next message
Matthias Nick is currently offline Matthias NickFriend
Messages: 197
Registered: August 2013
Senior Member
Hi d dr,

can you try to override the following method in your menu:

@Override
protected boolean getConfiguredEmptySpaceAction() {
 return true;
}


this should enable the menu even if you have no content in the table.

Best regards,
Matthias
Re: table row context menu when table is empty [message #1349720 is a reply to message #1349429] Mon, 12 May 2014 10:13 Go to previous messageGo to next message
davide . is currently offline davide .Friend
Messages: 12
Registered: March 2014
Junior Member
Great! Thanks Matthias, works perfectly well
Re: table row context menu when table is empty [message #1709830 is a reply to message #1349420] Thu, 01 October 2015 12:03 Go to previous messageGo to next message
Jannik Malken is currently offline Jannik MalkenFriend
Messages: 44
Registered: October 2015
Member
Hi,
Glad I found a thread dealing with my problem...
Does anyone know how you can make the table row menu (added like davide described) also open for multiple selections? Without further implementation than adding the Menu as an inner class, the menu will only open when no more than one line is selected.
Regards,
MannikJ
Re: table row context menu when table is empty [message #1709844 is a reply to message #1709830] Thu, 01 October 2015 13:15 Go to previous messageGo to next message
Jeremie Bresson is currently offline Jeremie BressonFriend
Messages: 1193
Registered: October 2011
Senior Member
I guess you are looking for the MenuTypes Property:
index.php/fa/23419/0/

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


In a table, only the TableMenuType Enum makes sense:
* SingleSelection => One row selected (default).
* MultiSelection => Multiple rows (this is what you are looking for).
* EmptySpace => The case decribed by davide in this thread.
* Header => For a menu only available on the column header.

Of course you can combine the values (If you want a menu avaible for EmptySpace and MultiSelection)
Re: table row context menu when table is empty [message #1709851 is a reply to message #1709844] Thu, 01 October 2015 13:46 Go to previous messageGo to next message
Jannik Malken is currently offline Jannik MalkenFriend
Messages: 44
Registered: October 2015
Member
Wow, can't believe, I didn't find this for myself.
Things in Scout are often so easy to realize, but even harder to figure out how to do it.
Thank you for the quick reply!
Re: table row context menu when table is empty [message #1709862 is a reply to message #1709851] Thu, 01 October 2015 14:18 Go to previous message
Jeremie Bresson is currently offline Jeremie BressonFriend
Messages: 1193
Registered: October 2011
Senior Member
Do not hesitate to ask here or on StackOverflow... We try to reply quickly.

Like with every framework, you need to learn how it works... A lot of our users have told us that doing the MiniCRM tutorial was the quickest way to learn a lot of scout concepts.

If you like you can also tell us who you are in the survey.
Previous Topic:Clearing cell decorations in editable table cell
Next Topic:[Blog Post] Overriding a method in Eclipse IDE and (non-Javadoc) comment lines
Goto Forum:
  


Current Time: Sun Sep 25 10:41:25 GMT 2016

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

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