javax.swing.undo.AbstractUndoableEdit#org.jgraph.graph.GraphConstants源码实例Demo

下面列出了javax.swing.undo.AbstractUndoableEdit#org.jgraph.graph.GraphConstants 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: CQL   文件: OverviewGraphModel.java
/**
 *
 *
 * @param vertex
 *
 * @return
 */
private static AttributeMap commonVertexAttributes(OverviewVertex vertex) {
	AttributeMap map = new AttributeMap();

	GraphConstants.setAutoSize(map, true);
	GraphConstants.setInset(map, 5);
	GraphConstants.setFont(map, GraphConstants.DEFAULTFONT.deriveFont(Font.BOLD, 12));
	GraphConstants.setOpaque(map, true);

	ImageIcon icon = vertex.getThumbnail();

	if (icon != null) {
		GraphConstants.setIcon(map, vertex.getThumbnail());
	} else {
		GraphConstants.setIcon(map, new ImageIcon());
	}

	GraphConstants.setVerticalTextPosition(map, SwingConstants.TOP);

	return map;
}
 
源代码2 项目: CQL   文件: OverviewGraphModel.java
/**
 * Returns an attribute map for Overview view edges
 *
 *
 * @param edge
 * @return a map of attributes to be used for a sketchnode
 */
public static AttributeMap viewEdgeAttributes(ViewDefinitionEdge edge) {
	AttributeMap map = commonEdgeAttributes();

	GraphConstants.setLineEnd(map, GraphConstants.ARROW_TECHNICAL);
	GraphConstants.setEndFill(map, true);
	GraphConstants.setEndSize(map, 10);

	Color color = getColor("edge_overview_view");

	GraphConstants.setLineColor(map, color);
	GraphConstants.setForeground(map, color);
	GraphConstants.setLineWidth(map, getWidth("edge_overview_view", 1.5));

	return map;
}
 
源代码3 项目: CQL   文件: View.java
/**
 * Checks to see if any of the query nodes have moved and, if so, updates them
 * and sets the view to dirty. If the view is already dirty, we don't have to do
 * anything at all.
 */
public void checkDirty() {
	if (_dirty) {
		return;
	}

	for (QueryNode n : _nodes.values()) {
		if (n == null) {
			// not sure why this would ever be null
		} else {
			Rectangle2D newBounds = GraphConstants.getBounds(n.getAttributes());
			if ((int) newBounds.getX() != n.getLastKnownX()) {
				setDirty(true);
				return;
			}
		}
	}

}
 
源代码4 项目: CQL   文件: ViewGraphModel.java
/**
 * Returns an attribute map for normal (non-injective, non-partial) edges.
 *
 * @return a map of attributes to be used for new normal edges
 */
private AttributeMap normalEdgeAttributes() {
	AttributeMap map = commonEdgeAttributes();

	GraphConstants.setLineEnd(map, GraphConstants.ARROW_TECHNICAL);
	GraphConstants.setEndFill(map, true);
	GraphConstants.setEndSize(map, 10);

	Color color = getColor(_mode + "edge_normal");

	GraphConstants.setLineColor(map, color);
	GraphConstants.setForeground(map, color);
	GraphConstants.setLineWidth(map, getWidth(_mode + "edge_normal", 1.5));

	return map;
}
 
源代码5 项目: CQL   文件: ViewGraphModel.java
/**
 * Returns the attribute map for injective edges.
 *
 * @return a map of attributes to be used for new injective edges
 */
private AttributeMap injectiveEdgeAttributes() {
	AttributeMap map = commonEdgeAttributes();

	GraphConstants.setLineEnd(map, GraphConstants.ARROW_TECHNICAL);
	GraphConstants.setEndFill(map, true);
	GraphConstants.setEndSize(map, 10);
	GraphConstants.setLineBegin(map, GraphConstants.ARROW_DIAMOND);
	GraphConstants.setBeginFill(map, false);
	GraphConstants.setBeginSize(map, 15);

	Color color = getColor(_mode + "edge_injective");

	GraphConstants.setLineColor(map, color);
	GraphConstants.setForeground(map, color);
	GraphConstants.setLineWidth(map, getWidth(_mode + "edge_injective", 1.5));

	return map;
}
 
