当前位置: 首页>>代码示例>>Java>>正文


Java GraphConstants.setLabelPosition方法代码示例

本文整理汇总了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);
    }
}
 
开发者ID:meteoorkip,项目名称:JavaGraph,代码行数:10,代码来源:JEdgeView.java

示例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;
}
 
开发者ID:meteoorkip,项目名称:JavaGraph,代码行数:16,代码来源:JEdgeLayout.java

示例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);
    }
}
 
开发者ID:mirkosertic,项目名称:ERDesignerNG,代码行数:35,代码来源:RelationEdge.java

示例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"))));
}
 
开发者ID:tvaquero,项目名称:itsimple,代码行数:13,代码来源:BasicArcView.java

示例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));
		}			
	}
}
 
开发者ID:tvaquero,项目名称:itsimple,代码行数:33,代码来源:BasicAssociationView.java

示例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);
}
 
开发者ID:tomaszi1,项目名称:petri-nets-simulator,代码行数:6,代码来源:ArcGraphCell.java


注:本文中的org.jgraph.graph.GraphConstants.setLabelPosition方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。