protected int getFirstSelectedRow() { return _table.getSelectionModel().getMinSelectionIndex(); }
int selectedRow = lsm.getMinSelectionIndex();
public void valueChanged(ListSelectionEvent e) { if (e.getValueIsAdjusting()) return; int index = ((ListSelectionModel) e.getSource()).getMinSelectionIndex(); if (index > -1) { presenter.onPortMappingSelected( table.getPortMapping(index) ); } } }
@Override public void valueChanged(ListSelectionEvent e) { ListSelectionModel lsm = (ListSelectionModel) e.getSource(); if (!lsm.isSelectionEmpty()) { Object o = xpathResults.get(lsm.getMinSelectionIndex()); if (o instanceof Node) { codeEditorPane.select((Node) o); } } } }
/** @see ListSelectionListener **/ public void valueChanged(ListSelectionEvent aEvent) { //Ignore extra messages. if (aEvent.getValueIsAdjusting()) { return; } final ListSelectionModel lsm = (ListSelectionModel) aEvent.getSource(); if (lsm.isSelectionEmpty()) { mDetails.setText("Nothing selected"); } else { final int selectedRow = lsm.getMinSelectionIndex(); final EventDetails e = mModel.getEventDetails(selectedRow); final Object[] args = { new Date(e.getTimeStamp()), e.getPriority(), escape(e.getThreadName()), escape(e.getNDC()), escape(e.getCategoryName()), escape(e.getLocationDetails()), escape(e.getMessage()), escape(getThrowableStrRep(e)) }; mDetails.setText(FORMATTER.format(args)); mDetails.setCaretPosition(0); } }
protected int getFirstSelectedRow() { return _table.getSelectionModel().getMinSelectionIndex(); }
int selectedRow = lsm.getMinSelectionIndex();
/** @see ListSelectionListener **/ public void valueChanged(ListSelectionEvent aEvent) { //Ignore extra messages. if (aEvent.getValueIsAdjusting()) { return; } final ListSelectionModel lsm = (ListSelectionModel) aEvent.getSource(); if (lsm.isSelectionEmpty()) { mDetails.setText("Nothing selected"); } else { final int selectedRow = lsm.getMinSelectionIndex(); final EventDetails e = mModel.getEventDetails(selectedRow); final Object[] args = { new Date(e.getTimeStamp()), e.getPriority(), escape(e.getThreadName()), escape(e.getNDC()), escape(e.getCategoryName()), escape(e.getLocationDetails()), escape(e.getMessage()), escape(getThrowableStrRep(e)) }; mDetails.setText(FORMATTER.format(args)); mDetails.setCaretPosition(0); } }
public void valueChanged(ListSelectionEvent lse) { if (!lse.getValueIsAdjusting()) { selection = getSelectedIndices(model.getMinSelectionIndex(), model.getMaxSelectionIndex()); if (selection.length == 0) { } else { modifyPropBtn.setEnabled(true); deletePropBtn.setEnabled(true); } } }
public void remove() { ListSelectionModel lsm = connectionTable.getSelectionModel(); int bot = lsm.getMinSelectionIndex(); int top = lsm.getMaxSelectionIndex(); for ( int i = top ; i >= bot ; i-- ) { ((Connection) connections.get(i - 1)).remove(); } if ( bot > connections.size() ) { bot = connections.size(); } lsm.setSelectionInterval(bot, bot); }
private void guiDownActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_guiDownActionPerformed int index = tabFonts.getSelectionModel().getMinSelectionIndex(); if (index >= 0) { SelectedChannelType f = (SelectedChannelType) model.getValueAt(index, 0); model.moveDown(f); } }//GEN-LAST:event_guiDownActionPerformed
public void remove() { ListSelectionModel lsm = connectionTable.getSelectionModel(); int bot = lsm.getMinSelectionIndex(); int top = lsm.getMaxSelectionIndex(); for ( int i = top ; i >= bot ; i-- ) { ((Connection) connections.get(i - 1)).remove(); } if ( bot > connections.size() ) { bot = connections.size(); } lsm.setSelectionInterval(bot, bot); }
@Override public void valueChanged(ListSelectionEvent e) { if (!e.getValueIsAdjusting()) { selectionChanged(getTable().getSelectionModel().getMinSelectionIndex() >= 0); } } });
private void doMove(int step) { acceptEditedValue(); ListSelectionModel selectionModel = paramTable.getSelectionModel(); int min = selectionModel.getMinSelectionIndex(); int max = selectionModel.getMaxSelectionIndex(); selectionModel.clearSelection(); model.moveRow(min, max, min + step); selectionModel.addSelectionInterval(min + step, max + step); }
protected ListSelectionModel saveColumnsSelection() { ListSelectionModel savedSelection = new DefaultListSelectionModel(); for (int viewColumnIndex = columnsSelectionModel.getMinSelectionIndex(); viewColumnIndex <= columnsSelectionModel.getMaxSelectionIndex(); viewColumnIndex++) { if (columnsSelectionModel.isSelectedIndex(viewColumnIndex)) { // We have to act upon view coordinates here! savedSelection.addSelectionInterval(viewColumnIndex, viewColumnIndex); } } return savedSelection; }
public IntegerInterval getInterval() { final int minimum = this.tableSelectionModel.getMinSelectionIndex(); final int maximum = this.tableSelectionModel.getMaxSelectionIndex(); if (minimum < 0 || maximum < 0) { return new IntegerInterval(-1, -1); } return new IntegerInterval(this.rowMapper.getModelIndex(minimum), this.rowMapper.getModelIndex(maximum)); }
public ListSelectionModel saveSelection() { ListSelectionModel cacheSelection = new DefaultListSelectionModel(); if (viewSelection != null) { for (int irow = viewSelection.getMinSelectionIndex(); irow <= viewSelection.getMaxSelectionIndex(); irow++) { if (viewSelection.isSelectedIndex(irow)) { int modelRow = convertRowIndexToModel(irow); cacheSelection.addSelectionInterval(modelRow, modelRow); } } } return cacheSelection; }
protected void restoreRowsSelection(ListSelectionModel wasSeleted) { // We have to act upon view coordinates here! rowsSelectionModel.clearSelection(); for (int viewRowIndex = wasSeleted.getMinSelectionIndex(); viewRowIndex <= wasSeleted.getMaxSelectionIndex(); viewRowIndex++) { if (viewRowIndex >= 0 && viewRowIndex < rowSorter.getViewRowCount()) { rowsSelectionModel.addSelectionInterval(viewRowIndex, viewRowIndex); } else if (viewRowIndex == rowSorter.getViewRowCount()) { rowsSelectionModel.addSelectionInterval(viewRowIndex - 1, viewRowIndex - 1); } } }
void up() { ListSelectionModel selectionModel = list.getSelectionModel(); int from = selectionModel.getMinSelectionIndex(); int to = selectionModel.getMaxSelectionIndex(); if (from > 0) { File top = (File) model.getElementAt(from - 1); for (int i = from; i <= to; i++) model.set(i - 1, (File) model.getElementAt(i)); model.set(to, top); selectionModel.setSelectionInterval(from - 1, to - 1); } }
void down() { ListSelectionModel selectionModel = list.getSelectionModel(); int from = selectionModel.getMinSelectionIndex(); int to = selectionModel.getMaxSelectionIndex(); if (from >= 0 && to < model.getSize() - 1) { File bottom = (File) model.getElementAt(to + 1); for (int i = to; i >= from; i--) model.set(i + 1, (File) model.getElementAt(i)); model.set(from, bottom); selectionModel.setSelectionInterval(from + 1, to + 1); } }