Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
Difference between revisions of "XWT Documentation"
(→Getting started) |
|||
Line 8: | Line 8: | ||
= Getting started = | = Getting started = | ||
+ | Here is a simple example. | ||
+ | <source lang="xml"> | ||
+ | <Shell xmlns="http://www.eclipse.org/xwt/presentation" | ||
+ | xmlns:x="http://www.eclipse.org/xwt"> | ||
+ | <Shell.layout> | ||
+ | <FillLayout/> | ||
+ | </Shell.layout> | ||
+ | <Button text="Hello, world!"> | ||
+ | </Button> | ||
+ | </Shell> | ||
+ | </source> | ||
+ | |||
+ | The same UI can be developed in Java corresponding: | ||
+ | |||
+ | <source lang="java"> | ||
+ | Shell parent = new Shell(); | ||
+ | parent.setLayout(new FillLayout()); | ||
+ | Button button = new Button(parent, SWT.NONE); | ||
+ | button.setText("Hello, world!"); | ||
+ | </source> | ||
+ | [[Image:XAMl4SWT_HelloWorld.png]] | ||
+ | |||
+ | To load and start a simple application, we use the class XWT: | ||
+ | <source lang="java"> | ||
+ | Shell shell = XWT.load(file).getShell(); | ||
+ | shell.pack(); | ||
+ | shell.open(); | ||
+ | while (!shell.isDisposed()) { | ||
+ | if (!shell.getDisplay().readAndDispatch()) { | ||
+ | shell.getDisplay().sleep(); | ||
+ | } | ||
+ | } | ||
+ | </source> | ||
+ | |||
+ | It is possible to load a UI resource under a Composite: | ||
+ | <source lang="java"> | ||
+ | XWT.load(parent, uri); | ||
+ | </source> | ||
+ | |||
Tutorial: [http://dev.eclipse.org/blogs/yvesyang/2009/01/17/xwt-getting-started/ Hello, world!] | Tutorial: [http://dev.eclipse.org/blogs/yvesyang/2009/01/17/xwt-getting-started/ Hello, world!] | ||
Revision as of 06:40, 8 July 2009
What it is?
XWT is a declarative UI designed for Eclipse. It is a powerful and lightweight framework. It uses XML as UI markup language.
XWT simplifies UI programming. You can create visible UI elements in the declarative XML markup with a physical separation of the UI definition from the run-time logic. An XML based declarative language is very intuitive for creating interfaces ranging from prototype to production, especially for people with a background in web design and technologies.
Contents
Getting started
Here is a simple example.
<Shell xmlns="http://www.eclipse.org/xwt/presentation" xmlns:x="http://www.eclipse.org/xwt"> <Shell.layout> <FillLayout/> </Shell.layout> <Button text="Hello, world!"> </Button> </Shell>
The same UI can be developed in Java corresponding:
Shell parent = new Shell(); parent.setLayout(new FillLayout()); Button button = new Button(parent, SWT.NONE); button.setText("Hello, world!");
To load and start a simple application, we use the class XWT:
Shell shell = XWT.load(file).getShell(); shell.pack(); shell.open(); while (!shell.isDisposed()) { if (!shell.getDisplay().readAndDispatch()) { shell.getDisplay().sleep(); } }
It is possible to load a UI resource under a Composite:
XWT.load(parent, uri);
Tutorial: Hello, world!
Webdemo: Getting started!
Event Handling
Integration with existing application
Binding and Data Binding
Reusable Component
This tutorial will shows how to develop a reusable UI component.