JavaFX Technology Preview __java

Source: Internet
Author: User
Tags memory usage silverlight
JavaFX Technology Preview

Author Charles Humble translator Trikon posted on November 24, 2008 1:35 A.M.


The success of Java can be attributed to the fact that it is a very good common language in the field it faces. Java is a good choice for typical long-running server-side programming in modern enterprise computing, and other aspects such as mobile development that supports cross-platform, stability, and security. But for some programming tasks that require a degree of expertise, Java is no more appropriate than all common languages. For example, challenge the technology and management of modern GUI design. Related Vendor Content

SOY Framework:java Rich Client rapid development framework

Infoq Chinese station readers exclusive 60 percent SD2C technical conference tickets, immediately snapped up

Salon: GlassFish's OSGi Modular Architecture analysis (11.29 Hangzhou)

From an administrative standpoint, a fluent, complex user interface often requires a number of different roles--image artists, information architects, animators, and programmers. Although some people can take up all the responsibilities, such people are definitely a minority. Generally speaking, the entire development process requires the involvement of different staff, and the flow of resources between designers and developers is often a big problem. Technically, modern UI design requires a high level of technical knowledge. A complex toolkit like swing provides developers with a complex set of controls, but it takes a lot of time for developers to learn how to use them when creating a UI. In addition, the responsiveness of the interface is largely dependent on concurrency. This in itself is not a problem--java multithreaded programming is simple--but with it comes a lot of fixed code for managing transformations and animations.

Sun, with JavaFX involved in rich Internet applications, declared war on Adobe Flex and Microsoft's Silverlight. JavaFX is undoubtedly one of Sun's strategies for Java developers to solve related problems. Its goal is to provide a platform for creating rich Internet applications across desktops, the Internet, and mobile devices, as well as a major shift in the Sun's Java family, which is no longer focused on the underlying technology, but is starting to create a complete solution. The current technology preview includes two main components: the Nile project that focuses on the designer/developer workflow and the JavaFX script--a new descriptive language for writing Java GUI applications (declarative language).

Both flex and Silverlight choose XML as their own descriptive language (using Mxml and XAML, respectively), while Sun chooses to recreate a new scripting language--javafx script. Sun's senior engineer Joshua Marinacci told us that Sun is not going to add support for XML language: "We find that many developers hate XML, and they want a more concise descriptive syntax that optimizes the graphical interface." We believe developers who are familiar with JavaScript will find JavaFX script very handy. ”

JavaFX script is a descriptive, statically typed, compiled, domain-specific language (DSL) built on Java Standard and miniature versions, using Java packets from the JavaFX environment to create the user interface. It focuses on two groups of users: a Java developer who is familiar with swing but is still looking for a faster and more efficient way to create a rich-functionality interface. Web developers who are familiar with other scripting languages, such as JavaScript or ActionScript.

