public class LoadoutItemModel
extends java.lang.Object
Constructor and Description |
---|
LoadoutItemModel(LoadoutItemModel copy) |
LoadoutItemModel(java.lang.String title)
Generates a navigation bar load out with just a provided name.
|
LoadoutItemModel(java.lang.String title,
LoadoutItemModel copy)
Generates a navigation bar load out with a provided name and loadout
|
LoadoutItemModel(java.lang.String uid,
java.lang.String title)
Generates a navigation bar load out with a reference and a name
|
LoadoutItemModel(java.lang.String uid,
java.lang.String title,
java.util.List<java.lang.String> stringSet)
Generates a navigation bar load out with a reference and a name
|
Modifier and Type | Method and Description |
---|---|
boolean |
containsButton(NavButtonModel btn)
Check if this loadout contains the given button model
|
boolean |
containsButton(java.lang.String reference)
Check if this loadout contains the given button model
|
void |
copy(LoadoutItemModel other)
Copy data from another loadout
|
static LoadoutItemModel |
fromStringSet(java.util.Set<java.lang.String> set)
Parse a loadout from the preference string set
|
NavButtonModel |
getButton(java.lang.String key)
Get a button given its position key
|
java.lang.String |
getButtonKey(NavButtonModel mdl)
Get the key for a given button model
|
int |
getNumButtons()
Get the current number of buttons
|
java.util.List<NavButtonModel> |
getSortedModels()
Get all button models sorted by this loadout's sort order
|
java.lang.String |
getTitle()
Get the title of this loadout
|
java.lang.String |
getUID()
Get the unique ID for this loadout
|
boolean |
isDefault()
Check if this loadout is the default loadout
|
boolean |
isTemporary()
Check whether or not this loadout is temporary (non-persistable)
|
boolean |
isToolVisible(java.lang.String modelRef)
Check whether a tool is visible
|
void |
persist()
Persist this loadout to shared preferences
|
void |
refreshButtons()
Refresh loadout button models
Useful in cases where a plugin has been loaded or unloaded
|
void |
removeButton(NavButtonModel btn)
Remove button with the given button model
|
void |
removeButton(java.lang.String key)
Remove button at the given position key
|
void |
setButton(int index,
NavButtonModel btn)
Set the button at the given position
|
void |
setButton(int index,
java.lang.String reference)
Set the button at the given position
|
void |
setButton(java.lang.String key,
NavButtonModel btn)
Set the button at the given position key
|
void |
setButton(java.lang.String key,
java.lang.String reference)
Set the given button to a model by its reference
If the reference is not found a blank placeholder will be used
|
void |
setSortOrder(java.util.List<?> models)
Set the sort order for this loadout using a list of sorted button models
|
void |
setTemporary(boolean temp)
Set whether this loadout is temporary
|
void |
setTitle(java.lang.String title)
Set the displayed title for this loadout
|
void |
setToolsVisible(java.util.Collection<java.lang.String> modelRefs,
boolean visible)
Set whether a tool in this loadout is visible or not
This determines whether the tool shows in the "overflow" menu
list of available tools
|
void |
setToolVisible(java.lang.String modelRef,
boolean visible)
Set whether a tool in this loadout is visible or not
This determines whether the tool shows in the "overflow" menu
list of available tools
|
void |
showZoomButton(boolean showZoom)
Set whether to show the zoom button in the loadout
|
java.util.Set<java.lang.String> |
toStringSet()
Serialize a loadout to the preferences string set format
|
public LoadoutItemModel(java.lang.String title)
title
- the provided namepublic LoadoutItemModel(java.lang.String title, LoadoutItemModel copy)
title
- the provided namecopy
- Loadout copypublic LoadoutItemModel(LoadoutItemModel copy)
public LoadoutItemModel(java.lang.String uid, java.lang.String title)
uid
- the reference should be unique across all navigation barstitle
- the title for the load outpublic LoadoutItemModel(java.lang.String uid, java.lang.String title, java.util.List<java.lang.String> stringSet)
uid
- the reference should be unique across all navigation barstitle
- the title for the load outstringSet
- the set of navigation buttons associated with the navigation bar load out
(can be null).public final java.lang.String getUID()
public java.lang.String getTitle()
public void setTitle(java.lang.String title)
title
- Titlepublic void setButton(java.lang.String key, NavButtonModel btn)
key
- Position keybtn
- Button (null to remove)public void setButton(java.lang.String key, java.lang.String reference)
key
- Button keyreference
- Button model referencepublic void setButton(int index, NavButtonModel btn)
index
- Position indexbtn
- Button (null to remove)public void setButton(int index, java.lang.String reference)
index
- Position indexreference
- Button referencepublic void showZoomButton(boolean showZoom)
showZoom
- True to show the zoom buttonpublic void removeButton(java.lang.String key)
key
- Position keypublic void removeButton(NavButtonModel btn)
btn
- Button modelpublic int getNumButtons()
public NavButtonModel getButton(java.lang.String key)
key
- Position keypublic java.lang.String getButtonKey(NavButtonModel mdl)
mdl
- Button modelpublic boolean containsButton(NavButtonModel btn)
btn
- Button to checkpublic boolean containsButton(java.lang.String reference)
reference
- Button model referencepublic boolean isDefault()
public void setToolVisible(java.lang.String modelRef, boolean visible)
modelRef
- NavButtonModel.getReference()
visible
- True if visible, false if hiddenpublic void setToolsVisible(java.util.Collection<java.lang.String> modelRefs, boolean visible)
modelRefs
- List of NavButtonModel.getReference()
visible
- True if visible, false if hiddenpublic boolean isToolVisible(java.lang.String modelRef)
modelRef
- NavButtonModel.getReference()
public void setSortOrder(java.util.List<?> models)
models
- Button models to use as the order reference
This can be a list of NavButtonModel
or String
public java.util.List<NavButtonModel> getSortedModels()
public void persist()
public void refreshButtons()
public void copy(LoadoutItemModel other)
other
- Other loadoutpublic boolean isTemporary()
public void setTemporary(boolean temp)
temp
- True if temporarypublic java.util.Set<java.lang.String> toStringSet()
public static LoadoutItemModel fromStringSet(java.util.Set<java.lang.String> set)
set
- String set containing loadout data