public ViewState(Core core, View view, CogaenId resourceGroupId) {
		super(core);
		
		if (resourceGroupId != null) {
			ResourceService resSrv = ResourceService.getInstance(getCore());
			if (!resSrv.hasGroup(resourceGroupId)) {
				resSrv.createGroup(resourceGroupId);
			}
			view.registerResources(resourceGroupId);
			addEnterAction(new LoadResourceGroupAction(getCore(), resourceGroupId));
		}		
		addEnterAction(new EngageAction(view));
		
		if (resourceGroupId != null) {
			addExitAction(new UnloadResourceGroupAction(core, resourceGroupId));
		}
		addExitAction(new DisengageAction(view));
	}