Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » scout » Saving users table customisation
Saving users table customisation [message #1401314] Tue, 15 July 2014 12:42 Go to next message
Lukas Steigerwald is currently offline Lukas SteigerwaldFriend
Messages: 47
Registered: July 2014
Member
My evaluation of the Scout framework progresses. Now the features I am investigating getting a bit more special I guess.
Currently I try to find a way to save the customisations a user does to a table that is displayed inside a form. Like changing the order of the columns or a sepcific combination of filters/sorts. Is this somehow possible to achieve?
Re: Saving users table customisation [message #1401350 is a reply to message #1401314] Tue, 15 July 2014 13:24 Go to previous messageGo to next message
Matthias Nick is currently offline Matthias NickFriend
Messages: 197
Registered: August 2013
Senior Member
Hi Lukas,

yes, we do have a concept for this. We use a cache. See this post for more information.

If you have more questions, please let us know.

Best regards,
Matthias
Re: Saving users table customisation [message #1401374 is a reply to message #1401350] Tue, 15 July 2014 13:59 Go to previous messageGo to next message
Lukas Steigerwald is currently offline Lukas SteigerwaldFriend
Messages: 47
Registered: July 2014
Member
In my case this behaviour is not existing. It does not even save when I am activating another page and then going back to the page where I did the changes. Could it be related to how I implemented the table? I deactivated the visibility of the default table of the tablepage and replaced it by a layoutform that contains three other forms. One of these forms is the form containing the table where the user settings should be saved.
TablePage (with deactivated table)
 -layoutform

  --form1

  --tableform (this file contains the table that is actually displayed)
   ---mainbox
   ----tablefield
   -----displayed table

  --form3

Maybe I have unchecked a box or something that influences the cache? Or it has something to do with running it from eclipse?
However the prefs file is generated in the suggested location from the other article.
Re: Saving users table customisation [message #1403178 is a reply to message #1401374] Tue, 22 July 2014 08:02 Go to previous messageGo to next message
Lukas Steigerwald is currently offline Lukas SteigerwaldFriend
Messages: 47
Registered: July 2014
Member
I have still no solution for my problem. I have read the article recommended by Matthias closely, but I cannot see how to address my problem, as this article approaches it from the side of trying to deactivate caching for the Table of a TablePage.

Does this preference service work if you are using anonymous users? Is it an issue that I am not using the default tables of the TablePage but using a form with a TableField embedded in another form? Does a way exist to enable this caching mechanism for TableFields?
Re: Saving users table customisation [message #1403187 is a reply to message #1403178] Tue, 22 July 2014 09:23 Go to previous messageGo to next message
Matthias Nick is currently offline Matthias NickFriend
Messages: 197
Registered: August 2013
Senior Member
Hi Lukas,

I am sorry that I can't provide a full solution yet, I am very busy. But I think the class you need to look into is
org.eclipse.scout.rt.client.ui.ClientUIPreferences
. This class has methods which may help:

hasTableColumnPreferences(ITable)
setAllTableColumnPreferences(ITable table)
setTableColumnPreferences(IColumn col)
getTableColumnWidth(IColumn col, int defaultWidth)
getTableColumnVisible(IColumn col, boolean defaultValue)
...


Matthias
Re: Saving users table customisation [message #1404556 is a reply to message #1403187] Mon, 04 August 2014 07:44 Go to previous messageGo to next message
Lukas Steigerwald is currently offline Lukas SteigerwaldFriend
Messages: 47
Registered: July 2014
Member
The solution to my problem seems to be calling initTable() after creating a new instance of the tableForm as pointed out by Jeremie in the context of another issue: https://www.eclipse.org/forums/index.php/mv/msg/235749/1404471/#msg_1404471
Maybe instantiating a form with a TableField misses this method call. When adding it manually it works.
Re: Saving users table customisation [message #1404748 is a reply to message #1404556] Tue, 05 August 2014 13:33 Go to previous messageGo to next message
Lukas Steigerwald is currently offline Lukas SteigerwaldFriend
Messages: 47
Registered: July 2014
Member
After experimenting a bit with this now working feature I realised that in my current setting there is just a single file for all clients to save these settings when running it locally. This means independently with which user I use the application, always the same settings are loaded. So if user A does a change then user B has the same change applied to his UI as well when starting the application the next time. In the Link Matthias shared in the second post it is mentioned that there is a way to store these preferences for each user in a database. Could anyone help me to find the information how to achieve this? Until now I only found the information that it is possible in Matthias' link but nowhere any hints how to achieve this.
Re: Saving users table customisation [message #1404913 is a reply to message #1404748] Wed, 06 August 2014 06:15 Go to previous messageGo to next message
Matthias Nick is currently offline Matthias NickFriend
Messages: 197
Registered: August 2013
Senior Member
Hi Lukas,

I experienced the same behavior.
Here is a way to solve your problem:

Before calling AbstractTable#initTable() you need to set a UserPreferenceContext:

getTable().setUserPreferenceContext(userId);
getTable().initTable()


Where the userId is a String. In my case I obtain the userId from the ClientSession where I have overridden the "getUserId" method.

Hope this helps,
Matthias
Re: Saving users table customisation [message #1405472 is a reply to message #1404913] Thu, 07 August 2014 12:35 Go to previous messageGo to next message
Lukas Steigerwald is currently offline Lukas SteigerwaldFriend
Messages: 47
Registered: July 2014
Member
Thank you Matthias, that solved the issue with the different customisations for different users. Regarding a way to store the customisation in a database as mentioned in the thread you posted in the beginning: Do you have any ideas where to start to realise that?
Re: Saving users table customisation [message #1405485 is a reply to message #1405472] Thu, 07 August 2014 12:59 Go to previous message
Matthias Nick is currently offline Matthias NickFriend
Messages: 197
Registered: August 2013
Senior Member
Hi Lukas,
I did not try but I suppose the following.

The preferences are stored by using the
IUserPreferencesStorageService
.

Currently, the
FileSystemUserPreferencesStorageService implements IUserPreferencesStorageService
will be used. If you wanted to save it in a Database, you would need to create your own implementation like this:

DatabaseUserPreferencesStorageService implements IUserPreferenceStorageService


Accordingly, when you call
IUserPreferencesStorageService
your DataBaseService will be used instead

[Updated on: Thu, 07 August 2014 13:00]

Report message to a moderator

Previous Topic:smartfield on mac swt
Next Topic:Defining and using datasources in scout
Goto Forum:
  


Current Time: Fri May 22 11:51:19 GMT 2015

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

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