Package gaiasky.gui

Class GenericDialog

java.lang.Object
com.badlogic.gdx.scenes.scene2d.Actor
com.badlogic.gdx.scenes.scene2d.Group
com.badlogic.gdx.scenes.scene2d.ui.WidgetGroup
com.badlogic.gdx.scenes.scene2d.ui.Table
All Implemented Interfaces:
com.badlogic.gdx.scenes.scene2d.utils.Cullable, com.badlogic.gdx.scenes.scene2d.utils.Layout
Direct Known Subclasses:
AboutWindow, AddShapeDialog, ArchiveViewWindow, BookmarkNameDialog, DataInfoWindow, DataLocationCheckWindow, DatasetFiltersWindow, DatasetInfoWindow, DatasetLoadDialog, DatasetManagerWindow, DatasetTransformsWindow, DatasetVisualSettingsWindow, DateDialog, FileChooser, FileNameWindow, GamepadConfigWindow, IndividualVisibilityWindow, KeyframePreferencesWindow, KeyframesWindow, LandAtWindow, LogWindow, MemInfoWindow, MinimapWindow, NewBookmarkFolderDialog, PreferencesWindow, ProceduralGenerationWindow, QuitWindow, ReleaseNotesWindow, SearchDialog, SlaveConfigWindow, TextureWindow, UpdatePopup

