Class LookAndFeelList
java.lang.Object
bibliothek.gui.dock.support.lookandfeel.LookAndFeelList
A list of
Clients should use
LookAndFeels, can setup a LookAndFeel when
asked. It's possible to add a LookAndFeelListener to this list and
receive events whenever the LookAndFeel changes.Clients should use
getDefaultList() to get a list of LookAndFeels- Author:
- Benjamin Sigg
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCrates a new list and collects all availableLookAndFeels. -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(LookAndFeelList.Info info) Adds a newLookAndFeelto the list.voidAdds a set of root-Components to this list, the set of roots will be used to find allJComponents which need to be updated when theLookAndFeelchanges.voidaddLookAndFeelListener(LookAndFeelListener listener) Adds a listener to this list, the listener will be notified whenever theLookAndFeelis changed.get(int index) Gets the index'thLookAndFeel.Gets information about theLookAndFeelthat is used when the system can decide on its own.static LookAndFeelListGets the global list ofLookAndFeelsgetFull(int index) Gets the index'thLookAndFeel, where 0 means thedefault, 1 thesystemand anything else thenormal, moved by 2 steps, LookAndFeels.Gets theLookAndFeelwhose unique identifier iskey.Gets theLookAndFeelwhich is currently used.Gets information about theLookAndFeelthat imitates the native look of the system.intindexOf(LookAndFeelList.Info info) Gets the location ofinfo.intvoidinsert(int index, LookAndFeelList.Info info) Inserts a newLookAndFeelinto the list.booleanWhether multiple calls toread(DataInputStream)have an effect or not.Gets a unique identifier forinfo.protected Collection<Component>Creates a list containing all root-Components of this application, theComponentCollectors are used to build this list.protected LookAndFeelListener[]Gets allLookAndFeelListenerthat are known to this list.voidread(DataInputStream in) voidvoidremove(int index) Removes aLookAndFeelfrom this list.voidremove(LookAndFeelList.Info info) Removes theLookAndFeelat locationindexfrom this list.voidRemoves an earlier added set of roots.voidremoveLookAndFeelListener(LookAndFeelListener listener) Removes a listener from this list.voidsetAllowReadOnlyOnce(boolean allowReadOnlyOnce) Sets whether multiple calls toread(DataInputStream)will have an effect.voidsetDefault(LookAndFeelList.Info defaultInfo) Sets the default-LookAndFeel.static voidSets the defaultLookAndFeelList.voidsetLookAndFeel(LookAndFeelList.Info lookAndFeel) Exchanges the currently usedLookAndFeel.voidsetReadOnce(boolean read) Sets whether this list has already read something once, or whether it is fresh.voidsetSystem(LookAndFeelList.Info systemInfo) Sets the system-LookAndFeel.intsize()Gets the number ofLookAndFeels that are known to this list.voidwrite(DataOutputStream out) Writes whichLookAndFeelis currently used.voidWrites whichLookAndFeelis currently used.
-
Constructor Details
-
LookAndFeelList
protected LookAndFeelList()Crates a new list and collects all availableLookAndFeels.
-
-
Method Details
-
getDefaultList
Gets the global list ofLookAndFeels- Returns:
- the global list, not
null
-
setDefaultList
Sets the defaultLookAndFeelList.- Parameters:
list- the list, can benull
-
isAllowReadOnlyOnce
public boolean isAllowReadOnlyOnce()Whether multiple calls toread(DataInputStream)have an effect or not.- Returns:
trueif only the first read-call has an effect.
-
setAllowReadOnlyOnce
public void setAllowReadOnlyOnce(boolean allowReadOnlyOnce) Sets whether multiple calls toread(DataInputStream)will have an effect.- Parameters:
allowReadOnlyOnce-trueif only the first read will have an effect,falseif theLookAndFeelcan change every timeread(DataInputStream)is called.
-
setReadOnce
public void setReadOnce(boolean read) Sets whether this list has already read something once, or whether it is fresh. Can be used to reset a list to its initial state.- Parameters:
read-trueif at least one time one of thereadmethods was called,falseotherwise.
-
addLookAndFeelListener
Adds a listener to this list, the listener will be notified whenever theLookAndFeelis changed.- Parameters:
listener- the new listener
-
removeLookAndFeelListener
Removes a listener from this list.- Parameters:
listener- the listener to remove
-
listeners
Gets allLookAndFeelListenerthat are known to this list.- Returns:
- the list of listeners
-
addComponentCollector
Adds a set of root-Components to this list, the set of roots will be used to find allJComponents which need to be updated when theLookAndFeelchanges.- Parameters:
c- the new set of roots
-
removeComponentCollector
Removes an earlier added set of roots.- Parameters:
c- the roots
-
add
Adds a newLookAndFeelto the list.- Parameters:
info- the new LookAndFeel
-
insert
Inserts a newLookAndFeelinto the list.- Parameters:
index- the location of the new LookAndFeelinfo- the new LookAndFeel
-
size
public int size()Gets the number ofLookAndFeels that are known to this list.- Returns:
- the number of LookAndFeels
-
get
Gets the index'thLookAndFeel.- Parameters:
index- the location of the LookAndFeel- Returns:
- the LookAndFeel
-
indexOf
Gets the location ofinfo.- Parameters:
info- aLookAndFeel- Returns:
- the location of
infoor -1
-
getFull
Gets the index'thLookAndFeel, where 0 means thedefault, 1 thesystemand anything else thenormal, moved by 2 steps, LookAndFeels.- Parameters:
index- the location of the LookAndFeel- Returns:
- the selected LookAndFeel
-
indexOfFull
Gets the index ofinfo, where 0 means thedefault, 1 thesystemand anything else thenormal, moved by 2 steps, LookAndFeels.- Parameters:
info- the LookAndFeel to search- Returns:
- the location of
info
-
getFull
Gets theLookAndFeelwhose unique identifier iskey.- Parameters:
key- the key to search- Returns:
- the handler of the
LookAndFeelornullifkeywas not found
-
keyOfFull
Gets a unique identifier forinfo.- Parameters:
info- the item whose identifier is searched- Returns:
- a unique identifier describing
info
-
remove
Removes theLookAndFeelat locationindexfrom this list.- Parameters:
info- the LookAndFeel to remove
-
remove
public void remove(int index) Removes aLookAndFeelfrom this list.- Parameters:
index- the location of the element to remove
-
getLookAndFeel
Gets theLookAndFeelwhich is currently used.- Returns:
- the currently used LookAndFeel
-
setLookAndFeel
Exchanges the currently usedLookAndFeel.- Parameters:
lookAndFeel- information about aLookAndFeel, notnull
-
getDefault
Gets information about theLookAndFeelthat is used when the system can decide on its own.- Returns:
- information about a
LookAndFeel
-
setDefault
Sets the default-LookAndFeel. Please note thatgetDefault()will return anotherLookAndFeelList.Info, even if the behavior of that other info is the same asdefaultInfo.- Parameters:
defaultInfo- the default LookAndFeel
-
getSystem
Gets information about theLookAndFeelthat imitates the native look of the system.- Returns:
- information about a
LookAndFeel
-
setSystem
Sets the system-LookAndFeel. Please note thatgetSystem()will return anotherLookAndFeelList.Info, even if the behavior of that other info is the same assystemInfo.- Parameters:
systemInfo- the system LookAndFeel
-
write
Writes whichLookAndFeelis currently used.- Parameters:
out- the stream to write into- Throws:
IOException- if the method can't write intoout
-
read
- Parameters:
in- the stream to read from- Throws:
IOException- ifincan't be read
-
writeXML
Writes whichLookAndFeelis currently used.- Parameters:
element- the element to write into, the attributes ofelementwill not be changed.
-
readXML
- Parameters:
element- the element to read from
-
listComponents
Creates a list containing all root-Components of this application, theComponentCollectors are used to build this list.- Returns:
- the list of roots
-