// Register all server-driven functions
registerServerCallbacks();
}
private void registerServerCallbacks() {
comm.reg("setGreeting", new CallHandler() {
public void call(String methodName, Object[] data) {
getConfig().setGreeting((String) data[0]);
}
});
comm.reg("setPs", new CallHandler() {
public void call(String methodName, Object[] data) {
setPs((String) data[0]);
}
});
comm.reg("setWrap", new CallHandler() {
public void call(String methodName, Object[] data) {
getConfig().setWrap((Boolean) data[0]);
}
});
comm.reg("setRows", new CallHandler() {
public void call(String methodName, Object[] data) {
getConfig().setRows((Integer) data[0]);
setRows((Integer) data[0]);
}
});
comm.reg("setCols", new CallHandler() {
public void call(String methodName, Object[] data) {
getConfig().setCols((Integer) data[0]);
setCols((Integer) data[0]);
}
});
comm.reg("print", new CallHandler() {
public void call(String methodName, Object[] data) {
print((String) data[0]);
}
});
comm.reg("println", new CallHandler() {
public void call(String methodName, Object[] data) {
println((String) data[0]);
}
});
comm.reg("println", new CallHandler() {
public void call(String methodName, Object[] data) {
println((String) data[0]);
}
});
comm.reg("prompt", new CallHandler() {
public void call(String methodName, Object[] data) {
prompt((String) (data.length > 0 ? data[0] : null));
}
});
comm.reg("ff", new CallHandler() {
public void call(String methodName, Object[] data) {
formFeed();
}
});
comm.reg("cr", new CallHandler() {
public void call(String methodName, Object[] data) {
carriageReturn();
}
});
comm.reg("lf", new CallHandler() {
public void call(String methodName, Object[] data) {
carriageReturn();
}
});
comm.reg("clearBuffer", new CallHandler() {
public void call(String methodName, Object[] data) {
clearBuffer();
}
});
comm.reg("reset", new CallHandler() {
public void call(String methodName, Object[] data) {
reset();
}
});
comm.reg("newLine", new CallHandler() {
public void call(String methodName, Object[] data) {
newLine();
}
});
comm.reg("scrollToEnd", new CallHandler() {
public void call(String methodName, Object[] data) {
scrollToEnd();
}
});
comm.reg("bell", new CallHandler() {
public void call(String methodName, Object[] data) {
bell();
}
});
comm.reg("setMaxBufferSize", new CallHandler() {
public void call(String methodName, Object[] data) {
getConfig().setMaxBufferSize((Integer) data[0]);
setMaxBufferSize((Integer) data[0]);
}
});
comm.reg("clearHistory", new CallHandler() {
public void call(String methodName, Object[] data) {
clearCommandHistory();
}
});
}