Class SequenceCardPanel

    • Field Detail

      • STATE_PROPERTY

        public static final java.lang.String STATE_PROPERTY
        The bound property of the sequence state.
      • TRANSITION_ENABLED_PROPERTY

        public static final java.lang.String TRANSITION_ENABLED_PROPERTY
        The bound property of whether the transitions are enabled.
    • Constructor Detail

      • SequenceCardPanel

        public SequenceCardPanel()
        Default constructor.
      • SequenceCardPanel

        protected SequenceCardPanel​(CardLayout layout)
        Layout constructor.
        Parameters:
        layout - The layout definition for the container.
        Throws:
        java.lang.NullPointerException - if the given layout is null.
    • Method Detail

      • getState

        public com.globalmentor.model.TaskState getState()
        Returns:
        The current state of the sequence, or null if the sequence is not occurring.
      • setState

        protected void setState​(com.globalmentor.model.TaskState newState)
        Sets the current state of the sequence. This is a bound property.
        Parameters:
        newState - The current state of the sequence, or null if the sequence is not occurring.
        See Also:
        STATE_PROPERTY
      • getTransition

        public SequenceTransition getTransition()
        Returns:
        The current transition in the sequence, or null if no transition is occurring.
      • isTransitionEnabled

        public boolean isTransitionEnabled()
        Returns:
        Whether transitions are enabled, so that changing selected cards will cause the appropriate validate/commit functionality.
      • setTransitionEnabled

        public void setTransitionEnabled​(boolean newTransitionEnabled)
        Sets whether transitions are enabled, so that changing selected cards will cause the appropriate validate/commit functionality. This is a bound property of type Boolean.
        Parameters:
        newTransitionEnabled - true if transitions are enabled, so that changing selected cards will cause the appropriate validate/commit functionality.
        See Also:
        TRANSITION_ENABLED_PROPERTY
      • getPreviousActionPrototype

        public ActionPrototype getPreviousActionPrototype()
        Returns:
        The prototype for the previous action.
      • getNextActionPrototype

        public ActionPrototype getNextActionPrototype()
        Returns:
        The prototype for the next action.
      • getFinishActionPrototype

        public ActionPrototype getFinishActionPrototype()
        Returns:
        The prototype for the action to finish the sequence.
      • getCancelActionPrototype

        public ActionPrototype getCancelActionPrototype()
        Returns:
        The prototype for the action to cancel the sequence.
      • addComponent

        protected void addComponent​(int index,
                                    Component childComponent)
        Adds a child component at the specified index. This version adds the component to the component list. Any class that overrides this method must call this version.

        This version installs a listener for the component's displayed status.

        Overrides:
        addComponent in class AbstractLayoutComponent
        Parameters:
        index - The index at which the component should be added.
        childComponent - The component to add to this component.
      • removeComponent

        protected void removeComponent​(Component childComponent)
        Removes a child component. This version removes the component from the component set. Any class that overrides this method must call this version.

        This version removes the component from the component list.

        This version uninstalls a listener for the component's displayed status.

        Overrides:
        removeComponent in class AbstractLayoutComponent
        Parameters:
        childComponent - The component to remove from this component.
      • childComponentValidPropertyChanged

        protected void childComponentValidPropertyChanged​(Component childComponent,
                                                          boolean oldValid,
                                                          boolean newValid)
        Called when the Component.VALID_PROPERTY of a child component changes. Every child version should call this version. This version updates the composite component's valid state by calling AbstractComponent.updateValid().

        This version updates the error status of the child component's constraints if those constraints implement TaskCardConstraints.

        Overrides:
        childComponentValidPropertyChanged in class AbstractCompositeComponent
        Parameters:
        childComponent - The child component the valid property of which changed.
        oldValid - The old valid property.
        newValid - The new valid property.
      • hasPrevious

        public boolean hasPrevious()
        Determines if there is a previous step in the sequence. This version returns true if there is a selected card and there exists a card before the selected card.
        Returns:
        true if there is a previous step in the sequence.
      • getPrevious

        public Component getPrevious()
        Determines the previous component in the sequence. Components that are not displayed or not enabled based upon their associated constraints are skipped.
        Returns:
        The previous component in the sequence, or null if there is no previous component in the sequence.
      • getPrevious

        protected Component getPrevious​(Component component)
        Determines the previous component in the sequence relative to the given component. Components that are not displayed or not enabled based upon their associated constraints are skipped.
        Parameters:
        component - The component the previous component to which should be found.
        Returns:
        The previous component in the sequence, or null if there is no previous component in the sequence.
        Throws:
        java.lang.NullPointerException - if the given component is null.
      • hasNext

        public boolean hasNext()
        Determines if there is a next step in the sequence. This version returns true if there is a selected card and there exists a card after the selected card.
        Returns:
        true if there is a next step in the sequence.
      • getNext

        public Component getNext()
        Determines the next component in the sequence. Components that are not displayed or not enabled based upon their associated constraints are skipped.
        Returns:
        The next component in the sequence, or null if there is no next component in the sequence.
      • goPrevious

        public void goPrevious()
        Goes to the previous step in the sequence. If there is no previous step, no action occurs. This method calls hasPrevious().
      • goNext

        public void goNext()
        Advances to the next step in the sequence. If the current card passes validation, the next card is enabled before advancing. If there is no next step, no action occurs. This method calls getNext().
      • goFinish

        public void goFinish()
        Finishes the sequence. This method validates and commits the current card, and then calls finish(). If no card is selected, no action occurs. The state is set to TaskState.COMPLETE.
      • goCancel

        public void goCancel()
        Cancels the sequence. This method calls cancel(). The state is set to TaskState.CANCELED.
      • resetSequence

        public void resetSequence()
        Resets the sequence by navigating to the first card and disabling all subsequent cards. The state is set to TaskState.INCOMPLETE.
      • commit

        public void commit()
                    throws java.io.IOException
        Commits the data. This version commits the selected card if there is a selected card and it implements Commitable. Subclass versions should call this version.
        Specified by:
        commit in interface Commitable
        Throws:
        java.io.IOException - if there is an error committing data.
      • finish

        public void finish()
        Finishes the sequence. This version does nothing.
      • cancel

        public void cancel()
        Cancels the sequence. This version does nothing.
      • getComponent

        protected Component getComponent​(Bookmark bookmark)
        Determines the component for navigation based upon the given bookmark. A bookmark parameter with a value of the empty string is considered to indicate the null value. Child components may override this method to select a different bookmark based upon whether components are enabled, for example.

        This version finds the first previous enabled and displayed card, searching backwards from the requested card, if the requested card is not enabled and displayed. This version chooses the first card if no card is requested.

        Overrides:
        getComponent in class AbstractCardPanel
        Parameters:
        bookmark - The bookmark for which a component should be returned, or null if no bookmark is available.
        Returns:
        The child component indicated by the given bookmark parameter value, or null if the given bookmark represents the null component value.