Class StandardGuiFactory
- java.lang.Object
-
- be.yildizgames.module.graphic.gui.internal.impl.StandardGuiFactory
-
- All Implemented Interfaces:
GuiFactory
public abstract class StandardGuiFactory extends Object implements GuiFactory
Build and manage all GUI elements.- Author:
- Grégory Van den Borre
-
-
Field Summary
Fields Modifier and Type Field Description protected be.yildizgames.module.window.ScreenSizescreenSizeContains the screen size data.
-
Constructor Summary
Constructors Modifier Constructor Description protectedStandardGuiFactory(be.yildizgames.module.window.ScreenSize screenSize)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description be.yildizgames.module.graphic.gui.internal.impl.SimpleButtonbuildButton(String name, be.yildizgames.module.coordinate.BaseCoordinate coordinates, ButtonMaterial material, SimpleContainer container)Build a new widget button.be.yildizgames.module.graphic.gui.internal.impl.SimpleCheckBoxbuildCheckBox(String name, be.yildizgames.module.coordinate.BaseCoordinate coordinates, Material background, Material hover, Material check, Material checkHover, Font font, SimpleContainer container)Build a new check box widget.abstract SimpleContainerbuildContainerElement(String name, be.yildizgames.module.coordinate.BaseCoordinate coordinates, Material background)Build a container base element in implementation.abstract SimpleContainerbuildContainerElement(String name, be.yildizgames.module.coordinate.BaseCoordinate coordinates, Material background, Container parent, boolean widget)Build a container base element with a container parent in implementation.be.yildizgames.module.graphic.gui.internal.impl.EmptyRectangleImagebuildEmptyRectangleImage(String name, be.yildizgames.module.coordinate.BaseCoordinate coordinates, Material background, int border, SimpleContainer container)Build a new image widget.be.yildizgames.module.graphic.gui.internal.impl.EmptyRectangleImagebuildEmptyUnderlineImage(String name, be.yildizgames.module.coordinate.BaseCoordinate coordinates, Material background, int border, SimpleContainer container)SimpleContainerbuildFullScreenOverlayContainer(String name, Material background)Build a new full screen GUI container, the position is set to (0, 0) and the size is the screen size, a GUI container is not meant to be used alone, it must be element of a view.protected abstract AbstractIconElementbuildIconElement(String name, be.yildizgames.module.coordinate.BaseCoordinate coordinates, Material material, Container container)Build an image base element in implementation.ImagebuildImage(String name, be.yildizgames.module.coordinate.BaseCoordinate coordinates, Material background, Container container)Build a new image widget.InputBoxbuildInputBox(be.yildizgames.module.coordinate.Position position, InputBoxTemplate def, SimpleContainer container)Build a new input box widget.be.yildizgames.module.graphic.gui.internal.impl.SimpleInputBoxbuildInputBox(String name, be.yildizgames.module.coordinate.BaseCoordinate coordinates, Font defaultFont, Font captionFont, Material background, Material backgroundHlight, Material cursorMaterial, Container container)Build a new input box widget.be.yildizgames.module.graphic.gui.internal.impl.SimpleInputBoxbuildInputBox(String name, be.yildizgames.module.coordinate.BaseCoordinate coordinates, Font font, Material background, Material backgroundHlight, Material cursorMaterial, Container container)Build a new input box widget.InputBoxbuildInputBox(String name, be.yildizgames.module.coordinate.BaseCoordinate coordinates, ButtonMaterial material, Material cursorMaterial, SimpleContainer container)Build a new input box widget.InputBoxbuildInputBox(String name, be.yildizgames.module.coordinate.Position position, InputBoxTemplate def, SimpleContainer container)SimpleContainerbuildOverlayContainer(String name, Material background, be.yildizgames.module.coordinate.BaseCoordinate coordinates)Build a new GUI container, a GUI container is not meant to be used alone, it must be element of a view.SimpleContainerbuildOverlayContainer(String name, Material background, be.yildizgames.module.coordinate.BaseCoordinate coordinates, SimpleContainer container)ProgressBarTimerbuildProgressBar(be.yildizgames.module.coordinate.BaseCoordinate coordinates, Material empty, Material filled, Font font, Duration duration, be.yildizgames.common.time.TimeFormatter formatter, SimpleContainer container)ProgressBarbuildProgressBar(be.yildizgames.module.coordinate.BaseCoordinate coordinates, Material empty, Material filled, SimpleContainer container)Build a new simple progress bar widget with a random unique name.ProgressBarbuildProgressBar(String name, be.yildizgames.module.coordinate.BaseCoordinate coordinates, Material empty, Material filled, SimpleContainer container)Build a new simple progress bar widget.ProgressBarbuildProgressBar(String name, be.yildizgames.module.coordinate.BaseCoordinate coordinates, Material leftMat, Material middleMat, Material rightMat, Material emptyMiddleMat, Material emptyRightMat, int borderWidth, SimpleContainer container)Build a new progress bar widget.ProgressBarbuildProgressBar(String name, Image background, Image filled, SimpleContainer parent)Build a new progress bar widget.ProgressBarbuildProgressBar(String name, SimpleContainer container)Build a new progress bar widget, all parameter are set to empty.TabContainerbuildTabcontainer(String name, String[] titles, be.yildizgames.module.coordinate.BaseCoordinate coordinates, int tabWidth, int tabHeight, Material background, Material tabMaterial, Material highlight, Material pushed, Font font, SimpleContainer container)Build a new tab container.TextAreabuildTextArea(String name, be.yildizgames.module.coordinate.BaseCoordinate coordinates, Font font, Material background, int textPadding, SimpleContainer container)Build a new multiple line text widget.protected abstract AbstractTextElementbuildTextElement(be.yildizgames.module.coordinate.BaseCoordinate coordinates, Font font, Container container)Build an text base element in implementation.be.yildizgames.module.graphic.gui.internal.impl.SimpleTextLinebuildTextLine(String name, be.yildizgames.module.coordinate.BaseCoordinate coordinates, Font font, SimpleContainer container)Build a new line of text widget.be.yildizgames.module.graphic.gui.internal.impl.SimpleButtonBuilderbutton()be.yildizgames.module.graphic.gui.internal.impl.SimpleCheckBoxBuildercheckbox()ContainerBuildercontainer()voiddelete(Button button)Delete a button.voiddelete(CheckBox checkBox)Delete a check box.voiddelete(Image image)Delete an image.voiddelete(InputBox inputBox)Delete an input box.voiddelete(SimpleContainer container)Delete a container.voiddelete(ProgressBar progressBar)Delete a progress bar.voiddelete(TextArea textArea)Delete a text area.voiddelete(TextLine textLine)Delete a text line.Optional<Button>findButton(String name)Try to retrieve a GuiButton from its name.Optional<Image>findImage(String name)try to retrieve an Image from its name.GuiAnimationManagergetAnimationManager()ButtongetButton(String name)Retrieve a GuiButton from its name.CheckBoxgetCheckBox(String name)Retrieve a CheckBoxGui from its name, if no name matches, anIllegalArgumentExceptionis thrown.SimpleContainergetContainer(String name)Retrieve a GuiContainer from its name, if no name matches, anIllegalArgumentExceptionis thrown.ImagegetImage(String name)Retrieve an Image from its name, throwIllegalArgumentExceptionif no matching name is found.InputBoxgetInputBox(String name)Retrieve a InputBoxGui from its name, if no name matches, anIllegalArgumentExceptionis thrown.ProgressBargetProgressBar(String name)Retrieve a ProgressBar from its name, if no name matches, anIllegalArgumentExceptionis thrown.be.yildizgames.module.window.ScreenSizegetScreenSize()SimpleContainergetSimpleContainer(String name)TextLinegetTextLine(String name)Retrieve a GuiTextLine from its name, throwIllegalArgumentExceptionif no matching name is found.ImageBuilderimage()be.yildizgames.module.graphic.gui.internal.impl.SimpleInputBoxBuilderinputBox()be.yildizgames.module.graphic.gui.internal.impl.SimpleProgressBarBuilderprogressBar()be.yildizgames.module.graphic.gui.internal.impl.SimpleTextAreaBuildertextArea()be.yildizgames.module.graphic.gui.internal.impl.SimpleTextLineBuildertextLine()TextLinetextLine(Container parent, TextLineTemplate template)TextLinetextLine(Container parent, TextLineTemplate template, be.yildizgames.common.client.translation.TranslationKey key)
-
-
-
Method Detail
-
container
public final ContainerBuilder container()
- Specified by:
containerin interfaceGuiFactory
-
button
public final be.yildizgames.module.graphic.gui.internal.impl.SimpleButtonBuilder button()
- Specified by:
buttonin interfaceGuiFactory
-
textLine
public final be.yildizgames.module.graphic.gui.internal.impl.SimpleTextLineBuilder textLine()
- Specified by:
textLinein interfaceGuiFactory
-
textLine
public final TextLine textLine(Container parent, TextLineTemplate template)
- Specified by:
textLinein interfaceGuiFactory
-
textLine
public final TextLine textLine(Container parent, TextLineTemplate template, be.yildizgames.common.client.translation.TranslationKey key)
- Specified by:
textLinein interfaceGuiFactory
-
textArea
public final be.yildizgames.module.graphic.gui.internal.impl.SimpleTextAreaBuilder textArea()
- Specified by:
textAreain interfaceGuiFactory
-
checkbox
public final be.yildizgames.module.graphic.gui.internal.impl.SimpleCheckBoxBuilder checkbox()
- Specified by:
checkboxin interfaceGuiFactory
-
image
public final ImageBuilder image()
- Specified by:
imagein interfaceGuiFactory
-
inputBox
public final be.yildizgames.module.graphic.gui.internal.impl.SimpleInputBoxBuilder inputBox()
- Specified by:
inputBoxin interfaceGuiFactory
-
progressBar
public final be.yildizgames.module.graphic.gui.internal.impl.SimpleProgressBarBuilder progressBar()
- Specified by:
progressBarin interfaceGuiFactory
-
buildButton
public final be.yildizgames.module.graphic.gui.internal.impl.SimpleButton buildButton(String name, be.yildizgames.module.coordinate.BaseCoordinate coordinates, ButtonMaterial material, SimpleContainer container)
Build a new widget button.- Parameters:
name- Unique button name.coordinates- GuiButton coordinates.material- GuiButton materials.container- Container holding the button.- Returns:
- The build button.
-
getButton
public final Button getButton(String name)
Retrieve a GuiButton from its name.- Parameters:
name- Name of the button to retrieve.- Returns:
- The matching GuiButton.
- Throws:
IllegalArgumentException- If no match is done.
-
findButton
public final Optional<Button> findButton(String name)
Try to retrieve a GuiButton from its name.- Parameters:
name- Name of the button to search for.- Returns:
- An optional button.
-
delete
public final void delete(Button button)
Delete a button.- Parameters:
button- GuiButton to delete.
-
buildImage
public final Image buildImage(String name, be.yildizgames.module.coordinate.BaseCoordinate coordinates, Material background, Container container)
Build a new image widget.- Parameters:
name- Unique image name.coordinates- Image coordinates.background- Image background material.container- Container holding the image.- Returns:
- The new image widget.
-
buildEmptyRectangleImage
public final be.yildizgames.module.graphic.gui.internal.impl.EmptyRectangleImage buildEmptyRectangleImage(String name, be.yildizgames.module.coordinate.BaseCoordinate coordinates, Material background, int border, SimpleContainer container)
Build a new image widget.- Parameters:
name- Unique image name.coordinates- Image coordinates.background- Image background material.border- Size of the border, in pixels.container- Container holding the image.- Returns:
- The new image widget.
-
buildEmptyUnderlineImage
public final be.yildizgames.module.graphic.gui.internal.impl.EmptyRectangleImage buildEmptyUnderlineImage(String name, be.yildizgames.module.coordinate.BaseCoordinate coordinates, Material background, int border, SimpleContainer container)
-
getImage
public final Image getImage(String name)
Retrieve an Image from its name, throwIllegalArgumentExceptionif no matching name is found.- Parameters:
name- Image name to retrieve.- Returns:
- The matching Image.
-
findImage
public final Optional<Image> findImage(String name)
try to retrieve an Image from its name.- Parameters:
name- Image name to retrieve.- Returns:
- The optional Image.
-
delete
public final void delete(Image image)
Delete an image.- Parameters:
image- Image to delete.
-
buildTextLine
public final be.yildizgames.module.graphic.gui.internal.impl.SimpleTextLine buildTextLine(String name, be.yildizgames.module.coordinate.BaseCoordinate coordinates, Font font, SimpleContainer container)
Build a new line of text widget.- Parameters:
name- Text line unique name.coordinates- Text line size and position.font- Font used for the text.container- Container holding the text line.- Returns:
- The new text line.
-
getTextLine
public final TextLine getTextLine(String name)
Retrieve a GuiTextLine from its name, throwIllegalArgumentExceptionif no matching name is found.- Parameters:
name- GuiTextLine name to retrieve.- Returns:
- The matching GuiTextLine.
-
delete
public final void delete(TextLine textLine)
Delete a text line.- Parameters:
textLine- Text line to delete.
-
buildTextArea
public final TextArea buildTextArea(String name, be.yildizgames.module.coordinate.BaseCoordinate coordinates, Font font, Material background, int textPadding, SimpleContainer container)
Build a new multiple line text widget.- Parameters:
name- Unique text area name.coordinates- Text area coordinates.font- Font used for the text.background- Background image.textPadding- Padding value for the text.container- Container holding the text area.- Returns:
- The new text area widget.
-
delete
public final void delete(TextArea textArea)
Delete a text area.- Parameters:
textArea- Text area to delete.
-
buildProgressBar
public final ProgressBar buildProgressBar(String name, be.yildizgames.module.coordinate.BaseCoordinate coordinates, Material leftMat, Material middleMat, Material rightMat, Material emptyMiddleMat, Material emptyRightMat, int borderWidth, SimpleContainer container)
Build a new progress bar widget.- Parameters:
name- Unique progress bar name.coordinates- Progress bar coordinates.leftMat- Material for the left corner.middleMat- Material for extensible part(will be stretched when the progress bar progress increase).rightMat- Material for the right corner.emptyMiddleMat- Material for the middle part to fill when still empty.emptyRightMat- Material for the right border part to fill when still empty.borderWidth- Width of the border element.container- Container holding the progress bar.- Returns:
- The new progress bar widget.
-
buildProgressBar
public final ProgressBar buildProgressBar(String name, Image background, Image filled, SimpleContainer parent)
Build a new progress bar widget.- Parameters:
name- Unique progress bar name.background- Image to use as empty background.filled- Image to use as filled background.parent- Container holding the progress bar.- Returns:
- The new progress bar widget.
-
buildProgressBar
public final ProgressBar buildProgressBar(String name, SimpleContainer container)
Build a new progress bar widget, all parameter are set to empty.- Parameters:
name- Unique progress bar name.container- Container holding the progress bar.- Returns:
- The new progress bar widget.
-
buildProgressBar
public final ProgressBar buildProgressBar(String name, be.yildizgames.module.coordinate.BaseCoordinate coordinates, Material empty, Material filled, SimpleContainer container)
Build a new simple progress bar widget.- Parameters:
name- Unique progress bar name.coordinates- Progress bar coordinates.empty- Material to use on empty part.filled- Material to use on filled part.container- Container holding the progress bar.- Returns:
- The new progress bar widget.
-
buildProgressBar
public final ProgressBar buildProgressBar(be.yildizgames.module.coordinate.BaseCoordinate coordinates, Material empty, Material filled, SimpleContainer container)
Build a new simple progress bar widget with a random unique name.- Parameters:
coordinates- Progress bar coordinates.empty- Material to use on empty part.filled- Material to use on filled part.container- Container holding the progress bar.- Returns:
- The new progress bar widget.
-
buildProgressBar
public final ProgressBarTimer buildProgressBar(be.yildizgames.module.coordinate.BaseCoordinate coordinates, Material empty, Material filled, Font font, Duration duration, be.yildizgames.common.time.TimeFormatter formatter, SimpleContainer container)
-
getProgressBar
public final ProgressBar getProgressBar(String name)
Retrieve a ProgressBar from its name, if no name matches, anIllegalArgumentExceptionis thrown.- Parameters:
name- Name of the ProgressBar to retrieve.- Returns:
- The ProgressBar associated with the name.
-
delete
public final void delete(ProgressBar progressBar)
Delete a progress bar.- Parameters:
progressBar- Progress bar to delete.
-
buildInputBox
public final be.yildizgames.module.graphic.gui.internal.impl.SimpleInputBox buildInputBox(String name, be.yildizgames.module.coordinate.BaseCoordinate coordinates, Font font, Material background, Material backgroundHlight, Material cursorMaterial, Container container)
Build a new input box widget.- Parameters:
name- Unique input box name.coordinates- Input box coordinates.font- Font used for the caption.background- Background material.backgroundHlight- Background material when the widget is focused.cursorMaterial- Material to use for the cursor.container- Container holding the input box.- Returns:
- The new input box widget.
-
buildInputBox
public final be.yildizgames.module.graphic.gui.internal.impl.SimpleInputBox buildInputBox(String name, be.yildizgames.module.coordinate.BaseCoordinate coordinates, Font defaultFont, Font captionFont, Material background, Material backgroundHlight, Material cursorMaterial, Container container)
Build a new input box widget.- Parameters:
name- Unique input box name.coordinates- Input box coordinates.defaultFont- Font used for the default message.captionFont- Font used for the text and the caption.background- Background material.backgroundHlight- Background material when the widget is focused.cursorMaterial- Material to use for the cursor.container- Container holding the input box.- Returns:
- The new input box widget.
-
buildInputBox
public final InputBox buildInputBox(String name, be.yildizgames.module.coordinate.BaseCoordinate coordinates, ButtonMaterial material, Material cursorMaterial, SimpleContainer container)
Build a new input box widget.- Parameters:
name- Unique input box name.coordinates- Input box coordinates.material- Background materials.cursorMaterial- Material to use for the cursor.container- Container holding the input box.- Returns:
- The new input box widget.
-
buildInputBox
public final InputBox buildInputBox(be.yildizgames.module.coordinate.Position position, InputBoxTemplate def, SimpleContainer container)
Build a new input box widget.- Parameters:
position- Input box position.def- Input box data.container- Container holding the input box.- Returns:
- The new input box widget.
-
buildInputBox
public final InputBox buildInputBox(String name, be.yildizgames.module.coordinate.Position position, InputBoxTemplate def, SimpleContainer container)
-
getInputBox
public final InputBox getInputBox(String name)
Retrieve a InputBoxGui from its name, if no name matches, anIllegalArgumentExceptionis thrown.- Parameters:
name- Name of the InputBoxGui to retrieve.- Returns:
- The InputBoxGui associated with the name.
-
delete
public final void delete(InputBox inputBox)
Delete an input box.- Parameters:
inputBox- Input box to delete.
-
buildCheckBox
public final be.yildizgames.module.graphic.gui.internal.impl.SimpleCheckBox buildCheckBox(String name, be.yildizgames.module.coordinate.BaseCoordinate coordinates, Material background, Material hover, Material check, Material checkHover, Font font, SimpleContainer container)
Build a new check box widget.- Parameters:
name- Unique check box name.coordinates- Check box coordinates.background- Background material.hover- Hover material.check- Material when checked.checkHover- Material when checked and hovered.font- Font to use for caption.container- Container holding the check box widget.- Returns:
- The new check box widget.
-
getCheckBox
public final CheckBox getCheckBox(String name)
Retrieve a CheckBoxGui from its name, if no name matches, anIllegalArgumentExceptionis thrown.- Parameters:
name- Name of the CheckBoxGui to retrieve.- Returns:
- The CheckBoxGui associated with the name.
-
delete
public final void delete(CheckBox checkBox)
Delete a check box.- Parameters:
checkBox- Check box to delete.
-
buildOverlayContainer
public final SimpleContainer buildOverlayContainer(String name, Material background, be.yildizgames.module.coordinate.BaseCoordinate coordinates)
Build a new GUI container, a GUI container is not meant to be used alone, it must be element of a view.- Parameters:
name- Unique container name.background- Material to use as background.coordinates- Container size and position.- Returns:
- The newly built container.
-
buildOverlayContainer
public SimpleContainer buildOverlayContainer(String name, Material background, be.yildizgames.module.coordinate.BaseCoordinate coordinates, SimpleContainer container)
-
buildFullScreenOverlayContainer
public final SimpleContainer buildFullScreenOverlayContainer(String name, Material background)
Build a new full screen GUI container, the position is set to (0, 0) and the size is the screen size, a GUI container is not meant to be used alone, it must be element of a view.- Parameters:
name- Unique container name.background- Container background material.- Returns:
- The newly built container.
-
getContainer
public final SimpleContainer getContainer(String name)
Retrieve a GuiContainer from its name, if no name matches, anIllegalArgumentExceptionis thrown.- Parameters:
name- Name of the GuiContainer to retrieve.- Returns:
- The GuiContainer associated with the name.
-
delete
public final void delete(SimpleContainer container)
Delete a container.- Parameters:
container- Gui container to delete.
-
buildTabcontainer
public final TabContainer buildTabcontainer(String name, String[] titles, be.yildizgames.module.coordinate.BaseCoordinate coordinates, int tabWidth, int tabHeight, Material background, Material tabMaterial, Material highlight, Material pushed, Font font, SimpleContainer container)
Build a new tab container.- Parameters:
name- Container name, must be unique.titles- Tab titles.coordinates- Container position and size.tabWidth- Tab width size.tabHeight- Tab height size.background- Container background material.tabMaterial- Material on inactive tab.highlight- Material on tab with mouse over.pushed- Material on active tab.font- Font to use on the tabs.container- Container holding the element.- Returns:
- The newly created tab container.
-
getScreenSize
public be.yildizgames.module.window.ScreenSize getScreenSize()
- Specified by:
getScreenSizein interfaceGuiFactory
-
getAnimationManager
public GuiAnimationManager getAnimationManager()
- Specified by:
getAnimationManagerin interfaceGuiFactory
-
getSimpleContainer
public final SimpleContainer getSimpleContainer(String name)
-
buildIconElement
protected abstract AbstractIconElement buildIconElement(String name, be.yildizgames.module.coordinate.BaseCoordinate coordinates, Material material, Container container)
Build an image base element in implementation.- Parameters:
name- Unique image name.coordinates- Image size and position.material- Material to set to the image.container- Container holding the image.- Returns:
- The newly built image.
-
buildTextElement
protected abstract AbstractTextElement buildTextElement(be.yildizgames.module.coordinate.BaseCoordinate coordinates, Font font, Container container)
Build an text base element in implementation.- Parameters:
coordinates- Text size and position.font- Font to set to the text.container- Container holding the text.- Returns:
- The newly built text.
-
buildContainerElement
public abstract SimpleContainer buildContainerElement(String name, be.yildizgames.module.coordinate.BaseCoordinate coordinates, Material background)
Build a container base element in implementation.- Parameters:
name- Unique container name.coordinates- Container size and position.background- Container background material.- Returns:
- The newly built container.
-
buildContainerElement
public abstract SimpleContainer buildContainerElement(String name, be.yildizgames.module.coordinate.BaseCoordinate coordinates, Material background, Container parent, boolean widget)
Build a container base element with a container parent in implementation.- Parameters:
name- Unique container name.coordinates- Container size and position.background- Container background material.parent- Parent container.widget-trueto use this container as part of a widget instead of widget container.- Returns:
- The newly built container.
-
-