本文整理汇总了Java中prefuse.data.Node.set方法的典型用法代码示例。如果您正苦于以下问题:Java Node.set方法的具体用法?Java Node.set怎么用?Java Node.set使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类prefuse.data.Node
的用法示例。
在下文中一共展示了Node.set方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addClassThingWithDetails
import prefuse.data.Node; //导入方法依赖的package包/类
/**
* Adds the special Class "Thing", owl:Thing.
* <p/>
* NOTE. Yes you could call this function with a name unlike "Thing" or a different URI as
* {@link TransformOWLtoGraph#OWL_THING_CLASS_URI} because a user can define an "own" class with the namespace of
* OWLThing. In this case the class should be shown as a OWLThing class.
* There are also several cases where user doesn't define the target or the source of a property. In this case the
* target / source of this property should be an OWLThing class. It should be possible for the GraphDataModifier to
* add an OWLClass with different or without an OWLClassThing Namespace (this may not be through for
* TransformOWLToGraph).
*
* @param instances the count of instances
* @param classID the id of this class
* @param name the name of this class
* @param uri an uri used as IRI of this class
* @param comment the comment of this class
* @param definiedBy used as IRI
*/
public void addClassThingWithDetails(int instances, int classID, String name, String uri, String comment, String definiedBy,
String owlVersion) {
addClass(classID, name, uri, comment, definiedBy, owlVersion, false, false);
if (instances != 0) {
addInstanceToClass(classID, instances);
}
// change the parts which are special for OWLClass Thing class types
Node n = findNode(classID);
// color 0080FF for classes
n.set(ColumnNames.COLOR_RED, 255);
n.set(ColumnNames.COLOR_GREEN, 255);
n.set(ColumnNames.COLOR_BLUE, 255);
// black text color
n.set(ColumnNames.TEXT_COLOR_RED, 0);
n.set(ColumnNames.TEXT_COLOR_GREEN, 0);
n.set(ColumnNames.TEXT_COLOR_BLUE, 0);
// changes the size of the OWLThing Class
n.set(ColumnNames.NODE_HEIGHT, ((int) (MIN_CLASS_SIZE / 1.25)));
n.set(ColumnNames.NODE_WIDTH, ((int) (MIN_CLASS_SIZE / 1.25)));
n.set(ColumnNames.TEXT_SIZE, MIN_TEXT_SIZE);
n.set(ColumnNames.NODE_VOWL_TYPE, Nodetype.vowltype[6]); // type OWLThing
}
示例2: helperDecreaseClassSizeAfterRemovingInstances
import prefuse.data.Node; //导入方法依赖的package包/类
/**
* Decreases the visual size of a node after instances have been removed.
*
* @param n the node
* @param howManyToRemove the count of instances that will be removed
*/
private void helperDecreaseClassSizeAfterRemovingInstances(Node n, int howManyToRemove) {
try {
int instancesIndex = n.getColumnIndex(ColumnNames.CLASS_INSTANCE_COUNT);
int instanceCount = (Integer) n.get(instancesIndex);
int heightIndex = n.getColumnIndex(ColumnNames.NODE_HEIGHT);
int widhtIndex = n.getColumnIndex(ColumnNames.NODE_WIDTH);
int height = (Integer) n.get(heightIndex);
int width = (Integer) n.get(widhtIndex);
instanceCount = instanceCount - howManyToRemove;
n.set(ColumnNames.CLASS_INSTANCE_COUNT, instanceCount);
n.set(ColumnNames.NODE_HEIGHT, height - (int) Math.log(CLASS_INSTANCES_STEPS * howManyToRemove));
n.set(ColumnNames.NODE_WIDTH, width - (int) Math.log(CLASS_INSTANCES_STEPS * howManyToRemove));
} catch (NullPointerException npe) {
logger.error("missing important data, wrong class : " + n.toString());
}
}
示例3: helperIncreaseClassSizeAfterAddingInstances
import prefuse.data.Node; //导入方法依赖的package包/类
/**
* Increases the visual size of a node after instances have been removed.
*
* @param n the node
* @param howManyToAdd the count of instances that will be added
*/
private void helperIncreaseClassSizeAfterAddingInstances(Node n, int howManyToAdd) {
try {
int instancesIndex = n.getColumnIndex(ColumnNames.CLASS_INSTANCE_COUNT);
int instanceCount = (Integer) n.get(instancesIndex);
int heightIndex = n.getColumnIndex(ColumnNames.NODE_HEIGHT);
int widhtIndex = n.getColumnIndex(ColumnNames.NODE_WIDTH);
int height = (Integer) n.get(heightIndex);
int width = (Integer) n.get(widhtIndex);
instanceCount = instanceCount + howManyToAdd;
n.set(ColumnNames.CLASS_INSTANCE_COUNT, instanceCount);
// n.set(ColumnNames.NODE_HEIGHT, height + (int) Math.log(howManyToAdd * CLASS_INSTANCES_STEPS));
// n.set(ColumnNames.NODE_WIDTH, width + (int) Math.log(howManyToAdd * CLASS_INSTANCES_STEPS));
n.set(ColumnNames.NODE_HEIGHT, height + (howManyToAdd * CLASS_INSTANCES_STEPS));
n.set(ColumnNames.NODE_WIDTH, width + (howManyToAdd * CLASS_INSTANCES_STEPS));
} catch (NullPointerException npe) {
logger.error("missing important data, wrong class : " + n.toString());
}
}
示例4: process
import prefuse.data.Node; //导入方法依赖的package包/类
public void process(OutputStream out) throws Exception {
Tree tree = new Tree();
tree.addColumn("name", String.class);
tree.addColumn(VisualItem.EXPANDED, Boolean.class);
Node root = tree.addNode();
root.set("name", "Root");
genTree(tree, root, 5, 2);
CommonTreeView view = new CommonTreeView(tree, "name", 6);
view.setSize(1440, 900);
Thread.sleep(800);
view.zoomToFit();
Thread.sleep(800);
view.saveImage(out, "JPG", 1);
}
示例5: getNode
import prefuse.data.Node; //导入方法依赖的package包/类
protected Node getNode(CiBean bean) {
Node n = nodeMap.get(bean.getAlias());
if (n != null) {
return(n);
}
n = g.addNode();
n.set("alias", bean.getAlias());
n.set("type", bean.getDerivedFrom());
String displayName = bean.getDisplayName();
if (displayName == null || displayName.length() == 0) {
displayName = "[" + bean.getAlias() + "]";
} else if (displayName.length() > 20) {
displayName = displayName.substring(0, 20) + "...";
}
n.set("name", displayName);
String icon = "";
if (getValue(bean, "icon") != null) {
icon = "&icon=" + getValue(bean, "icon");
}
n.set("image", OneCMDBConnection.instance().getIconURL() + "?type=" + bean.getAlias() + icon);
nodeMap.put(bean.getAlias(), n);
return(n);
}
示例6: addItem
import prefuse.data.Node; //导入方法依赖的package包/类
public ItemSelector addItem(String id, String alias, boolean primary) {
ItemSelector selector = q.findSelector(id);
if (selector == null) {
selector = new ItemOffspringSelector(id, alias);
selector.setPrimary(primary);
q.addSelector(selector);
selector.setPageInfo(new PageInfo(0, maxSize ));
// Update query Graph.
CiBean template = OneCMDBConnection.instance().getBeanFromAlias(alias);
Node n = queryGraph.addNode();
n.setString("id",id);
n.setString("name", alias);
n.setString("alias", alias);
if (template != null) {
n.set("image", "http://localhost:8080/icons/generate?iconid=" + getValue(template, "icon"));
}
queryGraphNodeMap.put(id, n);
}
return(selector);
}
示例7: getNode
import prefuse.data.Node; //导入方法依赖的package包/类
protected Node getNode(CiBean bean) {
Node n = nodeMap.get(bean.getAlias());
if (n != null) {
return(n);
}
n = g.addNode();
n.set("alias", bean.getAlias());
n.set("type", bean.getDerivedFrom());
String displayName = bean.getDisplayName();
if (displayName.length() > 20) {
displayName = displayName.substring(0, 20) + "...";
} else if (displayName.length() == 0) {
displayName = "[" + bean.getAlias() + "]";
}
n.set("name", displayName);
String icon = "";
if (getValue(bean, "icon") != null) {
icon = "&icon=" + getValue(bean, "icon");
}
n.set("image", OneCMDBConnection.instance().getIconURL() + "?type=" + bean.getAlias() + icon);
nodeMap.put(bean.getAlias(), n);
return(n);
}
示例8: addPropertyNode
import prefuse.data.Node; //导入方法依赖的package包/类
/**
* Creates a new property node (with the given attributes) and adds it to the graph.
*
* @param id id of the created node (property)
* @param name label of the property
* @param uri uri of the property
* @param comment the comment of the property
* @param definiedBy the uri witch defines the property
* @param owlVersion the owl version
* @param range the target
* @param domain the source
*/
public void addPropertyNode(int id, String name, String uri, String comment, String definiedBy,
String owlVersion, String range, String domain, boolean isGeneric) {
int class_size = MIN_CLASS_SIZE;
String shortName = helperGetShortName(name, MAX_CLASS_NAME_LENGT);
// now add the new data type property as node
Node n = GraphStorage.getGraph(viewManagerID).addNode();
n.set(ColumnNames.ID, id);
n.set(ColumnNames.NAME, shortName);
n.set(ColumnNames.FULL_NAME, name);
n.set(ColumnNames.NODE_FORM, Nodetype.nodetype[1]); // type box
n.set(ColumnNames.NODE_HEIGHT, class_size / 3 + 2);
n.set(ColumnNames.NODE_WIDTH, class_size + 2);
n.set(ColumnNames.TEXT_SIZE, MIN_TEXT_SIZE);
n.set(ColumnNames.RDFS_COMMENT, comment);
n.set(ColumnNames.RDFS_URI, uri);
n.set(ColumnNames.RDFS_DEFINED_BY, definiedBy);
n.set(ColumnNames.OWL_VERSION_INFO, owlVersion);
n.set(ColumnNames.RDFS_DOMAIN, domain);
n.set(ColumnNames.RDFS_RANGE, range);
if (isGeneric) {
n.set(ColumnNames.NODE_VOWL_TYPE, Nodetype.vowltype[7]); // generic VOWL Literal
} else {
n.set(ColumnNames.NODE_VOWL_TYPE, Nodetype.vowltype[4]); // VOWL Literal
}
// color #FFCC33 for data type propertys
n.set(ColumnNames.COLOR_RED, 255);
n.set(ColumnNames.COLOR_GREEN, 205);
n.set(ColumnNames.COLOR_BLUE, 51);
// black text color
n.set(ColumnNames.TEXT_COLOR_RED, 0);
n.set(ColumnNames.TEXT_COLOR_GREEN, 0);
n.set(ColumnNames.TEXT_COLOR_BLUE, 0);
}
示例9: helperUpdateShortName
import prefuse.data.Node; //导入方法依赖的package包/类
/**
* Updates the shorter name and the additional informations like instance count.
*
* @param n a node
*/
private void helperUpdateShortName(Node n) {
try {
int instanceCount = (Integer) n.get(n.getColumnIndex(ColumnNames.CLASS_INSTANCE_COUNT));
String fullName = (String) n.get(n.getColumnIndex(ColumnNames.FULL_NAME));
String shortName = helperGetShortName(fullName, MAX_CLASS_NAME_LENGT);
shortName = "[" + Integer.toString(instanceCount) + "]" + "\n" + shortName;
String vowlType = (String) n.get(n.getColumnIndex(ColumnNames.NODE_VOWL_TYPE));
if (vowlType != null) {
if (vowlType.equals(Nodetype.vowltype[2])) {
n.set(ColumnNames.NAME_DATA, DEPRECATED);
}
if (vowlType.equals(Nodetype.vowltype[3])) {
n.set(ColumnNames.NAME_DATA, ISEXTERNAL);
}
if (vowlType.equals(Nodetype.vowltype[8])) {
ArrayList<EquivalentClassDataStructure> iriList = new ArrayList<EquivalentClassDataStructure>(); // TODO list is always empty
String extraName = getEnoughLineBreaksForSecondLine(helperGetShortName(shortName, MAX_CLASS_NAME_LENGT));
extraName = extraName + "[";
for (int i = 0; i < iriList.size(); i++) {
extraName = extraName + iriList.get(i).getClassName();
}
extraName = helperGetShortName(extraName, (int) (MAX_CLASS_NAME_LENGT * (1 / RenderPrefuseGraph.NameExtraDataSize)));
extraName = extraName + "]"; // even when it's cut it should have a closing bracket
n.set(ColumnNames.NAME_DATA, extraName);
}
}
n.set(ColumnNames.NAME, shortName);
} catch (NullPointerException npe) {
logger.error("missing important data within class : " + n.toString());
}
}
示例10: removeAttributeIsClickedFromAllGraphElements
import prefuse.data.Node; //导入方法依赖的package包/类
/**
* remove the attribute "is clicked" from all nodes and edges
*/
private void removeAttributeIsClickedFromAllGraphElements(Graph graph) {
for (int i = 0; i < graph.getNodeCount(); i++) {
Node node = graph.getNode(i);
node.set(ColumnNames.IS_CLICKED, false);
}
for (int i = 0; i < graph.getEdgeCount(); i++) {
Edge edge = graph.getEdge(i);
edge.set(ColumnNames.IS_CLICKED, false);
}
}
示例11: addChild
import prefuse.data.Node; //导入方法依赖的package包/类
private Node addChild( Node parent, String name, Object object )
{
Node childNode = graph.addNode();
childNode.set( GraphDisplay.NAME_LABEL, name );
childNode.set( GraphDisplay.USER_OBJECT, object );
// check for application node
if( parent != null )
{
graph.addEdge( parent, childNode );
}
return childNode;
}
示例12: genTree
import prefuse.data.Node; //导入方法依赖的package包/类
private void genTree(Tree t, Node parent, int level, int child) {
if (level == 0) {
return;
}
for (int i = 0; i < child; i++) {
Node n = t.addChild(parent);
n.set("name", "Node[" + level + "," + child +"]");
n.set(VisualItem.EXPANDED, true);
genTree(t, n, level-1, child);
}
}
示例13: addNode
import prefuse.data.Node; //导入方法依赖的package包/类
private Node addNode(CiBean ci) {
Node n = nodeMap.get(ci.getAlias());
if (n != null) {
return(n);
}
Aggregate a = getAggregate(ci.getAlias());
if (a != null) {
n = nodeMap.get(a.getId());
if (n != null) {
return(n);
}
n = g.addNode();
n.set("aggregate", true);
n.set("name", "Aggregate [" + a.getMembers().size()+ "]");
nodeMap.put(a.getId(), n);
return(n);
}
n = g.addNode();
n.set("alias", ci.getAlias());
n.set("type", ci.getDerivedFrom());
String displayName = ci.getDisplayName();
if (displayName.length() > 20) {
displayName = displayName.substring(0, 20) + "...";
}
n.set("name", displayName);
String icon = "";
if (getValue(ci, "icon") != null) {
icon = "&icon=" + getValue(ci, "icon");
}
n.set("image", OneCMDBConnection.instance().getIconURL() + "?type=" + ci.getDerivedFrom() + icon);
nodeMap.put(ci.getAlias(), n);
return(n);
}
示例14: getNode
import prefuse.data.Node; //导入方法依赖的package包/类
private Node getNode(String alias) {
Node n = nodeMap.get(alias);
if (n == null) {
n = templateGraph.addNode();
CiBean bean = beanMap.get(alias);
n.set("alias", bean.getAlias());
n.set("name", bean.getDisplayName());
nodeMap.put(alias, n);
}
return(n);
}
示例15: getReferenceTree
import prefuse.data.Node; //导入方法依赖的package包/类
public Tree getReferenceTree(String alias) {
Tree t = new Tree();
setupModel(t);
CiBean bean = this.tModel.getBean(alias);
if (bean == null) {
System.out.println("Reference Tree Alias=" + alias + " is not found in " + tModel);
return(t);
}
Node root = t.addRoot();
root.set("alias", bean.getAlias());
root.set("name", bean.getAlias());
root.set("checked", true);
buildDependecyTree(t, root, "/" + alias,bean);
return(t);
}