Java Code Examples for org.jgraph.graph.GraphConstants#setSelectable()

The following examples show how to use org.jgraph.graph.GraphConstants#setSelectable() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ModelConstraint.java    From CQL with GNU Affero General Public License v3.0 6 votes vote down vote up
/**
 * 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();
}
 
Example 2
Source File: GetPathState.java    From CQL with GNU Affero General Public License v3.0 6 votes vote down vote up
/**
 * 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);
}
 
Example 3
Source File: GetFullyDefinedPathState.java    From CQL with GNU Affero General Public License v3.0 6 votes vote down vote up
/**
 * 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);
}
 
Example 4
Source File: SketchEdge.java    From CQL with GNU Affero General Public License v3.0 5 votes vote down vote up
/**
 * 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;
}
 
Example 5
Source File: ModelConstraint.java    From CQL with GNU Affero General Public License v3.0 5 votes vote down vote up
/**
 * Overrides superclass getAttributes to override selectable status.
 *
 * @return
 */
@Override
public AttributeMap getAttributes() {
	AttributeMap attrs = super.getAttributes();

	// Selectable as long as it is visible:
	GraphConstants.setSelectable(attrs, isVisible());

	return attrs;
}
 
Example 6
Source File: GuideEdge.java    From CQL with GNU Affero General Public License v3.0 5 votes vote down vote up
/**
 *
 *
 * @return
 */
@Override
public AttributeMap getAttributes() {
	AttributeMap attrs = super.getAttributes();

	// A GuideEdge is never selectable
	GraphConstants.setSelectable(attrs, false);

	return attrs;
}
 
Example 7
Source File: ModelVertex.java    From CQL with GNU Affero General Public License v3.0 5 votes vote down vote up
/**
 * Overrides superclass getAttributes to override selectable status.
 *
 * @return
 */
@Override
public AttributeMap getAttributes() {
	AttributeMap attrs = super.getAttributes();

	// Always selectable:
	GraphConstants.setSelectable(attrs, true);

	return attrs;
}
 
Example 8
Source File: MicroarrayGraph.java    From chipster with MIT License 4 votes vote down vote up
private static void setEdgeStyle(DefaultEdge edge) {
	GraphConstants.setSelectable(edge.getAttributes(), false);
}
 
Example 9
Source File: PhenodataVertex.java    From chipster with MIT License 4 votes vote down vote up
public PhenodataVertex(int x, int y, DataBean data, MicroarrayGraph graph) {
	super(x, y, data, graph);
	GraphConstants.setSelectable(this.getAttributes(), true);
}
 
Example 10
Source File: View_Edge.java    From CQL with GNU Affero General Public License v3.0 3 votes vote down vote up
/**
 * Override the super getAttributes() to reflect whether or not this edge is
 * selectable.
 *
 * @return
 * 
 * 		NEED TO WORK ON THIS METHOD
 * 
 */

@Override
public AttributeMap getAttributes() {
	final AttributeMap attrs = super.getAttributes();

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

	GraphConstants.setSelectable(attrs, false);

	return attrs;
}