|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100 |
- package com.vaadin.tests.components.table;
-
- import com.vaadin.event.Action;
- import com.vaadin.event.LayoutEvents.LayoutClickEvent;
- import com.vaadin.event.LayoutEvents.LayoutClickListener;
- import com.vaadin.tests.components.TestBase;
- import com.vaadin.ui.Button;
- import com.vaadin.ui.Component;
- import com.vaadin.ui.Link;
- import com.vaadin.ui.Table;
- import com.vaadin.ui.TextField;
- import com.vaadin.ui.VerticalLayout;
-
- public class TableContextMenuOnField extends TestBase {
-
- private static final Action ACTION_MYACTION = new Action("Action!!");
-
- @Override
- protected void setup() {
- Table table = new Table();
- table.setSelectable(true);
- table.setMultiSelect(true);
-
- table.addActionHandler(new Action.Handler() {
- @Override
- public void handleAction(Action action, Object sender, Object target) {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public Action[] getActions(Object target, Object sender) {
- return new Action[] { ACTION_MYACTION };
- }
- });
-
- table.addGeneratedColumn("layout", new Table.ColumnGenerator() {
-
- @Override
- public Component generateCell(Table source, Object itemId,
- Object columnId) {
-
- VerticalLayout layout = new VerticalLayout();
- layout.addComponent(new TextField());
-
- layout.addListener(new LayoutClickListener() {
-
- @Override
- public void layoutClick(LayoutClickEvent event) {
- getMainWindow().showNotification("HELLO");
-
- }
- });
-
- return layout;
- }
- });
-
- table.addGeneratedColumn("textfield", new Table.ColumnGenerator() {
- @Override
- public Component generateCell(Table source, Object itemId,
- Object columnId) {
- return new TextField();
- }
- });
-
- table.addGeneratedColumn("link", new Table.ColumnGenerator() {
- @Override
- public Component generateCell(Table source, Object itemId,
- Object columnId) {
- return new Link("Link", null);
- }
- });
-
- table.addGeneratedColumn("button", new Table.ColumnGenerator() {
- @Override
- public Component generateCell(Table source, Object itemId,
- Object columnId) {
- return new Button("Button");
- }
- });
-
- table.addItem();
- table.addItem();
- table.addItem();
- addComponent(table);
- }
-
- @Override
- protected String getDescription() {
- return "Right clicking on an item without a context menu should bring"
- + "up the Tables context menu";
- }
-
- @Override
- protected Integer getTicketNumber() {
- return 4264;
- }
-
- }
|