8035165: Expose internal representation in sun.awt.X11
Reviewed-by: pchelko, prr
This commit is contained in:
parent
c18253fc9a
commit
94f1aff5ba
@ -43,7 +43,7 @@ import sun.awt.HeadlessToolkit;
|
|||||||
import sun.awt.util.ThreadGroupUtils;
|
import sun.awt.util.ThreadGroupUtils;
|
||||||
import sun.lwawt.macosx.*;
|
import sun.lwawt.macosx.*;
|
||||||
|
|
||||||
public class CFontManager extends SunFontManager {
|
public final class CFontManager extends SunFontManager {
|
||||||
private FontConfigManager fcManager = null;
|
private FontConfigManager fcManager = null;
|
||||||
private static Hashtable<String, Font2D> genericFonts = new Hashtable<String, Font2D>();
|
private static Hashtable<String, Font2D> genericFonts = new Hashtable<String, Font2D>();
|
||||||
|
|
||||||
@ -61,20 +61,14 @@ public class CFontManager extends SunFontManager {
|
|||||||
return new CFontConfiguration(this, preferLocaleFonts, preferPropFonts);
|
return new CFontConfiguration(this, preferLocaleFonts, preferPropFonts);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String[] defaultPlatformFont = null;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Returns an array of two strings. The first element is the
|
* Returns an array of two strings. The first element is the
|
||||||
* name of the font. The second element is the file name.
|
* name of the font. The second element is the file name.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public synchronized String[] getDefaultPlatformFont() {
|
protected String[] getDefaultPlatformFont() {
|
||||||
if (defaultPlatformFont == null) {
|
return new String[]{"Lucida Grande",
|
||||||
defaultPlatformFont = new String[2];
|
"/System/Library/Fonts/LucidaGrande.ttc"};
|
||||||
defaultPlatformFont[0] = "Lucida Grande";
|
|
||||||
defaultPlatformFont[1] = "/System/Library/Fonts/LucidaGrande.ttc";
|
|
||||||
}
|
|
||||||
return defaultPlatformFont;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// This is a way to register any kind of Font2D, not just files and composites.
|
// This is a way to register any kind of Font2D, not just files and composites.
|
||||||
|
@ -3198,7 +3198,7 @@ public abstract class SunFontManager implements FontSupport, FontManagerForSGE {
|
|||||||
* Returns an array of two strings. The first element is the
|
* Returns an array of two strings. The first element is the
|
||||||
* name of the font. The second element is the file name.
|
* name of the font. The second element is the file name.
|
||||||
*/
|
*/
|
||||||
public abstract String[] getDefaultPlatformFont();
|
protected abstract String[] getDefaultPlatformFont();
|
||||||
|
|
||||||
// Begin: Refactored from SunGraphicsEnviroment.
|
// Begin: Refactored from SunGraphicsEnviroment.
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -40,7 +40,7 @@ import sun.util.logging.PlatformLogger;
|
|||||||
* For now, this class manages the list of items and painting thereof, but not
|
* For now, this class manages the list of items and painting thereof, but not
|
||||||
* posting of Item or ActionEvents
|
* posting of Item or ActionEvents
|
||||||
*/
|
*/
|
||||||
public class ListHelper implements XScrollbarClient {
|
final class ListHelper implements XScrollbarClient {
|
||||||
private static final PlatformLogger log = PlatformLogger.getLogger("sun.awt.X11.ListHelper");
|
private static final PlatformLogger log = PlatformLogger.getLogger("sun.awt.X11.ListHelper");
|
||||||
|
|
||||||
private final int FOCUS_INSET = 1;
|
private final int FOCUS_INSET = 1;
|
||||||
@ -79,24 +79,16 @@ public class ListHelper implements XScrollbarClient {
|
|||||||
// Holds the true if mouse is dragging outside of the area of the list
|
// Holds the true if mouse is dragging outside of the area of the list
|
||||||
// The flag is used at the moment of the dragging and releasing mouse
|
// The flag is used at the moment of the dragging and releasing mouse
|
||||||
// See 6243382 for more information
|
// See 6243382 for more information
|
||||||
boolean mouseDraggedOutVertically = false;
|
private boolean mouseDraggedOutVertically = false;
|
||||||
private volatile boolean vsbVisibilityChanged = false;
|
private volatile boolean vsbVisibilityChanged = false;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Comment
|
* Comment
|
||||||
*/
|
*/
|
||||||
public ListHelper(XWindow peer,
|
ListHelper(XWindow peer, Color[] colors, int initialSize,
|
||||||
Color[] colors,
|
boolean multiSelect, boolean scrollVert, boolean scrollHoriz,
|
||||||
int initialSize,
|
Font font, int maxVisItems, int SPACE, int MARGIN, int BORDER,
|
||||||
boolean multiSelect,
|
int SCROLLBAR) {
|
||||||
boolean scrollVert,
|
|
||||||
boolean scrollHoriz,
|
|
||||||
Font font,
|
|
||||||
int maxVisItems,
|
|
||||||
int SPACE,
|
|
||||||
int MARGIN,
|
|
||||||
int BORDER,
|
|
||||||
int SCROLLBAR) {
|
|
||||||
this.peer = peer;
|
this.peer = peer;
|
||||||
this.colors = colors;
|
this.colors = colors;
|
||||||
this.multiSelect = multiSelect;
|
this.multiSelect = multiSelect;
|
||||||
@ -121,6 +113,7 @@ public class ListHelper implements XScrollbarClient {
|
|||||||
SCROLLBAR_WIDTH = SCROLLBAR;
|
SCROLLBAR_WIDTH = SCROLLBAR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Component getEventSource() {
|
public Component getEventSource() {
|
||||||
return peer.getEventSource();
|
return peer.getEventSource();
|
||||||
}
|
}
|
||||||
@ -129,36 +122,36 @@ public class ListHelper implements XScrollbarClient {
|
|||||||
/* List management methods */
|
/* List management methods */
|
||||||
/**********************************************************************/
|
/**********************************************************************/
|
||||||
|
|
||||||
public void add(String item) {
|
void add(String item) {
|
||||||
items.add(item);
|
items.add(item);
|
||||||
updateScrollbars();
|
updateScrollbars();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void add(String item, int index) {
|
void add(String item, int index) {
|
||||||
items.add(index, item);
|
items.add(index, item);
|
||||||
updateScrollbars();
|
updateScrollbars();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void remove(String item) {
|
void remove(String item) {
|
||||||
// FIXME: need to clean up select list, too?
|
// FIXME: need to clean up select list, too?
|
||||||
items.remove(item);
|
items.remove(item);
|
||||||
updateScrollbars();
|
updateScrollbars();
|
||||||
// Is vsb visible now?
|
// Is vsb visible now?
|
||||||
}
|
}
|
||||||
|
|
||||||
public void remove(int index) {
|
void remove(int index) {
|
||||||
// FIXME: need to clean up select list, too?
|
// FIXME: need to clean up select list, too?
|
||||||
items.remove(index);
|
items.remove(index);
|
||||||
updateScrollbars();
|
updateScrollbars();
|
||||||
// Is vsb visible now?
|
// Is vsb visible now?
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeAll() {
|
void removeAll() {
|
||||||
items.removeAll(items);
|
items.removeAll(items);
|
||||||
updateScrollbars();
|
updateScrollbars();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMultiSelect(boolean ms) {
|
void setMultiSelect(boolean ms) {
|
||||||
multiSelect = ms;
|
multiSelect = ms;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -167,7 +160,7 @@ public class ListHelper implements XScrollbarClient {
|
|||||||
* merely keeps internal track of which items are selected for painting
|
* merely keeps internal track of which items are selected for painting
|
||||||
* dealing with target Components happens elsewhere
|
* dealing with target Components happens elsewhere
|
||||||
*/
|
*/
|
||||||
public void select(int index) {
|
void select(int index) {
|
||||||
if (index > getItemCount() - 1) {
|
if (index > getItemCount() - 1) {
|
||||||
index = (isEmpty() ? -1 : 0);
|
index = (isEmpty() ? -1 : 0);
|
||||||
}
|
}
|
||||||
@ -182,13 +175,13 @@ public class ListHelper implements XScrollbarClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* docs */
|
/* docs */
|
||||||
public void deselect(int index) {
|
void deselect(int index) {
|
||||||
assert(false);
|
assert(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* docs */
|
/* docs */
|
||||||
/* if called for multiselect, return -1 */
|
/* if called for multiselect, return -1 */
|
||||||
public int getSelectedIndex() {
|
int getSelectedIndex() {
|
||||||
if (!multiSelect) {
|
if (!multiSelect) {
|
||||||
Integer val = selected.get(0);
|
Integer val = selected.get(0);
|
||||||
return val.intValue();
|
return val.intValue();
|
||||||
@ -202,21 +195,21 @@ public class ListHelper implements XScrollbarClient {
|
|||||||
* A getter method for XChoicePeer.
|
* A getter method for XChoicePeer.
|
||||||
* Returns vsbVisiblityChanged value and sets it to false.
|
* Returns vsbVisiblityChanged value and sets it to false.
|
||||||
*/
|
*/
|
||||||
public boolean checkVsbVisibilityChangedAndReset(){
|
boolean checkVsbVisibilityChangedAndReset(){
|
||||||
boolean returnVal = vsbVisibilityChanged;
|
boolean returnVal = vsbVisibilityChanged;
|
||||||
vsbVisibilityChanged = false;
|
vsbVisibilityChanged = false;
|
||||||
return returnVal;
|
return returnVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isEmpty() {
|
boolean isEmpty() {
|
||||||
return items.isEmpty();
|
return items.isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getItemCount() {
|
int getItemCount() {
|
||||||
return items.size();
|
return items.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getItem(int index) {
|
String getItem(int index) {
|
||||||
return items.get(index);
|
return items.get(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -224,15 +217,15 @@ public class ListHelper implements XScrollbarClient {
|
|||||||
/* GUI-related methods */
|
/* GUI-related methods */
|
||||||
/**********************************************************************/
|
/**********************************************************************/
|
||||||
|
|
||||||
public void setFocusedIndex(int index) {
|
void setFocusedIndex(int index) {
|
||||||
focusedIndex = index;
|
focusedIndex = index;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isFocusedIndex(int index) {
|
private boolean isFocusedIndex(int index) {
|
||||||
return index == focusedIndex;
|
return index == focusedIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setFont(Font newFont) {
|
void setFont(Font newFont) {
|
||||||
if (newFont != font) {
|
if (newFont != font) {
|
||||||
font = newFont;
|
font = newFont;
|
||||||
fm = Toolkit.getDefaultToolkit().getFontMetrics(font);
|
fm = Toolkit.getDefaultToolkit().getFontMetrics(font);
|
||||||
@ -243,7 +236,7 @@ public class ListHelper implements XScrollbarClient {
|
|||||||
/*
|
/*
|
||||||
* Returns width of the text of the longest item
|
* Returns width of the text of the longest item
|
||||||
*/
|
*/
|
||||||
public int getMaxItemWidth() {
|
int getMaxItemWidth() {
|
||||||
int m = 0;
|
int m = 0;
|
||||||
int end = getItemCount();
|
int end = getItemCount();
|
||||||
for(int i = 0 ; i < end ; i++) {
|
for(int i = 0 ; i < end ; i++) {
|
||||||
@ -260,7 +253,7 @@ public class ListHelper implements XScrollbarClient {
|
|||||||
return fm.getHeight() + (2*TEXT_SPACE);
|
return fm.getHeight() + (2*TEXT_SPACE);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int y2index(int y) {
|
int y2index(int y) {
|
||||||
if (log.isLoggable(PlatformLogger.Level.FINE)) {
|
if (log.isLoggable(PlatformLogger.Level.FINE)) {
|
||||||
log.fine("y=" + y +", firstIdx=" + firstDisplayedIndex() +", itemHeight=" + getItemHeight()
|
log.fine("y=" + y +", firstIdx=" + firstDisplayedIndex() +", itemHeight=" + getItemHeight()
|
||||||
+ ",item_margin=" + ITEM_MARGIN);
|
+ ",item_margin=" + ITEM_MARGIN);
|
||||||
@ -275,14 +268,14 @@ public class ListHelper implements XScrollbarClient {
|
|||||||
public int numItemsDisplayed() {}
|
public int numItemsDisplayed() {}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public int firstDisplayedIndex() {
|
int firstDisplayedIndex() {
|
||||||
if (vsbVis) {
|
if (vsbVis) {
|
||||||
return vsb.getValue();
|
return vsb.getValue();
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int lastDisplayedIndex() {
|
int lastDisplayedIndex() {
|
||||||
// FIXME: need to account for horiz scroll bar
|
// FIXME: need to account for horiz scroll bar
|
||||||
if (hsbVis) {
|
if (hsbVis) {
|
||||||
assert false : "Implement for horiz scroll bar";
|
assert false : "Implement for horiz scroll bar";
|
||||||
@ -294,7 +287,7 @@ public class ListHelper implements XScrollbarClient {
|
|||||||
/*
|
/*
|
||||||
* If the given index is not visible in the List, scroll so that it is.
|
* If the given index is not visible in the List, scroll so that it is.
|
||||||
*/
|
*/
|
||||||
public void makeVisible(int index) {
|
private void makeVisible(int index) {
|
||||||
if (vsbVis) {
|
if (vsbVis) {
|
||||||
if (index < firstDisplayedIndex()) {
|
if (index < firstDisplayedIndex()) {
|
||||||
vsb.setValue(index);
|
vsb.setValue(index);
|
||||||
@ -306,7 +299,7 @@ public class ListHelper implements XScrollbarClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: multi-select needs separate focused index
|
// FIXME: multi-select needs separate focused index
|
||||||
public void up() {
|
void up() {
|
||||||
int curIdx = getSelectedIndex();
|
int curIdx = getSelectedIndex();
|
||||||
int numItems = getItemCount();
|
int numItems = getItemCount();
|
||||||
int newIdx;
|
int newIdx;
|
||||||
@ -323,12 +316,12 @@ public class ListHelper implements XScrollbarClient {
|
|||||||
select(newIdx);
|
select(newIdx);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void down() {
|
void down() {
|
||||||
int newIdx = (getSelectedIndex() + 1) % getItemCount();
|
int newIdx = (getSelectedIndex() + 1) % getItemCount();
|
||||||
select(newIdx);
|
select(newIdx);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void pageUp() {
|
void pageUp() {
|
||||||
// FIXME: for multi-select, move the focused item, not the selected item
|
// FIXME: for multi-select, move the focused item, not the selected item
|
||||||
if (vsbVis && firstDisplayedIndex() > 0) {
|
if (vsbVis && firstDisplayedIndex() > 0) {
|
||||||
if (multiSelect) {
|
if (multiSelect) {
|
||||||
@ -343,7 +336,7 @@ public class ListHelper implements XScrollbarClient {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public void pageDown() {
|
void pageDown() {
|
||||||
if (vsbVis && lastDisplayedIndex() < getItemCount() - 1) {
|
if (vsbVis && lastDisplayedIndex() < getItemCount() - 1) {
|
||||||
if (multiSelect) {
|
if (multiSelect) {
|
||||||
assert false : "Implement pageDown() for multiSelect";
|
assert false : "Implement pageDown() for multiSelect";
|
||||||
@ -357,17 +350,17 @@ public class ListHelper implements XScrollbarClient {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public void home() {}
|
void home() {}
|
||||||
public void end() {}
|
void end() {}
|
||||||
|
|
||||||
|
|
||||||
public boolean isVSBVisible() { return vsbVis; }
|
boolean isVSBVisible() { return vsbVis; }
|
||||||
public boolean isHSBVisible() { return hsbVis; }
|
boolean isHSBVisible() { return hsbVis; }
|
||||||
|
|
||||||
public XVerticalScrollbar getVSB() { return vsb; }
|
XVerticalScrollbar getVSB() { return vsb; }
|
||||||
public XHorizontalScrollbar getHSB() { return hsb; }
|
XHorizontalScrollbar getHSB() { return hsb; }
|
||||||
|
|
||||||
public boolean isInVertSB(Rectangle bounds, int x, int y) {
|
boolean isInVertSB(Rectangle bounds, int x, int y) {
|
||||||
if (vsbVis) {
|
if (vsbVis) {
|
||||||
assert vsb != null : "Vert scrollbar is visible, yet is null?";
|
assert vsb != null : "Vert scrollbar is visible, yet is null?";
|
||||||
int sbHeight = hsbVis ? bounds.height - SCROLLBAR_WIDTH : bounds.height;
|
int sbHeight = hsbVis ? bounds.height - SCROLLBAR_WIDTH : bounds.height;
|
||||||
@ -379,7 +372,7 @@ public class ListHelper implements XScrollbarClient {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isInHorizSB(Rectangle bounds, int x, int y) {
|
boolean isInHorizSB(Rectangle bounds, int x, int y) {
|
||||||
if (hsbVis) {
|
if (hsbVis) {
|
||||||
assert hsb != null : "Horiz scrollbar is visible, yet is null?";
|
assert hsb != null : "Horiz scrollbar is visible, yet is null?";
|
||||||
|
|
||||||
@ -392,7 +385,7 @@ public class ListHelper implements XScrollbarClient {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void handleVSBEvent(MouseEvent e, Rectangle bounds, int x, int y) {
|
void handleVSBEvent(MouseEvent e, Rectangle bounds, int x, int y) {
|
||||||
int sbHeight = hsbVis ? bounds.height - SCROLLBAR_WIDTH : bounds.height;
|
int sbHeight = hsbVis ? bounds.height - SCROLLBAR_WIDTH : bounds.height;
|
||||||
|
|
||||||
vsb.handleMouseEvent(e.getID(),
|
vsb.handleMouseEvent(e.getID(),
|
||||||
@ -405,7 +398,7 @@ public class ListHelper implements XScrollbarClient {
|
|||||||
* Called when items are added/removed.
|
* Called when items are added/removed.
|
||||||
* Update whether the scrollbar is visible or not, scrollbar values
|
* Update whether the scrollbar is visible or not, scrollbar values
|
||||||
*/
|
*/
|
||||||
void updateScrollbars() {
|
private void updateScrollbars() {
|
||||||
boolean oldVsbVis = vsbVis;
|
boolean oldVsbVis = vsbVis;
|
||||||
vsbVis = vsb != null && items.size() > maxVisItems;
|
vsbVis = vsb != null && items.size() > maxVisItems;
|
||||||
if (vsbVis) {
|
if (vsbVis) {
|
||||||
@ -420,10 +413,11 @@ public class ListHelper implements XScrollbarClient {
|
|||||||
// FIXME: check if added item makes a hsb necessary (if supported, that of course)
|
// FIXME: check if added item makes a hsb necessary (if supported, that of course)
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getNumItemsDisplayed() {
|
private int getNumItemsDisplayed() {
|
||||||
return items.size() > maxVisItems ? maxVisItems : items.size();
|
return items.size() > maxVisItems ? maxVisItems : items.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void repaintScrollbarRequest(XScrollbar sb) {
|
public void repaintScrollbarRequest(XScrollbar sb) {
|
||||||
Graphics g = peer.getGraphics();
|
Graphics g = peer.getGraphics();
|
||||||
Rectangle bounds = peer.getBounds();
|
Rectangle bounds = peer.getBounds();
|
||||||
@ -436,6 +430,7 @@ public class ListHelper implements XScrollbarClient {
|
|||||||
g.dispose();
|
g.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void notifyValue(XScrollbar obj, int type, int v, boolean isAdjusting) {
|
public void notifyValue(XScrollbar obj, int type, int v, boolean isAdjusting) {
|
||||||
if (obj == vsb) {
|
if (obj == vsb) {
|
||||||
int oldScrollValue = vsb.getValue();
|
int oldScrollValue = vsb.getValue();
|
||||||
@ -467,7 +462,7 @@ public class ListHelper implements XScrollbarClient {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateColors(Color[] newColors) {
|
void updateColors(Color[] newColors) {
|
||||||
colors = newColors;
|
colors = newColors;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -481,7 +476,7 @@ public class ListHelper implements XScrollbarClient {
|
|||||||
XVerticalScrollbar vsb,
|
XVerticalScrollbar vsb,
|
||||||
XHorizontalScrollbar hsb) {
|
XHorizontalScrollbar hsb) {
|
||||||
*/
|
*/
|
||||||
public void paintItems(Graphics g,
|
void paintItems(Graphics g,
|
||||||
Color[] colors,
|
Color[] colors,
|
||||||
Rectangle bounds) {
|
Rectangle bounds) {
|
||||||
// paint border
|
// paint border
|
||||||
@ -490,17 +485,14 @@ public class ListHelper implements XScrollbarClient {
|
|||||||
// paint focus?
|
// paint focus?
|
||||||
|
|
||||||
}
|
}
|
||||||
public void paintAllItems(Graphics g,
|
void paintAllItems(Graphics g,
|
||||||
Color[] colors,
|
Color[] colors,
|
||||||
Rectangle bounds) {
|
Rectangle bounds) {
|
||||||
paintItems(g, colors, bounds,
|
paintItems(g, colors, bounds,
|
||||||
firstDisplayedIndex(), lastDisplayedIndex());
|
firstDisplayedIndex(), lastDisplayedIndex());
|
||||||
}
|
}
|
||||||
public void paintItems(Graphics g,
|
private void paintItems(Graphics g, Color[] colors, Rectangle bounds,
|
||||||
Color[] colors,
|
int first, int last) {
|
||||||
Rectangle bounds,
|
|
||||||
int first,
|
|
||||||
int last) {
|
|
||||||
peer.flush();
|
peer.flush();
|
||||||
int x = BORDER_WIDTH + ITEM_MARGIN;
|
int x = BORDER_WIDTH + ITEM_MARGIN;
|
||||||
int width = bounds.width - 2*ITEM_MARGIN - 2*BORDER_WIDTH - (vsbVis ? SCROLLBAR_WIDTH : 0);
|
int width = bounds.width - 2*ITEM_MARGIN - 2*BORDER_WIDTH - (vsbVis ? SCROLLBAR_WIDTH : 0);
|
||||||
@ -529,12 +521,9 @@ public class ListHelper implements XScrollbarClient {
|
|||||||
/*
|
/*
|
||||||
* comment about what is painted (i.e. the focus rect
|
* comment about what is painted (i.e. the focus rect
|
||||||
*/
|
*/
|
||||||
public void paintItem(Graphics g,
|
private void paintItem(Graphics g, Color[] colors, String string, int x,
|
||||||
Color[] colors,
|
int y, int width, int height, boolean selected,
|
||||||
String string,
|
boolean focused) {
|
||||||
int x, int y, int width, int height,
|
|
||||||
boolean selected,
|
|
||||||
boolean focused) {
|
|
||||||
//System.out.println("LP.pI(): x="+x+" y="+y+" w="+width+" h="+height);
|
//System.out.println("LP.pI(): x="+x+" y="+y+" w="+width+" h="+height);
|
||||||
//g.setColor(colors[BACKGROUND_COLOR]);
|
//g.setColor(colors[BACKGROUND_COLOR]);
|
||||||
|
|
||||||
@ -575,7 +564,7 @@ public class ListHelper implements XScrollbarClient {
|
|||||||
//g.clipRect(clip.x, clip.y, clip.width, clip.height);
|
//g.clipRect(clip.x, clip.y, clip.width, clip.height);
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean isItemSelected(int index) {
|
private boolean isItemSelected(int index) {
|
||||||
Iterator<Integer> itr = selected.iterator();
|
Iterator<Integer> itr = selected.iterator();
|
||||||
while (itr.hasNext()) {
|
while (itr.hasNext()) {
|
||||||
Integer val = itr.next();
|
Integer val = itr.next();
|
||||||
@ -586,7 +575,7 @@ public class ListHelper implements XScrollbarClient {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void paintVSB(Graphics g, Color colors[], Rectangle bounds) {
|
private void paintVSB(Graphics g, Color colors[], Rectangle bounds) {
|
||||||
int height = bounds.height - 2*BORDER_WIDTH - (hsbVis ? (SCROLLBAR_WIDTH-2) : 0);
|
int height = bounds.height - 2*BORDER_WIDTH - (hsbVis ? (SCROLLBAR_WIDTH-2) : 0);
|
||||||
Graphics ng = g.create();
|
Graphics ng = g.create();
|
||||||
|
|
||||||
@ -602,7 +591,7 @@ public class ListHelper implements XScrollbarClient {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void paintHSB(Graphics g, Color colors[], Rectangle bounds) {
|
private void paintHSB(Graphics g, Color colors[], Rectangle bounds) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -43,7 +43,7 @@ import sun.awt.datatransfer.DataTransferer;
|
|||||||
/**
|
/**
|
||||||
* A class which interfaces with the X11 selection service.
|
* A class which interfaces with the X11 selection service.
|
||||||
*/
|
*/
|
||||||
public final class XSelection {
|
final class XSelection {
|
||||||
|
|
||||||
/* Maps atoms to XSelection instances. */
|
/* Maps atoms to XSelection instances. */
|
||||||
private static final Hashtable<XAtom, XSelection> table = new Hashtable<XAtom, XSelection>();
|
private static final Hashtable<XAtom, XSelection> table = new Hashtable<XAtom, XSelection>();
|
||||||
@ -119,11 +119,10 @@ public final class XSelection {
|
|||||||
/**
|
/**
|
||||||
* Creates a selection object.
|
* Creates a selection object.
|
||||||
*
|
*
|
||||||
* @param atom the selection atom.
|
* @param atom the selection atom
|
||||||
* @param clpbrd the corresponding clipoboard
|
* @throws NullPointerException if atom is {@code null}
|
||||||
* @exception NullPointerException if atom is <code>null</code>.
|
|
||||||
*/
|
*/
|
||||||
public XSelection(XAtom atom) {
|
XSelection(XAtom atom) {
|
||||||
if (atom == null) {
|
if (atom == null) {
|
||||||
throw new NullPointerException("Null atom");
|
throw new NullPointerException("Null atom");
|
||||||
}
|
}
|
||||||
@ -135,10 +134,9 @@ public final class XSelection {
|
|||||||
return selectionAtom;
|
return selectionAtom;
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized boolean setOwner(Transferable contents,
|
synchronized boolean setOwner(Transferable contents,
|
||||||
Map<Long, DataFlavor> formatMap,
|
Map<Long, DataFlavor> formatMap,
|
||||||
long[] formats, long time)
|
long[] formats, long time) {
|
||||||
{
|
|
||||||
long owner = XWindow.getXAWTRootWindow().getWindow();
|
long owner = XWindow.getXAWTRootWindow().getWindow();
|
||||||
long selection = selectionAtom.getAtom();
|
long selection = selectionAtom.getAtom();
|
||||||
|
|
||||||
@ -435,7 +433,7 @@ public final class XSelection {
|
|||||||
return data != null ? data : new byte[0];
|
return data != null ? data : new byte[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
void validateDataGetter(WindowPropertyGetter propertyGetter)
|
private void validateDataGetter(WindowPropertyGetter propertyGetter)
|
||||||
throws IOException
|
throws IOException
|
||||||
{
|
{
|
||||||
// The order of checks is important because a property getter
|
// The order of checks is important because a property getter
|
||||||
|
@ -1,3 +1,28 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
|
*
|
||||||
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU General Public License version 2 only, as
|
||||||
|
* published by the Free Software Foundation. Oracle designates this
|
||||||
|
* particular file as subject to the "Classpath" exception as provided
|
||||||
|
* by Oracle in the LICENSE file that accompanied this code.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
|
||||||
package sun.awt;
|
package sun.awt;
|
||||||
|
|
||||||
import java.awt.GraphicsEnvironment;
|
import java.awt.GraphicsEnvironment;
|
||||||
@ -29,7 +54,7 @@ import sun.util.logging.PlatformLogger;
|
|||||||
/**
|
/**
|
||||||
* The X11 implementation of {@link FontManager}.
|
* The X11 implementation of {@link FontManager}.
|
||||||
*/
|
*/
|
||||||
public class X11FontManager extends SunFontManager {
|
public final class X11FontManager extends SunFontManager {
|
||||||
|
|
||||||
// constants identifying XLFD and font ID fields
|
// constants identifying XLFD and font ID fields
|
||||||
private static final int FOUNDRY_FIELD = 1;
|
private static final int FOUNDRY_FIELD = 1;
|
||||||
@ -129,8 +154,6 @@ public class X11FontManager extends SunFontManager {
|
|||||||
*/
|
*/
|
||||||
private static String[] fontdirs = null;
|
private static String[] fontdirs = null;
|
||||||
|
|
||||||
private static String[] defaultPlatformFont = null;
|
|
||||||
|
|
||||||
private FontConfigManager fcManager = null;
|
private FontConfigManager fcManager = null;
|
||||||
|
|
||||||
public static X11FontManager getInstance() {
|
public static X11FontManager getInstance() {
|
||||||
@ -768,11 +791,9 @@ public class X11FontManager extends SunFontManager {
|
|||||||
return getFontPathNative(noType1Fonts);
|
return getFontPathNative(noType1Fonts);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String[] getDefaultPlatformFont() {
|
@Override
|
||||||
if (defaultPlatformFont != null) {
|
protected String[] getDefaultPlatformFont() {
|
||||||
return defaultPlatformFont;
|
final String[] info = new String[2];
|
||||||
}
|
|
||||||
String[] info = new String[2];
|
|
||||||
getFontConfigManager().initFontConfigFonts(false);
|
getFontConfigManager().initFontConfigFonts(false);
|
||||||
FontConfigManager.FcCompFont[] fontConfigFonts =
|
FontConfigManager.FcCompFont[] fontConfigFonts =
|
||||||
getFontConfigManager().getFontConfigFonts();
|
getFontConfigManager().getFontConfigFonts();
|
||||||
@ -798,8 +819,7 @@ public class X11FontManager extends SunFontManager {
|
|||||||
info[1] = "/dialog.ttf";
|
info[1] = "/dialog.ttf";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
defaultPlatformFont = info;
|
return info;
|
||||||
return defaultPlatformFont;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized FontConfigManager getFontConfigManager() {
|
public synchronized FontConfigManager getFontConfigManager() {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -37,7 +37,6 @@ import java.util.Locale;
|
|||||||
import java.util.NoSuchElementException;
|
import java.util.NoSuchElementException;
|
||||||
import java.util.StringTokenizer;
|
import java.util.StringTokenizer;
|
||||||
|
|
||||||
import sun.awt.Win32GraphicsEnvironment;
|
|
||||||
import sun.awt.windows.WFontConfiguration;
|
import sun.awt.windows.WFontConfiguration;
|
||||||
import sun.font.FontManager;
|
import sun.font.FontManager;
|
||||||
import sun.font.SunFontManager;
|
import sun.font.SunFontManager;
|
||||||
@ -46,9 +45,7 @@ import sun.font.TrueTypeFont;
|
|||||||
/**
|
/**
|
||||||
* The X11 implementation of {@link FontManager}.
|
* The X11 implementation of {@link FontManager}.
|
||||||
*/
|
*/
|
||||||
public class Win32FontManager extends SunFontManager {
|
public final class Win32FontManager extends SunFontManager {
|
||||||
|
|
||||||
private static String[] defaultPlatformFont = null;
|
|
||||||
|
|
||||||
private static TrueTypeFont eudcFont;
|
private static TrueTypeFont eudcFont;
|
||||||
|
|
||||||
@ -213,12 +210,8 @@ public class Win32FontManager extends SunFontManager {
|
|||||||
|
|
||||||
protected synchronized native String getFontPath(boolean noType1Fonts);
|
protected synchronized native String getFontPath(boolean noType1Fonts);
|
||||||
|
|
||||||
public String[] getDefaultPlatformFont() {
|
@Override
|
||||||
|
protected String[] getDefaultPlatformFont() {
|
||||||
if (defaultPlatformFont != null) {
|
|
||||||
return defaultPlatformFont;
|
|
||||||
}
|
|
||||||
|
|
||||||
String[] info = new String[2];
|
String[] info = new String[2];
|
||||||
info[0] = "Arial";
|
info[0] = "Arial";
|
||||||
info[1] = "c:\\windows\\fonts";
|
info[1] = "c:\\windows\\fonts";
|
||||||
@ -245,8 +238,7 @@ public class Win32FontManager extends SunFontManager {
|
|||||||
info[1] = dirs[0];
|
info[1] = dirs[0];
|
||||||
}
|
}
|
||||||
info[1] = info[1] + File.separator + "arial.ttf";
|
info[1] = info[1] + File.separator + "arial.ttf";
|
||||||
defaultPlatformFont = info;
|
return info;
|
||||||
return defaultPlatformFont;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* register only TrueType/OpenType fonts
|
/* register only TrueType/OpenType fonts
|
||||||
|
Loading…
x
Reference in New Issue
Block a user