Example usage for javax.swing.event EventListenerList EventListenerList

List of usage examples for javax.swing.event EventListenerList EventListenerList

Introduction

In this page you can find the example usage for javax.swing.event EventListenerList EventListenerList.

Prototype

EventListenerList

Source Link

Usage

From source file:org.jfree.data.general.AbstractDataset.java

/**
 * Returns a clone of the dataset. The cloned dataset will NOT include the
 * {@link DatasetChangeListener} references that have been registered with
 * this dataset.//from   w w  w . j a va 2  s.  c o  m
 *
 * @return A clone.
 *
 * @throws CloneNotSupportedException  if the dataset does not support
 *                                     cloning.
 */
@Override
public Object clone() throws CloneNotSupportedException {
    AbstractDataset clone = (AbstractDataset) super.clone();
    clone.listenerList = new EventListenerList();
    return clone;
}

From source file:net.sf.nmedit.nomad.core.menulayout.MLEntry.java

/**
 * Adds the specified ActionListener. /*from   ww w  . j a  v  a 2  s . co m*/
 * @param l
 */
public void addActionListener(ActionListener l) {
    if (listenerList == null)
        listenerList = new EventListenerList();
    listenerList.add(ActionListener.class, l);
}

From source file:org.jfree.data.general.Series.java

/**
 * Returns a clone of the series./*from  ww w  .j a v  a  2 s . co  m*/
 * <P>
 * Notes:
 * <ul>
 * <li>No need to clone the name or description, since String object is
 * immutable.</li>
 * <li>We set the listener list to empty, since the listeners did not
 * register with the clone.</li>
 * <li>Same applies to the PropertyChangeSupport instance.</li>
 * </ul>
 *
 * @return A clone of the series.
 *
 * @throws CloneNotSupportedException  not thrown by this class, but
 *         subclasses may differ.
 */
@Override
public Object clone() throws CloneNotSupportedException {
    Series clone = (Series) super.clone();
    clone.listeners = new EventListenerList();
    clone.propertyChangeSupport = new PropertyChangeSupport(clone);
    clone.vetoableChangeSupport = new VetoableChangeSupport(clone);
    return clone;
}

From source file:org.gvsig.remotesensing.scatterplot.chart.ScatterPlotDiagram.java

/**
 * Constructs a JFreeChart panel./*from  ww w.  j  av  a 2 s  . co m*/
 *
 * @param chart  the chart.
 * @param width  the preferred width of the panel.
 * @param height  the preferred height of the panel.
 * @param minimumDrawWidth  the minimum drawing width.
 * @param minimumDrawHeight  the minimum drawing height.
 * @param maximumDrawWidth  the maximum drawing width.
 * @param maximumDrawHeight  the maximum drawing height.
 * @param useBuffer  a flag that indicates whether to use the off-screen
 *                   buffer to improve performance (at the expense of 
 *                   memory).
 * @param properties  a flag indicating whether or not the chart property
 *                    editor should be available via the popup menu.
 * @param save  a flag indicating whether or not save options should be
 *              available via the popup menu.
 * @param print  a flag indicating whether or not the print option
 *               should be available via the popup menu.
 * @param zoom  a flag indicating whether or not zoom options should be 
 *              added to the popup menu.
 * @param tooltips  a flag indicating whether or not tooltips should be 
 *                  enabled for the chart.
 */
public ScatterPlotDiagram(JFreeChart chart, int width, int height, int minimumDrawWidth, int minimumDrawHeight,
        int maximumDrawWidth, int maximumDrawHeight, boolean useBuffer, boolean properties, boolean save,
        boolean print, boolean zoom, boolean tooltips) {

    this.setChart(chart);
    this.chartMouseListeners = new EventListenerList();
    this.info = new ChartRenderingInfo();
    setPreferredSize(new Dimension(width, height));
    this.useBuffer = useBuffer;
    this.refreshBuffer = false;
    this.minimumDrawWidth = minimumDrawWidth;
    this.minimumDrawHeight = minimumDrawHeight;
    this.maximumDrawWidth = maximumDrawWidth;
    this.maximumDrawHeight = maximumDrawHeight;
    this.zoomTriggerDistance = DEFAULT_ZOOM_TRIGGER_DISTANCE;

    this.popup = null;
    if (properties || save || print || zoom) {
        this.popup = createPopupMenu(properties, save, print, zoom);
    }

    enableEvents(AWTEvent.MOUSE_EVENT_MASK);
    enableEvents(AWTEvent.MOUSE_MOTION_EVENT_MASK);
    setDisplayToolTips(tooltips);
    addMouseListener(this);
    addMouseMotionListener(this);

    this.defaultDirectoryForSaveAs = null;
    this.enforceFileExtensions = true;

}

