Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 279728 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/gmf/runtime/gef/ui/figures/SlidableImageAnchor.java (-6 / +42 lines)
Lines 1-5 Link Here
1
/******************************************************************************
1
/******************************************************************************
2
 * Copyright (c) 2004, 2007 IBM Corporation and others.
2
 * Copyright (c) 2004, 2009 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 15-22 Link Here
15
import java.util.Map;
15
import java.util.Map;
16
import java.util.WeakHashMap;
16
import java.util.WeakHashMap;
17
17
18
import org.eclipse.draw2d.AnchorListener;
18
import org.eclipse.draw2d.IFigure;
19
import org.eclipse.draw2d.IFigure;
19
import org.eclipse.draw2d.ImageFigure;
20
import org.eclipse.draw2d.IImageFigure;
21
import org.eclipse.draw2d.IImageFigure.ImageChangedListener;
20
import org.eclipse.draw2d.geometry.Dimension;
22
import org.eclipse.draw2d.geometry.Dimension;
21
import org.eclipse.draw2d.geometry.Point;
23
import org.eclipse.draw2d.geometry.Point;
22
import org.eclipse.draw2d.geometry.PointList;
24
import org.eclipse.draw2d.geometry.PointList;
Lines 35-41 Link Here
35
 *
37
 *
36
 */
38
 */
37
public class SlidableImageAnchor
39
public class SlidableImageAnchor
38
	extends SlidableAnchor {
40
	extends SlidableAnchor implements ImageChangedListener {
39
41
40
	static private class ImageAnchorLocation {
42
	static private class ImageAnchorLocation {
41
43
Lines 239-245 Link Here
239
		}
241
		}
240
	}
242
	}
241
243
242
	private ImageFigure imageFig;
244
	private IImageFigure imageFig;
243
245
244
	/**
246
	/**
245
	 * Empty constructor
247
	 * Empty constructor
Lines 254-259 Link Here
254
	 */
256
	 */
255
	public SlidableImageAnchor(IFigure f) {
257
	public SlidableImageAnchor(IFigure f) {
256
		super(f);
258
		super(f);
259
		if (f instanceof IImageFigure) {
260
			this.imageFig = (IImageFigure) f;
261
		}
262
	}
263
	
264
	public SlidableImageAnchor(IImageFigure imageFigure) {
265
		this(imageFigure, imageFigure);
257
	}
266
	}
258
267
259
	/**
268
	/**
Lines 262-272 Link Here
262
	 * @param container the <code>IFigure</code> bounding figure
271
	 * @param container the <code>IFigure</code> bounding figure
263
	 * @param imageFig the <code>ImageFigure</code> inside the bounding figure
272
	 * @param imageFig the <code>ImageFigure</code> inside the bounding figure
264
	 */
273
	 */
265
	public SlidableImageAnchor(IFigure container, ImageFigure imageFig) {
274
	public SlidableImageAnchor(IFigure container, IImageFigure imageFig) {
266
		super(container);
275
		super(container);
267
		this.imageFig = imageFig;
276
		this.imageFig = imageFig;
268
	}
277
	}
269
278
279
	@Override
280
	public void addAnchorListener(AnchorListener listener) {
281
		if (listener == null)
282
			return;
283
		if (listeners.isEmpty() && imageFig != null) {
284
			imageFig.addImageChangedListener(this);
285
		}
286
		super.addAnchorListener(listener);
287
	}
288
289
	@Override
290
	public void removeAnchorListener(AnchorListener listener) {
291
		super.removeAnchorListener(listener);
292
		if (listeners.isEmpty() && imageFig != null) {
293
			imageFig.removeImageChangedListener(this);
294
		}
295
	}
296
270
	/**
297
	/**
271
	 * Constructor, for which reference point is specified
298
	 * Constructor, for which reference point is specified
272
	 * 
299
	 * 
Lines 274-283 Link Here
274
	 * @param imageFig the <code>ImageFigure</code> inside the bounding figure
301
	 * @param imageFig the <code>ImageFigure</code> inside the bounding figure
275
	 * @param p the <code>PrecisionPoint</code> relative reference
302
	 * @param p the <code>PrecisionPoint</code> relative reference
276
	 */
303
	 */
277
	public SlidableImageAnchor(IFigure f, ImageFigure imageFig, PrecisionPoint p) {
304
	public SlidableImageAnchor(IFigure f, IImageFigure imageFig, PrecisionPoint p) {
278
		super(f, p);
305
		super(f, p);
279
		this.imageFig = imageFig;
306
		this.imageFig = imageFig;
280
	}
307
	}
308
	
309
	public SlidableImageAnchor(IImageFigure imageFig, PrecisionPoint p) {
310
		this(imageFig, imageFig, p);
311
	}
281
312
282
	/**
313
	/**
283
	 * Returns the image.
314
	 * Returns the image.
Lines 324-327 Link Here
324
		return null;
355
		return null;
325
	}
356
	}
326
357
358
	@Override
359
	public void imageChanged() {
360
		fireAnchorMoved();
361
	}
362
327
}
363
}
(-)src/org/eclipse/gmf/runtime/draw2d/ui/render/figures/ScalableImageFigure.java (-1 / +7 lines)
Lines 71-76 Link Here
71
		public void imageRendered(RenderedImage rndImg) {
71
		public void imageRendered(RenderedImage rndImg) {
72
			if (ScalableImageFigure.this.getParent() != null) {
72
			if (ScalableImageFigure.this.getParent() != null) {
73
				ScalableImageFigure.this.setRenderedImage(rndImg);
73
				ScalableImageFigure.this.setRenderedImage(rndImg);
74
				ScalableImageFigure.this.notifyImageChanged();
74
				ScalableImageFigure.this.repaint();
75
				ScalableImageFigure.this.repaint();
75
			}
76
			}
76
		}
77
		}
Lines 403-408 Link Here
403
	 *            this figure
404
	 *            this figure
404
	 */
405
	 */
405
	public void setRenderedImage(RenderedImage renderedImage) {
406
	public void setRenderedImage(RenderedImage renderedImage) {
406
		this.lastRenderedImage = renderedImage;
407
		if (this.lastRenderedImage != renderedImage) {
408
			this.lastRenderedImage = renderedImage;
409
			if (renderedImage == null || renderedImage.isRendered()) {
410
				notifyImageChanged();
411
			}
412
		}
407
	}
413
	}
408
}
414
}

Return to bug 279728