tip = GXT.MESSAGES.listField_moveSelectedUp();
} else {
tip = getMessages().getMoveUp();
}
IconButton up = new IconButton("arrow-up");
up.setHeight(18);
up.setToolTip(tip);
up.addListener(Events.Select, new Listener<ComponentEvent>() {
public void handleEvent(ComponentEvent be) {
toField.getListView().moveSelectedUp();
}
});
buttonBar.add(up);
}
String tip = "";
if (getMessages().getAddAll() == null) {
tip = GXT.MESSAGES.listField_addAll();
} else {
tip = getMessages().getAddAll();
}
IconButton allRight = new IconButton("arrow-double-right");
allRight.setHeight(18);
allRight.setToolTip(tip);
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);
tip = "";
if (getMessages().getAddSelected() == null) {
tip = GXT.MESSAGES.listField_addSelected();
} else {
tip = getMessages().getAddSelected();
}
IconButton right = new IconButton("arrow-right");
right.setHeight(18);
right.setToolTip(tip);
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);
}
});
tip = "";
if (getMessages().getRemoveSelected() == null) {
tip = GXT.MESSAGES.listField_removeSelected();
} else {
tip = getMessages().getRemoveSelected();
}
IconButton left = new IconButton("arrow-left");
left.setHeight(18);
left.setToolTip(tip);
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);
tip = "";
if (getMessages().getRemoveAll() == null) {
tip = GXT.MESSAGES.listField_removeAll();
} else {
tip = getMessages().getRemoveAll();
}
IconButton allLeft = new IconButton("arrow-double-left");
allLeft.setHeight(18);
allLeft.setToolTip(tip);
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) {
tip = "";
if (getMessages().getMoveDown() == null) {
tip = GXT.MESSAGES.listField_moveSelectedDown();
} else {
tip = getMessages().getMoveDown();
}
IconButton down = new IconButton("arrow-down");
down.setHeight(18);
down.setToolTip(tip);
down.addListener(Events.Select, new Listener<ComponentEvent>() {
public void handleEvent(ComponentEvent be) {
toField.getListView().moveSelectedDown();
}
});
buttonBar.add(down);