public void appendToConsole(String text) { console.setText(console.getText() + text); if (console.getText().length() > 0) { console.setCursorPos(console.getText().length() - 1); console.getElement().setScrollTop(console.getElement().getScrollHeight()); } }
@Override public void debug(String tag, String message) { if (logLevel >= LOG_DEBUG) { checkLogLabel(); log.setText(log.getText() + "\n" + tag + ": " + message + "\n"); log.setCursorPos(log.getText().length() - 1); System.out.println(tag + ": " + message + "\n"); } }
@Override public void error(String tag, String message) { if (logLevel >= LOG_ERROR) { checkLogLabel(); log.setText(log.getText() + "\n" + tag + ": " + message); log.setCursorPos(log.getText().length() - 1); System.err.println(tag + ": " + message); } }
@Override public void error(String tag, String message, Throwable exception) { if (logLevel >= LOG_ERROR) { checkLogLabel(); log.setText(log.getText() + "\n" + tag + ": " + message + "\n" + exception.getMessage()); log.setCursorPos(log.getText().length() - 1); System.err.println(tag + ": " + message + "\n" + exception.getMessage() + "\n"); System.out.println(getStackTrace(exception)); } }
public void insertText(final String text, final boolean isSpecialPaste) { String textToInsert = text; final int i = textArea.getCursorPos(); final String left = textArea.getText().substring(0, i); final String right = textArea.getText().substring(i, textArea.getText().length()); int cursorPosition = left.toCharArray().length; if (isSpecialPaste) { int p = text.indexOf("|"); if (p > -1) { cursorPosition += p; textToInsert = textToInsert.replaceAll("\\|", ""); } } textArea.setFocus(true); textArea.setText(left + textToInsert + right); textArea.setCursorPos(cursorPosition); }
void insertText(String ins, boolean isSpecialPaste) { text.setFocus(true); int i = text.getCursorPos(); String left = text.getText().substring(0, i); String right = text.getText().substring(i, text.getText().length()); int cursorPosition = left.toCharArray().length; if (isSpecialPaste) { int p = ins.indexOf("|"); if (p > -1) { cursorPosition += p; ins = ins.replaceAll("\\|", ""); } } text.setText(left + ins + right); this.data.content = text.getText(); text.setCursorPos(cursorPosition); }