|
|
@ -62,7 +62,7 @@ public class DarkListUIBridge extends BasicListUI { |
|
|
|
* The constant BASELINE_COMPONENT_KEY. |
|
|
|
* The constant BASELINE_COMPONENT_KEY. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
protected static final StringBuilder BASELINE_COMPONENT_KEY = |
|
|
|
protected static final StringBuilder BASELINE_COMPONENT_KEY = |
|
|
|
new StringBuilder("List.baselineComponent"); |
|
|
|
new StringBuilder("List.baselineComponent"); |
|
|
|
/** |
|
|
|
/** |
|
|
|
* The bit relates to model changed property. |
|
|
|
* The bit relates to model changed property. |
|
|
|
*/ |
|
|
|
*/ |
|
|
@ -295,20 +295,19 @@ public class DarkListUIBridge extends BasicListUI { |
|
|
|
* @param leadIndex a lead index |
|
|
|
* @param leadIndex a lead index |
|
|
|
* @see #paint |
|
|
|
* @see #paint |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
protected void paintCell( |
|
|
|
protected void paintCell(final Graphics g, |
|
|
|
final Graphics g, |
|
|
|
final int row, |
|
|
|
final int row, |
|
|
|
final Rectangle rowBounds, |
|
|
|
final Rectangle rowBounds, |
|
|
|
final ListCellRenderer cellRenderer, |
|
|
|
final ListCellRenderer cellRenderer, |
|
|
|
final ListModel dataModel, |
|
|
|
final ListModel dataModel, |
|
|
|
final ListSelectionModel selModel, |
|
|
|
final ListSelectionModel selModel, |
|
|
|
final int leadIndex) { |
|
|
|
final int leadIndex) { |
|
|
|
|
|
|
|
Object value = dataModel.getElementAt(row); |
|
|
|
Object value = dataModel.getElementAt(row); |
|
|
|
boolean cellHasFocus = list.hasFocus() && (row == leadIndex); |
|
|
|
boolean cellHasFocus = list.hasFocus() && (row == leadIndex); |
|
|
|
boolean isSelected = selModel.isSelectedIndex(row); |
|
|
|
boolean isSelected = selModel.isSelectedIndex(row); |
|
|
|
|
|
|
|
|
|
|
|
Component rendererComponent = |
|
|
|
Component rendererComponent = |
|
|
|
cellRenderer.getListCellRendererComponent(list, value, row, isSelected, cellHasFocus); |
|
|
|
cellRenderer.getListCellRendererComponent(list, value, row, isSelected, cellHasFocus); |
|
|
|
|
|
|
|
|
|
|
|
int cx = rowBounds.x; |
|
|
|
int cx = rowBounds.x; |
|
|
|
int cy = rowBounds.y; |
|
|
|
int cy = rowBounds.y; |
|
|
@ -356,11 +355,10 @@ public class DarkListUIBridge extends BasicListUI { |
|
|
|
int rowHeight = list.getFixedCellHeight(); |
|
|
|
int rowHeight = list.getFixedCellHeight(); |
|
|
|
UIDefaults lafDefaults = UIManager.getLookAndFeelDefaults(); |
|
|
|
UIDefaults lafDefaults = UIManager.getLookAndFeelDefaults(); |
|
|
|
Component renderer = (Component) lafDefaults.get( |
|
|
|
Component renderer = (Component) lafDefaults.get( |
|
|
|
BASELINE_COMPONENT_KEY); |
|
|
|
BASELINE_COMPONENT_KEY); |
|
|
|
if (renderer == null) { |
|
|
|
if (renderer == null) { |
|
|
|
@SuppressWarnings("unchecked") |
|
|
|
@SuppressWarnings("unchecked") |
|
|
|
ListCellRenderer<Object> lcr = (ListCellRenderer) UIManager.get( |
|
|
|
ListCellRenderer<Object> lcr = (ListCellRenderer<Object>) UIManager.get("List.cellRenderer"); |
|
|
|
"List.cellRenderer"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// fix for 6711072 some LAFs like Nimbus do not provide this
|
|
|
|
// fix for 6711072 some LAFs like Nimbus do not provide this
|
|
|
|
// UIManager key and we should not through a NPE here because of it
|
|
|
|
// UIManager key and we should not through a NPE here because of it
|
|
|
@ -368,7 +366,7 @@ public class DarkListUIBridge extends BasicListUI { |
|
|
|
lcr = new DefaultListCellRenderer(); |
|
|
|
lcr = new DefaultListCellRenderer(); |
|
|
|
} |
|
|
|
} |
|
|
|
renderer = lcr.getListCellRendererComponent( |
|
|
|
renderer = lcr.getListCellRendererComponent( |
|
|
|
list, "a", -1, false, false); |
|
|
|
list, "a", -1, false, false); |
|
|
|
lafDefaults.put(BASELINE_COMPONENT_KEY, renderer); |
|
|
|
lafDefaults.put(BASELINE_COMPONENT_KEY, renderer); |
|
|
|
} |
|
|
|
} |
|
|
|
renderer.setFont(list.getFont()); |
|
|
|
renderer.setFont(list.getFont()); |
|
|
@ -383,7 +381,7 @@ public class DarkListUIBridge extends BasicListUI { |
|
|
|
rowHeight = renderer.getPreferredSize().height; |
|
|
|
rowHeight = renderer.getPreferredSize().height; |
|
|
|
} |
|
|
|
} |
|
|
|
return renderer.getBaseline(Integer.MAX_VALUE, rowHeight) + |
|
|
|
return renderer.getBaseline(Integer.MAX_VALUE, rowHeight) + |
|
|
|
list.getInsets().top; |
|
|
|
list.getInsets().top; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -394,7 +392,7 @@ public class DarkListUIBridge extends BasicListUI { |
|
|
|
* @since 1.6 |
|
|
|
* @since 1.6 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public Component.BaselineResizeBehavior getBaselineResizeBehavior( |
|
|
|
public Component.BaselineResizeBehavior getBaselineResizeBehavior( |
|
|
|
final JComponent c) { |
|
|
|
final JComponent c) { |
|
|
|
super.getBaselineResizeBehavior(c); |
|
|
|
super.getBaselineResizeBehavior(c); |
|
|
|
return Component.BaselineResizeBehavior.CONSTANT_ASCENT; |
|
|
|
return Component.BaselineResizeBehavior.CONSTANT_ASCENT; |
|
|
|
} |
|
|
|
} |
|
|
@ -652,7 +650,7 @@ public class DarkListUIBridge extends BasicListUI { |
|
|
|
|
|
|
|
|
|
|
|
if (list.getCellRenderer() == null) { |
|
|
|
if (list.getCellRenderer() == null) { |
|
|
|
@SuppressWarnings("unchecked") |
|
|
|
@SuppressWarnings("unchecked") |
|
|
|
ListCellRenderer<Object> tmp = (ListCellRenderer) (UIManager.get("List.cellRenderer")); |
|
|
|
ListCellRenderer<Object> tmp = (ListCellRenderer<Object>) (UIManager.get("List.cellRenderer")); |
|
|
|
list.setCellRenderer(tmp); |
|
|
|
list.setCellRenderer(tmp); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -716,7 +714,7 @@ public class DarkListUIBridge extends BasicListUI { |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public void installUI(final JComponent c) { |
|
|
|
public void installUI(final JComponent c) { |
|
|
|
@SuppressWarnings("unchecked") |
|
|
|
@SuppressWarnings("unchecked") |
|
|
|
JList<Object> tmp = (JList) c; |
|
|
|
JList<Object> tmp = (JList<Object>) c; |
|
|
|
list = tmp; |
|
|
|
list = tmp; |
|
|
|
|
|
|
|
|
|
|
|
layoutOrientation = list.getLayoutOrientation(); |
|
|
|
layoutOrientation = list.getLayoutOrientation(); |
|
|
@ -755,12 +753,12 @@ public class DarkListUIBridge extends BasicListUI { |
|
|
|
InputMap getInputMap(final int condition) { |
|
|
|
InputMap getInputMap(final int condition) { |
|
|
|
if (condition == JComponent.WHEN_FOCUSED) { |
|
|
|
if (condition == JComponent.WHEN_FOCUSED) { |
|
|
|
InputMap keyMap = (InputMap) DefaultLookup.get( |
|
|
|
InputMap keyMap = (InputMap) DefaultLookup.get( |
|
|
|
list, this, "List.focusInputMap"); |
|
|
|
list, this, "List.focusInputMap"); |
|
|
|
InputMap rtlKeyMap; |
|
|
|
InputMap rtlKeyMap; |
|
|
|
|
|
|
|
|
|
|
|
if (isLeftToRight || |
|
|
|
if (isLeftToRight || |
|
|
|
((rtlKeyMap = (InputMap) DefaultLookup.get(list, this, |
|
|
|
((rtlKeyMap = (InputMap) DefaultLookup.get(list, this, |
|
|
|
"List.focusInputMap.RightToLeft")) == null)) { |
|
|
|
"List.focusInputMap.RightToLeft")) == null)) { |
|
|
|
return keyMap; |
|
|
|
return keyMap; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
rtlKeyMap.setParent(keyMap); |
|
|
|
rtlKeyMap.setParent(keyMap); |
|
|
@ -1204,10 +1202,10 @@ public class DarkListUIBridge extends BasicListUI { |
|
|
|
switch (layoutOrientation) { |
|
|
|
switch (layoutOrientation) { |
|
|
|
case JList.VERTICAL_WRAP: |
|
|
|
case JList.VERTICAL_WRAP: |
|
|
|
return Math.min(list.getModel().getSize() - 1, rowsPerColumn * |
|
|
|
return Math.min(list.getModel().getSize() - 1, rowsPerColumn * |
|
|
|
column + Math.min(row, rowsPerColumn - 1)); |
|
|
|
column + Math.min(row, rowsPerColumn - 1)); |
|
|
|
case JList.HORIZONTAL_WRAP: |
|
|
|
case JList.HORIZONTAL_WRAP: |
|
|
|
return Math.min(list.getModel().getSize() - 1, row * columnCount + |
|
|
|
return Math.min(list.getModel().getSize() - 1, row * columnCount + |
|
|
|
column); |
|
|
|
column); |
|
|
|
default: |
|
|
|
default: |
|
|
|
return row; |
|
|
|
return row; |
|
|
|
} |
|
|
|
} |
|
|
@ -1262,7 +1260,7 @@ public class DarkListUIBridge extends BasicListUI { |
|
|
|
rowsPerColumn = visRows; |
|
|
|
rowsPerColumn = visRows; |
|
|
|
columnCount = Math.max(1, dataModelSize / rowsPerColumn); |
|
|
|
columnCount = Math.max(1, dataModelSize / rowsPerColumn); |
|
|
|
if (dataModelSize > 0 && dataModelSize > rowsPerColumn && |
|
|
|
if (dataModelSize > 0 && dataModelSize > rowsPerColumn && |
|
|
|
dataModelSize % rowsPerColumn != 0) { |
|
|
|
dataModelSize % rowsPerColumn != 0) { |
|
|
|
columnCount++; |
|
|
|
columnCount++; |
|
|
|
} |
|
|
|
} |
|
|
|
if (layoutOrientation == JList.HORIZONTAL_WRAP) { |
|
|
|
if (layoutOrientation == JList.HORIZONTAL_WRAP) { |
|
|
@ -1275,23 +1273,23 @@ public class DarkListUIBridge extends BasicListUI { |
|
|
|
} |
|
|
|
} |
|
|
|
} else if (layoutOrientation == JList.VERTICAL_WRAP && height != 0) { |
|
|
|
} else if (layoutOrientation == JList.VERTICAL_WRAP && height != 0) { |
|
|
|
rowsPerColumn = Math.max(1, (listHeight - insets.top - |
|
|
|
rowsPerColumn = Math.max(1, (listHeight - insets.top - |
|
|
|
insets.bottom) / height); |
|
|
|
insets.bottom) / height); |
|
|
|
columnCount = Math.max(1, dataModelSize / rowsPerColumn); |
|
|
|
columnCount = Math.max(1, dataModelSize / rowsPerColumn); |
|
|
|
if (dataModelSize > 0 && dataModelSize > rowsPerColumn && |
|
|
|
if (dataModelSize > 0 && dataModelSize > rowsPerColumn && |
|
|
|
dataModelSize % rowsPerColumn != 0) { |
|
|
|
dataModelSize % rowsPerColumn != 0) { |
|
|
|
columnCount++; |
|
|
|
columnCount++; |
|
|
|
} |
|
|
|
} |
|
|
|
} else if (layoutOrientation == JList.HORIZONTAL_WRAP && cellWidth > 0 && |
|
|
|
} else if (layoutOrientation == JList.HORIZONTAL_WRAP && cellWidth > 0 && |
|
|
|
listWidth > 0) { |
|
|
|
listWidth > 0) { |
|
|
|
columnCount = Math.max(1, (listWidth - insets.left - |
|
|
|
columnCount = Math.max(1, (listWidth - insets.left - |
|
|
|
insets.right) / cellWidth); |
|
|
|
insets.right) / cellWidth); |
|
|
|
rowsPerColumn = dataModelSize / columnCount; |
|
|
|
rowsPerColumn = dataModelSize / columnCount; |
|
|
|
if (dataModelSize % columnCount > 0) { |
|
|
|
if (dataModelSize % columnCount > 0) { |
|
|
|
rowsPerColumn++; |
|
|
|
rowsPerColumn++; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
preferredHeight = rowsPerColumn * cellHeight + insets.top + |
|
|
|
preferredHeight = rowsPerColumn * cellHeight + insets.top + |
|
|
|
insets.bottom; |
|
|
|
insets.bottom; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -1336,11 +1334,11 @@ public class DarkListUIBridge extends BasicListUI { |
|
|
|
startColumn = convertLocationToColumn(paintBounds.x, |
|
|
|
startColumn = convertLocationToColumn(paintBounds.x, |
|
|
|
paintBounds.y); |
|
|
|
paintBounds.y); |
|
|
|
endColumn = convertLocationToColumn(paintBounds.x + |
|
|
|
endColumn = convertLocationToColumn(paintBounds.x + |
|
|
|
paintBounds.width, |
|
|
|
paintBounds.width, |
|
|
|
paintBounds.y); |
|
|
|
paintBounds.y); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
startColumn = convertLocationToColumn(paintBounds.x + |
|
|
|
startColumn = convertLocationToColumn(paintBounds.x + |
|
|
|
paintBounds.width, |
|
|
|
paintBounds.width, |
|
|
|
paintBounds.y); |
|
|
|
paintBounds.y); |
|
|
|
endColumn = convertLocationToColumn(paintBounds.x, |
|
|
|
endColumn = convertLocationToColumn(paintBounds.x, |
|
|
|
paintBounds.y); |
|
|
|
paintBounds.y); |
|
|
@ -1364,7 +1362,7 @@ public class DarkListUIBridge extends BasicListUI { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
while (row < rowCount && rowBounds.y < maxY && |
|
|
|
while (row < rowCount && rowBounds.y < maxY && |
|
|
|
index < size) { |
|
|
|
index < size) { |
|
|
|
rowBounds.height = getHeight(colCounter, row); |
|
|
|
rowBounds.height = getHeight(colCounter, row); |
|
|
|
g.setClip(rowBounds.x, rowBounds.y, rowBounds.width, |
|
|
|
g.setClip(rowBounds.x, rowBounds.y, rowBounds.width, |
|
|
|
rowBounds.height); |
|
|
|
rowBounds.height); |
|
|
@ -1431,22 +1429,19 @@ public class DarkListUIBridge extends BasicListUI { |
|
|
|
return -1; |
|
|
|
return -1; |
|
|
|
} |
|
|
|
} |
|
|
|
if (layoutOrientation == JList.VERTICAL || |
|
|
|
if (layoutOrientation == JList.VERTICAL || |
|
|
|
(column == 0 && columnCount == 1)) { |
|
|
|
(column == 0 && columnCount == 1)) { |
|
|
|
return list.getModel().getSize(); |
|
|
|
return list.getModel().getSize(); |
|
|
|
} |
|
|
|
} |
|
|
|
if (column >= columnCount) { |
|
|
|
|
|
|
|
return -1; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (layoutOrientation == JList.VERTICAL_WRAP) { |
|
|
|
if (layoutOrientation == JList.VERTICAL_WRAP) { |
|
|
|
if (column < (columnCount - 1)) { |
|
|
|
if (column < (columnCount - 1)) { |
|
|
|
return rowsPerColumn; |
|
|
|
return rowsPerColumn; |
|
|
|
} |
|
|
|
} |
|
|
|
return list.getModel().getSize() - (columnCount - 1) * |
|
|
|
return list.getModel().getSize() - (columnCount - 1) * |
|
|
|
rowsPerColumn; |
|
|
|
rowsPerColumn; |
|
|
|
} |
|
|
|
} |
|
|
|
// JList.HORIZONTAL_WRAP
|
|
|
|
// JList.HORIZONTAL_WRAP
|
|
|
|
int diff = columnCount - (columnCount * rowsPerColumn - |
|
|
|
int diff = columnCount - (columnCount * rowsPerColumn - |
|
|
|
list.getModel().getSize()); |
|
|
|
list.getModel().getSize()); |
|
|
|
|
|
|
|
|
|
|
|
if (column >= diff) { |
|
|
|
if (column >= diff) { |
|
|
|
return Math.max(0, rowsPerColumn - 1); |
|
|
|
return Math.max(0, rowsPerColumn - 1); |
|
|
@ -1527,7 +1522,7 @@ public class DarkListUIBridge extends BasicListUI { |
|
|
|
if (index == size) { |
|
|
|
if (index == size) { |
|
|
|
decr = true; |
|
|
|
decr = true; |
|
|
|
} else if (index != 0 && convertModelToRow(index) |
|
|
|
} else if (index != 0 && convertModelToRow(index) |
|
|
|
!= convertModelToRow(index - 1)) { |
|
|
|
!= convertModelToRow(index - 1)) { |
|
|
|
|
|
|
|
|
|
|
|
Rectangle prev = getCellBounds(list, index - 1); |
|
|
|
Rectangle prev = getCellBounds(list, index - 1); |
|
|
|
Rectangle me = getCellBounds(list, index); |
|
|
|
Rectangle me = getCellBounds(list, index); |
|
|
@ -1537,16 +1532,16 @@ public class DarkListUIBridge extends BasicListUI { |
|
|
|
decr = Point2D.distance(prev.x + prev.width, |
|
|
|
decr = Point2D.distance(prev.x + prev.width, |
|
|
|
prev.y + (int) (prev.height / 2.0), |
|
|
|
prev.y + (int) (prev.height / 2.0), |
|
|
|
p.x, p.y) |
|
|
|
p.x, p.y) |
|
|
|
< Point2D.distance(me.x, |
|
|
|
< Point2D.distance(me.x, |
|
|
|
me.y + (int) (me.height / 2.0), |
|
|
|
me.y + (int) (me.height / 2.0), |
|
|
|
p.x, p.y); |
|
|
|
p.x, p.y); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
decr = Point2D.distance(prev.x, |
|
|
|
decr = Point2D.distance(prev.x, |
|
|
|
prev.y + (int) (prev.height / 2.0), |
|
|
|
prev.y + (int) (prev.height / 2.0), |
|
|
|
p.x, p.y) |
|
|
|
p.x, p.y) |
|
|
|
< Point2D.distance(me.x + me.width, |
|
|
|
< Point2D.distance(me.x + me.width, |
|
|
|
me.y + (int) (prev.height / 2.0), |
|
|
|
me.y + (int) (prev.height / 2.0), |
|
|
|
p.x, p.y); |
|
|
|
p.x, p.y); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -1578,7 +1573,7 @@ public class DarkListUIBridge extends BasicListUI { |
|
|
|
rect = getCellBounds(list, index); |
|
|
|
rect = getCellBounds(list, index); |
|
|
|
rect.y += rect.height; |
|
|
|
rect.y += rect.height; |
|
|
|
} else if (index != 0 && convertModelToColumn(index) |
|
|
|
} else if (index != 0 && convertModelToColumn(index) |
|
|
|
!= convertModelToColumn(index - 1)) { |
|
|
|
!= convertModelToColumn(index - 1)) { |
|
|
|
|
|
|
|
|
|
|
|
Rectangle prev = getCellBounds(list, index - 1); |
|
|
|
Rectangle prev = getCellBounds(list, index - 1); |
|
|
|
Rectangle me = getCellBounds(list, index); |
|
|
|
Rectangle me = getCellBounds(list, index); |
|
|
@ -1586,9 +1581,9 @@ public class DarkListUIBridge extends BasicListUI { |
|
|
|
if (Point2D.distance(prev.x + (int) (prev.width / 2.0), |
|
|
|
if (Point2D.distance(prev.x + (int) (prev.width / 2.0), |
|
|
|
prev.y + prev.height, |
|
|
|
prev.y + prev.height, |
|
|
|
p.x, p.y) |
|
|
|
p.x, p.y) |
|
|
|
< Point2D.distance(me.x + (int) (me.width / 2.0), |
|
|
|
< Point2D.distance(me.x + (int) (me.width / 2.0), |
|
|
|
me.y, |
|
|
|
me.y, |
|
|
|
p.x, p.y)) { |
|
|
|
p.x, p.y)) { |
|
|
|
|
|
|
|
|
|
|
|
index--; |
|
|
|
index--; |
|
|
|
rect = getCellBounds(list, index); |
|
|
|
rect = getCellBounds(list, index); |
|
|
@ -1638,7 +1633,7 @@ public class DarkListUIBridge extends BasicListUI { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (layoutOrientation != JList.VERTICAL && columnCount > 1 && |
|
|
|
if (layoutOrientation != JList.VERTICAL && columnCount > 1 && |
|
|
|
rowsPerColumn > 0) { |
|
|
|
rowsPerColumn > 0) { |
|
|
|
if (layoutOrientation == JList.VERTICAL_WRAP) { |
|
|
|
if (layoutOrientation == JList.VERTICAL_WRAP) { |
|
|
|
return index % rowsPerColumn; |
|
|
|
return index % rowsPerColumn; |
|
|
|
} |
|
|
|
} |
|
|
@ -1713,7 +1708,7 @@ public class DarkListUIBridge extends BasicListUI { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (layoutOrientation != JList.VERTICAL && rowsPerColumn > 0 && |
|
|
|
if (layoutOrientation != JList.VERTICAL && rowsPerColumn > 0 && |
|
|
|
columnCount > 1) { |
|
|
|
columnCount > 1) { |
|
|
|
if (layoutOrientation == JList.VERTICAL_WRAP) { |
|
|
|
if (layoutOrientation == JList.VERTICAL_WRAP) { |
|
|
|
return index / rowsPerColumn; |
|
|
|
return index / rowsPerColumn; |
|
|
|
} |
|
|
|
} |
|
|
@ -1742,7 +1737,7 @@ public class DarkListUIBridge extends BasicListUI { |
|
|
|
@SuppressWarnings("deprecation") |
|
|
|
@SuppressWarnings("deprecation") |
|
|
|
protected Transferable createTransferable(final JComponent c) { |
|
|
|
protected Transferable createTransferable(final JComponent c) { |
|
|
|
if (c instanceof JList) { |
|
|
|
if (c instanceof JList) { |
|
|
|
JList<?> list = (JList) c; |
|
|
|
JList<?> list = (JList<Object>) c; |
|
|
|
Object[] values = list.getSelectedValues(); |
|
|
|
Object[] values = list.getSelectedValues(); |
|
|
|
|
|
|
|
|
|
|
|
if (values == null || values.length == 0) { |
|
|
|
if (values == null || values.length == 0) { |
|
|
@ -1754,8 +1749,7 @@ public class DarkListUIBridge extends BasicListUI { |
|
|
|
|
|
|
|
|
|
|
|
htmlStr.append("<html>\n<body>\n<ul>\n"); |
|
|
|
htmlStr.append("<html>\n<body>\n<ul>\n"); |
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < values.length; i++) { |
|
|
|
for (Object obj : values) { |
|
|
|
Object obj = values[i]; |
|
|
|
|
|
|
|
String val = ((obj == null) ? "" : obj.toString()); |
|
|
|
String val = ((obj == null) ? "" : obj.toString()); |
|
|
|
plainStr.append(val).append('\n'); |
|
|
|
plainStr.append(val).append('\n'); |
|
|
|
htmlStr.append(" <li>").append(val).append('\n'); |
|
|
|
htmlStr.append(" <li>").append(val).append('\n'); |
|
|
@ -1775,46 +1769,46 @@ public class DarkListUIBridge extends BasicListUI { |
|
|
|
|
|
|
|
|
|
|
|
private static class Actions extends UIAction { |
|
|
|
private static class Actions extends UIAction { |
|
|
|
private static final String SELECT_PREVIOUS_COLUMN = |
|
|
|
private static final String SELECT_PREVIOUS_COLUMN = |
|
|
|
"selectPreviousColumn"; |
|
|
|
"selectPreviousColumn"; |
|
|
|
private static final String SELECT_PREVIOUS_COLUMN_EXTEND = |
|
|
|
private static final String SELECT_PREVIOUS_COLUMN_EXTEND = |
|
|
|
"selectPreviousColumnExtendSelection"; |
|
|
|
"selectPreviousColumnExtendSelection"; |
|
|
|
private static final String SELECT_PREVIOUS_COLUMN_CHANGE_LEAD = |
|
|
|
private static final String SELECT_PREVIOUS_COLUMN_CHANGE_LEAD = |
|
|
|
"selectPreviousColumnChangeLead"; |
|
|
|
"selectPreviousColumnChangeLead"; |
|
|
|
private static final String SELECT_NEXT_COLUMN = "selectNextColumn"; |
|
|
|
private static final String SELECT_NEXT_COLUMN = "selectNextColumn"; |
|
|
|
private static final String SELECT_NEXT_COLUMN_EXTEND = |
|
|
|
private static final String SELECT_NEXT_COLUMN_EXTEND = |
|
|
|
"selectNextColumnExtendSelection"; |
|
|
|
"selectNextColumnExtendSelection"; |
|
|
|
private static final String SELECT_NEXT_COLUMN_CHANGE_LEAD = |
|
|
|
private static final String SELECT_NEXT_COLUMN_CHANGE_LEAD = |
|
|
|
"selectNextColumnChangeLead"; |
|
|
|
"selectNextColumnChangeLead"; |
|
|
|
private static final String SELECT_PREVIOUS_ROW = "selectPreviousRow"; |
|
|
|
private static final String SELECT_PREVIOUS_ROW = "selectPreviousRow"; |
|
|
|
private static final String SELECT_PREVIOUS_ROW_EXTEND = |
|
|
|
private static final String SELECT_PREVIOUS_ROW_EXTEND = |
|
|
|
"selectPreviousRowExtendSelection"; |
|
|
|
"selectPreviousRowExtendSelection"; |
|
|
|
private static final String SELECT_PREVIOUS_ROW_CHANGE_LEAD = |
|
|
|
private static final String SELECT_PREVIOUS_ROW_CHANGE_LEAD = |
|
|
|
"selectPreviousRowChangeLead"; |
|
|
|
"selectPreviousRowChangeLead"; |
|
|
|
private static final String SELECT_NEXT_ROW = "selectNextRow"; |
|
|
|
private static final String SELECT_NEXT_ROW = "selectNextRow"; |
|
|
|
private static final String SELECT_NEXT_ROW_EXTEND = |
|
|
|
private static final String SELECT_NEXT_ROW_EXTEND = |
|
|
|
"selectNextRowExtendSelection"; |
|
|
|
"selectNextRowExtendSelection"; |
|
|
|
private static final String SELECT_NEXT_ROW_CHANGE_LEAD = |
|
|
|
private static final String SELECT_NEXT_ROW_CHANGE_LEAD = |
|
|
|
"selectNextRowChangeLead"; |
|
|
|
"selectNextRowChangeLead"; |
|
|
|
private static final String SELECT_FIRST_ROW = "selectFirstRow"; |
|
|
|
private static final String SELECT_FIRST_ROW = "selectFirstRow"; |
|
|
|
private static final String SELECT_FIRST_ROW_EXTEND = |
|
|
|
private static final String SELECT_FIRST_ROW_EXTEND = |
|
|
|
"selectFirstRowExtendSelection"; |
|
|
|
"selectFirstRowExtendSelection"; |
|
|
|
private static final String SELECT_FIRST_ROW_CHANGE_LEAD = |
|
|
|
private static final String SELECT_FIRST_ROW_CHANGE_LEAD = |
|
|
|
"selectFirstRowChangeLead"; |
|
|
|
"selectFirstRowChangeLead"; |
|
|
|
private static final String SELECT_LAST_ROW = "selectLastRow"; |
|
|
|
private static final String SELECT_LAST_ROW = "selectLastRow"; |
|
|
|
private static final String SELECT_LAST_ROW_EXTEND = |
|
|
|
private static final String SELECT_LAST_ROW_EXTEND = |
|
|
|
"selectLastRowExtendSelection"; |
|
|
|
"selectLastRowExtendSelection"; |
|
|
|
private static final String SELECT_LAST_ROW_CHANGE_LEAD = |
|
|
|
private static final String SELECT_LAST_ROW_CHANGE_LEAD = |
|
|
|
"selectLastRowChangeLead"; |
|
|
|
"selectLastRowChangeLead"; |
|
|
|
private static final String SCROLL_UP = "scrollUp"; |
|
|
|
private static final String SCROLL_UP = "scrollUp"; |
|
|
|
private static final String SCROLL_UP_EXTEND = |
|
|
|
private static final String SCROLL_UP_EXTEND = |
|
|
|
"scrollUpExtendSelection"; |
|
|
|
"scrollUpExtendSelection"; |
|
|
|
private static final String SCROLL_UP_CHANGE_LEAD = |
|
|
|
private static final String SCROLL_UP_CHANGE_LEAD = |
|
|
|
"scrollUpChangeLead"; |
|
|
|
"scrollUpChangeLead"; |
|
|
|
private static final String SCROLL_DOWN = "scrollDown"; |
|
|
|
private static final String SCROLL_DOWN = "scrollDown"; |
|
|
|
private static final String SCROLL_DOWN_EXTEND = |
|
|
|
private static final String SCROLL_DOWN_EXTEND = |
|
|
|
"scrollDownExtendSelection"; |
|
|
|
"scrollDownExtendSelection"; |
|
|
|
private static final String SCROLL_DOWN_CHANGE_LEAD = |
|
|
|
private static final String SCROLL_DOWN_CHANGE_LEAD = |
|
|
|
"scrollDownChangeLead"; |
|
|
|
"scrollDownChangeLead"; |
|
|
|
private static final String SELECT_ALL = "selectAll"; |
|
|
|
private static final String SELECT_ALL = "selectAll"; |
|
|
|
private static final String CLEAR_SELECTION = "clearSelection"; |
|
|
|
private static final String CLEAR_SELECTION = "clearSelection"; |
|
|
|
|
|
|
|
|
|
|
@ -1920,7 +1914,7 @@ public class DarkListUIBridge extends BasicListUI { |
|
|
|
clearSelection(list); |
|
|
|
clearSelection(list); |
|
|
|
} else if (Objects.equals(name, ADD_TO_SELECTION)) { |
|
|
|
} else if (Objects.equals(name, ADD_TO_SELECTION)) { |
|
|
|
int index = adjustIndex( |
|
|
|
int index = adjustIndex( |
|
|
|
list.getSelectionModel().getLeadSelectionIndex(), list); |
|
|
|
list.getSelectionModel().getLeadSelectionIndex(), list); |
|
|
|
|
|
|
|
|
|
|
|
if (!list.isSelectedIndex(index)) { |
|
|
|
if (!list.isSelectedIndex(index)) { |
|
|
|
int oldAnchor = list.getSelectionModel().getAnchorSelectionIndex(); |
|
|
|
int oldAnchor = list.getSelectionModel().getAnchorSelectionIndex(); |
|
|
@ -1931,7 +1925,7 @@ public class DarkListUIBridge extends BasicListUI { |
|
|
|
} |
|
|
|
} |
|
|
|
} else if (Objects.equals(name, TOGGLE_AND_ANCHOR)) { |
|
|
|
} else if (Objects.equals(name, TOGGLE_AND_ANCHOR)) { |
|
|
|
int index = adjustIndex( |
|
|
|
int index = adjustIndex( |
|
|
|
list.getSelectionModel().getLeadSelectionIndex(), list); |
|
|
|
list.getSelectionModel().getLeadSelectionIndex(), list); |
|
|
|
|
|
|
|
|
|
|
|
if (list.isSelectedIndex(index)) { |
|
|
|
if (list.isSelectedIndex(index)) { |
|
|
|
list.removeSelectionInterval(index, index); |
|
|
|
list.removeSelectionInterval(index, index); |
|
|
@ -1940,14 +1934,14 @@ public class DarkListUIBridge extends BasicListUI { |
|
|
|
} |
|
|
|
} |
|
|
|
} else if (Objects.equals(name, EXTEND_TO)) { |
|
|
|
} else if (Objects.equals(name, EXTEND_TO)) { |
|
|
|
changeSelection( |
|
|
|
changeSelection( |
|
|
|
list, EXTEND_SELECTION, |
|
|
|
list, EXTEND_SELECTION, |
|
|
|
adjustIndex(list.getSelectionModel().getLeadSelectionIndex(), list), |
|
|
|
adjustIndex(list.getSelectionModel().getLeadSelectionIndex(), list), |
|
|
|
0); |
|
|
|
0); |
|
|
|
} else if (Objects.equals(name, MOVE_SELECTION_TO)) { |
|
|
|
} else if (Objects.equals(name, MOVE_SELECTION_TO)) { |
|
|
|
changeSelection( |
|
|
|
changeSelection( |
|
|
|
list, CHANGE_SELECTION, |
|
|
|
list, CHANGE_SELECTION, |
|
|
|
adjustIndex(list.getSelectionModel().getLeadSelectionIndex(), list), |
|
|
|
adjustIndex(list.getSelectionModel().getLeadSelectionIndex(), list), |
|
|
|
0); |
|
|
|
0); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -1958,8 +1952,8 @@ public class DarkListUIBridge extends BasicListUI { |
|
|
|
|
|
|
|
|
|
|
|
// CHANGE_LEAD is only valid with multiple interval selection
|
|
|
|
// CHANGE_LEAD is only valid with multiple interval selection
|
|
|
|
if (type == CHANGE_LEAD && |
|
|
|
if (type == CHANGE_LEAD && |
|
|
|
list.getSelectionMode() |
|
|
|
list.getSelectionMode() |
|
|
|
!= ListSelectionModel.MULTIPLE_INTERVAL_SELECTION) { |
|
|
|
!= ListSelectionModel.MULTIPLE_INTERVAL_SELECTION) { |
|
|
|
|
|
|
|
|
|
|
|
type = CHANGE_SELECTION; |
|
|
|
type = CHANGE_SELECTION; |
|
|
|
} |
|
|
|
} |
|
|
@ -2056,13 +2050,13 @@ public class DarkListUIBridge extends BasicListUI { |
|
|
|
ListSelectionModel lsm = list.getSelectionModel(); |
|
|
|
ListSelectionModel lsm = list.getSelectionModel(); |
|
|
|
int lead = adjustIndex(lsm.getLeadSelectionIndex(), list); |
|
|
|
int lead = adjustIndex(lsm.getLeadSelectionIndex(), list); |
|
|
|
Rectangle leadRect = |
|
|
|
Rectangle leadRect = |
|
|
|
(lead == -1) ? new Rectangle() : list.getCellBounds(lead, lead); |
|
|
|
(lead == -1) ? new Rectangle() : list.getCellBounds(lead, lead); |
|
|
|
|
|
|
|
|
|
|
|
if (leadRect == null) { |
|
|
|
if (leadRect == null) { |
|
|
|
return index; |
|
|
|
return index; |
|
|
|
} |
|
|
|
} |
|
|
|
if (list.getLayoutOrientation() == JList.VERTICAL_WRAP && |
|
|
|
if (list.getLayoutOrientation() == JList.VERTICAL_WRAP && |
|
|
|
list.getVisibleRowCount() <= 0) { |
|
|
|
list.getVisibleRowCount() <= 0) { |
|
|
|
if (!list.getComponentOrientation().isLeftToRight()) { |
|
|
|
if (!list.getComponentOrientation().isLeftToRight()) { |
|
|
|
direction = -direction; |
|
|
|
direction = -direction; |
|
|
|
} |
|
|
|
} |
|
|
@ -2158,8 +2152,8 @@ public class DarkListUIBridge extends BasicListUI { |
|
|
|
// go up one cell if last visible cell doesn't fit
|
|
|
|
// go up one cell if last visible cell doesn't fit
|
|
|
|
// into visible rectangle
|
|
|
|
// into visible rectangle
|
|
|
|
if (cellBounds != null && |
|
|
|
if (cellBounds != null && |
|
|
|
cellBounds.y + cellBounds.height > |
|
|
|
cellBounds.y + cellBounds.height > |
|
|
|
visRect.y + visRect.height) { |
|
|
|
visRect.y + visRect.height) { |
|
|
|
p.y = cellBounds.y - 1; |
|
|
|
p.y = cellBounds.y - 1; |
|
|
|
index = list.locationToIndex(p); |
|
|
|
index = list.locationToIndex(p); |
|
|
|
if (index == -1) { |
|
|
|
if (index == -1) { |
|
|
@ -2182,8 +2176,8 @@ public class DarkListUIBridge extends BasicListUI { |
|
|
|
// go one cell up if last visible cell doesn't fit
|
|
|
|
// go one cell up if last visible cell doesn't fit
|
|
|
|
// into adjasted visible rectangle
|
|
|
|
// into adjasted visible rectangle
|
|
|
|
if (cellBounds != null && |
|
|
|
if (cellBounds != null && |
|
|
|
cellBounds.y + cellBounds.height > |
|
|
|
cellBounds.y + cellBounds.height > |
|
|
|
visRect.y + visRect.height) { |
|
|
|
visRect.y + visRect.height) { |
|
|
|
p.y = cellBounds.y - 1; |
|
|
|
p.y = cellBounds.y - 1; |
|
|
|
index = list.locationToIndex(p); |
|
|
|
index = list.locationToIndex(p); |
|
|
|
if (index == -1) { |
|
|
|
if (index == -1) { |
|
|
@ -2250,7 +2244,7 @@ public class DarkListUIBridge extends BasicListUI { |
|
|
|
Rectangle visRect = list.getVisibleRect(); |
|
|
|
Rectangle visRect = list.getVisibleRect(); |
|
|
|
if (cellBounds != null && !visRect.contains(cellBounds)) { |
|
|
|
if (cellBounds != null && !visRect.contains(cellBounds)) { |
|
|
|
if (list.getLayoutOrientation() == JList.VERTICAL_WRAP && |
|
|
|
if (list.getLayoutOrientation() == JList.VERTICAL_WRAP && |
|
|
|
list.getVisibleRowCount() <= 0) { |
|
|
|
list.getVisibleRowCount() <= 0) { |
|
|
|
// horizontal
|
|
|
|
// horizontal
|
|
|
|
if (list.getComponentOrientation().isLeftToRight()) { |
|
|
|
if (list.getComponentOrientation().isLeftToRight()) { |
|
|
|
if (direction > 0) { |
|
|
|
if (direction > 0) { |
|
|
@ -2258,17 +2252,17 @@ public class DarkListUIBridge extends BasicListUI { |
|
|
|
int x = Math.max(0, |
|
|
|
int x = Math.max(0, |
|
|
|
cellBounds.x + cellBounds.width - visRect.width); |
|
|
|
cellBounds.x + cellBounds.width - visRect.width); |
|
|
|
int startIndex = |
|
|
|
int startIndex = |
|
|
|
list.locationToIndex(new Point(x, cellBounds.y)); |
|
|
|
list.locationToIndex(new Point(x, cellBounds.y)); |
|
|
|
if (startIndex == -1) { |
|
|
|
if (startIndex == -1) { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
Rectangle startRect = list.getCellBounds(startIndex, |
|
|
|
Rectangle startRect = list.getCellBounds(startIndex, |
|
|
|
startIndex); |
|
|
|
startIndex); |
|
|
|
if (startRect != null && |
|
|
|
if (startRect != null && |
|
|
|
startRect.x < x && startRect.x < cellBounds.x) { |
|
|
|
startRect.x < x && startRect.x < cellBounds.x) { |
|
|
|
startRect.x += startRect.width; |
|
|
|
startRect.x += startRect.width; |
|
|
|
startIndex = |
|
|
|
startIndex = |
|
|
|
list.locationToIndex(startRect.getLocation()); |
|
|
|
list.locationToIndex(startRect.getLocation()); |
|
|
|
if (startIndex == -1) { |
|
|
|
if (startIndex == -1) { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
@ -2285,7 +2279,7 @@ public class DarkListUIBridge extends BasicListUI { |
|
|
|
// left for right-to-left
|
|
|
|
// left for right-to-left
|
|
|
|
int x = cellBounds.x + visRect.width; |
|
|
|
int x = cellBounds.x + visRect.width; |
|
|
|
int rightIndex = |
|
|
|
int rightIndex = |
|
|
|
list.locationToIndex(new Point(x, cellBounds.y)); |
|
|
|
list.locationToIndex(new Point(x, cellBounds.y)); |
|
|
|
if (rightIndex == -1) { |
|
|
|
if (rightIndex == -1) { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
@ -2293,7 +2287,7 @@ public class DarkListUIBridge extends BasicListUI { |
|
|
|
rightIndex); |
|
|
|
rightIndex); |
|
|
|
if (rightRect != null) { |
|
|
|
if (rightRect != null) { |
|
|
|
if (rightRect.x + rightRect.width > x && |
|
|
|
if (rightRect.x + rightRect.width > x && |
|
|
|
rightRect.x > cellBounds.x) { |
|
|
|
rightRect.x > cellBounds.x) { |
|
|
|
rightRect.width = 0; |
|
|
|
rightRect.width = 0; |
|
|
|
} |
|
|
|
} |
|
|
|
cellBounds.x = Math.max(0, |
|
|
|
cellBounds.x = Math.max(0, |
|
|
@ -2311,29 +2305,29 @@ public class DarkListUIBridge extends BasicListUI { |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
// vertical
|
|
|
|
// vertical
|
|
|
|
if (direction > 0 && |
|
|
|
if (direction > 0 && |
|
|
|
(cellBounds.y < visRect.y || |
|
|
|
(cellBounds.y < visRect.y || |
|
|
|
cellBounds.y + cellBounds.height |
|
|
|
cellBounds.y + cellBounds.height |
|
|
|
> visRect.y + visRect.height)) { |
|
|
|
> visRect.y + visRect.height)) { |
|
|
|
//down
|
|
|
|
//down
|
|
|
|
int y = Math.max(0, |
|
|
|
int y = Math.max(0, |
|
|
|
cellBounds.y + cellBounds.height - visRect.height); |
|
|
|
cellBounds.y + cellBounds.height - visRect.height); |
|
|
|
int startIndex = |
|
|
|
int startIndex = |
|
|
|
list.locationToIndex(new Point(cellBounds.x, y)); |
|
|
|
list.locationToIndex(new Point(cellBounds.x, y)); |
|
|
|
if (startIndex == -1) { |
|
|
|
if (startIndex == -1) { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
Rectangle startRect = list.getCellBounds(startIndex, |
|
|
|
Rectangle startRect = list.getCellBounds(startIndex, |
|
|
|
startIndex); |
|
|
|
startIndex); |
|
|
|
if (startRect != null && |
|
|
|
if (startRect != null && |
|
|
|
startRect.y < y && startRect.y < cellBounds.y) { |
|
|
|
startRect.y < y && startRect.y < cellBounds.y) { |
|
|
|
startRect.y += startRect.height; |
|
|
|
startRect.y += startRect.height; |
|
|
|
startIndex = |
|
|
|
startIndex = |
|
|
|
list.locationToIndex(startRect.getLocation()); |
|
|
|
list.locationToIndex(startRect.getLocation()); |
|
|
|
if (startIndex == -1) { |
|
|
|
if (startIndex == -1) { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
startRect = |
|
|
|
startRect = |
|
|
|
list.getCellBounds(startIndex, startIndex); |
|
|
|
list.getCellBounds(startIndex, startIndex); |
|
|
|
} |
|
|
|
} |
|
|
|
cellBounds = startRect; |
|
|
|
cellBounds = startRect; |
|
|
|
if (cellBounds != null) { |
|
|
|
if (cellBounds != null) { |
|
|
@ -2359,18 +2353,18 @@ public class DarkListUIBridge extends BasicListUI { |
|
|
|
public boolean accept(final Object c) { |
|
|
|
public boolean accept(final Object c) { |
|
|
|
Object name = getName(); |
|
|
|
Object name = getName(); |
|
|
|
if (name == SELECT_PREVIOUS_COLUMN_CHANGE_LEAD || |
|
|
|
if (name == SELECT_PREVIOUS_COLUMN_CHANGE_LEAD || |
|
|
|
name == SELECT_NEXT_COLUMN_CHANGE_LEAD || |
|
|
|
name == SELECT_NEXT_COLUMN_CHANGE_LEAD || |
|
|
|
name == SELECT_PREVIOUS_ROW_CHANGE_LEAD || |
|
|
|
name == SELECT_PREVIOUS_ROW_CHANGE_LEAD || |
|
|
|
name == SELECT_NEXT_ROW_CHANGE_LEAD || |
|
|
|
name == SELECT_NEXT_ROW_CHANGE_LEAD || |
|
|
|
name == SELECT_FIRST_ROW_CHANGE_LEAD || |
|
|
|
name == SELECT_FIRST_ROW_CHANGE_LEAD || |
|
|
|
name == SELECT_LAST_ROW_CHANGE_LEAD || |
|
|
|
name == SELECT_LAST_ROW_CHANGE_LEAD || |
|
|
|
name == SCROLL_UP_CHANGE_LEAD || |
|
|
|
name == SCROLL_UP_CHANGE_LEAD || |
|
|
|
name == SCROLL_DOWN_CHANGE_LEAD) { |
|
|
|
name == SCROLL_DOWN_CHANGE_LEAD) { |
|
|
|
|
|
|
|
|
|
|
|
// discontinuous selection actions are only enabled for
|
|
|
|
// discontinuous selection actions are only enabled for
|
|
|
|
// DefaultListSelectionModel
|
|
|
|
// DefaultListSelectionModel
|
|
|
|
return c != null && ((JList) c).getSelectionModel() |
|
|
|
return c != null && ((JList<Object>) c).getSelectionModel() |
|
|
|
instanceof DefaultListSelectionModel; |
|
|
|
instanceof DefaultListSelectionModel; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return true; |
|
|
|
return true; |
|
|
@ -2526,9 +2520,9 @@ public class DarkListUIBridge extends BasicListUI { |
|
|
|
* The type Handler. |
|
|
|
* The type Handler. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
protected class Handler implements FocusListener, KeyListener, |
|
|
|
protected class Handler implements FocusListener, KeyListener, |
|
|
|
ListDataListener, ListSelectionListener, |
|
|
|
ListDataListener, ListSelectionListener, |
|
|
|
MouseInputListener, PropertyChangeListener, |
|
|
|
MouseInputListener, PropertyChangeListener, |
|
|
|
DragRecognitionSupport.BeforeDrag { |
|
|
|
DragRecognitionSupport.BeforeDrag { |
|
|
|
/** |
|
|
|
/** |
|
|
|
* The Prefix. |
|
|
|
* The Prefix. |
|
|
|
*/ |
|
|
|
*/ |
|
|
@ -2562,12 +2556,12 @@ public class DarkListUIBridge extends BasicListUI { |
|
|
|
* letters followed by first typed another letter. |
|
|
|
* letters followed by first typed another letter. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public void keyTyped(final KeyEvent e) { |
|
|
|
public void keyTyped(final KeyEvent e) { |
|
|
|
JList<?> src = (JList) e.getSource(); |
|
|
|
JList<?> src = (JList<?>) e.getSource(); |
|
|
|
ListModel<?> model = src.getModel(); |
|
|
|
ListModel<?> model = src.getModel(); |
|
|
|
|
|
|
|
|
|
|
|
if (model.getSize() == 0 || e.isAltDown() || |
|
|
|
if (model.getSize() == 0 || e.isAltDown() || |
|
|
|
DarkUIUtil.isMenuShortcutKeyDown(e) || |
|
|
|
DarkUIUtil.isMenuShortcutKeyDown(e) || |
|
|
|
isNavigationKey(e)) { |
|
|
|
isNavigationKey(e)) { |
|
|
|
// Nothing to select
|
|
|
|
// Nothing to select
|
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
@ -2657,8 +2651,8 @@ public class DarkListUIBridge extends BasicListUI { |
|
|
|
* listDataListener from the old model and add it to the new one. |
|
|
|
* listDataListener from the old model and add it to the new one. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
if (Objects.equals(propertyName, "model")) { |
|
|
|
if (Objects.equals(propertyName, "model")) { |
|
|
|
ListModel<?> oldModel = (ListModel) e.getOldValue(); |
|
|
|
ListModel<?> oldModel = (ListModel<?>) e.getOldValue(); |
|
|
|
ListModel<?> newModel = (ListModel) e.getNewValue(); |
|
|
|
ListModel<?> newModel = (ListModel<?>) e.getNewValue(); |
|
|
|
if (oldModel != null) { |
|
|
|
if (oldModel != null) { |
|
|
|
oldModel.removeListDataListener(listDataListener); |
|
|
|
oldModel.removeListDataListener(listDataListener); |
|
|
|
} |
|
|
|
} |
|
|
@ -2687,7 +2681,7 @@ public class DarkListUIBridge extends BasicListUI { |
|
|
|
updateLayoutStateNeeded |= cellRendererChanged; |
|
|
|
updateLayoutStateNeeded |= cellRendererChanged; |
|
|
|
redrawList(); |
|
|
|
redrawList(); |
|
|
|
} else if (Objects.equals(propertyName, PropertyKey.FONT) |
|
|
|
} else if (Objects.equals(propertyName, PropertyKey.FONT) |
|
|
|
|| DarkSwingUtil.isScaleChanged(e)) { |
|
|
|
|| DarkSwingUtil.isScaleChanged(e)) { |
|
|
|
updateLayoutStateNeeded |= fontChanged; |
|
|
|
updateLayoutStateNeeded |= fontChanged; |
|
|
|
redrawList(); |
|
|
|
redrawList(); |
|
|
|
} else if (Objects.equals(propertyName, "prototypeCellValue")) { |
|
|
|
} else if (Objects.equals(propertyName, "prototypeCellValue")) { |
|
|
@ -2880,8 +2874,8 @@ public class DarkListUIBridge extends BasicListUI { |
|
|
|
// If shift is down in multi-select, we should do nothing.
|
|
|
|
// If shift is down in multi-select, we should do nothing.
|
|
|
|
// For single select or non-shift-click, clear the selection
|
|
|
|
// For single select or non-shift-click, clear the selection
|
|
|
|
if (isFileList && e.getID() == MouseEvent.MOUSE_PRESSED && |
|
|
|
if (isFileList && e.getID() == MouseEvent.MOUSE_PRESSED && |
|
|
|
(!e.isShiftDown() || |
|
|
|
(!e.isShiftDown() || |
|
|
|
list.getSelectionMode() == ListSelectionModel.SINGLE_SELECTION)) { |
|
|
|
list.getSelectionMode() == ListSelectionModel.SINGLE_SELECTION)) { |
|
|
|
list.clearSelection(); |
|
|
|
list.clearSelection(); |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
|