/usr/share/doc/libjgraph-java-doc/examples/com/jgraph/example/fastgraph/FastVertexView.java is in libjgraph-java-doc 5.12.4.2+dfsg-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | /*
* Copyright (c) 2005, David Benson
*
* See LICENSE file in distribution for licensing details of this source file
*/
package com.jgraph.example.fastgraph;
import java.util.Map;
import org.jgraph.graph.AttributeMap;
import org.jgraph.graph.GraphLayoutCache;
import org.jgraph.graph.GraphModel;
import org.jgraph.graph.VertexView;
public class FastVertexView extends VertexView {
/**
* Default constructor
*/
public FastVertexView() {
super();
}
/**
* @param cell
*/
public FastVertexView(Object cell) {
super(cell);
}
/**
* Hook from AbstractCellView, avoid creating attribute map until as late
* as possible
*/
protected AttributeMap createAttributeMap() {
return AttributeMap.emptyAttributeMap;
}
/**
* If the model is a FastGraphModel check the undoDisabled flag. If set,
* copy the reference from the model attributes. This will cause the
* preview of a drag to edit in-place, but since undo is disabled this
* will only cause a performance improvement.
*/
protected AttributeMap getCellAttributes(GraphModel model) {
if (model instanceof FastGraphModel) {
if (((FastGraphModel)model).undoDisabled) {
return model.getAttributes(cell);
}
}
return (AttributeMap) model.getAttributes(cell).clone();
}
protected void mergeAttributes() {
}
public void setAttributes(AttributeMap attributes) {
if (allAttributes == null)
allAttributes = new AttributeMap(4, 0.75f);
this.allAttributes = attributes;
}
public Map changeAttributes(GraphLayoutCache cache, Map change) {
if (change != null) {
Map undo = allAttributes.applyMap(change);
update(cache);
return undo;
}
return null;
}
}
|