private int getNextPageIndex(JList list, int direction) { if (getElementCount(list) == 0) { return -1;
private int getNextPageIndex(JList list, int direction) { if (getElementCount(list) == 0) { return -1;
private int getNextPageIndex(JList list, int direction) { if (getElementCount(list) == 0) { return -1;
private int getNextPageIndex(JList list, int direction) { if (getElementCount(list) == 0) { return -1;
private void changeSelection(JList list, int type, int index, int direction) { if (index >= 0 && index < getElementCount(list)) { ListSelectionModel lsm = list.getSelectionModel();
private void changeSelection(JList list, int type, int index, int direction) { if (index >= 0 && index < getElementCount(list)) { ListSelectionModel lsm = list.getSelectionModel();
private void changeSelection(JList list, int type, int index, int direction) { if (index >= 0 && index < getElementCount(list)) { ListSelectionModel lsm = list.getSelectionModel();
private int getNextColumnIndex(JList list, BasicXListUI ui, int amount) { if (list.getLayoutOrientation() != JList.VERTICAL) { int index = adjustIndex(list.getLeadSelectionIndex(), list); int size = getElementCount(list); if (index == -1) { return 0; } else if (size == 1) { // there's only one item so we should select it return 0; } else if (ui == null || ui.columnCount <= 1) { return -1; } int column = ui.convertModelToColumn(index); int row = ui.convertModelToRow(index); column += amount; if (column >= ui.columnCount || column < 0) { // No wrapping. return -1; } int maxRowCount = ui.getRowCount(column); if (row >= maxRowCount) { return -1; } return ui.getModelIndex(column, row); } // Won't change the selection. return -1; }
private int getNextColumnIndex(JList list, BasicXListUI ui, int amount) { if (list.getLayoutOrientation() != JList.VERTICAL) { int index = adjustIndex(list.getLeadSelectionIndex(), list); int size = getElementCount(list); if (index == -1) { return 0; } else if (size == 1) { // there's only one item so we should select it return 0; } else if (ui == null || ui.columnCount <= 1) { return -1; } int column = ui.convertModelToColumn(index); int row = ui.convertModelToRow(index); column += amount; if (column >= ui.columnCount || column < 0) { // No wrapping. return -1; } int maxRowCount = ui.getRowCount(column); if (row >= maxRowCount) { return -1; } return ui.getModelIndex(column, row); } // Won't change the selection. return -1; }
private int getNextColumnIndex(JList list, BasicXListUI ui, int amount) { if (list.getLayoutOrientation() != JList.VERTICAL) { int index = adjustIndex(list.getLeadSelectionIndex(), list); int size = getElementCount(list); if (index == -1) { return 0; } else if (size == 1) { // there's only one item so we should select it return 0; } else if (ui == null || ui.columnCount <= 1) { return -1; } int column = ui.convertModelToColumn(index); int row = ui.convertModelToRow(index); column += amount; if (column >= ui.columnCount || column < 0) { // No wrapping. return -1; } int maxRowCount = ui.getRowCount(column); if (row >= maxRowCount) { return -1; } return ui.getModelIndex(column, row); } // Won't change the selection. return -1; }
private void changeSelection(JList list, int type, int index, int direction) { if (index >= 0 && index < getElementCount(list)) { ListSelectionModel lsm = list.getSelectionModel();
private int getNextColumnIndex(JList list, BasicXListUI ui, int amount) { if (list.getLayoutOrientation() != JList.VERTICAL) { int index = adjustIndex(list.getLeadSelectionIndex(), list); int size = getElementCount(list); if (index == -1) { return 0; } else if (size == 1) { // there's only one item so we should select it return 0; } else if (ui == null || ui.columnCount <= 1) { return -1; } int column = ui.convertModelToColumn(index); int row = ui.convertModelToRow(index); column += amount; if (column >= ui.columnCount || column < 0) { // No wrapping. return -1; } int maxRowCount = ui.getRowCount(column); if (row >= maxRowCount) { return -1; } return ui.getModelIndex(column, row); } // Won't change the selection. return -1; }
private int getNextIndex(JList list, BasicXListUI ui, int amount) { int index = adjustIndex(list.getLeadSelectionIndex(), list); int size = getElementCount(list); if (index == -1) { if (size > 0) { if (amount > 0) { index = 0; } else { index = size - 1; } } } else if (size == 1) { // there's only one item so we should select it index = 0; } else if (list.getLayoutOrientation() == JList.HORIZONTAL_WRAP) { if (ui != null) { index += ui.columnCount * amount; } } else { index += amount; } return index; } }
private int getNextIndex(JList list, BasicXListUI ui, int amount) { int index = adjustIndex(list.getLeadSelectionIndex(), list); int size = getElementCount(list); if (index == -1) { if (size > 0) { if (amount > 0) { index = 0; } else { index = size - 1; } } } else if (size == 1) { // there's only one item so we should select it index = 0; } else if (list.getLayoutOrientation() == JList.HORIZONTAL_WRAP) { if (ui != null) { index += ui.columnCount * amount; } } else { index += amount; } return index; } }
private void selectAll(JList list) { int size = getElementCount(list); if (size > 0) { ListSelectionModel lsm = list.getSelectionModel(); int lead = adjustIndex(lsm.getLeadSelectionIndex(), list); if (lsm.getSelectionMode() == ListSelectionModel.SINGLE_SELECTION) { if (lead == -1) { int min = adjustIndex(list.getMinSelectionIndex(), list); lead = (min == -1 ? 0 : min); } list.setSelectionInterval(lead, lead); list.ensureIndexIsVisible(lead); } else { list.setValueIsAdjusting(true); int anchor = adjustIndex(lsm.getAnchorSelectionIndex(), list); list.setSelectionInterval(0, size - 1); // this is done to restore the anchor and lead SwingXUtilities.setLeadAnchorWithoutSelection(lsm, anchor, lead); list.setValueIsAdjusting(false); } } }
private void selectAll(JList list) { int size = getElementCount(list); if (size > 0) { ListSelectionModel lsm = list.getSelectionModel(); int lead = adjustIndex(lsm.getLeadSelectionIndex(), list); if (lsm.getSelectionMode() == ListSelectionModel.SINGLE_SELECTION) { if (lead == -1) { int min = adjustIndex(list.getMinSelectionIndex(), list); lead = (min == -1 ? 0 : min); } list.setSelectionInterval(lead, lead); list.ensureIndexIsVisible(lead); } else { list.setValueIsAdjusting(true); int anchor = adjustIndex(lsm.getAnchorSelectionIndex(), list); list.setSelectionInterval(0, size - 1); // this is done to restore the anchor and lead SwingXUtilities.setLeadAnchorWithoutSelection(lsm, anchor, lead); list.setValueIsAdjusting(false); } } }
private int getNextIndex(JList list, BasicXListUI ui, int amount) { int index = adjustIndex(list.getLeadSelectionIndex(), list); int size = getElementCount(list); if (index == -1) { if (size > 0) { if (amount > 0) { index = 0; } else { index = size - 1; } } } else if (size == 1) { // there's only one item so we should select it index = 0; } else if (list.getLayoutOrientation() == JList.HORIZONTAL_WRAP) { if (ui != null) { index += ui.columnCount * amount; } } else { index += amount; } return index; } }
private int getNextIndex(JList list, BasicXListUI ui, int amount) { int index = adjustIndex(list.getLeadSelectionIndex(), list); int size = getElementCount(list); if (index == -1) { if (size > 0) { if (amount > 0) { index = 0; } else { index = size - 1; } } } else if (size == 1) { // there's only one item so we should select it index = 0; } else if (list.getLayoutOrientation() == JList.HORIZONTAL_WRAP) { if (ui != null) { index += ui.columnCount * amount; } } else { index += amount; } return index; } }
private void selectAll(JList list) { int size = getElementCount(list); if (size > 0) { ListSelectionModel lsm = list.getSelectionModel(); int lead = adjustIndex(lsm.getLeadSelectionIndex(), list); if (lsm.getSelectionMode() == ListSelectionModel.SINGLE_SELECTION) { if (lead == -1) { int min = adjustIndex(list.getMinSelectionIndex(), list); lead = (min == -1 ? 0 : min); } list.setSelectionInterval(lead, lead); list.ensureIndexIsVisible(lead); } else { list.setValueIsAdjusting(true); int anchor = adjustIndex(lsm.getAnchorSelectionIndex(), list); list.setSelectionInterval(0, size - 1); // this is done to restore the anchor and lead SwingXUtilities.setLeadAnchorWithoutSelection(lsm, anchor, lead); list.setValueIsAdjusting(false); } } }
private void selectAll(JList list) { int size = getElementCount(list); if (size > 0) { ListSelectionModel lsm = list.getSelectionModel(); int lead = adjustIndex(lsm.getLeadSelectionIndex(), list); if (lsm.getSelectionMode() == ListSelectionModel.SINGLE_SELECTION) { if (lead == -1) { int min = adjustIndex(list.getMinSelectionIndex(), list); lead = (min == -1 ? 0 : min); } list.setSelectionInterval(lead, lead); list.ensureIndexIsVisible(lead); } else { list.setValueIsAdjusting(true); int anchor = adjustIndex(lsm.getAnchorSelectionIndex(), list); list.setSelectionInterval(0, size - 1); // this is done to restore the anchor and lead SwingXUtilities.setLeadAnchorWithoutSelection(lsm, anchor, lead); list.setValueIsAdjusting(false); } } }