源代码6 项目: CQL   文件: ViewGraphModel.java
/**
 * Returns the attribute map for partial edges.
 *
 * @return a map of attributes to be used for partial edges
 */
private AttributeMap partialEdgeAttributes() {
	AttributeMap map = commonEdgeAttributes();

	GraphConstants.setLineEnd(map, GraphConstants.ARROW_TECHNICAL);
	GraphConstants.setEndFill(map, true);
	GraphConstants.setEndSize(map, 10);
	GraphConstants.setLineBegin(map, GraphConstants.ARROW_LINE);
	GraphConstants.setBeginFill(map, true);
	GraphConstants.setBeginSize(map, 15);

	Color color = getColor(_mode + "edge_partial");

	GraphConstants.setLineColor(map, color);
	GraphConstants.setForeground(map, color);
	GraphConstants.setLineWidth(map, getWidth(_mode + "edge_partial", 1.5));

	return map;
}
 
源代码7 项目: CQL   文件: ViewGraphModel.java
/**
 * Returns the attribute map for virtual edges.
 *
 * @return a map of attributes to be used for new virtual edges
 */
private AttributeMap virtualEdgeAttributes() {
	AttributeMap map = commonEdgeAttributes();

	GraphConstants.setLineEnd(map, GraphConstants.ARROW_NONE);
	GraphConstants.setLineBegin(map, GraphConstants.ARROW_NONE);
	GraphConstants.setDashPattern(map, new float[] { 5.0f, 3.0f });

	Color color = getColor(_mode + "edge_virtual");

	GraphConstants.setLineColor(map, color);
	GraphConstants.setForeground(map, color);
	GraphConstants.setLineWidth(map, getWidth(_mode + "edge_virtual", 1.5));

	return map;
}
 
源代码8 项目: CQL   文件: SketchGraphModel.java
/**
 * Returns an attribute map for normal (non-injective, non-partial) edges.
 *
 * @return a map of attributes to be used for new normal edges
 */
private AttributeMap normalEdgeAttributes() {
	AttributeMap map = commonEdgeAttributes();

	GraphConstants.setLineEnd(map, GraphConstants.ARROW_TECHNICAL);
	GraphConstants.setEndFill(map, true);
	GraphConstants.setEndSize(map, 10);

	Color color = getColor(_mode + "edge_normal");

	GraphConstants.setLineColor(map, color);
	GraphConstants.setForeground(map, color);
	GraphConstants.setLineWidth(map, getWidth(_mode + "edge_normal", 1.5));

	return map;
}
 
源代码9 项目: CQL   文件: SketchGraphModel.java
/**
 * Returns the attribute map for injective edges.
 *
 * @return a map of attributes to be used for new injective edges
 */
private AttributeMap injectiveEdgeAttributes() {
	AttributeMap map = commonEdgeAttributes();

	GraphConstants.setLineEnd(map, GraphConstants.ARROW_TECHNICAL);
	GraphConstants.setEndFill(map, true);
	GraphConstants.setEndSize(map, 10);
	GraphConstants.setLineBegin(map, GraphConstants.ARROW_DIAMOND);
	GraphConstants.setBeginFill(map, false);
	GraphConstants.setBeginSize(map, 15);

	Color color = getColor(_mode + "edge_injective");

	GraphConstants.setLineColor(map, color);
	GraphConstants.setForeground(map, color);
	GraphConstants.setLineWidth(map, getWidth(_mode + "edge_injective", 1.5));

	return map;
}
 
源代码10 项目: CQL   文件: SketchGraphModel.java
/**
 * Returns the attribute map for partial edges.
 *
 * @return a map of attributes to be used for partial edges
 */