public abstract class GenericDialog extends CollapsibleWindow
  • Nested Class Summary

    Nested classes/interfaces inherited from class com.badlogic.gdx.scenes.scene2d.ui.Table

    com.badlogic.gdx.scenes.scene2d.ui.Table.Debug, com.badlogic.gdx.scenes.scene2d.ui.Table.DebugRect
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    com.badlogic.gdx.scenes.scene2d.ui.TextButton
     
    protected Runnable
     
    protected Set<com.badlogic.gdx.controllers.ControllerListener>
     
     
    protected com.badlogic.gdx.scenes.scene2d.ui.Table
     
    protected com.badlogic.gdx.scenes.scene2d.ui.HorizontalGroup
     
    com.badlogic.gdx.scenes.scene2d.ui.TextButton
     
    protected Runnable
     
    protected Runnable
     
    protected com.badlogic.gdx.scenes.scene2d.ui.Table
     
    protected boolean
     
    protected boolean
     
    protected boolean
     
    protected boolean
     
     
    protected com.badlogic.gdx.scenes.scene2d.InputListener
     
    protected float
     
    protected float
     
    protected GenericDialog
     
    protected boolean
     
     
    protected static float
     
    protected static float
     
    protected static float
     
    protected static float
     
    protected com.badlogic.gdx.utils.Array<OwnScrollPane>
     
    protected int
    Currently selected tab
    protected final com.badlogic.gdx.scenes.scene2d.ui.Skin
     
    protected final com.badlogic.gdx.scenes.scene2d.Stage
     
    protected com.badlogic.gdx.utils.Array<com.badlogic.gdx.scenes.scene2d.ui.Button>
    If this dialog has tabs, this list holds them.
    protected com.badlogic.gdx.utils.Array<com.badlogic.gdx.scenes.scene2d.Group>
    Actual actor for each tab.
    protected com.badlogic.gdx.scenes.scene2d.ui.Stack
    Tab contents stack.

    Fields inherited from class gaiasky.util.scene2d.CollapsibleWindow

    collapseSpeed

    Fields inherited from class gaiasky.util.scene2d.OwnWindow

    dragging, edge

    Fields inherited from class com.badlogic.gdx.scenes.scene2d.ui.Table

    backgroundBottom, backgroundLeft, backgroundRight, backgroundTop, debugActorColor, debugCellColor, debugTableColor
  • Constructor Summary

    Constructors
    Constructor
    Description
    GenericDialog(String title, com.badlogic.gdx.scenes.scene2d.ui.Skin skin, com.badlogic.gdx.scenes.scene2d.Stage stage)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected abstract boolean
    The accept function, if any.
    void
    act(float delta)
     
    void
    Adds a horizontal separator to the main content table with the default colspan of 1.
    void
    addSeparator(int colSpan)
    Adds a horizontal separator to the main content table with the given colspan.
    protected void
    addTabContent(com.badlogic.gdx.scenes.scene2d.Group tabContent)
    Add tab contents to the list of tabs.
    protected abstract void
    Build the content here.
    void
     
    protected abstract void
    The cancel function, if any.
    boolean
    Closes the window with the accept action.
    boolean
    Closes the window with the cancel action.
    abstract void
     
    protected void
    enableComponents(boolean enabled, com.badlogic.gdx.scenes.scene2d.utils.Disableable... components)
    Sets the enabled property on the given components.
    void
     
    com.badlogic.gdx.scenes.scene2d.Group
     
    com.badlogic.gdx.scenes.scene2d.ui.Table
     
    com.badlogic.gdx.scenes.scene2d.Group
     
    com.badlogic.gdx.scenes.scene2d.ui.Table
     
    com.badlogic.gdx.scenes.scene2d.Group
     
    com.badlogic.gdx.scenes.scene2d.Stage
     
    com.badlogic.gdx.utils.Array<com.badlogic.gdx.scenes.scene2d.ui.Button>
     
    boolean
     
    boolean
     
    boolean
     
    void
    Hides the dialog.
    void
    hide(com.badlogic.gdx.scenes.scene2d.Action action)
    Hides the dialog with the given action and then removes it from the stage.
    protected void
     
    void
    setAcceptButtonColor(com.badlogic.gdx.graphics.Color col)
     
    void
     
    void
    Sets a listener that runs when accept is clicked.
    void
    setAcceptText(String acceptText)
     
    void
    setCancelButtonColors(com.badlogic.gdx.graphics.Color textColor, com.badlogic.gdx.graphics.Color buttonColor)
     
    void
     
    void
    Sets a listener that runs when cancel is clicked.
    void
    setCancelText(String cancelText)
     
    void
    Sets a listener that runs when the dialog is closed.
    void
    Sets the keyboard focus, override in case you want to set the focus to a specific item.
    void
    setModal(boolean modal)
     
    protected void
    Prepares the tab button listeners that make tab buttons actually change the content.
    show(com.badlogic.gdx.scenes.scene2d.Stage stage)
    Packs the dialog and adds it to the stage, centered with default fadeIn action.
    show(com.badlogic.gdx.scenes.scene2d.Stage stage, float x, float y)
    Packs the dialog and adds it to the stage at the specified position.
    show(com.badlogic.gdx.scenes.scene2d.Stage stage, com.badlogic.gdx.scenes.scene2d.Action action)
    Packs the dialog and adds it to the stage with custom action which can be null for instant show.
    protected void
    showDialogHook(com.badlogic.gdx.scenes.scene2d.Stage stage)
     
    boolean
     
    boolean
     
    void
    Override this method to update the contents of this dialog before displaying it.
    static void
     

    Methods inherited from class com.badlogic.gdx.scenes.scene2d.ui.Table

    add, add, add, add, add, add, add, align, background, background, bottom, center, clearChildren, clip, clip, columnDefaults, debug, debug, debugActor, debugAll, debugCell, debugTable, defaults, drawDebug, drawDebugBounds, getAlign, getBackground, getCell, getCells, getClip, getColumnMinWidth, getColumnPrefWidth, getColumns, getColumnWidth, getMinHeight, getMinWidth, getPadBottom, getPadBottomValue, getPadLeft, getPadLeftValue, getPadRight, getPadRightValue, getPadTop, getPadTopValue, getPadX, getPadY, getRow, getRowHeight, getRowMinHeight, getRowPrefHeight, getRows, getSkin, getTableDebug, invalidate, layout, left, pad, pad, pad, pad, padBottom, padBottom, padLeft, padLeft, padRight, padRight, padTop, padTop, removeActor, removeActor, removeActorAt, reset, right, row, setBackground, setBackground, setClip, setDebug, setRound, setSkin, stack, top

    Methods inherited from class com.badlogic.gdx.scenes.scene2d.ui.WidgetGroup

    childrenChanged, invalidateHierarchy, needsLayout, setFillParent, setLayoutEnabled, sizeChanged, validate

    Methods inherited from class com.badlogic.gdx.scenes.scene2d.Group

    addActor, addActorAfter, addActorAt, addActorBefore, applyTransform, applyTransform, clear, clear, clearChildren, computeTransform, drawChildren, drawDebugChildren, findActor, getChild, getChildren, getCullingArea, hasChildren, isTransform, localToDescendantCoordinates, resetTransform, resetTransform, setCullingArea, setDebug, setStage, setTransform, swapActor, swapActor, toString

    Methods inherited from class com.badlogic.gdx.scenes.scene2d.Actor

    addAction, addCaptureListener, addListener, ancestorsVisible, ascendantsVisible, clearActions, clearListeners, clipBegin, clipBegin, clipEnd, fire, firstAscendant, getActions, getCaptureListeners, getColor, getDebug, getListeners, getName, getOriginX, getOriginY, getParent, getRight, getRotation, getScaleX, getScaleY, getTop, getTouchable, getUserObject, getX, getX, getY, getY, getZIndex, hasActions, hasKeyboardFocus, hasParent, hasScrollFocus, isAscendantOf, isDescendantOf, isTouchable, isTouchFocusListener, isTouchFocusTarget, isVisible, localToActorCoordinates, localToAscendantCoordinates, localToParentCoordinates, localToScreenCoordinates, localToStageCoordinates, moveBy, notify, parentToLocalCoordinates, positionChanged, remove, removeAction, removeCaptureListener, removeListener, rotateBy, rotationChanged, scaleBy, scaleBy, scaleChanged, screenToLocalCoordinates, setBounds, setColor, setColor, setHeight, setName, setOrigin, setOrigin, setOriginX, setOriginY, setParent, setPosition, setPosition, setRotation, setScale, setScale, setScaleX, setScaleY, setSize, setTouchable, setUserObject, setVisible, setWidth, setX, setX, setY, setY, setZIndex, sizeBy, sizeBy, stageToLocalCoordinates, toBack, toFront

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • pad34

      protected static float pad34
    • pad20

      protected static float pad20
    • pad18

      protected static float pad18
    • pad10

      protected static float pad10
    • stage

      protected final com.badlogic.gdx.scenes.scene2d.Stage stage
    • skin

      protected final com.badlogic.gdx.scenes.scene2d.ui.Skin skin
    • acceptButton

      public com.badlogic.gdx.scenes.scene2d.ui.TextButton acceptButton
    • cancelButton

      public com.badlogic.gdx.scenes.scene2d.ui.TextButton cancelButton
    • me

      protected GenericDialog me
    • content

      protected com.badlogic.gdx.scenes.scene2d.ui.Table content
    • bottom

      protected com.badlogic.gdx.scenes.scene2d.ui.Table bottom
    • defaultMouseKbdListener

      protected boolean defaultMouseKbdListener
    • defaultGamepadListener

      protected boolean defaultGamepadListener
    • lastPosX

      protected float lastPosX
    • lastPosY

      protected float lastPosY
    • buttonGroup

      protected com.badlogic.gdx.scenes.scene2d.ui.HorizontalGroup buttonGroup
    • enterExit

      protected boolean enterExit
    • escExit

      protected boolean escExit
    • acceptListener

      protected Runnable acceptListener
    • cancelListener

      protected Runnable cancelListener
    • closeListener

      protected Runnable closeListener
    • mouseKbdListener

      protected AbstractMouseKbdListener mouseKbdListener
    • gamepadListener

      protected AbstractGamepadListener gamepadListener
    • tabButtons

      protected com.badlogic.gdx.utils.Array<com.badlogic.gdx.scenes.scene2d.ui.Button> tabButtons
      If this dialog has tabs, this list holds them.
    • selectedTab

      protected int selectedTab
      Currently selected tab
    • tabContents

      protected com.badlogic.gdx.utils.Array<com.badlogic.gdx.scenes.scene2d.Group> tabContents
      Actual actor for each tab.
    • tabStack

      protected com.badlogic.gdx.scenes.scene2d.ui.Stack tabStack
      Tab contents stack.
    • ignoreTouchDown

      protected com.badlogic.gdx.scenes.scene2d.InputListener ignoreTouchDown
    • scrolls

      protected com.badlogic.gdx.utils.Array<OwnScrollPane> scrolls
    • backupMouseKbdListeners

      protected Set<AbstractMouseKbdListener> backupMouseKbdListeners
    • backupGamepadListeners

      protected Set<com.badlogic.gdx.controllers.ControllerListener> backupGamepadListeners
  • Constructor Details

    • GenericDialog

      public GenericDialog(String title, com.badlogic.gdx.scenes.scene2d.ui.Skin skin, com.badlogic.gdx.scenes.scene2d.Stage stage)
  • Method Details

    • updatePads

      public static void updatePads()
    • setAcceptText

      public void setAcceptText(String acceptText)
    • setAcceptButtonStyle

      public void setAcceptButtonStyle(String style)
    • setAcceptButtonColor

      public void setAcceptButtonColor(com.badlogic.gdx.graphics.Color col)
    • setCancelText

      public void setCancelText(String cancelText)
    • setCancelButtonStyle

      public void setCancelButtonStyle(String style)
    • setCancelButtonColors

      public void setCancelButtonColors(com.badlogic.gdx.graphics.Color textColor, com.badlogic.gdx.graphics.Color buttonColor)
    • addTabContent

      protected void addTabContent(com.badlogic.gdx.scenes.scene2d.Group tabContent)
      Add tab contents to the list of tabs.
      Parameters:
      tabContent - The contents.
    • setUpTabListeners

      protected void setUpTabListeners()
      Prepares the tab button listeners that make tab buttons actually change the content. It also sets up the button group, which restricts the number of tabs that can be checked at once to one.
    • setModal

      public void setModal(boolean modal)
      Overrides:
      setModal in class CollapsibleWindow
    • recalculateButtonSize

      protected void recalculateButtonSize()
    • buildSuper

      public void buildSuper()
    • build

      protected abstract void build()
      Build the content here.
    • closeAccept

      public boolean closeAccept()
      Closes the window with the accept action.
    • closeCancel

      public boolean closeCancel()
      Closes the window with the cancel action.
    • accept

      protected abstract boolean accept()
      The accept function, if any.
      Returns:
      True if the dialog must close after the call, false otherwise.
    • cancel

      protected abstract void cancel()
      The cancel function, if any.
    • show

      public GenericDialog show(com.badlogic.gdx.scenes.scene2d.Stage stage, com.badlogic.gdx.scenes.scene2d.Action action)
      Packs the dialog and adds it to the stage with custom action which can be null for instant show.
    • touch

      public void touch()
      Override this method to update the contents of this dialog before displaying it.
    • getCurrentContentContainer

      public com.badlogic.gdx.scenes.scene2d.Group getCurrentContentContainer()
    • getBottmGroup

      public com.badlogic.gdx.scenes.scene2d.Group getBottmGroup()
    • getButtonsGroup

      public com.badlogic.gdx.scenes.scene2d.Group getButtonsGroup()
    • show

      public GenericDialog show(com.badlogic.gdx.scenes.scene2d.Stage stage)
      Packs the dialog and adds it to the stage, centered with default fadeIn action.
    • showDialogHook

      protected void showDialogHook(com.badlogic.gdx.scenes.scene2d.Stage stage)
    • show

      public GenericDialog show(com.badlogic.gdx.scenes.scene2d.Stage stage, float x, float y)
      Packs the dialog and adds it to the stage at the specified position.
    • setKeyboardFocus

      public void setKeyboardFocus()
      Sets the keyboard focus, override in case you want to set the focus to a specific item.
    • hide

      public void hide(com.badlogic.gdx.scenes.scene2d.Action action)
      Hides the dialog with the given action and then removes it from the stage.
    • hide

      public void hide()
      Hides the dialog. Called automatically when a button is clicked. The default implementation fades out the dialog over 400 milliseconds and then removes it from the stage.
    • addSeparator

      public void addSeparator()
      Adds a horizontal separator to the main content table with the default colspan of 1.
    • addSeparator

      public void addSeparator(int colSpan)
      Adds a horizontal separator to the main content table with the given colspan.
      Parameters:
      colSpan - The column span to use.
    • setAcceptListener

      public void setAcceptListener(Runnable r)
      Sets a listener that runs when accept is clicked.
      Parameters:
      r - The listener.
    • hasAcceptRunnable

      public boolean hasAcceptRunnable()
    • setCancelListener

      public void setCancelListener(Runnable r)
      Sets a listener that runs when cancel is clicked.
      Parameters:
      r - The listener.
    • hasCancelRunnable

      public boolean hasCancelRunnable()
    • setCloseListener

      public void setCloseListener(Runnable r)
      Sets a listener that runs when the dialog is closed. It runs when either the accept or the cancel button is clicked.
      Parameters:
      r - The listener.
    • hasCloseRunnable

      public boolean hasCloseRunnable()
    • enableComponents

      protected void enableComponents(boolean enabled, com.badlogic.gdx.scenes.scene2d.utils.Disableable... components)
      Sets the enabled property on the given components.
      Parameters:
      enabled - The state to set.
      components - The components to enable or disable.
    • tabRight

      public boolean tabRight()
    • tabLeft

      public boolean tabLeft()
    • focusFirstInputWidget

      public void focusFirstInputWidget()
    • getContent

      public com.badlogic.gdx.scenes.scene2d.ui.Table getContent()
    • getBottom

      public com.badlogic.gdx.scenes.scene2d.ui.Table getBottom()
    • getTabButtons

      public com.badlogic.gdx.utils.Array<com.badlogic.gdx.scenes.scene2d.ui.Button> getTabButtons()
    • dispose

      public abstract void dispose()
    • act

      public void act(float delta)
      Overrides:
      act in class CollapsibleWindow
    • getStage

      public com.badlogic.gdx.scenes.scene2d.Stage getStage()
      Overrides:
      getStage in class com.badlogic.gdx.scenes.scene2d.Actor