java.lang.Object
com.jbstrap.core.messagebus.MessageBus
com.jbstrap.ui.Component<SelectorWindow>
com.jbstrap.ui.components.form.items.selectoritem.SelectorWindow
Direct Known Subclasses:
DefaultValueSelector

public abstract class SelectorWindow extends Component<SelectorWindow>

The ancestor class of the selector windows, that are used by the selector item. Every selector window, that is to be used through a selector item, must extend from this class.

The selector item creates the window automatically, with the use of the constructor implemented in the class, it does not need to be overwritten. The rendering (component building, initializing) must be done through the rendering() method. The method will be called by the selector item.

When the window is displayed, the selector item will call t he showSelector() method, the operations that need to be executed upon display must be implemented here. These are the data query operations, setting the window back to the default state, etc.

When the window is closed, the selector item will call the closeSelector() method.

The class also contains two methods, which can be used during the implementation of the window operation. These are the following: The getParentSelectorItem(), which returns the selector item instance, from which the window was opened from. The selectElement(Object) method allows the passing of the values selected by the user, as a chosen value, to the selector item.

Since:
4.0
Author:
JBStrap
  • Constructor Details

    • SelectorWindow

      public SelectorWindow(SelectorItem parent, String language)
      Parameters:
      parent - The selector item instance, that will have this selector window assigned to.
      language - The language code, that the form item will use.The value is the same as the selector item's language code
      Throws:
      NullPointerException - If the selector item is null
  • Method Details

    • rendering

      public abstract void rendering()

      The window rendering must be implemented here. The components must be built here, and they have to be assigned to each other. These will make up the window.

      This is called once by the selector item, when the window is being rendered.

    • showSelector

      public abstract void showSelector()

      The window opening event

      The selector item calls this method, when the user wants to open the selector window. The window opening, data query and every other related operations must be implemented here.

    • closeSelector

      public abstract void closeSelector()

      The window close event

      The selector item calls this method, when the user wants to close the selector window. Relevant operations, such as removing/hiding components must be implemented here.

    • selectElement

      public final void selectElement(Object selectedElement)
      Selects an element
      Parameters:
      selectedElement - The selected element. Could be a record from the selector item DataDescriptor, selected by the user, or could be a data value for the selector item. If a record is passed, that will be used as a basis when setting the selector item. If a data value is passed, the selector item will try to query it from the database. If it finds a record that is corresponding to the specified object, that will be used as a basis for setting the selector item.
    • getParentSelectorItem

      public final SelectorItem getParentSelectorItem()
      Gets the parent selector item instance.
      Returns:
      The parent selector item instance, that is connected to the selector window.