private AttributeMap partialEdgeAttributes() {
	AttributeMap map = commonEdgeAttributes();

	GraphConstants.setLineEnd(map, GraphConstants.ARROW_TECHNICAL);
	GraphConstants.setEndFill(map, true);
	GraphConstants.setEndSize(map, 10);
	GraphConstants.setLineBegin(map, GraphConstants.ARROW_LINE);
	GraphConstants.setBeginFill(map, true);
	GraphConstants.setBeginSize(map, 15);

	Color color = getColor(_mode + "edge_partial");

	GraphConstants.setLineColor(map, color);
	GraphConstants.setForeground(map, color);
	GraphConstants.setLineWidth(map, getWidth(_mode + "edge_partial", 1.5));

	return map;
}
 
源代码11 项目: CQL   文件: SketchGraphModel.java
/**
 * Returns the attribute map for virtual edges.
 *
 * @return a map of attributes to be used for new virtual edges
 */
private AttributeMap virtualEdgeAttributes() {
	AttributeMap map = commonEdgeAttributes();

	GraphConstants.setLineEnd(map, GraphConstants.ARROW_NONE);
	GraphConstants.setLineBegin(map, GraphConstants.ARROW_NONE);
	GraphConstants.setDashPattern(map, new float[] { 5.0f, 3.0f });

	Color color = getColor(_mode + "edge_virtual");

	GraphConstants.setLineColor(map, color);
	GraphConstants.setForeground(map, color);
	GraphConstants.setLineWidth(map, getWidth(_mode + "edge_virtual", 1.5));

	return map;
}
 
源代码12 项目: CQL   文件: ModelConstraint.java
/**
 * Removes the visuals from the sketch (when hiding)
 */
private void removeVisualsFromModel() {
	// Push loading state
	_theModel.getStateManager().pushState(new LoadingState<>(_theModel));
	_theModel.getGraphModel().beginInsignificantUpdate();

	GraphLayoutCache glc = _theModel.getGraphLayoutCache();

	glc.remove(_visuals.toArray(new GuideEdge[0]));
	_visuals.clear();

	_edgesVisualized = false;

	GraphConstants.setSelectable(getAttributes(), false);
	_theModel.refresh();
	_theModel.getGraphModel().cancelInsignificantUpdate();

	// Pop state
	_theModel.getStateManager().popState();
}
 
源代码13 项目: CQL   文件: GetPathState.java
/**
 * When pushed on, the first thing done is clearing the selection and then
 * disabling selection for all items except for edges.
 */
@Override
@SuppressWarnings("rawtypes")
public void pushedOn() {
	setNextButton(false);
	setCancelButton(true);
	setFinishButton(false);

	_selectable = new Hashtable();
	_unselectable = new Hashtable();

	GraphConstants.setSelectable(_selectable, true);
	GraphConstants.setSelectable(_unselectable, false);

	// Initially, we allow all edges and entities to be selected
	_ourModel.clearSelection();
	_ourModel.refresh();

	// Gets pushed on by all "add constraint" states. We don't want to be
	// able to imbed adding constraints
	_ourModel.getFrame().enableAddConstraintItems(false);
}
 
源代码14 项目: CQL   文件: GetFullyDefinedPathState.java
/**
 * When pushed on, the first thing done is clearing the selection and then
 * disabling selection for all items except for edges.
 */
@Override
@SuppressWarnings("rawtypes")
public void pushedOn() {
	setNextButton(false);
	setCancelButton(true);
	setFinishButton(false);

	_selectable = new Hashtable();
	_unselectable = new Hashtable();

	GraphConstants.setSelectable(_selectable, true);
	GraphConstants.setSelectable(_unselectable, false);

	// Initially, we allow all edges and entities to be selected
	_ourModel.clearSelection();
	_ourModel.refresh();

	// Gets pushed on by all "add constraint" states. We don't want to be
	// able to imbed adding constraints
	_ourModel.getFrame().enableAddConstraintItems(false);
}
 
源代码15 项目: CQL   文件: EasikGraphModel.java
/**
 * Returns the common attribute mapping for edges. Used by
 * normalEdgeAttributes() et al. to establish the common attributes for an edge.
 * 
 * @return The attribute mapping
 */