JavaFX script is highly efficient and has some very handy features for inserting and deleting operations (for example, insert before x[1]; It also addresses many other common problems, such as the ease with which a UI component can be bound to a background database, and it triggers the corresponding event with a simplified mechanism like a listener, called an event trigger, to change the value of a variable.

Sun in the language of the readability of hard to make it easy to grasp, easy to read. One result of this is that they use Boolean operators similar to basic in Java and JavaScript rather than C-style operators. Therefore, JavaFX script replaces && with "and", substituting "or" for | |. In addition, it can support both "not" and "!". It doesn't take a lot of time to get used to this, but I do find that a lot of customers are surprised.

There are other aspects of JavaFX script that are also surprising. For example, it supports the use of reserved words to create functions or variables, but it requires the use of French quotes to eliminate the original meaning-for example, AR <<while>> = 100--rather than through situational analysis to judge. For example, JavaFX script chooses to support multiple inheritance without using Java interface. Marinacci explained: "In the GUI environment, we find that using multiple inheritance can simplify many tasks." In most cases, developers do not need to use the Create subclass, so this is not a big problem. The application of subclasses is mainly focused on component development. ”

JavaFX borrowed and augmented some of the Java ideas from it. It is worth mentioning that Javafxdoc has made necessary updates to the documentation tools on the basis of Javadoc. Javafxdoc discards HTML, chooses to generate XML-formatted documents, and then converts them to other output formats. The current format is XHTML1.0. This two-step strategy preserves the potential for future support for other formats such as PDFs or the creation of databases that store knowledge. The new output format does not use a frame and can be easily formatted with CSS. It also makes basic filtering for each profile-for example, the JavaFX API is divided into general, desktop, and mobile profiles, which filter documents correctly. Here's an example. Another feature that can embody efficient development is the Javafxdoc build internal samples through the @examples identity. The sample code is highlighted automatically according to syntax, and then the document tool compiles and executes the sample to post the results to the document, providing a way to automatically update the document screenshots.

We also talked with Marinacci about the future development plan for the tool, and he confirmed that Sun was developing a search solution, but the 1.0 version would not be available. Updates to the core Javadoc tools are currently tentatively released in Java 7, and he believes that the development of the future version of Javadoc will draw lessons from Javafxdoc. JavaFX script can access all existing Java packages, and it also contains some new APIs. Two of the key APIs are the media APIs (currently available as native library versions, in version 1.0 will be replaced with ON2 truemotion video codecs) and the scene graphics API. The Scenario graphics API reflects a shift in the way that developers who have a swing technology background often think about the GUI. The GUI here represents a series of layers of visual nodes that make up the scene and interact with the user. The scene image model supports effects, arbitrary transformations (scaling and rotation), and animations. The scene graphic retains the drawing object, which, whenever the page refreshes, will redraw the graphics, hiding the details of the process, caching, and other immediacy API issues like java2d. This level of abstraction also allows the API to perform a variety of optimizations, such as preload textures and graphics card prototypes. The scene graphics API is closely associated with JavaFX, but you can also apply it in common Java programs.

Sun has divided the API into 3 types of profiles, currently available in two ways: the generic Profile API can be used on all devices, including the scene graphics API and the media component, while desktop profile is more akin to swing components. The third is mobile profile, which is expected to be released in 2009 and may be a complete application stack for mobile device developers, although there is no detailed public information available.

By the time this article was written, there were one or two major omissions in the generic API-for example, there are no objects in the JavaFX preview that are the same as table, TabbedPane, textarea, or Bookpanel. The 1.0 edition should be more complete. Marinacci told us: "We plan to migrate swing components to subclass nodes, and then we are free to mix swing components and graphics nodes without needing to use the adapter class." Currently, advanced classes, such as trees and tables, are available only on desktop systems. ”

Developing a new language instead of following Adobe's leadership is a bold attempt, and I think it's a good decision. JavaFX script works well, and there are other possible uses beyond the current application-for example, the JavaFX data Format (FXD), a key part of the Nile Project, which uses a subset of the JavaFX script description character to represent the graphical resource.

Microsoft has provided a special toolbox (expression Toolkit) for Silverlight to directly convert the output files of Adobe's Creative suite. Sun is also developing its own tools (expected next year), and they decide to support the current popular tools through the Nile project, with Adobe Illustrator and Photoshop taking the brunt of these tools.

The Nile Project supports OS X and Windows, which includes plug-ins specifically for Adobe Illustrator and Photoshop CS3, an SVG conversion tool, and a JAVAFX data format (FXD) viewer. Designers of adobe Tools can create graphical resources as usual, and finally output in FXD format. Users can browse the graphics file through the viewer to verify that the output files are as expected. Developers can also access and process individual layers that make up a graphical resource file by JavaFX the scripting language. These operations are good for processing graphics resources, but customizing styles to basic components is still a problem. Sun is currently working on how to use CSS to wrap swing components, which is one of the goals of the plan in JavaFX version 1.0.

All of this work is done on the basis of Java 6 Update 10 (the official name is the consumer JRE project)-Improvements to deployment, performance, memory usage, and built-in sense (Nimbus) will help drive swing to develop desktop applications efficiently. Unfortunately, these improvements are still limited for developers at the moment. Although Sun has released Windows, Linux, and Solaris versions of Update 10, these editions are in the applet quickstarter, kernel installation files, and Direct3D The pipeline (Windows platform only) approach is completely different. In addition, Apple has limited Java 6 on all 64-bit Intel Mac OS X 10.5. Marinacci also confirmed to us that Sun was working with Apple to improve Java and JavaFX's support for OS X, but did not disclose any details. He also provided us with the latest download statistics: "The JRE has an average of 400.05 billion downloads per month, and some months will reach 100 million." These downloads 95% are javase 6. After a few months of Javase 6 Update 10, it will turn on Automatic updates, and we expect to see similar data. According to Omniture's statistics, 91% of the computers connected to the Internet are installed with Java. ”

Both Flash and Silverlight are proprietary tools for fully enclosed code and are a huge hurdle for some developers to use. Because many of the key codes in Flash, such as audio and video decoders, are licensed by third parties, Adode makes it difficult to open the Flash platform as easily as sun-open java. Although the license has not yet been finalized, Sun is trying to release JavaFX as open source software, and now they have published compilers and scene graphics APIs under the GPL v.2 license. Open source may significantly improve the penetration of the JavaFX platform, however, JavaFX has a lot of important work to do to be a strong competitor.

View English Original: Java FX Technology Preview.

Turn from: Http://www.infoq.com/cn/articles/jfx_preview

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.