简体   繁体   English

编写Vaadin项目的有效方法是什么?

[英]What's effective way to write Vaadin project ?

I'm looking for effective approach to writing Java web app in Vaadin. 我正在寻找在Vaadin中编写Java Web应用程序的有效方法。 (several pages, a lot of tables, buttons..) (几页,很多表格,按钮..)

From what should I start ? 我应该从什么开始?

It's good solution to begin from writing all needed components, layouts, panels and next merge all that to build single pages ? 从编写所有需要的组件,布局,面板开始,然后合并所有内容以构建单个页面,这是一个很好的解决方案。

or maybe it's better to write every single page with no thinking about the entire project (of course, except changing pages), so for example: first I write login page (and all stuff I need for it), next I write admin page etc.. 或者也许最好是不考虑整个项目而写每个页面(当然,除了更改页面),所以例如:首先我写登录页面(以及我需要的所有东西),然后我写管理页面,等等。 ..

question concerns Vaadin, but it would be also fine to know, how it looks like in other Java web frameworks. 这个问题涉及Vaadin,但也可以知道,它在其他Java Web框架中的外观如何。

I am recently just got into Vaadin and this is the method I used to get my app off the ground. 我最近刚接触Vaadin,这是我用来启动我的应用程序的方法。

First off check out the sampler application to get an idea of what is possible with Vaadin: Sampler 首先,请检查采样器应用程序,以了解Vaadin可能做的事情: 采样器

If you are using eclipse get the plug-in. 如果您使用的是eclipse,请获取插件。 Using the built-in "Install New software" function in Eclipse(Help -> Install new software) just type in the link and install the plugin: Eclipse Plugin 在Eclipse中使用内置的“安装新软件”功能(帮助->安装新软件),只需输入链接并安装插件即可: Eclipse Plugin

Use the plugin to create a basic vaadin project. 使用该插件创建一个基本的vaadin项目。 Right-click in the Project explorer -> New -> Vaadin Project Then go through the "1-hour" tutorial version on the site Tutorial 右键单击Project Explorer-> New-> Vaadin Project,然后浏览Tutorial网站上的“ 1-hour”教程版本

It will take you step by step into how to create a application and also will give you a basic structure by which to organize your project. 它会逐步引导您如何创建应用程序,并为您提供组织项目的基本结构。 Try to write as much as you can yourself and then look at the examples when you get stuck. 尝试尽可能多地编写代码,然后在遇到困难时查看示例。

Layout in a nutshell: 简而言之布局:

At the most simple level you will have a vertical layout. 在最简单的级别上,您将具有垂直布局。

Then you will add a panels to this layout. 然后,您将向该布局添加面板。 A panel is similar to a div element. 面板类似于div元素。 Add captions to panels. 将标题添加到面板。 Use verticalLayout.setSpacing(true) to space out the elements in a layout. 使用verticalLayout.setSpacing(true)来分隔布局中的元素。

Then you will add content to the panels such as a table for displaying data or a form or grid layout. 然后,您将向面板添加内容,例如用于显示数据的表格或表单或网格布局。 Elements in the content such as a table can be linked to a container which is a datasource for a element. 内容中的元素(例如表格)可以链接到容器,该容器是元素的数据源。

Basic approach: 基本方法:

Create: 创造:

Layout(To organize elements) -> Elements to be placed in layout -> listeners for elements(To handle events like onClick) -> containers for elements that interact with data(To handle persistence and data population) 布局(组织元素)->要放置在布局中的元素->元素的侦听器(以处理诸如onClick的事件)->与数据交互的元素的容器(以处理持久性和数据填充)

I'd say get one page working fairly well then expand out from there. 我会说让一页工作得很好,然后从那里开始扩展。 Spend extra time learning how containers work. 花更多的时间学习容器的工作原理。

您可以签出Instant WebApp作为应用程序的起点。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在for循环中重用ArrayLists的有效方法是什么? - What's an effective way to reuse ArrayLists in a for loop? 重构这个简单方法的最有效方法是什么? - What's the most effective way to refactor this simple method? 在Java集群环境中管理会话数据的有效方法是什么? - what's the effective way of managing session data in java clustering environment? 将RxJava排放写入文本文件的有效方法? - Effective Way to Write RxJava Emissions to Text File? 将File写入ServletOutputStream的最有效方法 - Most effective way to write File to ServletOutputStream 未来一段时间在App Engine上执行任务的最有效方法是什么? - What's the most effective way to execute a task some distant time in the future on App Engine? 编写此函数的更好方法是什么? - What's the better way to write this function? 编写此方法最有效的方法是什么? - What's the most efficient way to write this method? 使用 Java 从另一台 postgres 服务器向 postgresql 服务器插入更多一百万行的有效方法是什么? - What's the effective way to insert more a million rows into postgresql server from another postgres server using Java? 编写此IP阀的正确方法是什么? - What's the correct way to write this IP valve?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM