SideBySide2: Move [,] event handling into header
The header object knows how to manage the navigation. Instead of digging into there from anonymous Runnables in SideBySide2, let Header create the Runnable, hiding some of the inner details of Header from the event binding code. This shortens the event binding code for a CM3 a bit more, making the table of key bindings slightly easier to read. Change-Id: Ia3c999f37001c51d5c36d8eaff02f8bdc725773a
This commit is contained in:
@@ -255,12 +255,29 @@ class Header extends Composite {
|
||||
}
|
||||
}
|
||||
|
||||
boolean hasPrev() {
|
||||
return hasPrev;
|
||||
}
|
||||
|
||||
boolean hasNext() {
|
||||
return hasNext;
|
||||
Runnable navigate(Direction dir) {
|
||||
switch (dir) {
|
||||
case PREV:
|
||||
return new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
(hasPrev ? prev : up).go();
|
||||
}
|
||||
};
|
||||
case NEXT:
|
||||
return new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
(hasNext ? next : up).go();
|
||||
}
|
||||
};
|
||||
default:
|
||||
return new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
String getNextPath() {
|
||||
|
||||
Reference in New Issue
Block a user