}
}
protected void initButtons() {
if (mode == Mode.INSERT) {
IconButton up = new IconButton("arrow-up");
configureButton(up, getMessages().getMoveUp(), GXT.MESSAGES.listField_moveSelectedUp());
up.addListener(Events.Select, new Listener<ComponentEvent>() {
public void handleEvent(ComponentEvent be) {
toField.getListView().moveSelectedUp();
}
});
buttonBar.add(up);
}
IconButton allRight = new IconButton("arrow-double-right");
configureButton(allRight, getMessages().getAddAll(), GXT.MESSAGES.listField_addAll());
allRight.addListener(Events.Select, new Listener<ComponentEvent>() {
public void handleEvent(ComponentEvent be) {
List<D> sel = fromField.getStore().getModels();
toField.getStore().add(sel);
fromField.getStore().removeAll();
}
});
buttonBar.add(allRight);
IconButton right = new IconButton("arrow-right");
configureButton(right, getMessages().getAddSelected(), GXT.MESSAGES.listField_addSelected());
right.addListener(Events.Select, new Listener<ComponentEvent>() {
public void handleEvent(ComponentEvent be) {
List<D> sel = fromField.getSelection();
for (D model : sel) {
fromField.getStore().remove(model);
}
toField.getStore().add(sel);
select(toField, sel);
}
});
IconButton left = new IconButton("arrow-left");
configureButton(left, getMessages().getRemoveSelected(), GXT.MESSAGES.listField_removeSelected());
left.addListener(Events.Select, new Listener<ComponentEvent>() {
public void handleEvent(ComponentEvent be) {
List<D> sel = toField.getSelection();
for (D model : sel) {
toField.getStore().remove(model);
}
fromField.getStore().add(sel);
select(fromField, sel);
}
});
buttonBar.add(right);
buttonBar.add(left);
IconButton allLeft = new IconButton("arrow-double-left");
configureButton(allLeft, getMessages().getRemoveAll(), GXT.MESSAGES.listField_removeAll());
allLeft.addListener(Events.Select, new Listener<ComponentEvent>() {
public void handleEvent(ComponentEvent be) {
List<D> sel = toField.getStore().getModels();
fromField.getStore().add(sel);
toField.getStore().removeAll();
}
});
buttonBar.add(allLeft);
if (mode == Mode.INSERT) {
IconButton down = new IconButton("arrow-down");
configureButton(down, getMessages().getMoveDown(), GXT.MESSAGES.listField_moveSelectedDown());
down.addListener(Events.Select, new Listener<ComponentEvent>() {
public void handleEvent(ComponentEvent be) {
toField.getListView().moveSelectedDown();
}
});
buttonBar.add(down);