java.lang.Object com.realtime.crossfire.jxclient.skin.skin.DefaultJXCSkin
public class DefaultJXCSkin
Default JXCSkin
implementation.
Field Summary | |
---|---|
private int |
currentScreenHeight
The current screen height. |
private int |
currentScreenWidth
The current screen width. |
private static int |
DEFAULT_NUM_LOOK_OBJECTS
The default number of ground view objects. |
private KeyBindings |
defaultKeyBindings
The default key bindings. |
private JXCSkinCache<CommandList> |
definedCommandLists
All defined command lists. |
private Dialogs |
dialogs
All defined dialogs. |
private java.util.Collection<GUIItemList> |
floorLists
The GUIItemList s that display floor items. |
private java.util.Collection<GUIElement> |
guiElements
All GUI elements. |
private java.util.Collection<CommandList> |
initEvents
All "event init" commands in execution order. |
private java.util.Collection<GUIMap> |
maps
The GUIMap s that display maps. |
private Resolution |
maxResolution
The maximal resolution. |
private Resolution |
minResolution
The minimal resolution. |
private int |
numLookObjects
The maximum number of ground view objects. |
private OptionManager |
optionManager
The OptionManager to use. |
private java.util.Collection<java.lang.String> |
optionNames
The defined option names. |
private java.util.Collection<SkinEvent> |
skinEvents
All SkinEvent s attached to this instance. |
private java.lang.String |
skinName
The skin name. |
private AbstractLabel |
tooltipLabel
The tooltip label or null . |
private TooltipManager |
tooltipManager
The TooltipManager currently attached to or null if
not attached. |
Constructor Summary | |
---|---|
DefaultJXCSkin(KeyBindings defaultKeyBindings,
OptionManager optionManager,
Dialogs dialogs)
Creates a new instance. |
Method Summary | |
---|---|
void |
addCommandList(java.lang.String commandListName,
CommandListType commandListType)
Defines a new command list. |
void |
addDialog(java.lang.String dialogName)
Defines a new dialog. |
void |
addFloorList(GUIItemList floorList)
Adds a GUIItemList element that displays floor items. |
void |
addInitEvent(CommandList commandList)
Adds a command list to be executed on "init" events. |
void |
addMap(GUIMap map)
Adds a GUIMap element that displays a map. |
void |
addOption(java.lang.String optionName,
java.lang.String documentation,
Option commandCheckBoxOption)
Add a new option. |
void |
addSkinEvent(SkinEvent skinEvent)
Records a SkinEvent attached to this instance. |
void |
attach(TooltipManager tooltipManager)
Attaches this skin to a gui manager. |
void |
detach()
Frees all allocated resources. |
CommandList |
getCommandList(java.lang.String name)
Returns a named command list. |
KeyBindings |
getDefaultKeyBindings()
Returns the default key bindings for this skin. |
Gui |
getDialog(java.lang.String name)
Returns a dialog by name. |
Gui |
getDialogBook(int bookNo)
Returns the popup dialog for readables. |
Gui |
getDialogConnect()
Returns the "connection in progress" dialog. |
Gui |
getDialogDisconnect()
Returns the "disconnect from server?" dialog. |
Gui |
getDialogKeyBind()
Returns the key bindings dialog. |
Gui |
getDialogQuery()
Returns the dialog for query text input. |
Gui |
getDialogQuit()
Returns the "really quit?" dialog. |
java.lang.String |
getDialogToLoad()
Returns one dialog pending loading. |
Gui |
getMainInterface()
Returns the main window. |
java.awt.Dimension |
getMapSize()
Returns the map size in squares. |
Resolution |
getMaxResolution()
Returns the maximal resolution of this skin. |
Gui |
getMetaInterface()
Returns the server selection window. |
Resolution |
getMinResolution()
Returns the minimal resolution of this skin. |
int |
getNumLookObjects()
The number of ground view objects to request from the server. |
java.lang.String |
getSkinName()
Returns a short name for the skin. |
Gui |
getStartInterface()
Returns the start window. |
AbstractLabel |
getTooltipLabel()
Returns the AbstractLabel that is used to display tooltips. |
boolean |
hasChangedDialog()
Returns whether the dialog state should be saved. |
void |
insertGuiElement(GUIElement guiElement)
Adds a new GUIElement to this skin. |
java.util.Iterator<Gui> |
iterator()
Returns all gui instances of this skin. |
void |
setNumLookObjects(int numLookObjects)
Sets the maximum number of ground view objects. |
void |
setScreenSize(int screenWidth,
int screenHeight)
Updates the skin's gui elements to a screen size. |
void |
setSkinName(java.lang.String skinName,
Resolution minResolution,
Resolution maxResolution)
Sets the skin name. |
void |
setTooltipLabel(AbstractLabel tooltipLabel)
Sets the AbstractLabel that is used to display tooltips. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private int currentScreenHeight
private int currentScreenWidth
private static final int DEFAULT_NUM_LOOK_OBJECTS
@NotNull private final KeyBindings defaultKeyBindings
@NotNull private final JXCSkinCache<CommandList> definedCommandLists
@NotNull private final Dialogs dialogs
@NotNull private final java.util.Collection<GUIItemList> floorLists
GUIItemList
s that display floor items.
@NotNull private final java.util.Collection<GUIElement> guiElements
@NotNull private final java.util.Collection<CommandList> initEvents
@NotNull private final java.util.Collection<GUIMap> maps
GUIMap
s that display maps.
@NotNull private Resolution maxResolution
@NotNull private Resolution minResolution
private int numLookObjects
@NotNull private final OptionManager optionManager
OptionManager
to use.
@NotNull private final java.util.Collection<java.lang.String> optionNames
@NotNull private final java.util.Collection<SkinEvent> skinEvents
SkinEvent
s attached to this instance.
@NotNull private java.lang.String skinName
@Nullable private AbstractLabel tooltipLabel
null
.
@Nullable private TooltipManager tooltipManager
TooltipManager
currently attached to or null
if
not attached.
Constructor Detail |
---|
public DefaultJXCSkin(@NotNull KeyBindings defaultKeyBindings, @NotNull OptionManager optionManager, @NotNull Dialogs dialogs)
defaultKeyBindings
- the default key bindingsoptionManager
- the option manager to usedialogs
- the dialogs to useMethod Detail |
---|
public void addCommandList(@NotNull java.lang.String commandListName, @NotNull CommandListType commandListType) throws JXCSkinException
commandListName
- the command list's namecommandListType
- the command list's type
JXCSkinException
- if the command list cannot be createdpublic void addDialog(@NotNull java.lang.String dialogName)
dialogName
- the dialog's namepublic void addFloorList(@NotNull GUIItemList floorList)
GUIItemList
element that displays floor items. These
elements are used to calculate the number of floor objects to request
from the Crossfire server.
floorList
- the floor list elementpublic void addInitEvent(@NotNull CommandList commandList)
commandList
- the command listpublic void addMap(@NotNull GUIMap map)
GUIMap
element that displays a map. These elements are
used to calculate the size of the map view to request from the Crossfire
server.
map
- the map elementpublic void addOption(@NotNull java.lang.String optionName, @NotNull java.lang.String documentation, @NotNull Option commandCheckBoxOption) throws JXCSkinException
optionName
- the option name to adddocumentation
- the documentation string for the settingscommandCheckBoxOption
- the option instance to forward to
JXCSkinException
- if the option cannot be createdpublic void addSkinEvent(@NotNull SkinEvent skinEvent)
SkinEvent
attached to this instance.
skinEvent
- the skin event to addpublic void attach(@NotNull TooltipManager tooltipManager)
attach
in interface JXCSkin
tooltipManager
- the tooltip manager to attach topublic void detach()
detach
in interface JXCSkin
@NotNull public CommandList getCommandList(@NotNull java.lang.String name) throws JXCSkinException
getCommandList
in interface JXCSkin
name
- the name of the command list
JXCSkinException
- if the command list does not exist@NotNull public KeyBindings getDefaultKeyBindings()
getDefaultKeyBindings
in interface JXCSkin
@NotNull public Gui getDialog(@NotNull java.lang.String name) throws JXCSkinException
getDialog
in interface JXCSkin
name
- the dialog's name
JXCSkinException
- if the dialog does not exist@NotNull public Gui getDialogBook(int bookNo)
getDialogBook
in interface JXCSkin
bookNo
- the book ID
@Nullable public Gui getDialogConnect()
getDialogConnect
in interface JXCSkin
null
if the dialog does not exist@Nullable public Gui getDialogDisconnect()
getDialogDisconnect
in interface JXCSkin
null
if the dialog does not exist@NotNull public Gui getDialogKeyBind()
getDialogKeyBind
in interface JXCSkin
@NotNull public Gui getDialogQuery()
getDialogQuery
in interface JXCSkin
@Nullable public Gui getDialogQuit()
getDialogQuit
in interface JXCSkin
null
if the dialog does not exist@Nullable public java.lang.String getDialogToLoad()
null
@NotNull public Gui getMainInterface()
getMainInterface
in interface JXCSkin
@NotNull public java.awt.Dimension getMapSize()
getMapSize
in interface JXCSkin
@NotNull public Resolution getMaxResolution()
getMaxResolution
in interface JXCSkin
@NotNull public Gui getMetaInterface()
getMetaInterface
in interface JXCSkin
@NotNull public Resolution getMinResolution()
getMinResolution
in interface JXCSkin
public int getNumLookObjects()
getNumLookObjects
in interface JXCSkin
@NotNull public java.lang.String getSkinName()
getSkinName
in interface JXCSkin
@NotNull public Gui getStartInterface()
getStartInterface
in interface JXCSkin
@Nullable public AbstractLabel getTooltipLabel()
AbstractLabel
that is used to display tooltips.
getTooltipLabel
in interface JXCSkin
null
if tooltips are disabledpublic boolean hasChangedDialog()
hasChangedDialog
in interface JXCSkin
public void insertGuiElement(@NotNull GUIElement guiElement)
GUIElement
to this skin.
guiElement
- the GUI element@NotNull public java.util.Iterator<Gui> iterator()
iterator
in interface JXCSkin
iterator
in interface java.lang.Iterable<Gui>
public void setNumLookObjects(int numLookObjects)
numLookObjects
- the number of objectspublic void setScreenSize(int screenWidth, int screenHeight)
setScreenSize
in interface JXCSkin
screenWidth
- the new screen widthscreenHeight
- the new screen heightpublic void setSkinName(@NotNull java.lang.String skinName, @NotNull Resolution minResolution, @NotNull Resolution maxResolution)
skinName
- the skin nameminResolution
- the minimal supported resolutionmaxResolution
- the maximal supported resolutionpublic void setTooltipLabel(@Nullable AbstractLabel tooltipLabel)
AbstractLabel
that is used to display tooltips.
tooltipLabel
- the label or null
to disable tooltips