Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » NatTable » NatTable Persistence problem(":" in text causes persistency fails)
NatTable Persistence problem [message #1695194] Tue, 12 May 2015 14:53 Go to next message
Gal Rogozinski is currently offline Gal RogozinskiFriend
Messages: 40
Registered: June 2014
Member
Hello,

This is the code from PersistanceUtils

/**
	 * Parse the persisted property and create a TreeMap<Integer, String> from it.
	 * Works in conjunction with the {@link PersistenceUtils#mapAsString(Map)}.
	 * 
	 * @param property from the properties file.
	 */
	public static Map<Integer, String> parseString(Object property) {
		TreeMap<Integer, String> map = new TreeMap<Integer, String>();
		
		if (property != null) {
			String value = (String) property;
			String[] renamedColumns = value.split("\\|"); //$NON-NLS-1$
	
			for (String token : renamedColumns) {
				String[] split = token.split(":"); //$NON-NLS-1$
				String index = split[0];
				String label = split[1];
				map.put(Integer.valueOf(index), label);
			}
		}
		return map;
	}


Notice the line:
label = split[1]

This part of the code makes everything after the colon (":") be mapped to label. This way a string of the following format is parsed correctly:
%d:%s (key:value)

However, what if value has colons insid of it as well (value looks like %s:%s),
Part of the value will be missing -> Bug.


Now I need a fast solution for this... What do I do???
I can't seem to override your code...

Thanks!!
Re: NatTable Persistence problem [message #1695201 is a reply to message #1695194] Tue, 12 May 2015 15:27 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2803
Registered: July 2012
Senior Member
Quote:
Now I need a fast solution for this... What do I do???
I can't seem to override your code...


Use JFace tables, there you don't have those nasty problems with this stupid NatTable and our stupid implementations

Which layer persists values containing colons? The FilterRowDataLayer had such an issue, but there we use some replacement before persisting, and replace it back on loading IIRC. So it would be nice if you tell me where this issue occurs. I don't know where this should happen.
Re: NatTable Persistence problem [message #1695206 is a reply to message #1695201] Tue, 12 May 2015 15:57 Go to previous messageGo to next message
Gal Rogozinski is currently offline Gal RogozinskiFriend
Messages: 40
Registered: June 2014
Member
I use nattable 1.0 I should say.
When I tried to pgrade I ran into some painting issues.

The FilterRowDataLayer is the one.
I saw no replacements when looking at your code...

Why didn't yopu implement this way: token.split(":", 2)?
Re: NatTable Persistence problem [message #1695210 is a reply to message #1695206] Tue, 12 May 2015 16:14 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2803
Registered: July 2012
Senior Member
I didn't implement it. It looked already that way when I started with NatTable.

So I'm also not sure why things were implemented back in the days. Maybe your suggestion also works. But I don't support those old versions. From my point of view the bug is fixed in the current release. So you should update. We fixed tons of bugs since 1.0.
Re: NatTable Persistence problem [message #1695228 is a reply to message #1695210] Tue, 12 May 2015 21:00 Go to previous messageGo to next message
Gal Rogozinski is currently offline Gal RogozinskiFriend
Messages: 40
Registered: June 2014
Member
I encountered painting issues in nattable 1.3 so I downgraded back...
The table didn't paint fully . When I attempted to resize it fixed it.

Out of curiosity. How did you fix the persistence issue in the new versions?

Thanks!!
Re: NatTable Persistence problem [message #1695230 is a reply to message #1695228] Tue, 12 May 2015 21:19 Go to previous message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2803
Registered: July 2012
Senior Member
Quote:
I encountered painting issues in nattable 1.3 so I downgraded back...


I suggest to search why this happens and fix your setup so it works with 1.3.0. I'm not sure what causes this behavior in your case. But we have fixed really a lot of issues since then and we added quite a lot of features. Staying with 1.0.0 is a risk IMHO.

Quote:
Out of curiosity. How did you fix the persistence issue in the new versions?


As I already explained, we introduced a replacement string for colons.
Previous Topic:Open dialog for cell value
Next Topic:Row/Column line invisible
Goto Forum:
  


Current Time: Fri Feb 26 21:38:22 GMT 2021

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

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

Back to the top