diva.graphx
Interface AttributeAdapter


public interface AttributeAdapter

An adapter to allow the Diva graph interaction code to operate on attributes of graph elements. This is used for two purposes:

The adaptor basically just maps keyword-value pairs to however the graph elements store this information. In some cases, graph elements may just contain a Map themselves. In others, they may map an attribute to a pair of getter and setter methods.

With the editing attributes, there is always the possiblity that attributes expected by the Diva editors may collide with pre-existing attributes in your graph data structure. At present (and possibly forever) the only way around this is to used the AttributeAdapter to rename these attributes. For example, if your nodes have a "location" attribute that means something other than the position of the node's visual representation, then make the AttributeAdapter think it's called eg "fooLocation."

Version:
$Revision: 1.1 $
Author:
John Reekie (johnr@eecs.berkeley.edu)

Method Summary
 Iterator attributeNames(Object element)
          Return an iterator over the names of the attributes that this element knows about.
 Object getAttribute(Object element, String name)
          Get the value of an attribute.
 AttributeProxy getAttributeProxy(Object element, String name)
          Get a "proxy" for the named attribute of the given element.
 void setAttribute(Object element, String name, Object value)
          Set the value of an attribute.
 

Method Detail

attributeNames

Iterator attributeNames(Object element)
Return an iterator over the names of the attributes that this element knows about.


getAttribute

Object getAttribute(Object element,
                    String name)
Get the value of an attribute. This method should always return an object if the attribute is valid, so that things like visual property editors know what type the object is. If the attribute is invalid, return null.


getAttributeProxy

AttributeProxy getAttributeProxy(Object element,
                                 String name)
Get a "proxy" for the named attribute of the given element. If a non-null result is returned, then property editors and so on will be able to perform more sophistcated editing on graph elements. If null is returned, then Diva will just do the best it can with the methods in this interface (AttributeAdapter).


setAttribute

void setAttribute(Object element,
                  String name,
                  Object value)
Set the value of an attribute. The value argument should never be null.



Copyright © 2015 Central Laboratory of the Research Councils. All Rights Reserved.