/** * Ensures that serialization returns the unique instances. * * @return The object. * * @throws ObjectStreamException if there is a problem. */ private Object readResolve() throws ObjectStreamException { Layer result = null; if (this.equals(Layer.FOREGROUND)) { result = Layer.FOREGROUND; } else if (this.equals(Layer.BACKGROUND)) { result = Layer.BACKGROUND; } return result; }
/** * Ensures that serialization returns the unique instances. * * @return The object. * * @throws ObjectStreamException if there is a problem. */ private Object readResolve() throws ObjectStreamException { Layer result = null; if (this.equals(Layer.FOREGROUND)) { result = Layer.FOREGROUND; } else if (this.equals(Layer.BACKGROUND)) { result = Layer.BACKGROUND; } return result; }
/** * Ensures that serialization returns the unique instances. * * @return The object. * * @throws ObjectStreamException if there is a problem. */ private Object readResolve() throws ObjectStreamException { Layer result = null; if (this.equals(Layer.FOREGROUND)) { result = Layer.FOREGROUND; } else if (this.equals(Layer.BACKGROUND)) { result = Layer.BACKGROUND; } return result; }
/** * Adds an annotation to the specified layer and sends a * {@link RendererChangeEvent} to all registered listeners. * * @param annotation the annotation (<code>null</code> not permitted). * @param layer the layer (<code>null</code> not permitted). */ public void addAnnotation(XYAnnotation annotation, Layer layer) { if (annotation == null) { throw new IllegalArgumentException("Null 'annotation' argument."); } if (layer.equals(Layer.FOREGROUND)) { this.foregroundAnnotations.add(annotation); annotation.addChangeListener(this); fireChangeEvent(); } else if (layer.equals(Layer.BACKGROUND)) { this.backgroundAnnotations.add(annotation); annotation.addChangeListener(this); fireChangeEvent(); } else { // should never get here throw new RuntimeException("Unknown layer."); } } /**