@SuppressWarnings("static-access")
public static AttributeMap commonEdgeAttributes() {
	AttributeMap map = new AttributeMap();

	GraphConstants.setLabelAlongEdge(map, true);
	GraphConstants.setBendable(map, false);
	GraphConstants.setMoveable(map, false);
	GraphConstants.setConnectable(map, false);
	GraphConstants.setDisconnectable(map, false);

	EdgeRouter er = EdgeRouter.getSharedInstance();

	er.setEdgeSeparation(20.0);
	er.setEdgeDeparture(50.0);
	GraphConstants.setRouting(map, er);
	GraphConstants.setLineStyle(map, GraphConstants.STYLE_SPLINE);

	return map;
}
 
源代码16 项目: MogwaiERDesignerNG   文件: RelationEdge.java
public RelationEdge(Relation aRelation, TableCell aImporting, TableCell aExporting) {

        super(aRelation);

        GraphConstants.setLineStyle(getAttributes(), GraphConstants.STYLE_ORTHOGONAL);
        GraphConstants.setConnectable(getAttributes(), false);
        GraphConstants.setDisconnectable(getAttributes(), false);
        GraphConstants.setBendable(getAttributes(), true);

        GraphConstants.setLineWidth(getAttributes(), 1);
        GraphConstants.setLineBegin(getAttributes(), LINE_BEGIN);
        GraphConstants.setLineEnd(getAttributes(), LINE_END);

        setSource(aImporting.getChildAt(0));
        setTarget(aExporting.getChildAt(0));
    }
 
源代码17 项目: Pydev   文件: GraphVisitor.java
public DefaultGraphCell createVertex(String name, double x, double y, Color bg, boolean raised) {

        // Create vertex with the given name
        DefaultGraphCell cell = new DefaultGraphCell(name);

        GraphConstants.setBorder(cell.getAttributes(), BorderFactory.createEtchedBorder());
        GraphConstants.setBounds(cell.getAttributes(), new Rectangle2D.Double(x, y, 10, 10));
        GraphConstants.setResize(cell.getAttributes(), true);
        GraphConstants.setAutoSize(cell.getAttributes(), true);

        // Set fill color
        if (bg != null) {
            GraphConstants.setOpaque(cell.getAttributes(), true);
            GraphConstants.setGradientColor(cell.getAttributes(), bg);
        }

        // Set raised border
        if (raised)
            GraphConstants.setBorder(cell.getAttributes(), BorderFactory.createRaisedBevelBorder());
        else
            // Set black border
            GraphConstants.setBorderColor(cell.getAttributes(), Color.black);

        return cell;
    }
 
源代码18 项目: CQL   文件: OverviewGraphModel.java
/**
 * Returns an attribute map for SketchNodes
 *
 * @param node
 * @return The attribute mapping
 */
private static AttributeMap sketchAttributes(SketchNode node) {
	AttributeMap map = commonVertexAttributes(node);

	GraphConstants.setBorder(map, BorderFactory.createLineBorder(getColor("overview_sketch_border"),
			getIntWidth("overview_sketch_border", 2)));
	GraphConstants.setBackground(map, getColor("overview_sketch_bg"));
	GraphConstants.setForeground(map, getColor("overview_sketch_fg"));

	return map;
}
 
源代码19 项目: CQL   文件: OverviewGraphModel.java
/**
 * Returns an attribute map for Overview views
 *
 * @param node
 * @return The attribute mapping
 */
private static AttributeMap viewAttributes(ViewNode node) {
	AttributeMap map = commonVertexAttributes(node);

	GraphConstants.setBorder(map, BorderFactory.createLineBorder(getColor("overview_view_border"),
			getIntWidth("overview_view_border", 2)));
	GraphConstants.setBackground(map, getColor("overview_view_bg"));
	GraphConstants.setForeground(map, getColor("overview_view_fg"));

	return map;
}
 
源代码20 项目: CQL   文件: OverviewVertex.java
/**
 * Accessor for the X coordinate
 * 
 * @return The x coordinate
 */
public int getX() {
	Rectangle2D bounds = GraphConstants.getBounds(getAttributes());

	if (bounds != null) {
		return (int) bounds.getX();
	}
	return _initX;
}
 
源代码21 项目: CQL   文件: OverviewVertex.java
/**
 * Accessor for the Y Coordinate
 * 
 * @return The Y Coordinate
 */
