Index: /other-projects/GlamED/trunk/src/org/honours/Main.java
===================================================================
--- /other-projects/GlamED/trunk/src/org/honours/Main.java	(revision 26588)
+++ /other-projects/GlamED/trunk/src/org/honours/Main.java	(revision 26588)
@@ -0,0 +1,392 @@
+package org.honours;
+
+import java.awt.Point;
+import java.io.File;
+import java.util.HashSet;
+import java.util.Set;
+import java.util.concurrent.CopyOnWriteArrayList;
+
+import javax.swing.SwingUtilities;
+
+import org.expeditee.actions.Actions;
+import org.expeditee.gui.*;
+import org.expeditee.items.*;
+
+import org.honours.collection.*;
+import org.honours.greenstone.ArchiveFileReader;
+import org.honours.gui.*;
+
+/**
+ * Main class for the cultural collections
+ * management system.
+ * @author Korii
+ */
+public class Main {
+	
+	public static CopyOnWriteArrayList<Collection> _collections = new CopyOnWriteArrayList<Collection>();
+	
+	public static final String SYSTEM_FRAMESET_NAME = "Honours";
+	
+	//TODO: Write a script to set up an environment variable which lasts during runtime.
+	public static final String GSDL_HOME = "C:\\Research\\Pei-Jones-Taonga\\expeditee-svn\\images\\greenstone3-svn4\\web";
+	
+	//
+	public static final String GSDL_COLLECT_PATH = GSDL_HOME + File.separator + "sites" + File.separator + "localsite" +
+			File.separator + "collect" + File.separator;
+	
+	public static Frame _profile;
+	
+	//position of assocfilepath annotation on the frame
+	public static final int _assocfilePathXpos = 175;
+	public static final int _assocfilePathYpos = 101;
+	
+	/**
+	 * Initialize settings and other things for the system.
+	 */
+	public static void initialize(){
+		
+		SwingUtilities.invokeLater(new Runnable(){
+			
+			public void run(){
+				loadSettings();
+			}
+		});
+		
+	}
+	
+	/**
+	 * Load settings required for the system.
+	 */
+	private static void loadSettings(){
+		
+		MessageBay.displayMessage("Initializing System...");
+		
+		Frame profile = FrameIO.LoadProfile(SYSTEM_FRAMESET_NAME);
+		
+		if(profile == null){
+			
+			try{
+				profile = FrameIO.CreateNewProfile(SYSTEM_FRAMESET_NAME);
+			}catch(Exception e){
+				e.printStackTrace();
+				MessageBay.errorMessage("ERROR: Unable to load profile.");
+				return;
+			}
+		}
+		
+		assert(profile != null);
+		
+		_profile = profile;
+		
+		if(DisplayIO.getCurrentFrame() != _profile)
+			DisplayIO.setCurrentFrame(_profile, true);
+		
+		//Set up main overlay display
+		Interfaces.setUpMainOverlay(_profile);
+		
+		UserSettings.UserName = "honours";
+		
+		initializeMainFramesets();
+		
+		addActionsAndAgents();
+		addCustomMouseActions();
+		addCustomKeyboardActions();
+		
+		try{
+			setUpCollectionObjects();
+		}catch(Exception e){
+			e.printStackTrace();
+			
+			MessageBay.errorMessage("ERROR: Unable to load collection objects.");
+			return;
+		}
+		
+		MessageBay.displayMessage("System initialized and is now ready for use.");
+		System.err.println("Collections available: " + _collections.size());
+		
+		if(_collections.size() > 0){
+			System.err.println("*** " + _collections.get(0).getItems().size());
+		}
+	}
+	
+	/**
+	 * Set up collection objects which last for entire runtime.
+	 * A "Collections" directory has been specially created where
+	 * collection framesets from GSDL are kept. This method will only
+	 * search this directory for collections (and not any other directories
+	 * where framesets are kept).
+	 * @throws Exception
+	 */
+	private static void setUpCollectionObjects() throws Exception{
+		
+		//File collectionsDir = new File(HonoursFrameIO.COLLECTIONS_PATH);
+		
+		File collectionsDir = new File(FrameIO.FRAME_PATH);
+		
+		if(collectionsDir.isDirectory()){
+			
+			//return list of folders in collections directory
+			File[] folders = collectionsDir.listFiles();
+			
+			for(File f : folders){
+				
+				if(!f.isDirectory())
+					continue;
+				
+				String fName = f.getName();
+				
+				if(fName.equals("collectionsmain") || fName.equals("exhibitionsmain") || fName.equals("interface-overlays") || fName.equals("notesmain") || fName.equals("documentation")){
+					continue;
+				}
+				
+				Collection collect = obtainCollectionItems(fName);
+				
+				if(collect.getItems().size() == 0)
+					continue;
+				
+				_collections.add(collect);
+				
+			}
+			
+			for(Collection c : _collections){
+				
+				for(CollectionItem cItem : c.getItems()){
+					Interfaces.setUpToolbarOverlay(cItem);
+					Interfaces.setUpToggleToolbarOverlay(cItem);
+					Interfaces.setUpNotesOverlay(cItem);
+					//Interfaces.setUpBox(cItem);
+				}
+			}
+			
+			MessageBay.displayMessage("Interfaces for collection items initialized.");
+		}
+
+	}
+	
+	/**
+	 * This method obtains all frames in a "collection" frameset
+	 * and converts them to collection item objects. These items are
+	 * then added to a collection object.
+	 * @param collectName
+	 * @return
+	 */
+	public static Collection obtainCollectionItems(String collectName){
+		
+		Collection collect = new Collection(collectName);
+		CollectionInformation cInfo = new CollectionInformation();
+		
+		//Having an issue here when running ImportCollections agent.
+		//int last = FrameIO.LoadLast(collectName,HonoursFrameIO.COLLECTIONS_PATH).getNumber();
+		int last = FrameIO.getLastNumber(collectName);
+		
+		//TODO: Add content layering stuff back in once I get just normal
+		//loading of collection items working.
+		for(int i = 1; i <= last; i++){
+			
+			//Frame curr = FrameIO.LoadFrame(collectName + i, HonoursFrameIO.COLLECTIONS_PATH);
+			Frame curr = FrameIO.LoadFrame(collectName + i);
+			
+			if(curr == null)
+				continue;
+			
+			String assoc = getAssocFilePath(curr);
+			
+			if(assoc == null)
+				continue;
+			
+			CollectionItem cItem = new CollectionItem();
+			cItem.setFrame(curr);
+			
+			cInfo.addRow("I", curr.getName(), assoc);
+			
+			String docXML = GSDL_COLLECT_PATH + collectName + File.separator + "archives" + File.separator + assoc + File.separator + "doc.xml";
+			
+			cItem.setDocXML(docXML);
+			
+			ArchiveFileReader afr = new ArchiveFileReader(docXML);
+			
+			//System.err.println("*** assoc = " + assoc);
+			//System.err.println("*** docXML = " + docXML);
+			
+			String[] splitAssocFileName = afr.obtainElementText("gsdlassocfile").split(":");
+			
+			String assocFileName = GSDL_COLLECT_PATH + collectName + File.separator + 
+					"index" + File.separator + "assoc" + File.separator + assoc + File.separator + splitAssocFileName[0];
+			
+			cItem.setAssocfilePath(assoc);
+			cItem.setAssociatedFile(assocFileName);
+			//setInExpeditee(docXML);
+			
+			collect.addItem(cItem);
+		}
+		
+		cInfo.sort();
+		collect.setCollectionInformation(cInfo);
+		return collect;
+	}
+	
+	/**
+	 * This method extracts a text annotation on the passed frame
+	 * which contains an assocfilepath metadata value 
+	 * (e.g. "@assocfilepath HASH0170.dir"). Each frame/collection item
+	 * has its own unique assocfilepath value.
+	 * TODO: There is a bug in GSDL that is affecting this code here... The 
+	 * assocfilepath metadata is being displayed as "HASH0170, HASH0170" for example
+	 * when it should only be displayed as "HASH0170.
+	 * @param curr - the frame to extract the assocfilepath text annotation from.
+	 * @return - the assocfilepath value. If none is found, return null.
+	 */
+	private static String getAssocFilePath(Frame curr){
+		
+		String splitString = null;
+		
+		for(Item item : curr.getItems()){
+			if(item instanceof Text){
+				Text text = (Text) item;
+				
+				if(text.getText().startsWith("@assocfilepath")){
+					
+					String[] split = text.getText().split(" ");
+					
+					if(splitString == null){
+						splitString = split[1];
+					
+						//remove a comma that may be at the end of the string.
+						if(splitString.endsWith(",")){
+							splitString = splitString.substring(0, splitString.length()-1);
+						}
+					}
+					
+					//do this so that no one can edit/delete 
+					//assocfilepath annotation.
+					item.setPermission(UserAppliedPermission.none);
+					
+					//Shift item to position (3,129).
+					if(item.getX() != _assocfilePathXpos && item.getY() != _assocfilePathYpos)
+						item.setPosition(new Point(_assocfilePathXpos,_assocfilePathYpos));
+					
+					if(item.getSize() != 14)
+						item.setSize(14);
+					
+					curr.setSaved();
+					curr.setChanged(true);
+				}
+			}
+		}
+		return splitString;
+	}
+	
+	/**
+	 * Initialize (currently three) main framesets:
+	 * collections,exhibitions,notes.
+	 */
+	private static void initializeMainFramesets(){
+		
+		//NOTE: CollectionsMain not to be confused with the collections
+		//directory where all collection framesets are stored.
+		String[] mainFramesetNames = new String[]{"CollectionsMain","ExhibitionsMain","NotesMain"};
+		
+		//TODO: might be better just to check frameset directory
+		//instead of trying to load frames...
+		for(String s : mainFramesetNames){
+			Frame frame = FrameIO.LoadFrame(s + "1");
+			
+			if(frame == null){
+				try{
+					FrameIO.CreateNewFrameset(s);
+				}catch(Exception e){
+					e.printStackTrace();
+				}
+			}
+		}
+		
+		MessageBay.displayMessage("Main framesets initialized.");
+	}
+	
+	/**
+	 * Method to load and set up actions and agents for this system.
+	 */
+	@SuppressWarnings("rawtypes")
+	private static void addActionsAndAgents(){
+		
+		Actions.Init();
+		
+		Set<String> agents = new HashSet<String>();
+		try{
+			for(Class c : Actions.getClasses("org.honours.agents.")){
+				if(c != null){
+					agents.add(c.getName());
+				}else{
+					throw new ClassNotFoundException("ERROR: No class found.");
+				}
+			}
+			
+		}catch(ClassNotFoundException e){
+			e.printStackTrace();
+		}
+		
+		Actions.addAgents(agents);
+		
+		try{
+			for(Class c : Actions.getClasses("org.honours.actions.")){
+				
+				if(c != null)
+					Actions.LoadMethods(c);
+				else
+					throw new ClassNotFoundException("ERROR: No class found.");
+			}
+		}catch(ClassNotFoundException e){
+			e.printStackTrace();
+		}
+		
+		MessageBay.displayMessage("Actions and agents initialized.");
+	}
+	
+	/**
+	 * Method to add custom mouse actions for this system.
+	 * These extend on Expedite's mouse actions.
+	 */
+	private static void addCustomMouseActions(){
+		
+		MouseActions mouseActions = MouseActions.getInstance();
+		
+		Browser._theBrowser.getMouseEventRouter().removeExpediteeMouseListener(FrameMouseActions.getInstance());
+		Browser._theBrowser.getMouseEventRouter().addExpediteeMouseListener(mouseActions);
+		Browser._theBrowser.getMouseEventRouter().removeExpediteeMouseMotionListener(FrameMouseActions.getInstance());
+		Browser._theBrowser.getMouseEventRouter().addExpediteeMouseMotionListener(mouseActions);
+		
+		MessageBay.displayMessage("Mouse actions initialized");
+	}
+	
+	/**
+	 * Method to add custom keyboard actions for this system.
+	 * These extend on Expeditee's keyboard actions.
+	 */
+	private static void addCustomKeyboardActions(){
+		
+		KeyboardActions keyboardActions = KeyboardActions.getInstance();
+		Browser._theBrowser.removeKeyListener(FrameKeyboardActions.getInstance());
+		Browser._theBrowser.addKeyListener(keyboardActions);
+		
+		Browser._theBrowser.getContentPane().removeKeyListener(FrameKeyboardActions.getInstance());
+		Browser._theBrowser.getContentPane().addKeyListener(keyboardActions);
+		
+		MessageBay.displayMessage("Keyboard actions initialized");
+	}
+
+	/**
+	 * Main entry point for this system.
+	 * @param args - any arguments passed to this system will be passed to the Expeditee browser.
+	 */
+	public static void main(final String[] args){
+		
+		Browser.main(args);
+		
+		SwingUtilities.invokeLater(new Runnable(){
+			public void run(){
+				initialize();
+			}
+		});
+	}
+	
+}
Index: /other-projects/GlamED/trunk/src/org/honours/actions/ApplyDisplayToCollection.java
===================================================================
--- /other-projects/GlamED/trunk/src/org/honours/actions/ApplyDisplayToCollection.java	(revision 26588)
+++ /other-projects/GlamED/trunk/src/org/honours/actions/ApplyDisplayToCollection.java	(revision 26588)
@@ -0,0 +1,80 @@
+package org.honours.actions;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.expeditee.gui.*;
+import org.expeditee.items.Dot;
+import org.expeditee.items.Item;
+import org.expeditee.items.ItemParentStateChangedEvent;
+import org.expeditee.items.Line;
+import org.expeditee.items.Picture;
+import org.expeditee.items.Text;
+import org.honours.collection.Collection;
+import org.honours.collection.CollectionItem;
+import org.honours.items.Data;
+
+/**
+ * When editing the display of the current frame in
+ * a collection set, change all the other frames so they
+ * look the same.
+ * @author Korii
+ */
+public class ApplyDisplayToCollection {
+
+	/*the manually changed frame which we compare 
+	with all the other frames in the frameset.*/
+	private static Frame _comparisonFrame;	
+	private static List<Item> _comparisonFrameItems; //items on the comparison frame.
+	
+	private static Collection _collection;
+	
+	/**
+	 * Updates all frames based on the current frame being viewed.
+	 */
+	public static void updateAllFrames(){
+		updateAllFrames(DisplayIO.getCurrentFrame());
+	}
+	
+	/**
+	 * Updates all frames based on the passed frame.
+	 * @param frame - the frame used to change the display of 
+	 * the other frames in the same frameset.
+	 */
+	public static void updateAllFrames(Frame frame){
+		
+		if(frame == null){
+			MessageBay.errorMessage("ERROR: Can't update display. Item cannot be found.");
+			return;
+		}
+		
+		_comparisonFrame = frame;
+		
+		_comparisonFrameItems = _comparisonFrame.getItems();
+		
+		//Find matching collection.
+		_collection = Collection.findCollection(_comparisonFrame);
+		
+		for(CollectionItem ci : _collection.getItems()){
+			Frame currCiFrame = ci.getFrame();
+			if(currCiFrame == DisplayIO.getCurrentFrame())
+				continue;
+			
+			MessageBay.displayMessage("Updating display of: " + currCiFrame.getName());
+			changeItemDisplay(ci,currCiFrame);
+		}
+		
+	}
+	
+	/**
+	 * Change the passed Collection Item's display.
+	 * @param ci - the collection item, whose display we want to change.
+	 * @param frame - the collection item's frame representation.
+	 */
+	private static void changeItemDisplay(CollectionItem ci, Frame frame){
+		
+		List<Item> list = frame.getItems(true);
+		List<Item> saved = new ArrayList<Item>();
+	}
+	
+}
Index: /other-projects/GlamED/trunk/src/org/honours/actions/CollectionNavigation.java
===================================================================
--- /other-projects/GlamED/trunk/src/org/honours/actions/CollectionNavigation.java	(revision 26588)
+++ /other-projects/GlamED/trunk/src/org/honours/actions/CollectionNavigation.java	(revision 26588)
@@ -0,0 +1,305 @@
+package org.honours.actions;
+
+import java.awt.Color;
+import java.util.List;
+
+import org.expeditee.actions.Navigation;
+import org.expeditee.gui.DisplayIO;
+import org.expeditee.gui.Frame;
+import org.expeditee.gui.FrameIO;
+import org.expeditee.gui.MessageBay;
+import org.honours.agents.CollectionToGreenstone;
+import org.honours.collection.*;
+
+public class CollectionNavigation {
+
+	//TODO: Change these actions so that we 
+	//account for content layers.
+	public static void Previous(Frame frame)
+	{
+		String frameSetName = frame.getFramesetName();
+		int frameNum= frame.getNumber();
+		
+		int lastInFrame = FrameIO.getLastNumber(frameSetName);
+		if(frameNum == 1){
+			Navigation.Goto(frameSetName+lastInFrame);
+		}else{
+			frameNum--;
+			Navigation.Goto(frameSetName + frameNum);
+			
+		}
+	}
+	
+	public static void PreviousItem(){
+		PreviousItem(DisplayIO.getCurrentFrame());
+	}
+	
+	public static void NextItem(){
+		NextItem(DisplayIO.getCurrentFrame());
+	}
+	
+	public static void NextItem(Frame frame){
+		
+		System.err.println("Reached Next Item....");
+		Collection collection = Collection.findCollection(frame);
+		System.err.println("Collection is: " + collection.getName());
+		
+		if(collection != null){
+			List<CollectionItem> lci = collection.getItems();
+			boolean hit = false;
+			int i = 0;
+			CollectionItem navigateTo = null;
+			
+			while(i < lci.size() && !hit){
+				CollectionItem ci = lci.get(i);
+				
+				/*if(ci.getFrame() == frame){
+					
+					if(i == lci.size()-1){
+						navigateTo = lci.get(0);
+					}else{
+						navigateTo = lci.get(i+1);
+					}
+					hit = true;
+				}*/
+				if(ci.getFrame().getName().equals(frame.getName())){
+					
+					if(i == lci.size() -1){
+						navigateTo = lci.get(0);
+					}else{
+						navigateTo = lci.get(i+1);
+					}
+					hit = true;
+				}
+				i++;
+			}
+			
+			if(hit){
+				Navigation.Goto(navigateTo.getFrame().getName());
+			}
+		}
+	}
+	
+	
+	/**
+	 * Just like Previous() method above but
+	 * we navigate to the previous CollectionItem (as
+	 * opposed to the previous frame).
+	 * @param frame
+	 */
+	public static void PreviousItem(Frame frame){
+		
+		Collection collection = Collection.findCollection(frame);
+
+		if(collection != null){
+			
+			List<CollectionItem> lci = collection.getItems();
+			boolean hit = false;
+			int i = 0;
+			CollectionItem navigateTo = null;
+			
+			while(i < lci.size() && !hit){
+				
+				CollectionItem ci = lci.get(i);
+				
+				if(ci.getFrame().getName().equals(frame.getName()))
+				{
+					if(i == 0)
+						navigateTo = lci.get(lci.size()-1);
+					else
+						navigateTo = lci.get(i-1);
+					
+					hit = true;
+				}
+				
+				i++;
+			}
+			
+			if(hit){
+				Navigation.Goto(navigateTo.getFrame().getName());
+			}
+			
+		}else{
+			MessageBay.errorMessage("ERROR: Collection can't be found");
+			return;
+		}
+	}
+	
+	/**
+	 * Navigate to next frame visited in collection space.
+	 * @param frame
+	 */
+	public static void Next(Frame frame){
+		
+		String frameSetName = frame.getFramesetName();
+		int frameNum = frame.getNumber();
+		
+		int lastInFrame = FrameIO.getLastNumber(frameSetName);
+		
+		if(frameNum == lastInFrame){
+			Navigation.Goto(frameSetName+"1");
+		}else{
+			frameNum++;
+			Navigation.Goto(frameSetName+frameNum);
+		}
+	}
+	
+	public static void NextInCollection(){
+		Next(DisplayIO.getCurrentFrame());
+	}
+	
+	public static void PreviousInCollection(){
+		Previous(DisplayIO.getCurrentFrame());
+	}
+	
+/*	public static void GoToCollectionSpace(){
+		Frame currFrame = DisplayIO.getCurrentFrame();
+		
+		Collection matchingCollection = Collection.findCollection(currFrame);
+		CollectionSpace collectionSpace;
+		
+		
+		//Obtain the collection's collectionSpace.
+		if(matchingCollection != null){
+			collectionSpace = matchingCollection.getCollectionSpace();
+			if(collectionSpace != null){
+				Navigation.Goto(collectionSpace.getName());
+				return;
+			}
+		}else{
+			return;
+		}
+		
+		//Otherwise need to produce one.
+		MessageBay.displayMessage("Now generating new collection space...", Color.blue);
+		collectionSpace = new CollectionSpace(matchingCollection);
+		
+		//TODO:Run generate() method.
+		collectionSpace.generate();
+	}*/
+	
+	
+	public static void UpdateCollectionAction(){
+		org.honours.agents.UpdateCollection uc = 
+				new org.honours.agents.UpdateCollection();
+		uc.process(DisplayIO.getCurrentFrame());
+	}
+	
+	public static void ExportToGreenstoneAction(){
+		CollectionToGreenstone ctg = new
+				CollectionToGreenstone();
+		ctg.process(DisplayIO.getCurrentFrame());
+		
+	}
+	
+	/**
+	 * Used to navigate away from a layer
+	 * back to the associated item.
+	 */
+/*	public static void BackToItem(){
+		BackToItem(DisplayIO.getCurrentFrame());
+	}*/
+	
+	/**
+	 * Used to navigate back to an item when
+	 * we are currently viewing a layer of that item.
+	 * @param frame
+	 */
+/*	public static void BackToItem(Frame frame){
+		
+		ContentLayer thisLayer = null;
+		CollectionItem layerParent = null;
+		
+		Frame goTo = null;
+		
+		Collection findCollection = Collection.findCollection(frame.getFramesetName());
+		
+		if(findCollection != null)
+			thisLayer = ContentLayer.findItemLayer(frame,findCollection);
+		
+		if(thisLayer != null)
+			layerParent = thisLayer.getAssociatedItem();
+		
+		goTo = layerParent.getFrame();
+		
+		Navigation.Goto(goTo.getName());
+	}*/
+	
+	/////////////////
+	
+	/**
+	 * Used to navigate to an image layer frame.
+	 */
+/*	public static void NavigateToImageLayer(){
+		NavigateToImageLayer(DisplayIO.getCurrentFrame());
+	}*/
+	
+/*	public static void NavigateToImageLayer(Frame frame){
+		
+		CollectionItem cItem = null;
+		Frame goTo = null;
+		Collection findCollection = Collection.findCollection(frame);
+		LAYER_TYPE textType = LAYER_TYPE.IMAGE;
+		
+		if(findCollection != null)
+			cItem = CollectionItem.findCollectionItem(frame, findCollection);
+		
+		if(cItem != null){
+			//get layers
+			List<ContentLayer> layers = cItem.getLayers();
+			
+			if(layers.size() > 0)
+				for(ContentLayer cl : layers)
+					if(cl.getLayerType() == textType)
+						goTo = cl.getFrame();
+					
+		}
+		
+		if(goTo != null)
+			Navigation.Goto(goTo.getName());
+	}*/
+	
+	//////////////////////
+	
+	/**
+	 * Used to navigate to a text layer item.
+	 */
+/*	public static void NavigateToTextLayer(){
+		NavigateToTextLayer(DisplayIO.getCurrentFrame());
+	}*/
+	
+	/**
+	 * TODO: REFACTOR this and NavigateToTextLayer() method.
+	 * @param frame
+	 */
+/*	public static void NavigateToTextLayer(Frame frame){
+		CollectionItem cItem = null;
+		Frame goTo = null;
+		LAYER_TYPE textType = LAYER_TYPE.TEXT;
+		
+		Collection findCollection = Collection.findCollection(frame);
+		
+		if(findCollection != null)
+			cItem = CollectionItem.findCollectionItem(frame, findCollection);
+		
+		if(cItem != null){
+			//get layers.
+			List<ContentLayer> layers = cItem.getLayers();
+			
+			if(layers.size() > 0){
+				for(ContentLayer cl : layers){
+					
+					if(cl.getLayerType() == textType)
+						goTo = cl.getFrame();
+				}
+			}
+		}
+		
+		if(goTo != null){
+			Navigation.Goto(goTo.getName());
+		}
+	}*/
+	
+
+	
+}
Index: /other-projects/GlamED/trunk/src/org/honours/actions/ImportCollectionActions.java
===================================================================
--- /other-projects/GlamED/trunk/src/org/honours/actions/ImportCollectionActions.java	(revision 26588)
+++ /other-projects/GlamED/trunk/src/org/honours/actions/ImportCollectionActions.java	(revision 26588)
@@ -0,0 +1,20 @@
+package org.honours.actions;
+
+import org.honours.agents.ImportCollections;
+
+/**
+ * This allows the user to only import 
+ * collections from GSDL (or wherever) 
+ * into Expeditee. If the user wants to
+ * update a collection then they will need
+ * to use the "Update Collection" option.
+ * @author Korii - 26/08/2012
+ */
+public class ImportCollectionActions {
+
+	public static void ImportCollection(){
+		ImportCollections ic = new ImportCollections();
+		ic.process(null);
+	}
+	
+}
Index: /other-projects/GlamED/trunk/src/org/honours/actions/MiscActions.java
===================================================================
--- /other-projects/GlamED/trunk/src/org/honours/actions/MiscActions.java	(revision 26588)
+++ /other-projects/GlamED/trunk/src/org/honours/actions/MiscActions.java	(revision 26588)
@@ -0,0 +1,155 @@
+package org.honours.actions;
+
+import java.awt.Color;
+
+import org.expeditee.actions.Actions;
+import org.expeditee.gui.DisplayIO;
+import org.expeditee.gui.Frame;
+import org.expeditee.gui.FrameIO;
+import org.expeditee.gui.FrameKeyboardActions;
+import org.expeditee.gui.MessageBay;
+import org.expeditee.items.Text;
+import org.honours.Main;
+import org.honours.collection.Collection;
+import org.honours.collection.CollectionItem;
+import org.honours.collection.NoteLayer;
+import org.honours.gui.HonoursFrameIO;
+
+public class MiscActions {
+
+	/**
+	 * Copy items on a frame which
+	 * can be pasted on another frame.
+	 */
+	public static void CopyFrame(){
+		HonoursFrameIO.CopyFrame();
+	}
+	
+	/**
+	 * Paste a copied frame on to
+	 * the current frame being displayed.
+	 */
+	public static void PasteFrame(){
+		HonoursFrameIO.PasteFrame();
+	}
+	
+	/**
+	 * Toggle toolbar on and off.
+	 */
+	public static void ToggleToolbar(){
+		
+		HonoursFrameIO.ToggleToolbar();
+	}
+	
+	/**
+	 * Toggle display of toggle toolbar on and off.
+	 */
+	public static void ToggleToggler(){
+		HonoursFrameIO.toggleToggler();
+	}
+	
+	/**
+	 * Toggle display of layers on and off.
+	 */
+/*	public static void ToggleDisplayLayers(){
+		HonoursFrameIO.ToggleLayersDisplay();
+		
+		if(HonoursFrameIO.DISPLAY_LAYERS)
+			MessageBay.displayMessage("Display of layers on");
+		else
+			MessageBay.displayMessage("Display of layers off");
+	}*/
+	
+	
+	///////////
+	
+	public static void AddNewNote(){
+		System.err.println("REACHED");
+		AddNewNote(DisplayIO.getCurrentFrame());
+		Actions.PerformActionCatchErrors(DisplayIO.getCurrentFrame(), null, "Format");
+	}
+	
+	public static void AddNewNote(Frame frame){
+		Collection collect = Collection.findCollection(frame);
+
+		if(collect != null){
+			CollectionItem cItem = CollectionItem.findCollectionItem(frame, collect);
+			if(cItem != null)
+				AddNewNote(cItem,collect);
+		}
+	}
+	
+	/**
+	 * Add a new note about a collection item which will be displayed
+	 * on the item's frame.
+	 * @param collectItem
+	 * @param collect
+	 */
+	public static void AddNewNote(CollectionItem collectItem, Collection collect){
+
+		NoteLayer noteLayer = null;
+		
+		//Check if collectionItem has a notelayer.
+		if(collectItem.getNoteLayer() != null){
+			noteLayer = collectItem.getNoteLayer();
+			
+		}else{
+			//Create a new note layer.
+			noteLayer = new NoteLayer();
+			noteLayer.setAssociatedItem(collectItem);
+			
+			//Create a new frame and set noteLayer's frame attribute.
+			int frameNumber = FrameIO.getLastNumber("notesmain") + 1;
+			HonoursFrameIO.generateFrame(frameNumber, "notesmain");
+			Frame layerFrame = FrameIO.LoadFrame("notesmain"+frameNumber);
+			noteLayer.setFrame(layerFrame);
+			noteLayer.setAssociatedItem(collectItem);
+			
+			collectItem.setNoteLayer(noteLayer);
+			
+			//now put collectItem back in collection list.
+			int itemIndex = CollectionItem.getPositionInCollection(collectItem, collect);
+			collect.getItems().remove(itemIndex);
+			collect.getItems().add(itemIndex, collectItem);
+			
+			//put collection back in collection list.
+			int collectIndex = Collection.getCollectionPosition(collect);
+			Main._collections.remove(collectIndex);
+			Main._collections.add(collectIndex,collect);
+		}
+		
+		//Add new text item to noteLayer's frame in a free space - for now
+		//just add at position (200,200) and hope that any other note has been moved since.
+		Text noteText = noteLayer.getFrame().addText(200, 200, "@[Insert note here]", null);
+		noteText.setBackgroundColor(Color.LIGHT_GRAY);
+		noteText.setColor(Color.BLACK);
+		noteText.setBorderColor(Color.BLACK);
+		noteText.setThickness(1);
+		noteLayer.getFrame().setSaved();
+		FrameKeyboardActions.Refresh();
+		
+		HonoursFrameIO.DISPLAY_NOTES = false;
+		HonoursFrameIO.ToggleNotesDisplay(collectItem);
+	}
+	
+	
+	public static void ToggleNotesView(){
+		ToggleNotesView(DisplayIO.getCurrentFrame());
+	}
+	
+	
+	/**
+	 * Toggle the display of notes for a collection item on and off.
+	 * @param frame
+	 */
+	public static void ToggleNotesView(Frame frame){
+		Collection collect = Collection.findCollection(frame);
+		if(collect != null){
+			CollectionItem cItem = CollectionItem.findCollectionItem(frame, collect);
+			if(cItem != null)
+				HonoursFrameIO.ToggleNotesDisplay(cItem);
+		}
+	}
+
+	
+}
Index: /other-projects/GlamED/trunk/src/org/honours/agents/CollectionToGreenstone.java
===================================================================
--- /other-projects/GlamED/trunk/src/org/honours/agents/CollectionToGreenstone.java	(revision 26588)
+++ /other-projects/GlamED/trunk/src/org/honours/agents/CollectionToGreenstone.java	(revision 26588)
@@ -0,0 +1,206 @@
+package org.honours.agents;
+
+import java.awt.Color;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.FileWriter;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.expeditee.agents.DefaultAgent;
+import org.expeditee.gui.Frame;
+import org.expeditee.gui.MessageBay;
+
+import org.honours.Main;
+import org.honours.collection.*;
+import org.honours.greenstone.CollectionContentEditor;
+import org.honours.greenstone.CollectionCustomizer;
+
+/**
+ * This agent sends a collection (represented by an 
+ * Expeditee frameset) back to Greenstone.  
+ * @author Korii Scrivener
+ */
+public class CollectionToGreenstone extends DefaultAgent {
+
+	private static String COLLECTIONS_HOME;
+	private static String _collection;
+	private static String _collectionPath;
+	private static List<String[]> _filesToMove = new ArrayList<String[]>();
+	
+	
+	public static void addFileToMove(String filename, String assocfilepath){
+		_filesToMove.add(new String[]{filename,assocfilepath});
+	}
+	
+	public Frame process(Frame frame){
+		
+		//Check if frame belongs to a collection and then obtain a 
+		//collection object.
+		Collection collection = Collection.findCollection(frame);
+
+		if(collection == null){
+			MessageBay.errorMessage("Error: No collection could be obtained for" + frame.getFramesetName() +
+					". GSDL exporter is now stopping.");
+			return null;
+		}
+		
+		_collection = collection.getName();
+		
+		
+		//Check if GSDL is set.
+		if(Main.GSDL_HOME != null){
+			COLLECTIONS_HOME = Main.GSDL_HOME + File.separator + "sites" + File.separator + "localsite" + File.separator + "collect";
+			_collectionPath = COLLECTIONS_HOME + File.separator + _collection;
+		}else{
+			MessageBay.errorMessage("ERROR: No Greenstone environment variable set. Now stopping");
+			return null;
+		}
+		
+		File collectionFolder = new File(COLLECTIONS_HOME + File.separator + _collection);
+		
+		if(collectionFolder.isDirectory())
+			rebuildCollection(collection);
+	
+		MessageBay.displayMessage("Success: Collection has been successfully edited & rebuilt", Color.green);
+		
+		return null;
+	}
+	
+	/**
+	 * Rebuild the Greenstone collection.
+	 * @param collection
+	 */
+	private void rebuildCollection(Collection collection){
+		try{
+			CollectionCustomizer customizer = CollectionCustomizer.getInstance(_collectionPath);
+
+			CollectionContentEditor contentEditor = null;
+
+			//loop through all the items in the collection and read their matching frames.
+			for(int i = 0; i < collection.getItems().size(); i++){
+
+				CollectionItem currCI = collection.getItems().get(i);
+				Frame currCiFrame = currCI.getFrame();
+
+				if(currCiFrame == null)
+					continue;
+
+				contentEditor = new CollectionContentEditor(currCI,_collectionPath);
+
+				if(i == 0)
+					customizer.customize(currCI);
+
+				contentEditor.editCollectionItems();
+			}
+
+			build();
+			CollectionCustomizer.reset();
+
+			/*sleep to give time for collection to be rebuilt before 
+			*proceeding to move files to index/assoc/assocfilepath directory. Otherwise
+			*if you try to move files while rebuilding is still going, they will just be removed.
+			*This is done for moving/adding extra files. Maybe it would be better to add them elsewhere
+			*i.e. an "images folder...*/
+			Thread.sleep(45000);
+			
+			//move any images to index/assoc folder in GSDL once building is completed.
+			moveFiles();
+
+			_filesToMove = new ArrayList<String[]>();
+			
+		}catch(Exception e){
+			e.printStackTrace();
+			return;
+		}
+	}
+	
+	/**
+	 * Method to move files currently not part of collection (e.g. images) 
+	 * to the collection's index/assoc/assocfilepath directory.
+	 */
+	private static void moveFiles()
+	{
+		try{
+
+			String newPath = _collectionPath + File.separator + "index" + File.separator + "assoc" + File.separator;
+			
+			for(int i =0; i < _filesToMove.size(); i++){
+				String f = _filesToMove.get(i)[0];
+				String a = _filesToMove.get(i)[1];
+				
+				newPath += a + File.separator;
+				
+				File origFile = new File(f);
+				if(origFile.exists()){
+					FileInputStream fis = new FileInputStream(origFile);
+					newPath += origFile.getName();
+					
+					FileOutputStream fos = new FileOutputStream(newPath);
+					
+					byte[] buf = new byte[fis.available()];
+					fis.read(buf);
+					fos.write(buf);
+				}
+				
+				newPath = _collectionPath + File.separator + "index" + File.separator + "assoc" + File.separator;
+			}
+		}catch(Exception e){
+			e.printStackTrace();
+		}
+	}
+	
+	
+	/**
+	 * Run batch script to rebuild collection.
+	 */
+	private void build(){
+		
+		try{
+			//"cmd /c start .../build.bat"
+			String command = "cmd /c start collectionBuilder.bat";
+			createBatchFile();
+			Runtime.getRuntime().exec(command);
+		}
+		catch(Exception e){
+			MessageBay.errorMessage("ERROR: Failed to build collection.");
+			e.printStackTrace();
+			return;
+		}
+	}
+	
+	/**
+	 * Method to create batch file which runs when
+	 * we want to export a frameset to Greenstone and 
+	 * rebuild the matching collection.
+	 */
+	private void createBatchFile(){
+		
+		StringBuffer cmds = new StringBuffer("");
+		cmds.append("@echo off\n");
+		
+		//TODO: Change this so it uses a relative path to GSDL.
+		String chdir = "C:\\Research\\Pei-Jones-Taonga\\expeditee-svn\\images\\greenstone3-svn4";
+		cmds.append("chdir \"" + ((chdir != null) ? chdir : "") + "\"\n");
+		cmds.append("call \"./gs3-setup.bat\"\n");
+		
+		cmds.append("perl -S buildcol.pl -verbosity 5 -site localsite " + _collection + "\n");
+		//cmds.append("perl -S incremental-rebuild.pl -verbosity 5 -site localsite " + _collection + "\n");
+		cmds.append("perl -S activate.pl -site localsite " + _collection + "\n");
+		cmds.append("pause\n");
+		cmds.append("exit\n");
+		
+		try{
+			FileWriter fwriter = new FileWriter("collectionBuilder.bat");
+			BufferedWriter out = new BufferedWriter(fwriter);
+			out.write(cmds.toString());
+			out.close();
+		}catch(Exception e){
+			e.printStackTrace();
+			return;
+		}
+	}
+	
+}
Index: /other-projects/GlamED/trunk/src/org/honours/agents/ImportCollections.java
===================================================================
--- /other-projects/GlamED/trunk/src/org/honours/agents/ImportCollections.java	(revision 26588)
+++ /other-projects/GlamED/trunk/src/org/honours/agents/ImportCollections.java	(revision 26588)
@@ -0,0 +1,398 @@
+package org.honours.agents;
+
+import java.awt.Color;
+import java.awt.Point;
+import java.io.*;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.expeditee.actions.Misc;
+import org.expeditee.agents.DefaultAgent;
+import org.expeditee.gui.*;
+import org.expeditee.items.Item;
+import org.expeditee.items.Text;
+
+import org.honours.Main;
+import org.honours.collection.*;
+import org.honours.gui.*;
+
+/**
+ * This is an Expeditee agent to allow a user
+ * to import/move Expeditee framesets generated
+ * in Greenstone to the system's "collections" directory.
+ * @author Korii
+ */
+public class ImportCollections extends DefaultAgent {
+
+	//Starting position of displaying rows containing links to access and work with imported collections/framesets.
+	private static final int _startX = 75;
+	private static final int _startY = 100;
+	
+	//Declare gap between rows and height of each row.
+	private static final int _gap = 30;
+	private static final int _rowSize = 60;
+	
+	//Maximum rows that can be displayed on each frame.
+	private static final int _maxRows = 5;
+	
+	//Main frameset where user accesses imported collections/framesets from.
+	private static final String _collectionFramesetName = "collectionsmain";
+	
+	//GSDL collect directory link.
+	private static String _gsdlCollectionsDir = Main.GSDL_HOME + File.separator + "sites" +
+			File.separator + "localsite" + File.separator + "collect" + File.separator;
+	
+	/**
+	 * Imports all collections that can be obtained from GSDL and
+	 * are NOT currently in Expeditee.
+	 * NOTE: null can be passed to this method as
+	 * we don't actually rely on a frame for this agent to be run.
+	 */
+	public Frame process(Frame frame) {
+		
+		File collectDir = new File(_gsdlCollectionsDir);
+		
+		String[] children = collectDir.list();
+		if(children == null){
+			MessageBay.errorMessage("No GSDL Collections Could Be Found.");
+			return null;
+		}
+		
+		try{
+			importEachCollection(children);
+		}catch(Exception e){
+			e.printStackTrace();
+			return null;
+		}
+		
+		MessageBay.displayMessage("Collection Importing Complete!", Color.green);
+		return null;
+	}
+	
+	private static void importEachCollection(String[] children) throws Exception{
+
+		List<Collection> tempCollections = new ArrayList<Collection>();
+		Frame getFreeFrame = null;
+		Point getFreePoint = null;
+		String link = null;
+		
+		for(int i = 0; i < children.length; i++){
+			
+			//Name of the GSDL collection
+			String collectionName = children[i];
+			String filename = _gsdlCollectionsDir + File.separator + collectionName;
+			
+			File dir = new File(filename);
+			
+			if(dir.isDirectory()){
+				File exports = getExportDirectory(filename);
+				
+				if(exports != null){
+					//Search exports folder for 0.exp, 1.exp & frame.inf
+					String[] filesToMove = getFiles(exports);
+					
+					if(filesToMove == null){
+						String errorMsg = "Failed to import collection " + collectionName;
+						MessageBay.errorMessage("ERROR: " + errorMsg);
+						throw new Exception(errorMsg);
+					}
+					
+					File matchingFrameset = matchingFrameset(collectionName);
+					
+					//Obtain first free frame for displaying collection row with links
+					Object[] freeFrameInfo = findFreeFrame();
+					getFreeFrame = (Frame)freeFrameInfo[0];
+					getFreePoint = (Point)freeFrameInfo[1];
+					
+					if(getFreeFrame == null){
+						int num = FrameIO.getLastNumber(_collectionFramesetName) + 1;
+						HonoursFrameIO.generateFrame(num,_collectionFramesetName);
+						getFreeFrame = FrameIO.LoadFrame(_collectionFramesetName + FrameIO.getLastNumber(_collectionFramesetName));
+					}
+					
+					link = collectionName + "1";
+					
+					//Import collection into Expeditee.
+					importIntoExpeditee(matchingFrameset,exports,collectionName,tempCollections);
+					
+				}
+			}
+		}
+		
+		for(Collection t : tempCollections){
+			
+			
+			Main._collections.add(t);
+		}
+		
+		//Display links for each collection.
+		for(Collection c : Main._collections){
+			
+			for(CollectionItem cItem : c.getItems()){
+				System.err.println("Setting up interface for " + cItem.getFrame().getName());
+				Interfaces.setUpToolbarOverlay(cItem);
+				Interfaces.setUpToggleToolbarOverlay(cItem);
+				Interfaces.setUpNotesOverlay(cItem);
+				//Interfaces.setUpBox(cItem);
+			}
+			
+			String cName = c.getName();
+			
+			//Check if a row of links already exists for the current collection.
+			boolean linkExists = linkExists(cName);
+			System.err.println("Link exists: " + linkExists);
+			
+			if(!linkExists){
+				System.err.println("Adding row of link for collection " + cName);
+				displayRowsOfLinks(cName, getFreeFrame, getFreePoint, link);
+			}
+			
+		}
+
+	}
+
+	/**
+	* Import current collection into Expeditee from GSDL.
+	* @param matchingFrameset - location of an existing matching frameset.
+	* @param collectionName - name of the collection to import
+	**/
+	private static void importIntoExpeditee(File matchingFrameset, File exports, String collectionName, List<Collection> tempCollections){
+		
+		if(matchingFrameset == null){
+			MessageBay.displayMessage("Importing from GSDL: " + collectionName);
+			
+			//Create new frameset directory.
+			//String newPath = HonoursFrameIO.COLLECTIONS_PATH + collectionName;
+			String newPath = FrameIO.FRAME_PATH + collectionName;
+			
+			new File(newPath).mkdir();
+			
+			matchingFrameset = new File(newPath);
+			
+			//move frames from export to matching frameset.
+			moveFiles(exports,matchingFrameset);
+			
+			Collection collect = Main.obtainCollectionItems(collectionName);
+			
+			if(collect.getItems().size() == 0){
+				MessageBay.errorMessage("Cannot import collection " + collectionName + ". No items/assocfilepaths could be found.");
+				FrameIO.deleteFrameset(collectionName);
+			}else{
+				tempCollections.add(collect);
+			}
+			
+			
+		}
+
+	}
+	
+	////////////
+	
+	/**
+	 * This method displays rows of links for accessing
+	 * collections along with options to export collection
+	 * to GSDL, view a collection space, etc.
+	 * @param collectionName
+	 * @param getFreeFrame
+	 * @param getFreePoint
+	 * @param link
+	 */
+	private static void displayRowsOfLinks(String collectionName,Frame getFreeFrame, Point getFreePoint, String link) {
+		
+		getFreeFrame.addText(getFreePoint.x, getFreePoint.y, collectionName, null,link);
+		
+		//TODO: will need to change it so it runs an action - if a collection space does NOT
+		//exist it will be generated, otherwise user will just simply navigate to it.
+		getFreeFrame.addText(getFreePoint.x+250,getFreePoint.y,"View Collection Space",null,"collection-space-"+collectionName+"1");
+		
+		getFreeFrame.addText(getFreePoint.x+500,getFreePoint.y,"Export to GSDL","CollectionToGreenstone",link);
+		
+		getFreeFrame.addText(getFreePoint.x+750,getFreePoint.y,"Complete Reimport", "OverwriteUpdate " + collectionName + "1");
+		
+		getFreeFrame.addText(getFreePoint.x+1000,getFreePoint.y,"Incremental Reimport","AddDeleteItemsOnlyUpdate " + collectionName + "1");
+	}
+	
+	////////////
+	
+	/**
+	 * Check if a link on the collections list page/frame for the passed
+	 * collection name exists.
+	 * @param collectionName
+	 * @return
+	 */
+	private static boolean linkExists(String collectionName){
+		
+		//loop through each collections frame looking for link
+		for(int j = 1; j <= FrameIO.getLastNumber(_collectionFramesetName);j++){
+			
+			Frame curr = FrameIO.LoadFrame(_collectionFramesetName + j);
+			if(curr == null)
+				continue;
+			
+			List<Item> items = curr.getItems();
+			for(Item item : items){
+				if(item.hasLink()){
+					if(item.getLink().equals(collectionName + "1")){
+						return true;
+					}
+				}
+			}
+		}
+		
+		return false;
+	}
+
+	////////////
+	
+	/**
+	 * Return a point & a frame
+	 * @param collectionName
+	 * @return
+	 */
+	private static Object[] findFreeFrame(){
+		
+		for(int i = 1; i <= FrameIO.getLastNumber(_collectionFramesetName); i++){
+			
+			Frame curr = FrameIO.LoadFrame(_collectionFramesetName + i);
+			if(curr == null)
+				continue;
+			
+			int y = _startY;
+			for(int j = 0; j < _maxRows; j++){
+				
+				Item check = Misc.getItemAtPosition(_startX, y, curr);
+				if(check == null){
+					return new Object[]{curr,new Point(_startX,y)};
+				}
+				y += _rowSize + _gap;
+			}
+		}
+		
+		//otherwise need to go on to next frame (which doesn't exist probably).
+		Frame toCreate = FrameIO.LoadFrame(_collectionFramesetName + FrameIO.getLastNumber(_collectionFramesetName)+1);
+		
+		return new Object[]{toCreate,new Point(_startX,_startY)};
+	}
+	
+	////////////
+	
+	private static File matchingFrameset(String collectionName){
+		
+		String[] framesets = FrameIO.getFramesetList().split("\n");
+		
+		for(int i = 0; i < framesets.length; i++){
+			
+			if(framesets[i].equals(collectionName))
+				//return new File(HonoursFrameIO.COLLECTIONS_PATH + framesets[i]);
+				return new File(FrameIO.FRAME_PATH + framesets[i]);
+		}
+		
+		return null;
+	}
+	
+	////////////
+	
+	private static String[] getFiles(File exports){
+		
+		String[] expFiles = exports.list();
+		
+		boolean hasZeroFrame = false;
+		boolean hasFirstFrame = false;
+		boolean hasFrameInf = false;
+		
+		for(int i = 0; i < expFiles.length; i++){
+			
+			String s = expFiles[i];
+			if(s.equals("0.exp"))
+				hasZeroFrame = true;
+			
+			if(s.equals("1.exp"))
+				hasFirstFrame = true;
+			
+			if(s.equals("frame.inf"))
+				hasFrameInf = true;
+			
+			if(hasZeroFrame && hasFirstFrame && hasFrameInf)
+				return expFiles;
+		}
+		
+		return null;
+	}
+	
+	////////////
+	
+	private static File getExportDirectory(String filename){
+		
+		String[] newChildren = new File(filename).list();
+		
+		for(int j = 0; j < newChildren.length; j++){
+			if(newChildren[j].equals("export"))
+					return new File(filename + File.separator + "export");
+		}
+		
+		return null;
+	}
+	
+	////////////
+	
+	/**
+	 * Method to  copy files from one directory
+	 * to another.
+	 * @param src
+	 * @param dest
+	 */
+	public static void moveFiles(File src, File dest){
+		
+		//get all files in source/original directory.
+		File[] filesToMove = src.listFiles();
+		
+		for(File f : filesToMove){
+			String filename = dest.getAbsolutePath() + File.separator + f.getName();
+			
+			File newFile = new File(filename);
+			
+			if(!newFile.exists()){
+				
+				try{
+					newFile.createNewFile();
+					newFile = new File(filename);
+					
+				}catch(Exception e){
+					
+					e.printStackTrace();
+					return;
+				}
+			}else{
+				try{
+				newFile.delete();
+				newFile.createNewFile();
+				newFile = new File(filename);
+				}catch(Exception e){
+					e.printStackTrace();
+					return;
+				}
+			}
+			
+			InputStream in = null;
+			OutputStream out = null;
+			
+			try{
+				in = new FileInputStream(f);
+				out = new FileOutputStream(newFile);
+				
+				//transfer bytes from in to out
+				byte[] buf = new byte[1024];
+				int len;
+				while((len = in.read(buf)) > 0){
+					out.write(buf,0,len);
+				}
+				in.close();
+				out.close();
+			}catch(Exception e){
+				e.printStackTrace();
+				return;
+			}
+		}
+	}
+
+}
Index: /other-projects/GlamED/trunk/src/org/honours/agents/UpdateCollection.java
===================================================================
--- /other-projects/GlamED/trunk/src/org/honours/agents/UpdateCollection.java	(revision 26588)
+++ /other-projects/GlamED/trunk/src/org/honours/agents/UpdateCollection.java	(revision 26588)
@@ -0,0 +1,158 @@
+package org.honours.agents;
+
+import java.io.File;
+
+import org.expeditee.agents.DefaultAgent;
+import org.expeditee.gui.Frame;
+import org.expeditee.gui.FrameIO;
+import org.expeditee.items.Text;
+
+import org.honours.Main;
+import org.honours.collection.Collection;
+
+import org.honours.collection.CollectionItem;
+import org.honours.greenstone.ArchiveFileEditor;
+import org.honours.greenstone.ArchiveFileReader;
+import org.honours.gui.HonoursFrameIO;
+import org.honours.gui.Interfaces;
+
+/**
+ * This is used to import items from GSDL not
+ * already in Expeditee and to remove items
+ * from Expeditee no longer in GSDL. At this stage,
+ * this is done by comparing doc.xml files. Would be 
+ * better to do this from GSDL.
+ * @author Korii
+ */
+public class UpdateCollection extends DefaultAgent {
+
+	private Collection _collection;
+	
+	public Frame process(Frame frame) {
+		
+		//Obtain collection and its name.
+		_collection = Collection.findCollection(frame);
+		int index = Collection.getCollectionPosition(_collection);
+
+		if(_collection == null)
+			return null;
+		
+		//Obtain archives directory.
+		String archivesDir = Main.GSDL_HOME + File.separator + "sites" + File.separator + "localsite" +
+				File.separator + "collect" + File.separator + _collection.getName() + File.separator + "archives";
+		File archivesDirFolder = new File(archivesDir);
+		
+		//get all files/folders in archivesDirFolder.
+		File[] archivesSubFolders = archivesDirFolder.listFiles();
+		
+		for(File f : archivesSubFolders){
+			
+			if(f.isDirectory()){
+				String docXML = findDocXML(f);
+								
+				//Check for an InExpeditee metadata.
+				ArchiveFileReader afr = new ArchiveFileReader(docXML);
+				String inExpediteeMetadata = afr.obtainElementText("InExpeditee");
+				String assocFilePathMetadata = afr.obtainElementText("assocfilepath");
+				String assocFileMetadata = afr.obtainElementText("gsdlassocfile").split(":")[0];
+				
+				if(inExpediteeMetadata == null){
+					createNewCollectionItem(archivesDir, docXML,assocFilePathMetadata, assocFileMetadata);
+				}else if(inExpediteeMetadata.equals("0")){
+					createNewCollectionItem(archivesDir, docXML,assocFilePathMetadata, assocFileMetadata);
+				}
+			}
+		}
+		
+		//Replace collection with newly updated collection.
+		Main._collections.remove(index);
+		Main._collections.add(index, _collection);
+		
+		return frame;
+	}
+	
+	/**
+	 * Recursive method to obtain doc.xml file
+	 * associated with this item. Sometimes there are 
+	 * subfolders within an archive folder and we have
+	 * to search through these to obtain the doc.xml file.
+	 * @param subDir
+	 * @return
+	 */
+	private String findDocXML(File subDir){
+		
+		File[] subDirFiles = subDir.listFiles();
+		String docXML = null;
+		
+		for(File f : subDirFiles){
+			
+			if(f.getName().equals("doc.xml")){
+				docXML = f.getAbsolutePath();
+				return docXML;
+			}
+		}
+		
+		for(File f : subDirFiles){
+			if(f.isDirectory()){
+				return findDocXML(f);
+			}
+		}
+		
+		return docXML;
+	}
+
+	//TODO: Also generate layers associated with this frame.
+	/**
+	 * Generate a new collection item.
+	 * @param archivesDir
+	 * @param docXML
+	 * @param assocFilePathMetadata
+	 * @param assocFileMetadata
+	 */
+	private void createNewCollectionItem(String archivesDir, String docXML, String assocFilePathMetadata, String assocFileMetadata) {
+		
+		//Make a new frame
+		HonoursFrameIO.generateFrame((FrameIO.getLastNumber(_collection.getName())+1), _collection.getName());
+		Frame newCollectionItemFrame = FrameIO.LoadFrame(_collection.getName()+FrameIO.getLastNumber(_collection.getName()));
+		
+		//Make a new collectionItem
+		CollectionItem newCollectionItem = new CollectionItem();
+		newCollectionItem.setDocXML(docXML);
+		newCollectionItem.setAssocfilePath(assocFilePathMetadata);
+		
+		String newAssocFileMetadata = archivesDir + File.separator + assocFilePathMetadata + File.separator + assocFileMetadata;
+		newCollectionItem.setAssociatedFile(newAssocFileMetadata);
+		
+		newCollectionItem.setFrame(newCollectionItemFrame);
+		
+		//need to write out newCollectionItem frame and assocfilepath to info object.
+		_collection.getCollectionInformation().addRow("I", newCollectionItem.getFrame().getName(), assocFilePathMetadata);
+		_collection.getCollectionInformation().sort();
+		
+		Interfaces.setUpToolbarOverlay(newCollectionItem);
+		Interfaces.setUpToggleToolbarOverlay(newCollectionItem);
+		
+		//Update docxml
+		Text text = new Text("1");
+		text.setData("InExpeditee");
+		ArchiveFileEditor afe = new ArchiveFileEditor(newCollectionItem.getDocXML());
+		afe.editArchiveDocFile(text);
+		afe.write();
+		
+		_collection.addItem(newCollectionItem);
+		
+		//TODO: HACK for now just to show that this stuff works... Must fix this!!
+		ArchiveFileReader afr = new ArchiveFileReader(docXML);
+		String catNumber = afr.obtainElementText("Catalogue-Number");
+		String physicalLocation = afr.obtainElementText("Physical-Location");
+		String provenance = afr.obtainElementText("Provenance");
+		String description = afr.obtainElementText("Description");
+		
+		newCollectionItem.getFrame().addText(100, 200, catNumber, null);
+		newCollectionItem.getFrame().addText(100,250,physicalLocation,null);
+		newCollectionItem.getFrame().addText(100,300,provenance,null);
+		newCollectionItem.getFrame().addText(100,350,description,null);
+		newCollectionItem.getFrame().addText(100,400,"@i: " + newAssocFileMetadata + " 0.5",null);
+	}
+
+}
Index: /other-projects/GlamED/trunk/src/org/honours/collection/Collection.java
===================================================================
--- /other-projects/GlamED/trunk/src/org/honours/collection/Collection.java	(revision 26588)
+++ /other-projects/GlamED/trunk/src/org/honours/collection/Collection.java	(revision 26588)
@@ -0,0 +1,116 @@
+package org.honours.collection;
+
+import java.util.List;
+import java.util.concurrent.CopyOnWriteArrayList;
+
+import org.expeditee.gui.Frame;
+import org.honours.Main;
+
+public class Collection {
+
+	private String _name;
+	private CopyOnWriteArrayList<CollectionItem> _items;
+	private CollectionInformation _collectionInfo;
+	
+	public Collection() {}
+	
+	public Collection(String name){
+		_name = name;
+		_items = new CopyOnWriteArrayList<CollectionItem>();
+	}
+	
+	public void setName(String s){
+		_name = s;
+	}
+	
+	public String getName(){
+		return _name;
+	}
+	
+	public void setCollectionInformation(CollectionInformation ci){
+		_collectionInfo = ci;
+	}
+	
+	public CollectionInformation getCollectionInformation(){
+		return _collectionInfo;
+	}
+	
+	public void addItem(CollectionItem item){
+		_items.add(item);
+	}
+	
+	public List<CollectionItem> getItems()
+	{
+		return _items;
+	}
+	
+	public void resetItems(){
+		//_items = new ArrayList<CollectionItem>();
+		_items = new CopyOnWriteArrayList<CollectionItem>();
+	}
+	
+public static Collection findCollection(Frame frame){
+		
+		if(frame == null)
+			return null;
+		
+		String framesetName = frame.getFramesetName();
+		for(Collection c : Main._collections){
+			if(c.getName().equals(framesetName))
+				return c;
+		}
+		return null;
+	}
+	
+	/**
+	 * Find a collection with the matching
+	 * passed (frameset) name.
+	 * @param name
+	 * @return
+	 */
+	public static Collection findCollection(String name){
+		
+		if(name == null)
+			return null;
+		else if(name.equals(""))
+			return null;
+		
+		for(Collection c : Main._collections){
+			if(c.getName().equals(name))
+				return c;
+		}
+		
+		return null;
+	}
+	
+	public static int getCollectionPosition(Collection c){
+		
+		if(c == null)
+			return -1;
+		
+		for(int i = 0; i < Main._collections.size(); i++){
+			Collection currCol = Main._collections.get(i);
+			if(currCol == c)
+				return i;
+		}
+		
+		return -1;
+	}
+	
+	public static int getCollectionPosition(Frame frame){
+		Collection find = findCollection(frame);
+		if(find == null)
+			return -1;
+		
+		for(int i = 0; i < Main._collections.size(); i++){
+			
+			Collection currCol = Main._collections.get(i);
+			if(currCol == find)
+				return i;
+			
+		}
+		
+		return -1;
+	}
+	
+}
Index: /other-projects/GlamED/trunk/src/org/honours/collection/CollectionInformation.java
===================================================================
--- /other-projects/GlamED/trunk/src/org/honours/collection/CollectionInformation.java	(revision 26588)
+++ /other-projects/GlamED/trunk/src/org/honours/collection/CollectionInformation.java	(revision 26588)
@@ -0,0 +1,73 @@
+package org.honours.collection;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+
+/**
+ * A collection information object is used to 
+ * hold information about a collection during runtime
+ * of the system. Replaces the collectionInfo.inf file
+ * which was used originally.
+ * @author Korii 14/11/2012
+ */
+public class CollectionInformation {
+
+	private List<String[]> _rows;
+
+	
+	public CollectionInformation(){
+		_rows = new ArrayList<String[]>();
+	}
+	
+	/**
+	 * Add a row containing information about an individual collection
+	 * item or layer.
+	 * 
+	 * @param type - Three types: "I" for collection item; 
+	 * 				 "LT" for text layer and "LI" for image layer.
+	 * @param frameName - name of the frame representing a collection item/layer
+	 * @param assocfilepath - the assocfilepath value associated with the item.
+	 */
+	public void addRow(String type,String frameName,String assocfilepath){
+		
+		String[] row = new String[]{type,frameName,assocfilepath};
+		_rows.add(row);
+	}
+	
+	public List<String[]> getRows(){
+		return _rows;
+	}
+	
+	/**
+	 * Find a row associated with a particular frame.
+	 * @param frameName
+	 * @return
+	 */
+	public String[] findRow(String frameName){
+		
+		String[] result = null;
+		
+		for(String[] s : _rows){
+			if(s[1].equals(frameName))
+				result = s;
+		}
+		
+		return result;
+	}
+	
+	/**
+	 * Sort the collection information object by
+	 * assocfilepath
+	 */
+	public void sort(){
+		//sort rows by the 3rd index of arrays (assocfilepath)
+		Collections.sort(_rows,new Comparator<String[]>(){
+			public int compare(String[] s1, String[] s2){
+				return s1[2].compareTo(s2[2]);
+			}
+		});
+	}
+	
+}
Index: /other-projects/GlamED/trunk/src/org/honours/collection/CollectionItem.java
===================================================================
--- /other-projects/GlamED/trunk/src/org/honours/collection/CollectionItem.java	(revision 26588)
+++ /other-projects/GlamED/trunk/src/org/honours/collection/CollectionItem.java	(revision 26588)
@@ -0,0 +1,112 @@
+package org.honours.collection;
+
+import java.util.List;
+import java.util.concurrent.CopyOnWriteArrayList;
+
+import org.expeditee.gui.Frame;
+
+/**
+ * Stores all the information about an individual
+ * item in a collection (including the actual
+ * frame that this item is displayed on).
+ * @author Korii
+ *
+ */
+public class CollectionItem {
+
+	private Frame _frame;
+	
+	//Path location of the file associated with this item (e.g. HASH017.dir).
+	private String _assocfilepath;
+	
+	//file associated with this particular item.
+	private String _associatedFile;
+	
+	//doc.xml file associated with this item.
+	private String _docXML;
+	
+	private CopyOnWriteArrayList<ContentLayer> _layers;
+	
+	//At this stage a CollectionItem can only have ONE NoteLayer object.
+	private NoteLayer _noteLayer;
+	
+	public CollectionItem(){
+		_layers = new CopyOnWriteArrayList<ContentLayer>();
+	}
+	
+	public void setFrame(Frame f){
+		_frame = f;
+	}
+	
+	public Frame getFrame(){
+		return _frame;
+	}
+	
+	public void setNoteLayer(NoteLayer nl){
+		_noteLayer = nl;
+	}
+	
+	public NoteLayer getNoteLayer(){
+		return _noteLayer;
+	}
+	
+	public void addLayer(ContentLayer layer){
+		_layers.add(layer);
+	}
+	
+	public List<ContentLayer> getLayers(){
+		return _layers;
+	}
+		
+	public void setAssocfilePath(String assocfilepath){
+		_assocfilepath = assocfilepath;
+	}
+	
+	public String getAssocFilePath()
+	{
+		return _assocfilepath;
+	}
+	
+	public void setAssociatedFile(String associatedFile){
+		_associatedFile = associatedFile;
+	}
+	
+	public String getAssociatedFile(){
+		return _associatedFile;
+	}
+	
+	public void setDocXML(String docXML){
+		_docXML = docXML;
+	}
+	
+	public String getDocXML(){
+		return _docXML;
+	}
+	
+	public static CollectionItem findCollectionItem(Frame frame,Collection collect){
+		
+		if(collect == null)
+			return null;
+		
+		for(CollectionItem ci : collect.getItems()){
+			if(ci.getFrame().getName().equals(frame.getName()))
+				return ci;
+		}
+		
+		return null;
+	}
+	
+	public static int getPositionInCollection(CollectionItem ci,Collection collect){
+		
+		if(ci == null)
+			return -1;
+		
+		for(int i = 0; i < collect.getItems().size(); i++){
+			CollectionItem currCI = collect.getItems().get(i);
+			if(currCI == ci)
+				return i;
+		}
+		
+		return -1;
+	}
+}
Index: /other-projects/GlamED/trunk/src/org/honours/collection/ContentLayer.java
===================================================================
--- /other-projects/GlamED/trunk/src/org/honours/collection/ContentLayer.java	(revision 26588)
+++ /other-projects/GlamED/trunk/src/org/honours/collection/ContentLayer.java	(revision 26588)
@@ -0,0 +1,5 @@
+package org.honours.collection;
+
+public class ContentLayer {
+
+}
Index: /other-projects/GlamED/trunk/src/org/honours/collection/NoteLayer.java
===================================================================
--- /other-projects/GlamED/trunk/src/org/honours/collection/NoteLayer.java	(revision 26588)
+++ /other-projects/GlamED/trunk/src/org/honours/collection/NoteLayer.java	(revision 26588)
@@ -0,0 +1,37 @@
+package org.honours.collection;
+
+import org.expeditee.gui.Frame;
+
+/**
+ * 
+ * @author Korii
+ */
+public class NoteLayer {
+	
+	private Frame _frame;
+	private CollectionItem _associatedItem;
+	
+	public NoteLayer(){}
+	
+	public NoteLayer(Frame frame, CollectionItem associatedItem){
+		_frame = frame;
+		_associatedItem = associatedItem;
+	}
+	
+	public void setFrame(Frame frame){
+		_frame = frame;
+	}
+	
+	public Frame getFrame(){
+		return _frame;
+	}
+	
+	public void setAssociatedItem(CollectionItem cItem){
+		_associatedItem = cItem;
+	}
+	
+	public CollectionItem getItem(){
+		return _associatedItem;
+	}
+	
+}
Index: /other-projects/GlamED/trunk/src/org/honours/greenstone/ArchiveFileEditor.java
===================================================================
--- /other-projects/GlamED/trunk/src/org/honours/greenstone/ArchiveFileEditor.java	(revision 26588)
+++ /other-projects/GlamED/trunk/src/org/honours/greenstone/ArchiveFileEditor.java	(revision 26588)
@@ -0,0 +1,109 @@
+package org.honours.greenstone;
+
+import java.io.*;
+
+import javax.xml.transform.*;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+
+import org.apache.log4j.Logger;
+import org.expeditee.items.Text;
+import org.greenstone.gsdl3.util.GSXML;
+import org.greenstone.gsdl3.util.XMLConverter;
+import org.w3c.dom.*;
+
+
+public class ArchiveFileEditor {
+
+	static Logger logger = Logger.getLogger(org.honours.greenstone.ArchiveFileEditor.class.getName());
+	private XMLConverter _xmlConverter;
+	private Document _document;
+	private String _archiveDocFile;
+	
+	public ArchiveFileEditor(String docXML){
+		_xmlConverter = new XMLConverter();
+		_archiveDocFile = docXML;
+		_document = _xmlConverter.getDOM(new File(_archiveDocFile));
+	}
+	
+	public void editArchiveDocFile(Text text){
+		try{
+			String newText = text.getText();
+			String data = (text.getData() != null) ? text.getData().get(0) : "";
+			
+			if(data.equals(""))
+				return;
+			
+			
+			NodeList nl = _document.getDocumentElement().getElementsByTagName("Description");
+			Element description = (Element)nl.item(0);
+			
+			nl = description.getChildNodes();
+			boolean found = false;
+			for(int i = 0; i < nl.getLength(); i++){
+				Node node = nl.item(i);
+				
+				if(node.getNodeType() == Node.ELEMENT_NODE){
+					Element e = (Element)node;
+					String originalText = e.getTextContent();
+					
+					if(e.getTagName().equals("Metadata") && e.getAttribute("name").equals(data)){
+						
+						if(!originalText.equals(newText)){
+							GSXML.setNodeText(e, newText);
+						}
+						found = true;
+					}
+				}
+			}
+			
+			if(!found){
+				System.err.println("Create a new metadata");
+				Element newElem = _document.createElement("Metadata");
+				newElem.setAttribute("name",data);
+				newElem.setTextContent(newText);
+				description.appendChild(newElem);
+				description.appendChild(_document.createTextNode("\n\t"));
+				found = true;
+			}
+			
+		}catch(Exception e){
+			e.printStackTrace();
+		}
+	}
+	
+	/**
+	 * Write out new stuff to doc.xml
+	 */
+	public void write(){
+		
+		try{
+			TransformerFactory tf = TransformerFactory.newInstance();
+			Transformer trans = tf.newTransformer();
+			
+			//generating string from xml tree.
+			StringWriter sw = new StringWriter();
+			StreamResult result = new StreamResult(sw);
+			DOMSource source = new DOMSource(_document);
+			
+			trans.transform(source,result);
+			String xmlString = sw.toString();
+			
+			//Saving XML content back to doc.xml file
+			//System.err.println(_archiveDocFile);
+			OutputStream os = new FileOutputStream(_archiveDocFile);
+			byte[] buf = xmlString.getBytes();
+			
+			for(int i = 0; i < buf.length; i++)
+				os.write(buf[i]);
+			
+			os.close();
+			buf = null;
+			
+		}catch(Exception e){
+			e.printStackTrace();
+			return;
+		}
+	}
+	
+}
Index: /other-projects/GlamED/trunk/src/org/honours/greenstone/ArchiveFileReader.java
===================================================================
--- /other-projects/GlamED/trunk/src/org/honours/greenstone/ArchiveFileReader.java	(revision 26588)
+++ /other-projects/GlamED/trunk/src/org/honours/greenstone/ArchiveFileReader.java	(revision 26588)
@@ -0,0 +1,56 @@
+package org.honours.greenstone;
+
+import java.io.File;
+
+
+import org.apache.log4j.Logger;
+
+import org.greenstone.gsdl3.util.GSXML;
+import org.greenstone.gsdl3.util.XMLConverter;
+import org.w3c.dom.*;
+
+public class ArchiveFileReader {
+
+	static Logger logger = Logger.getLogger(org.honours.greenstone.ArchiveFileReader.class.getName());
+	private XMLConverter _xmlConverter;
+	private Document _document;
+	private String _archiveDocFile;
+	
+	public ArchiveFileReader(String docXML){
+		_xmlConverter = new XMLConverter();
+		_archiveDocFile = docXML;
+		_document = _xmlConverter.getDOM(new File(_archiveDocFile));
+		
+	}
+	
+	public String obtainElementText(String metadataName){
+		
+		if(metadataName.equals("") || metadataName == null)
+			return null;
+		
+		NodeList nl = _document.getDocumentElement().getElementsByTagName("Description");
+		Element description = (Element)nl.item(0);
+		
+		nl = description.getChildNodes();
+		int i = 0;
+		
+		while(i <= nl.getLength()){
+			
+			Node node = nl.item(i);
+			if(node != null){
+			if(node.getNodeType() == Node.ELEMENT_NODE){
+				Element e = (Element)node;
+				
+				if(e.getTagName().equals("Metadata") && e.getAttribute("name")
+						.equals(metadataName)){
+					
+					return GSXML.getNodeText(e);	
+				}
+			}
+			}
+			i++;
+		}
+		
+		return null;
+	}
+}
Index: /other-projects/GlamED/trunk/src/org/honours/greenstone/CollectionConfigEditor.java
===================================================================
--- /other-projects/GlamED/trunk/src/org/honours/greenstone/CollectionConfigEditor.java	(revision 26588)
+++ /other-projects/GlamED/trunk/src/org/honours/greenstone/CollectionConfigEditor.java	(revision 26588)
@@ -0,0 +1,438 @@
+package org.honours.greenstone;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.OutputStream;
+import java.io.StringWriter;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+
+import org.apache.log4j.Logger;
+import org.expeditee.gui.MessageBay;
+import org.greenstone.gsdl3.util.GSXML;
+import org.greenstone.gsdl3.util.XMLConverter;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+public class CollectionConfigEditor {
+
+	static Logger logger = Logger.getLogger(org.honours.greenstone.CollectionConfigEditor.class.getName());
+	
+	private XMLConverter _converter;
+	private Document _document;
+	
+	//filename of xml file (collectionConfig.xml) that we want to parse & edit.
+	private String _collectionConfigFile;
+	
+	private Element _displayTag = null;
+	private Element _formatTag = null;
+	private Element _documentContentTemplate = null;
+	private Element _scriptElem = null;
+	
+	
+	private static CollectionConfigEditor _instance = null;
+	
+	public static CollectionConfigEditor getInstance(String c){
+		
+		if(_instance == null)
+			_instance = new CollectionConfigEditor(c);
+		
+		return _instance;
+	}
+	
+	private CollectionConfigEditor(String c){
+		_converter = new XMLConverter();
+		_collectionConfigFile = c;
+		
+		_document = _converter.getDOM(new File(_collectionConfigFile));
+		
+		_displayTag = retrieveDisplayTag();
+		_formatTag = retrieveFormatTag();
+		
+		_documentContentTemplate = retrieveDocContentTemplate();
+	}
+	
+	public void reset(){
+		_instance = null;
+	}
+	
+	/**
+	 * Method to retrieve <format></format> element within a 
+	 * <display></display> element.
+	 * @return - the <format></format> element.
+	 */
+	public Element getFormatTag(){
+		if(_formatTag != null)
+			return _formatTag;
+		else
+			return retrieveFormatTag();
+	}
+	
+	/**
+	 * Method to retrieve a <gsf:template name="documentContent"></gsf:template>
+	 * element, generally located in the <display><format>...</format></display>
+	 * section of the collectionConfig.xml editor.
+	 * @return - the retrieved <gsf:template></gsf:template> element.
+	 */
+	public Element getDocumentContentTemplate(){
+		if(_documentContentTemplate != null)
+			return _documentContentTemplate;
+		else
+			return retrieveDocContentTemplate();
+	}
+	
+	/**
+	 * Retrieve sectionImage template for displaying
+	 * the document image on a GSDL document's page.
+	 * @return
+	 */
+	public Element getSectionImageTemplate(){
+		
+		Element sectionImageTemplate = null;
+		String xslTemplate = "xsl:template";
+		String sectionImg = "sectionImage";
+		
+		
+		//if an <xsl:template name="sectionImage"></xsl:template> element is found, remove it.
+		getChildElement(_formatTag.getChildNodes(), xslTemplate, "","",sectionImg,_formatTag);
+		
+		//(Re-)create <xsl:template name="sectionImage"></xsl:template>
+		sectionImageTemplate = createElement(xslTemplate, "", sectionImg, "", _formatTag);
+		
+		return sectionImageTemplate;
+	}
+	
+	/**
+	 * Searches for, destroys and re-creates an
+	 * <xsl:template name="showAssocFilePath"></xsl:template> element.
+	 * @return - an <xsl:tempate name="showAssocFilePath"></xsl:template> element.
+	 */
+	public Element getAssocFilePathTemplate(){
+		
+		Element assocFilePathTemplate = null;
+		String xslTemplate = "xsl:template";
+		String showAssocFilePath = "showAssocFilePath";
+		
+		getChildElement(_formatTag.getChildNodes(),xslTemplate,"","",showAssocFilePath,_formatTag);
+		
+		assocFilePathTemplate = createElement(xslTemplate,"",showAssocFilePath,"",_formatTag);
+		
+		return assocFilePathTemplate;
+	}
+	
+	/**
+	 * NOTE: Don't actually use this at this current time but 
+	 * will need to later when we want to save Expeditee annotation items
+	 * and send these to Greenstone.
+	 * @return
+	 */
+	public Element getExpediteeAttrTemplate(){
+		return null;
+	}
+	
+	/**
+	 * Write out xml to file.
+	 */
+	public void write(){
+		try{
+			//System.err.println(GSXML.elementToString(_document.getDocumentElement(), true));
+			
+			TransformerFactory tf = TransformerFactory.newInstance();
+			Transformer trans = tf.newTransformer();
+			
+			//generating string from xml tree
+			StringWriter sw = new StringWriter();
+			StreamResult result = new StreamResult(sw);
+			DOMSource source = new DOMSource(_document);
+			trans.transform(source,result);
+			String xmlString = sw.toString();
+			
+			//Saving the XML content back to collectionConfig.xml
+			OutputStream os = new FileOutputStream(_collectionConfigFile);
+			byte[] buf = xmlString.getBytes();
+			
+			for(int i = 0; i < buf.length; i++){
+				os.write(buf[i]);
+			}
+			os.close();
+			buf = null;
+			
+		}catch(Exception e){
+			e.printStackTrace();
+			return;
+		}
+	}
+	
+	/**
+	 * This method searches for and returns a
+	 * <display></display> element in the document. If none
+	 * exists, a new one will be created.
+	 * @return - A <display></display> element.
+	 */
+	private Element retrieveDisplayTag(){
+		
+		Element display = null;
+		
+		NodeList nl = _document.getDocumentElement().getElementsByTagName("display");
+		
+		if(nl.getLength() > 0)
+			display = (Element)nl.item(0);
+		else{	//just in case a <display></display> element doesn't exist in the file.
+			display = _document.createElement("display");
+			_document.appendChild(display);
+		}
+		
+		System.err.println(GSXML.elementToString(display, true));
+		
+		return display;
+	}
+	
+	/**
+	 * This method returns a <format></format> element found within
+	 * a <display></display> element. If none is found, a new 
+	 * one will be created and returned.
+	 * @return - a <format></format> element.
+	 */
+	private Element retrieveFormatTag(){
+		
+		Element format = null;
+		
+		//Just in case the display tag hasn't already been retrieved.
+		if(_displayTag != null)
+			_displayTag = retrieveDisplayTag();
+		
+		NodeList nl = _displayTag.getElementsByTagName("format");
+		
+		if(nl.getLength() > 0)
+			format = (Element)nl.item(0);
+		else{
+			format = _document.createElement("format");
+			_displayTag.appendChild(format);
+		}
+		
+		return format;
+	}
+
+	/**
+	 * Returns <gsf:template name="documentContent"></gsf:template>,
+	 * located in the <display><format></format></display> section
+	 * of the xml file. Customized html will be appended to this 
+	 * returned element.
+	 * @return - a <gsf:template> element with name "documentContent".
+	 */
+	private Element retrieveDocContentTemplate(){
+		
+		Element documentContentTemplate = null;
+		
+		String gsfTemplate = "gsf:template";
+		String documentContent = "documentContent";
+		
+		//Obtain script element in documentContent template before deleting template
+		_scriptElem = getScriptTag();
+		
+		//Search for and remove <gsf:template name="documentContent"></gsf:template> then recreate.
+		getChildElement(_formatTag.getChildNodes(),gsfTemplate,"","",documentContent,_formatTag);
+		documentContentTemplate = createElement(gsfTemplate,"",documentContent,"",_formatTag);
+		
+		documentContentTemplate.appendChild(_scriptElem);
+
+		return documentContentTemplate;
+	}
+	
+	/**
+	 * Method to create an element and append it to the passed parent
+	 * element.
+	 * @param tagname - the element's tagname (e.g. gsf:template) 
+	 * @param match - a value specifying the "match" attribute, otherwise use ""
+	 * @param name - a value specifying the "name" attribute, otherwise use ""
+	 * @param mode - a value specifying the "mode" attribute, otherwise use ""
+	 * @param parent - the parent element to append the new element to
+	 * @return - the newly created element
+	 */
+	private Element createElement(String tagname, String match, String name, String mode,Element parent){
+		
+		Element elem = _document.createElement(tagname);
+		parent.appendChild(elem);
+		
+		if(!match.equals(""))
+			elem.setAttribute("match",match);
+		
+		if(!name.equals(""))
+			elem.setAttribute("name",name);
+		
+		if(!mode.equals(""))
+			elem.setAttribute("mode",mode);
+		
+		return elem;
+	}
+	
+	
+	/**
+	 * This method searches for a child element that
+	 * matches a number of conditions and removes it
+	 * from its parent element.
+	 * @param nl - the list of elements to search through (a particular element's parents)
+	 * @param tagName - the tag name of the element, e.g. gsf:template
+	 * @param match - any specified match attribute value, otherwise just use ""
+	 * @param mode - any specified mode attribute vale, otherwise just ""
+	 * @param name - a name attribute
+	 * @param parent - the parent element to remove the child from (if found)
+	 */
+	private void getChildElement(NodeList nl, String tagName, String match,String mode, String name, Element parent){
+		
+		for(int i = 0; i < nl.getLength(); i++){
+			Node n = nl.item(i);
+			
+			if(n.getNodeType() == Node.ELEMENT_NODE){
+				
+				if(n.getNodeType() == Node.ELEMENT_NODE){
+					
+					Element e = (Element)n;
+					
+					/* If we find an exact match for elements we want to create, throw
+					 * the pre-existing ones away & re-create them and any sub-elements*/
+					boolean tagNameMatches = e.getTagName().equals(tagName);
+					
+					boolean conditionOne = tagNameMatches && e.getAttribute("match").equals(match) &&
+							e.getAttribute("mode").equals(mode);
+					boolean conditionTwo = tagNameMatches && e.getAttribute("name").equals(name);
+					
+					
+					if(conditionOne || conditionTwo)
+						parent.removeChild(e);
+					
+				}
+			}
+		}
+	}
+	
+	/**
+	 * This method searches for a <script></script>
+	 * element in the documentContent template of the
+	 * collectionConfig.xml file.
+	 * @return
+	 */
+	private Element getScriptTag(){
+		
+		Element script = null;
+		
+		//Obtain <gsf:template name="documentContent"></gsf:template> first.
+		Element docContent = null;
+		
+		NodeList nl = _formatTag.getChildNodes();
+		
+		for(int i = 0; i < nl.getLength(); i++){
+			Node n = nl.item(i);
+			
+			if(n.getNodeType() == Node.ELEMENT_NODE){
+				Element e = (Element)n;
+				
+				if(e.getTagName().equals("gsf:template"))
+					if(e.getAttribute("name").equals("documentContent"))
+						docContent = e;
+					
+			}
+		}
+		
+		if(docContent != null){
+			
+			nl = docContent.getChildNodes();
+			
+			for(int i = 0; i < nl.getLength(); i++){
+				
+				Node n = docContent.getChildNodes().item(i);
+				
+				if(n.getNodeType() == Node.ELEMENT_NODE){
+					
+					Element e = (Element)n;
+					
+					if(e.getTagName().equals("script")){
+						
+						//Check we are only dealing with script element
+						//for adding the export documents to Expeditee feature
+						if(e.getAttribute("id").equals("exportScript")){
+							script = e;
+						}
+					}
+				}
+			}
+			
+		}else{
+			System.err.println("ERROR: No documentContent template could be found while trying to obtain" +
+					"script element.");
+			return null;
+		}
+		
+		//Create a new script element if none can be found.
+		if(script == null)
+			script = generateScriptElement();
+		
+		return script;
+	}
+	
+	private Element generateScriptElement(){
+		
+		//Create a script element with id = "exportScript"
+		Element script = _document.createElement("script");
+		script.setAttribute("text", "text/javascript");
+		script.setAttribute("id","exportScript");
+		
+		//Create <xsl:text> element
+		Element xslText = _document.createElement("xsl:text");
+		xslText.setAttribute("disable-output-escaping","yes");
+		script.appendChild(xslText);
+		
+		String js = writeJSCode();
+		
+		xslText.appendChild(_document.createTextNode(js));
+
+		return script;
+	}
+
+	/**
+	 * Writes out JS Code for adding the exporting individual
+	 * GSDL documents to Expeditee functionality. This code 
+	 * is stored in a string and returned.
+	 * @return -a string containing JS code for the exporting individual
+	 * GSDL documents to Expeditee feature.
+	 */
+	private String writeJSCode(){
+		
+		StringBuffer jsCode = new StringBuffer("");
+		
+		jsCode.append("$(document).ready(function(){\n");
+		jsCode.append("\t var btnExport = document.createElement(\"button\");\n");
+		jsCode.append("\t $(btnExport).attr('id','btnExport');\n");
+		jsCode.append("\t $(btnExport).attr('class','ui-button ui-widget ui-state-default ui-corner-all');\n");
+		jsCode.append("\t $(btnExport).append(document.createTextNode(\"Export to Expeditee\"));\n\n");
+		
+		jsCode.append("\t $('#rightSidebar').append($(btnExport));\n\n");
+		
+		jsCode.append("\t $('#btnExport').click(function(){\n\n");
+		
+		jsCode.append("\t\t var c = gs.cgiParams.c;\n");
+		jsCode.append("\t\t var docID = gs.cgiParams.d;\n");
+		jsCode.append("\t\t var site = gs.xsltParams.site_name;\n");
+		jsCode.append("\t\t var assocfilepath = gs.documentMetadata.assocfilepath;\n\n");
+		
+		jsCode.append("\t\t var url = 'cgi-bin/export-individual-expeditee.pl?docID=' + docID + '&amp;c=' + '&amp;assocfilepath=' + encodeURIComponent(assocfilepath) + '&amp;site=' + site;\n\n");
+		
+		jsCode.append("\t\t window.open(url,'exportWindow','width=1050,height=700,left=0,top=0,screenX=0,screenY=0');\n");
+		
+		jsCode.append("\t });\n\n");
+		
+		jsCode.append("});");
+		
+		
+		return jsCode.toString();
+	}
+	
+	
+}
Index: /other-projects/GlamED/trunk/src/org/honours/greenstone/CollectionContentEditor.java
===================================================================
--- /other-projects/GlamED/trunk/src/org/honours/greenstone/CollectionContentEditor.java	(revision 26588)
+++ /other-projects/GlamED/trunk/src/org/honours/greenstone/CollectionContentEditor.java	(revision 26588)
@@ -0,0 +1,99 @@
+package org.honours.greenstone;
+
+import java.util.List;
+
+import org.apache.log4j.Logger;
+import org.expeditee.items.Item;
+import org.expeditee.items.Picture;
+import org.expeditee.items.Text;
+import org.honours.collection.CollectionItem;
+import org.honours.collection.NoteLayer;
+
+public class CollectionContentEditor {
+
+	static Logger logger = Logger.getLogger(org.honours.greenstone.CollectionContentEditor.class.getName());
+	
+	private CollectionItem _collectionItem;
+	private ArchiveFileEditor _archiveFileEditor;
+	//private HtmlForDocXML _htmlForDocXML;
+	
+	public CollectionContentEditor(CollectionItem currCI, String _collectionPath) {
+		_collectionItem = currCI;
+		_archiveFileEditor = new ArchiveFileEditor(_collectionItem.getDocXML());
+	}
+
+	public void editCollectionItems() {
+		
+		List<Item> items = _collectionItem.getFrame().getItems();
+		boolean noChange = true;
+		
+		for(Item item : items){
+			
+			if(item instanceof Text){
+				if(item.isAnnotation()){
+					//TODO: Deal with annotation items correctly.
+				}else{
+					
+					Text text = (Text)item;
+					
+					ArchiveFileReader afe = new ArchiveFileReader(_collectionItem.getDocXML());
+					
+					if(text.getData() != null)
+					if(text.getData().size() > 0){
+						String elemText = afe.obtainElementText(text.getData().get(0));
+					
+						if(!elemText.equals(null)){
+							if(elemText.equals(text.getText()))
+								continue;
+							else
+								noChange = false;
+						}
+					}
+					
+					if(!noChange)
+						_archiveFileEditor.editArchiveDocFile(text);
+				}
+			}else if(item instanceof Picture){
+				//TODO: Deal with picture items correctly.
+			}
+		}
+		
+		//addNotes();
+		
+		if(!noChange)
+			_archiveFileEditor.write();
+	}
+
+	private void addNotes() {
+		//Add notes to docXML file.
+		NoteLayer noteLayer = _collectionItem.getNoteLayer();
+		
+		if(noteLayer != null){
+			StringBuffer notesStringBuffer = new StringBuffer("");
+			
+			notesStringBuffer.append("<table attr=\"norect\" cellpadding=\"0\" width=\"100%\">");
+			notesStringBuffer.append("<tbody attr=\"norect\">");
+
+			for(Text t : noteLayer.getFrame().getTextItems()){
+				notesStringBuffer.append("<tr attr=\"norect\">");
+				notesStringBuffer.append("<td attr=\"norect\">");
+				
+				notesStringBuffer.append(t.getText() + "<br/>");
+				
+				notesStringBuffer.append("</td>");
+				notesStringBuffer.append("</tr>");
+			}
+			
+			notesStringBuffer.append("</table>");
+			
+			if(!notesStringBuffer.toString().equals(""))
+			{
+				//Write a "Notes" metadata element to the doc.xml file.
+				Text notesText = new Text(notesStringBuffer.toString());
+				notesText.setData("Notes");
+				_archiveFileEditor.editArchiveDocFile(notesText);
+			}
+		}
+	}
+
+}
Index: /other-projects/GlamED/trunk/src/org/honours/greenstone/CollectionCustomizer.java
===================================================================
--- /other-projects/GlamED/trunk/src/org/honours/greenstone/CollectionCustomizer.java	(revision 26588)
+++ /other-projects/GlamED/trunk/src/org/honours/greenstone/CollectionCustomizer.java	(revision 26588)
@@ -0,0 +1,995 @@
+package org.honours.greenstone;
+
+import java.awt.Color;
+import java.awt.Font;
+import java.awt.Rectangle;
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+
+import org.expeditee.gui.Frame;
+import org.expeditee.io.Conversion;
+import org.expeditee.items.Dot;
+import org.expeditee.items.Item;
+import org.expeditee.items.Picture;
+import org.expeditee.items.Text;
+import org.honours.collection.CollectionItem;
+import org.honours.html.Div;
+import org.honours.html.Table;
+import org.honours.html.TableRow;
+import org.honours.items.Data;
+import org.honours.items.PictureInformation;
+import org.honours.items.TextInformation;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+public class CollectionCustomizer {
+
+	private final String CONFIG_FILE = "collectionConfig.xml";
+	private final String ETC_DIR_NAME = "etc";
+	
+	private List<Text> _textList;
+	private List<Text> _annotationList; 
+	private List<Picture> _pictureList;
+	private List<Dot> _dotList;
+	private List<Table> _tablesList;
+	private List<Div> _divsList;
+	
+	private List<Object> _remove;
+	
+	private String _collectionConfigFilePath = null;
+	
+	private CollectionConfigEditor _collectConfigEditor;
+	
+	private static CollectionCustomizer _collectionCustomizer;
+	
+	private CollectionItem _collectionItem;
+	private Frame _mainItemFrame;
+	
+	/**
+	 * Instantiate a new CollectionCustomizer object.
+	 * @param collectionPath
+	 */
+	private CollectionCustomizer(String collectionPath){
+		_collectionConfigFilePath = collectionPath + File.separator +
+				ETC_DIR_NAME + File.separator + CONFIG_FILE;
+		
+		_textList = new ArrayList<Text>();
+		_annotationList = new ArrayList<Text>(); 
+		_pictureList = new ArrayList<Picture>();
+		_dotList = new ArrayList<Dot>();
+		_tablesList = new ArrayList<Table>();
+		_divsList = new ArrayList<Div>();
+		
+		_remove = new ArrayList<Object>();
+		
+		_collectConfigEditor = CollectionConfigEditor.getInstance(_collectionConfigFilePath);
+	}
+	
+	/**
+	 * Get instance of a CollectionCustomizer object.
+	 * @param _collectionPath
+	 * @return
+	 */
+	public static CollectionCustomizer getInstance(String _collectionPath) {
+		
+		if(_collectionCustomizer == null)
+			_collectionCustomizer = new CollectionCustomizer(_collectionPath);
+		
+		return _collectionCustomizer;
+	}
+
+	/**
+	 * Entry point where we start customizing
+	 * the display of the collection.
+	 * @param currCI
+	 */
+	public void customize(CollectionItem cItem) {
+		_collectionItem = cItem;
+		_mainItemFrame = _collectionItem.getFrame();
+		
+		getFrameItems();
+		sortDotItems();
+		obtainTables();
+		obtainDivs();
+		editGsdlDisplay();
+		
+	}
+
+	/**
+	 * Reset collection customizer instance so 
+	 * we can instantiate a new one for another collection/frameset.
+	 */
+	public static void reset() {
+		_collectionCustomizer = null;
+		
+	}
+	
+	/**
+	 * Reads all items on the frame and stores them
+	 * for future use.
+	 */
+	private void getFrameItems(){
+		for(Item item : _mainItemFrame.getItems()){
+			
+			if(item.isAnnotation()){
+				if (item.getText().startsWith("@i:"))
+					_pictureList.add(PictureInformation.getPicture((Text)item));
+				else
+					_annotationList.add((Text) item);
+			}
+			else if (item instanceof Text) {
+				_textList.add((Text) item);
+			} else if (item instanceof Dot) {
+
+				// the dot belongs to a rectangle.
+				if (item.getConstraints().size() == 2 && item.getLines().size() == 2)
+					_dotList.add((Dot) item);
+			}
+			
+		}		
+	}
+	
+	/**
+	 * Retrieve all the dot items. For each rectangle on a frame, 
+	 * only one dot from that rectangle will remain in the dot list.
+	 */
+	@SuppressWarnings({ "unchecked", "rawtypes" })
+	private void sortDotItems(){
+		Collections.sort(_dotList, new Comparator() {
+
+			public int compare(Object o1, Object o2) {
+				Dot d1 = (Dot) o1;
+				Dot d2 = (Dot) o2;
+				return new Integer(d1.getID()).compareTo(new Integer(d2.getID()));
+			}
+		});
+
+
+			int iter = 0;
+			List<Dot> tempDotList = _dotList;
+			List<Rectangle> tempRectList = new ArrayList<Rectangle>();
+			_dotList = new ArrayList<Dot>();
+			
+			while(iter < tempDotList.size()){
+				
+				Dot curr = tempDotList.get(iter);
+				Rectangle currRect = curr.getEnclosedRectangle();
+				
+				if(!tempRectList.contains(currRect)){
+					tempRectList.add(currRect);
+					_dotList.add(curr);
+				}
+				
+				iter++;
+			}
+	}
+	
+	/**
+	 * Obtain all rectangles on a frame that are considered
+	 * to be a table object. Each rectangle is sorted firstly
+	 * by its x coordinate and then its y coordinate.
+	 */
+	@SuppressWarnings({ "unchecked", "rawtypes" })
+	private void obtainTables(){
+		//Sort dot list by x coordinate.
+		Collections.sort(_dotList, new Comparator(){
+			public int compare(Object o1, Object o2){
+				Dot d1 = (Dot) o1;
+				Dot d2 = (Dot) o2;
+				
+				Rectangle r1 = d1.getEnclosedRectangle();
+				Rectangle r2 = d2.getEnclosedRectangle();
+				return new Integer(r1.x).compareTo(r2.x);
+			}
+		});
+		
+		// Sort dot list by y coordinate.
+		Collections.sort(_dotList, new Comparator() {
+			
+			public int compare(Object o1, Object o2) {
+				Dot d1 = (Dot) o1;
+				Dot d2 = (Dot) o2;
+
+				Rectangle r1 = d1.getEnclosedRectangle();
+				Rectangle r2 = d2.getEnclosedRectangle();
+				return new Integer(r1.y).compareTo(r2.y);
+			}
+		});
+		
+		if(_dotList.size() > 0){
+			
+			TableRow row = new TableRow();
+			row.addDot(_dotList.get(0));
+			Rectangle curr = _dotList.get(0).getEnclosedRectangle();
+			List<TableRow> listOfRows = new ArrayList<TableRow>();
+
+			recursionRows(curr, 1, row, listOfRows);
+
+			// Now that we have found all rows, we determine how to group these
+			// rows in their respective tables!
+			if (listOfRows.size() > 0) {
+				TableRow currRow = listOfRows.get(0);
+				Table table = new Table();
+				recursionTables(currRow, table, 1, listOfRows);
+			}
+		}
+	}
+
+	/**
+	 * Obtains all rows of rectangles from a frame and turns them into table row (tr) objects.
+	 * @param r - the current rectangle being read on the frame.
+	 * @param i - a counter.
+	 * @param row - the row for adding the rectangle to.
+	 * @param listOfRows - the list to add the row to.
+	 */
+	private void recursionRows(Rectangle r, int i, TableRow row, List<TableRow> listOfRows){
+		if (!row.getRow().contains(r))
+			row.add(r);
+
+		if (i < _dotList.size()) {
+			Rectangle compare = _dotList.get(i).getEnclosedRectangle();
+
+			if (r.y == compare.y) {
+
+				if (r.x + r.width == compare.x) {
+					row.add(compare);
+					row.addDot(_dotList.get(i));
+					i++;
+					recursionRows(compare, i, row, listOfRows);
+				}
+			} else {
+				listOfRows.add(row);
+				row = new TableRow();
+				row.addDot(_dotList.get(i));
+				i++;
+				recursionRows(compare, i, row, listOfRows);
+			}
+		} else {
+			listOfRows.add(row);
+			return;
+		}
+	}
+	
+	/**
+	 * Once all rows are obtained on a frame, they are grouped
+	 * together to obtain tables.
+	 * @param row - the current row being processed
+	 * @param table - the table to add the row to
+	 * @param i - a counter
+	 * @param listOfRows - to obtain a row for comparison.
+	 */
+	private void recursionTables(TableRow row, Table table, int i, List<TableRow> listOfRows){
+		
+		if (!table.getTable().contains(row))
+			table.addRow(row);
+
+		if (i < listOfRows.size()) {
+
+			TableRow compare = listOfRows.get(i);
+			Rectangle rowRect = row.getRow().get(0);
+			Rectangle compareRect = compare.getRow().get(0);
+
+			if (rowRect.x == compareRect.x) {
+
+				if (rowRect.y + rowRect.height == compareRect.y) {
+					table.addRow(compare);
+					i++;
+					recursionTables(compare, table, i, listOfRows);
+				}
+				else{		//not sure if i need this else statement just yet...
+					_tablesList.add(table);
+					table = new Table();
+					i++;
+					recursionTables(compare,table,i,listOfRows);
+				}
+			} else {
+				_tablesList.add(table);
+				table = new Table();
+				i++;
+				recursionTables(compare, table, i, listOfRows);
+			}
+		} else {
+			_tablesList.add(table);
+			return;
+		}
+	}
+	
+	/**
+	 * Obtains all rectangles on a frame that are considered to be div objects.
+	 * A rectangle is considered a div if it stands alone 
+	 * (i.e. no other rectangles are joined to it).
+	 */
+	private void obtainDivs(){
+		
+		int iter = _tablesList.size() - 1;
+		while (iter > -1) {
+
+			Table table = _tablesList.get(iter);
+			if (table.getTable().size() == 1) {
+
+				TableRow row = table.getTable().get(0);
+				 
+				if (row.getRow().size() == 1) {
+					Rectangle r = row.getRow().get(0);
+					Dot d = row.getDots().get(0);
+
+					Div div = new Div(r);
+					div.setDot(d);
+					_divsList.add(div);
+					_tablesList.remove(iter); // remove table from _tablesList since it is really a div.					
+				}
+			}
+			iter--;
+		}
+	}
+	
+	/**
+	 * This is where we start processing all items on
+	 * a frame and writing out the matching HTML.
+	 */
+	private void editGsdlDisplay(){
+		
+		try{
+			Element documentContent = _collectConfigEditor.getDocumentContentTemplate();
+			
+			//setUpAnnotationsTemplate(_collectConfigEditor.getExpediteeAttrTable());
+			
+			List<Object> objects = new ArrayList<Object>();
+			
+			addToObjects(objects, _textList);
+			addToObjects(objects, _pictureList);
+			addToObjects(objects, _tablesList);
+			addToObjects(objects, _divsList);
+			
+			sortObjectsList(objects);
+			
+			processItems(objects,documentContent,null,null);
+			
+			//Append showAssocFilePath template.
+			appendAssocFilePathTemplate(documentContent);
+			
+			//changeGsContentHeight();
+			
+			_collectConfigEditor.write();
+			
+		}catch(Exception e){
+			e.printStackTrace();
+			return;
+		}
+	}
+	
+	/**
+	 * Add in the "showAssocFilePath" template to the collectionConfig.xml file and calls 
+	 * this template in the documentContent section.
+	 * The "showAssocFilePath" template is used to display the GSDL document's 
+	 * matching assocfilepath value, provided the user has appended the document's 
+	 * URL with "p.showAssocFilePath=1".
+	 * @param documentContent - the document content template to append the <xsl:call-template name="showAssocFilePath"/> element to.
+	 */
+	private void appendAssocFilePathTemplate(Element documentContent){
+		
+		Document doc = documentContent.getOwnerDocument();
+		Element assocFilePathTemplate = _collectConfigEditor.getAssocFilePathTemplate();
+		
+		Element xslIf = doc.createElement("xsl:if");
+		xslIf.setAttribute("test","/page/pageRequest/paramList/param[@name='p.showAssocFilePath']/@value='1'");
+		assocFilePathTemplate.appendChild(xslIf);
+		
+		Element span = doc.createElement("span");
+		span.setAttribute("data", "gsdl.Metadata: assocfilepath");
+		xslIf.appendChild(span);
+		
+		span.appendChild(doc.createTextNode("@assocfilepath "));
+		
+		Element gsfMetadata = doc.createElement("gsf:metadata");
+		gsfMetadata.setAttribute("name","assocfilepath");
+		span.appendChild(gsfMetadata);
+		
+		//Generate <xsl:call-template name="showAssocFilePath"/> and append to end of documentContent template.
+		Element xslCall = doc.createElement("xsl:call-template");
+		xslCall.setAttribute("name", "showAssocFilePath");
+		
+		documentContent.appendChild(xslCall);
+		
+	}
+
+	/**
+	 * Method to add items in a list to a list of objects.
+	 * @param objects
+	 * @param list
+	 */
+	@SuppressWarnings("rawtypes")
+	public static void addToObjects(List<Object> objects, List list) {
+		for (int i = 0; i < list.size(); i++) {
+			objects.add(list.get(i));
+		}
+	}
+	
+	/**
+	 * Sort all objects in a list first by their x coordinate
+	 * and then by their y coordinate.
+	 * @param l
+	 */
+	@SuppressWarnings({ "unchecked", "rawtypes" })
+	public static void sortObjectsList(List<Object> l) {
+
+		//sort by x-coordinate
+		Collections.sort(l, new Comparator(){
+			
+			@Override 
+			public int compare(Object o1, Object o2){
+				
+				int d1 = 0;
+				int d2 = 0;
+				
+				if(o1 instanceof Text){
+					Text t1 = (Text)o1;
+					d1 = t1.getX();
+				}else if(o1 instanceof Picture){
+					Picture p1 = (Picture) o1;
+					d1 = p1.getX();
+				}else if(o1 instanceof Table){
+					Table t1 = (Table)o1;
+					d1 = (int)(t1.getTable().get(0).getRow().get(0).getY());
+				}else if(o1 instanceof Div){
+					Div div1 = (Div)o1;
+					d1 = (int)(div1.getDiv().getY());
+				}
+				
+				if(o2 instanceof Text){
+					Text t2 = (Text)o2;
+					d2 = t2.getX();
+				}else if(o2 instanceof Picture){
+					Picture p2 = (Picture)o2;
+					d2 = p2.getX();
+				}else if(o2 instanceof Table){
+					Table t2 = (Table)o2;
+					d2 = (int)(t2.getTable().get(0).getRow().get(0).getY());
+				}else if(o2 instanceof Div){
+					Div div2 = (Div)o2;
+					d2 = (int)(div2.getDiv().getY());
+				}
+				
+				return new Integer(d1).compareTo(new Integer(d2));
+			}
+		});
+		
+		
+		//sort by y-coordinate
+		Collections.sort(l, new Comparator() {
+
+			@Override
+			public int compare(Object o1, Object o2) {
+				int d1 = 0;
+				int d2 = 0;
+
+				if (o1 instanceof Text) {
+					Text t1 = (Text) o1;
+					d1 = t1.getY();
+				} else if (o1 instanceof Picture) {
+					Picture p1 = (Picture) o1;
+					d1 = p1.getY();
+				} else if (o1 instanceof Table) {
+					Table t1 = (Table) o1;
+					d1 = (int) (t1.getTable().get(0).getRow().get(0).getY());
+				} else if (o1 instanceof Div) {
+					Div div1 = (Div) o1;
+					d1 = (int) (div1.getDiv().getY());
+				}
+
+				if (o2 instanceof Text) {
+					Text t2 = (Text) o2;
+					d2 = t2.getY();
+				} else if (o2 instanceof Picture) {
+					Picture p2 = (Picture) o2;
+					d2 = p2.getY();
+				} else if (o2 instanceof Table) {
+					Table t2 = (Table) o2;
+					d2 = (int) (t2.getTable().get(0).getRow().get(0).getY());
+				} else if (o2 instanceof Div) {
+					Div div2 = (Div) o2;
+					d2 = (int) (div2.getDiv().getY());
+				}
+
+				return new Integer(d1).compareTo(new Integer(d2));
+			}
+		});
+	}
+	
+	/**
+	 * 
+	 * @param objects
+	 * @param docContent
+	 * @param containerElem
+	 * @param containeRect
+	 */
+	private void processItems(List<Object> objects,Element docContent,Element containerElem,Rectangle containerRect)
+			throws Exception{
+	
+		for (Object o : objects) {
+			if (o instanceof Text) {
+				Text text = (Text) o;
+				processText(text, docContent, containerElem,containerRect);
+			} else if (o instanceof Picture) {
+				Picture pic = (Picture) o;
+				processPicture(pic, docContent, containerElem, containerRect);
+			} else if (o instanceof Table) {
+				Table table = (Table) o;
+				drawTable(table,docContent,containerElem,containerRect);
+			} else if (o instanceof Div) {
+				Div div2 = (Div) o;
+				drawDiv(div2,docContent,containerElem,containerRect);
+			}
+
+		}
+	}
+	
+	/**
+	 * Process any text items on an Expeditee frame and
+	 * write out the appropriate html.
+	 * @param text
+	 * @param docContent
+	 * @param containerElem
+	 * @param containerRect
+	 */
+	private void processText(Text text, Element docContent, Element containerElem, Rectangle containerRect){
+		
+		if(!_remove.contains(text)){
+			
+			Font font = text.getPaintFont();
+			Color c = text.getColor();
+			float size = text.getSize();
+			
+			String[] fontAttr = TextInformation.setUpFontAttributes(font,c);
+			
+			Document doc = docContent.getOwnerDocument();
+			
+			//Returns either a heading or paragraph html element depending on font styles & size.
+			Element elem = TextInformation.determineTextElemType(size,fontAttr[1].equals("bold"),doc);
+			docContent.appendChild(elem);
+			
+			//StringBuffer to store value of the paragraph's style attributes
+			StringBuffer style = new StringBuffer("");
+			
+			//Only write out font size if dealing with a paragraph element.
+			if(elem.getNodeName().equals("p")){
+				style.append("font-size: " + size + "px; ");
+			}
+			
+			style.append("font-family: " + fontAttr[0] + "; ");
+			style.append("font-style: " + fontAttr[2] + "; ");
+			style.append("color: " + fontAttr[3] + "; ");
+			
+			//if the text has a parent element
+			if(containerElem != null){
+				containerElem.appendChild(elem);
+				
+				if(containerElem.getNodeName().equals("div")){
+					
+					style.append("position: absolute;");
+					int left = text.getX() - containerRect.x;
+					int top = (text.getArea().getBounds().y - text.getHeight()) - containerRect.y;
+					style.append("left: " + left + "px; ");
+					style.append("top: " + top + "px; ");
+				}
+			}
+			
+			elem.setAttribute("style",style.toString());
+			
+			if(Data.HasData(text)){
+				
+				Element e = doc.createElement("gsf:metadata");
+				String data = text.getData().get(0);
+				elem.setAttribute("data", data);
+				e.setAttribute("name",data);
+				elem.appendChild(e);
+			}else{
+				org.w3c.dom.Text textNode = doc.createTextNode(text.getText());
+				elem.appendChild(textNode);
+			}
+			
+			_remove.add(text);
+			
+		}
+	}
+	
+	/**
+	 * 
+	 * Process any picture items on the frame and
+	 * write out image tags in the collectionConfig.xml file.
+	 * Creates an <xsl:template></xsl:template> which should
+	 * overwrite GSDL's <xsl:template name="sectionImage"></xsl:template>
+	 * originally located in web\interfaces\default\transform\pages\document.xsl.
+	 * Then the line: <xsl:call-template name="sectionImage"/> should be
+	 * written to the document-content template. 
+	 * 
+	 * @param pic - the Expeditee picture item currently being processed
+	 * @param docContent - the document-content template we are writing html to
+	 * @param containerElem - an element the picture may be a child of
+	 * @param containerRect - the rectangle representing the container element
+	 */
+	private void processPicture(Picture pic, Element docContent, Element containerElem, Rectangle containerRect){
+		if(!_remove.contains(pic)){
+			
+			//Border styling info
+			Color c = pic.getBorderColor();
+			float thickness = (pic.getThickness() <= 0) ? 1 : pic.getThickness();
+			String color = (c != null) ? Conversion.getCssColor(c) : Conversion.getCssColor(Color.BLACK);
+						
+			Document doc = docContent.getOwnerDocument();
+			
+			//true for now...
+			boolean isGsdlImage = true;
+			Text source = pic.getSource();
+			
+			if(isGsdlImage){
+				
+				Element sectionImgTemplate = _collectConfigEditor.getSectionImageTemplate();
+				
+				StringBuffer style = new StringBuffer("");
+				
+				//Deal with changes in size of image.
+				int width = pic.getBoundsWidth();
+				int height = pic.getBoundsHeight();
+				
+
+				style.append("border: " + thickness + "px solid " + color + "; ");
+								
+				Element xslCallTemplate = doc.createElement("xsl:call-template");
+				xslCallTemplate.setAttribute("name","sectionImage");
+				
+				//if image is a child of another element (such as a div)
+				if(containerElem != null){
+					
+					if(containerElem.getNodeName().equals("div")){
+						style.append("position: absolute; ");
+						
+						int left = pic.getX() - containerRect.x;
+						int top = pic.getY() - containerRect.y;
+						
+						style.append("left: " + left + "px; ");
+						style.append("top: " + top + "px; ");
+						
+						containerElem.appendChild(xslCallTemplate);
+						
+					}else if(containerElem.getNodeName().equals("td")){
+						containerElem.appendChild(xslCallTemplate);
+					}
+				}else{
+					docContent.appendChild(xslCallTemplate);
+				}
+				
+				//Create <xsl:variable></xsl:variable> element
+				Element screenXslVariable = doc.createElement("xsl:variable");
+				screenXslVariable.setAttribute("name","ScreenName");
+				screenXslVariable.appendChild(doc.createTextNode("Screen"));
+
+				sectionImgTemplate.appendChild(screenXslVariable);
+				
+				//Create <img></img> element
+				Element img = doc.createElement("img");
+				img.setAttribute("style",style.toString());
+				img.setAttribute("width",Integer.toString(width));
+				img.setAttribute("height",Integer.toString(height));
+				sectionImgTemplate.appendChild(img);
+				
+				//Create <xsl:attribute name='src'></xsl:attribute> element
+				Element srcXslAttribute = doc.createElement("xsl:attribute");
+				srcXslAttribute.setAttribute("name","src");
+				img.appendChild(srcXslAttribute);
+				
+				//Create <xsl:value-of ..../> element.
+				Element xslValueOf = createXslValueOfElem("yes", "/page/pageResponse/collection/metadataList/metadata[@name= 'httpPath']",doc);
+				srcXslAttribute.appendChild(xslValueOf);
+				
+				
+				//Create <xsl:text></xsl:text> element
+				Element xslText = createXslText("/index/assoc/",doc);
+				
+				System.err.println("xslText: " + xslText);
+				System.err.println("srcXslAttribute: " + srcXslAttribute);
+				
+				srcXslAttribute.appendChild(xslText);
+				
+				xslValueOf = createXslValueOfElem("yes","/page/pageResponse/document/metadataList/metadata[@name = 'assocfilepath']",doc);
+				srcXslAttribute.appendChild(xslValueOf);
+				
+				xslText = createXslText("/",doc);
+				srcXslAttribute.appendChild(xslText);
+				
+				xslValueOf = createXslValueOfElem("yes","(.//metadataList)[last()]/metadata[@name = $ScreenName]",doc);
+				srcXslAttribute.appendChild(xslValueOf);
+			}else{
+				
+				_annotationList.add(source);
+			}
+			
+			//TODO: Deal with situation where actual image changes.
+			
+			//TODO: Deal with display of multiple images.
+			
+			//TODO: Deal with adding images not part of GSDL collection.
+			
+			_remove.add(pic);
+			
+		}
+	}
+	
+	private Element createXslValueOfElem(String disable, String select, Document doc){
+		
+		Element xslValueOf = doc.createElement("xsl:value-of");
+		
+		xslValueOf.setAttribute("disable-output-escaping",disable);
+		xslValueOf.setAttribute("select",select);
+		
+		return xslValueOf;
+	}
+	
+	private Element createXslText(String text, Document doc){
+		
+		Element xslText = doc.createElement("xsl:text");
+		xslText.appendChild(doc.createTextNode(text));
+		
+		return xslText;
+	}
+	
+	/**
+	 * 
+	 * @param table
+	 * @param docContent
+	 * @param containerElem
+	 * @param containerRect
+	 */
+	private void drawTable(Table table, Element docContent, Element containerElem, Rectangle containerRect){
+		if(!_remove.contains(table)){
+			
+			int tableWidth = 0;
+			List<Rectangle> firstRow = table.getTable().get(0).getRow();
+			
+			for (Rectangle rect : firstRow)
+				tableWidth += rect.width;
+
+			Color bg, c;
+			String bgColor, color;
+			float thickness;
+
+			Dot d = table.getTable().get(0).getDots().get(0);
+			c = (d.getBorderColor() != null) ? d.getBorderColor() : d.getColor();
+			color = (c != null) ? Conversion.getCssColor(c) : Conversion.getCssColor(Color.black);
+			thickness = d.getThickness() >= 0 ? d.getThickness() : 1;
+			
+			Document doc = docContent.getOwnerDocument();
+			Element tableEl = doc.createElement("table");
+			docContent.appendChild(tableEl);
+			
+			StringBuffer styleAttr = new StringBuffer("");
+			styleAttr.append("border-collapse: collapse; ");
+			styleAttr.append("border: " + thickness + "px solid " + color + "; ");
+		
+			if (containerRect != null) {
+				String percentageWidth = String.format("%2.02f",
+						((float) tableWidth) / containerRect.width * 100) + "%";
+				styleAttr.append("width: " + percentageWidth + "; ");
+			}
+			
+			if (containerElem != null) { 
+				//absolute position table within its parent
+				styleAttr.append("position: absolute; ");
+				int left = firstRow.get(0).x - containerRect.x;
+				int top = firstRow.get(0).y - containerRect.y;
+				styleAttr.append("left: " + left + "px; ");
+				styleAttr.append("top: " + top + "px;");
+			}
+			
+			tableEl.setAttribute("style", styleAttr.toString());
+			tableEl.setAttribute("cellpadding", "1");
+			tableEl.setAttribute("cellspacing", "0");
+			
+			// Retrieve each table row (<tr>)
+			for (int j = 0; j < table.getTable().size(); j++) {
+				
+				TableRow currRow = table.getTable().get(j);
+				Element row = doc.createElement("tr");
+				
+				//Retrieve each table cell <td>
+				for(int k = 0; k < currRow.getRow().size(); k++){
+					
+					Dot currCellDot = currRow.getDots().get(k);
+					Rectangle currCell = currRow.getRow().get(k);
+					bg = currCellDot.getFillColor();
+					bgColor = (bg != null) ? Conversion.getCssColor(bg) : Conversion.getCssColor(Color.WHITE);
+
+					Element td = doc.createElement("td");
+
+					styleAttr = new StringBuffer("");
+					styleAttr.append("border: " + thickness + "px solid " + color + "; ");
+					styleAttr.append("background-color: " + bgColor + ";");
+					td.setAttribute("style", styleAttr.toString());
+					getItemsWithinContainer(currCell, td, docContent);
+
+					row.appendChild(td);
+				}
+				
+				tableEl.appendChild(row);
+				
+			}
+			
+			if (containerElem != null)
+				containerElem.appendChild(tableEl);
+			
+			_remove.add(table);
+		}
+	}
+	
+	private void getItemsWithinContainer(Rectangle currContainer, Element elem,Element docContent){
+		
+		int currX = currContainer.x;
+		int currY = currContainer.y;
+		
+		int currWidth = currContainer.width;
+		int currHeight = currContainer.height;
+		
+		int[] dimensions = new int[]{ currX, currY, currWidth, currHeight };
+		
+		List<Item> itemsInCell = new ArrayList<Item>();
+		
+		addToItemsInCell(_textList,itemsInCell,dimensions);
+		addToItemsInCell(_pictureList,itemsInCell,dimensions);
+		
+		for(Item i : itemsInCell){
+			if(i instanceof Text){
+				processText((Text)i,docContent,elem,currContainer);
+			}else if(i instanceof Picture){
+				processPicture((Picture)i,docContent,elem,currContainer);
+			}
+		}
+	}
+	
+	/**
+	 * Method to add items to a list of items within a particular cell/container.
+	 * @param items
+	 * @param itemsInCell
+	 * @param dimensions
+	 */
+	@SuppressWarnings("rawtypes")
+	public static void addToItemsInCell(List items, List<Item> itemsInCell,int[] dimensions) {
+
+		for (int i = 0; i < items.size(); i++) {
+			Item t = (Item) items.get(i);
+			if (t.getX() >= dimensions[0]
+					&& t.getX() <= dimensions[0] + dimensions[2]) {
+				if (t.getY() >= dimensions[1]
+						&& t.getY() <= dimensions[1] + dimensions[3])
+					itemsInCell.add(t);
+			}
+		}
+	}
+	
+	/**
+	 * Writes out div html and any html
+	 * within the div to the collectionConfig.xml file.
+	 * @param div
+	 * @param docContent
+	 * @param containerElem
+	 * @param containerRect
+	 */
+	private void drawDiv(Div div, Element docContent, Element containerElem, Rectangle containerRect){
+		
+		if(!_remove.contains(div)){
+			
+			Dot d = div.getDot();
+			
+			Color c = (d.getBorderColor() != null) ? d.getBorderColor() : d.getColor();
+			String color = (c != null) ? Conversion.getCssColor(c) : Conversion.getCssColor(Color.BLACK);
+			Color bg = d.getFillColor();
+			
+			String bgColor = (bg != null) ? Conversion.getCssColor(bg) : Conversion.getCssColor(Color.WHITE);
+			
+			float thickness = d.getThickness() >= 0 ? d.getThickness() : 1;
+			int width = div.getDiv().width;
+			int height = div.getDiv().height;
+			
+			Document doc = docContent.getOwnerDocument();
+			Element divEl = doc.createElement("div");
+			docContent.appendChild(divEl);
+			
+			StringBuffer styleAttr = new StringBuffer("");
+			styleAttr.append("border: " + thickness + "px solid " + color + "; ");
+			styleAttr.append("background-color: " + bgColor + "; ");
+			styleAttr.append("width: " + width + "px; ");
+			styleAttr.append("height: " + height + "px; ");
+			
+			//the element has a parent so position the element relevant to this parent.
+			if (containerRect != null) {
+				styleAttr.append("position: absolute; ");
+				int left = div.getDiv().x - containerRect.x;
+				int top = div.getDiv().y - containerRect.y;
+				
+				styleAttr.append("left: " + left + "px; ");
+				styleAttr.append("top: " + top + "px;");
+			} else	// the element does NOT have a parent (i.e. it most likely IS a parent)
+				styleAttr.append("position: relative; ");
+
+				String id = null;
+				if(Data.HasData(d)){
+				id = d.getData().get(0);
+			}
+				
+			if(id != null)
+				divEl.setAttribute("id",id);
+			
+			divEl.setAttribute("style", styleAttr.toString());
+			
+			// Add ALL items within the div to this list.
+			List<Object> objects = new ArrayList<Object>();
+			
+			Rectangle container = div.getDiv();
+			
+			addToChildrenObjects(objects, _textList, div, container);
+			addToChildrenObjects(objects, _pictureList, div, container);
+			addToChildrenObjects(objects, _tablesList, div, container);
+			addToChildrenObjects(objects, _divsList, div, container);
+			
+			sortObjectsList(objects);
+			
+			try{
+				processItems(objects, docContent,divEl,div.getDiv());
+			}catch(Exception e){
+				e.printStackTrace();
+				return;
+			}
+			
+			if (containerElem != null)
+				containerElem.appendChild(divEl);
+			
+			_remove.add(div);
+		}
+	}
+	
+	/**
+	 * Used to add all items located within another item (such 
+	 * as a rectangle) to the same list.
+	 * @param objects
+	 * @param list
+	 * @param div
+	 * @param container
+	 */
+	@SuppressWarnings({ "rawtypes" })
+	public static void addToChildrenObjects(List<Object> objects, List list, Div div,Rectangle container) {
+		for (int i = 0; i < list.size(); i++) {
+			
+			if (list.get(i) instanceof Item) {
+				Item currItem = (Item) list.get(i);
+				int currItemX = currItem.getX();
+				int currItemY = currItem.getY();
+				if (currItemX >= container.x && currItemX <= container.x + container.width)
+					if (currItemY >= container.y && currItemY <= container.y + container.height)
+						objects.add(currItem);
+				
+			} else if (list.get(i) instanceof Div) {
+				
+				Div currDiv = (Div) list.get(i);
+				Rectangle currDivRect = currDiv.getDiv();
+				
+				if (currDivRect.x >= container.x && currDivRect.x <= container.x + container.width)
+					if (currDivRect.y >= container.y && currDivRect.y <= container.y + container.height)
+						if (currDiv != div)
+							objects.add(currDiv);
+
+			} else if (list.get(i) instanceof Table) {
+				
+				Table currTable = (Table) list.get(i);
+				Rectangle currTableRect = currTable.getTable().get(0).getRow().get(0);
+
+				if (currTableRect.x >= container.x && currTableRect.x <= container.x + container.width)
+					if (currTableRect.y >= container.y && currTableRect.y <= container.y + container.height)
+						objects.add(currTable);
+			}
+		}
+	}
+	
+	
+}
Index: /other-projects/GlamED/trunk/src/org/honours/gui/HonoursFrameIO.java
===================================================================
--- /other-projects/GlamED/trunk/src/org/honours/gui/HonoursFrameIO.java	(revision 26588)
+++ /other-projects/GlamED/trunk/src/org/honours/gui/HonoursFrameIO.java	(revision 26588)
@@ -0,0 +1,193 @@
+package org.honours.gui;
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileWriter;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.expeditee.gui.DisplayIO;
+import org.expeditee.gui.Frame;
+import org.expeditee.gui.FrameIO;
+import org.expeditee.gui.FrameKeyboardActions;
+import org.expeditee.gui.MessageBay;
+import org.expeditee.gui.UserSettings;
+import org.expeditee.items.Item;
+import org.expeditee.items.Text;
+import org.expeditee.items.widgets.WidgetCorner;
+import org.expeditee.stats.Formatter;
+import org.honours.collection.CollectionItem;
+
+public class HonoursFrameIO {
+
+	private static Frame _lastCopiedFrame = null;	
+	
+	public static boolean DISPLAY_TOOLBAR = true;
+	public static boolean DISPLAY_LAYERS = true;
+	public static boolean DISPLAY_NOTES = false;
+	
+	public static boolean DISPLAY_TOGGLER = true;
+	
+	public static String COLLECTIONS_PATH = FrameIO.PARENT_FOLDER +
+			"collections" + File.separator;
+	
+	/**
+	 * Generate a new frame for a given (existing) 
+	 * frameset.
+	 * @param frameNumber - frame number for this next item.
+	 * @param frameset - frameset to add frame to.
+	 */
+	public static void generateFrame(int frameNumber, String frameset){
+		String frameFileName = FrameIO.FRAME_PATH + frameset + File.separator +
+				frameNumber + ".exp";
+		Frame checkExistingFrame = FrameIO.LoadFrame(frameset + frameNumber);
+		
+		if(checkExistingFrame == null){
+			FileWriter fw;
+			BufferedWriter bw;
+			
+			try{
+				fw = new FileWriter(frameFileName);
+				bw = new BufferedWriter(fw);
+				writeOutFrameHeader(bw);
+				FrameIO.WriteINF(FrameIO.FRAME_PATH, frameset, frameset+frameNumber);
+			}catch(Exception e){
+				e.printStackTrace();
+			}
+		}
+	}
+	
+	/**
+	 * Writes out a frame header for a new frame.
+	 * @param bw
+	 */
+	public static void writeOutFrameHeader(BufferedWriter bw){
+		try {
+			StringBuffer header = new StringBuffer("");
+			
+			header.append("V 1\n");
+			header.append("p 44");
+			header.append("U " + UserSettings.UserName + "\n");
+			header.append("D " + Formatter.getDateTime() + "\n");	//
+			header.append("M " + UserSettings.UserName + "\n");		//last modified by
+			header.append("d " + Formatter.getDateTime() + "\n");
+			header.append("Z\n\n");
+			bw.write(header.toString());
+			
+		}catch(Exception e) {
+			e.printStackTrace();
+		}
+	}
+
+	public static Frame CopyFrame() {
+		_lastCopiedFrame = DisplayIO.getCurrentFrame();
+		MessageBay.displayMessage("Item successfully copied.");
+		
+		return _lastCopiedFrame;
+	}
+
+	public static Frame PasteFrame() {
+		
+		Frame current = DisplayIO.getCurrentFrame();
+		if(_lastCopiedFrame != null){
+			
+			List<Item> list = _lastCopiedFrame.getVisibleItems();
+			List<Item> copy = new ArrayList<Item>();
+			
+			for(Item item : list){
+				if(!(item instanceof WidgetCorner))
+					copy.add(item);
+			}
+			
+			current.addAllItems(copy);
+			
+		}else{
+			MessageBay.errorMessage("ERROR: NO FRAME/ITEM TO COPY");
+			return null;
+		}
+		
+		return _lastCopiedFrame;
+
+	}
+	
+	/**
+	 * Toggles on and off the display of the "Toggle 
+	 * Toolbar" overlay.
+	 */
+	public static void toggleToggler(){
+		if(DISPLAY_TOGGLER){
+			swapLinks(Interfaces.TOGGLE_TOOLS_OVERLAY,Interfaces.BLANK_TOGGLER_OVERLAY);
+			DISPLAY_TOGGLER = false;
+		}else{
+			swapLinks(Interfaces.BLANK_TOGGLER_OVERLAY,Interfaces.TOGGLE_TOOLS_OVERLAY);
+			DISPLAY_TOGGLER = true;
+		}
+		FrameKeyboardActions.Refresh();
+	}
+
+	public static void ToggleToolbar() {
+		if(DISPLAY_TOOLBAR){
+			
+			swapLinks(Interfaces.NAVIGATION_OVERLAY,Interfaces.BLANK_TOOLBAR_OVERLAY);
+			DISPLAY_TOOLBAR = false;
+			
+		}else{
+			//make it reappear.
+			swapLinks(Interfaces.BLANK_TOOLBAR_OVERLAY,Interfaces.NAVIGATION_OVERLAY);
+			DISPLAY_TOOLBAR = true;
+		}
+		
+		FrameKeyboardActions.Refresh();
+	}
+
+	public static void ToggleNotesDisplay(CollectionItem collectItem) {
+		
+		//get link to the collection item's note frame.
+				String noteFrameLink = collectItem.getNoteLayer().getFrame().getName();
+				
+				if(DISPLAY_NOTES){
+					
+					swapLinks(noteFrameLink,Interfaces.BLANK_HIDE_NOTES_OVERLAY);
+					DISPLAY_NOTES = false;
+				
+					
+				}else{
+					swapLinks(Interfaces.BLANK_HIDE_NOTES_OVERLAY,noteFrameLink);
+					DISPLAY_NOTES = true;
+				}
+				FrameKeyboardActions.Refresh();
+		
+	}
+	
+
+	
+	/**
+	 * Used by toggleToolbar() and ToggleLayersDisplay() and ToggleNotesDisplay()
+	 * to change the overlay annotation links. So if we want
+	 * the display of these things off, the overlay will just be 
+	 * a blank frame. Otherwise the overlay will be the appropriate
+	 * frame displaying the toolbar/layer display.
+	 * @param oldLink
+	 * @param newLink
+	 */
+	private static void swapLinks(String oldLink,String newLink){
+		
+		Frame curr = DisplayIO.getCurrentFrame();
+		for(Item item : curr.getItems()){
+			
+			if(item instanceof Text){
+				Text t = (Text)item;
+				if(t.getText().equals("@ao:3") || t.getText().equals("@ao:4")){
+					if(t.hasLink()){
+						if(t.getLink().equals(oldLink)){
+							t.setLink(newLink);
+							return;
+						}
+					}
+				}
+			}
+		}
+	}
+
+
+}
Index: /other-projects/GlamED/trunk/src/org/honours/gui/Interfaces.java
===================================================================
--- /other-projects/GlamED/trunk/src/org/honours/gui/Interfaces.java	(revision 26588)
+++ /other-projects/GlamED/trunk/src/org/honours/gui/Interfaces.java	(revision 26588)
@@ -0,0 +1,231 @@
+package org.honours.gui;
+
+import java.util.List;
+
+import org.expeditee.gui.*;
+import org.expeditee.items.Text;
+
+import org.honours.Main;
+import org.honours.collection.*;
+
+/**
+ * This class is used for displaying the
+ * various different overlays/interfaces available.
+ * @author Korii
+ */
+public class Interfaces {
+	
+	//various frame names for the different interface overlays.
+	public static final String MAIN_INTERFACE_OVERLAY = "interface-overlays1";
+	public static final String NAVIGATION_OVERLAY = "interface-overlays2";
+	public static final String LAYERS_BACK_BTN_OVERLAY = "interface-overlays3";
+	public static final String TOGGLE_TOOLS_OVERLAY = "interface-overlays4";
+	//public static final String DISPLAY_LAYERS_OVERLAY = "interface-overlays5";
+	public static final String BLANK_TOOLBAR_OVERLAY = "interface-overlays6";
+	//public static final String BLANK_DISPLAY_LAYERS_OVERLAY = "interface-overlays7";
+	
+	//TODO: Overlay for hiding notes.
+	public static final String BLANK_HIDE_NOTES_OVERLAY = "interface-overlays9";
+	
+	public static final String BLANK_TOGGLER_OVERLAY = "interface-overlays10";
+	
+	private static final String AO_TEXT3 = "@ao:3";
+	private static final String _aoText4 = "@ao:4";
+
+	//used to determine positioning of the various @ao:3/4 text items.
+	private static int _mainOverAoX = 3;
+	private static int _mainOverAoY = 10;
+	
+	private static int _toolbarAoX = 1272;
+	private static int _toolbarAoY = 130;
+	
+	private static int _toggleAoX = 1272;
+	private static int _toggleAoY = 94;
+	
+	private static int _notesAoX = 1272;
+	private static int _notesAoY = 58;
+	
+	private static String _overlayAnnotationData = "overlay-annotation";
+	
+	
+	/**
+	 * This method sets up the main overlay on the profile
+	 * frame.
+	 * @param frame - frame to add the main overlay too.
+	 */
+	public static void setUpMainOverlay(Frame frame){
+		
+		List<Text> list = frame.getBodyTextItems(true);
+		
+		boolean found = false;
+		int i = 0;
+		
+		while(i < list.size() && !found){
+			
+			Text text = list.get(i);
+			
+			if(text.getText().equals(AO_TEXT3)){
+				if(text.hasLink()){
+					if(text.getLink().equals(MAIN_INTERFACE_OVERLAY)){
+						found = true;
+					}
+					
+				}
+			}
+			i++;
+		}
+		
+		if(!found){
+			Text t = frame.addText(_mainOverAoX,_mainOverAoY,AO_TEXT3,null);
+			t.setLink(MAIN_INTERFACE_OVERLAY);
+			
+			frame.setSaved();
+			frame.setChanged(true);
+		}
+		
+		FrameKeyboardActions.Refresh();
+	}
+	
+
+	/**
+	 * Set up overlay which displays toolbar for collection items.
+	 * @param cItem - the collection item to add the toolbar to (or rather its represented frame).
+	 */
+	public static void setUpToolbarOverlay(CollectionItem cItem) {
+		
+		Frame ciFrame = cItem.getFrame();
+		List<Text> list = ciFrame.getBodyTextItems(true);
+		
+		boolean found = false;
+		int i = 0;
+		
+		while(i < list.size() && !found){
+			
+			Text t = list.get(i);
+			
+			if(t.getText().equals(AO_TEXT3)){
+				
+				if(t.hasLink()){
+					if(t.getLink().equals(NAVIGATION_OVERLAY)){
+						found = true;
+					}
+				}
+			}
+			
+			i++;
+		}
+		
+		if(!found){
+			
+			Text newText = ciFrame.addText(_toolbarAoX,_toolbarAoY,AO_TEXT3,null);
+			newText.setLink(NAVIGATION_OVERLAY);
+		}
+	
+		
+	}
+
+	/**
+	 * Method to set up overlay which displays a "toggle toolbar" option/button.
+	 * @param cItem - the collection item to add the toggle toolbar option to.
+	 */
+	public static void setUpToggleToolbarOverlay(CollectionItem cItem) {
+		Frame ciFrame = cItem.getFrame();
+		List<Text> list = ciFrame.getBodyTextItems(true);
+		
+		boolean found = false;
+		int i = 0;
+		
+		while(i < list.size() && !found){
+			
+			Text t = list.get(i);
+			
+			if(t.getText().equals(AO_TEXT3)){
+				
+				if(t.hasLink()){
+					
+					if(t.getLink().equals(TOGGLE_TOOLS_OVERLAY)){
+						found = true;
+					}
+				}
+			}
+			i++;
+		}
+		
+		if(!found){
+			Text newText = ciFrame.addText(_toggleAoX,_toggleAoY,AO_TEXT3,null);
+			newText.setLink(TOGGLE_TOOLS_OVERLAY);
+		}
+		
+	}
+
+	/**
+	 * Method to set up an overlay for displaying notes for
+	 * the passed collection item.
+	 * @param cItem - collection item to add notes to.
+	 */
+	public static void setUpNotesOverlay(CollectionItem cItem) {
+		
+		Frame ciFrame = cItem.getFrame();
+		List<Text> list = ciFrame.getBodyTextItems(true);
+		
+		boolean found = false;
+		int i = 0;
+		
+		while(i < list.size() && !found){
+			
+			Text t = list.get(i);
+			
+			if(t.getText().equals(_aoText4)){
+				
+				if(t.hasLink()){
+					
+					if(t.getLink().startsWith("notes")){
+						found = true;
+					}
+					
+				}
+			}
+			
+			i++;
+		}
+		
+		if(!found){
+			
+			//check for an overlay frame in notes frameset associated with this collection item.
+			NoteLayer getNoteLayer = cItem.getNoteLayer();
+			Frame getNotesOverlayFrame = null;
+			
+			if(getNoteLayer == null){
+				
+				//Create a new notelayer and frame
+				getNoteLayer = new NoteLayer();
+				getNoteLayer.setAssociatedItem(cItem);
+				
+				//Create new frame.
+				int frameNumber = FrameIO.getLastNumber("notesmain") + 1;
+				HonoursFrameIO.generateFrame(frameNumber, "notesmain");
+				getNotesOverlayFrame = FrameIO.LoadFrame("notesmain"+frameNumber);
+				getNoteLayer.setFrame(FrameIO.LoadFrame(getNotesOverlayFrame.getName()));
+				cItem.setNoteLayer(getNoteLayer);
+				
+				//Add collectionItem back into collection
+				//Add collection back into collections list
+				Collection matchingCollection = Collection.findCollection(cItem.getFrame());
+				int collectionIndex = Collection.getCollectionPosition(matchingCollection);
+				int collectionItemPosition = CollectionItem.getPositionInCollection(cItem, matchingCollection);
+				
+				matchingCollection.getItems().remove(collectionItemPosition);
+				matchingCollection.getItems().add(collectionItemPosition,cItem);
+				
+				Main._collections.remove(collectionIndex);
+				Main._collections.add(collectionIndex, matchingCollection);
+			}else{
+				getNotesOverlayFrame = getNoteLayer.getFrame();
+			}
+			
+			Text newText = ciFrame.addText(_notesAoX,_notesAoY,_aoText4,null);
+			newText.setLink(getNotesOverlayFrame.getName());
+		}
+	}
+	
+}
Index: /other-projects/GlamED/trunk/src/org/honours/gui/KeyboardActions.java
===================================================================
--- /other-projects/GlamED/trunk/src/org/honours/gui/KeyboardActions.java	(revision 26588)
+++ /other-projects/GlamED/trunk/src/org/honours/gui/KeyboardActions.java	(revision 26588)
@@ -0,0 +1,71 @@
+package org.honours.gui;
+
+import java.awt.event.KeyEvent;
+import java.awt.event.KeyListener;
+
+import org.expeditee.gui.DisplayIO;
+import org.expeditee.gui.Frame;
+import org.expeditee.gui.FrameGraphics;
+import org.expeditee.gui.FrameKeyboardActions;
+import org.honours.actions.MiscActions;
+
+public class KeyboardActions implements KeyListener{
+
+	private static KeyboardActions _instance = null;
+	
+	private KeyboardActions(){}
+	
+	public static KeyboardActions getInstance(){
+		if(_instance == null)
+			_instance = new KeyboardActions();
+		
+		return _instance;
+	}
+	
+	@Override
+	public void keyPressed(KeyEvent e) {
+		
+		int keyCode = e.getKeyCode();
+		//Frame currFrame = DisplayIO.getCurrentFrame();
+		
+		//TODO:Check if current frame is a "content-layer"
+		
+		//If F9 (Audience Mode button) has been pressed.
+		if(keyCode == KeyEvent.VK_F9){
+			
+			if(FrameGraphics.isAudienceMode()){
+				//turn off display of toolbar.
+				HonoursFrameIO.DISPLAY_TOOLBAR = false;
+				MiscActions.ToggleToolbar();
+				
+				//turn off display of toggle toolbar
+				HonoursFrameIO.DISPLAY_TOGGLER = false;
+				MiscActions.ToggleToggler();
+				
+			}else{
+				HonoursFrameIO.DISPLAY_TOOLBAR = true;
+				MiscActions.ToggleToolbar();
+				
+				HonoursFrameIO.DISPLAY_TOGGLER = true;
+				MiscActions.ToggleToggler();
+				
+			}
+		}
+		
+				
+		FrameKeyboardActions.getInstance().keyPressed(e);
+	}
+
+	@Override
+	public void keyReleased(KeyEvent e) {
+		FrameKeyboardActions.getInstance().keyReleased(e);
+		
+	}
+
+	@Override
+	public void keyTyped(KeyEvent e) {
+		FrameKeyboardActions.getInstance().keyTyped(e);
+	}
+
+	
+}
Index: /other-projects/GlamED/trunk/src/org/honours/gui/MouseActions.java
===================================================================
--- /other-projects/GlamED/trunk/src/org/honours/gui/MouseActions.java	(revision 26588)
+++ /other-projects/GlamED/trunk/src/org/honours/gui/MouseActions.java	(revision 26588)
@@ -0,0 +1,64 @@
+package org.honours.gui;
+
+import java.awt.event.MouseEvent;
+import java.awt.event.MouseListener;
+import java.awt.event.MouseMotionListener;
+
+import org.expeditee.gui.FrameMouseActions;
+
+/**
+ * 
+ * @author Korii
+ *
+ */
+public class MouseActions implements MouseMotionListener, MouseListener {
+
+	private static MouseActions _instance = null;
+	
+	private MouseActions(){}
+	
+	public static MouseActions getInstance(){
+		
+		if(_instance == null)
+			_instance = new MouseActions();
+		
+		return _instance;
+	}
+	
+	@Override
+	public void mouseClicked(MouseEvent e) {
+		FrameMouseActions.getInstance().mouseClicked(e);
+	}
+
+	@Override
+	public void mouseEntered(MouseEvent e) {
+		FrameMouseActions.getInstance().mouseEntered(e);	
+	}
+
+	@Override
+	public void mouseExited(MouseEvent e) {
+		FrameMouseActions.getInstance().mouseExited(e);
+	}
+
+	@Override
+	public void mousePressed(MouseEvent e) {
+		FrameMouseActions.getInstance().mousePressed(e);
+	}
+
+	@Override
+	public void mouseReleased(MouseEvent e) {
+		FrameMouseActions.getInstance().mouseReleased(e);
+		
+	}
+
+	@Override
+	public void mouseDragged(MouseEvent e) {
+		FrameMouseActions.getInstance().mouseDragged(e);
+	}
+
+	@Override
+	public void mouseMoved(MouseEvent e) {
+		FrameMouseActions.getInstance().mouseMoved(e);
+	}
+
+}
Index: /other-projects/GlamED/trunk/src/org/honours/html/Div.java
===================================================================
--- /other-projects/GlamED/trunk/src/org/honours/html/Div.java	(revision 26588)
+++ /other-projects/GlamED/trunk/src/org/honours/html/Div.java	(revision 26588)
@@ -0,0 +1,36 @@
+package org.honours.html;
+
+import java.awt.Rectangle;
+import org.expeditee.items.Dot;
+
+/**
+ * Class that represents a Div object for converting
+ * rectangles on an Expeditee frame to div html elements.
+ * @author Korii
+ *
+ */
+public class Div {
+	
+	private Rectangle _div;
+	private Dot _dot;
+	
+	public Div(Rectangle d){
+		_div = d;
+	}
+	
+	public void setDot(Dot d){
+		_dot = d;
+	}
+	
+	public Dot getDot(){
+		return _dot;
+	}
+	
+	public void setDiv(Rectangle r){
+		_div = r;
+	}
+	
+	public Rectangle getDiv(){
+		return _div;
+	}
+}
Index: /other-projects/GlamED/trunk/src/org/honours/html/Table.java
===================================================================
--- /other-projects/GlamED/trunk/src/org/honours/html/Table.java	(revision 26588)
+++ /other-projects/GlamED/trunk/src/org/honours/html/Table.java	(revision 26588)
@@ -0,0 +1,114 @@
+package org.honours.html;
+
+import java.awt.Color;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.expeditee.io.Conversion;
+import org.expeditee.items.Dot;
+
+import org.w3c.dom.*;
+
+/**
+ * Class to produce table html elements from rectangles on
+ * an Expeditee frame. At least 2 rectangles joined together are
+ * required to produce a table.
+ * @author Korii
+ */
+public class Table {
+	
+	//A table consists of a list of rows
+	private List<TableRow> _table;
+	
+	private Dot _dot;
+	
+	//Table attributes
+	private int _cellspacing;
+	private int _cellpadding;
+	private int _left;
+	private int _top;
+	
+	private Alignment _alignment;
+	private Position _positioning;
+	
+	public enum Alignment{
+		CENTER, LEFT, RIGHT;
+	}
+	
+	public enum Position{
+		STATIC, ABSOLUTE, FIXED, RELATIVE, INHERIT;
+	}
+	
+	public Table(){
+		_table = new ArrayList<TableRow>();
+	}
+	
+	/**
+	 * Returns a complete <table> element which includes
+	 * all the <tr>'s, <td>'s and any text/images within
+	 * the <td>'s.
+	 * @param doc - the document to use when creating elements
+	 * @return - a complete table
+	 */
+	public Element getTableElement(Document doc){
+		
+		Element tableElem = doc.createElement("table");
+		setTableStyle(tableElem);
+		
+		//Append all <tr>'s to table. In TableRow class, append all <td>'s to the row.
+		for(int i = 0; i < _table.size(); i++){
+			
+			Element trElem = doc.createElement("tr");
+			tableElem.appendChild(trElem);
+		}
+		
+		return tableElem;
+	}
+	
+	private void setTableStyle(Element tableElem){
+		
+		Color c = (_dot.getColor() != null) ? _dot.getBorderColor() : _dot.getColor();
+		String color = (c != null) ? Conversion.getCssColor(c) : Conversion.getCssColor(Color.black);
+		
+		float thickness = _dot.getThickness() >= 0 ? _dot.getThickness() : 1;
+		
+		tableElem.setAttribute("cellpadding","1");
+		tableElem.setAttribute("cellspacing","0");
+		
+		StringBuffer styleAttr = new StringBuffer("");
+		styleAttr.append("border-collapse: collapse; ");
+		styleAttr.append("border: " + thickness +"px solid " + color + ";");
+		
+		tableElem.setAttribute("style",styleAttr.toString());
+	}
+	
+	public void addRow(TableRow r){
+		
+		_table.add(r);
+		
+		//gets the first dot in the row's list of dots and uses this as the dot for customizing the table
+		//attributes
+		if(_table.size() == 1){
+			
+			if(r.getDots() != null){
+				
+				if(r.getDots().size() > 0 && r.getDots().get(0) != null)
+					setDot(r.getDots().get(0));
+			}
+		}
+	}
+	
+	public List<TableRow> getTable(){
+		return _table;
+	}
+	
+	private void setDot(Dot d){
+		_dot = d;
+	}
+	
+	public Dot getDot(){
+		return _dot;
+	}
+	
+	
+}
Index: /other-projects/GlamED/trunk/src/org/honours/html/TableCell.java
===================================================================
--- /other-projects/GlamED/trunk/src/org/honours/html/TableCell.java	(revision 26588)
+++ /other-projects/GlamED/trunk/src/org/honours/html/TableCell.java	(revision 26588)
@@ -0,0 +1,5 @@
+package org.honours.html;
+
+public class TableCell {
+
+}
Index: /other-projects/GlamED/trunk/src/org/honours/html/TableRow.java
===================================================================
--- /other-projects/GlamED/trunk/src/org/honours/html/TableRow.java	(revision 26588)
+++ /other-projects/GlamED/trunk/src/org/honours/html/TableRow.java	(revision 26588)
@@ -0,0 +1,40 @@
+package org.honours.html;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.awt.Rectangle;
+
+import org.expeditee.items.Dot;		
+
+
+public class TableRow {
+
+	private List<Rectangle> _row;
+	private List<Dot> _dots;
+	
+	public TableRow()
+	{
+		_row = new ArrayList<Rectangle>();
+		_dots = new ArrayList<Dot>();
+	}
+	
+	/**
+	 * Add a rectangle (cell) to the row
+	 * @param r
+	 */
+	public void add(Rectangle r){
+		_row.add(r);
+	}
+	
+	public void addDot(Dot d){
+		_dots.add(d);
+	}
+	
+	public List<Dot> getDots(){
+		return _dots;
+	}
+	
+	public List<Rectangle> getRow(){
+		return _row;
+	}
+}
Index: /other-projects/GlamED/trunk/src/org/honours/items/Data.java
===================================================================
--- /other-projects/GlamED/trunk/src/org/honours/items/Data.java	(revision 26588)
+++ /other-projects/GlamED/trunk/src/org/honours/items/Data.java	(revision 26588)
@@ -0,0 +1,16 @@
+package org.honours.items;
+
+import org.expeditee.items.Item;
+
+public class Data {
+
+	public static boolean HasData(Item item)
+	{
+		if(item.getData() != null){
+			if(item.getData().size() > 0){
+				return true;
+			}
+		}
+		return false;
+	}
+}
Index: /other-projects/GlamED/trunk/src/org/honours/items/PictureInformation.java
===================================================================
--- /other-projects/GlamED/trunk/src/org/honours/items/PictureInformation.java	(revision 26588)
+++ /other-projects/GlamED/trunk/src/org/honours/items/PictureInformation.java	(revision 26588)
@@ -0,0 +1,80 @@
+package org.honours.items;
+
+import java.io.File;
+
+import org.expeditee.gui.MessageBay;
+import org.expeditee.items.Picture;
+import org.expeditee.items.Text;
+
+public class PictureInformation {
+
+	public static Picture getPicture(Text i){
+		
+		String[] array = getPictureInfo(i);
+		String filename = new File(array[0]).getName();
+		String path = new File(array[0]).getPath();
+		String getSize = array[1];
+		
+		MessageBay.displayMessage("array[0]=" + array[0]);
+		MessageBay.displayMessage("filename = " + filename);
+		MessageBay.displayMessage("path = " + path);
+	
+		Picture p = new Picture((Text)i,filename,path,getSize,null);
+		
+		return p;
+	}
+	
+	public static String getPictureFileName(Text a){
+		String filename = null;
+		
+		filename = a.getText().substring(3);
+		String temp = filename;
+		
+		if(filename.startsWith(" ")){
+			filename = temp.substring(1);
+		}
+		
+		return filename;
+	}
+	
+	public static String[] getPictureInfo(Text i){
+		
+		String s = i.getText().substring(3);
+		String temp = s;
+		
+		if(s.startsWith(" ")){
+			s = temp.substring(1);
+			temp = s;
+		}
+		String getSize = getSizeFromImageString(s);
+		
+		//reverse the string
+		StringBuffer sb = new StringBuffer(getSize);
+		getSize = sb.reverse().toString();
+		s = temp.substring(0,temp.length()-getSize.length()-1);
+		String[] array = new String[2];
+		array[0] = s;
+		array[1] = getSize;
+		
+		return array;
+	}
+	
+	private static String getSizeFromImageString(String s){
+		
+		String getSize = "";
+		int i = s.length() - 1;
+		char c;
+		
+		while((c = s.charAt(i)) != ' '){
+			boolean valid = ((c >= '0') && (c <= '9')) || (c == '.');
+			
+			if(valid)
+				getSize += c;
+			
+			i--;
+		}
+		return getSize;
+	}
+	
+	
+}
Index: /other-projects/GlamED/trunk/src/org/honours/items/TextInformation.java
===================================================================
--- /other-projects/GlamED/trunk/src/org/honours/items/TextInformation.java	(revision 26588)
+++ /other-projects/GlamED/trunk/src/org/honours/items/TextInformation.java	(revision 26588)
@@ -0,0 +1,42 @@
+package org.honours.items;
+
+import java.awt.Color;
+import java.awt.Font;
+
+import org.expeditee.io.Conversion;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+public class TextInformation {
+
+	public static Element determineTextElemType(float size, boolean isBold, Document doc)
+	{
+		Element elem = doc.createElement("p");
+		
+		if(isBold){
+			if(size == 32)
+				elem = doc.createElement("h1");
+			else if(size == 24)
+				elem = doc.createElement("h2");
+			else if(size == 18)
+				elem = doc.createElement("h3");
+			else if(size == 13)
+				elem = doc.createElement("h5");
+			else if(size == 10)
+				elem = doc.createElement("h6");
+		}
+		
+		return elem;
+	}
+	
+	public static String[] setUpFontAttributes(Font f, Color c){
+		
+		String[] a = new String[4];
+		a[0] = Conversion.getCssFontFamily(f.getFamily());	//add font family to first index position.
+		a[1] = (f.isBold()) ? "bold" : "normal";
+		a[2] = (f.isItalic()) ? "italic" : "normal";
+		a[3] = (c != null) ? Conversion.getCssColor(c) : Conversion.getCssColor(new Color(0,0,0));
+		
+		return a;
+	}
+}
