@FrameworkOnly public class ThemeMap extends Object
ThemeFactory
s. This map can change the DockTheme
of its associated CControl
. New factories can be added or removed
from the map.Modifier and Type | Field and Description |
---|---|
static String |
KEY_BASIC_THEME
standard key for the
CBasicTheme |
static String |
KEY_BUBBLE_THEME
standard key for the
CBubbleTheme |
static String |
KEY_ECLIPSE_THEME
standard key for the
CEclipseTheme |
static String |
KEY_FLAT_THEME
standard key for the
CFlatTheme |
static String |
KEY_SMOOTH_THEME
standard key for the
CSmoothTheme |
Constructor and Description |
---|
ThemeMap()
Creates a new empty map.
|
ThemeMap(CControl control)
Creates a new map and wires this map to
control . |
Modifier and Type | Method and Description |
---|---|
void |
add(String key,
ThemeFactory factory)
Adds
factory at the end of this map. |
void |
addThemeMapListener(ThemeMapListener listener)
Adds a new listener to this map.
|
ThemeFactory |
getFactory(int index)
Gets the
index 'th factory. |
ThemeFactory |
getFactory(String key)
Searches the factory which is associated with
key . |
String |
getKey(int index)
Gets the key of the
index 'th element. |
DockThemeModifier |
getModifier()
Gets the object which will modify the
DockTheme before applying
the theme to the DockController . |
ThemeFactory |
getSelectedFactory()
Gets the currently selected factory.
|
String |
getSelectedKey()
Gets the name of the currently selected factory.
|
int |
indexOf(String key)
Searches for
key and returns its location. |
int |
indexOf(ThemeFactory factory)
Searches for
factory and returns its index. |
void |
insert(int index,
String key,
ThemeFactory factory)
Inserts a new factory into this map.
|
protected ThemeMapListener[] |
listeners()
Gets an array containing all
ThemeMapListener s of this map. |
void |
put(String key,
ThemeFactory factory)
Searches for an entry named
key and changes its factory. |
void |
remove(int index)
Removes the
index 'th entry of this map. |
boolean |
remove(String key)
Deletes the factory associated with
key . |
void |
removeThemeMapListener(ThemeMapListener listener)
Removes a listener from this map.
|
void |
select(int index)
Changes the selected factory.
|
void |
select(int index,
boolean force)
Changes the selected factory.
|
void |
select(String key)
Changes the selected factory.
|
void |
select(String key,
boolean force)
Changes the selected factory.
|
void |
select(ThemeFactory factory)
Changes the selected factory to
factory . |
void |
setModifier(DockThemeModifier modifier)
Sets the object which will modify the
DockTheme before applying
the theme to the DockController . |
int |
size()
Gets the number of elements of this map.
|
public static final String KEY_BASIC_THEME
CBasicTheme
public static final String KEY_BUBBLE_THEME
CBubbleTheme
public static final String KEY_ECLIPSE_THEME
CEclipseTheme
public static final String KEY_FLAT_THEME
CFlatTheme
public static final String KEY_SMOOTH_THEME
CSmoothTheme
public ThemeMap()
public ThemeMap(CControl control)
control
. Ensures
that the standard themes are available.control
,
and this map will ensure that the name of the theme is stored in the
ApplicationResourceManager
.control
- the control to monitorpublic void addThemeMapListener(ThemeMapListener listener)
listener
- the new listenerpublic void removeThemeMapListener(ThemeMapListener listener)
listener
- the listener to removeprotected ThemeMapListener[] listeners()
ThemeMapListener
s of this map.public void setModifier(DockThemeModifier modifier)
DockTheme
before applying
the theme to the DockController
.modifier
- the new modifier, can be null
public DockThemeModifier getModifier()
DockTheme
before applying
the theme to the DockController
.null
public void select(String key)
key
or key
is null
, then the
null
-factory is selected.key
- the name of the newly selected factory, can be null
public void select(String key, boolean force)
key
or key
is null
, then the
null
-factory is selected.key
- the name of the newly selected factory, can be null
force
- true
if the theme is to be loaded even
if it is already selectedpublic void select(ThemeFactory factory)
factory
.factory
- the factory to selectIllegalArgumentException
- if factory
is not registered
in this map.public void select(int index)
index
- the index of the newly selected factory, -1 will deselect
any factorypublic void select(int index, boolean force)
index
- the index of the newly selected factory, -1 will deselect
any factoryforce
- true
if an update should be forced even if
there seems not to be a changepublic String getSelectedKey()
null
public ThemeFactory getSelectedFactory()
null
public int size()
public void put(String key, ThemeFactory factory)
key
and changes its factory.
If no such entry is found, then factory
is added at the
end of this map.key
- the name of the factoryfactory
- the new factorypublic void add(String key, ThemeFactory factory)
factory
at the end of this map. If there is already
a factory named key
, then that other factory is first removed.key
- the key of the new factoryfactory
- the new factorypublic void insert(int index, String key, ThemeFactory factory)
key
in this map, then that other factory is removed.index
- the index where to insert the new factorykey
- the key of the new factoryfactory
- the new factorypublic void remove(int index)
index
'th entry of this map.index
- the name of the element to removepublic boolean remove(String key)
key
.key
- the name of the element to removetrue
if the element was deleted, false
if no element named key
was foundpublic int indexOf(ThemeFactory factory)
factory
and returns its index.factory
- the factory to searchpublic int indexOf(String key)
key
and returns its location.key
- the key to searchpublic String getKey(int index)
index
'th element.index
- the index of the elementpublic ThemeFactory getFactory(int index)
index
'th factory.index
- the index of the factorynull
public ThemeFactory getFactory(String key)
key
.key
- the unique name of a factorynull