// Path: Demo/src/main/java/ni3po42/android/tractiondemo/models/DemoFragmentChoice.java
// public class DemoFragmentChoice
// {
// 	private Class<? extends Fragment> fragmentType;
// 	private String name;
// 	private String description;
// 	
// 	public DemoFragmentChoice(Class<? extends Fragment> fragmentType, String name, String description)
// 	{
// 		this.fragmentType = fragmentType;
// 		this.name = name;
// 		this.description = description;
// 	}
// 
// 	public Class<? extends Fragment> getFragmentType()
// 	{
// 		return fragmentType;
// 	}
// 	public void setFragmentType(Class<? extends Fragment> viewModelType)
// 	{
// 		this.fragmentType = viewModelType;
// 	}
// 
//     public Fragment getFragment()
//     {
//         Fragment fragment = null;
//         try
//         {
//             fragment = getFragmentType().newInstance();
//         }
//         catch (Throwable e)
//         {
//         }
//         if (fragment == null)
//             throw new RuntimeException("Cannot find View Model : " + getFragmentType().getName());
//         return fragment;
//     }
// 
// 
// 	public String getName()
// 	{
// 		return name;
// 	}
// 
// 	public void setName(String name)
// 	{
// 		this.name = name;
// 	}
// 
// 	public String getDescription()
// 	{
// 		return description;
// 	}
// 
// 	public void setDescription(String description)
// 	{
// 		this.description = description;
// 	}
// 	
// }
// 
// Path: traction/src/main/java/traction/mvc/controllers/FragmentController.java
// public class FragmentController
// extends Fragment
// {
// 	/**
// 	 * Helper to implement Controller logic.
// 	 */
// 	protected final ControllerHelper View = new ControllerHelper(this);
// 
// 	@Override
// 	public void onCreate(Bundle savedInstanceState)
// 	{	
// 		super.onCreate(savedInstanceState);
// 		setRetainInstance(true);
// 	}
// 	
// 	@Override
// 	public View onCreateView(LayoutInflater notUsed, ViewGroup container, Bundle savedInstanceState) 
// 	{
// 		View v = View.inflateView(View.getContentView(), container, container != null);
//         IViewBinding vb = ViewFactory.getViewBinding(v);
//         if (vb != null) {
//             View.ensureMenuInflator(vb.getBindingInventory());
//         }
//         return v;
// 	}
// 	
// 	@Override
// 	public void onCreateOptionsMenu(Menu menu, MenuInflater inflater)
// 	{
//         View.onCreateOptionsMenu(menu);
// 	}
// 
// 	@Override
// 	public void onDestroyView() 
// 	{		
// 		super.onDestroyView();	
// 		ViewFactory.DetachContext(getView());
// 	}
// 
//     @Override
//     public void onAttach(Activity activity)
//     {
//         super.onAttach(activity);
//         View.registerFragmentToActivity(this, activity);
//     }
// 
//     @Override
//     public void onDetach()
//     {
//         super.onDetach();
//         View.unregisterFragmentFromActivity(this, getActivity());
//     }
// 
//     @Override
//     public void onStart()
//     {
//         super.onStart();
//         View.connectFragmentViewToParentView(this);
//     }
// }
// 
// Path: traction/src/main/java/traction/mvc/interfaces/IObjectListener.java
// public interface IObjectListener
// {
//     public static class Utility
//     {
//         public static String generatePropagationId(String currentPropagationId, String currentSource)
//         {
//             if (currentSource == null || currentSource.equals(""))
//                 return currentPropagationId;
//             else if (currentPropagationId == null || currentPropagationId.equals(""))
//                 return currentSource;
//             else
//                 return currentSource + "." + currentPropagationId;
//         }
//     }
// 
// 	/**
// 	 * Fired when listener is signalled of something, anything really.
// 	 */
//     void onEvent(String propagationId);
// }
// 
// Path: Demo/src/main/java/ni3po42/android/tractiondemo/models/IDemoSelectionModel.java
// public interface IDemoSelectionModel
//     extends IProxyObservableObject
// {
//     List<DemoFragmentChoice> getChoices();
// 
//     Fragment getCurrentFragment();
//     void setCurrentFragment(Fragment fragment);
// 
//     DemoFragmentChoice getChoice();
//     void setChoice(DemoFragmentChoice choice);
// }
// 
// Path: traction/src/main/java/traction/mvc/observables/OnPropertyChangedEvent.java
// public abstract class OnPropertyChangedEvent
//     implements IObjectListener
// {
//     @Override
//     public void onEvent(String propagationId) {
//         //eh, nothing
//     }
// 
//     protected abstract void onChange(String propertyName, Object oldValue, Object newValue);
// }


import android.app.Fragment;
import android.app.FragmentTransaction;
import android.os.Bundle;
import ni3po42.android.tractiondemo.models.DemoFragmentChoice;
import traction.mvc.controllers.FragmentController;
import traction.mvc.interfaces.IObjectListener;
import ni3po42.android.tractiondemo.R;
import ni3po42.android.tractiondemo.models.IDemoSelectionModel;
import traction.mvc.observables.OnPropertyChangedEvent;
/* Copyright 2013 Tim Stratton

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
 */

package ni3po42.android.tractiondemo.controllers;




public class MainController extends FragmentController
{
    public final static String NoMultiViewModelSupport = "multiViewModelSupport";

	@Override
	public void onCreate(Bundle savedInstanceState)
	{	
		super.onCreate(savedInstanceState);
		if (savedInstanceState != null)
			return;
        View.setContentView(R.layout.mainview);
	}

