ding4
(ding pierre)
June 16, 2015, 12:34pm
1
Hello,
I want to create a customelized grid with GridUtil to be able to add/Modify/Delete some information, see the example, i don’t understand how to use it, because it displays nothing when i call setColumnRenderes();
private Grid genGrid() {
// init Grid
final Grid grid = new Grid();
grid.setSizeFull();
// init Container
List<Template> templates = new ArrayList<Template>();
templates.add(new Template(1, "template 1 ", "user1"));
templates.add(new Template(2, "template 2 ", "user1"));
templates.add(new Template(3, "template 3 ", "user2"));
BeanItemContainer<Template> container = new BeanItemContainer<Template>(Template.class, templates);
grid.setContainerDataSource(container);
grid.setColumnOrder("id", "user", "name");
setColumnRenderes(grid);
initFilter(grid);
// initFooterRow(grid, container);
// initExtraHeaderRow(grid);
//
initColumnAlignments(grid);
return grid;
}
private void setColumnRenderes(final Grid grid) {
[b]
grid.getColumn("id")
.setRenderer(new EditDeleteButtonValueRenderer(new EditDeleteButtonClickListener() {
@Override
public void onEdit(final RendererClickEvent event) {
Notification.show(event.getItemId()
.toString() + " want's to get edited", Type.HUMANIZED_MESSAGE);
}
@Override
public void onDelete(final com.vaadin.ui.renderers.ClickableRenderer.RendererClickEvent event) {
Notification.show(event.getItemId()
.toString() + " want's to get delete", Type.WARNING_MESSAGE);
};
}))
.setWidth(150);
[/b]
}
In MainUI:
CustomerTableColumnsSelectorComponent filterComponent = new CustomerTableColumnsSelectorComponent();
layout.addComponent(filterComponent);
Should i add a file in webapp folder?
and should i add in main UI class something like that:
@WebServlet(
value = "/*",
asyncSupported = true)
@VaadinServletConfiguration(
productionMode = false,
ui = DemoUI.class,
widgetset = "org.vaadin.gridutil.demo.DemoWidgetSet")
public static class Servlet extends VaadinServlet {
}
ding4
(ding pierre)
June 16, 2015, 5:10pm
2
I think may be it’s related to the widget, because I cannot compile this widget, this is my pom:
<build>
<finalName>mvp-example</finalName>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.6</version>
<configuration>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.3</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
<!-- <attachClasses>true</attachClasses> -->
<!-- <packagingExcludes>WEB-INF/lib/tomcat-embed-*.jar -->
<!-- </packagingExcludes> -->
<packagingExcludes>
**/VAADIN/gwt-unitCache/**,
**/VAADIN/widgetsets/WEB-INF/**,
**/WEB-INF/lib/servlet-api-*.jar,
**/WEB-INF/lib/vaadin-client-*.jar,
**/WEB-INF/lib/jetty-*.jar,
**/WEB-INF/lib/ant-*.jar,
**/WEB-INF/classes/gwt-unitCache/**,
**/WEB-INF/classes/themes/**,
**/WEB-INF/classes/widgetsets/**
</packagingExcludes>
</configuration>
</plugin>
<plugin>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-maven-plugin</artifactId>
<version>${vaadin.version}</version>
<configuration>
<webappDirectory>${basedir}/src/main/webapp/VAADIN/widgetsets</webappDirectory>
<hostedWebapp>${basedir}/src/main/webapp/VAADIN/widgetsets</hostedWebapp>
<extraJvmArgs>-Xmx1g -Xss4024k</extraJvmArgs>
<noServer>true</noServer>
<!-- Remove draftCompile when project is ready -->
<draftCompile>false</draftCompile>
<compileReport>false</compileReport>
<style>OBF</style>
<persistentunitcachedir>${project.build.directory}</persistentunitcachedir>
<deploy>${project.build.directory}/gwt-deploy</deploy>
<runTarget>http://localhost:8080/</runTarget>
</configuration>
<executions>
<execution>
<goals>
<goal>resources</goal>
<goal>update-widgetset</goal>
<goal>compile</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${spring.version}</version>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
<!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>com.vaadin</groupId>
<artifactId>
vaadin-maven-plugin
</artifactId>
<versionRange>
[7.5.0.alpha1,)
</versionRange>
<goals>
<goal>
update-widgetset
</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore></ignore>
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
and:
<dependency>
<groupId>org.vaadin.addons</groupId>
<artifactId>vaadin-grid-util</artifactId>
<version>1.0.7</version>
</dependency>
Then i created the file src\main\java\com\ui\DemoWidgetSet.gwt.xml:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.5.1//EN" "http://google-web-toolkit.googlecode.com/svn/tags/2.5.1/distro-source/core/src/gwt-module.dtd">
<module>
<set-configuration-property name="devModeRedirectEnabled" value="true" />
<inherits name="com.vaadin.DefaultWidgetSet" />
<inherits name="org.vaadin.gridutil.WidgetSet" />
</module>
When i run mvn package, no error and no folder widget created in “src\main\webapp\VAADIN”.
Someone knows this problem, please?
sgarcia
(santiago garcia)
September 15, 2015, 5:02pm
3
Sorry i a dummy in Vaadin.
I have the same or similar problem.
Have you a solution?
Thank’s
ding4
(ding pierre)
September 15, 2015, 8:15pm
4
I found the problem, it’s related to my POM, but finally i chose the table, because it’s more easy to control.