BACKGROUND OF THE INVENTION1. FIELD OF THE INVENTION[0001]
This invention relates to binding user interface objects to application objects.[0002]
2. Background Art[0003]
Developing software applications to be used on the Internet is difficult and complex. There is a need for tools to make it easier for a software developer to create such applications. The problem in developing Internet applications can be understood by examining the Internet and current tools for creating programs.[0004]
The Internet is a worldwide network of interconnected computers. An Internet client accesses a computer on the network via an Internet provider. An Internet provider is an organization that provides a client (e.g., an individual or other organization) with access to the Internet (via analog telephone line or Integrated Services Digital Network line, for example). A client can, for example, download a file from or send an electronic mail message to another computer/client using the Internet. An Intranet is an internal corporate or organizational network that uses the same communications protocols as the Internet.[0005]
Internet AccessThe World Wide Web (WWW) facilitates access to the Internet using several protocols including the Hypertext Transfer Protocol (HTTP). The WWW can be used to access text and other forms of information such as graphics, pictures, and sound. Components of the WWW include browser software, network links, and servers. The browser software, or browser, is a user-friendly interface (i.e., front-end) that simplifies access to the Internet. A browser allows a client to communicate a request without having to learn a complicated command syntax, for example. A browser typically provides a graphical user interface (GUI) for displaying information and receiving input. Examples of browsers currently available include Netscape's Navigator Gold 3.0 and Microsoft's Internet Explorer.[0006]
Information servers provide information on the WWW in response to a client request. Hypertext Transport Protocol (HTTP) is a standard protocol for communication with an information server on the WWW. HTTP provides communication methods that allow clients to request data from a server and send information to the server.[0007]
HTML Definitional LanguageA browser displays information to a client/user as pages or documents. The Hypertext Markup Language (HTML) is used to define the format for a page to be displayed on the WWW. A WWW page is transmitted to a client as an HTML document. The browser executing at the client parses the document and generates and displays a page based on the information specified in the HTML document.[0008]
HTML is a structural language that is comprised of HTML elements that are nested within each other. An HTML document is a text file in which certain strings of characters, called tags, mark regions of the document and assign special meaning to them. These regions are called HTML elements. Each element has a name, or tag. Examples of elements include unordered lists, text boxes, check boxes, and radio buttons. Each of these elements can have attributes that specify properties of the element such as name, type, and value. The following provides an example of the structure of an HTML document:
[0009] | <HEAD> |
| .... element(s) valid in the document head |
| </HEAD> |
| <BODY> |
| .... element(s) valid in the document body |
| </BODY> |
Each HTML element is delimited by the pair of characters “<” and “>”. The name of the HTML element is contained within the delimiting characters. The combination of the name and delimiting characters is referred to as a marker, or tag. Each element is identified by its marker. In most cases, each element has a start and ending marker. The ending marker is identified by the inclusion of an another character, “/” that follows the “<” character.[0010]
HTML is a hierarchical language. With the exception of the main HTML element which encompasses the entire HTML document, all other elements are contained within another element. The HTML element encompasses the entire document. The main HTML element identifies the enclosed text as an HTML document. The HEAD element is contained within the main HTML element and includes information about the HTML document. The BODY element is contained within the main HTML element. The BODY element contains all of the text and other information to be displayed. Other HTML elements are described in an HTML reference manual such as Scharf, D.,[0011]HTML. Visual Quick Reference, Que Corporation (1995).
Mechanisms exist for developing Web applications that allow a user to interact with an application running on a remote processor as though the user's computer terminal was hardwired to the remote processor. That is, traditional networked applications are being ported to the Internet to allow remote access to the application via the Internet. The WebObjects product from NeXT Software, Inc. is an example of a set of tools that can be used to develop and run Web applications.[0012]
An application can be ported to the Web by creating HTML definitions for the application's user interface. A Web application exhibits a back-end state (e.g., stored data, runtime data, and logic). The HTML definitions that are used primarily for the application's user interface must be dynamic to reflect the changing back-end state. The back-end state must be able to be bound to the HTML definitions such that the application's logic can dynamically generate (or modify) the HTML definitions. The WebObjects product provides the ability to define the bindings in a plain text, or ASCII, file. The application developer writes a set of statements in a text file that are interpreted to determine the bindings. There is, however, no tool that provides an environment for interactively defining the bindings using a graphical user interface (GUI) and for generating the binding statements.[0013]
HTML allows hypertext links to be embedded in an HTML document that allow a user to interactively initiate transactions at server computers via the WWW. Minimal state information about such transactions is retained within an HTML document. It would be beneficial to use object-oriented HTML elements to manage a series of transactions and to maintain state information across transactions. It would be beneficial to be able to generate HTML documents dynamically using information from a previous transaction, corporate data, and data retained in HTML element objects. It would be beneficial to be able to share application development across applications.[0014]
As described more fully in United States Patent Application entitled Method and Apparatus for Generating Object-Oriented World Wide Web Pages, Ser. No. 08/515,057, filed on Aug. 14, 1995, assigned to the assignee of the present invention, and incorporated herein by reference, a capability exists for generating and manipulating WWW pages programmatically using object classes in an object-oriented environment. Classes of objects are defined for each HTML element. Properties of an HTML element are stored in instance variables of an object class. An object class can include methods to manipulate an HTML element. For example, an object class can include a method for generating the HTML for the element in a Web page definition.[0015]
ComponentSelf-contained modules, or components, are described in United States Patent Application entitled Method and Apparatus for Developing and Managing Transactions, Ser. No. 08/532,491, filed on Sep. 22, 1995, assigned to the assignee of the present invention, and incorporated herein by reference. Such a component can be used in one or more Web pages across multiple applications to provide definition for the Web page. A component can represent an entire page or some portion of a page.[0016]
Resources such as a template, association, and custom logic can be associated with a component. An HTML template, for example, can provide a layout or description of the Web page. An HTML template can include some or all of the HTML definition for the Web page, for example. The template can further identify a dynamic element that can be used to generate the definition for an HTML element. Like an HTML element specification in an HTML document, a dynamic element is identified using a tag. The dynamic element's entry in the template can further specify attributes for an instance of the object class.[0017]
Custom logic can be a program written in a script, Objective C, or other programming language that can be used to generate and control a Web page at runtime. For example, custom logic can generate an HTML definition for a requested Web page using an HTML template together with a runtime, or back-end, state of a client or server process. Thus, certain portions of the Web page can be defined prior to runtime while other portions are dynamically created at runtime.[0018]
Associations of a component can be used to provide a binding between the definitional elements (e.g., HTML elements) included in a Web page specification (e.g., HTML definition file) and the back-end state of a client or server process. For example, a text or ASCII file can be created using a text editor that contains statements that associate attributes of an HTML element with variables declared in the custom logic. Currently, a WWW application developer must specify these associations by writing statements using a declarative language syntax such as value=employee.fn where value is an attribute of an HTML element, employee is the variable and fn is a field of the employee variable. In the prior art, there is no mechanism for graphically specifying or viewing bindings between a Web page definition and custom logic.[0019]
SUMMARY OF THE INVENTIONA graphical user interface (GUI) and accompanying functionality for binding Web page definitional elements to a back-end state (e.g., client- or server-side back-end state) and custom logic is provided. A template containing definitional elements, custom logic, and bindings is generated that defines all or a portion of a Web page.[0020]
The GUI is used to define the layout of a Web page. Definitional elements (e.g., HTML elements) are specified for inclusion in the Web page. A set of variables and methods are defined using the invention. Variables have associated classes that are used to determine a default binding. Bindings between the definitional elements and the variables and methods is performed using the invention.[0021]
A definitional element can be bound to a variable, method or constant. A default binding can be determined between the definitional element and a variable based on the class of the variable. The definitional element's attribute that is used in the binding can be determined based on the variable's class. Certain attributes of a definitional element can be bound to a method or constant.[0022]
To bind a definitional element and a back-end state item, a definitional element is selected from the GUI. A back-end state item (e.g., variable, constant or method) is selected from the GUI either from a list of all items or a list of possible items. A default binding is determined between an attribute of the definitional element and the back-end state item. The default binding is displayed in the GUI for viewing by the user. In most cases, the attribute of the definitional element that is bound to the back-end state item can be displayed in the graphic representation of the definitional element. Since more than one attribute of a definitional element can be bound to the back-end state, the attribute that is fundamental to specifying the definitional element is displayed in the GUI. For example, the attribute that contains the value of a string or identifies the variable that stores a text field's input provides information that is fundamental to the specification of the string and text field definitional elements. A default binding is determined for a fundamental attribute of the definitional element and is displayed in the GUI. The user can change a default or other binding using an input screen referred to as an inspector. The inspector has input fields that can be used to input the definitional element, back-end state item and/or attribute to use in the binding. The inspector can be used to add arbitrary back-end state items in addition to the default bindings.[0023]
The invention can be used to bind a definitional element to data contained in a database. A display group object used as a controller for enterprise objects can be bound to definitional elements in the Web page. Thus, data can be retrieved from one or more tables in a database and used to dynamically generate a Web page. Further, data can be retrieved from a Web page received from a Web application user and stored in the database.[0024]
BRIEF DESCRIPTION OF THE DRAWINGSFIG. 1 provides an example of a general purpose computer that can be used with the present invention.[0025]
FIG. 2 provides an functional overview of an embodiment of the invention.[0026]
FIG. 3 provides an overview of the screens used in a GUI according to an embodiment of the invention.[0027]
FIG. 4A provides an example of an application window according to an embodiment of the invention.[0028]
FIG. 4B provides an example of a palette containing HTML elements according to an embodiment of the invention.[0029]
FIG. 4C provides an example of usage of a form-based dynamic element palette according to an embodiment of the invention.[0030]
FIG. 4D provides an example of an inspector window with bindings displayed according to an embodiment of the invention.[0031]
FIG. 5 provides an example of a component window according to an embodiment of the invention.[0032]
FIG. 6 provides an example of an object browser window containing variables and methods for a component.[0033]
FIG. 7 provides an example of a graphical user interface screen used in a binding operation.[0034]
FIG. 8A provides an example of a definitional element section containing definitional elements according to one embodiment of the invention.[0035]
FIG. 8B illustrates variables and definitional elements in a guest application according to one embodiment of the invention.[0036]
FIG. 8C displays examples of bindings according to an embodiment of the invention.[0037]
FIGS.[0038]9A-9B provide a binding process flow according to an embodiment of the invention.
FIG. 10 provides an example of binding definitional elements to a database table according to an embodiment of the invention.[0039]
DETAILED DESCRIPTION OF THE INVENTIONA method and apparatus for binding user interface objects to application objects is described. In the following description, numerous specific details are set forth in order to provide a more thorough description of the present invention. It will be apparent, however, to one skilled in the art, that the present invention may be practiced without these specific details. In other instances, well-known features have not been described in detail so as not to obscure the invention.[0040]
The present invention can be implemented on a general purpose computer such as illustrated in FIG. 1. A keyboard[0041]110,mouse111 and I/O119 are coupled to abi-directional system bus118. The keyboard and mouse are for introducing user input to the computer system and communicating that user input toCPU113. The computer system of FIG. 1 also includes avideo memory114,main memory115 andmass storage112, all coupled tobi-directional system bus118 along with keyboard110,mouse111 andCPU113. Themass storage112 may include both fixed and removable media, such as magnetic, optical or magnetic optical storage systems or any other available mass storage technology.Bus118 may contain, for example, 32 address lines for addressingvideo memory114 ormain memory115. Thesystem bus118 also includes, for example, a 32-bit DATA bus for transferring DATA between and among the components, such asCPU113,main memory115,video memory114 andmass storage112. Alternatively, multiplexed DATA/address lines may be used instead of separate DATA and address lines.
In the preferred embodiment of this invention, the[0042]CPU113 is a 32-bit microprocessor manufactured by Motorola, such as the 680×0 or Power PC processor or a microprocessor manufactured by Intel, such as the 80×86, or Pentium processor. However, any other suitable microprocessor or microcomputer may be utilized.Main memory115 is comprised of dynamic random access memory (DRAM).Video memory114 is a dual-ported video random access memory. One port of thevideo memory114 is coupled tovideo amplifier116. Thevideo amplifier116 is used to drive the cathode ray tube (CRT)raster monitor117.Video amplifier116 is well known in the art and may be implemented by any suitable means. This circuitry converts pixel DATA stored invideo memory114 to a raster signal suitable for use bymonitor117.Monitor117 is a type of monitor suitable for displaying graphic images.
The computer system described above is for purposes of example only. The invention may be implemented in any type of computer system or programming or processing environment.[0043]
The invention provides a mechanism for binding Web page definitional elements to a runtime, or back-end, state using a graphical user interface (GUI). The GUI includes functionality to specify and view a Web page definition including definitional elements, back-end state of a client or server process, and bindings between the two. Functionality is provided for displaying a set of potential, default bindings using selections made by the GUI user (e.g., a Web application developer). Bindings can be made between definitional elements and elements of a database using the invention. Dynamic Web pages can be generated using data retrieved from a database. Further, input received from a Web page can be stored in a database.[0044]
FIG. 2 provides an functional overview of an embodiment of the invention.[0045]Web page202 contains fields such as input fields204 and206 andbutton field208.Page202 is displayed using a browser such as, for example, Netscape's Navigator browser or Microsoft's Internet Explorer. A browser displayspage202 from a definition such asdefinition212.Definition212 contains definitional elements (e.g., HTML elements) that are used by a browser to generatepage202. For example,element214 contains a definition forinput field204.Element214 specifies attributes forinput field204 such as the type of input (“TYPE=‘TEXT’”) and size of the field (i.e., “SIZE=‘20’”). The default value forfield204 is determined at runtime from back-end state210.Elements216 and218 contain definitional information forfields206 and208.
Attributes of HTML elements[0046]214-218 can be specified prior to runtime (e.g., statically defined). Other attributes may be defined at runtime from information contained in back-end state210. Back-end state210 includes data and logic such asvariable234, constant236 andmethod238. Attributes224-228 are attributes of dynamic elements used to generate HTML elements. For example,attribute224 is an attribute of a dynamic element that generatesHTML element214.HTML element214 is the HTML definition forfield204.Attribute224 is bound to variable234 in back-end state210. Variable234 contains the default value that is displayed infield204. Similarly, constant236 is used to determine a size forinput field206, andmethod238 provides an action that is performed when a submit input is received.
The invention is used to bind, or map, the back-end state to the definitional attributes. A binding is a mapping between one aspect of a dynamic element in a definition (e.g., an attribute) and the back-end state. A dynamic element is an element that is replaced with dynamically generated HTML at runtime. For a dynamic element to be fully functional, it must be bound to the back-end state. Bindings[0047]244-248 bind, or map, elements214-218 to back-end state210.Input element214 is bound (via binding244) tovariable234. Binding246 bindsinput element216 to constant236.Method238 is bound (via binding248) toinput element218.
The invention's functionality is used to create and manage bindings[0048]244-248. A GUI is provided that is used to create, delete and modify bindings. FIG. 3 provides an overview of the screens used in a GUI according to an embodiment of the invention. The GUI is used to generatetemplate330,declarations332 andscript334.
The GUI includes[0049]application window302 that is used to control application-wide resources. It is used to open, create, or delete components inside an application as well as to define variables with global scope (e.g., application- and session-level variables). At runtime, application-level variables are created when an application starts executing and are deallocated when the application quits. A session-level variable is created when a new user begins a new session and is deallocated when the session ends. Application- and session-level variables can be accessed by an application's components. Component-level variables exist while the dynamic pieces of the component are being evaluated. After the component's page is redrawn, the back-end state contained in a component-level variable is lost.
FIG. 4A provides an example of an application window according to an embodiment of the invention.[0050]Application window472 includestabs474,476, and478 to allow a user to select the level at which to perform functions. By selectingtab474, functions are performed at the component level. Whentab474 is selected, a list of components (lines480A-480G) is displayed to select a component upon which operations can be performed. Components can be added, deleted, modified and viewed. Application-level and session-level functions can be performed by selectingtabs476 and478, respectively. For example, it is possible to add, delete, modify or view application- or session-level variables by selectingtabs476 or478.
Multiple application windows can be opened at the same time in the GUI. For example, two instances of[0051]application window472 can be opened that correspond to two different applications, application A and application B. A component that is used in application A can be reused in application B by selecting and dragging the component's graphical representation from application A's application window to application B's application window. The component is copied into application B. The component's HTML template, declarations, and script are copied into application B's directory. Further, a graphical-representation of the component is displayed in application B's application window. Thus, a component that has already been defined in one application can be reused in another application using the GUI.
In the preferred embodiment, a component is reused without the need to copy it to an application's directory. Instead, a component can be shared that is placed in a location that is known to all applications. Thus, any application can access the component in that location. There is no need to copy the component to an application's directory. Multiple applications can share the same component (a portion of a component such as a template). Changes can be made to a single copy of the component. There is no need to update multiple copies of a component.[0052]
Referring to FIG. 3,[0053]object browser312 is used to create, delete and modify application-, session-, and component-level variables. When it is used at the component-level,object browser312 displays the full interface provided by a script file. Those items that are fully defined in the script file (e.g., a method that is filled out or a complete variable declaration) are displayed inobject browser312.Object browser312 is used to bind dynamic elements to variables or methods in a script.Object browser312 can also be used to display the interfaces of application- and session-level script files.
[0054]Component window304, reached by selecting component table474 and selecting or creating a component, provides an interface for creating, editing, and viewing a component. For example,component window304 is used to add definitional elements, variables and methods to a component.Script window306 shows a component's custom logic (e.g., a script or Java program). The contents ofscript window306 can vary depending on the current definition level (e.g., application, session, and component). Ifapplication window302 is open to define the application,script window306 displays an application-level script. Similarly, if the session is being defined,script window306 displays a session script. Whencomponent window304 is open,script window306 contains the component's script. The GUI includes aninspector window310 that is used to display and modify binding, attributes and other settings.
[0055]Palette308 contains elements that can be dragged into another window. For example,palettes308 can include a window that contains a collection of definitional elements (e.g., HTML elements) that can be dragged and dropped into a component displayed incomponent window304. FIG. 4B provides an example of a palette containing definitional elements according to an embodiment of the invention.
[0056]Icons402,404 and406 represent different palette views that can be opened by, for example, clicking the icon. Icon402 represents a static elements palette that contains static definitional elements. Static elements are elements that remain constant (i.e., are not modified at runtime). Icons410-422 are examples of HTML static elements.Icon410 represents a heading HTML element. The paragraph, list, HTML block, horizontal line, table, and link tags are represented by icons412-422.
Dynamic elements can be displayed by selecting[0057]icons404 and406, respectively.Icon404 represents form-based dynamic elements. A form-based dynamic element is an element that has an equivalent static element in the definitional language (e.g., has an HTML element equivalent).Icon404 represents definitional elements such as HTML elements that can be defined or modified at runtime. A dynamic element is replaced or modified with dynamically generated definitional statements (e.g., HTML statements) at runtime. For example, a string element can be added to the definition of a page prior to runtime whose value will be determined at runtime. A static element can be transformed into a dynamic element by creating a binding for the element. If no binding is created, a static element (e.g., a static form-based element ) is created. Preferably, when a binding is defined for a form-based element, an object class that is associated with the element is used to manipulate the element at runtime. For example, when a binding is defined for a text field, a textField object is created to provide attributes and behavior for the text field element at runtime.
FIG. 4C provides an example of a form-based dynamic element palette according to an embodiment of the invention.[0058]Icon440 is selected to displaypalette window444.Palette window444 includes icons450-456 that represent elements that can be dragged (e.g., in direction442) frompalette window444 and dropped into another window (e.g., component window446) to create a definitional element (e.g., HTML form element). HTML language statements are generated for the element.
Referring to FIG. 4B,[0059]icon406 is used to open an abstract dynamic elements palette. An abstract dynamic element is an element that does not have a direct equivalent in the Web page definitional language. At runtime, an abstract element can be replaced by text or graphics or another definitional construct. A palette window can be opened to select an abstract element by selectingicon406, for example. In addition to the static, form-based and abstract element palettes, it is possible to create custom palettes or to access a pre-existing custom palette.
The GUI is used to specify an initial definition and custom logic for[0060]Web page202 and bindings between the two. In one embodiment, the initial definition is in the form of a text file (e.g., template330) that contains a set of definitional statements such as HTML statements that identify an initial layout forWeb page202. Script334 contains logic that can be executed at runtime. Script334 can be defined using a scripting or compiled language, for example.Declarations332 contains a set of bindings that associate elements specified intemplate330 with the logic contained inscript334.
Component Window[0061]Component window304 provides an interface for creating, editing, or viewing a component. For example, the interface can be used to add HTML elements, variables, and methods to a component. FIG. 5 provides an example of a component window according to an embodiment of the invention.
[0062]Component window502 includes aelement section504 and anobject browser506.Element section504 is used to add, remove, or modify definitional elements (e.g., HTML elements) to the component. As discussed above,palette window308 contains definitional elements that can be selected for inclusion in a component. A graphical display of the definitional elements is provided inelement section504. Definitional elements displayed inelement section504 are used to generatetemplate330.
[0063]Object browser506 is used to display variables or methods. FIG. 6 provides an example of an object browser containing variables and methods for a component.Columns602,604, and608 are used to display variables and methods. For example, ifobject browser606 is being used to display component-level information,column602 contains the component'svariables610 andmethods612.Object browser606 can also be used to display application-level or session-level variables. An instance ofobject browser606 is displayed whentab476 or478 is selected inapplication window472, for example. Whenline614 of variables610 (available in a component window) is selected,column604 is used to display application-level variables616. Similarly, if line618 (available in a component window) is selected, session-level variables can be displayed incolumn604.
[0064]Icons626,628, and630 are used to create or delete a variable or method. For example,icon630 is used to delete a variable (or method). To create a variable or a method,icons628 and626, respectively, are selected. The name of the variable (or method) being created is typed intofield620. The script is modified (e.g., variable or method declarations) inscript window306 in response to a create or delete operation.
A class can be specified for the[0065]variable using field622 by either typing in a class or selecting a class from a menu that is displayed by pressingbutton624. The class of a variable specifies the variable type. Preferably, a variable is identified as being one of three types of classes: base, composite, or enterprise object. A base class includes variables that represent or can be translated into a single value. The base classes are Object, Number, and String. A variable of the Number class represents a single number, and a variable of the String class represents a single string, for example.
The composite classes include dictionary and custom classes. A variable in the Dictionary class could represent all of the information about one item. The Enterprise Object classes are used in applications that access a database. A variable of type base, composite or enterprise object can also be an array of objects. The objects contained in the array are of the class selected for the variable. An array variable might represent a list of items.[0066]
Binding ElementsA binding is a mapping between a variable or method declared in a component's script (or other logic such as a function or method) and an attribute of a dynamic definitional element of the component. Each dynamic definitional element has one or more attributes. Each attribute of a dynamic definitional element can be bound to a variable or method in a script. It is not necessary to bind all of a dynamic definitional element's attributes, however. In one embodiment, the class of a variable is used to determine a default binding.[0067]
The GUI of the invention is used to specify a binding including specifying the variable (or method), the dynamic definitional element and the element's attribute. The invention facilitates binding by determining possible attributes of a definitional element for binding based on the variable selected. Further, given the definitional element and a variable, the invention identifies a default binding using an attribute of the definitional element. The variable's class is used to facilitate the identification of possible attributes of a definitional element to bind to the variable.[0068]
To bind a definitional element to a variable, a user:[0069]
1) selects a definitional element;[0070]
2) selects a variable (or method); and[0071]
3) selects an attribute of the selected definitional element to be bound to the selected variable.[0072]
FIG. 7 provides an example of a graphical user interface screen used in a binding operation.[0073]Component window702 containsdefinitional element section704 andobject browser706.Definitional element section704 containsfield712 which is a graphical representation of an HTML INPUT element. An HTML INPUT element includes name and value attributes. The user selectsfield712 as the definitional element to be bound.
[0074]Object browser706 contains a listing of variables (e.g., aGuest) and methods (e.g., submit) that can be selected for binding to the HTML INPUT element. The variable aGuest is a dictionary composite class variable that contains the variables: comments, email, and name. The user selects the name variable for binding to the HTML INPUT element. Based on this, the value attribute of the HTML INPUT element is bound to the name variable. The value attribute of the HTML INPUT in the component (i.e., field712) is bound to the aGuest.name variable in the component's script.
At runtime, the value attribute of a dynamic element used to generate the HTML INPUT elements is bound to a variable that contains the default value for the input field. In[0075]field712, the name field of the aGuest variable is used to specify the default value for the HTML INPUT element in the page in which the component is a part. At runtime, an HTML INPUT statement is generated, or modified, with the value contained in aGuest.name.
A binding is displayed in the GUI for review by the user. The graphical representation of the bound definitional element (e.g., field[0076]712) identifies the bound variable (e.g., aGuest.name).Message718 is displayed to identify the specific attribute of the definitional element that is bound to the variable.
In the previous example, the user selected the variable to be bound from a display of all variables and methods accessible to the component in the object browser. Alternatively, a pop-up menu can be used to display the possible variables that can be selected based on the selection of the definitional element. The GUI can display a pop-up window in the definitional element section that contains the variables that can be bound to the definitional element selected by the user. The user can select one of the variables contained in the pop-up window. The variables are chosen for inclusion in the pop-up menu based on their class relative to the definitional element that was selected.[0077]
More than one attribute of a definitional element can be bound to the back-end state. One or more attributes of a definitional element are considered to be fundamental to the definitional element's specification. For example, the attribute that contains the value of a string or identifies the variable that stores a text field's input provide information that is fundamental to the specification of the string and text field definitional elements. If a binding is determined for a fundamental attribute of the definitional element, it is displayed in the GUI.[0078]
[0079]Inspector window310 can be used to specify the binding information.Inspector window310 might be used to access an attribute including those that are not fundamental to a definitional element's specification or to specify a constant, for example. As a result of a binding to a constant declaration, the constant declaration is added to the bindings file.
FIG. 4D provides an example of an inspector window with bindings displayed according to an embodiment of the invention.[0080]Inspector window490 displays the bindings, attributes, and other settings for the currently selected definitional element and other definitional elements. Definitional languages such as HTML are hierarchical languages. A definitional element is contained within another definitional element. The hierarchy is displayed ininspector window490 using icons ashierarchy492. The icons inhierarchy492 represent a definitional element or a binding for a definitional element.Bindings section494 displays the bindings (i.e., the attribute and a value to which it is bound) for a definitional element. A constant can be bound to an attribute by selecting the attribute, inputting a value infield496, and pressingconnect button488. A variable can be bound to an attribute by selecting the variable,opening inspector490, selecting an attribute, and pressing the currentvariable button498.
Default BindingsIn addition to providing a GUI for defining a binding, the invention provides a mechanism for automatically identifying and displaying all of the possible variables that are available for binding to a definitional element. Further, an attribute, such as a fundamental attribute, of a definitional element selection can be automatically selected for binding with a selected variable. The automatic identification of a possible variable and/or attribute facilitates binding. The user is given those variables that can be bound to the definitional element. Further, it is not necessary for the user to select an attribute for binding to the variable.[0081]
The class of a variable is used in the identification of one or more attributes for binding. The attributes of a definitional element are compared with the class associated with a variable in the identification process. For example, a definitional element that is used to dynamically generate a string at runtime has a value attribute. The value attribute specifies the text that is to be displayed in the Web page. A string or other value or object that can be translated into a string would be a valid binding to the value attribute. Variables that have been defined as being in the base class (i.e., are an object, number or string) are compatible with the value attribute. Thus, these variables can be displayed as possible variables for binding with the string definitional element. Further, if a variable of a base class is selected, the value attribute (a fundamental attribute) of the string definitional element is automatically selected as the default binding attribute.[0082]
Binding ExampleThe following binding example is provided to illustrate binding using embodiments of the invention. The example assumes an object-oriented programming environment and the use of HTML as the definitional language. However, the capabilities and techniques illustrated can be applied in other programming environments other definitional languages. The example involves the development of a Web page for entering and displaying information about users in a guest book application. Users enter the name and email address in the input fields on a displayed Web page. The entered name and address are retrieved from the Web page and added to an array of guests. One guest or all entries in the guests array can be displayed on one or more Web pages.[0083]
[0084]Application window302 can be used to create a main component for the Web page. Associated with the main component is an instance of each oftemplate330,declarations332, andscript334. An instance ofcomponent window304 is opened fromapplication window302. Since there is nothing at this point intemplate330, the definitional element section (e.g., section504) ofcomponent window304 is initially empty. Instances ofpalette308 can be used to drag and drop HTML elements into the main component.
FIG. 8A provides an example of a definitional element section containing definitional elements according to one embodiment of the invention. A repetition is illustrated between[0085]icons850. The elements withinicons850 are repeated for each item in a repetition. A repetition element is an abstract dynamic element that does not directly correspond to an HTML element. A repetition element is used to generate HTML at runtime such as an ordered or unordered HTML list. A repetition element includeslist attribute800A anditem attribute800B (their connection is illustrated by icon852). Referring to FIG. 8B, the list attribute identifies the array (e.g., array832) of objects (e.g., objects834A-834D) thatrepetition element802 will iterate through. The item attribute identifies the current item (e.g.,834A) in the list array.
Referring to FIG. 8A,[0086]string element804 andstring element806 are dynamic elements that generate HTML display strings at runtime. As indicated bystatic text810 and812,string elements804 and806 display a name and an email address. A string element is an abstract dynamic element that generates a text string. Submitelement808 is a form-based element that corresponds to the submit HTML element (i.e., an INPUT HTML element of type submit).
Variables are created to store back-end state information for the guest book application. FIG. 8B illustrates variables and definitional elements in the guest book application according to one embodiment of the invention. A custom class, guest, is created that is of class dictionary. A dictionary class has some similarity to a C language structure with fields. It contains a key (a name of the field) and a value for a key. The keys for objects of class guest are name and email. An application-level variable, guests (variable[0087]832), is an array of objects of class guest that is created, usingobject browser312, to store a list of guests.Object browser312 is used to create a component-level variable, aguest, that is of class guest and stores current guest information.
The GUI is used to create a binding between elements[0088]802-808 and the variables. To create a binding forrepetition element802, it is first selected. A variable, for example variable832 (guests), is selected for binding torepetition element802. Sincevariable832 is an array in this embodiment, a default binding842A is created betweenvariable832 andrepetition element802 using the list attribute ofrepetition element802. A second binding, binding842B, is created using the item attribute ofrepetition element802 when variable834A, aguest, andrepetition element802 are selected. Thus,repetition element802 is bound to two different variables.
Variable[0089]834A has name and email subfields that bind to stringelements804 and806. Binding844 is created betweenstring element804 and aguest.name (variable.834A) via the value attribute ofstring element804.String element806 is bound (binding846) to aguest.email (variable834A) via the value attribute ofstring element806. Submitelement808 causesmethod838 to be created in the main component's script.Method838 can be viewed and modified usingscript window306. For example,method838 adds the information contained in the variable834A (i.e., aguest variable) to the variable832 (i.e., guests array variable). A default binding (binding848) is created betweenmethod838 and submitelement808 via its action attribute.
[0090]Bindings842A-842B and844-848 are default bindings. That is, they are created automatically given the class of the selected variable and the attributes of the selected element. The name and email subfields of variable834A are of class object (a base class). Default bindings are created between these subfields and an attribute ofstring elements804 and806 that expects a value (i.e., the value attribute). The list attribute ofrepetition element802 expects an array variable (e.g., variable834A). The item attribute is an element of the list array. Once the list attribute is bound to an array of a specific type, the type of the item attribute can be determined. For example, when the list attribute is bound to an array of guests, an item attribute is a single guest. If a single guest is a dictionary variable of composite class (e.g., variable832), the user can access the fields within the dictionary variable (e.g., name and email fields of the aguest variable)The action attribute of submitelement808 expects a method (e.g., method838).
The bindings that are created are displayed in the GUI. FIG. 8C displays bindings according to an embodiment of the invention. The graphical representation of[0091]repetition element802 is updated to begraphical representations800A and800B (in FIG. 8B).Graphical representation800A reflects the binding ofrepetition element802 to the guests variable (variable832).Graphical representation800B displays the binding betweenrepetition element802 and the aguest variable (variable834A). Similarly, the variable names aguest.name and aguest.email are displayed in the GUI forstring elements804 and806, respectively. The name of a bound method can be displayed ingraphical representation808.
At runtime, the information stored in the script variables and the scripts methods are used to dynamically generate the HTML definition for the main component. In a preferred embodiment, the HTML elements are instantiated as objects whose attributes include the definitional element's attributes. The objects' behavior is used to retrieve information to generate the Web page using the data stored in the script variables. In addition, the objects' behavior is used to retrieve information from the Web page for storage in the script variables. An objects' behavior can also be invoked in response to an action is taken in the Web page (e.g., the submit button is depressed).[0092]
Each of the variables or items in[0093]array832 are processed usingrepetition element802. Referring to FIG. 8B,repetition element802 is bound to anarray832 and item is bound to a variable which is to be set with elements from the array (e.g., variable834A) withinarray832.Repetition element802 advances a pointer to a current item inarray832.String element804 accesses information contained in the current item ofarray832 to generate or modify an existing HTML definition using the data contained in the array item. For example the name field of variable834A is used bystring element804 to generate a name string. Similarly, the email field of variable834A is used bystring element808 to generate an email string. The name and email strings are added to the HTML definition ofWeb page850. When the HTML definition is complete, it is sent to the requesting browser for interpretation and display.
[0094]Web page850 is displayed by the browser. A browser user can review the name and email information infields804 and806. WhenWeb page850 is submitted using submitfield808,bindings844 and846 andmethod838 can be used to store the input in theWeb page850 in the name and email subfields of back-end variable834.
Binding FlowFIGS.[0095]9A-9B provide a binding process flow according to an embodiment of the invention. Atstep902, a definitional element is selected by the user. Atstep904, the invention identifies the attributes of definitional element. At step906 (i.e., “selected element has attributes and there are possible variables?”), a determination is made whether the selected definitional element has attributes to be bound and there are possible variables that can be bound to an attribute of the definitional element. If the selected definitional element does not have attributes for binding or there are no possible variables that can be bound to an attribute, processing continues at step926 to indicate that there is no suitable default binding and processing ends atstep924.
If, at[0096]step906, it is determined that there are attributes of the definitional element that can be bound to possible variables, processing continues atstep908. Atstep908, the variables that can be bound to the definitional element are determined. The possible variables are displayed for review by the user, for example, in a pop-up menu atstep910. Atstep912, the user selects a variable for binding. Atstep914, attributes of the definitional element are identified that can be bound to the selected variable. At step916 (i.e., a single pertinent attribute?”) a determination is made whether there is one fundamental attribute that matches the selected variable. If there are zero or more than one such attribute, processing continues at step926 to indicate that there is no suitable default binding. The user can elect to identify theattribute using Inspector310.
If it is determined based on the class of the variable that there is a single pertinent attribute of the definitional element that can be bound to the selected variable, processing continues at[0097]step918. At step918 (i.e., attribute fundamental to element), a determination is made whether the attribute is a fundamental attribute. If so, processing continues atstep920 to display the variable in the GUI to identify it as being bound to the definitional element. If not, processing continues atstep922. Atstep922, a message is displayed to identify the definitional element's attribute that was used in the binding. Processing ends atstep924.
The process flow in FIGS.[0098]9A-9B use a pop-up menu or other interface widget to display those variables that can be bound to the selected definitional element. Alternatively, a user can specify a binding usinginpsector window310. In this case, the user selects a definitional element instep902 and selects a variable as instep910. The user selects an attribute of the selected definitional element to bind to the selected variable frominspector window310.
Database BindingIn the guest book application, the guests array is populated from input received from users. A database can be the source of data that is used to populate the guests array. Fields of a database table can be bound to elements of a Web page such that data retrieved from a database is displayed in a Web page or data contained in a Web page is stored in a database.[0099]
FIG. 10 provides an example of binding to a database table according to an embodiment of the invention. Table[0100]1012 contains two columns, or fields: name and email.Entity1014 maps table1012 to an object class,class1006.Entity1014 can be created using a modeling application such as the EOModeler modeling application available from Apple Computer, Inc.Entity1014 maps columns in table1012 to attributes ofclass1006. The mapping information provided byentity1014 includes a mapping between the NAME column of table1012 and the name attribute ofclass1006. Similarly, the EMAIL column of table1012 is mapped to the email attribute ofclass1006.
[0101]Entity1014 is stored as part of the application (e.g., the guest application). Data is fetched from table1012 and stored in instances ofclass1006. A custom class, called a displayGroup class, can manage for display instances of an object class mapped to the database. For example, an instance of the displaygroup class,displayGroup1020, is created to manage for display the instances ofclass1006. For example, objects1008A-1008C are controlled bydisplaygroup1020.Objects1008A-1008C are instantiated using data from table1012. Thus, for example, objects1008A-1008C can contain the name and email information stored inrows1018A-1018C (respectively) of table1012. A description of object to databased mapping is provided in the Enterprise Objects Framework 2.0 Developer's Guide and is incorporated herein by reference.
The attributes or instance variables of[0102]class1006 are displayed (e.g., in a component window) and can be bound to a definitional element as previously discussed. Thus, an attribute of a definitional element can be bound to an attribute of an object containing data from a data source such as a database (e.g., table1012). As illustrated byline1022, the binding is performed via the displayGroup object instance (e.g., displayGroup1020).
The displayGroup class keeps track of all of the objects that it manages (e.g., allObjects). At runtime, the displaygroup monitors which object or objects are currently selected or displayed. A binding can be specified between an attribute of a definitional element and an attribute of an object class instance that is currently selected or being displayed. For example, a binding can be defined between the value attribute of[0103]element1040 and the name attribute of an object that is currently selected (e.g., object1008B whereobject1008B is a selected object at runtime). WheredisplayGroup1020 is referred to as guestDisplayGroup, the binding can be expressed as guestDisplayGroup.selectedObject.name.
The application developer can therefore bind dynamic elements of a Web page to attributes or instance variables of objects that are held by the displayGroup. In addition, a dynamic element can be bound to a method of[0104]displaygroup1020. For example, a method ofdisplayGroup1020 such as displayObjects can be bound to a repetition element. The following provides examples of possible methods ofdisplayGroup1020 grouped by the type of operation they perform:
Display Results MethodsThe “Display Results” methods give access to database objects and allow them to be displayed:
[0105] | |
| |
| allObjects: | All of the objects managed for display |
| | by displayGroup. |
| displayedObjects: | The subset of allObjects. |
| selectedObjects: | The objects in the current selection. |
| selectedObject: | A single selected object. |
| |
Managing Batches MethodsThe application developer can specify the number of records that are displayed on a Web page by setting numberOfObjectsPerBatch. Based on the numberOfObjectsPerBatch setting, the displayGroup changes the subset of allobjects for display (i.e., displayedObjects). The size of the subset is determined by the batch size specified (e.g., by the application developer). For example, if the numberOfObjectsPerBatch is set to five, displayedObjects initially identifies the first five objects in the set of allobjects as the displayed objects. The displayNextBatch results in the next five objects of the set of allObjects being identified as the displayedObjects.[0106]
The following are examples of batch methods
[0107] |
|
| displayPreviousBatch: | Select the previous batch of |
| objects and then reloads the page. |
| displayNextBatch: | Selects the next batch of objects and then |
| reloads the page. |
| batchCount: | The number of batches to display. |
| currentBatchIndex: | The number of the batch currently |
| displayed where 1 is the first batch |
| displayed. |
| numberOfObjectsPerBatch: | The number of objects that can be |
| displayed in a Web page. |
|
Query MethodsThe displaygroup object class can be used to construct and invoke a query on the information contained in a database. A query-by-example interface is used to specify the query. To construct a query in the guest application, for example, an empty form is displayed that contains a name and email address input field for entering guest information. A template object instance that is not tied to a row in the database is used to store input entered into an input field. The template object instance can be thought of as a dictionary of key value pairs.[0108]
The keys or properties of a template object instance are bound to attributes of a definitional element. For example, if a value attribute of a definitional element used to generate an input field of an input form is bound to a property of a template object such as name and a user enters a value in the field, the user input is stored in the template object as name. To construct a query, the displaygroup instance (e.g., guestDisplayGroup) accesses the information stored in the template object to construct a qualifier (e.g., selection criteria) for use in querying the database (e.g., table[0109]1012).
Methods of the displaygroup (e.g., inputObjectForQualifier and secondObjectForQualifier) return a template object to which the user interface fields can be bound. When either the inputObjectForQualifier or secondObjectForQualifier is selected in[0110]object browser312, the attributes of a template object are displayed (e.g., the name and email attributes oftemplate object1050 are displayed when inputObjectForQualifier is selected). In defining the input form,elements1040 and1042 are created as a textField definitional elements that generate HTML INPUT fields at runtime.
[0111]Elements1040 and1042 are bound totemplate objects1050 and1052 viadisplaygroup1020. Where displaygroup is named guestDisplayGroup, the bindings are expressed as (respectively):
“guestDisplayGroup.inputObjectFor Qualifier.name”[0112]
“guestDisplayGroup.secondtObjectForQualifier name”[0113]
The bindings are shown graphically in FIG. 10. The value attributes of[0114]elements1040 and1042 are bound to the name attributes oftemplate objects1050 and1052 (respectively). Template objects1050 and1052 is used to store input entered into an input fields and are not tied to records in table1012.
When all query fields having values are only in inputObjectForQualifier (i.e., none in secondObjectForQualifier), a qualifier is constructed using equality or LIKE pattern matching. For example, when a value is specified for a name attribute of[0115]element1040, a select statement is generated that includes the clause “where name=user input.” A pattern such as “%@*” can be specified for the displayGroup. The pattern is used to generate the where clause for string pattern matching. The “%@” portion of the pattern specifies the location of the user input and the “*” is a wild card. Thus, the pattern is “user input*”. For example, if the user input is Bill, the where clause that is constructed is using the “%@*” pattern matching is “where name LIKE Bill*”. Where more than one attribute of a template object has a value, a where clause is constructed that tests for each attribute that has a value.
A range (i.e., “from” “to”) can be specified by binding two template objects to two definitional elements. For example, inputObjectForQualifier is bound to one definitional element and secondObjectForQualifier is bound to a second definitional element. Referring to FIG. 10,[0116]element1040 is bound to atemplate object1050 andelement1042 is bound toelement1054 viadisplayGroup1020. When a user inputs a “from” name using the input field ofelement1040, the value is stored intemplate object1050. A “to” name input using the input field ofelement1042 is stored intemplate object1054. The executeQuery method constructs a selection criteria that specifies a range using the “from” and “to” name values. For example, if the name attributes oftemplate objects1050 and1054 contain the values “Jones” and “Smith”, the where clause that is generated is “where name>“Jones” and name <“Smith”.
The following are examples of methods used to perform queries:
[0117] |
|
| executeQuery: | Builds a qualifier using |
| inputObjectForQualifier and the pattern |
| matching set in the displayGroup |
| options panel, and fetches the records |
| that match the qualifier. |
| inputObjectForQualifier: | Returns an entity object that is used to |
| create the qualifier. |
| secondObjectForQualifier: | Used for from-to queries to specify the |
| “to” value. |
|
Database Modification MethodsThe following are examples of methods used to modify the database:
[0118] | |
| |
| insert: | Adds a new empty record. |
| delete: | Deletes the selected records. |
| |
A displayGroup is associated with a change tracking object. The change tracking object monitors the changes that are made to the data. To perform a commit, the displayGroup instance sends a save request to the change tracking object. The changed data stored in an object is written to the database.[0119]
Thus, a method and apparatus for binding user interface objects to application objects has been provided.[0120]