|
From: SVN by r. <sv...@ca...> - 2008-03-02 14:09:00
|
Author: roy
Date: 2008-03-02 15:08:49 +0100 (Sun, 02 Mar 2008)
New Revision: 246
Modified:
src/main/java/nl/improved/sqlclient/SQLShell.java
Log:
output fixes
removed border of 1 pix around interface
Modified: src/main/java/nl/improved/sqlclient/SQLShell.java
===================================================================
--- src/main/java/nl/improved/sqlclient/SQLShell.java 2008-03-02 13:50:55 UTC (rev 245)
+++ src/main/java/nl/improved/sqlclient/SQLShell.java 2008-03-02 14:08:49 UTC (rev 246)
@@ -115,7 +115,7 @@
*/
public SQLShell() {
super(Toolkit.getScreenWidth(),Toolkit.getScreenHeight(), true, "SQLShell");
- char[] emptyLineChar = new char[Toolkit.getScreenWidth()-2];
+ char[] emptyLineChar = new char[Toolkit.getScreenWidth()];
Arrays.fill(emptyLineChar, ' ');
emptyLine = new String(emptyLineChar);
@@ -329,7 +329,7 @@
}
});
- MAX_LINE_LENGTH = Toolkit.getScreenWidth()-(2+PROMPT.length()+2+1); // 2 spaces bouds.. prompt + "> "
+ MAX_LINE_LENGTH = Toolkit.getScreenWidth()-(PROMPT.length()+2+1); // prompt + "> "
output("Welcome to the SQLShell client.");
output("Type 'help' to get a list of available commands other then the default sql input.");
@@ -395,7 +395,7 @@
* @param inp the character that is being pressed by the user.
*/
protected void handleInput(InputChar inp) {
- debug("Input: " + inp.getCode());
+ //debug("Input: " + inp.getCode());
try {
if (inp.getCode() != InputChar.KEY_PPAGE && inp.getCode() != InputChar.KEY_NPAGE) {
pageUpCount = 0; // some character entered, so reset pageup count
@@ -793,7 +793,6 @@
*/
@Override
protected synchronized void paint() {
- Toolkit.clearScreen(new CharColor(CharColor.WHITE, CharColor.BLACK, CharColor.REVERSE, CharColor.REVERSE));
CharColor color = new CharColor(CharColor.BLACK, CharColor.WHITE, CharColor.BOLD, CharColor.BOLD);
List<CharSequence> tmpList = new ArrayList<CharSequence>();
@@ -810,8 +809,8 @@
}
}
int startLine;
- if (tmpList.size() > Toolkit.getScreenHeight()-4) {
- startLine = tmpList.size() - (Toolkit.getScreenHeight()-4);
+ if (tmpList.size() > Toolkit.getScreenHeight()-1) {
+ startLine = tmpList.size() - (Toolkit.getScreenHeight()-1);
if (pageUpCount > 0) {
startLine -= (pageUpCount * Toolkit.getScreenHeight()/2);
if (startLine < 0) {
@@ -822,11 +821,15 @@
startLine = 0;
}
int lineNr;
- for (lineNr = startLine;lineNr < tmpList.size() && lineNr - startLine < Toolkit.getScreenHeight()-4; lineNr++) {
- CharSequence line = tmpList.get(lineNr);
- Toolkit.printString(line.toString()
- , 1, lineNr+1-startLine, color);
+ for (lineNr = startLine;lineNr < tmpList.size() && lineNr - startLine < Toolkit.getScreenHeight()-1; lineNr++) {
+ CharSequence linePart = tmpList.get(lineNr);
+ String line = linePart + emptyLine.substring(linePart.length());
+ Toolkit.printString(line
+ , 0, lineNr-startLine, color);
}
+ for (int lNr = lineNr; lNr < Toolkit.getScreenHeight(); lNr++) {
+ Toolkit.printString(emptyLine, 0, lNr, color);
+ }
// paint cursor
color = new CharColor(CharColor.BLACK, CharColor.WHITE, CharColor.REVERSE, CharColor.REVERSE);
@@ -837,7 +840,7 @@
cursorChar = tmp.substring(cursorPosition.x, cursorPosition.x+1);
}
}
- Toolkit.printString(cursorChar, PROMPT.length() +"> ".length() + cursorPosition.x+1, lineNr-(commandLines.getLines().size() -cursorPosition.y-1)-startLine, color);
+ Toolkit.printString(cursorChar, PROMPT.length() +"> ".length() + cursorPosition.x, lineNr-(commandLines.getLines().size() -cursorPosition.y)-startLine, color);
}
private void debug(String debug) {
@@ -851,7 +854,7 @@
* @return the text devided into multiple lines to match the screen width
*/
private static List<CharSequence> getLines(CharSequence text) {
- int maxWidth = Toolkit.getScreenWidth()-2;
+ int maxWidth = Toolkit.getScreenWidth();
List<CharSequence> list = new ArrayList<CharSequence>();
StringBuilder buffer = new StringBuilder();
for (int i=0; i<text.length(); i++) {
@@ -885,7 +888,7 @@
maxWidth = Math.max(maxWidth, iValues.next().length());
}
maxWidth+=2;// add extra space
- int nrOfColumns = (Toolkit.getScreenWidth()-2) / maxWidth;
+ int nrOfColumns = (Toolkit.getScreenWidth()) / maxWidth;
StringBuilder returnValue = new StringBuilder();
for (int row = 0; row < values.size(); row+=nrOfColumns) {
for (int col = 0; col < nrOfColumns && row + col < values.size(); col++) {
|