UIX Developer's Guide |
Contents |
Previous |
Next |
Different parts of UIX can be used to develop different parts of a web application, which means you can take advantage of only those UIX features you need. This chapter provides a brief introduction to the various UIX features and technologies. It contains the following sections:
You can develop UIX applications using any of the following development environments.
Java. UIX includes Java classes and APIs for developing a UIX application entirely in Java. All UIX classes are located in the oracle.cabo
package and its subpackages.
uiXML. uiXML is an XML dialect for developing UIX applications declaratively, using uiXML elements. This is the recommended means for developing in UIX. (See More About uiXML, below, for more information about uiXML.)
JSP tags. UIX also incudes a Java Server Pages (JSP) tag library for those who prefer to work with JSPs.
uiXML and Java examples are provided throughout this manual. For information about using the UIX JSP tag library, see the chapter UIX JSP Tag Library.
UIX contains two main areas of functionality: UIX Components, for defining and rendering pages in a user interface, and UIX Controller, for managing events and the interaction among pages in an application.
UIX Components includes a set of user interface components and the means for rendering them:
The user interface components are implemented as Java Beans. They include page layouts and simple user interface objects that map to standard HTML controls, such as buttons, forms, and checkboxes. They also include composite components, such as trees, hide-show controls, lists of values (LOVs), and shuttles. All UIX components have built-in capability for localization, accessibility support, and a consistent look and feel.
The renderers are Java classes for rendering the user interface components to target clients or devices. These components are rendered differently depending on the target; for example, they can be rendered as HTML for use in web browsers or as WML (Wireless Markup Language) for use in mobile devices. In their base implementations, the renderers generate HTML with the visual and behavioral characteristics of the Oracle Browser Look and Feel (BLAF). UIX will include other look-and-feel implementations in the future, and it is possible to create your own. You can add to the set of renderers—or even replace them—without making any modifications to the page or component definition. UIX renderers also contain built-in support for multiple locales and languages.
The Java code and classes supporting UIX Components are in the oracle.cabo.ui
package and its subpackages.
UIX also includes utilities for dynamically generating images (see UIX Dynamic Images, below) and cascading style sheets (CSS) (see UIX Styles, below) . These utilities together with the renderers make UIX user interfaces portable across different locales, fonts, and browsers.
UIX Controller is a J2EE-based servlet that is the central processing module of UIX. It is responsible for receiving, processing, and dispatching web requests (events), and it manages the navigation among the pages in an application. Typically, the controller executes application and business logic in response to an HTTP request and then updates the application state accordingly. As a result of this processing, the controller renders a page in the browser.
UIX Controller standardizes the way applications deal with HTML events and provides built-in services such as error page loops, login support, and file uploading. While it operates independently of the technology used to render individual pages--such as UIX Components, JSPs, or Extensible Stylesheet Transformations (XSLT)--it has built-in support to ease development when technologies like UIX Components are used.
The Java code and classes supporting UIX Controller are in the oracle.cabo.servlet
package and its subpackages.
UIX includes other features, utilities, and supporting classes, which provide further control and flexibility for creating web applications:
UIX Dynamic Images provides a means for generating images that contain text, including built-in support for buttons and tabs. It can colorize the images of an application to support color schemes, as well as provide localization and accessibility support and provide caching support for improved performance. UIX Dynamic Images generate images and, for those who need them, image maps.
Because text is processed separately from images, localization with UIX Dynamic Images is easier and more efficient. Translators work only with text and do not have to edit images. The translated text can be stored separately (for example, in resource files) and extracted when needed, to be combined with the image. Separating text and image processing in this way also makes it possible to use different text styles and sizes for special purposes, such as increasing the size of the text for complex characters such as Kanji, or to adjust visual attributes for people with some visual impairment, for example color blindness.
The Java code and classes supporting UIX Dynamic Images are located in the oracle.cabo.image
package and its subpackages. UIX Components can use UIX Dynamic Images for their own rendered images.
UIX Styles provides an architecture for defining and customizing style sheets for different end user environments (for example, locales, browsers, or platforms). Style sheets provide a centralized mechanism for defining and altering the appearance of pages separate from the content they contain.
UIX Styles include a new XML Style Sheet Language (XSS) for defining environment-specific style sheets. XSS is based on Cascading Style Sheets (CSS). UIX Styles also feature server-side APIs for managing style information, including a facility to generate CSS style sheets dynamically at runtime.
The Java code and classes supporting UIX Styles are located in the
oracle.cabo.style
package and its subpackages. UIX Components and UIX Dynamic Images
can use UIX Styles for their own style information.
All UIX projects depend on common utility classes provided UIX Share. The UIX Share classes include functionality that is useful to all UIX web applications, such as configuration support and localization. The Java code and classes supporting UIX Share are located in the
oracle.cabo.share
package and its subpackages.
uiXML is an XML language for programming UIX applications. uiXML builds on top of the other UIX technologies, providing an XML language for specifying user interfaces and linking them to data and events. uiXML provides a declarative alternative to creating web applications programmatically with the UIX Java APIs. The pages, events, and any other items defined with uiXML elements are all transformed into Java objects behind the scenes and are thus treated equally by UIX. No compilation is required.
Here is an example of a uiXML element that defines a button:
<button text="Policy"
destination="http://www.mycompany.com/policy"
disabled="false"/>
The following uiXML defines an event handler.
<handlers>
<event name="goto">
<navigate parameter="value">
<when value="1" page="first"/>
<when value="2" page="second"/>
<when value="3" page="third"/>
</navigate>
</event>
</handlers>
The fact that uiXML is an XML language influences aspects of its design:
uiXML documents are written in a text format, with each document representing a UIX page, or a subset of a page to be included in other pages.
uiXML pages are often stored as files with the file extension .uix
. This is not a requirement, however; a uiXML document could exist entirely in memory on a server and never have a file system counterpart.
uiXML documents must be well-formed and valid, as defined by XML standards.
A well-formed uiXML document complies with all of the XML syntax requirements, such as that every element start tag must have a corresponding close tag (unless it uses the abbreviated element form). These syntax rules are found in the XML version 1.0 standard.
A uiXML document is valid if it follows the semantic rules defined for each
element. For example, if uiXML rules indicate that a <foo>
element
must have exactly one <bar>
child element and no attributes, then any
<foo>
elements in the document must comply with those rules for the
document to be valid.
The rules, or grammar, for uiXML documents are defined in schemas. Schemas are XML documents written to the XML Schemas standard for defining XML grammars (see www.w3.org/XML/Schema). Schemas are an alternative to Document Type Declarations (DTDs), which use a nonXML format for defining grammars.
The schemas that describe uiXML elements have the file extension .xsd
, and they are found in the oracle\cabo\ui\xml\schemas
directory of a UIX release. uiXML documents must follow the rules in these schemas in order to be valid. However, UIX includes documentation and tools to help you write compliant uiXMLs documents without ever looking at or understanding the schemas themselves.
The Java code and classes supporting uiXML are located in the oracle.cabo.ui.xml
and oracle.cabo.servlet.xml
packages and their subpackages.
Because the UIX technology stack is open and flexible, you have the choice of using as many of its features as you need. It is important to note, however, that the various UIX technologies are designed to work together. This means that one UIX technology can make it easier to use another. For example, UIX Controller automatically creates and caches the pages specified in uiXML because it has built-in support for this. If you use uiXML without UIX Components, you will need to write some code to load in your uiXML document and display it. Conversely, if you use UIX Components without uiXML, you may have to write some code telling the UIX framework how to display your own pages.
That said, here are some recommendations for which technologies to use:
If you are starting a new web application from scratch...
Use UIX Controller to manage application flow and use UIX Components and uiXML to specify page layouts and events. This allows you to get the most functionality from UIX with the least work.
If you cannot replace your existing application flow management technology, but you have flexibility on your page rendering...
Use UIX Components and uiXML to create and render your pages. This allows you to get the advantages of UIX Components (agent-based rendering architecture, high level page beans, localization, etc.) even if you can't use the entire UIX stack. Keep in mind, however, that some of the UIX Controller code might still be useful to your server-side flow management, even if you do not adopt UIX Controller entirely. For example, UIX Controller includes utility code for handling file uploads that is generally useful for Java servlet-based applications.
If you have existing pages (JSPs or dynamic HTML) that you need to manage via a servlet...
Use the UIX Controller servlet to manage logins, handle errors, and provide other utilities that are missing from the basic servlet architecture. This will also make it easier to include additional pages based on UIX Components later on.
If you have some existing pages designed with HTML or JSPs, but need to implement new pages for your application...
Use UIX Components and uiXML for all your pages. This is possible because UIX Components and uiXML provide easy ways to intersperse other content such as existing JSPs and HTML on the same page using its passthrough capability. Doing so gives you the opportunity to consolidate your pages on one technology later on and transition as you go.
If you would like to use UIX Components beans, but are already using Java-based page rendering for other parts of your page(s)...
You can still use UIX Components on a page through the Java web bean classes. The generated output can be merged into your existing Java-generated page output. The decision to also use UIX Controller for page management is independent of this choice.
If you cannot change your current page rendering technology, but you need localizable images in your web application...
Use UIX Dynamic Images to generate images including text that are localized.
If you cannot change your current page rendering technology, but you need style sheets for your product that are tailored to each viewer's browser, locale, or preferences...
Use UIX Styles to generate and cache individual style sheets based on variants.
Although nearly all parts of UIX project are accessible to developers, there are a few small areas which should be avoided by those using Java APIs to access the functionality. Specifically, a few classes have compatibility restrictions on them beyond those enforced by the API access level. Compatibility of these classes is not guaranteed in future UIX versions; using them may cause your code to break if you upgrade.
You should avoid directly calling the oracle.cabo.ui.laf.LookAndFeel
class or any classes in the oracle.cabo.ui.laf.*
subpackages. These
classes contain internal rendering code which is not guaranteed to maintain backwards compatibility.
If you are writing Javascript code and are using the existing Javascript libraries in UIX, you should not use any methods prefixed by an underscore ("_"). This a convention to indicate an internal, private function that is subject to change. JavaScript itself does not provide this ability to restrict.
Finally, if you intend to completely customize or change UIX, you should not directly implement the following interfaces:
oracle.cabo.ui.Renderer
oracle.cabo.ui.UINode
oracle.cabo.ui.RenderingContext
oracle.cabo.ui.io.OutputMethod
You may notice that names such as "Cabo," "Baja," and "Marlin" are used as part of some UIX file names, package names, and class names. These are a legacy of the early code names for these projects. They have no inherent significance. However, they are retained to maintain backward compatibility.