古风网站的关于我们页面怎么做,wordpress相册灯箱,北京做网站男生工资,域名历史记录查询网站SmartGWT简介 我最近开始使用SmartGWT #xff0c;它是一个基于GWT的框架#xff0c;该框架为您的应用程序UI提供了一个全面的小部件库#xff0c;并为服务器端的数据管理提供了帮助。 您可以在SmartGWT展示柜上查看其漂亮的功能。 我准备了一个简短的“入门”指南#xf… SmartGWT简介 我最近开始使用SmartGWT 它是一个基于GWT的框架该框架为您的应用程序UI提供了一个全面的小部件库并为服务器端的数据管理提供了帮助。 您可以在SmartGWT展示柜上查看其漂亮的功能。 我准备了一个简短的“入门”指南介绍如何将库与GWT项目集成假设您已经安装了GWT SDK和Eclipse的Google插件 。 请注意Smart GWT与GWT 1.5.3GWT 1.6.4GWT 1.7.x和GWT 2.0.x兼容。 创建GWT项目 第一步是从下载部分下载库。 我将在本教程中使用的版本是2.1直接从此处下载。 解压缩ZIP文件并在新目录中找到框架的文档一些示例“ Hello World”示例以及必要的JAR文件。 在新的浏览器选项卡中打开JavaDocs 。 接下来我们在Eclipse中创建一个新的“ Web应用程序项目”。 为项目选择适当的名称并选择适当的包装。 确保选中“使用Google Web Toolkt”复选框不需要Google的App Engine因此请不要选择该复选框。 该向导将如下所示 添加SmartGWT库 创建项目框架之后浏览文件系统到项目位置然后创建一个名为“ lib”的新文件夹。 将解压缩的ZIP中的“ smartgwt.jar”文件复制到新创建的文件夹中并在Eclipse中刷新项目以便新文件显示在此处。 然后配置项目的类路径以包含JAR文件“项目”→“属性”→“ Java构建路径”→“添加JAR”…。 到目前为止的标准东西。 Eclipse中的扩展项目应如下所示 然后编辑模块xml文件名为“ SmartGWTIntroProject.gwt.xml”并在标准“继承”声明之后添加以下行 inherits namecom.smartgwt.SmartGwt/ 模块xml文件将是 ?xml version1.0 encodingUTF-8?
module rename-tosmartgwtintroproject
!-- Inherit the core Web Toolkit stuff. --
inherits namecom.google.gwt.user.User/!-- Inherit the default GWT style sheet. You can change --
!-- the theme of your GWT application by uncommenting --
!-- any one of the following lines. --
!-- inherits namecom.google.gwt.user.theme.standard.Standard/ --
!-- inherits namecom.google.gwt.user.theme.chrome.Chrome/ --
!-- inherits namecom.google.gwt.user.theme.dark.Dark/ --!-- Other module inherits --inherits namecom.smartgwt.SmartGwt/!-- Specify the app entry point class. --
entry-point classcom.javacodegeeks.smartgwt.client.client.SmartGWTIntroProject/!-- Specify the paths for translatable code --
source pathclient/
source pathshared//module 这使GWT知道您的应用程序将使用SmartGWT库。 更新“ com.google.gwt.user.theme.standard.Standard”声明应像上面一样被删除或注释掉因为它与某些SmartGWT样式冲突。 之后在“ war”文件夹中找到主HTML。 编辑它并在编译的模块声明之前添加以下行 scriptvar isomorphicDirsmartgwtintroproject/sc/;/script 更新从2.2版开始不再需要定义isomorpihcDir值。 查看Smart GWT 2.2的发行说明 。 但是对于本教程使用2.1版需要声明。 在同一文件中向下滚动并找到以下几行 td idnameFieldContainer/td
td idsendButtonContainer/td 将其替换为以下内容 td idformContainer/td
td idbuttonContainer/td 这些是将包含文本项HTML元素以及稍后将添加的按钮。 完整HTML文件如下 !doctype html
!-- The DOCTYPE declaration above will set the --
!-- browsers rendering engine into --
!-- Standards Mode. Replacing this declaration --
!-- with a Quirks Mode doctype may lead to some --
!-- differences in layout. --html
head
meta http-equivcontent-type contenttext/html; charsetUTF-8!-- --
!-- Consider inlining CSS to reduce the number of requested files --
!-- --
link typetext/css relstylesheet hrefSmartGWTIntroProject.css!-- --
!-- Any title is fine --
!-- --
titleWeb Application Starter Project/title!-- --
!-- This script loads your compiled module. --
!-- If you add any GWT meta tags, they must --
!-- be added before this line. --
!-- --
scriptvar isomorphicDirsmartgwtintroproject/sc/;/script
script typetext/javascript languagejavascript srcsmartgwtintroproject/smartgwtintroproject.nocache.js/script
/head!-- --
!-- The body can have arbitrary html, or --
!-- you can leave the body empty if you want --
!-- to create a completely dynamic UI. --
!-- --
body!-- OPTIONAL: include this if you want history support --
iframe srcjavascript: id__gwt_historyFrame tabIndex-1 styleposition:absolute;width:0;height:0;border:0/iframe!-- RECOMMENDED if your web app will not function without JavaScript enabled --
noscript
div stylewidth: 22em; position: absolute; left: 50%; margin-left: -11em; color: red; background-color: white; border: 1px solid red; padding: 4px; font-family: sans-serifYour web browser must have JavaScript enabled
in order for this application to display correctly.
/div/noscripth1
Web Application Starter Project/h1table aligncenter
tr
td colspan2 stylefont-weight:bold;Please enter your name:/td
/trtr
td idformContainer/td
td idbuttonContainer/td
/trtr
td colspan2 stylecolor:red; iderrorLabelContainer/td
/tr/table/body
/html 创建应用程序入口点 通过Eclipse创建GWT时会创建许多自动生成的文件。 其中之一是“客户端”包中的主要Java文件该文件用作应用程序的入口点。 因此删除生成的代码并添加以下内容 package com.javacodegeeks.smartgwt.client.client;import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.ui.RootPanel;
import com.smartgwt.client.util.SC;
import com.smartgwt.client.widgets.IButton;
import com.smartgwt.client.widgets.events.ClickEvent;
import com.smartgwt.client.widgets.events.ClickHandler;
import com.smartgwt.client.widgets.form.DynamicForm;
import com.smartgwt.client.widgets.form.fields.TextItem;public class SmartGWTIntroProject implements EntryPoint {public void onModuleLoad() {final DynamicForm form new DynamicForm();final TextItem textItem new TextItem();textItem.setTitle(Name);form.setFields(textItem);final IButton button new IButton(Hello);button.addClickHandler(new ClickHandler() {public void onClick(ClickEvent event) {String name textItem.getValue().toString();SC.say(Hello name);}});RootPanel.get(formContainer).add(form);RootPanel.get(buttonContainer).add(button);}} 确保导入的软件包如上所示因为SmartGWT使用的名称与核心GWT框架的名称相同的类。 启动应用程序 接下来我们准备启动我们的应用程序。 选择运行 运行为 Web应用程序并使用您喜欢的浏览器访问提供的URL http://127.0.0.1:8888/SmartGWTIntroProject.html?gwt.codesvr127.0.0.1:9997 您应该能够看到以下内容 而已。 现在您可以创建一些由SmartGWT支持的出色应用程序了。 您可以在此处找到Eclipse项目某些文件已从项目中删除。 这只是有关如何将SmartGWT添加到项目中的简短指南。 在以下文章中我将基于SmartGWT创建一个完整的应用程序以向您展示其一些出色的功能。 敬请关注。 相关文章 高级SmartGWT教程第1部分 将CAPTCHA添加到您的GWT应用程序 使用Spring Security保护GWT应用程序 GWT 2 Spring 3 JPA 2 Hibernate 3.5教程– Eclipse和Maven 2展示 建立自己的GWT Spring Maven原型 GWT EJB3 Maven JBoss 5.1集成教程 翻译自: https://www.javacodegeeks.com/2010/06/getting-started-smartgwt-gwt-interfaces.html