/**
 * 
 */
package org.concord.otrunk.view;

import java.awt.BorderLayout;
import java.util.Hashtable;

import javax.swing.JFrame;

import org.concord.framework.otrunk.OTObject;
import org.concord.framework.otrunk.view.OTFrame;
import org.concord.framework.otrunk.view.OTFrameManager;
import org.concord.framework.otrunk.view.OTViewContext;
import org.concord.framework.otrunk.view.OTViewEntry;
import org.concord.framework.otrunk.view.OTViewFactory;

public class OTFrameManagerImpl implements OTFrameManager 
{
	Hashtable frameContainers = new Hashtable();
	OTViewFactory viewFactory;
	private JFrame jFrame;
	private int oldX = 0;
	private int oldY = 0;
	
	public class FrameContainer
	{
		OTViewContainerPanel container;
		JFrame frame;
	}
	
	public void setViewFactory(OTViewFactory viewFactory)
	{
		this.viewFactory = viewFactory;
	}
	
	public void putObjectInFrame(OTObject otObject, 
			OTFrame otFrame) 
	{
		putObjectInFrame(otObject, null, otFrame, null);
	}
	
	public void putObjectInFrame(OTObject otObject, 
			org.concord.framework.otrunk.view.OTViewEntry viewEntry,
			OTFrame otFrame) 
	{
		putObjectInFrame(otObject, viewEntry, otFrame, null);
	}

	/* (non-Javadoc)
	 * @see org.concord.framework.otrunk.view.OTFrameManager#putObjectInFrame(org.concord.framework.otrunk.OTObject, org.concord.framework.otrunk.view.OTViewEntry, org.concord.framework.otrunk.view.OTFrame, java.lang.String)
	 */
	public void putObjectInFrame(OTObject otObject, OTViewEntry viewEntry, OTFrame otFrame, String viewMode) 
	{
		putObjectInFrame(otObject, viewEntry, otFrame, viewMode, 30, 30);
	}
	
	public void putObjectInFrame(OTObject otObject, OTViewEntry viewEntry, OTFrame otFrame, String viewMode, 
		int positionX, int positionY) 
	{
		// look up view container with the frame.
		FrameContainer frameContainer = 
			(FrameContainer)frameContainers.get(otFrame.getGlobalId());
		
		if(frameContainer == null || oldX != positionX || oldY != positionY) {
			jFrame = new JFrame(otFrame.getTitle());
	
			frameContainer = new FrameContainer();
			frameContainer.frame = jFrame;
			OTViewContainerPanel otContainer = new OTViewContainerPanel(this);
			otContainer.setTopLevelContainer(true);
			
			frameContainer.container = otContainer;	
			OTViewContext factoryContext = viewFactory.getViewContext();
			frameContainer.container.setOTViewFactory(factoryContext.createChildViewFactory());

			jFrame.getContentPane().setLayout(new BorderLayout());
	
			jFrame.getContentPane().add(otContainer, BorderLayout.CENTER);
			
			jFrame.setBounds(positionX, positionY, otFrame.getWidth(), otFrame.getHeight());
			
			oldX = positionX;
			oldY = positionY;
			
			if (otFrame.getBorderlessPopup()){
				jFrame.setUndecorated(true);
			}
			
			frameContainers.put(otFrame.getGlobalId(), frameContainer);
		}
		
		// call setCurrentObject on that view container with a null
		// frame
		frameContainer.container.setViewMode(viewMode);
		frameContainer.container.setCurrentObject(otObject, viewEntry, true);
		frameContainer.frame.setVisible(true);
	}
	
	public void distroyFrame(){
		jFrame.dispose();
	}
}
@@ -1017,16 +1017,197 @@
 bject, %0A
+%09%09OTFrame otFrame, int positionX, int positionY) %0A%09%7B%0A%09%09putObjectInFrame(otObject, null, otFrame, null, positionX, positionY);%0A%09%7D%0A%09%0A%09public void putObjectInFrame(OTObject otObject, %0A
 %09%09%09org.c

Add another option for putting object in frame