本文整理汇总了Java中org.jgraph.graph.GraphConstants.setLabelPosition方法的典型用法代码示例。如果您正苦于以下问题:Java GraphConstants.setLabelPosition方法的具体用法?Java GraphConstants.setLabelPosition怎么用?Java GraphConstants.setLabelPosition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jgraph.graph.GraphConstants
的用法示例。
在下文中一共展示了GraphConstants.setLabelPosition方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: checkDefaultLabelPosition
import org.jgraph.graph.GraphConstants; //导入方法依赖的package包/类
@Override
protected void checkDefaultLabelPosition() {
this.labelPosition = GraphConstants.getLabelPosition(this.allAttributes);
if (this.labelPosition == null) {
int center = GraphConstants.PERMILLE / 2;
this.labelPosition = new Point(center, 0);
GraphConstants.setLabelPosition(this.allAttributes, this.labelPosition);
}
}
示例2: toJAttr
import org.jgraph.graph.GraphConstants; //导入方法依赖的package包/类
/**
* Converts the layout information into an attribute map as required by
* <tt>jgraph</tt>. The attribute map contains points, label position and
* linestyle as specified by this edge layout.
* @return an attribute map with layout information
*/
@Override
public AttributeMap toJAttr() {
AttributeMap result = new AttributeMap();
GraphConstants.setPoints(result, this.points);
GraphConstants.setLineStyle(result, this.lineStyle.getCode());
GraphConstants.setLabelPosition(result, this.labelPosition == null ? defaultLabelPosition
: this.labelPosition);
return result;
}
示例3: transferPropertiesToAttributes
import org.jgraph.graph.GraphConstants; //导入方法依赖的package包/类
@Override
public void transferPropertiesToAttributes(Relation aRelation) {
Point2D thePoint;
// PROPERTY_TEXT_OFFSET
// skip processing of the offset-property, instead remove it from
// relation to be compatible to earlier versions
thePoint = aRelation.getProperties().getPoint2DProperty(
Relation.PROPERTY_TEXT_OFFSET);
if (thePoint != null) {
GraphConstants.setOffset(getAttributes(), thePoint);
}
// PROPERTY_LABEL_POSITION)
// instead of storing the offset, store the location of the label now
thePoint = aRelation.getProperties().getPoint2DProperty(
Relation.PROPERTY_LABEL_POSITION);
if (thePoint != null) {
GraphConstants.setLabelPosition(getAttributes(), thePoint);
}
// PROPERTY_POINTS
String thePoints = aRelation.getProperties().getProperty(Relation.PROPERTY_POINTS);
if (thePoints != null) {
List<Point2D> thePointList = new ArrayList<>();
for (StringTokenizer theSt = new StringTokenizer(thePoints, ","); theSt.hasMoreTokens(); ) {
thePoint = ModelProperties.toPoint2D(theSt.nextToken());
thePointList.add(thePoint);
}
GraphConstants.setPoints(getAttributes(), thePointList);
}
}
示例4: BasicArcView
import org.jgraph.graph.GraphConstants; //导入方法依赖的package包/类
public BasicArcView(Object cell) {
super(cell);
BasicArc arc = (BasicArc)cell;
AttributeMap attributes = arc.getAttributes();
// weight position
Element weightLabelOffSet;
weightLabelOffSet = arc.getData().getChild("inscription").getChild("graphics").getChild("offset");
GraphConstants.setLabelPosition(attributes,
new Point2D.Double(GraphConstants.PERMILLE/2, Integer.parseInt(weightLabelOffSet.getAttributeValue("y"))));
}
示例5: BasicAssociationView
import org.jgraph.graph.GraphConstants; //导入方法依赖的package包/类
public BasicAssociationView(Object cell) {
super(cell);
BasicAssociation association = (BasicAssociation)cell;
AttributeMap attributes = association.getAttributes();
// main label position
Element labels;
if(cell instanceof ClassAssociation){
labels = association.getReference().getChild("graphics").getChild("labels");
} else{
labels = association.getData().getChild("graphics").getChild("labels");
}
Element mainLabelPosition = null;
try {
XPath path = new JDOMXPath("label[@type='main']/position");
mainLabelPosition = (Element)path.selectSingleNode(labels);
} catch (JaxenException e) {
e.printStackTrace();
}
if(mainLabelPosition != null){
if(mainLabelPosition.getAttributeValue("x").equals("") || mainLabelPosition.getAttributeValue("y").equals("")){
GraphConstants.setLabelPosition(attributes, new Point2D.Double(GraphConstants.PERMILLE/2, -15));
} else{
int x = Integer.parseInt(mainLabelPosition.getAttributeValue("x"));
int y = Integer.parseInt(mainLabelPosition.getAttributeValue("y"));
GraphConstants.setLabelPosition(attributes, new Point2D.Double(x, y));
}
}
}
示例6: ArcGraphCell
import org.jgraph.graph.GraphConstants; //导入方法依赖的package包/类
public ArcGraphCell() {
GraphConstants.setLineEnd(getAttributes(), GraphConstants.ARROW_TECHNICAL);
GraphConstants.setLabelPosition(getAttributes(), new Point2D.Double(GraphConstants.PERMILLE / 2, -10));
GraphConstants.setFont(getAttributes(), FONT);
}