public final class MapPaintStyles extends java.lang.Object
MapPaintStyles.MapPaintSylesUpdateListener.mapPaintStylesUpdated()
is fired
for all listeners.Modifier and Type | Class and Description |
---|---|
static class |
MapPaintStyles.IconReference
IconReference is used to remember the associated style source for each icon URL.
|
static class |
MapPaintStyles.MapPaintStyleLoader |
static interface |
MapPaintStyles.MapPaintSylesUpdateListener
MapPaintSylesUpdateListener & related code
(get informed when the list of MapPaint StyleSources changes)
|
static class |
MapPaintStyles.TagKeyReference
Value holder for a reference to a tag name.
|
Modifier and Type | Field and Description |
---|---|
private static java.util.Collection<java.lang.String> |
DEPRECATED_IMAGE_NAMES |
private static java.util.concurrent.CopyOnWriteArrayList<MapPaintStyles.MapPaintSylesUpdateListener> |
listeners |
private static ElemStyles |
styles |
private static java.lang.String |
XML_STYLE_MIME_TYPES
To remove in November 2016
|
Modifier | Constructor and Description |
---|---|
private |
MapPaintStyles() |
Modifier and Type | Method and Description |
---|---|
static void |
addMapPaintSylesUpdateListener(MapPaintStyles.MapPaintSylesUpdateListener listener) |
static StyleSource |
addStyle(SourceEntry entry)
Add a new map paint style.
|
static boolean |
canMoveStyles(int[] sel,
int i) |
static void |
fireMapPaintStyleEntryUpdated(int idx) |
static void |
fireMapPaintSylesUpdated() |
private static StyleSource |
fromSourceEntry(SourceEntry entry) |
static javax.swing.ImageIcon |
getIcon(MapPaintStyles.IconReference ref,
int width,
int height)
Return scaled icon.
|
static ImageProvider |
getIconProvider(MapPaintStyles.IconReference ref,
boolean test)
Image provider for icon.
|
static java.util.List<java.lang.String> |
getIconSourceDirs(StyleSource source) |
static javax.swing.ImageIcon |
getNodeIcon(Tag tag) |
static javax.swing.ImageIcon |
getNodeIcon(Tag tag,
boolean includeDeprecatedIcon)
Returns the node icon that would be displayed for the given tag.
|
static javax.swing.ImageIcon |
getNoIconIcon(StyleSource source)
No icon with the given name was found, show a dummy icon instead
|
static ElemStyles |
getStyles()
Returns the
ElemStyles singleton instance. |
private static void |
loadStyleForFirstTime(StyleSource source) |
static void |
moveStyles(int[] sel,
int delta)
Move position of entries in the current list of StyleSources
|
static void |
readFromPreferences() |
static void |
reloadStyles(int... sel)
reload styles
preferences are the same, but the file source may have changed
|
static void |
removeMapPaintSylesUpdateListener(MapPaintStyles.MapPaintSylesUpdateListener listener) |
static void |
toggleStyleActive(int... sel) |
private static final java.lang.String XML_STYLE_MIME_TYPES
private static final java.util.Collection<java.lang.String> DEPRECATED_IMAGE_NAMES
private static ElemStyles styles
private static final java.util.concurrent.CopyOnWriteArrayList<MapPaintStyles.MapPaintSylesUpdateListener> listeners
private MapPaintStyles()
public static ElemStyles getStyles()
ElemStyles
singleton instance.
The returned object is read only, any manipulation happens via one of
the other wrapper methods in this class. (readFromPreferences()
,
moveStyles(int[], int)
, ...)ElemStyles
singleton instancepublic static ImageProvider getIconProvider(MapPaintStyles.IconReference ref, boolean test)
ref
- reference to the requested icontest
- if true
than the icon is request is testednull
when test
is true
).getIcon(IconReference, int,int)
public static javax.swing.ImageIcon getIcon(MapPaintStyles.IconReference ref, int width, int height)
ref
- reference to the requested iconwidth
- icon width or -1 for autoscaleheight
- icon height or -1 for autoscalenull
.getIconProvider(IconReference, boolean)
public static javax.swing.ImageIcon getNoIconIcon(StyleSource source)
source
- style sourcepublic static javax.swing.ImageIcon getNodeIcon(Tag tag)
public static javax.swing.ImageIcon getNodeIcon(Tag tag, boolean includeDeprecatedIcon)
tag
- The tag to look an icon forincludeDeprecatedIcon
- if true
, the special deprecated icon will be returned if applicablenull
if no icon found, or if the icon is deprecated and not wantedpublic static java.util.List<java.lang.String> getIconSourceDirs(StyleSource source)
public static void readFromPreferences()
private static void loadStyleForFirstTime(StyleSource source)
private static StyleSource fromSourceEntry(SourceEntry entry)
public static void reloadStyles(int... sel)
sel
- the indices of styles to reloadpublic static void moveStyles(int[] sel, int delta)
sel
- The indices of styles to be moved.delta
- The number of lines it should move. positive int moves
down and negative moves up.public static boolean canMoveStyles(int[] sel, int i)
public static void toggleStyleActive(int... sel)
public static StyleSource addStyle(SourceEntry entry)
entry
- map paint stylenull
public static void addMapPaintSylesUpdateListener(MapPaintStyles.MapPaintSylesUpdateListener listener)
public static void removeMapPaintSylesUpdateListener(MapPaintStyles.MapPaintSylesUpdateListener listener)
public static void fireMapPaintSylesUpdated()
public static void fireMapPaintStyleEntryUpdated(int idx)