1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | <!DOCTYPE html> <html> <head> <meta charset="UTF-8" name="design-properties" ... </head> <body> <v-vertical-layout size-full="true"> <v-horizontal-layout size-full="true"> <v-table _id="table" caption="Select article" width-auto height-full> </v-table> <v-embedded _id='e' caption="Article view" source="http://www.ibm.com/" size-full :expand> </v-horizontal-layout> </v-vertical-layout> </body> </html> |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | public ArticleViewDesign() { Design.read("ArticleViewer.html", this); table.addContainerProperty("Year", String.class, null); table.addContainerProperty("Article", String.class, null); int i = 1; for (Object[] row: listdata ) { table.addItem(getRowData(row), i++); } table.setSelectable(true); table.setImmediate(true); e.setType(Embedded.TYPE_BROWSER); e.setSource(new ExternalResource(getURL(listdata[0]))); table.addItemClickListener(new ItemClickListener(){ @Override public void itemClick(ItemClickEvent event) { // TODO Auto-generated method stub System.out.println("ID is " + event.getItemId()); e.setSource(new ExternalResource(getURL(listdata [Integer.parseInt(event.getItemId().toString()) - 1]))); } }); } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | public class DeclarativeUI extends UI { @WebServlet(value = "/*", asyncSupported = true) @VaadinServletConfiguration(productionMode = false, ui = DeclarativeUI.class) public static class Servlet extends VaadinServlet { } @Override protected void init(VaadinRequest request) { setContent(new ArticleViewDesign()); } } |
欢迎光临 电子技术论坛_中国专业的电子工程师学习交流社区-中电网技术论坛 (http://bbs.eccn.com/) | Powered by Discuz! 7.0.0 |