1029 |
*/ |
*/ |
1030 |
public Dimension getPreferredScrollableViewportSize() |
public Dimension getPreferredScrollableViewportSize() |
1031 |
{ |
{ |
|
int vis = getVisibleRowCount(); |
|
|
int nrows = getModel() == null ? 0 : getModel().getSize(); |
|
|
// FIXME: this is a somewhat arbitrary default, but.. ? |
|
|
Dimension single = new Dimension(10, 10);; |
|
|
Rectangle bounds = null; |
|
1032 |
|
|
1033 |
if (vis > nrows) |
Dimension retVal = getPreferredSize(); |
1034 |
|
if (getLayoutOrientation() == VERTICAL) |
1035 |
{ |
{ |
1036 |
if (fixedCellWidth != -1 && |
if (fixedCellHeight != -1) |
|
fixedCellHeight != -1) |
|
1037 |
{ |
{ |
1038 |
single = new Dimension(fixedCellWidth, fixedCellHeight); |
if (fixedCellWidth != -1) |
1039 |
} |
{ |
1040 |
else if (nrows != 0 && getUI() != null) |
int size = getModel().getSize(); |
1041 |
{ |
retVal = new Dimension(fixedCellWidth, size * fixedCellHeight); |
1042 |
Rectangle tmp = getUI().getCellBounds(this, 0, 0); |
} // TODO: add else clause (preferredSize is ok for now) |
1043 |
if (tmp != null) |
} // TODO: add else clause (preferredSize is ok for now) |
|
single = tmp.getSize(); |
|
|
} |
|
|
} |
|
|
else if (getUI() != null) |
|
|
{ |
|
|
return getUI().getCellBounds(this, 0, vis - 1).getSize(); |
|
1044 |
} |
} |
1045 |
|
return retVal; |
|
return new Dimension(single.width, single.height * vis); |
|
1046 |
} |
} |
1047 |
|
|
1048 |
/** |
/** |
1181 |
*/ |
*/ |
1182 |
public boolean getScrollableTracksViewportWidth() |
public boolean getScrollableTracksViewportWidth() |
1183 |
{ |
{ |
1184 |
return false; |
Component parent = getParent(); |
1185 |
|
boolean retVal = false; |
1186 |
|
if (parent instanceof JViewport) |
1187 |
|
{ |
1188 |
|
JViewport viewport = (JViewport) parent; |
1189 |
|
Dimension pref = getPreferredSize(); |
1190 |
|
if (viewport.getSize().width > pref.width) |
1191 |
|
retVal = true; |
1192 |
|
if ((getLayoutOrientation() == HORIZONTAL_WRAP) |
1193 |
|
&& (getVisibleRowCount() <= 0)) |
1194 |
|
retVal = true; |
1195 |
|
} |
1196 |
|
return retVal; |
1197 |
} |
} |
1198 |
|
|
1199 |
/** |
/** |
1206 |
*/ |
*/ |
1207 |
public boolean getScrollableTracksViewportHeight() |
public boolean getScrollableTracksViewportHeight() |
1208 |
{ |
{ |
1209 |
return false; |
Component parent = getParent(); |
1210 |
|
boolean retVal = false; |
1211 |
|
if (parent instanceof JViewport) |
1212 |
|
{ |
1213 |
|
JViewport viewport = (JViewport) parent; |
1214 |
|
Dimension pref = getPreferredSize(); |
1215 |
|
if (viewport.getSize().height > pref.height) |
1216 |
|
retVal = true; |
1217 |
|
if ((getLayoutOrientation() == VERTICAL_WRAP) |
1218 |
|
&& (getVisibleRowCount() <= 0)) |
1219 |
|
retVal = true; |
1220 |
|
} |
1221 |
|
return retVal; |
1222 |
} |
} |
1223 |
|
|
1224 |
public int getAnchorSelectionIndex() |
public int getAnchorSelectionIndex() |