我尝试构建一个基于Spring Boot(1.2.7.RELEASE)和Vaadin(7.6.3)的应用程序.我的问题是我无法将Spring Security与Vaadin集成.我想要一个自定义的Vaadin内置的LoginScreen和Spring Security控件.我的项目设置如下:
@Configuration
@EnableWebSecurity
public class SpringSecurityConfig extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
http.csrf().disable().
exceptionHandling().authenticationEntryPoint(new LoginUrlAuthenticationEntryPoint("/login")).accessDeniedPage("/accessDenied")
.and().authorizeRequests()
.antMatchers("/VAADIN/**", "/PUSH/**", "/UIDL/**", "/login", "/login/**", "/error/**", "/accessDenied/**", "/vaadinServlet/**").permitAll()
.antMatchers("/authorized", "/**").fullyAuthenticated();
}
}
Run Code Online (Sandbox Code Playgroud)
这是我的Vaadin登录界面
@SpringUI(path = "/login")
@Title("LoginPage")
@Theme("valo")
public class LoginUI extends UI {
TextField user;
PasswordField password;
Button loginButton = new Button("Login", this::loginButtonClick);
private static final String username = "username";
private static final String passwordValue = "test123";
@Override
protected void init(VaadinRequest request) {
setSizeFull();
user …Run Code Online (Sandbox Code Playgroud) 我正在关注Grails中的Vaadin插件,这正是我想要实现的:
我有一个UI班级和两个View班级
UI代码中有一个导航器:
class MyUI extends UI {
@Override
protected void init(VaadinRequest vaadinRequest) {
Navigator navigator = new Navigator(this, this)
navigator.addView(MainView.NAME, new MainView())
navigator.addView(CountView.NAME, CountView.class)
}
}
Run Code Online (Sandbox Code Playgroud)
在MainView中有一个Button,我希望用户CountView在单击按钮后被重定向到.我添加了Button.ClickListener(),但我无法抓住导航到所需页面的Navigator实例View.
如果你能给我一个例子,我将不胜感激.
如何获取运行我的Vaadin webapp的应用服务器的协议,IP和端口?我正在使用Vaadin 7.
在vaadin 6中我这样做,但不能在vaadin 7中工作:
String server = ((WebApplicationContext) this.getContext()).getHttpSession().getServletContext().getServerInfo();
java.net.URL url = this.getURL();
String s = url.getHost()+":"+url.getPort()+url.getPath();
Run Code Online (Sandbox Code Playgroud) 如何ServletContext从我的Vaadin 7应用程序中访问当前的数据?
我想使用ServletContext对象的setAttribute,getAttribute,removeAttribute,和getAttributeNames方法来管理全球一些国家对我的Vaadin应用程序.
此外,如果为此目的使用这些方法不适合Vaadin应用程序,请解释.
通过在Eclipse/STS中使用"Spring Stater Project",我能够快速启动并运行Vaadin项目.我想通过Vaadin-Addon将图表添加到项目中.我谷歌搜索试图找到如何正确添加和使用Vaadin Chart插件到项目.但我很困惑,因为有很多"指南/教程",但很多不是春季启动或他们已过时或部分.
所以我正在寻找Vaadin-SpringBoot-VaadinChart-AddOn的完整指南/教程.
这是我到目前为止:
---- Pom文件----
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.aci</groupId>
<artifactId>oversight2</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>oversight2</name>
<description>Oversite</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.2.5.RELEASE</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.8</java.version>
</properties>
<dependencies>
<!-- <dependency> -->
<!-- <groupId>com.vaadin</groupId> -->
<!-- <artifactId>vaadin-spring-boot</artifactId> -->
<!-- <version>1.0.0</version> -->
<!-- </dependency> -->
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-spring-boot-starter</artifactId>
<version>1.0.0.beta3</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.vaadin.addon</groupId>
<version>2.0.0</version>
<artifactId>vaadin-charts</artifactId>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-bom</artifactId>
<version>7.4.5</version>
<type>pom</type>
<scope>import</scope> …Run Code Online (Sandbox Code Playgroud) 嗨我尝试在vaadin中的网格中添加按钮,但它打印按钮对象上的引用.
Grid statementEnquiriesList = new Grid();
statementEnquiriesList.addColumn("", Button.class);
statementEnquiriesList.addColumn("DATE/TIME", String.class);
statementEnquiriesList.addColumn("TRANSACTION ID", String.class);
statementEnquiriesList.addColumn("FROM", String.class);
// historyList is an array object
for (int i = 0; i < historyList.size(); i++)
{
HistoryList recordObj = historyList.get(i);
Button addBtn = new Button();
addBtn.setCaption("Add");
statementEnquiriesList.addRow(addBtn , recordObj.getDate(), recordObj.getTransactionId(), recordObj.getFrom());
}
Run Code Online (Sandbox Code Playgroud)
我怎样才能在此打印"添加"标题
我有一个组件,它作为我所有页面的通用布局存在.该组件的布局如下(使用油漆制作,所以请抱歉:p):

右箭头表示此布局是HorizontalLayout和向下箭头VerticalLayout.
我真的很感兴趣使bodyContent布局可滚动.在这个布局中,我通常会介绍很多UI组件(更多布局,文本字段,表单,网格......),有时由于缺少垂直空间和没有垂直滚动而未显示组件.那么有没有办法让bodyContent可滚动(使用SCSS/CSS或任何其他方式)?
提前致谢.
编辑: 我已经解决了这个感谢@JaneVi:
.v-ui > .v-widget {
overflow: visible;
}
Run Code Online (Sandbox Code Playgroud) 我使用数据库中的数据创建简单网格:
BeanItemContainer<Customer> container = new BeanItemContainer<>(Customer.class, customerRepository.findAll());
Grid grid = new Grid(container);
Run Code Online (Sandbox Code Playgroud)
要编辑按钮的每一行:
Button edit = new Button("Edit", clickEvent -> openWindow((Customer) grid.getSelectedRows().iterator().next()));
Run Code Online (Sandbox Code Playgroud)
这个打开的新窗口带有编辑表单.接受所有更改后,我必须手动刷新整个页面以查看Grid上的修改.我的问题是:
如何在修改任何行条目后仅刷新网格?如何将这些修改保存到数据库(也许beanItemContainer可以做到)?
vaadin7 ×10
vaadin ×8
java ×4
vaadin-grid ×2
css ×1
grails ×1
servlets ×1
spring ×1
spring-boot ×1