|  |  | @ -12,9 +12,12 @@ import java.lang.reflect.InvocationTargetException; | 
			
		
	
		
		
			
				
					
					|  |  |  | import java.lang.reflect.Method; |  |  |  | import java.lang.reflect.Method; | 
			
		
	
		
		
			
				
					
					|  |  |  | import java.util.ArrayList; |  |  |  | import java.util.ArrayList; | 
			
		
	
		
		
			
				
					
					|  |  |  | import java.util.HashMap; |  |  |  | import java.util.HashMap; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | import java.util.LinkedList; | 
			
		
	
		
		
			
				
					
					|  |  |  | import java.util.List; |  |  |  | import java.util.List; | 
			
		
	
		
		
			
				
					
					|  |  |  | import java.util.Map; |  |  |  | import java.util.Map; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | import java.util.Queue; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | import javax.swing.DefaultListSelectionModel; | 
			
		
	
		
		
			
				
					
					|  |  |  | import javax.swing.JButton; |  |  |  | import javax.swing.JButton; | 
			
		
	
		
		
			
				
					
					|  |  |  | import javax.swing.JFrame; |  |  |  | import javax.swing.JFrame; | 
			
		
	
		
		
			
				
					
					|  |  |  | import javax.swing.JPanel; |  |  |  | import javax.swing.JPanel; | 
			
		
	
	
		
		
			
				
					|  |  | @ -56,7 +59,7 @@ public class SIPRPWindow extends JFrame implements TrackableWindow, ListSelectio | 
			
		
	
		
		
			
				
					
					|  |  |  | 		 *  |  |  |  | 		 *  | 
			
		
	
		
		
			
				
					
					|  |  |  | 		 * @return |  |  |  | 		 * @return | 
			
		
	
		
		
			
				
					
					|  |  |  | 		 */ |  |  |  | 		 */ | 
			
		
	
		
		
			
				
					
					|  |  |  | 		String onSelect(); |  |  |  | 		String [] onSelect(); | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | 		/** |  |  |  | 		/** | 
			
		
	
		
		
			
				
					
					|  |  |  | 		 * Array of actions to execute when a change is listened in this |  |  |  | 		 * Array of actions to execute when a change is listened in this | 
			
		
	
	
		
		
			
				
					|  |  | @ -64,7 +67,7 @@ public class SIPRPWindow extends JFrame implements TrackableWindow, ListSelectio | 
			
		
	
		
		
			
				
					
					|  |  |  | 		 *  |  |  |  | 		 *  | 
			
		
	
		
		
			
				
					
					|  |  |  | 		 * @return |  |  |  | 		 * @return | 
			
		
	
		
		
			
				
					
					|  |  |  | 		 */ |  |  |  | 		 */ | 
			
		
	
		
		
			
				
					
					|  |  |  | 		String onChange(); |  |  |  | 		String [] onChange(); | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | 	} |  |  |  | 	} | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
	
		
		
			
				
					|  |  | @ -110,8 +113,8 @@ public class SIPRPWindow extends JFrame implements TrackableWindow, ListSelectio | 
			
		
	
		
		
			
				
					
					|  |  |  | 	/** |  |  |  | 	/** | 
			
		
	
		
		
			
				
					
					|  |  |  | 	 * Fields |  |  |  | 	 * Fields | 
			
		
	
		
		
			
				
					
					|  |  |  | 	 */ |  |  |  | 	 */ | 
			
		
	
		
		
			
				
					
					|  |  |  | 	private Map<String, Object> mapWindowOnSelectFieldByActionName = new HashMap<String, Object>(); |  |  |  | 	private Map<String, List<Object>> mapWindowOnSelectFieldByActionName = new HashMap<String, List<Object>>(); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 	private Map<String, Object> mapWindowOnChangeFieldByActionName = new HashMap<String, Object>(); |  |  |  | 	private Map<String, List<Object>> mapWindowOnChangeFieldByActionName = new HashMap<String, List<Object>>(); | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 	private Map<String, Field> mapLeafObjectByActionName = new HashMap<String, Field>(); |  |  |  | 	private Map<String, Field> mapLeafObjectByActionName = new HashMap<String, Field>(); | 
			
		
	
		
		
			
				
					
					|  |  |  | 	private Map<Field, Object> mapInstanceByField = new HashMap<Field, Object>(); |  |  |  | 	private Map<Field, Object> mapInstanceByField = new HashMap<Field, Object>(); | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
	
		
		
			
				
					|  |  | @ -127,6 +130,11 @@ public class SIPRPWindow extends JFrame implements TrackableWindow, ListSelectio | 
			
		
	
		
		
			
				
					
					|  |  |  | 	 */ |  |  |  | 	 */ | 
			
		
	
		
		
			
				
					
					|  |  |  | 	private Map<Object, Annotation> mapAnnotationByObject = new HashMap<Object, Annotation>(); |  |  |  | 	private Map<Object, Annotation> mapAnnotationByObject = new HashMap<Object, Annotation>(); | 
			
		
	
		
		
			
				
					
					|  |  |  | 	 |  |  |  | 	 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	/** | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	 * Run later actions  | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	 */ | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	private Queue<String> listRunLater = new LinkedList<String>(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | 	public SIPRPWindow(SIPRPLogic logicController) throws IllegalArgumentException, IllegalAccessException |  |  |  | 	public SIPRPWindow(SIPRPLogic logicController) throws IllegalArgumentException, IllegalAccessException | 
			
		
	
		
		
			
				
					
					|  |  |  | 	{ |  |  |  | 	{ | 
			
		
	
		
		
			
				
					
					|  |  |  | 		super(); |  |  |  | 		super(); | 
			
		
	
	
		
		
			
				
					|  |  | @ -180,6 +188,8 @@ public class SIPRPWindow extends JFrame implements TrackableWindow, ListSelectio | 
			
		
	
		
		
			
				
					
					|  |  |  | 				{ |  |  |  | 				{ | 
			
		
	
		
		
			
				
					
					|  |  |  | 					mapActionByName.put( value, action ); |  |  |  | 					mapActionByName.put( value, action ); | 
			
		
	
		
		
			
				
					
					|  |  |  | 					mapWindowMethodsByActionName.put( value, new ArrayList<Method>() ); |  |  |  | 					mapWindowMethodsByActionName.put( value, new ArrayList<Method>() ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 					mapWindowOnSelectFieldByActionName.put( value, new ArrayList<Object>() ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 					mapWindowOnChangeFieldByActionName.put( value, new ArrayList<Object>() ); | 
			
		
	
		
		
			
				
					
					|  |  |  | 				} |  |  |  | 				} | 
			
		
	
		
		
			
				
					
					|  |  |  | 			} |  |  |  | 			} | 
			
		
	
		
		
			
				
					
					|  |  |  | 		} |  |  |  | 		} | 
			
		
	
	
		
		
			
				
					|  |  | @ -194,36 +204,43 @@ public class SIPRPWindow extends JFrame implements TrackableWindow, ListSelectio | 
			
		
	
		
		
			
				
					
					|  |  |  | 				ActionActivation componentBehaviour = field.getAnnotation( ActionActivation.class ); |  |  |  | 				ActionActivation componentBehaviour = field.getAnnotation( ActionActivation.class ); | 
			
		
	
		
		
			
				
					
					|  |  |  | 				if( componentBehaviour != null ) |  |  |  | 				if( componentBehaviour != null ) | 
			
		
	
		
		
			
				
					
					|  |  |  | 				{ |  |  |  | 				{ | 
			
		
	
		
		
			
				
					
					|  |  |  | 					String onChange = componentBehaviour.onChange(); |  |  |  | 					String[] allChanges = componentBehaviour.onChange(); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 					// if( onChange != null )
 |  |  |  | 					if( allChanges != null ) | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 					// {
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 					// for( String currentOnChange : onChange )
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 					// {
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 					if( mapActionByName.containsKey( onChange ) ) |  |  |  |  | 
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 					{ |  |  |  | 					{ | 
			
		
	
		
		
			
				
					
					|  |  |  | 						// valid action
 |  |  |  | 						for( String onChange : allChanges ) | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 						mapAnnotationByObject.put( field.get( instance ), componentBehaviour ); |  |  |  | 						{ | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 						mapWindowOnChangeFieldByActionName.put( onChange, field.get( instance ) ); |  |  |  | 							if( mapActionByName.containsKey( onChange ) ) | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 						mapInstanceByField.put( field, instance ); |  |  |  | 							{ | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 						addListenerForField( componentBehaviour, field, instance ); |  |  |  | 								// valid action
 | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 								mapAnnotationByObject.put( field.get( instance ), componentBehaviour ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 								mapWindowOnChangeFieldByActionName.get( onChange ).add( field.get( instance ) ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 								if(!mapInstanceByField.containsKey( field )) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 								{ | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 									addListenerForField( componentBehaviour, field, instance ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 									mapInstanceByField.put( field, instance ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 								} | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 							} | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 						} | 
			
		
	
		
		
			
				
					
					|  |  |  | 					} |  |  |  | 					} | 
			
		
	
		
		
			
				
					
					|  |  |  | 					// }
 |  |  |  | 					 | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 					// }
 |  |  |  | 					String[] allSelect = componentBehaviour.onSelect(); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 					String onSelect = componentBehaviour.onSelect(); |  |  |  | 					if( allSelect != null ) | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 					// if( onSelect != null )
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 					// {
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 					// for( String currentOnSelect : onSelect )
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 					// {
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 					if( mapActionByName.containsKey( onSelect ) ) |  |  |  |  | 
			
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 					{ |  |  |  | 					{ | 
			
		
	
		
		
			
				
					
					|  |  |  | 						// valid action
 |  |  |  | 						for( String onSelect : allSelect ) | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 						mapAnnotationByObject.put( field.get( instance ), componentBehaviour ); |  |  |  | 						{ | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 						mapWindowOnSelectFieldByActionName.put( onSelect, field.get( instance ) ); |  |  |  | 							if( mapActionByName.containsKey( onSelect ) ) | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 						mapInstanceByField.put( field, instance ); |  |  |  | 							{ | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 						addListenerForField( componentBehaviour, field, instance ); |  |  |  | 								// valid action
 | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 								mapAnnotationByObject.put( field.get( instance ), componentBehaviour ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 								mapWindowOnSelectFieldByActionName.get( onSelect ).add( field.get( instance ) ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 								if(!mapInstanceByField.containsKey( field )) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 								{ | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 									addListenerForField( componentBehaviour, field, instance ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 									mapInstanceByField.put( field, instance ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 								} | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 							} | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 						} | 
			
		
	
		
		
			
				
					
					|  |  |  | 					} |  |  |  | 					} | 
			
		
	
		
		
			
				
					
					|  |  |  | 					// }
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 					// }
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 				} |  |  |  | 				} | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | 				LeafObject leafObject = field.getAnnotation( LeafObject.class ); |  |  |  | 				LeafObject leafObject = field.getAnnotation( LeafObject.class ); | 
			
		
	
	
		
		
			
				
					|  |  | @ -275,13 +292,17 @@ public class SIPRPWindow extends JFrame implements TrackableWindow, ListSelectio | 
			
		
	
		
		
			
				
					
					|  |  |  | 			LeafUIActionBinding actionBinding = method.getAnnotation( LeafUIActionBinding.class ); |  |  |  | 			LeafUIActionBinding actionBinding = method.getAnnotation( LeafUIActionBinding.class ); | 
			
		
	
		
		
			
				
					
					|  |  |  | 			if( actionBinding != null ) |  |  |  | 			if( actionBinding != null ) | 
			
		
	
		
		
			
				
					
					|  |  |  | 			{ |  |  |  | 			{ | 
			
		
	
		
		
			
				
					
					|  |  |  | 				String actionName = actionBinding.action(); |  |  |  | 				String [] actions = actionBinding.action(); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 				if( mapActionByName.containsKey( actionName ) ) |  |  |  | 				for(String actionName : actions) | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 				{ |  |  |  | 				{ | 
			
		
	
		
		
			
				
					
					|  |  |  | 					// valid action
 |  |  |  | 					if( mapActionByName.containsKey( actionName ) ) | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 					mapAnnotationByObject.put( method, actionBinding ); |  |  |  | 					{ | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 					mapWindowMethodsByActionName.get( actionName ).add( method ); |  |  |  | 						// valid action
 | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 					mapInstanceByMethod.put( method, instance ); |  |  |  | 						mapWindowMethodsByActionName.get( actionName ).add( method ); | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 						 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 						mapAnnotationByObject.put( method, actionBinding ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 						mapInstanceByMethod.put( method, instance ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 					} | 
			
		
	
		
		
			
				
					
					|  |  |  | 				} |  |  |  | 				} | 
			
		
	
		
		
			
				
					
					|  |  |  | 			} |  |  |  | 			} | 
			
		
	
		
		
			
				
					
					|  |  |  | 		} |  |  |  | 		} | 
			
		
	
	
		
		
			
				
					|  |  | @ -297,10 +318,10 @@ public class SIPRPWindow extends JFrame implements TrackableWindow, ListSelectio | 
			
		
	
		
		
			
				
					
					|  |  |  | 				LeafLogicActionBinding actionBinding = method.getAnnotation( LeafLogicActionBinding.class ); |  |  |  | 				LeafLogicActionBinding actionBinding = method.getAnnotation( LeafLogicActionBinding.class ); | 
			
		
	
		
		
			
				
					
					|  |  |  | 				if( actionBinding != null ) |  |  |  | 				if( actionBinding != null ) | 
			
		
	
		
		
			
				
					
					|  |  |  | 				{ |  |  |  | 				{ | 
			
		
	
		
		
			
				
					
					|  |  |  | 					String [] actions = actionBinding.actions(); |  |  |  | 					String[] actions = actionBinding.actions(); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 					if( actions != null) |  |  |  | 					if( actions != null ) | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 					{ |  |  |  | 					{ | 
			
		
	
		
		
			
				
					
					|  |  |  | 						for(String actionName : actions) |  |  |  | 						for( String actionName : actions ) | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 						{ |  |  |  | 						{ | 
			
		
	
		
		
			
				
					
					|  |  |  | 							if( mapActionByName.containsKey( actionName ) ) |  |  |  | 							if( mapActionByName.containsKey( actionName ) ) | 
			
		
	
		
		
			
				
					
					|  |  |  | 							{ |  |  |  | 							{ | 
			
		
	
	
		
		
			
				
					|  |  | @ -337,7 +358,7 @@ public class SIPRPWindow extends JFrame implements TrackableWindow, ListSelectio | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | 	} |  |  |  | 	} | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | 	private Object getObjectForAction(String actionName) |  |  |  | 	private Object getObjectForAction( String actionName ) | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 	{ |  |  |  | 	{ | 
			
		
	
		
		
			
				
					
					|  |  |  | 		Object result = null; |  |  |  | 		Object result = null; | 
			
		
	
		
		
			
				
					
					|  |  |  | 		Field field = mapLeafObjectByActionName.get( actionName ); |  |  |  | 		Field field = mapLeafObjectByActionName.get( actionName ); | 
			
		
	
	
		
		
			
				
					|  |  | @ -363,21 +384,44 @@ public class SIPRPWindow extends JFrame implements TrackableWindow, ListSelectio | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | 	public void runAction( String actionName ) |  |  |  | 	public void runAction( String actionName ) | 
			
		
	
		
		
			
				
					
					|  |  |  | 	{ |  |  |  | 	{ | 
			
		
	
		
		
			
				
					
					|  |  |  | 		runAction( actionName, null ); |  |  |  | 		runGivenAction( actionName, null ); | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		runPendingActions(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	} | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	public void runAction( String actionName, Object argument) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	{ | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		runGivenAction( actionName, argument ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		runPendingActions(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	} | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	public void runActionLater(String action) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	{ | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		if( action != null && mapActionByName.containsKey( action )) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		{ | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 			listRunLater.add( action ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		} | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	} | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	private void runPendingActions() | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	{ | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		while( listRunLater.size() > 0) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		{ | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 			runAction( listRunLater.poll() ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		} | 
			
		
	
		
		
			
				
					
					|  |  |  | 	} |  |  |  | 	} | 
			
		
	
		
		
			
				
					
					|  |  |  | 	 |  |  |  | 	 | 
			
		
	
		
		
			
				
					
					|  |  |  | 	/** |  |  |  | 	/** | 
			
		
	
		
		
			
				
					
					|  |  |  | 	 * Executes given action |  |  |  | 	 * Executes given action | 
			
		
	
		
		
			
				
					
					|  |  |  | 	 */ |  |  |  | 	 */ | 
			
		
	
		
		
			
				
					
					|  |  |  | 	public void runAction( String actionName, Object argument ) |  |  |  | 	private void runGivenAction( String actionName, Object argument ) | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 	{ |  |  |  | 	{ | 
			
		
	
		
		
			
				
					
					|  |  |  | 		System.out.println("Running: "+actionName); |  |  |  | 		System.out.println( "Running: " + actionName ); | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 		if( actionName != null && mapActionByName.containsKey( actionName ) ) |  |  |  | 		if( actionName != null && mapActionByName.containsKey( actionName ) ) | 
			
		
	
		
		
			
				
					
					|  |  |  | 		{ |  |  |  | 		{ | 
			
		
	
		
		
			
				
					
					|  |  |  | 			Action action = mapActionByName.get( actionName ); |  |  |  | 			Action action = mapActionByName.get( actionName ); | 
			
		
	
		
		
			
				
					
					|  |  |  | 			if( action.isSave() ) |  |  |  | 			if( action.isSave() ) | 
			
		
	
		
		
			
				
					
					|  |  |  | 			{ |  |  |  | 			{ | 
			
		
	
		
		
			
				
					
					|  |  |  | 				Object windowArgument = getObjectForAction(actionName); |  |  |  | 				Object windowArgument = getObjectForAction( actionName ); | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 				Object logicArgument = windowArgument; |  |  |  | 				Object logicArgument = windowArgument; | 
			
		
	
		
		
			
				
					
					|  |  |  | 				for( Method currentWindowMethod : mapWindowMethodsByActionName.get( actionName ) ) |  |  |  | 				for( Method currentWindowMethod : mapWindowMethodsByActionName.get( actionName ) ) | 
			
		
	
		
		
			
				
					
					|  |  |  | 				{ |  |  |  | 				{ | 
			
		
	
	
		
		
			
				
					|  |  | @ -517,75 +561,106 @@ public class SIPRPWindow extends JFrame implements TrackableWindow, ListSelectio | 
			
		
	
		
		
			
				
					
					|  |  |  | 	private Object getArgumentListSelectionEvent( String actionName, ListSelectionEvent event ) |  |  |  | 	private Object getArgumentListSelectionEvent( String actionName, ListSelectionEvent event ) | 
			
		
	
		
		
			
				
					
					|  |  |  | 	{ |  |  |  | 	{ | 
			
		
	
		
		
			
				
					
					|  |  |  | 		Object source = event.getSource(); |  |  |  | 		Object source = event.getSource(); | 
			
		
	
		
		
			
				
					
					|  |  |  | 		Object result = null; |  |  |  | 		List<Object> allComponents = mapWindowOnSelectFieldByActionName.get( actionName ); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 		Object component = mapWindowOnSelectFieldByActionName.get( actionName ); |  |  |  | 		for( Object component : allComponents ) | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 		if( component instanceof BaseTable && ((BaseTable) component).getSelectionModel().equals( source ) ) |  |  |  |  | 
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 		{ |  |  |  | 		{ | 
			
		
	
		
		
			
				
					
					|  |  |  | 			int index = ((BaseTable) component).getSelectedRow(); |  |  |  | 			if( component instanceof BaseTable && ((BaseTable) component).getSelectionModel().equals( source ) ) | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 			if( index > -1 ) |  |  |  |  | 
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 			{ |  |  |  | 			{ | 
			
		
	
		
		
			
				
					
					|  |  |  | 				TableModel model = ((BaseTable) component).getModel(); |  |  |  | 				int index = ((BaseTable) component).getSelectedRow(); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 				if( model instanceof VectorTableModel ) |  |  |  | 				if( index > -1 ) | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 				{ |  |  |  | 				{ | 
			
		
	
		
		
			
				
					
					|  |  |  | 					result = ((ColumnizedMappable) ((VectorTableModel) model).getRowAt( index )).getID(); |  |  |  | 					TableModel model = ((BaseTable) component).getModel(); | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 					if( model instanceof VectorTableModel ) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 					{ | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 						return ((ColumnizedMappable) ((VectorTableModel) model).getRowAt( index )).getID(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 					} | 
			
		
	
		
		
			
				
					
					|  |  |  | 				} |  |  |  | 				} | 
			
		
	
		
		
			
				
					
					|  |  |  | 			} |  |  |  | 			} | 
			
		
	
		
		
			
				
					
					|  |  |  | 		} |  |  |  | 		} | 
			
		
	
		
		
			
				
					
					|  |  |  | 		return result; |  |  |  | 		return null; | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 	} |  |  |  | 	} | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | 	private String getActionListSelectionEvent( ListSelectionEvent event ) |  |  |  | 	private List<String> getActionListSelectionEvent( ListSelectionEvent event ) | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 	{ |  |  |  | 	{ | 
			
		
	
		
		
			
				
					
					|  |  |  | 		for( String actionName : mapWindowOnSelectFieldByActionName.keySet() ) |  |  |  | 		List<String> result = new ArrayList<String>(); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 		{ |  |  |  | 		if( event.getSource() instanceof DefaultListSelectionModel) | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 			Object component = mapWindowOnSelectFieldByActionName.get( actionName ); |  |  |  | 		{ | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 			if( component != null && component instanceof BaseTable && event.getSource().equals( ((BaseTable) component).getSelectionModel() ) ) |  |  |  | 			DefaultListSelectionModel model = (DefaultListSelectionModel) event.getSource(); | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 			BaseTable table = null; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 			for(List<Object> allComponents : mapWindowOnSelectFieldByActionName.values()){ | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 				// for each registered table
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 				for( Object component : allComponents ) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 				{ | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 					if( component instanceof BaseTable && ((BaseTable) component).getSelectionModel().equals( model ) ) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 					{ | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 						table = (BaseTable) component; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 					} | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 					if( table != null) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 					{ | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 						break; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 					} | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 				} | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 				if( table != null) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 				{ | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 					break; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 				} | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 			} | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 			Annotation an = mapAnnotationByObject.get( table ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 			if(an != null && an instanceof ActionActivation) | 
			
		
	
		
		
			
				
					
					|  |  |  | 			{ |  |  |  | 			{ | 
			
		
	
		
		
			
				
					
					|  |  |  | 				return actionName; |  |  |  | 				String [] actions = ((ActionActivation) an).onSelect(); | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 				for( String actionName : actions ) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 				{ | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 					result.add( actionName ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 				} | 
			
		
	
		
		
			
				
					
					|  |  |  | 			} |  |  |  | 			} | 
			
		
	
		
		
			
				
					
					|  |  |  | 		} |  |  |  | 		} | 
			
		
	
		
		
			
				
					
					|  |  |  | 		return null; |  |  |  | 		return result; | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 	} |  |  |  | 	} | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | 	// returns selected node
 |  |  |  | 	// returns selected node
 | 
			
		
	
		
		
			
				
					
					|  |  |  | 	private Object getArgumentTreeSelectionEvent( String actionName, TreeSelectionEvent event ) |  |  |  | 	private Object getArgumentTreeSelectionEvent( String actionName, TreeSelectionEvent event ) | 
			
		
	
		
		
			
				
					
					|  |  |  | 	{ |  |  |  | 	{ | 
			
		
	
		
		
			
				
					
					|  |  |  | 		Object result = null; |  |  |  | 		List<Object> components = mapWindowOnSelectFieldByActionName.get( actionName ); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 		Object component = mapWindowOnSelectFieldByActionName.get( actionName ); |  |  |  | 		for( Object component : components ) | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 		if( component instanceof JTree && event.getPath() != null ) |  |  |  |  | 
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 		{ |  |  |  | 		{ | 
			
		
	
		
		
			
				
					
					|  |  |  | 			Object[] nodes = event.getPath().getPath(); |  |  |  | 			if( component instanceof JTree && event.getPath() != null ) | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 			if( nodes != null && nodes.length > 0 ) |  |  |  |  | 
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 			{ |  |  |  | 			{ | 
			
		
	
		
		
			
				
					
					|  |  |  | 				result = nodes[nodes.length - 1]; |  |  |  | 				Object[] nodes = event.getPath().getPath(); | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 				if( nodes != null && nodes.length > 0 ) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 				{ | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 					return nodes[nodes.length - 1]; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 				} | 
			
		
	
		
		
			
				
					
					|  |  |  | 			} |  |  |  | 			} | 
			
		
	
		
		
			
				
					
					|  |  |  | 		} |  |  |  | 		} | 
			
		
	
		
		
			
				
					
					|  |  |  | 		return result; |  |  |  | 		return null; | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 	} |  |  |  | 	} | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | 	private String getActionTreeSelectionEvent( TreeSelectionEvent event ) |  |  |  | 	private List<String> getActionTreeSelectionEvent( TreeSelectionEvent event ) | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 	{ |  |  |  | 	{ | 
			
		
	
		
		
			
				
					
					|  |  |  | 		for( String actionName : mapWindowOnSelectFieldByActionName.keySet() ) |  |  |  | 		List<String> result = new ArrayList<String>(); | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		Annotation an = mapAnnotationByObject.get( event.getSource() ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		if(an != null && an instanceof ActionActivation) | 
			
		
	
		
		
			
				
					
					|  |  |  | 		{ |  |  |  | 		{ | 
			
		
	
		
		
			
				
					
					|  |  |  | 			Object component = mapWindowOnSelectFieldByActionName.get( actionName ); |  |  |  | 			String [] actions = ((ActionActivation) an).onSelect(); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 			if( component != null && component instanceof JTree && event.getSource().equals( component ) ) |  |  |  | 			for( String actionName : actions ) | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 			{ |  |  |  | 			{ | 
			
		
	
		
		
			
				
					
					|  |  |  | 				return actionName; |  |  |  | 				result.add( actionName ); | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 			} |  |  |  | 			} | 
			
		
	
		
		
			
				
					
					|  |  |  | 		} |  |  |  | 		} | 
			
		
	
		
		
			
				
					
					|  |  |  | 		return null; |  |  |  | 		return result; | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 	} |  |  |  | 	} | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | 	private String getActionActionEvent( ActionEvent event ) |  |  |  | 	private List<String> getActionActionEvent( ActionEvent event ) | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 	{ |  |  |  | 	{ | 
			
		
	
		
		
			
				
					
					|  |  |  | 		String result = null; |  |  |  | 		List<String> result = new ArrayList<String>(); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 		for( String actionName : mapWindowOnSelectFieldByActionName.keySet() ) |  |  |  | 		Annotation an = mapAnnotationByObject.get( event.getSource() ); | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		if(an != null && an instanceof ActionActivation) | 
			
		
	
		
		
			
				
					
					|  |  |  | 		{ |  |  |  | 		{ | 
			
		
	
		
		
			
				
					
					|  |  |  | 			Object component = mapWindowOnSelectFieldByActionName.get( actionName ); |  |  |  | 			String [] actions = ((ActionActivation) an).onSelect(); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 			if( event.getSource().equals( component ) ) |  |  |  | 			for( String actionName : actions ) | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 			{ |  |  |  | 			{ | 
			
		
	
		
		
			
				
					
					|  |  |  | 				result = actionName; |  |  |  | 				result.add( actionName ); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 				break; |  |  |  |  | 
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 			} |  |  |  | 			} | 
			
		
	
		
		
			
				
					
					|  |  |  | 		} |  |  |  | 		} | 
			
		
	
		
		
			
				
					
					|  |  |  | 		return result; |  |  |  | 		return result; | 
			
		
	
	
		
		
			
				
					|  |  | @ -594,9 +669,12 @@ public class SIPRPWindow extends JFrame implements TrackableWindow, ListSelectio | 
			
		
	
		
		
			
				
					
					|  |  |  | 	@Override |  |  |  | 	@Override | 
			
		
	
		
		
			
				
					
					|  |  |  | 	public void valueChanged( TreeSelectionEvent event ) |  |  |  | 	public void valueChanged( TreeSelectionEvent event ) | 
			
		
	
		
		
			
				
					
					|  |  |  | 	{ |  |  |  | 	{ | 
			
		
	
		
		
			
				
					
					|  |  |  | 		String actionName = getActionTreeSelectionEvent( event ); |  |  |  | 		List<String> actions= getActionTreeSelectionEvent( event ); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 		Object argument = getArgumentTreeSelectionEvent( actionName, event ); |  |  |  | 		for( String action : actions ) | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 		runAction( actionName, argument ); |  |  |  | 		{ | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 			Object argument = getArgumentTreeSelectionEvent( action, event ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 			runAction( action, argument ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		} | 
			
		
	
		
		
			
				
					
					|  |  |  | 	} |  |  |  | 	} | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | 	/** |  |  |  | 	/** | 
			
		
	
	
		
		
			
				
					|  |  | @ -607,16 +685,22 @@ public class SIPRPWindow extends JFrame implements TrackableWindow, ListSelectio | 
			
		
	
		
		
			
				
					
					|  |  |  | 	{ |  |  |  | 	{ | 
			
		
	
		
		
			
				
					
					|  |  |  | 		if( !event.getValueIsAdjusting() ) |  |  |  | 		if( !event.getValueIsAdjusting() ) | 
			
		
	
		
		
			
				
					
					|  |  |  | 		{ |  |  |  | 		{ | 
			
		
	
		
		
			
				
					
					|  |  |  | 			String actionName = getActionListSelectionEvent( event ); |  |  |  | 			List<String> actionNames = getActionListSelectionEvent( event ); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 			Object argument = getArgumentListSelectionEvent( actionName, event ); |  |  |  | 			for( String action : actionNames ) | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 			runAction( actionName, argument ); |  |  |  | 			{ | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 				Object argument = getArgumentListSelectionEvent(action, event); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 				runAction( action, argument ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 			} | 
			
		
	
		
		
			
				
					
					|  |  |  | 		} |  |  |  | 		} | 
			
		
	
		
		
			
				
					
					|  |  |  | 	} |  |  |  | 	} | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | 	@Override |  |  |  | 	@Override | 
			
		
	
		
		
			
				
					
					|  |  |  | 	public void actionPerformed( ActionEvent event ) |  |  |  | 	public void actionPerformed( ActionEvent event ) | 
			
		
	
		
		
			
				
					
					|  |  |  | 	{ |  |  |  | 	{ | 
			
		
	
		
		
			
				
					
					|  |  |  | 		String actionName = getActionActionEvent( event ); |  |  |  | 		List<String> actionName = getActionActionEvent( event ); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 		runAction( actionName, null ); |  |  |  | 		for( String action : actionName ) | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		{ | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 			runAction( action, null ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		} | 
			
		
	
		
		
			
				
					
					|  |  |  | 	} |  |  |  | 	} | 
			
		
	
		
		
			
				
					
					|  |  |  | } |  |  |  | } | 
			
		
	
	
		
		
			
				
					|  |  | 
 |