Interface Component

    • Field Detail

      • BOOKMARK_ENABLED_PROPERTY

        static final java.lang.String BOOKMARK_ENABLED_PROPERTY
        The bound property of whether the component has bookmarks enabled.
      • CONSTRAINTS_PROPERTY

        static final java.lang.String CONSTRAINTS_PROPERTY
        The bound property of the layout constraints.
      • DRAG_ENABLED_PROPERTY

        static final java.lang.String DRAG_ENABLED_PROPERTY
        The bound property of whether the component has dragging enabled.
      • DROP_ENABLED_PROPERTY

        static final java.lang.String DROP_ENABLED_PROPERTY
        The bound property of whether the component has dropping enabled.
      • FLYOVER_ENABLED_PROPERTY

        static final java.lang.String FLYOVER_ENABLED_PROPERTY
        The bound property of whether the component has flyovers enabled.
      • FLYOVER_STRATEGY_PROPERTY

        static final java.lang.String FLYOVER_STRATEGY_PROPERTY
        The bound property of the strategy controlling flyovers.
      • INPUT_STRATEGY_PROPERTY

        static final java.lang.String INPUT_STRATEGY_PROPERTY
        The input strategy bound property.
      • NAME_PROPERTY

        static final java.lang.String NAME_PROPERTY
        The bound property of the component name.
      • NOTIFICATION_PROPERTY

        static final java.lang.String NOTIFICATION_PROPERTY
        The bound property of the notification.
      • ORIENTATION_PROPERTY

        static final java.lang.String ORIENTATION_PROPERTY
        The orientation bound property.
      • THEME_APPLIED_PROPERTY

        static final java.lang.String THEME_APPLIED_PROPERTY
        The bound property of whether a theme has been applied to this object.
      • VALID_PROPERTY

        static final java.lang.String VALID_PROPERTY
        The valid bound property.
    • Method Detail

      • addPreferenceProperty

        void addPreferenceProperty​(java.lang.String propertyName)
        Adds a property to be saved and loaded as a preference.
        Parameters:
        propertyName - The property to store as a preference.
        See Also:
        loadPreferences(boolean), savePreferences(boolean)
      • isPreferenceProperty

        boolean isPreferenceProperty​(java.lang.String propertyName)
        Determines whether the given property is saved and loaded as a preference.
        Parameters:
        propertyName - The property to determine if it is stored as a preference.
        Returns:
        true if the given property is saved and loaded as a preference.
        See Also:
        loadPreferences(boolean), savePreferences(boolean)
      • getPreferenceProperties

        java.lang.Iterable<java.lang.String> getPreferenceProperties()
        Returns all properties stored as preferences.
        Returns:
        An iterable of all properties saved and loaded as preferences.
        See Also:
        loadPreferences(boolean), savePreferences(boolean)
      • removePreferenceProperty

        void removePreferenceProperty​(java.lang.String propertyName)
        Removes a property from being saved and loaded as preferences.
        Parameters:
        propertyName - The property that should no longer be stored as a preference.
        See Also:
        loadPreferences(boolean), savePreferences(boolean)
      • getName

        java.lang.String getName()
        Returns:
        The name of the component, not guaranteed to be unique (but guaranteed not to be the empty string) and useful only for searching for components within a component sub-hierarchy, or null if the component has no name.
      • setName

        void setName​(java.lang.String newName)
        Sets the name of the component. This is a bound property.
        Parameters:
        newName - The new name of the component, or null if the component should have no name.
        Throws:
        java.lang.IllegalArgumentException - if the given name is the empty string.
        See Also:
        NAME_PROPERTY
      • getConstraints

        Constraints getConstraints()
        Returns:
        The layout constraints describing individual component layout information, or null if no constraints have been specified for this component.
      • setConstraints

        void setConstraints​(Constraints newConstraints)
        Sets the layout constraints of this component. This is a bound property.
        Parameters:
        newConstraints - The layout constraints describing individual component layout information, or null if no constraints have been specified for this component.
        See Also:
        CONSTRAINTS_PROPERTY
      • getInputStrategy

        InputStrategy getInputStrategy()
        Returns:
        The strategy for processing input, or null if this component has no input strategy.
      • setInputStrategy

        void setInputStrategy​(InputStrategy newInputStrategy)
        Sets the strategy for processing input. This is a bound property.
        Parameters:
        newInputStrategy - The new strategy for processing input, or null if this component is to have no input strategy.
        See Also:
        INPUT_STRATEGY_PROPERTY
      • getNotification

        Notification getNotification()
        Returns:
        The notification associated with the component, or null if no notification is associated with this component.
      • setNotification

        void setNotification​(Notification newNotification)
        Sets the component notification. This is a bound property. The notification is also fired as a NotificationEvent on this component if a new notification is given. Parents are expected to refire the notification event up the hierarchy.
        Parameters:
        newNotification - The notification for the component, or null if no notification is associated with this component.
        See Also:
        NOTIFICATION_PROPERTY
      • getOrientation

        Orientation getOrientation()
        Returns this component's requested orientation. To resolve the orientation up the hierarchy, getComponentOrientation() should be used.
        Returns:
        The internationalization orientation of the component's contents, or null if the default orientation should be used.
        See Also:
        getComponentOrientation()
      • getComponentOrientation

        Orientation getComponentOrientation()
        Determines the internationalization orientation of the component's contents. This method returns the local orientation value, if there is one. If there is no orientation specified for this component, the request is deferred to this component's parent. If there is no parent component, a default orientation is retrieved from the current session.
        Returns:
        The internationalization orientation of the component's contents.
        See Also:
        getOrientation(), GuiseSession.getOrientation()
      • setOrientation

        void setOrientation​(Orientation newOrientation)
        Sets the orientation. This is a bound property
        Parameters:
        newOrientation - The new internationalization orientation of the component's contents, or null if default orientation should be determined based upon the session's locale.
        See Also:
        ORIENTATION_PROPERTY
      • getParent

        CompositeComponent getParent()
        Returns:
        The parent of this component, or null if this component does not have a parent.
      • getAncestor

        <A extends CompositeComponent> A getAncestor​(java.lang.Class<A> ancestorClass)
        Retrieves the first ancestor of the given type.
        Type Parameters:
        A - The type of ancestor component requested.
        Parameters:
        ancestorClass - The class of ancestor component requested.
        Returns:
        The first ancestor component of the given type, or null if this component has no such ancestor.
      • setParent

        void setParent​(CompositeComponent newParent)
        Sets the parent of this component. This method is managed by containers, and normally should not be called by applications. A component cannot be given a parent if it already has a parent. A component's parent cannot be removed if that parent is a container and this component is still a child of that container. A container's parent cannot be set to a container unless that container already recognizes this component as one of its children. If a component is given the same parent it already has, no action occurs.
        Parameters:
        newParent - The new parent for this component, or null if this component is being removed from a parent.
        Throws:
        java.lang.IllegalStateException - if a parent is provided and this component already has a parent.
        java.lang.IllegalStateException - if no parent is provided and this component's old parent is a container that still recognizes this component as its child.
        java.lang.IllegalArgumentException - if a parent container is provided and the given parent container does not already recognize this component as its child.
        See Also:
        Container.add(Component), Container.remove(Object)
      • isDragEnabled

        boolean isDragEnabled()
        Returns:
        Whether the component has dragging enabled.
      • setDragEnabled

        void setDragEnabled​(boolean newDragEnabled)
        Sets whether the component has dragging enabled. This is a bound property of type Boolean.
        Parameters:
        newDragEnabled - true if the component should allow dragging, else false.
        See Also:
        DRAG_ENABLED_PROPERTY
      • isDropEnabled

        boolean isDropEnabled()
        Returns:
        Whether the component has dropping enabled.
      • setDropEnabled

        void setDropEnabled​(boolean newDropEnabled)
        Sets whether the component has dropping enabled. This is a bound property of type Boolean.
        Parameters:
        newDropEnabled - true if the component should allow dropping, else false.
        See Also:
        DROP_ENABLED_PROPERTY
      • isFlyoverEnabled

        boolean isFlyoverEnabled()
        Returns:
        Whether flyovers are enabled for this component.
      • setFlyoverEnabled

        void setFlyoverEnabled​(boolean newFlyoverEnabled)
        Sets whether flyovers are enabled for this component. Flyovers contain information from the component model's "description" property. This is a bound property of type Boolean.
        Parameters:
        newFlyoverEnabled - true if the component should display flyovers, else false.
        See Also:
        InfoModel.getDescription(), FLYOVER_ENABLED_PROPERTY
      • getFlyoverStrategy

        Component.FlyoverStrategy<?> getFlyoverStrategy()
        Returns:
        The installed flyover strategy, or null if there is no flyover strategy installed.
      • setFlyoverStrategy

        void setFlyoverStrategy​(Component.FlyoverStrategy<?> newFlyoverStrategy)
        Sets the strategy for controlling flyovers. The flyover strategy will be registered as a mouse listener for this component. This is a bound property.
        Parameters:
        newFlyoverStrategy - The new flyover strategy, or null if there is no flyover strategy installed.
        See Also:
        FLYOVER_STRATEGY_PROPERTY
      • isThemeApplied

        boolean isThemeApplied()
        Returns:
        Whether a theme has been applied to this component.
      • setThemeApplied

        void setThemeApplied​(boolean newThemeApplied)
        Sets whether a theme has been applied to this component. This is a bound property of type Boolean.
        Parameters:
        newThemeApplied - true if a theme has been applied to this component, else false.
        See Also:
        THEME_APPLIED_PROPERTY
      • addExportStrategy

        void addExportStrategy​(ExportStrategy<?> exportStrategy)
        Adds an export strategy to the component. The export strategy will take precedence over any compatible export strategy previously added.
        Parameters:
        exportStrategy - The export strategy to add.
      • removeExportStrategy

        void removeExportStrategy​(ExportStrategy<?> exportStrategy)
        Removes an export strategy from the component.
        Parameters:
        exportStrategy - The export strategy to remove.
      • exportTransfer

        Transferable<?> exportTransfer()
        Exports data from the component. Each export strategy, from last to first added, will be asked to export data, until one is successful.
        Specified by:
        exportTransfer in interface DepictedObject
        Returns:
        The object to be transferred, or null if no data can be transferred.
      • addImportStrategy

        void addImportStrategy​(ImportStrategy<?> importStrategy)
        Adds an import strategy to the component. The import strategy will take precedence over any compatible import strategy previously added.
        Parameters:
        importStrategy - The import strategy to add.
      • removeImportStrategy

        void removeImportStrategy​(ImportStrategy<?> importStrategy)
        Removes an import strategy from the component.
        Parameters:
        importStrategy - The import strategy to remove.
      • importTransfer

        boolean importTransfer​(Transferable<?> transferable)
        Imports data to the component. Each import strategy, from last to first added, will be asked to import data, until one is successful.
        Parameters:
        transferable - The object to be transferred.
        Returns:
        true if the given object was be imported.
      • initialize

        void initialize()
        Initializes the component after construction. This method can only be called once during the life of a component. Subclasses should call this version.
        Throws:
        java.lang.IllegalStateException - if this method has already been called.
      • isValid

        boolean isValid()
        Returns:
        Whether the state of the component and all child components represents valid user input.
      • validate

        boolean validate()
        Validates the user input of this component and all child components. The component will be updated with error information.
        Returns:
        The current state of isValid() as a convenience.
      • getTheme

        Theme getTheme()
                throws java.io.IOException
        Returns the theme to apply to this component. If there is no theme to this component, the parent theme will be returned.
        Returns:
        The theme to apply to this component.
        Throws:
        java.io.IOException - if there is an error loading the theme.
      • resetTheme

        void resetTheme()
        Resets this object's theme. This method sets to false the state of whether a theme has been applied to this object. This method is called for any child components resetting its own theme. No new theme is actually loaded. There is normally no need to override this method or to call this method directly by applications.
        See Also:
        setThemeApplied(boolean)
      • updateTheme

        void updateTheme()
                  throws java.io.IOException
        Updates this object's theme. This method checks whether a theme has been applied to this object. If a theme has not been applied to this object this method calls applyTheme(). This method is called for any child components before applying the theme to the component itself, to assure that child theme updates have already occurred before theme updates occur for this component. There is normally no need to override this method or to call this method directly by applications.
        Throws:
        java.io.IOException - if there was an error loading or applying a theme.
        See Also:
        isThemeApplied(), applyTheme()
      • applyTheme

        void applyTheme()
                 throws java.io.IOException
        Applies the theme to this object. Themes are only applied of the application is themed. This method may be overridden to effectively override theme settings by ensuring the state of important properties after the theme has been set. If the theme is successfully applied, this method updates the theme applied status.
        Throws:
        java.io.IOException - if there was an error loading or applying a theme.
        See Also:
        GuiseApplication.isThemed(), getTheme(), applyTheme(Theme), setThemeApplied(boolean)
      • applyTheme

        void applyTheme​(Theme theme)
        Applies a theme and its parents to this object. The theme's rules will be applied to this object and any related objects. Theme application occurs unconditionally, regardless of whether themes have been applied to this component before. There is normally no need to call this method directly by applications.
        Parameters:
        theme - The theme to apply to the object.
      • loadPreferences

        void loadPreferences​(boolean includeDescendants)
                      throws java.io.IOException
        Loads the preferences for this component and optionally any descendant components. Any preferences returned from getPreferenceProperties() will be loaded automatically.
        Parameters:
        includeDescendants - true if preferences of any descendant components should also be loaded, else false.
        Throws:
        java.io.IOException - if there is an error loading preferences.
      • savePreferences

        void savePreferences​(boolean includeDescendants)
                      throws java.io.IOException
        Saves the preferences for this component and optionally any descendant components. Any preferences returned from getPreferenceProperties() will be saved automatically.
        Parameters:
        includeDescendants - true if preferences of any descendant components should also be saved, else false.
        Throws:
        java.io.IOException - if there is an error saving preferences.
      • dispatchInputEvent

        void dispatchInputEvent​(InputEvent inputEvent)
        Dispatches an input event to this component and all child components, if any. If this is a FocusedInputEvent, the event will be directed towards the branch in which lies the focused component of any InputFocusGroupComponent ancestor of this component (or this component, if it is a focus group). If this is instead a TargetedEvent, the event will be directed towards the branch in which lies the target component of the event. Otherwise, the event will be dispatched to all child components. Only after the event has been dispatched to any children will the event be fired to any event listeners and then passed to the installed input strategy, if any. Once the event is consumed, no further processing takes place.
        Parameters:
        inputEvent - The input event to dispatch.
        Throws:
        java.lang.NullPointerException - if the given event is null.
        See Also:
        TargetedEvent, FocusedInputEvent, InputEvent.isConsumed(), fireInputEvent(InputEvent), getInputStrategy(), InputStrategy.input(Input)
      • fireInputEvent

        void fireInputEvent​(InputEvent inputEvent)
        Fire the given even to all registered listeners, if any. If the event is consumed further processing should cease.
        Parameters:
        inputEvent - The input event to fire.
        Throws:
        java.lang.NullPointerException - if the given event is null.
        See Also:
        InputEvent.isConsumed()
      • addCommandListener

        void addCommandListener​(CommandListener commandListener)
        Adds a command listener.
        Parameters:
        commandListener - The command listener to add.
      • removeCommandListener

        void removeCommandListener​(CommandListener commandListener)
        Removes a command listener.
        Parameters:
        commandListener - The command listener to remove.
      • hasCommandListeners

        boolean hasCommandListeners()
        Returns:
        true if there is one or more command listeners registered.
      • addKeyListener

        void addKeyListener​(KeyboardListener keyListener)
        Adds a key listener.
        Parameters:
        keyListener - The key listener to add.
      • removeKeyListener

        void removeKeyListener​(KeyboardListener keyListener)
        Removes a key listener.
        Parameters:
        keyListener - The key listener to remove.
      • hasKeyListeners

        boolean hasKeyListeners()
        Returns:
        true if there is one or more key listeners registered.
      • addMouseListener

        void addMouseListener​(MouseListener mouseListener)
        Adds a mouse listener.
        Parameters:
        mouseListener - The mouse listener to add.
      • removeMouseListener

        void removeMouseListener​(MouseListener mouseListener)
        Removes a mouse listener.
        Parameters:
        mouseListener - The mouse listener to remove.
      • hasMouseListeners

        boolean hasMouseListeners()
        Returns:
        true if there is one or more mouse listeners registered.
      • addNotificationListener

        void addNotificationListener​(NotificationListener notificationListener)
        Adds a notification listener.
        Parameters:
        notificationListener - The notification listener to add.
      • removeNotificationListener

        void removeNotificationListener​(NotificationListener notificationListener)
        Removes a notification listener.
        Parameters:
        notificationListener - The notification listener to remove.