Package com.minecolonies.core.client.gui
Class AbstractWindowSkeleton
java.lang.Object
com.ldtteam.blockui.UiRenderMacros
com.ldtteam.blockui.Pane
com.ldtteam.blockui.views.View
com.ldtteam.blockui.views.BOWindow
com.minecolonies.core.client.gui.AbstractWindowSkeleton
- All Implemented Interfaces:
com.ldtteam.blockui.controls.ButtonHandler,IModuleContainer<IWindowModule>,Consumer<com.ldtteam.blockui.controls.Button>
- Direct Known Subclasses:
AbstractBuildingWindow,AbstractWindowCitizen,DebugWindowCitizen,WindowAssignCitizen,WindowBannerRallyGuards,WindowBuildBuilding,WindowBuildDecoration,WindowBuildingBrowser,WindowClipBoard,WindowColonyMap,WindowColonyPrestigeRanking,WindowConfirm,WindowDecorationController,WindowField,WindowHireWorker,WindowHutAllInventory,WindowHutGuide,WindowInfo,WindowInteraction,WindowPlantationField,WindowPostBoxMain,WindowQuestLog,WindowReactivateBuilding,WindowRequestDetail,WindowResearchTree,WindowResourceList,WindowSchematicAnalyzer,WindowSuggestBuildTool,WindowSupplyStory,WindowTownHallCantCreateColony,WindowTownHallColonyManage,WindowTownHallColonyReactivate,WindowTownHallDeleteAbandonColony
public abstract class AbstractWindowSkeleton
extends com.ldtteam.blockui.views.BOWindow
implements com.ldtteam.blockui.controls.ButtonHandler, IModuleContainer<IWindowModule>
Manage windows and their events.
-
Nested Class Summary
Nested classes/interfaces inherited from class com.ldtteam.blockui.views.BOWindow
com.ldtteam.blockui.views.BOWindow.WindowRenderType -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final com.ldtteam.blockui.controls.Buttonprotected final com.ldtteam.blockui.controls.Buttonprotected final com.ldtteam.blockui.controls.TextPanes used by the generic page handlerprotected com.ldtteam.blockui.views.SwitchViewFields inherited from class com.ldtteam.blockui.views.BOWindow
DEFAULT_HEIGHT, DEFAULT_WIDTH, lightbox, screen, windowPausesGame, windowRenderType, xmlResourceLocationFields inherited from class com.ldtteam.blockui.views.View
children, paddingFields inherited from class com.ldtteam.blockui.Pane
alignment, cursor, debugging, enabled, focus, height, hoverSource, id, lastClickedPane, mc, onHover, onHoverId, visible, wasCursorInPane, width, window, x, yFields inherited from class com.ldtteam.blockui.UiRenderMacros
HALF_BIAS -
Constructor Summary
ConstructorsConstructorDescriptionAbstractWindowSkeleton(@Nullable com.ldtteam.blockui.views.BOWindow parent, net.minecraft.resources.ResourceLocation resource) Constructor for the skeleton class of the windows.AbstractWindowSkeleton(net.minecraft.resources.ResourceLocation resource) Constructor with no parent window -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()final voiddoNothing(com.ldtteam.blockui.controls.Button ignored) Button clicked without an action.@NotNull Class<IWindowModule>Get the class type of the module container.@NotNull List<IWindowModule>Get a list containing all modules registered to this container.voidonButtonClicked(@NotNull com.ldtteam.blockui.controls.Button button) Handle a button clicked event.voidonClosed()voidonOpened()voidonUpdate()final voidregisterButton(String id, Runnable action) Register a button on the window.final voidregisterButton(String id, Consumer<com.ldtteam.blockui.controls.Button> action) Register a button on the window.final <T extends IWindowWithLayoutModule,A>
TregisterLayoutModule(BiFunction<AbstractWindowSkeleton, A, T> moduleBuilder, A argument, int xPos, int yPos) Add a module to this window.final <T extends IWindowModule,A>
TregisterModule(BiFunction<AbstractWindowSkeleton, A, T> moduleBuilder, A argument) Add a module to this window.voidsetPage(boolean relative, int page) Generic page handler, uses common idsMethods inherited from class com.ldtteam.blockui.views.BOWindow
doesWindowPauseGame, drawSelf, getRenderType, getScreen, getXmlResourceLocation, hasLightbox, loadParams, onKeyTyped, onMouseReleased, onUnhandledKeyTyped, open, openAsLayerMethods inherited from class com.ldtteam.blockui.views.View
accumulatePosition, addChild, addChild, adjustChild, childIsVisible, click, drawHidden, drawSelfLast, findPaneByID, findPaneByType, findPaneForClick, getAccumulatedPosition, getChildren, getInteriorHeight, getInteriorWidth, mouseClickableEventHandler, mouseEventProcessor, mousePointableEventHandler, onMouseDrag, parseChildren, postAddChild, removeChild, rightClick, scrollInput, setSize, setWindowMethods inherited from class com.ldtteam.blockui.Pane
canHandleClick, clearFocus, disable, draw, drawLast, enable, findFirstPaneByType, findPaneOfTypeByID, getAlignment, getCursor, getFocus, getHeight, getHoverPane, getID, getParent, getWidth, getWindow, getX, getY, handleClick, handleHover, handleRightClick, hide, isClickable, isEnabled, isFocus, isPointInPane, isVisible, moveBy, off, on, onFocus, onFocusLost, putInside, scissorsEnd, scissorsStart, setAlignment, setCursor, setEnabled, setFocus, setFocus, setHoverPane, setID, setParentView, setPosition, setVisible, shouldDraw, show, wasCursorInPaneMethods inherited from class com.ldtteam.blockui.UiRenderMacros
blit, blit, blit, blit, blitRepeatable, drawEntity, drawLineRect, drawLineRect, drawLineRect, drawLineRectGradient, drawLineRectGradient, drawLineRectGradient, fill, fill, fillGradient, fillGradient, hLine, hLine, line, line, populateBlitTriangles, populateFillGradientTriangles, populateFillTriangles, vLine, vLineMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.ldtteam.blockui.controls.ButtonHandler
acceptMethods inherited from interface com.minecolonies.api.colony.modules.IModuleContainer
getFirstModuleOccurance, getModule, getModule, getModule, getModuleMatching, getModules, getModules, getModules, getModulesByType, hasModule, hasModule, hasModule
-
Field Details
-
pageNum
protected final com.ldtteam.blockui.controls.Text pageNumPanes used by the generic page handler -
buttonPrevPage
protected final com.ldtteam.blockui.controls.Button buttonPrevPage -
buttonNextPage
protected final com.ldtteam.blockui.controls.Button buttonNextPage -
switchView
protected com.ldtteam.blockui.views.SwitchView switchView
-
-
Constructor Details
-
AbstractWindowSkeleton
public AbstractWindowSkeleton(net.minecraft.resources.ResourceLocation resource) Constructor with no parent window- Parameters:
resource- window resource location.
-
AbstractWindowSkeleton
public AbstractWindowSkeleton(@Nullable @Nullable com.ldtteam.blockui.views.BOWindow parent, net.minecraft.resources.ResourceLocation resource) Constructor for the skeleton class of the windows.- Parameters:
parent- the parent window.resource- window resource location.
-
-
Method Details
-
getModules
Description copied from interface:IModuleContainerGet a list containing all modules registered to this container.- Specified by:
getModulesin interfaceIModuleContainer<IWindowModule>- Returns:
- the list of all modules.
-
getClassType
Description copied from interface:IModuleContainerGet the class type of the module container.- Specified by:
getClassTypein interfaceIModuleContainer<IWindowModule>- Returns:
- the class type.
-
registerButton
Register a button on the window.- Parameters:
id- Button ID.action- Consumer with the action to be performed.
-
registerButton
Register a button on the window.- Parameters:
id- Button ID.action- Consumer with the action to be performed.
-
registerModule
public final <T extends IWindowModule,A> T registerModule(BiFunction<AbstractWindowSkeleton, A, T> moduleBuilder, A argument) Add a module to this window. Extending the original logic of the window.- Parameters:
moduleBuilder- the new module.
-
registerLayoutModule
public final <T extends IWindowWithLayoutModule,A> T registerLayoutModule(BiFunction<AbstractWindowSkeleton, A, T> moduleBuilder, A argument, int xPos, int yPos) Add a module to this window. Extending the original logic of the window.- Parameters:
moduleBuilder- the new module.
-
onOpened
public void onOpened()- Overrides:
onOpenedin classcom.ldtteam.blockui.views.BOWindow
-
onUpdate
public void onUpdate()- Overrides:
onUpdatein classcom.ldtteam.blockui.views.View
-
onClosed
public void onClosed()- Overrides:
onClosedin classcom.ldtteam.blockui.views.BOWindow
-
onButtonClicked
public void onButtonClicked(@NotNull @NotNull com.ldtteam.blockui.controls.Button button) Handle a button clicked event. Find the registered event and execute that.todo: make final once migration is complete
- Specified by:
onButtonClickedin interfacecom.ldtteam.blockui.controls.ButtonHandler- Parameters:
button- the button that was clicked.
-
doNothing
public final void doNothing(com.ldtteam.blockui.controls.Button ignored) Button clicked without an action. Method does nothing.- Parameters:
ignored- Parameter is ignored. Since some actions require a button, we must accept a button parameter.
-
setPage
public void setPage(boolean relative, int page) Generic page handler, uses common ids- Parameters:
relative- whether page param is relative or absolutepage- if relative turn x pages forward/backward, if absolute turn to x-th page
-
close
public void close()- Overrides:
closein classcom.ldtteam.blockui.views.BOWindow
-