Skip to main content
summaryrefslogtreecommitdiffstats
blob: 29adbf6f9a7cb2feae3676fa375cf40d321d7129 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/*******************************************************************************
 * Copyright (c) 2001, 2005 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 * 
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/
package org.eclipse.jem.internal.proxy.remote.awt;
/*
 *  $RCSfile: REMStandardAWTBeanProxyFactory.java,v $
 *  $Revision: 1.5 $  $Date: 2005/08/24 20:39:07 $ 
 */

import org.eclipse.jem.internal.proxy.awt.*;
import org.eclipse.jem.internal.proxy.core.*;
import org.eclipse.jem.internal.proxy.remote.REMProxyFactoryRegistry;

/**
 * Standard AWT Bean Proxy Factory.
 * Package protected because it should not referenced
 * outside of the package other than through the interface.
 */
class REMStandardAWTBeanProxyFactory implements IStandardAwtBeanProxyFactory {

	final IStandardBeanTypeProxyFactory fBeanTypeFactory;
	
	public REMStandardAWTBeanProxyFactory(REMProxyFactoryRegistry factory) {
		factory.registerBeanProxyFactory(IStandardAwtBeanProxyFactory.REGISTRY_KEY, this);
		fBeanTypeFactory = factory.getBeanTypeProxyFactory();
	}
	
	public IDimensionBeanProxy createDimensionBeanProxyWith(int width, int height){
		try {
			return (IDimensionBeanProxy) fBeanTypeFactory.getBeanTypeProxy("java.awt.Dimension").newInstance("new java.awt.Dimension("+width+","+height+")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
		} catch (ThrowableProxy e) {
			return null;
		} catch (InstantiationException e) {
			return null;	// Shouldn't occur
		}
	}
	
	public IPointBeanProxy createPointBeanProxyWith(int x, int y){
		try {
			return (IPointBeanProxy) fBeanTypeFactory.getBeanTypeProxy("java.awt.Point").newInstance("new java.awt.Point("+x+","+y+")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
		} catch (ThrowableProxy e) {
			return null;
		} catch (InstantiationException e) {
			return null;	// Shouldn't occur
		}

	}
	
	public IRectangleBeanProxy createBeanProxyWith(int x, int y, int width, int height){
		try {
			return (IRectangleBeanProxy) fBeanTypeFactory.getBeanTypeProxy("java.awt.Rectangle").newInstance("new java.awt.Rectangle("+x+","+y+","+width+","+height+")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
		} catch (ThrowableProxy e) {
			return null;
		} catch (InstantiationException e) {
			return null;	// Shouldn't occur
		}

	}
	
	/*
	 * Terminate this factory. Since it doesn't hold onto anything other than the beantype factory,
	 * and nothing will be holding onto this factory, nothing needs to be done. It will be GC'd.
	 */
	public void terminateFactory(boolean wait) {
	}

}

Back to the top