BrightSide Workbench Full Report + Source Code
org.turro.zkoss.grid.KeyEventListener Class Reference
Inheritance diagram for org.turro.zkoss.grid.KeyEventListener:
Collaboration diagram for org.turro.zkoss.grid.KeyEventListener:

Public Member Functions

 KeyEventListener (EditableGrid grid)
 
void onEvent (Event event) throws Exception
 
- Public Member Functions inherited from org.turro.zkoss.grid.EditableEventListener
 EditableEventListener (EditableGrid grid)
 

Additional Inherited Members

- Protected Attributes inherited from org.turro.zkoss.grid.EditableEventListener
EditableGrid grid
 

Detailed Description

Author
Lluis TurrĂ³ Cutiller lluis.nosp@m.@tur.nosp@m.ro.or.nosp@m.g

Definition at line 30 of file KeyEventListener.java.

Constructor & Destructor Documentation

◆ KeyEventListener()

org.turro.zkoss.grid.KeyEventListener.KeyEventListener ( EditableGrid  grid)

Definition at line 32 of file KeyEventListener.java.

32  {
33  super(grid);
34  }

Member Function Documentation

◆ onEvent()

void org.turro.zkoss.grid.KeyEventListener.onEvent ( Event  event) throws Exception

Definition at line 37 of file KeyEventListener.java.

37  {
38  Component comp = event.getTarget();
39  Row row = Components.from(comp).parent(Row.class);
40  KeyEvent kev = (KeyEvent) event;
41  if(row != null) {
42  if(kev.isCtrlKey()) {
43  if(grid.isAllowDeletions() && kev.getKeyCode() == KeyEvent.DELETE) {
45  } else if(grid.isAllowInsertions() && kev.getKeyCode() == KeyEvent.INSERT) {
47  }
48  } else {
49  int cellIndex = row.getChildren().indexOf(comp);
50  if(kev.getKeyCode() == KeyEvent.DOWN) {
51  row = (Row) row.getNextSibling();
52  } else if(kev.getKeyCode() == KeyEvent.UP) {
53  row = (Row) row.getPreviousSibling();
54  }
55  if(row != null) {
56  comp = (Component) row.getChildren().get(cellIndex);
57  }
58  if(comp == null) {
59  if(grid.isAllowInsertions()) {
60  row = grid.addNewRow();
61  } else {
62  row = (Row) grid.getRows().getFirstChild();
63  }
64  if(row != null) {
65  comp = (Component) row.getChildren().get(cellIndex);
66  }
67  }
68  if(row != null && comp != null) {
69  grid.processEdition(new EditableCell(grid, row, comp));
70  }
71  }
72  }
73  }
void processEdition(EditableCell editableCell)
void deleteSelectedRow(final Row row)
Rows getRows(boolean create)
Here is the call graph for this function:

The documentation for this class was generated from the following file: