Package me.hsgamer.hscore.ui
Class BaseHolder<D extends Display>
java.lang.Object
me.hsgamer.hscore.ui.BaseHolder<D>
- Type Parameters:
D- The type ofDisplay
- All Implemented Interfaces:
Holder<D>,Initializable,Updatable
A simple implementation of
Holder-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<T> voidaddEventConsumer(Class<T> eventClass, Consumer<T> eventConsumer) Add an event consumervoidClear all event consumers of all eventsvoidclearEventConsumer(Class<?> eventClass) Clear all event consumerscreateDisplay(UUID uuid) Create a display with the unique idgetDisplay(UUID uuid) Get the display for the unique idvoidhandleEvent(Object event) Handle the eventprotected abstract DnewDisplay(UUID uuid) Make a new displayprotected voidonRemoveDisplay(D display) Called when the display is removedvoidRemove all displaysvoidremoveDisplay(UUID uuid) Remove a display with the unique idvoidstop()Stop the objectvoidupdate()Update the updatable objectMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface me.hsgamer.hscore.ui.property.Initializable
init
-
Field Details
-
displayMap
-
-
Constructor Details
-
BaseHolder
public BaseHolder()
-
-
Method Details
-
newDisplay
Make a new display- Parameters:
uuid- the unique id- Returns:
- the display
-
onRemoveDisplay
Called when the display is removed- Parameters:
display- the display
-
createDisplay
Description copied from interface:HolderCreate a display with the unique id- Specified by:
createDisplayin interfaceHolder<D extends Display>- Parameters:
uuid- the unique id- Returns:
- the display
-
removeDisplay
Description copied from interface:HolderRemove a display with the unique id- Specified by:
removeDisplayin interfaceHolder<D extends Display>- Parameters:
uuid- the unique id
-
removeAllDisplay
public void removeAllDisplay()Description copied from interface:HolderRemove all displays- Specified by:
removeAllDisplayin interfaceHolder<D extends Display>
-
getDisplay
Description copied from interface:HolderGet the display for the unique id- Specified by:
getDisplayin interfaceHolder<D extends Display>- Parameters:
uuid- the unique id- Returns:
- the display
-
update
public void update()Description copied from interface:UpdatableUpdate the updatable object -
addEventConsumer
Description copied from interface:HolderAdd an event consumer- Specified by:
addEventConsumerin interfaceHolder<D extends Display>- Type Parameters:
T- the type of the event- Parameters:
eventClass- the event classeventConsumer- the event consumer
-
stop
public void stop()Description copied from interface:InitializableStop the object- Specified by:
stopin interfaceInitializable
-
clearEventConsumer
Description copied from interface:HolderClear all event consumers- Specified by:
clearEventConsumerin interfaceHolder<D extends Display>- Parameters:
eventClass- the event class
-
clearAllEventConsumer
public void clearAllEventConsumer()Description copied from interface:HolderClear all event consumers of all events- Specified by:
clearAllEventConsumerin interfaceHolder<D extends Display>
-
handleEvent
Description copied from interface:HolderHandle the event- Specified by:
handleEventin interfaceHolder<D extends Display>- Parameters:
event- the event
-