Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » scout » Table columns order hidden cache??(Table columns order hidden cache??)
Table columns order hidden cache?? [message #1222068] Thu, 19 December 2013 10:41 Go to next message
João Rebelo is currently offline João Rebelo
Messages: 21
Registered: December 2013
Junior Member
Hi,

I'm doing the MiniCRM (great) tutorial, and have come to an odd situation.
While creating the Person page I've created the columns in the wrong order (person_nr, first_name, last_name). After running with the suggested query it obviouslly was showing the last name value in first name column and vice-versa.

So to fix this (and also try the Scout limits Razz ) I've drag-and-dropped the last_name column to the correct order in the Scout Explorer view. This has correctly fixed the code order and annotations:

    @Order(20.0)
    public class LastNameColumn extends AbstractStringColumn {
        ...
        
        @Override
        protected int getConfiguredWidth() {
            return 200;
        }
    }

    @Order(30.0)
    public class FirstNameColumn extends AbstractStringColumn {
        ...
    }


So after this change, I've also setted the width for both name columns.
For me the logical result for this would be to have a table with first column having the last_name, and the second column having the first_name, and both columns having 200 as width.

For my big surprise the clients (at least SWT & RAP) presented something different:
1. kept the original/erroneous column orders (first_name, last_name).
2. Now the data was correctly loaded with the suggested query (as expected)
3. First Name now had a 200 width, but Last Name remained with the initial width.

To be sure I've seen the advanced properties and seen that ViewOrder was still -1, so there wasn't no apparent reason for not updating the columns order.
Just for a try I've cleaned all my projects, and deleted the runtime information that was created with the project. Still the columns were unsorted.

In this "plays" I've seen that columns widths are persisted in between executions, even if runtime information is deleted. But if I configure in a execution the columns order, this configuration isn't persisted for the following execution.

Just for a relief I've restarted eclipse to see if some in-memory thing was going on.

So where is the "black magic" that is generating this table???

My humble guess there must be some "cache" holding this values but isn't in the obvious places (maybe in workspace metadata or some plugins data??).

Also what other mysterious problems like this can we expect in this changes?


Regards
João
Re: Table columns order hidden cache?? [message #1222095 is a reply to message #1222068] Thu, 19 December 2013 11:46 Go to previous messageGo to next message
Jeremie Bresson is currently offline Jeremie Bresson
Messages: 529
Registered: October 2011
Senior Member
Hi,

Thanks for your interest in Scout.


You are correct, there is a cache and it is a feature:

If a user reorganizes a table, when he opens the TablePage again, he will find the columns organized like he organized them the last time.

To reset:
In the table header, open the context menu and select: "reset columns > all".

The whole cache is stored in a pref file. So in order to reset everything, you can of course destroy this preference file.
Re: Table columns order hidden cache?? [message #1222098 is a reply to message #1222095] Thu, 19 December 2013 11:55 Go to previous messageGo to next message
João Rebelo is currently offline João Rebelo
Messages: 21
Registered: December 2013
Junior Member
Jeremie thanks for the answer,

After the reset it worked as supposed.
I didn't understand why when I've reordered the columns and restarted it didn't kept the order.

So my next question is where is that preference file? I would assume that it should be in the runtime folder, but clearly it isn't (After deleting the folder the preferences are kept).

Regards

ps: It would be nice for development if we can have a test mode that always cleans the preferences.
Re: Table columns order hidden cache?? [message #1222171 is a reply to message #1222098] Thu, 19 December 2013 15:35 Go to previous messageGo to next message
Jeremie Bresson is currently offline Jeremie Bresson
Messages: 529
Registered: October 2011
Senior Member
João Rebelo wrote on Thu, 19 December 2013 17:55

So my next question is where is that preference file? I would assume that it should be in the runtime folder, but clearly it isn't (After deleting the folder the preferences are kept).


The mechanism is defined with a service: interface IUserPreferencesStorageService

An implementation of this service (that will be the default if you do not change anything) stores the content in a file: have a look at FileSystemUserPreferencesStorageService

If you take the MiniCrm application as example under windows, the file will be:
* Starting the dev product from eclipse
C:\Users\<my user name>\user\.settings\org.eclipse.scout.rt.client.prefs


* Starting the exported application (minicrm.exe)
C:\Users\<my user name>\minicrm\user\.settings\org.eclipse.scout.rt.client.prefs


Depending on your use case, you can also provide a Database implementation of the user preferences. If your users log into the application from different computers, they will get the same UI settings everywhere.


João Rebelo wrote on Thu, 19 December 2013 17:55

ps: It would be nice for development if we can have a test mode that always cleans the preferences.


I couldn't agree more.
This is something I have in a lot of projects (a command like an ant script to clean the file).
Re: Table columns order hidden cache?? [message #1222394 is a reply to message #1222171] Fri, 20 December 2013 05:10 Go to previous message
João Rebelo is currently offline João Rebelo
Messages: 21
Registered: December 2013
Junior Member
Jeremie,

Once again thanks for the great support!
I've located the file and confirmed your support.

Regards
João
Previous Topic:How to change theme on RAP client
Next Topic:Password decoding
Goto Forum:
  


Current Time: Sat Apr 19 13:26:39 EDT 2014

Powered by FUDForum. Page generated in 0.01651 seconds