1、首先需要把chartsaddon加入到liferay中,方法是:
(1)先把charts的license改成agpl,原来是cval,是收费的,编译客户端代码时会检查License。修改jar中的META-INF/MANIFEST.MF
(2)建立一个vaadin的project,将vaadinchartsaddon的jar包放在lib下,也包括其以来的jar
(3)编译生成客户端的js,也就是widgetsets
(4)将生成的widgetsets目录复制到liferay的html/VAADIN目录下,替换原来widgetets目录
(5)修改liferay的WEB-INF下classes中的portal-ext.properties文件
# Portal-wide widgetset
vaadin.widgetset=com.dareway.vaadincomponents.widgetset.VaadincomponentsWidgetset
# Theme to use
vaadin.theme=valo
2、编写一个portlet
直接用了一个charts的例子代码,成功了。
publicclass EmployeePerformance extends UI{
@Override
protectedvoidinit(VaadinRequest request) {
final VerticalLayoutlayout= new VerticalLayout();
layout.setMargin(true);
setContent(layout);
Button button = newButton("Click Me");
button.addClickListener(newButton.ClickListener() {
publicvoidbuttonClick(ClickEvent event) {
layout.addComponent(newLabel("Thank you for clicking"));
}
});
layout.addComponent(button);
layout.addComponent(newBar().getChart());
}
}