public int getY() {
	Rectangle2D bounds = GraphConstants.getBounds(getAttributes());

	if (bounds != null) {
		return (int) bounds.getY();
	}
	return _initY;

}
 
源代码22 项目: CQL   文件: Overview.java
/**
 * Add one one of our verticies to the overview
 *
 * @param theNode The node to be added
 */
public void addVertex(OverviewVertex theNode) {
	// The next call will fire a rendering. At this point, the model adapter
	// does not know
	// where it should place the node, and picks a default value. This will
	// cause an update
	// in our Node's x and y coordinates, making it forget where it was
	// initialized.
	// We store it's initializeded position so as not to lose them in the
	// first rendering.
	int initX = theNode.getX();
	int initY = theNode.getY();

	// Make sure the name is unique; increment it if not.
	if (isNameUsed(theNode.getName())) {
		theNode.setName(getNewName(theNode.getName()));
	}

	// Add our sketch to the graph
	getGraphLayoutCache().insert(theNode);

	// Add our vertex to the appropriate map
	if (theNode instanceof SketchNode) {
		_sketchNodes.put(theNode.toString(), (SketchNode) theNode);
		_appFrame.getInfoTreeUI().addSketch((SketchNode) theNode);
	} else if (theNode instanceof ViewNode) {
		_viewNodes.put(theNode.toString(), (ViewNode) theNode);
		_appFrame.getInfoTreeUI().addView((ViewNode) theNode);
	}

	// Set the on-screen position of our sketch to the attributes of the
	// sketch
	AttributeMap nAttribs = theNode.getAttributes();

	GraphConstants.setAutoSize(nAttribs, true);
	GraphConstants.setBounds(nAttribs, new Rectangle2D.Double(initX, initY, 0, 0));

	// Reload the graph to reflect the new changes
	refresh(theNode);
}
 
源代码23 项目: CQL   文件: ViewGraphModel.java
/**
 * TRIANGLES CF2012 Set the attributes for display of a triangle edge.
 * 
 * @param edge the edge to read attributes from
 * @return a map of attributes to be used for new triangle edges
 */
private static AttributeMap triangleEdgeAttributes(
		TriangleEdge<ViewFrame, ViewGraphModel, View, QueryNode, View_Edge> edge) {
	AttributeMap map = commonEdgeAttributes();

	GraphConstants.setLineEnd(map, edge.getLineEnd());
	GraphConstants.setLineBegin(map, edge.getLineBegin());
	GraphConstants.setLineWidth(map, edge.getWidth());
	GraphConstants.setLineColor(map, edge.getColor());
	GraphConstants.setForeground(map, edge.getColor());
	GraphConstants.setDashPattern(map, new float[] { edge.getWidth(), 3 });

	return map;
}
 
源代码24 项目: CQL   文件: ViewGraphModel.java
/**
 * Returns the attribute map for highlighted virtual edges.
 *
 * @return a map of attributes to be used for highlighted virtual edges
 */
private AttributeMap virtualHighlightedEdgeAttributes() {
	AttributeMap map = virtualEdgeAttributes();
	Color color = getColor(_mode + "edge_virtual_highlighted");

	GraphConstants.setLineColor(map, color);
	GraphConstants.setForeground(map, color);
	GraphConstants.setLineWidth(map, getWidth(_mode + "edge_virtual_highlighted", 1.5));

	return map;
}
 
源代码25 项目: CQL   文件: ViewGraphModel.java
/**
 * Returns the attribute map for vertices (i.e. EntityNodes).
 *
 * @return a map of attributes to be used for new vertices
 */
private AttributeMap vertexAttributes() {
	AttributeMap map = new AttributeMap();

	GraphConstants.setAutoSize(map, true);
	GraphConstants.setInset(map, 5);
	GraphConstants.setBorder(map, BorderFactory.createLineBorder(getColor(_mode + "entity_border"),
			getIntWidth(_mode + "entity_border", 1)));
	GraphConstants.setBackground(map, getColor(_mode + "entity_bg"));
	GraphConstants.setForeground(map, getColor(_mode + "entity_fg"));
	GraphConstants.setFont(map, GraphConstants.DEFAULTFONT.deriveFont(Font.BOLD, 12));
	GraphConstants.setOpaque(map, true);

	return map;
}
 