From source file:com.twinsoft.convertigo.beans.core.Sequence.java

@Override
public Sequence clone() throws CloneNotSupportedException {
    Sequence clonedObject = (Sequence) super.clone();
    clonedObject.variables = new HashMap<String, Object>();
    clonedObject.cloneNumber = ++cloneNumber;
    clonedObject.vVariables = new ArrayList<RequestableVariable>();
    clonedObject.vTestCases = new ArrayList<TestCase>();
    clonedObject.vAllVariables = null;//from w w w  .j  ava 2  s. c  o  m
    clonedObject.nbAsyncThreadRunning = 0;
    clonedObject.xpathApi = null;
    clonedObject.stepHttpState = null;
    clonedObject.transactionSessionId = null;
    clonedObject.copies = null;
    clonedObject.loadedProjects = new HashMap<String, Project>(10);
    clonedObject.loadedSteps = new HashMap<Long, Step>(10);
    clonedObject.executedSteps = null;
    clonedObject.childrenSteps = null;
    clonedObject.workerElementMap = null;
    clonedObject.vSteps = new ArrayList<Step>();
    clonedObject.vAllSteps = null;
    clonedObject.handlePriorities = handlePriorities;
    clonedObject.currentStep = null;
    clonedObject.currentChildStep = 0;
    clonedObject.stepContextNames = new ArrayList<String>();
    clonedObject.arborting = false;
    clonedObject.skipSteps = false;
    clonedObject.sequenceListeners = new EventListenerList();
    clonedObject.stepListeners = new EventListenerList();
    return clonedObject;
}

From source file:org.jfree.data.general.AbstractDataset.java

/**
 * Restores a serialized object./*w ww  .ja v  a  2  s  . com*/
 *
 * @param stream  the input stream.
 *
 * @throws IOException if there is an I/O problem.
 * @throws ClassNotFoundException if there is a problem loading a class.
 */
private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException {
    stream.defaultReadObject();
    this.listenerList = new EventListenerList();
    stream.registerValidation(this, 10); // see comments about priority of
                                         // 10 in validateObject()
}

From source file:edu.ucla.stat.SOCR.motionchart.MotionChart.java

/**
 * Clones the object, and takes care of listeners.
 * Note: caller shall register its own listeners on cloned graph.
 *
 * @return A clone.//from  ww w .  j  a v a 2s .com
 *
 * @throws CloneNotSupportedException if the chart is not cloneable.
 */
public Object clone() throws CloneNotSupportedException {
    MotionChart chart = (MotionChart) super.clone();

    chart.chart = (JFreeChart) this.chart.clone();
    chart.plot = (XYPlot) this.plot.clone();
    chart.chartPanel = new ChartPanel(chart.chart);
    chart.dataset = (MotionDataSet) this.dataset.clone();
    chart.renderer = (MotionBubbleRenderer) renderer.clone();
    chart.changeListeners = new EventListenerList();

    return chart;
}

From source file:com.twinsoft.convertigo.beans.connectors.HttpConnector.java

@Override
public HttpConnector clone() throws CloneNotSupportedException {
    HttpConnector clonedObject = (HttpConnector) super.clone();
    clonedObject.httpStateListeners = new EventListenerList();
    clonedObject.sUrl = "";
    clonedObject.handleCookie = true;/*from  www. j  av  a  2s.com*/
    clonedObject.httpParameters = new XMLVector<XMLVector<String>>();
    clonedObject.postQuery = "";

    clonedObject.certificateManager = new CertificateManager();

    clonedObject.hostConfiguration = new HostConfiguration();
    clonedObject.givenAuthPassword = null;
    clonedObject.givenAuthUser = null;

    return clonedObject;
}

From source file:de.xirp.ui.widgets.custom.XChartComposite.java

/**
 * @param jfreechart//from w w w  .  j a v a2  s.c om
 * @param minimumDrawWidth
 * @param minimumDrawHeight
 * @param maximumDrawWidth
 * @param maximumDrawHeight
 * @param useBuffer
 * @param zoom
 * @param tooltips
 * @param export
 * @param robotName
 */
