}
};
@Override
public void initialise() {
final ScrollableArea scrollArea = find("scrollArea", ScrollableArea.class);
scrollArea.moveToBottom();
List<CommandInfo> commands = console.getCommandList();
// JAVA8: replace with lamba expression
Collection<String> commandNames = Collections2.transform(commands, new Function<CommandInfo, String>() {
@Override
public String apply(CommandInfo input) {
return input.getName();
}
});
commandLine = find("commandLine", UICommandEntry.class);
getManager().setFocus(commandLine);
commandLine.setTabCompletionEngine(new CyclingTabCompletionEngine(console, commandNames));
commandLine.bindCommandHistory(new ReadOnlyBinding<List<String>>() {
@Override
public List<String> get() {
return console.getPreviousCommands();
}
});
commandLine.subscribe(new ActivateEventListener() {
@Override
public void onActivated(UIWidget widget) {
console.execute(commandLine.getText(), localPlayer.getClientEntity());
commandLine.setText("");
scrollArea.moveToBottom();
}
});
final UIText history = find("messageHistory", UIText.class);
history.bindText(new ReadOnlyBinding<String>() {