Creating a declarative XML UI language

Source: Internet
Author: User
Tags object model adobe shockwave

Writing a GUI with programming code often leads to confusing design, which in turn leads to confusion between business logic and UI code. This article explores how to create a collection of declarative XML UI tags with a companion Java™ framework that resolves, constructs, and ultimately binds a declared GUI component to the business logic at run time.

Brief introduction

GUI development can be a daunting task. The GUI framework does not always have good documentation, and the amount of code needed can grow rapidly, slowing the development workflow. In particular, drag-and-drop tools and Ides that support these GUI frameworks often entice GUI software developers to create code that is difficult to manage and read. This may further confuse the boundaries between business logic and GUI description code, making software maintenance more difficult.

Common abbreviations

API: Application Programming Interface

DOM: Document Object Model

GUI: Graphical user interface

HTML: Hypertext Markup Language

IDE: Integrated development environment

Jar:java Compressed Documents

UI: User Interface

URI: Uniform Resource Identifier

XML: Extensible Markup Language

Xsd:xml Mode Information Set model

World Wide Web Consortium: WWW Consortium

This is why declarative UI languages are convenient. The UI language describes what is, not how. For example, HTML describes what is displayed, rather than describing the rendering function used to render the content. The declarative language does not specify "how to", thereby omitting the control flow. Although this omission may sound like a limitation, it is actually an advantage because the side effects of the control flow-such as modifying a global state (such as a variable) or calling another function or method-are eliminated. Choosing a declarative language also facilitates separating the UI code from the application code. This separation will also provide some benefits, such as a clear distinction between project and team roles, which may even reduce the cost of integration between business logic and multiple views or view technologies.

There are a few examples of declarative XML UIs that are currently in use. The linux® and UNIX® operating systems that use the GNOME desktop environment have Glade. microsoft®windows® users have extensible Application Markup Language (XAML), which supports rich functionality, including inserting code into XML. The Adobe®flex®framework mxml format describes the GUI for Adobe Shockwave (SWF) players and contains code inserts. See the links in resources for more information.

The necessary components of a basic declarative UI framework in Java technology may include:

Validation: Using XML Schema

A DOM: A custom DOM that handles specific matters, such as synchronizing GUI component State and XML node state

Persistence: GUI marshalling (marshalling) and reconciliation Group (unmarshalling)

Image data: stored as BASE64 data

Swing components: GUI Development The representation of commonly used swing components

You can create declarative XML by remembering the necessary components in the creation process.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.