Class DefaultGUIRegistry

  • All Implemented Interfaces:

    public class DefaultGUIRegistry
    extends Object
    implements GUIRegistry
    A default implementation of a GUI registry.
    Jerry Vos, Eric Tatara
    • Constructor Detail

      • DefaultGUIRegistry

        public DefaultGUIRegistry()
        Constructs the GUI Registry.
    • Method Detail

      • addComponent

        public void addComponent​(JComponent component,
                                 GUIRegistryType type,
                                 String name)
        Adds a component with the given type and name. The type is not meant to be "JPanel" or "JTable," but to be along the lines of "Graph" or "Display." The name can be null.
        Specified by:
        addComponent in interface GUIRegistry
        component - the component to add
        type - the type of the component
        name - the name of the component (can be null)
      • removeComponent

        public boolean removeComponent​(JComponent component)
        Removes a component from the registry.
        Specified by:
        removeComponent in interface GUIRegistry
        component - the component to remove
        true if something was removed (false if this didn't contain the component
      • getName

        public String getName​(JComponent component)
        Retrieves the name of a given component. This may return null if the name was null or if the component does not exist in the registry.
        Specified by:
        getName in interface GUIRegistry
        component - the component who's name to retrieve
        the specified component's name
      • addDisplay

        public void addDisplay​(String name,
                               GUIRegistryType type,
                               IDisplay display)
        Adds an IDisplay to this GUIRegistry. If the display is added, there is NO need to add the component associated with the IDisplay as well.
        Specified by:
        addDisplay in interface GUIRegistry
        display - the renderer to add
      • getDisplays

        public List<IDisplay> getDisplays()
        Gets the list of IDisplay-s registered with this GUIRegistry.
        Specified by:
        getDisplays in interface GUIRegistry
        the list of IDisplays-s registered with this GUIRegistry.
      • getDisplayForComponent

        public IDisplay getDisplayForComponent​(JComponent comp)
        Gets the IDisplay associated with the specified component.
        Specified by:
        getDisplayForComponent in interface GUIRegistry
        comp - the component whose IDisplay we want to get
        the IDisplay associated with the specified component.
      • getDisplayForName

        public IDisplay getDisplayForName​(String displayName)
        Get the IDisplay associated with the specified display name;
        Specified by:
        getDisplayForName in interface GUIRegistry
        displayName - the display name
        the IDisplay with the provided name