public class ObjectLocator
extends Object
An object locator consists of a (local) file name, a fully qualified class name and a unique ident. The file name may be null.
In the future, this should probably be handled as a fully-qualified URI, but it works as an adequate substitute.
WindowManager
Modifier and Type | Field and Description |
---|---|
private Class |
_class
type of object being located
|
private GraphObjectID |
_ID
unique ID for identification
|
private File |
_sourceFile
absolute file (if any) where object is located
|
Constructor and Description |
---|
ObjectLocator(File f,
Class c,
GraphObjectID id)
Creates a new object locator with the given constituents.
|
ObjectLocator(File f,
GraphObjectID id)
Creates a locator with the given file and ident, and class
java.lang.Object |
ObjectLocator(String filename,
GraphObjectID id)
Creates a locator with the given file and ident, and class
java.lang.Object |
Modifier and Type | Method and Description |
---|---|
File |
getFile()
Gets the file portion of the locator.
|
GraphObjectID |
getID()
Gets the file portion of the locator.
|
Object |
getObject(boolean makeAvailable)
Find the object that this locator is intended to identify.
|
static Object |
getObject(File f,
GraphObjectID id,
Class c,
boolean makeAvailable)
Find the object, wherever it is, opening its window if necessary.
|
private static Class |
getRelevantClass(Class c) |
private void |
initialize(File f,
Class c,
GraphObjectID id) |
boolean |
isAccessible() |
static ObjectLocator |
parseURI(String uri)
Construct an object locator from its URI string.
|
void |
setFile(File f)
Sets the file portion of the locator
|
void |
setID(GraphObjectID id) |
String |
toURI()
Creates a URI to identify this object.
|
String |
toXML(String indent) |
private File _sourceFile
private GraphObjectID _ID
private Class _class
public ObjectLocator(File f, Class c, GraphObjectID id)
public ObjectLocator(File f, GraphObjectID id)
java.lang.Object
f
- file where this object is currently stored.id
- an id that is unique across all locatable objects on the
current host.public ObjectLocator(String filename, GraphObjectID id)
java.lang.Object
private void initialize(File f, Class c, GraphObjectID id)
public File getFile()
null
if it's not
in a file.public void setFile(File f)
public GraphObjectID getID()
public void setID(GraphObjectID id)
public static Object getObject(File f, GraphObjectID id, Class c, boolean makeAvailable)
public Object getObject(boolean makeAvailable)
makeAvailable
- Whether to open up the resource and make the object
available. If false, and the the object is not currently accessbiel, then
return null.public boolean isAccessible()
private static Class getRelevantClass(Class c)
public String toXML(String indent)
public String toURI()
file:/Volumes/hsd/Research/CGs/catonmat.cgx#charger.obj.Concept-12345667
where the URI fragment (after the "#") is the class type and the ID
number.public static ObjectLocator parseURI(String uri)
URI
,
toURI()