Index: /other-projects/GlamED/trunk/src/org/honours/widgets/CollectionSpaceDropBox.java
===================================================================
--- /other-projects/GlamED/trunk/src/org/honours/widgets/CollectionSpaceDropBox.java	(revision 26716)
+++ /other-projects/GlamED/trunk/src/org/honours/widgets/CollectionSpaceDropBox.java	(revision 26716)
@@ -0,0 +1,202 @@
+package org.honours.widgets;
+
+import java.awt.Color;
+import java.awt.Rectangle;
+import java.awt.event.MouseEvent;
+import java.awt.event.MouseListener;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.swing.JPanel;
+
+import org.expeditee.gui.DisplayIO;
+import org.expeditee.gui.Frame;
+import org.expeditee.gui.FrameIO;
+import org.expeditee.gui.MessageBay;
+import org.expeditee.items.Item;
+import org.expeditee.items.ItemParentStateChangedEvent;
+import org.expeditee.items.Text;
+import org.expeditee.items.widgets.DataFrameWidget;
+import org.expeditee.items.widgets.WidgetCorner;
+
+public class CollectionSpaceDropBox extends DataFrameWidget {
+
+	private JPanel _dropBox;
+	String[] _args = null;
+	
+	public CollectionSpaceDropBox(Text source, String[] args){
+		super(source, new JPanel(), 280,280,-1,400,400,-1);
+		_dropBox = (JPanel)_swingComponent;
+		_dropBox.setBackground(Color.getHSBColor(336, 28, 84));
+
+		//add mouse actions to drop box.
+		_dropBox.addMouseListener(new MouseListener() {
+			
+			@Override
+			public void mouseReleased(MouseEvent e) {
+				MessageBay.displayMessage("Mouse released");
+			}
+			
+			@Override
+			public void mousePressed(MouseEvent e) {
+				MessageBay.displayMessage("Mouse Pressed");
+			}
+			
+			@Override
+			//TODO: mouseExited not always called especially if 
+			//mouse is moved very quickly.
+			public void mouseExited(MouseEvent e) {
+				
+				//Get all images in the drop box area of this current frame.
+				Frame curr = DisplayIO.getCurrentFrame();
+				String collectionSpaceName = curr.getFramesetName();
+				
+				List<Item> imagesOnCurrentPanel = retrievePanel(curr);
+				
+				//Then clear the drop boxes on the other frames.
+				for(int i = 1; i <= FrameIO.getLastNumber(collectionSpaceName); i++){
+					Frame f = FrameIO.LoadFrame(collectionSpaceName + i);
+					if(f == null)
+						continue;
+					
+					if(f == curr)
+						continue;
+
+					clearPanel(f);
+					
+					addItemsBackToPanel(f,imagesOnCurrentPanel);
+					
+					
+				}
+				
+				
+				//Then update the cleared boxes so they look like the box on this current frame.
+				
+			}
+			
+			@Override
+			public void mouseEntered(MouseEvent e) {
+				MessageBay.displayMessage("Mouse Entered");
+			}
+			
+			@Override
+			public void mouseClicked(MouseEvent e) {
+				MessageBay.displayMessage("Mouse Clicked");
+				
+				
+			}
+		});
+		
+	}
+	
+	private static void addItemsBackToPanel(Frame curr, List<Item> imagesOnCurrentPanel){
+		MessageBay.displayMessage("Reached addItemsBackToPanel. Items to add" +
+				" back in: " + imagesOnCurrentPanel.size());
+		if(imagesOnCurrentPanel.size() > 0){
+			for(Item item : imagesOnCurrentPanel){
+				Item copy = item.copy();
+				copy.onParentStateChanged(new ItemParentStateChangedEvent(
+						curr,ItemParentStateChangedEvent.EVENT_TYPE_ADDED));
+				copy.setParent(curr);
+				curr.addItem(copy);
+
+				curr.setSaved();
+			}
+		}
+	}
+	
+	private static void clearPanel(Frame curr){
+		Rectangle area = getArea(curr.getItems());
+		ArrayList<Item>clear = getItemsWithinArea(curr.getItems(),area);
+		
+		if(clear == null)
+			return;
+		
+		if(clear.size() > 0){
+			int iter = clear.size() - 1;
+			
+			while(iter > -1){
+				Item currItem = clear.get(iter);
+				currItem.onParentStateChanged(new ItemParentStateChangedEvent(curr,
+						ItemParentStateChangedEvent.EVENT_TYPE_REMOVED));
+				curr.removeItem(currItem);
+				curr.setSaved();
+				iter--;
+			}
+		}
+	}
+	
+	private static ArrayList<Item> retrievePanel(Frame curr){
+		
+		List<Item> items = curr.getItems();
+		ArrayList<Item> retrieve = new ArrayList<Item>();
+		
+		Rectangle area = getArea(items);
+		
+		if(area != null){
+			retrieve = getItemsWithinArea(items,area);
+		}
+		
+		return retrieve;
+	}
+	
+	private static ArrayList<Item> getItemsWithinArea(List<Item> items, Rectangle area){
+		if(area == null)
+			return null;
+		ArrayList<Item> retrieve = new ArrayList<Item>();
+		
+		for(Item item : items){
+			if(item instanceof Text){
+				
+				Text t = (Text)item;
+				
+				if(t.getText().startsWith("@i:")){
+					if(t.getX() > area.x && t.getX() < area.x+area.width){
+						if(t.getY() > area.y && t.getY() < area.y+area.height){
+							retrieve.add(t);
+						}
+					}
+				}
+
+			}
+		}
+		
+		return retrieve;
+	}
+	
+	private static Rectangle getArea(List<Item> items){
+			
+		Rectangle rect = null;
+		int iter = 0;
+		boolean foundPanel = false;
+		
+		while(iter < items.size() && !foundPanel){
+			
+			Item item = items.get(iter);
+			if(item instanceof WidgetCorner){
+				WidgetCorner wc = (WidgetCorner)item;
+				Text wcsource = (Text)wc.getWidgetSource().getSource();
+				
+				if(wcsource.getText().startsWith("@iw: org.honours.widgets.CollectionSpaceDropBox") ||
+						wcsource.getText().startsWith("@iw:org.honours.widgets.CollectionSpaceDropBox")){
+					
+					rect = wc.getEnclosedRectangle();
+					foundPanel = true;
+				}
+				
+			}
+			
+			iter++;
+		}
+		
+		return rect;
+	}
+	
+
+	@Override
+	protected String[] getArgs() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+}
+
