Lines 108-115
Link Here
|
108 |
} |
108 |
} |
109 |
|
109 |
|
110 |
// view - bit ugly but can be easily refactored |
110 |
// view - bit ugly but can be easily refactored |
111 |
public static SQLCompletionItem column(boolean view, QualIdent tupleName, String columnName, String substText, int substOffset, SubstitutionHandler substHandler) { |
111 |
public static SQLCompletionItem column(boolean view, |
112 |
return new Column(view, tupleName, columnName, substText, substOffset, substHandler); |
112 |
QualIdent tupleName, |
|
|
113 |
String columnName, |
114 |
String dataType, |
115 |
String substText, |
116 |
int substOffset, |
117 |
SubstitutionHandler substHandler) { |
118 |
return new Column(view, tupleName, columnName, dataType, substText, substOffset, substHandler); |
113 |
} |
119 |
} |
114 |
|
120 |
|
115 |
public static SQLCompletionItem keyword(String keyword, int substOffset, SubstitutionHandler substHandler) { |
121 |
public static SQLCompletionItem keyword(String keyword, int substOffset, SubstitutionHandler substHandler) { |
Lines 132-138
Link Here
|
132 |
} |
138 |
} |
133 |
|
139 |
|
134 |
public int getPreferredWidth(Graphics g, Font defaultFont) { |
140 |
public int getPreferredWidth(Graphics g, Font defaultFont) { |
135 |
return CompletionUtilities.getPreferredWidth(getLeftHtmlText(), getRightHtmlText(), g, defaultFont); |
141 |
int width = CompletionUtilities.getPreferredWidth(getLeftHtmlText(), getRightHtmlText(), g, defaultFont); |
|
|
142 |
width += 20; // give some more room for visible seperation |
143 |
return width; |
136 |
} |
144 |
} |
137 |
|
145 |
|
138 |
public void render(Graphics g, Font defaultFont, Color defaultColor, Color backgroundColor, int width, int height, boolean selected) { |
146 |
public void render(Graphics g, Font defaultFont, Color defaultColor, Color backgroundColor, int width, int height, boolean selected) { |
Lines 375-386
Link Here
|
375 |
private final String columnName; |
383 |
private final String columnName; |
376 |
private String leftText; |
384 |
private String leftText; |
377 |
private String rightText; |
385 |
private String rightText; |
|
|
386 |
private String dataType; |
378 |
|
387 |
|
379 |
public Column(boolean view, QualIdent tableName, String columnName, String substText, int substOffset, SubstitutionHandler substHandler) { |
388 |
public Column(boolean view, |
|
|
389 |
QualIdent tableName, |
390 |
String columnName, |
391 |
String dataType, |
392 |
String substText, |
393 |
int substOffset, |
394 |
SubstitutionHandler substHandler) { |
380 |
super(substText, substOffset, substHandler); |
395 |
super(substText, substOffset, substHandler); |
381 |
this.view = view; |
396 |
this.view = view; |
382 |
this.tableName = tableName; |
397 |
this.tableName = tableName; |
383 |
this.columnName = columnName; |
398 |
this.columnName = columnName; |
|
|
399 |
this.dataType = dataType; |
384 |
} |
400 |
} |
385 |
|
401 |
|
386 |
protected String getColumnName() { |
402 |
protected String getColumnName() { |
Lines 412-419
Link Here
|
412 |
sb.append(TABLE_COLOR); |
428 |
sb.append(TABLE_COLOR); |
413 |
sb.append(tableName.toString()); |
429 |
sb.append(tableName.toString()); |
414 |
sb.append(COLOR_END); |
430 |
sb.append(COLOR_END); |
415 |
rightText = MessageFormat.format(NbBundle.getMessage(SQLCompletionItem.class, view ? "MSG_View" : "MSG_Table"), sb.toString()); |
431 |
rightText = MessageFormat.format( |
|
|
432 |
NbBundle.getMessage(SQLCompletionItem.class, view ? "MSG_View" : "MSG_Table"), sb.toString()); |
433 |
sb.setLength(0); |
434 |
if (dataType != null && (! dataType.trim().isEmpty())) { |
435 |
sb.append(" ("); |
436 |
sb.append(dataType.trim()); |
437 |
sb.append(")"); |
438 |
rightText += sb.toString(); |
416 |
} |
439 |
} |
|
|
440 |
} |
417 |
return rightText; |
441 |
return rightText; |
418 |
} |
442 |
} |
419 |
|
443 |
|