Package 

Class DataButtonGroup

  • All Implemented Interfaces:

    
    public abstract class DataButtonGroup
    
                        

    If possible, use GuiBase.addButtonGroup rather than using this class directly!

    This class provides an inheritance-based option to create your buttons, whereas addButtonGroup instead allows you to pass actions for creating/refreshing buttons and the action to execute.

    base class defining a group of buttons with each button representing a possible date and the whole group representing a data set defined by the sum of data of all active buttons.

    In other words, this represents a row (or column) of buttons. All buttons in that row perform the same action when clicked. When a button is clicked, that action is performed with the data of all active buttons.

    buttons get activated/deactivated by the user by clicking on them when a button is clicked, executeAction gets called with the sum of data of all active buttons

    If, for instance, we have two buttons with corresponding data 1 and respectively, and the user activates the first button, [1] will be passed as data to the groupAction and 1 as triggeringButtonData. If the user then clicks the second button [1, 2], will be passed as data and 2 as triggeringButtonData.

    Extend this class by implementing createButtons, refresh and executeAction

    • Constructor Detail

      • DataButtonGroup

        DataButtonGroup(LazyFont font, String descriptionText, ButtonGroupLayout layout)
        Parameters:
        font - LazyFont object
        descriptionText - text to be rendered above the group
        layout - defines where/how the group gets rendered
    • Method Detail

      • setDescriptionText

         final Unit setDescriptionText(String descriptionText)
        Parameters:
        descriptionText - text to be rendered above the group
      • resetGrid

         final Unit resetGrid()

        reset grid positions back to original values call this method if you want to e.g. change something and recreate buttons

      • disableButton

         final Unit disableButton(String title)

        disable (i.e. grey out and make un-clickable) button with given title/text/name

      • refreshAllButtons

         final Unit refreshAllButtons(List<Object> data)

        refresh state (active/inactive) of all buttons

        Parameters:
        data - all buttons where button data is contained in this list will be set to active
      • advance

         final Boolean advance()

        needs to be called every frame. checks if a button was clicked/hovered over during that frame

      • render

         final Unit render()

        needs to be called every frame from a render-method, such as e.g. BaseEveryFrameCombatPlugin::renderInUICoords

      • createButtons

         abstract Unit createButtons()

        Override me! gets called on construction. Create all buttons belonging to this group in the implementation of this method. cf. CreateSimpleButtons for an example implementation.

      • refresh

         abstract Unit refresh()

        Override me! gets called whenever a button of any group gets pressed (or something calls for a re-render) If you e.g. want to enable/disable buttons or change tooltips based on the current state, implement that logic in this method. Otherwise, an empty method will do.

      • executeAction

         abstract Unit executeAction(List<Object> data, Object triggeringButtonData, Object deselectedButtonData)

        Override me! gets called whenever a button in this group gets clicked. Implement the actual logic you want your button group to perform in here.

        Parameters:
        data - a list of the data of all currently active buttons
        triggeringButtonData - data of the button that was clicked if it was turned active.
        deselectedButtonData - data of the button that was clicked if it was turned inactive.
      • onHover

         Unit onHover()

        Override this method to perform some action when the user hovers over a button in the group.