Class ItemSelectionPanel<I,P extends JComponent>

java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
com.inductiveautomation.ignition.client.util.gui.ItemSelectionPanel<I,P>
Type Parameters:
I - Type representing the items that are selectable
P - UI Panel type for editing the items
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible

public class ItemSelectionPanel<I,P extends JComponent> extends JPanel

This is a specialized panel that essentially acts like a tabbed pane whose tabs are always on the left hand side. It is built for user interfaces where the user picks one thing to configure/edit at a time.

To use the item selection panel, there is an order to the setup process.

  1. Instantiate one
  2. If you want a header above the items, call addItemHeader(JComponent)
  3. Add all the items using addItem(Object)
  4. If you want a footer below the items, call addItemFooter(JComponent)
  5. Provide a way for the item selection panel to create new panels for each selected item using setPanelMaker(Function, boolean)
See Also:
  • Field Details

    • left

      protected final JPanel left
    • selected

      protected I selected
  • Constructor Details

    • ItemSelectionPanel

      public ItemSelectionPanel()
  • Method Details

    • getSelectedPanel

      @Nullable public P getSelectedPanel()
    • setSelectedItem

      public void setSelectedItem(I newItem)
    • getSelectedItem

      public I getSelectedItem()
    • addItemHeader

      public void addItemHeader(JComponent header)
    • addItem

      public void addItem(I item)
    • addItemFooter

      public void addItemFooter(JComponent footer)
    • setPanelMaker

      public void setPanelMaker(Function<I,P> panelMaker, boolean cache)
      Provide a way to create the panels that will be displayed for each selected item.
      Parameters:
      cache - if true, panels created will be cached in case the selection changes away and then back to the same item
    • createHolderPanel

      protected HolderPanel<P> createHolderPanel()
      Override this if you want to customize the holder panel that holds the panels P
    • configureItemLabel

      protected void configureItemLabel(I item, JLabel label)
      Override this to configure the item labels if you need more than just the toString() of the items.