源代码26 项目: CQL   文件: ViewGraphModel.java
/**
 * Returns the attribute map for virtual vertices (i.e. constaint nodes).
 *
 * @return a map of attributes to be used for new virtual vertices
 */
private AttributeMap virtualVertexAttributes() {
	AttributeMap map = new AttributeMap();

	GraphConstants.setAutoSize(map, true);
	GraphConstants.setInset(map, 5);
	GraphConstants.setBorder(map, BorderFactory.createLineBorder(getColor(_mode + "constraint_border"),
			getIntWidth(_mode + "constraint_border", 1)));
	GraphConstants.setBackground(map, getColor(_mode + "constraint_bg"));
	GraphConstants.setForeground(map, getColor(_mode + "constraint_fg"));
	GraphConstants.setFont(map, GraphConstants.DEFAULTFONT.deriveFont(Font.BOLD, 12));
	GraphConstants.setOpaque(map, true);

	return map;
}
 
源代码27 项目: CQL   文件: SketchEdge.java
/**
 * Override the super getAttributes() to reflect whether or not this edge is
 * selectable.
 *
 * @return
 */
@Override
public AttributeMap getAttributes() {
	final AttributeMap attrs = super.getAttributes();

	// A SketchEdge is selectable unless we're in manipulation mode
	final Sketch sketch = _sourceObj.getMModel();

	GraphConstants.setSelectable(attrs, sketch.getFrame().getMode() != SketchFrame.Mode.MANIPULATE);

	return attrs;
}
 
源代码28 项目: CQL   文件: SketchGraphModel.java
/**
 * TRIANGLES CF2012 Set the attributes for display of a triangle edge.
 * 
 * @param edge the edge to read attributes from
 * @return a map of attributes to be used for new triangle edges
 */
private static AttributeMap triangleEdgeAttributes(
		TriangleEdge<SketchFrame, SketchGraphModel, Sketch, EntityNode, SketchEdge> edge) {
	AttributeMap map = commonEdgeAttributes();

	GraphConstants.setLineEnd(map, edge.getLineEnd());
	GraphConstants.setLineBegin(map, edge.getLineBegin());
	GraphConstants.setLineWidth(map, edge.getWidth());
	GraphConstants.setLineColor(map, edge.getColor());
	GraphConstants.setForeground(map, edge.getColor());
	GraphConstants.setDashPattern(map, new float[] { edge.getWidth(), 3 });

	return map;
}
 
源代码29 项目: CQL   文件: SketchGraphModel.java
/**
 * Returns the attribute map for highlighted virtual edges.
 *
 * @return a map of attributes to be used for highlighted virtual edges
 */
private AttributeMap virtualHighlightedEdgeAttributes() {
	AttributeMap map = virtualEdgeAttributes();
	Color color = getColor(_mode + "edge_virtual_highlighted");

	GraphConstants.setLineColor(map, color);
	GraphConstants.setForeground(map, color);
	GraphConstants.setLineWidth(map, getWidth(_mode + "edge_virtual_highlighted", 1.5));

	return map;
}
 
源代码30 项目: CQL   文件: SketchGraphModel.java
/**
 * Returns the attribute map for vertices (i.e. EntityNodes).
 *
 * @return a map of attributes to be used for new vertices
 */
private AttributeMap vertexAttributes() {
	AttributeMap map = new AttributeMap();

	GraphConstants.setAutoSize(map, true);
	GraphConstants.setInset(map, 5);
	GraphConstants.setBorder(map, BorderFactory.createLineBorder(getColor(_mode + "entity_border"),
			getIntWidth(_mode + "entity_border", 1)));
	GraphConstants.setBackground(map, getColor(_mode + "entity_bg"));
	GraphConstants.setForeground(map, getColor(_mode + "entity_fg"));
	GraphConstants.setFont(map, GraphConstants.DEFAULTFONT.deriveFont(Font.BOLD, 12));
	GraphConstants.setOpaque(map, true);

	return map;
}