Class 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 Detail

      • screenSize

        protected final be.yildizgames.module.window.ScreenSize screenSize
        Contains the screen size data.
    • Constructor Detail

      • StandardGuiFactory

        protected StandardGuiFactory​(be.yildizgames.module.window.ScreenSize screenSize)
    • Method Detail

      • button

        public final be.yildizgames.module.graphic.gui.internal.impl.SimpleButtonBuilder button()
        Specified by:
        button in interface GuiFactory
      • textLine

        public final be.yildizgames.module.graphic.gui.internal.impl.SimpleTextLineBuilder textLine()
        Specified by:
        textLine in interface GuiFactory
      • textArea

        public final be.yildizgames.module.graphic.gui.internal.impl.SimpleTextAreaBuilder textArea()
        Specified by:
        textArea in interface GuiFactory
      • checkbox

        public final be.yildizgames.module.graphic.gui.internal.impl.SimpleCheckBoxBuilder checkbox()
        Specified by:
        checkbox in interface GuiFactory
      • inputBox

        public final be.yildizgames.module.graphic.gui.internal.impl.SimpleInputBoxBuilder inputBox()
        Specified by:
        inputBox in interface GuiFactory
      • progressBar

        public final be.yildizgames.module.graphic.gui.internal.impl.SimpleProgressBarBuilder progressBar()
        Specified by:
        progressBar in interface GuiFactory
      • 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, throw IllegalArgumentException if 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, throw IllegalArgumentException if 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.
      • getProgressBar

        public final ProgressBar getProgressBar​(String name)
        Retrieve a ProgressBar from its name, if no name matches, an IllegalArgumentException is 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.
      • getInputBox

        public final InputBox getInputBox​(String name)
        Retrieve a InputBoxGui from its name, if no name matches, an IllegalArgumentException is 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, an IllegalArgumentException is 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.
      • 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, an IllegalArgumentException is 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:
        getScreenSize in interface GuiFactory
      • 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 - true to use this container as part of a widget instead of widget container.
        Returns:
        The newly built container.