Method and component for navigating a hierarchical user interface representation6791587Abstract A navigation manager component cooperable with a user interface renderer is described. The navigation manager manages one or more navigation units and maintains a navigation unit cursor. Each navigation unit is associated with another navigation unit managed by the same navigation manager. The navigation manager provides a range of navigation services, which operate upon the navigation unit cursor. These services include a service to navigate forwards and a service to navigate backwards. These services take into account the associations between navigation units in order to determine the correct sequence of navigation units for forwards and backwards navigation. The services also determine whether the items represented by each navigation unit include eligible items or items for which data entry is incomplete. In this way, navigation units for which all the items represented by the navigation unit are ineligible can be passed over by the navigation services, to that they never become current. Claims What is claimed is: Description FIELD OF INVENTION
Item aspect Tests
SELECTED If the referenced item supports
selection, check that its selection
state is as defined in the UI
representation.
VALID If the referenced item supports
validity checking, check that its
valid state is as defined in the UI
representation.
ENABLED If the referenced item supports
enabling, check that its enabled
state is as defined in the UI
representation.
SHOWN If the referenced item supports
showing, i.e. that it may either be
visible or invisible, check that
its shown state is as defined in
the UI representation.
VALUE If a comparative value is supplied
in the UI representation, testing
proceeds according to the value
type for the referenced item. The
set of definitions for the UI
representation defines several
comparative test conditions for the
various defined data types. The
referenced item value is compared
to the item value according to the
defined test.
In addition, if the item is contained within another item, the container's eligibility is tested recursively. void addPresentationListener(PresentationListener listener); void removePresentationListener(PresentationListener listener); These methods allow listeners to be added to and removed from objects which implement this interface. Whenever eligibility or completeness of the item may have changed, due to user input or other actions, the listener is notified. By adding a suitable listener to each of the objects, the NavigationManager, in particular, is thus able to respond appropriately to those changes. CompletableItem The set of definitions allows for data items to be defined such that they should notify completeness. This interface extends PresentableItem and is implemented by all the objects which represent such data items. CompletableItem ensures the provision of the following methods: boolean iscomplete( ); This method returns true if data entry into the item can currently be considered complete, and false otherwise. The set of XML definitions includes a mechanism for defining that a data item should notify completeness. ItemSupport provides a method that tests an item for completeness according to the following rules: If the item is a data item, and is eligible, and is mandatory, and is either invalid, null, or of zero length, then it is deemed to be incomplete. If the item contains other items, and any of those items is incomplete, then it is also deemed to be incomplete. DataItem This interface extends CompletableItem and is implemented by all the objects which represent data items in the XML UI representation. DataItem ensures the provision of the following methods: String getvalue( ); void setValue(String value); UI representation data items, for example, <STRING> should have a child item <VALUE> having a string value. When instantiated, the child item calls setvalue on its parent and the parent data item's value is accessed using getvalue. boolean isValid( ); void setValid(boolean valid); The first of these methods returns true if the item is currently valid, and false otherwise. The set of XML definitions defines several data types, and the rules governing how they should be formatted. In addition, value constraints may be applied. These methods relate to the adherence of values to formatting rules and constraints. ItemSupport provides a corresponding method that tests the data item value against criteria specific to the data type. The tests are as follows:
Data type Tests
STRING The length of the string is compared
with any UI representation defined
minimum and maximum.
DATE The value is checked against the set
of XML definition's formatting rules
for dates (ISO 8601), and compared
against any UI representation defined
earliest and latest date.
TIME The value is checked against the set
of XML definition's formatting rules
for times (ISO 8601), and compared
against any UI representation defined
earliest and latest time.
NUMBER The value is checked to ensure it is
a valid number representation, and
then its precision is checked against
any UI representation defined
precision. Finally, the value is
compared to any UI representation
defined minimum and maximum.
Container For any UI representation item that
is acting as a container, its
validity depends on the validity of
its contained items, so each
contained item is checked
recursively.
boolean isReadOnly( );
void setReadOnly(boolean readOnly);
The first of these methods returns true if the
item is read only, and false otherwise. The set
of XML definitions allows data items to be
specified as read only, indicating that the data
item value should not change. These methods
relate to this facility.
boolean isMandatory( );
void setMandatory (boolean mandatory);
The first of these methods returns true if the
item is mandatory, and false otherwise. The set
of XML definitions allows data items to be
flagged as mandatory, indicating that a value
must be provided. These methods relate to this
facility.
GroupItem This extends CompleteableItem, ItemContainer and Conditional, and represents XML UI representation <GROUP> elements. It adds no further methods but the methods of ItemContainer are as follows: void addItem (PresentableItem item); void removeItem (PresentableItem item); PresentableItem [] getItems( ); Thus, when a child element of a GroupItem is instantiated, either the child items constructor class or an ItemFactory instantiating the elements, can add the child item to an array of items on the container. Similarly, setParent can be called on the child element. The container in turn sets itself as a presentation listener on the child element, so that changes in child elements are therefore propagated up through the hierarchy of objects representing the user interface. Thus when a change happens to a child element, any listeners to antecedents of the child element will be notified and can take action accordingly. Although not strictly required by the interface, the implementation of this protocol within containers, ensures changes in elements are immediately notified to listeners who may need to take action. Conditional This interface is implemented by all the objects which represent data items in the UI representation and that are conditionally presented according to the state of another item. In the present embodiment, only GroupItems implement conditional, as these are the only container objects implementing conditional, although the invention is not limited to this implementation. Conditional ensures the provision of the following methods: String getItemName( ); void setItemName(String itemName); These methods return and set the NAME of the referenced item on which the condition and test are to be applied, as defined in the XML UI representation. String getvalue( ); void setValue(String value); These methods return and set the VALUE on which the condition and test are to be applied. int getCondition( ); void setCondition(int condition); These methods return and set a constant representing one of the conditions (CONTAINS, TRUE, FALSE, EQ, NE, GE, LE, GT, LT) defined in the set of definitions. int getTest( ); void setTest(int test); These methods return and set a constant representing one of the tests (ENABLED, SELECTED, SHOWN, VALID, VALUE) defined in the set of definitions. void addConditionListener(ConditionListener listener); void removeConditionListener(ConditionListener listener); This methods allows listeners to be added to and removed from objects which implement this interface. Whenever the result of evaluating a condition might change, due to user input or other actions, the listener is notified. By adding a suitable listener to each of the objects, the NavigationManager is thus able to respond appropriately to those changes. NavigationManager Using any implementation of the above interfaces to instantiate a hierarchy of renderer specific items based on a given XML UI representation, an instance of NavigationManager can be employed to provide presentation and navigation support for those items. Any given renderer first determines the items from the hierarchy that are to act as points of navigation, and then it provides the NavigationManager with these items in the correct sequence. In the preferred embodiment, NavigationManager encapsulates each item passed from the renderer in an instance of NavigationUnit, an inner class that is private to NavigationManager. NavigationManager builds an array of NavigationUnits, and maintains an index into this array to keep track of the "current" navigation unit. The renderer uses the NavigationManager services to present and keep up to date the available navigation options, and to present the appropriate item(s) for the current navigation point. The methods on NavigationManager for this purpose are: NavigationManager(DataGroupItem owner); The NavigationManager constructor is supplied with the XML UI item that is the root of all items in the XML UI representation. void addNavigationListener(NavigationListener listener); void removeNavigationListener(NavigationListener listener); The NavigationListener interface defines the means by which an interested party may be informed of navigation state changes for a given NavigationManager, using the Listener design pattern well known to those skilled in the art. This is the means by which a renderer specific user interface can reflect navigation options according to their current availability.void addItem(PresentableItem item); void addItem(PresentableItem item, PresentableItem previousItem); The supplied item is added to the set of items managed by this NavigationManager. If supplied, the previousItem is set as the item to which the NavigationManager should reverse navigate from this item. If previousItem is not supplied it is set to the item previously added. The exact sequence of events is as follows: Any previousItem is validated to ensure it has already been added. A new NavigationUnit is constructed with the item and the index of the default or provided previousItem. The new NavigationUnit is added to the array of NavigationUnits. void reset( ); Resets the NavigationManager's navigation cursor to the first eligible item, and then notifies NavigationListeners of a change in navigation point. PresentableItem getCurrent( ); Returns the item at the current cursor position. This allows a renderer specific user interface to obtain and present the current renderer specific item and thereby any of its children. boolean allowNext( ); Returns true if the current item is complete, and all previous shown eligible completable items are complete, and there is at least one shown eligible item following this item. To determine this, NavigationManager iterates backwards through its NavigationUnits from the current unit calling isEligible( ) on each unit to discover eligibility, and iscomplete( ) on each eligible unit. Iteration stops as soon as any eligible unit is found to be incomplete. If all preceding eligible units are complete, any following units are iterated through until an eligible unit is discovered. PresentableItem navigateNext( ); This method checks the legality of forward navigation using the same logic as described in allowNext( ). If legal, the current item is set to the discovered eligible unit, and NavigationListeners are notified of a change in navigation point. This method returns the new current item, or null if no navigation has occurred. However, in most cases renderers will ignore this return value and rely on notification of navigation changes to trigger any updates. boolean allowPrevious( ); Returns true if there is at least one previous shown eligible item. To determine this, NavigationManager will iterate backwards through its NavigationUnits from the previous unit calling isEligible( ) until an eligible unit is found. PresentableItem navigatePrevious( ); Returns the previous shown eligible item and updates the navigation cursor, or returns null if allowPrevious( ) would return false. This method checks the legality of backward navigation using the same logic as described in allowPrevious( ). If legal, the current item is set to the previous unit as defined when the current item was added, and NotificationListeners are notified of a change in navigation point. This method again returns the new current item, or null if no navigation has occurred. However, in most cases renderers will ignore this return value and rely on notification of navigation changes to trigger any updates. boolean allowComplete( ); Returns true if all shown eligible completable items are complete. To determine this, NavigationManager iterates through all of its NavigationUnits calling isEligible( ) on each unit to discover eligibility, and isComplete( ) on each eligible unit. Iteration stops as soon as any eligible unit is found to be incomplete. boolean allowCancel( ); Returns true since it is assumed that the user is always allowed to terminate the user interface. Included for completeness. NavigationUnit As mentioned above, NavigationUnit is a private inner class of NavigationManager that encapsulates a PresentableItem, and identifies an index for backwards navigation purposes, both provided with the constructor. NavigationManager uses the following NavigationUnit methods in checking and performing navigation: NavigationUnit(PresentableItem item, int previousindex); The supplied item and previousindex are stored. If the item implements Conditional, or is contained within an item that implements Conditional, the NavigationUnit adds itself as a ConditionalListener to the item or navigates up the object hierarchy to find the closest containing Conditional implementation and adds itself as a ConditionalListener to this item. It also adds itself as a PresentationListener to the item. Whenever condition change or completion state change notifications are received, the NavigationUnit fires a navigation state change on behalf of the NavigationManager. boolean isEligible( ); Returns true if the encapsulated item is shown and is eligible. To determine this, PresentableItem.isShown( ) and PresentableItem.isEligible( ) are called on the item. Implementations of PresentableItem may use the services of ItemSupport to assist in determining eligibility. boolean iscomplete( ); Returns true if the encapsulated item is a CompletableItem and is complete. To determine this, CompletableItem.isComplete( ) is called on the item. Implementations of CompletableItem may use the services of ItemSupport to assist in determining completeness Navigation Manager Example The following example provides a demonstration of a renderer that uses the Navigation Manager according to the preferred embodiment. The XML UI representation for the content is shown in Appendix A, where the elements that directly pertain to the Navigation Manager are in bold. To facilitate understanding of the relationship between the renderer and the Navigation Manager, each stage of the process is provided with a screen shot and a relevant description of the main methods that are used. All interface methods are in bold. The renderer parses the XML UI representation using a conventional XML parser and creates its own DOM (Document Object Model), shown in FIG. 3. Once completed, the renderer creates the Navigation Manager, calling the method: NavigationManager(DataGroupItem owner). This particular renderer has decided that each top-level group "Welcome", "Person Age", "Too Young", "Details", "Complete Insurance") will be displayed as a separate page. To achieve this, the renderer adds each top-level Group in order of occurrence to the Navigation Manager using the NavigationManager method: addItem(PresentableItem item), and each navigation unit is listed in FIG. 3 as A, B, C, D, E. The renderer does not explicitly identify the target for backwards navigation from each Group because it accepts the default which is the previous Group. Within the Navigation Manager, the navigation units instantiated for Groups C, D and E will detect that each of these items implement the Conditional interface and so and will thus add themselves as respective condition listeners to their encapsulated objects. Next the Navigation Manager is initialised to the first shown eligible group: reset( ). The renderer creates a main window that will at all times show the presentable item (and any children thereof) that the Navigation Manager signifies as the current item. At the base of the window, the renderer has provided buttons to demonstrate all methods of navigation that are provided by the Navigation Manager. The state of these buttons will always represent the current state of navigation. To keep the button states current, the renderer creates a Navigation Listener and supplies it to the Navigation Manager using the method: addNavigationListener(NavigationListener listener). The Navigation Listener is called every time the navigation state changes. On each occurrence, the renderer sets the current state of the buttons `Cancel`, `Back`, `Next>`, and `Finish` with reference to the corresponding Navigation Manager methods allowCancel( ), allowPrevious( ), allowNext( ), and allowComplete( ). FIG. 4 shows the first navigable item (A). The `< Back` button has been disabled because allowPrevious( ) indicates that there is no previous shown eligible item. The `Next>` button is enabled because allowNext( ) indicates that there is a subsequent shown eligible item, and that there are no invalid mandatory items amongst the children of the current item. `Finish` is enabled because allowComplete( ) indicates that all shown eligible items are complete. The `Cancel` button is enabled because allowCancel( ) indicates that the current interaction may be terminated. FIG. 5 shows the result of the `Next` button being pressed, which causes the renderer to call navigateNext( ). A navigation state changed notification is issued by the Navigation Manager. On receipt of this notification the renderer updates the display to reflect the new current item, in this case item (B), and updates the navigation buttons to reflect any change in navigation state. All subsequent navigable items (C) to (E) are conditional. Navigable item (C) is the next in sequence and is eligible only if the `Under>` choice is selected. Since this is the case, the `Next>` button is enabled. FIG. 6 shows the result of the `Next>2 button being pressed with the `Under 21 ` choice selected. As in the case of FIG. 5, the `< Back` button has been enabled because allowPrevious( ) indicates that there is at least one previous shown eligible item. The `Next >` button is disabled because allowNext( ) indicates that there are no subsequent shown eligible items (D and E are conditional upon "Above21" being selected, and so are ineligible). `Finish` is enabled because allowComplete( ) indicates that all shown eligible items are complete. When the `< Back` button is pressed the renderer calls navigatePrevious( ). Since the previous navigable item (B) is eligible, it becomes the current item and a navigation state changed notification is issued. FIG. 7 shows item (B) again, with the 21 or above` choice selected. When "21 or above" is selected, the condition upon which navigable items (D) and (E) are eligible changes. This is detected by the Navigation Manager because navigation unit (B) is a condition listener on this GroupItem (B) and it issues a navigation state change. On receipt the renderer checks the status of the navigation buttons by calling the allowNext, allowPrevious, allowComplete and allowCancel methods on NagivationManager. The `Finish` button is now disabled because allowComplete( ) indicates that there is at least one shown eligible mandatory incomplete item. In this case it is the `Number Plate` item, which is part of the containment hierarchy of navigable item (D). When the `Next >` button is pressed the renderer calls navigateNext( ). The next navigable item in sequence is (C), but this is now ineligible because the condition of item `Under21` being selected is not satisfied. However, navigable item (D) is now eligible, and so becomes the current item. FIG. 8 shows the result of the `Next >` button being pressed with the `21 or above` choice selected. The Group item "Details" contains two inner Groups "Person Details" and "Car Details"). The Group "Car Details" contains a mandatory field "Number Plate". The `Next >` and `Finish` buttons are disabled because the "Number Plate" field is empty. FIG. 9 shows the result of text entry into the mandatory field. When text is entered into the "Number Plate" field, the mandatory field is considered complete. This change is detected by the containing GroupItem "Car Details", which in turn raises a PresentationEvent on its listeners, one of which is the GroupItem "Details". This group again raises a PresentationEvent, which is detected by its encapsulating navigation unit within the Navigation Manager. This causes a navigation state change to be issued and on receipt the renderer checks the status of the navigation buttons. The `Next >` button is enabled because allowNext( ) indicates that there is at least one subsequent shown eligible item (E), and no incomplete mandatory items as part of the current navigable item. The `Finish` button is enabled because allowComplete( ) indicates that there are no incomplete mandatory items. When the `Next >` button is pressed the renderer calls navigateNext( ). The next navigable item in sequence is (E), which is eligible because the condition of item `Above21` being selected is satisfied. This becomes the current navigable item. FIG. 10 shows the result of the `Next >` button being pressed. The `Next >` button is disabled because allowNext( ) indicates that there are no subsequent eligible items. `Finish` is enabled because allowComplete( ) has indicated that all shown eligible mandatory items are complete.
APPENDIX A
<?xml version="1.0" ?>
<!DOCTYPE DRUID SYSTEM "DRUID.dtd">
<DRUID>
<DATA-GROUP NAME="Car Insurance">
<CAPTION>Car Insurance Direct</CAPTION>
<GROUP NAME-"Welcome">
<CAPTION>Car Insurance Direct</CAPTION>
<STRING NAME="Introduction" READ-ONLY="TRUE"
OPTIMUM-LENGTH="29" OPTIMUM-SIZE="3">
<VALUE>
Welcome to Car Insurance Direct. Please complete
the form to the best of your knowledge.
Thank you.
</VALUE>
</STRING>
</GROUP>
<GROUP NAME-"Persons Age">
<CAPTION>Person Details</CAPTION>
<CHOICE NAME="Age Group" OPTIMUM-SIZE="2"
SELECTION-POLICY="SINGLE">
<CAPTION>Your Age Group</CAPTION>
<STRING NAME="Under21">
<VALUE>Under 21</VALUE>
</STRING>
<STRING NAME="Above21">
<VALUE>21 or above</VALUE>
</STRING>
</CHOICE>
</GROUP>
<GROUP NAME="Too Young" ITEM-NAME="Under21"
TEST="SELECTED" CONDITION="TRUE">
<CAPTION>Insurance Refusal</CAPTION>
<STRING NAME="Refusal" READ-ONLY- "TRUE"
OPTIMUM-LENGTH="27" OPTIMUM-SIZE="2">
<VALUE>Unfortunately your request has been
refused due to your young age.</VALUE>
</STRING>
</GROUP>
<GROUP NAME="Details" ITEM-NAME="Above21"
TEST="SELECTED" CONDITION="TRUE">
<GROUP NAME="Person Details">
<CAPTION>Person Details</CAPTION>
<STRING NAME="FirstName" OPTIMUM-LENGTH="10">
<CAPTION>First Name</CAPTION>
<VALUE>Roland</VALUE>
</STRING>
<STRING NAME="Initial" MAX-LENGTH="1">
<CAPTION>Initial</CAPTION>
<VALUE>A</VALUE>
</STRING>
<STRING NAME="LastName" OPTIMUM-LENGTH="10">
<CAPTION>Last Name</CAPTION>
<VALUE>Merrick</VALUE>
</STRING>
<STRING NAME="email" OPTIMUM-LENGTH="10">
<CAPTION>Email</CAPTION>
</STRING>
</GROUP>
<GROUP NAME="Car Details">
<CAPTION>Car Details</CAPTION>
<STRING NAME="Make" OPTIMUM-LENGTH="10">
<CAPTION>Car Model</CAPTION>
</STRING>
<STRING NAME="Number Plate" MANDATORY="TRUE"
MAX-LENGTH="8">
<CAPTION>Number Plate</CAPTION>
</STRING>
</GROUP>
</GROUP>
<GROUP NAME="Complete Insurance" ITEM-NAME-"Above21"
TEST="SELECTED" CONDITION="TRUE">
<CAPTION>Insurance Details Complete</CAPTION>
<STRING NAME="Completion" READ-ONLY="TRUE"
OPTIMUM-LENGTH="27" OPTIMUM-SIZE="2">
<VALUE>We will now process your details and
send you an insurance quote for your vehicle.</VALUE>
</STRING>
</GROUP>
</DATA-GROUP>
<WIZARD></WIZARD>
</DRUID>
|
Same subclass Same class Consider this |
||||||||||
