|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object viper.api.impl.EventfulNodeHelper viper.api.impl.ConfigImpl
Implements the Config interface of the viper.api, including all standard extensions. This means that it is editable, serializable to xml, and can take event listeners.
Nested Class Summary | |
static class |
ConfigImpl.DescNameChangeEvent
|
static class |
ConfigImpl.DescNameChangeUndoable
|
static class |
ConfigImpl.DescTypeChangeUndoable
|
Nested classes inherited from class viper.api.Config |
Config.Edit |
Nested classes inherited from class viper.api.extensions.TransactionalNode |
TransactionalNode.Transaction |
Field Summary |
Fields inherited from class viper.api.impl.EventfulNodeHelper |
childNodeType, notifyingListeners |
Fields inherited from interface viper.api.Config |
CONTENT, FILE, OBJECT |
Constructor Summary | |
ConfigImpl(java.lang.String name,
int type)
Constructs a new descriptor class definition, with the given class name and type. |
Method Summary | |
java.lang.Object |
clone()
Returns a copy of this node, unconnected to the parent, but with copies of the attribute config nodes. |
AttrConfig |
createAttrConfig(java.lang.String name,
java.lang.String type,
boolean dynamic,
java.lang.Object def,
AttrValueWrapper params)
Note that this will not check the case of the type or the name, or check for spaces. |
boolean |
equals(java.lang.Object o)
Checks to see that this descriptor class definition describes the same type of descriptor objects as the referenced object. |
AttrConfig |
getAttrConfig(java.lang.String name)
Gets a specific attribute configuration. |
int |
getAttrConfigIndex(AttrConfig ac)
Gets the index of the given config. |
java.util.Collection |
getAttrConfigs()
Gets the configuration of each attribute attached to this descriptor. |
java.util.Iterator |
getAttributeConfigs()
Gets the configuration of each attribute attached to this descriptor. |
Node |
getChild(int i)
Gets the ith child. |
java.util.Iterator |
getChildren()
Gets all the Node children of this Node. |
java.lang.String |
getDescName()
Get the name of the descriptor. |
int |
getDescType()
Get the descriptor type. |
Config.Edit |
getEditor()
Gets an editor object for this node. |
protected java.util.logging.Logger |
getLogger()
|
int |
getNumberOfChildren()
Gets the count of children attached to this node. |
Node |
getParent()
Gets the parent node. |
org.w3c.dom.Element |
getXMLFormat(org.w3c.dom.Document root)
Get a new XML Element node representing this Node. |
boolean |
hasAttrConfig(java.lang.String name)
Checks to see that a descriptor has an attribute with the given name. |
boolean |
hasChild(Node n)
Checks to see if this node has the specified node among its children. |
int |
hashCode()
Since there can only be one of a given type/name pair, this only returns the hash of the name and type. |
protected void |
helpSetChild(int i,
Node n,
TransactionalNode.Transaction t,
boolean insert)
Replace the child at index i with the given node. |
int |
indexOf(Node n)
Gets the index of the given child node. |
protected void |
postHelpSetChild(int i,
Node n,
TransactionalNode.Transaction t,
boolean insert)
Invoked after the event has been generated for the corresponding helpSetChild call. |
void |
printConfig(java.io.PrintWriter pw)
Old skool print config; exports the data in the old gtf format. |
void |
setDescName(java.lang.String str)
Set the descriptor name. |
void |
setDescType(int i)
Set the descriptor type. |
java.lang.String |
toString()
Returns a old school gtf representation of the descriptor config. |
Methods inherited from class viper.api.impl.EventfulNodeHelper |
addChild, addChild, addNodeListener, begin, fireMajorNodeChanged, fireMinorNodeChanged, fireNodeChanged, getRoot, hasListeners, isNotifyingListeners, isWriteLocked, removeChild, removeChild, removeChild, removeNodeListener, setChild |
Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface viper.api.Node |
addChild, getRoot, removeChild, removeChild, setChild |
Methods inherited from interface viper.api.extensions.EventfulNode |
addNodeListener, fireMajorNodeChanged, fireMinorNodeChanged, fireNodeChanged, isNotifyingListeners, removeNodeListener |
Constructor Detail |
public ConfigImpl(java.lang.String name, int type)
name
- the name of the classtype
- the descriptor typeMethod Detail |
public Node getParent()
Node
null
getParent
in interface Node
Node.getParent()
public java.util.Iterator getChildren()
Node
getChildren
in interface Node
Node.getChildren()
public Node getChild(int i)
Node
getChild
in interface Node
i
- the index of the child to get
Node.getChild(int)
public java.lang.Object clone()
Object.clone()
public java.lang.String getDescName()
Config
getDescName
in interface Config
Config.getDescName()
public int getDescType()
Config
getDescType
in interface Config
FILE
, OBJECT
,
or CONTENT
Config.getDescType()
public java.util.Collection getAttrConfigs()
Config
Config.getAttributeConfigs()
,
as that allows more freedom in the implementation.
getAttrConfigs
in interface Config
java.util.Collection
of AttrConfig
objectsConfig.getAttrConfigs()
public boolean equals(java.lang.Object o)
Object.equals(java.lang.Object)
public int hashCode()
getAttrConfigs().hashCode()
.
getDescType() ^ getDescName().hashCode()
public java.lang.String toString()
Object.toString()
public boolean hasAttrConfig(java.lang.String name)
Config
hasAttrConfig
in interface Config
name
- the name of the attribute to check for.
true
iff an attribute with the
specified name may exist in this descriptor.Config.hasAttrConfig(java.lang.String)
public int getAttrConfigIndex(AttrConfig ac)
ac
- the config for check for
UnknownAttributeTypeException
- if the config isn't foundpublic AttrConfig getAttrConfig(java.lang.String name)
Config
getAttrConfig
in interface Config
name
- The attribute to get.
Config.getAttrConfig(java.lang.String)
public AttrConfig createAttrConfig(java.lang.String name, java.lang.String type, boolean dynamic, java.lang.Object def, AttrValueWrapper params) throws java.lang.IllegalArgumentException
createAttrConfig
in interface Config
name
- the name for the new attribute, such as "FaceBox"
or "Comment"type
- the datatype to use, such as "http://viper#lvalue" or "bbox"dynamic
- true
if the value can change over
the life of an instance of a descriptor.
Only valid for OBJECT descriptors.def
- a default valueparams
- any additional parameters that the data type
must take, such as possible values for an
lvalue
AttrConfig
, already attached to this Config
java.lang.IllegalArgumentException
- if attaching a dynamic
attribute to a FILE or CONTENT Config
,
type
is not a valid datatype, or
params
does not apply to the datatypeConfig.createAttrConfig(String, String, boolean, Object, AttrValueWrapper)
public void setDescName(java.lang.String str)
Config.Edit
setDescName
in interface Config.Edit
str
- The new descriptor nameConfig.Edit.setDescName(java.lang.String)
public void setDescType(int i) throws java.lang.IllegalArgumentException
Config.Edit
setDescType
in interface Config.Edit
i
- OBJECT, CONTENT, etc.
java.lang.IllegalArgumentException
Config.Edit.setDescType(int)
public void printConfig(java.io.PrintWriter pw) throws java.io.IOException
pw
- where to put the data
java.io.IOException
- if there is a problem while writing to the
printwriterpublic org.w3c.dom.Element getXMLFormat(org.w3c.dom.Document root)
XmlVisibleNode
getXMLFormat
in interface XmlVisibleNode
root
- the DOM Document root to use to generate
the necessary elements.
XmlVisibleNode.getXMLFormat(org.w3c.dom.Document)
protected void helpSetChild(int i, Node n, TransactionalNode.Transaction t, boolean insert)
EventfulNodeHelper
helpSetChild
in class EventfulNodeHelper
i
- the index to insert/setn
- the node to insertt
- the transaction associated with the event, if it exists.
Otherwise, it is null
.insert
- true
if the node should be inserted,
false
if the current node i should be replacedprotected void postHelpSetChild(int i, Node n, TransactionalNode.Transaction t, boolean insert)
EventfulNodeHelper
postHelpSetChild
in class EventfulNodeHelper
i
- the index to insert/setn
- the node to insertt
- the transaction associated with the event, if it exists.
Otherwise, it is null
.insert
- true
if the node should be inserted,
false
if the current node i should be replacedpublic java.util.Iterator getAttributeConfigs()
Config
getAttributeConfigs
in interface Config
java.util.Iterator
of AttrConfig
objectsConfig.getAttributeConfigs()
public int getNumberOfChildren()
Node
getNumberOfChildren
in interface Node
Node.getNumberOfChildren()
public boolean hasChild(Node n)
Node
hasChild
in interface Node
n
- The node to check for.
true
if node n
is a child of this nodeNode.hasChild(viper.api.Node)
public int indexOf(Node n)
Node
indexOf
in interface Node
n
- The node to search for
Node.indexOf(viper.api.Node)
public Config.Edit getEditor()
Config
null
for this method.
getEditor
in interface Config
Config.getEditor()
protected java.util.logging.Logger getLogger()
getLogger
in class EventfulNodeHelper
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |