com.mxgraph.view.mxGraphSelectionModel Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jgraphx Show documentation
Show all versions of jgraphx Show documentation
JGraphX Swing Component - Java Graph Visualization Library
This is a binary & source redistribution of the original, unmodified JGraphX library originating from:
"https://github.com/jgraph/jgraphx/archive/v3.4.1.3.zip".
The purpose of this redistribution is to make the library available to other Maven projects.
/*
* $Id: mxGraphSelectionModel.java,v 1.10 2011/01/06 08:14:09 gaudenz Exp $
* Copyright (c) 2001-2005, Gaudenz Alder
*
* All rights reserved.
*
* See LICENSE file for license details. If you are unable to locate
* this file please contact info (at) jgraph (dot) com.
*/
package com.mxgraph.view;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
import com.mxgraph.util.mxEvent;
import com.mxgraph.util.mxEventObject;
import com.mxgraph.util.mxEventSource;
import com.mxgraph.util.mxUndoableEdit;
import com.mxgraph.util.mxUndoableEdit.mxUndoableChange;
/**
* Implements the selection model for a graph.
*
* This class fires the following events:
*
* mxEvent.UNDO fires after the selection was changed in changeSelection. The
* edit
property contains the mxUndoableEdit which contains the
* mxSelectionChange.
*
* mxEvent.CHANGE fires after the selection changes by executing an
* mxSelectionChange. The added
and removed
* properties contain Collections of cells that have been added to or removed
* from the selection, respectively.
*
* To add a change listener to the graph selection model:
*
*
* addListener(
* mxEvent.CHANGE, new mxIEventListener()
* {
* public void invoke(Object sender, mxEventObject evt)
* {
* mxGraphSelectionModel model = (mxSelectionModel) sender;
* Collection added = (Collection) evt.getProperty("added");
* Collection removed = (Collection) evt.getProperty("removed");
* selectionChanged(model, added, removed);
* }
* });
*
*/
public class mxGraphSelectionModel extends mxEventSource
{
/**
* Reference to the enclosing graph.
*/
protected mxGraph graph;
/**
* Specifies if only one selected item at a time is allowed.
* Default is false.
*/
protected boolean singleSelection = false;
/**
* Holds the selection cells.
*/
protected Set