Package org.astrogrid.samp.gui
Class IconStore
java.lang.Object
org.astrogrid.samp.gui.IconStore
Manages client icons. Images are cached where appropriate.
A size may be supplied so that all icons returned by this object's methods
are of a given standard size.
Also provides some icon utility methods.
- Since:
- 17 Nov 2008
- Author:
- Mark Taylor
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Icon
createEmptyIcon
(int size) Returns an icon with no content but a given size.static Icon
createMinimalIcon
(int size) Returns an icon which indicates a shape but doesn't look like much.Returns the icon supplied by the graphic file at a given URL.Returns the icon associated with a given client.static Icon
Icon implementation which is rescaled to so that one dimension (either width or height) has a fixed value.static Icon
Return an icon based on an existing one, but drawn to an exact size.
-
Constructor Details
-
IconStore
Constructor.- Parameters:
defaultIcon
- icon returned if no client icon is available
-
-
Method Details
-
getIcon
Returns the icon supplied by the graphic file at a given URL. Icons are cached, so that repeated invocations with the same url are not expensive.- Parameters:
url
- URL of image- Returns:
- image icon, resized if appropriate
-
getIcon
Returns the icon associated with a given client. This is either the icon described in its metadata or the default icon if there isn't one.- Parameters:
client
- client whose icon is required- Returns:
- associated icon, resized if appropriate
-
createEmptyIcon
Returns an icon with no content but a given size.- Parameters:
size
- edge size in pixels- Returns:
- emtpy square icon
-
createMinimalIcon
Returns an icon which indicates a shape but doesn't look like much. Currently it's a kind of open square.- Parameters:
size
- dimension in pixels- Returns:
- minimal icon
-
sizeIcon
Return an icon based on an existing one, but drawn to an exact size.- Parameters:
icon
- original icon, or null for blanksize
- number of horizontal and vertical pixels in output- Returns:
- resized version of
icon
-
scaleIcon
Icon implementation which is rescaled to so that one dimension (either width or height) has a fixed value.- Parameters:
icon
- input iconfixDim
- the fixed dimension in pixelsmaxAspect
- maximum aspect ratio (>= 1)fixVertical
- true to fix height, false to fix width
-