![]() | ||||||||||
![]() | ![]() | |||||||||
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
The promise of DHTML is a simple yet powerful page description language. One with better
control over style and placement than HTML, and with real programmability. WFC encapsulates
the DHTML document object model into a handful of easy to use Java classes.
Background
How?
Sample Code
Two classes are implemented, Module1 and Class1. The WFC framework defines these objects and their
functions. Examine the following HTML:
IE loads our Module from the CAB file like any other object via the OBJECT tag.
In this case its WFC's DhModule class. We pass Class1 as the CODECLASS parameter and
all of the code transports from our CABBASE parameter in a single connection.
Upon loading, we bind the first two elements and hide them. We then replace the
third parameter with our Application title. The content and event handlers are set in Class1's
initForm() method. Sound familiar?
In this case the UI is defined entirely in code. We even create a table programmatically for your
enjoyment. However, in most production applications you will probably have designers and
copywriters use ID's in their HTML to define specific blocks of content. As the team's
developer you will create the event handlers and logic that drive the application and
dynamically modify, hide, and display these blocks.
We'll use a table to contain most of our new elements. This is done to reinforce
that Tables can contain only Rows and Rows can contain only Cells. Cells can contain anything.
We implement context-sensitive help in tool tips and display a real Windows MessageBox on
document load. The button click refreshes our CVP analysis.
Conclusion
DHTML is primarily about STYLES (the look, positioning, and layering of content),
DIVisions (fine granularity of what's what), and CONTROL. Control is
where WFC breaks new ground. In the past DHTML pretty much meant some sort of
scripting language (Javascript, VBscript). Well, it was possible to use C++
via COM, but few did. With WFC you can deliver self-contained DHTML applications written
completely in Java. Even better, these applications can be separated from their
content and graphic design. Writers and Designers control their respective pieces while
the developer codes application logic. The application logic remains in Java and is
available to the enterprise.
ID's tie it all together. You specify containers in the HTML using DIV and
SPAN tags. These elements can then be bound and accessed by Java. That's about all the
HTML you'll need to know as a Java developer. WFC unifies DHTML with the Win32 API.
The same familar methods are all there along with the same event handling,
the same accessor/mutator methods, the same Color handling, etc. All of the page
elements can be defined in Java and the web page existing only for hosting and loading.
Think about that.
The sample presented here uses DHTML's interactive nature to change the contents of a page
without a round trip to the server. It responds to user input and calculates the profit
or loss of a hypothetical web site. As you can see it isn't easy money.
What's new? Nothing really. First, we display some HTML explaining the system requirements
and where to get the necessary components. We use the SPAN tag as an HTML container.
This container defines an "object" that we can later access within our code.
Next up, a link. Since that's already a tag, we can contain it using the ID option of HREF.
Lastly, another Text Block also defined in a SPAN.
This page requires the Microsoft. Virtual Machine for Java, Version 5.00.2910 or greater,
and the Microsoft Windows. Foundation Classes (WFC) for Java. If nothing happens
15 seconds after this page finishes loading you should use the following link to
Upgrade your Java VM.
Loading Cost-Volume-Profit analyzer, please stand by...
DHTML is very powerful. That power has been restricted by the fact that most
HTML-jockeys and especially Graphic Designers are not programmers. WFC wraps the
complexity of DHTML in Java and does so in such a way that it starts to look and feel
like Java. At the same time it leaves the actual DHTML templates and Cascading Style
Sheets under the control of Designers and Copywriters. Enjoy!
Last updated: September 16, 1998
) 1998 Microsoft Corporation. All rights reserved. Terms of Use.