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 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 ListenerList<MapPaintStyles.MapPaintSylesUpdateListener> |
listeners |
private static ElemStyles |
styles |
Modifier | Constructor and Description |
---|---|
private |
MapPaintStyles() |
Modifier and Type | Method and Description |
---|---|
static void |
addMapPaintSylesUpdateListener(MapPaintStyles.MapPaintSylesUpdateListener listener)
Add a listener that listens to global style changes.
|
static StyleSource |
addStyle(SourceEntry entry)
Add a new map paint style.
|
static boolean |
canMoveStyles(int[] sel,
int i)
Check if the styles can be moved
|
static void |
fireMapPaintStyleEntryUpdated(int index)
Notifies all listeners that there was an update to a specific map paint style
|
static void |
fireMapPaintSylesUpdated()
Notifies all listeners that there was any update to the map paint styles
|
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)
Gets the directories that should be searched for icons
|
static javax.swing.ImageIcon |
getNodeIcon(Tag tag)
Returns the node icon that would be displayed for the given 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()
Reloads all styles from the preferences.
|
private static void |
refreshStyles() |
static void |
removeMapPaintSylesUpdateListener(MapPaintStyles.MapPaintSylesUpdateListener listener)
Removes a listener that listens to global style changes.
|
static void |
removeStyle(SourceEntry entry)
Remove a map paint style.
|
static void |
toggleStyleActive(int... sel)
Toggles the active state of several styles
|
private static final java.util.Collection<java.lang.String> DEPRECATED_IMAGE_NAMES
private static final ListenerList<MapPaintStyles.MapPaintSylesUpdateListener> listeners
private static ElemStyles styles
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)
tag
- The tag to look an icon fornull
if no icon foundpublic 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)
source
- The style source the icon is frompublic static void readFromPreferences()
private static void loadStyleForFirstTime(StyleSource source)
private static StyleSource fromSourceEntry(SourceEntry entry)
public 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)
sel
- The indexes of the selected stylesi
- The number of places to move the stylestrue
if that movement is possiblepublic static void toggleStyleActive(int... sel)
sel
- The style indexespublic static StyleSource addStyle(SourceEntry entry)
entry
- map paint stylepublic static void removeStyle(SourceEntry entry)
entry
- map paint styleprivate static void refreshStyles()
public static void addMapPaintSylesUpdateListener(MapPaintStyles.MapPaintSylesUpdateListener listener)
listener
- The listenerpublic static void removeMapPaintSylesUpdateListener(MapPaintStyles.MapPaintSylesUpdateListener listener)
listener
- The listenerpublic static void fireMapPaintSylesUpdated()
public static void fireMapPaintStyleEntryUpdated(int index)
index
- The style index