private void init(JFreeChart jfreechart, int minimumDrawWidth, int minimumDrawHeight, int maximumDrawWidth,
        int maximumDrawHeight, boolean useBuffer, boolean zoom, boolean tooltips, boolean export,
        String robotName) {

    setChartAndRobotName(jfreechart, robotName);
    addControlListener(this);
    chartMouseListeners = new EventListenerList();
    setLayout(new FillLayout());
    info = new ChartRenderingInfo();

    this.useBuffer = useBuffer;
    this.refreshBuffer = false;
    this.minimumDrawWidth = minimumDrawWidth;
    this.minimumDrawHeight = minimumDrawHeight;
    this.maximumDrawWidth = maximumDrawWidth;
    this.maximumDrawHeight = maximumDrawHeight;
    this.zoomTriggerDistance = DEFAULT_ZOOM_TRIGGER_DISTANCE;

    setDisplayToolTips(tooltips);

    canvas = new XCanvas(this, SWT.DOUBLE_BUFFERED | SWT.BACKGROUND);

    canvas.addPaintListener(new PaintListener() {

        public void paintControl(PaintEvent e) {
            if (chart != null) {
                paintChart(e);
            }
        }
    });

    if (chart != null) {
        chart.addChangeListener(this);
        Plot plot = chart.getPlot();
        this.domainZoomable = false;
        this.rangeZoomable = false;
        if (plot instanceof Zoomable) {
            Zoomable z = (Zoomable) plot;
            this.domainZoomable = z.isDomainZoomable();
            this.rangeZoomable = z.isRangeZoomable();
            this.orientation = z.getOrientation();
        }
    }

    // set up popup menu...
    this.popup = null;
    if (zoom) {
        this.popup = createPopupMenu(zoom, export);
    }

    Listener listener = new Listener() {

        public void handleEvent(Event event) {
            if (XChartComposite.this.chart != null) {
                handleMouseEvents(event);
            }
        }

    };

    canvas.addListener(SWT.MouseDown, listener);
    canvas.addListener(SWT.MouseMove, listener);
    canvas.addListener(SWT.MouseUp, listener);

    this.enforceFileExtensions = true;
}

From source file:org.mwc.cmap.grideditor.chart.FixedChartComposite.java

/**
 * Constructs a JFreeChart panel.//w  w  w .ja v a 2s .c  o  m
 * 
 * @param comp
 *          The parent.
 * @param style
 *          The style of the composite.
 * @param jfreechart
 *          the chart.
 * @param width
 *          the preferred width of the panel.
 * @param height
 *          the preferred height of the panel.
 * @param minimumDrawW
 *          the minimum drawing width.
 * @param minimumDrawH
 *          the minimum drawing height.
 * @param maximumDrawW
 *          the maximum drawing width.
 * @param maximumDrawH
 *          the maximum drawing height.
 * @param usingBuffer
 *          a flag that indicates whether to use the off-screen buffer to
 *          improve performance (at the expense of memory).
 * @param properties
 *          a flag indicating whether or not the chart property editor should
 *          be available via the popup menu.
 * @param save
 *          a flag indicating whether or not save options should be available
 *          via the popup menu.
 * @param print
 *          a flag indicating whether or not the print option should be
 *          available via the popup menu.
 * @param zoom
 *          a flag indicating whether or not zoom options should be added to
 *          the popup menu.
 * @param tooltips
 *          a flag indicating whether or not tooltips should be enabled for
 *          the chart.
 */
public FixedChartComposite(final Composite comp, final int style, final JFreeChart jfreechart, final int width,
        final int height, final int minimumDrawW, final int minimumDrawH, final int maximumDrawW,
        final int maximumDrawH, final boolean usingBuffer, final boolean properties, final boolean save,
        final boolean print, final boolean zoom, final boolean tooltips) {
    super(comp, style);
    setChart(jfreechart);
    this.chartMouseListeners = new EventListenerList();
    setLayout(new FillLayout());
    this.info = new ChartRenderingInfo();
    this.useBuffer = usingBuffer;
    this.refreshBuffer = false;
    this.minimumDrawWidth = minimumDrawW;
    this.minimumDrawHeight = minimumDrawH;
    this.maximumDrawWidth = maximumDrawW;
    this.maximumDrawHeight = maximumDrawH;
    this.zoomTriggerDistance = DEFAULT_ZOOM_TRIGGER_DISTANCE;
    setDisplayToolTips(tooltips);
    // create the canvas and add the required listeners
    this.canvas = new Canvas(this, SWT.DOUBLE_BUFFERED | SWT.NO_BACKGROUND);
    this.canvas.addPaintListener(this);
    this.canvas.addMouseListener(this);
    this.canvas.addMouseMoveListener(this);

    // set up popup menu...
    this.popup = null;
    if (properties || save || print || zoom)
        this.popup = createPopupMenu(properties, save, print, zoom);

    this.enforceFileExtensions = true;
}