public Device getDevice() { return parentRegistry.getDevice(); }
@Override public Device getDevice() { return parentRegistry.getDevice(); }
@Override public Device getDevice() { return parentRegistry.getDevice(); }
/** * Creates an empty image registry using the given resource manager to allocate images. * * @param manager the resource manager used to allocate images * * @since 3.1 */ public ImageRegistry(ResourceManager manager) { Assert.isNotNull(manager); Device dev = manager.getDevice(); if (dev instanceof Display) { this.display = (Display)dev; } this.manager = manager; manager.disposeExec(disposeRunnable); }
/** * Creates an empty image registry using the given resource manager to allocate images. * * @param manager the resource manager used to allocate images * * @since 3.1 */ public ImageRegistry(ResourceManager manager) { Assert.isNotNull(manager); Device dev = manager.getDevice(); if (dev instanceof Display) { this.display = (Display)dev; } this.manager = manager; manager.disposeExec(disposeRunnable); }
/** * Creates an empty image registry using the given resource manager to allocate images. * * @param manager the resource manager used to allocate images * * @since 1.0 */ public ImageRegistry(ResourceManager manager) { Assert.isNotNull(manager); Device dev = manager.getDevice(); if (dev instanceof Display) { this.display = (Display)dev; } this.manager = manager; manager.disposeExec(disposeRunnable); }
entry.descriptor = new OriginalImageDescriptor(image, manager.getDevice());
entry.descriptor = new OriginalImageDescriptor(image, manager.getDevice());
entry.descriptor = new OriginalImageDescriptor(image, manager.getDevice());
@Override public Rectangle resize ( final ResourceManager resourceManager, final Rectangle clientRectangle ) { if ( this.title == null || this.title.isEmpty () ) { return null; } final GC gc = new GC ( resourceManager.getDevice () ); gc.setFont ( createFont ( resourceManager ) ); try { final Point size = gc.textExtent ( this.title ); this.rect = new Rectangle ( clientRectangle.x, clientRectangle.y, clientRectangle.width, size.y + this.padding * 2 ); return new Rectangle ( clientRectangle.x, this.rect.y + this.rect.height, clientRectangle.width, clientRectangle.height - this.rect.height ); } finally { gc.dispose (); } }
@Override public Rectangle resize ( final ResourceManager resourceManager, final Rectangle clientRectangle ) { if ( this.title == null || this.title.isEmpty () ) { return null; } final GC gc = new GC ( resourceManager.getDevice () ); gc.setFont ( createFont ( resourceManager ) ); try { final Point size = gc.textExtent ( this.title ); this.rect = new Rectangle ( clientRectangle.x, clientRectangle.y, clientRectangle.width, size.y + this.padding * 2 ); return new Rectangle ( clientRectangle.x, this.rect.y + this.rect.height, clientRectangle.width, clientRectangle.height - this.rect.height ); } finally { gc.dispose (); } }
private Font createFont ( final ResourceManager resourceManager ) { final Font defaultFont = resourceManager.getDevice ().getSystemFont (); if ( defaultFont == null ) { return null; } final FontData fd[] = FontDescriptor.copy ( defaultFont.getFontData () ); if ( fd == null ) { return null; } for ( final FontData f : fd ) { if ( this.fontSize > 0 ) { f.setHeight ( this.fontSize ); } } return resourceManager.createFont ( FontDescriptor.createFrom ( fd ) ); } }
private int calcHeight ( final ResourceManager resourceManager ) { if ( this.axis == null ) { return 0; } final GC gc = new GC ( resourceManager.getDevice () ); try { gc.setFont ( makeFont ( resourceManager ) ); final DateFormat format = makeFormat ( this.axis.getMax () - this.axis.getMin () ); final Point markerSize = getExtent ( gc, format.format ( new Date () ) ); final Point labelSize = getExtent ( gc, this.axis.getLabel () ); int height = markerSize.y + labelSize.y + this.textPadding * 2 + this.markerSize; if ( labelSize.y > 0 ) { height += this.textPadding; } return height; } finally { gc.dispose (); } }
private int calcHeight ( final ResourceManager resourceManager ) { if ( this.axis == null ) { return 0; } final GC gc = new GC ( resourceManager.getDevice () ); try { gc.setFont ( makeFont ( resourceManager ) ); final DateFormat format = makeFormat ( this.axis.getMax () - this.axis.getMin () ); final Point markerSize = getExtent ( gc, format.format ( new Date () ) ); final Point labelSize = getExtent ( gc, this.axis.getLabel () ); int height = markerSize.y + labelSize.y + this.textPadding * 2 + this.markerSize; if ( labelSize.y > 0 ) { height += this.textPadding; } return height; } finally { gc.dispose (); } }
private Font createFont ( final ResourceManager resourceManager ) { final Font defaultFont = resourceManager.getDevice ().getSystemFont (); if ( defaultFont == null ) { return null; } final FontData fd[] = FontDescriptor.copy ( defaultFont.getFontData () ); if ( fd == null ) { return null; } for ( final FontData f : fd ) { if ( this.fontSize > 0 ) { f.setHeight ( this.fontSize ); } } return resourceManager.createFont ( FontDescriptor.createFrom ( fd ) ); } }
final GC gc = new GC ( resourceManager.getDevice () );
final GC gc = new GC ( resourceManager.getDevice () );