    @Override
    public void onStart() {
        super.onStart();

// Path: Demo/src/main/java/ni3po42/android/tractiondemo/models/DemoFragmentChoice.java
// public class DemoFragmentChoice
// {
// 	private Class<? extends Fragment> fragmentType;
// 	private String name;
// 	private String description;
// 	
// 	public DemoFragmentChoice(Class<? extends Fragment> fragmentType, String name, String description)
// 	{
// 		this.fragmentType = fragmentType;
// 		this.name = name;
// 		this.description = description;
// 	}
// 
// 	public Class<? extends Fragment> getFragmentType()
// 	{
// 		return fragmentType;
// 	}
// 	public void setFragmentType(Class<? extends Fragment> viewModelType)
// 	{
// 		this.fragmentType = viewModelType;
// 	}
// 
//     public Fragment getFragment()
//     {
//         Fragment fragment = null;
//         try
//         {
//             fragment = getFragmentType().newInstance();
//         }
//         catch (Throwable e)
//         {
//         }
//         if (fragment == null)
//             throw new RuntimeException("Cannot find View Model : " + getFragmentType().getName());
//         return fragment;
//     }
// 
// 
// 	public String getName()
// 	{
// 		return name;
// 	}
// 
// 	public void setName(String name)
// 	{
// 		this.name = name;
// 	}
// 
// 	public String getDescription()
// 	{
// 		return description;
// 	}
// 
// 	public void setDescription(String description)
// 	{
// 		this.description = description;
// 	}
// 	
// }
// 
// Path: traction/src/main/java/traction/mvc/controllers/FragmentController.java
// public class FragmentController
// extends Fragment
// {
// 	/**
// 	 * Helper to implement Controller logic.
// 	 */
// 	protected final ControllerHelper View = new ControllerHelper(this);
// 
// 	@Override
// 	public void onCreate(Bundle savedInstanceState)
// 	{	
// 		super.onCreate(savedInstanceState);
// 		setRetainInstance(true);
// 	}
// 	
// 	@Override
// 	public View onCreateView(LayoutInflater notUsed, ViewGroup container, Bundle savedInstanceState) 
// 	{
// 		View v = View.inflateView(View.getContentView(), container, container != null);
//         IViewBinding vb = ViewFactory.getViewBinding(v);
//         if (vb != null) {
//             View.ensureMenuInflator(vb.getBindingInventory());
//         }
//         return v;
// 	}
// 	
// 	@Override
// 	public void onCreateOptionsMenu(Menu menu, MenuInflater inflater)
// 	{
//         View.onCreateOptionsMenu(menu);
// 	}
// 
// 	@Override
// 	public void onDestroyView() 
// 	{		
// 		super.onDestroyView();	
// 		ViewFactory.DetachContext(getView());
// 	}
// 
//     @Override
//     public void onAttach(Activity activity)
//     {
//         super.onAttach(activity);
//         View.registerFragmentToActivity(this, activity);
//     }
// 
//     @Override
//     public void onDetach()
//     {
//         super.onDetach();
//         View.unregisterFragmentFromActivity(this, getActivity());
//     }
// 
//     @Override
//     public void onStart()
//     {
//         super.onStart();
//         View.connectFragmentViewToParentView(this);
//     }
// }
// 
// Path: traction/src/main/java/traction/mvc/interfaces/IObjectListener.java
// public interface IObjectListener
// {
//     public static class Utility
//     {
//         public static String generatePropagationId(String currentPropagationId, String currentSource)
//         {
//             if (currentSource == null || currentSource.equals(""))
//                 return currentPropagationId;
//             else if (currentPropagationId == null || currentPropagationId.equals(""))
//                 return currentSource;
//             else
//                 return currentSource + "." + currentPropagationId;
//         }
//     }
// 
// 	/**
// 	 * Fired when listener is signalled of something, anything really.
// 	 */
//     void onEvent(String propagationId);
// }
// 
// Path: Demo/src/main/java/ni3po42/android/tractiondemo/models/IDemoSelectionModel.java
// public interface IDemoSelectionModel
//     extends IProxyObservableObject
// {
//     List<DemoFragmentChoice> getChoices();
// 
//     Fragment getCurrentFragment();
//     void setCurrentFragment(Fragment fragment);
// 
//     DemoFragmentChoice getChoice();
//     void setChoice(DemoFragmentChoice choice);
// }
// 
// Path: traction/src/main/java/traction/mvc/observables/OnPropertyChangedEvent.java
// public abstract class OnPropertyChangedEvent
//     implements IObjectListener
// {
//     @Override
//     public void onEvent(String propagationId) {
//         //eh, nothing
//     }
// 
//     protected abstract void onChange(String propertyName, Object oldValue, Object newValue);
// }


// Path: Demo/src/main/java/ni3po42/android/tractiondemo/controllers/MainController.java
import android.app.Fragment;
import android.app.FragmentTransaction;
import android.os.Bundle;
import ni3po42.android.tractiondemo.models.DemoFragmentChoice;
import traction.mvc.controllers.FragmentController;
import traction.mvc.interfaces.IObjectListener;
import ni3po42.android.tractiondemo.R;
import ni3po42.android.tractiondemo.models.IDemoSelectionModel;
import traction.mvc.observables.OnPropertyChangedEvent;

/* Copyright 2013 Tim Stratton

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
 */

package ni3po42.android.tractiondemo.controllers;




public class MainController extends FragmentController
{
    public final static String NoMultiViewModelSupport = "multiViewModelSupport";

	@Override
	public void onCreate(Bundle savedInstanceState)
	{	
		super.onCreate(savedInstanceState);
		if (savedInstanceState != null)
			return;
        View.setContentView(R.layout.mainview);
	}

    @Override
    public void onStart() {
        super.onStart();

        final IDemoSelectionModel model = View.getScope();