01: /*
02: * $Id: JGraphEditorFactoryMethod.java,v 1.1.1.1 2005/08/04 11:21:58 gaudenz Exp $
03: * Copyright (c) 2001-2005, Gaudenz Alder
04: *
05: * All rights reserved.
06: *
07: * See LICENSE file for license details. If you are unable to locate
08: * this file please contact info (at) jgraph (dot) com.
09: */
10: package com.jgraph.editor.factory;
11:
12: import java.awt.Component;
13:
14: import org.w3c.dom.Node;
15:
16: /**
17: * Defines the basic implementation of a factory method.
18: */
19: public abstract class JGraphEditorFactoryMethod {
20:
21: /**
22: * Holds the name.
23: */
24: protected String name = null;
25:
26: /**
27: * Constructs a new factory method using the specified name.
28: *
29: * @param name
30: * The name of the factory method to construct.
31: */
32: public JGraphEditorFactoryMethod(String name) {
33: this .name = name;
34: }
35:
36: /**
37: * Returns a new component for the specified configuration.
38: *
39: * @param configuration
40: * The configuration to create the component with.
41: * @return Returns a new component.
42: */
43: public abstract Component createInstance(Node configuration);
44:
45: /**
46: * Returns the name of the factory method.
47: *
48: * @return Returns the name.
49: */
50: public String getName() {
51: return name;
52: }
53:
54: /**
55: * Sets the name of the factory method.
56: *
57: * @param name
58: * The name to set.
59: */
60: public void setName(String name) {
61: this.name = name;
62: }
63:
64: }
|