src/solaris/classes/sun/awt/X11/XListPeer.java
Print this page
*** 573,588 ****
repaint();
}
}
void mousePressed(MouseEvent mouseEvent) {
! if (log.isLoggable(PlatformLogger.FINER)) {
log.finer(mouseEvent.toString() + ", hsb " + hsbVis + ", vsb " + vsbVis);
}
if (isEnabled() && mouseEvent.getButton() == MouseEvent.BUTTON1) {
if (inWindow(mouseEvent.getX(), mouseEvent.getY())) {
! if (log.isLoggable(PlatformLogger.FINE)) {
log.fine("Mouse press in items area");
}
active = WINDOW;
int i = y2index(mouseEvent.getY());
if (i >= 0) {
--- 573,588 ----
repaint();
}
}
void mousePressed(MouseEvent mouseEvent) {
! if (log.isLoggable(PlatformLogger.Level.FINER)) {
log.finer(mouseEvent.toString() + ", hsb " + hsbVis + ", vsb " + vsbVis);
}
if (isEnabled() && mouseEvent.getButton() == MouseEvent.BUTTON1) {
if (inWindow(mouseEvent.getX(), mouseEvent.getY())) {
! if (log.isLoggable(PlatformLogger.Level.FINE)) {
log.fine("Mouse press in items area");
}
active = WINDOW;
int i = y2index(mouseEvent.getY());
if (i >= 0) {
*** 617,636 ****
// 6426186: reset variable to prevent action event
// if user clicks on unoccupied area of list
currentIndex = -1;
}
} else if (inVerticalScrollbar(mouseEvent.getX(), mouseEvent.getY())) {
! if (log.isLoggable(PlatformLogger.FINE)) {
log.fine("Mouse press in vertical scrollbar");
}
active = VERSCROLLBAR;
vsb.handleMouseEvent(mouseEvent.getID(),
mouseEvent.getModifiers(),
mouseEvent.getX() - (width - SCROLLBAR_WIDTH),
mouseEvent.getY());
} else if (inHorizontalScrollbar(mouseEvent.getX(), mouseEvent.getY())) {
! if (log.isLoggable(PlatformLogger.FINE)) {
log.fine("Mouse press in horizontal scrollbar");
}
active = HORSCROLLBAR;
hsb.handleMouseEvent(mouseEvent.getID(),
mouseEvent.getModifiers(),
--- 617,636 ----
// 6426186: reset variable to prevent action event
// if user clicks on unoccupied area of list
currentIndex = -1;
}
} else if (inVerticalScrollbar(mouseEvent.getX(), mouseEvent.getY())) {
! if (log.isLoggable(PlatformLogger.Level.FINE)) {
log.fine("Mouse press in vertical scrollbar");
}
active = VERSCROLLBAR;
vsb.handleMouseEvent(mouseEvent.getID(),
mouseEvent.getModifiers(),
mouseEvent.getX() - (width - SCROLLBAR_WIDTH),
mouseEvent.getY());
} else if (inHorizontalScrollbar(mouseEvent.getX(), mouseEvent.getY())) {
! if (log.isLoggable(PlatformLogger.Level.FINE)) {
log.fine("Mouse press in horizontal scrollbar");
}
active = HORSCROLLBAR;
hsb.handleMouseEvent(mouseEvent.getID(),
mouseEvent.getModifiers(),
*** 811,821 ****
}
}
void keyPressed(KeyEvent e) {
int keyCode = e.getKeyCode();
! if (log.isLoggable(PlatformLogger.FINE)) {
log.fine(e.toString());
}
switch(keyCode) {
case KeyEvent.VK_UP:
case KeyEvent.VK_KP_UP: // TODO: I assume we also want this, too
--- 811,821 ----
}
}
void keyPressed(KeyEvent e) {
int keyCode = e.getKeyCode();
! if (log.isLoggable(PlatformLogger.Level.FINE)) {
log.fine(e.toString());
}
switch(keyCode) {
case KeyEvent.VK_UP:
case KeyEvent.VK_KP_UP: // TODO: I assume we also want this, too
*** 998,1008 ****
/**
* return value from the scrollbar
*/
public void notifyValue(XScrollbar obj, int type, int v, boolean isAdjusting) {
! if (log.isLoggable(PlatformLogger.FINE)) {
log.fine("Notify value changed on " + obj + " to " + v);
}
int value = obj.getValue();
if (obj == vsb) {
scrollVertical(v - value);
--- 998,1008 ----
/**
* return value from the scrollbar
*/
public void notifyValue(XScrollbar obj, int type, int v, boolean isAdjusting) {
! if (log.isLoggable(PlatformLogger.Level.FINE)) {
log.fine("Notify value changed on " + obj + " to " + v);
}
int value = obj.getValue();
if (obj == vsb) {
scrollVertical(v - value);
*** 1083,1093 ****
if (selected[j] >= i) {
selected[j] += 1;
}
}
}
! if (log.isLoggable(PlatformLogger.FINER)) {
log.finer("Adding item '" + item + "' to " + addedIndex);
}
// Update maxLength
boolean repaintItems = !isItemHidden(addedIndex);
--- 1083,1093 ----
if (selected[j] >= i) {
selected[j] += 1;
}
}
}
! if (log.isLoggable(PlatformLogger.Level.FINER)) {
log.finer("Adding item '" + item + "' to " + addedIndex);
}
// Update maxLength
boolean repaintItems = !isItemHidden(addedIndex);
*** 1103,1113 ****
options = (repaintItems ? (PAINT_ITEMS):0)
| ((maxLength != oldMaxLength || (hsbWasVis ^ hsbVis))?(PAINT_HSCROLL):0)
| ((vsb.needsRepaint())?(PAINT_VSCROLL):0);
}
! if (log.isLoggable(PlatformLogger.FINEST)) {
log.finest("Last visible: " + getLastVisibleItem() +
", hsb changed : " + (hsbWasVis ^ hsbVis) + ", items changed " + repaintItems);
}
repaint(addedIndex, getLastVisibleItem(), options);
}
--- 1103,1113 ----
options = (repaintItems ? (PAINT_ITEMS):0)
| ((maxLength != oldMaxLength || (hsbWasVis ^ hsbVis))?(PAINT_HSCROLL):0)
| ((vsb.needsRepaint())?(PAINT_VSCROLL):0);
}
! if (log.isLoggable(PlatformLogger.Level.FINEST)) {
log.finest("Last visible: " + getLastVisibleItem() +
", hsb changed : " + (hsbWasVis ^ hsbVis) + ", items changed " + repaintItems);
}
repaint(addedIndex, getLastVisibleItem(), options);
}
*** 1121,1135 ****
// save the current state of the scrollbars
boolean hsbWasVisible = hsbVis;
boolean vsbWasVisible = vsbVis;
int oldLastDisplayed = lastItemDisplayed();
! if (log.isLoggable(PlatformLogger.FINE)) {
log.fine("Deleting from " + s + " to " + e);
}
! if (log.isLoggable(PlatformLogger.FINEST)) {
log.finest("Last displayed item: " + oldLastDisplayed + ", items in window " + itemsInWindow() +
", size " + items.size());
}
if (items.size() == 0) {
--- 1121,1135 ----
// save the current state of the scrollbars
boolean hsbWasVisible = hsbVis;
boolean vsbWasVisible = vsbVis;
int oldLastDisplayed = lastItemDisplayed();
! if (log.isLoggable(PlatformLogger.Level.FINE)) {
log.fine("Deleting from " + s + " to " + e);
}
! if (log.isLoggable(PlatformLogger.Level.FINEST)) {
log.finest("Last displayed item: " + oldLastDisplayed + ", items in window " + itemsInWindow() +
", size " + items.size());
}
if (items.size() == 0) {
*** 1195,1205 ****
int focusBound = (items.size() > 0) ? 0 : -1;
setFocusIndex(Math.max(s-1, focusBound));
options |= PAINT_FOCUS;
}
! if (log.isLoggable(PlatformLogger.FINEST)) {
log.finest("Multiple selections: " + multipleSelections);
}
// update vsb.val
if (vsb.getValue() >= s) {
--- 1195,1205 ----
int focusBound = (items.size() > 0) ? 0 : -1;
setFocusIndex(Math.max(s-1, focusBound));
options |= PAINT_FOCUS;
}
! if (log.isLoggable(PlatformLogger.Level.FINEST)) {
log.finest("Multiple selections: " + multipleSelections);
}
// update vsb.val
if (vsb.getValue() >= s) {
*** 1450,1460 ****
/**
* scrollVertical
* y is the number of items to scroll
*/
void scrollVertical(int y) {
! if (log.isLoggable(PlatformLogger.FINE)) {
log.fine("Scrolling vertically by " + y);
}
int itemsInWin = itemsInWindow();
int h = getItemHeight();
int pixelsToScroll = y * h;
--- 1450,1460 ----
/**
* scrollVertical
* y is the number of items to scroll
*/
void scrollVertical(int y) {
! if (log.isLoggable(PlatformLogger.Level.FINE)) {
log.fine("Scrolling vertically by " + y);
}
int itemsInWin = itemsInWindow();
int h = getItemHeight();
int pixelsToScroll = y * h;
*** 1492,1502 ****
/**
* scrollHorizontal
* x is the number of pixels to scroll
*/
void scrollHorizontal(int x) {
! if (log.isLoggable(PlatformLogger.FINE)) {
log.fine("Scrolling horizontally by " + y);
}
int w = getListWidth();
w -= ((2 * SPACE) + (2 * MARGIN));
int h = height - (SCROLLBAR_AREA + (2 * MARGIN));
--- 1492,1502 ----
/**
* scrollHorizontal
* x is the number of pixels to scroll
*/
void scrollHorizontal(int x) {
! if (log.isLoggable(PlatformLogger.Level.FINE)) {
log.fine("Scrolling horizontally by " + y);
}
int w = getListWidth();
w -= ((2 * SPACE) + (2 * MARGIN));
int h = height - (SCROLLBAR_AREA + (2 * MARGIN));
*** 1730,1740 ****
} finally {
XToolkit.awtUnlock();
}
if (localBuffer == null) {
! if (log.isLoggable(PlatformLogger.FINE)) {
log.fine("Creating buffer " + width + "x" + height);
}
// use GraphicsConfig.cCVI() instead of Component.cVI(),
// because the latter may cause a deadlock with the tree lock
localBuffer =
--- 1730,1740 ----
} finally {
XToolkit.awtUnlock();
}
if (localBuffer == null) {
! if (log.isLoggable(PlatformLogger.Level.FINE)) {
log.fine("Creating buffer " + width + "x" + height);
}
// use GraphicsConfig.cCVI() instead of Component.cVI(),
// because the latter may cause a deadlock with the tree lock
localBuffer =
*** 1769,1779 ****
paint(listG, firstItem, lastItem, options, null, null);
}
private void paint(Graphics listG, int firstItem, int lastItem, int options,
Rectangle source, Point distance) {
! if (log.isLoggable(PlatformLogger.FINER)) {
log.finer("Repaint from " + firstItem + " to " + lastItem + " options " + options);
}
if (firstItem > lastItem) {
int t = lastItem;
lastItem = firstItem;
--- 1769,1779 ----
paint(listG, firstItem, lastItem, options, null, null);
}
private void paint(Graphics listG, int firstItem, int lastItem, int options,
Rectangle source, Point distance) {
! if (log.isLoggable(PlatformLogger.Level.FINER)) {
log.finer("Repaint from " + firstItem + " to " + lastItem + " options " + options);
}
if (firstItem > lastItem) {
int t = lastItem;
lastItem = firstItem;
*** 1860,1870 ****
g.fillRect(0, 0, listWidth, listHeight);
draw3DRect(g, getSystemColors(), 0, 0, listWidth - 1, listHeight - 1, false);
}
private void paintItems(Graphics g, int firstItem, int lastItem, int options) {
! if (log.isLoggable(PlatformLogger.FINER)) {
log.finer("Painting items from " + firstItem + " to " + lastItem + ", focused " + focusIndex + ", first " + getFirstVisibleItem() + ", last " + getLastVisibleItem());
}
firstItem = Math.max(getFirstVisibleItem(), firstItem);
if (firstItem > lastItem) {
--- 1860,1870 ----
g.fillRect(0, 0, listWidth, listHeight);
draw3DRect(g, getSystemColors(), 0, 0, listWidth - 1, listHeight - 1, false);
}
private void paintItems(Graphics g, int firstItem, int lastItem, int options) {
! if (log.isLoggable(PlatformLogger.Level.FINER)) {
log.finer("Painting items from " + firstItem + " to " + lastItem + ", focused " + focusIndex + ", first " + getFirstVisibleItem() + ", last " + getLastVisibleItem());
}
firstItem = Math.max(getFirstVisibleItem(), firstItem);
if (firstItem > lastItem) {
*** 1873,1918 ****
firstItem = t;
}
firstItem = Math.max(getFirstVisibleItem(), firstItem);
lastItem = Math.min(lastItem, items.size()-1);
! if (log.isLoggable(PlatformLogger.FINER)) {
log.finer("Actually painting items from " + firstItem + " to " + lastItem +
", items in window " + itemsInWindow());
}
for (int i = firstItem; i <= lastItem; i++) {
paintItem(g, i);
}
}
private void paintItem(Graphics g, int index) {
! if (log.isLoggable(PlatformLogger.FINEST)) {
log.finest("Painting item " + index);
}
// 4895367 - only paint items which are visible
if (!isItemHidden(index)) {
Shape clip = g.getClip();
int w = getItemWidth();
int h = getItemHeight();
int y = getItemY(index);
int x = getItemX();
! if (log.isLoggable(PlatformLogger.FINEST)) {
log.finest("Setting clip " + new Rectangle(x, y, w - (SPACE*2), h-(SPACE*2)));
}
g.setClip(x, y, w - (SPACE*2), h-(SPACE*2));
// Always paint the background so that focus is unpainted in
// multiselect mode
if (isSelected(index)) {
! if (log.isLoggable(PlatformLogger.FINEST)) {
log.finest("Painted item is selected");
}
g.setColor(getListForeground());
} else {
g.setColor(getListBackground());
}
! if (log.isLoggable(PlatformLogger.FINEST)) {
log.finest("Filling " + new Rectangle(x, y, w, h));
}
g.fillRect(x, y, w, h);
if (index <= getLastVisibleItem() && index < items.size()) {
--- 1873,1918 ----
firstItem = t;
}
firstItem = Math.max(getFirstVisibleItem(), firstItem);
lastItem = Math.min(lastItem, items.size()-1);
! if (log.isLoggable(PlatformLogger.Level.FINER)) {
log.finer("Actually painting items from " + firstItem + " to " + lastItem +
", items in window " + itemsInWindow());
}
for (int i = firstItem; i <= lastItem; i++) {
paintItem(g, i);
}
}
private void paintItem(Graphics g, int index) {
! if (log.isLoggable(PlatformLogger.Level.FINEST)) {
log.finest("Painting item " + index);
}
// 4895367 - only paint items which are visible
if (!isItemHidden(index)) {
Shape clip = g.getClip();
int w = getItemWidth();
int h = getItemHeight();
int y = getItemY(index);
int x = getItemX();
! if (log.isLoggable(PlatformLogger.Level.FINEST)) {
log.finest("Setting clip " + new Rectangle(x, y, w - (SPACE*2), h-(SPACE*2)));
}
g.setClip(x, y, w - (SPACE*2), h-(SPACE*2));
// Always paint the background so that focus is unpainted in
// multiselect mode
if (isSelected(index)) {
! if (log.isLoggable(PlatformLogger.Level.FINEST)) {
log.finest("Painted item is selected");
}
g.setColor(getListForeground());
} else {
g.setColor(getListBackground());
}
! if (log.isLoggable(PlatformLogger.Level.FINEST)) {
log.finest("Filling " + new Rectangle(x, y, w, h));
}
g.fillRect(x, y, w, h);
if (index <= getLastVisibleItem() && index < items.size()) {
*** 1934,1944 ****
g.setClip(clip);
}
}
void paintScrollBar(XScrollbar scr, Graphics g, int x, int y, int width, int height, boolean paintAll) {
! if (log.isLoggable(PlatformLogger.FINEST)) {
log.finest("Painting scrollbar " + scr + " width " +
width + " height " + height + ", paintAll " + paintAll);
}
g.translate(x, y);
scr.paint(g, getSystemColors(), paintAll);
--- 1934,1944 ----
g.setClip(clip);
}
}
void paintScrollBar(XScrollbar scr, Graphics g, int x, int y, int width, int height, boolean paintAll) {
! if (log.isLoggable(PlatformLogger.Level.FINEST)) {
log.finest("Painting scrollbar " + scr + " width " +
width + " height " + height + ", paintAll " + paintAll);
}
g.translate(x, y);
scr.paint(g, getSystemColors(), paintAll);
*** 1974,2005 ****
private void paintFocus(Graphics g, int options) {
boolean paintFocus = (options & PAINT_FOCUS) != 0;
if (paintFocus && !hasFocus()) {
paintFocus = false;
}
! if (log.isLoggable(PlatformLogger.FINE)) {
log.fine("Painting focus, focus index " + getFocusIndex() + ", focus is " +
(isItemHidden(getFocusIndex())?("invisible"):("visible")) + ", paint focus is " + paintFocus);
}
Shape clip = g.getClip();
g.setClip(0, 0, listWidth, listHeight);
! if (log.isLoggable(PlatformLogger.FINEST)) {
log.finest("Setting focus clip " + new Rectangle(0, 0, listWidth, listHeight));
}
Rectangle rect = getFocusRect();
if (prevFocusRect != null) {
// Erase focus rect
! if (log.isLoggable(PlatformLogger.FINEST)) {
log.finest("Erasing previous focus rect " + prevFocusRect);
}
g.setColor(getListBackground());
g.drawRect(prevFocusRect.x, prevFocusRect.y, prevFocusRect.width, prevFocusRect.height);
prevFocusRect = null;
}
if (paintFocus) {
// Paint new
! if (log.isLoggable(PlatformLogger.FINEST)) {
log.finest("Painting focus rect " + rect);
}
g.setColor(getListForeground()); // Focus color is always black on Linux
g.drawRect(rect.x, rect.y, rect.width, rect.height);
prevFocusRect = rect;
--- 1974,2005 ----
private void paintFocus(Graphics g, int options) {
boolean paintFocus = (options & PAINT_FOCUS) != 0;
if (paintFocus && !hasFocus()) {
paintFocus = false;
}
! if (log.isLoggable(PlatformLogger.Level.FINE)) {
log.fine("Painting focus, focus index " + getFocusIndex() + ", focus is " +
(isItemHidden(getFocusIndex())?("invisible"):("visible")) + ", paint focus is " + paintFocus);
}
Shape clip = g.getClip();
g.setClip(0, 0, listWidth, listHeight);
! if (log.isLoggable(PlatformLogger.Level.FINEST)) {
log.finest("Setting focus clip " + new Rectangle(0, 0, listWidth, listHeight));
}
Rectangle rect = getFocusRect();
if (prevFocusRect != null) {
// Erase focus rect
! if (log.isLoggable(PlatformLogger.Level.FINEST)) {
log.finest("Erasing previous focus rect " + prevFocusRect);
}
g.setColor(getListBackground());
g.drawRect(prevFocusRect.x, prevFocusRect.y, prevFocusRect.width, prevFocusRect.height);
prevFocusRect = null;
}
if (paintFocus) {
// Paint new
! if (log.isLoggable(PlatformLogger.Level.FINEST)) {
log.finest("Painting focus rect " + rect);
}
g.setColor(getListForeground()); // Focus color is always black on Linux
g.drawRect(rect.x, rect.y, rect.width, rect.height);
prevFocusRect = rect;