Hello,
I don't find native solution, but I build my own, and I share this with you:
I have in first, Override locationChanged(Location location) method of my
BaseApp to store the current location like this :
[code]public class MyBaseApp extends BaseApp {
@Inject
public MyBaseApp (AppContext appContext, AppView appView) {
super(appContext, appView);
}
@Override
public void start(Location location) {
super.start(location);
}
@Override
public void locationChanged(Location location) {
super.locationChanged(location);
current = location;
String parameter = location.getParameter();
System.out.println(parameter);
}
private Location defaultLocation = null, current = null;
public Location getDefaultLocation() {
if (defaultLocation == null) {
defaultLocation = new DefaultLocation(
DefaultLocation.LOCATION_TYPE_APP,
appContext.getName(),
getAppContext().getDefaultSubAppDescriptor().getName()
);
}
return defaultLocation;
}
public Location getCurrentLocation () {
if (current == null)
return getDefaultLocation();
return current;
}
}[/code]
Next, in each SubApp, I have Override these two methods :
- onSubAppStart() : In this, I store the current location to reuse it while
close operation
- onSubAppStop() : We have just to goTo the previous stored location
See on my example:
[code]public class MySubApp extends BaseSubApp<MySubAppView> implements
MySubAppView.Listener{
private LocationController locationController;
private Location previousLocation = null;
@Inject
public MySubApp(SubAppContext subAppContext, MySubAppView view,
LocationController locationController, MagnoliaConfigurationProperties
properties) {
super(subAppContext, view);
this.locationController = locationController;
view.setListener(this);
}
@Override
protected void onSubAppStart() {
super.onSubAppStart();
AppContext ctx = getAppContext();
if (ctx instanceof AppInstanceController) {
AppInstanceController controller = (AppInstanceController)ctx;
DatabaseModifierApp app = (DatabaseModifierApp)controller.getApp();
previousLocation = app.getCurrentLocation();
}
}
@Override
protected void onSubAppStop() {
super.onSubAppStop();
locationController.goTo(previousLocation);
}
}[/code]
I hope this is a good solution
--
Context is everything:
http://forum.magnolia-cms.com/forum/thread.html?threadId=a39d0ab0-e00b-4677-95ac-668657d7fc26
----------------------------------------------------------------
For list details, see http://www.magnolia-cms.com/community/mailing-lists.html
Alternatively, use our forums: http://forum.magnolia-cms.com/
To unsubscribe, E-mail to: <[email protected]>
----------------------------------------------------------------