cnish_09
|
Posted: May 18, 2010 16:18 by cnish_09
|
|
Hi All, I am developing an application using the SAF and I love the way SAF works. But is there any way by which i can disable the session state feature which comes with SAF. Is there any flag in the API for doing the same. Like if isSaveSessionDisabled. Is it possible to disable the same. Regards, Nishanth.C |
How to Disable the Session State Feature.
by: etf
Eric Heumann
|
Posted: May 18, 2010 17:50 by Eric Heumann
|
As far as I know, there's no simple setSessionStorageEnabled(false); What aspect of session storage are you trying to disable? Do you not want window states and locations to be stored, or do you not want table columns to be stored, or...? If you're using BSAF, you can unregister a property support type by calling application.getContext().getSessionStorage().register(aClass, null); For aClass, put the type of object you don't want stored, such as Window.class, JTabbedPane.class, JSplitPane.class, or JTable.class. If you're using SAF 1.03, you can't unregister property supports, so you have to stop the framework from saving the session altogether, which means overriding the shutdown method in your SingleFrameApplication and not calling super.shutdown() in it. This will stop the state of the main frame from being stored. If you have secondary windows or dialogs in your application, and you display them via the show methods in SingleFrameApplication, their session states will still be stored, and it would be very difficult to keep that from happening. If you're in that boat, I'd recommend upgrading to BSAF. Hope that helps. Eric |
etf
|
Posted: May 18, 2010 20:36 by etf
|
|
Thank you for your message. You gave me another reason to refactor SingleFrameApplication. We need all features like resources injection and session storage to be implemented as decoupled and reusable mixins for an concrete application class. As for your question you could consider inheritance directly from Application class. |
cnish_09
|
Posted: May 19, 2010 05:09 by cnish_09
|
|
Hi Eric, Thanks for the reply. So if i use BSAF then i can stop restoring certain type of components like JTable or JTabbedPane etc.. right? And one more question the method register(class,null) you meant is not there in the SessionStorage Class in bsaf-1.9RC4.jar. I just found this below method(registerPropertySupport()). Is this what i need to use?
public void registerPropertySupport(Class<? extends Component> clazz, PropertySupport propertySupport)
{
if (clazz == null) throw new IllegalArgumentException("Class argument must not ne null.");
if (propertySupport == null) {
this.propertyMap.remove(clazz);
return;
}
ETF: Thanks for your suggestion too. Will try in that way too .
|
Eric Heumann
|
Posted: May 19, 2010 06:00 by Eric Heumann
|
|
Yes, that's correct, and yes, registerPropertySupport(clazz, support) is the method you want. Sorry about that; I forgot its name. Eric |
Anonymous User
|
Posted: June 04, 2010 01:26 by Anonymous User
|
|
So if I want to turn it off I must pass my own class that implements PropertySupport interface? I tried passing it a null, since in the source I found this comment
What I'm trying to fix is the following:
This prints out when I close a JDialog, I thought that disabling persistant would fix it. So either 1.- Passing a null disabled persistence and I've got a different problem 2.- Persistence was not disabled. note Line 167 should be changed to: ss.registerPropertySupport(JTable.class, new ExtendedTableProperty()); |
by: etf



.





