rem
stringlengths
0
477k
add
stringlengths
0
313k
context
stringlengths
6
599k
meta
stringlengths
141
403
else if (e.getActionCommand().equals("selectNextColumnExtendSelection"))
else if (command.equals("selectNextColumnExtendSelection"))
public void actionPerformed (ActionEvent e) { ListSelectionModel rowModel = table.getSelectionModel(); ListSelectionModel colModel = table.getColumnModel().getSelectionModel(); int rowLead = rowModel.getLeadSelectionIndex(); int rowMax = table.getModel().getRowCount() - 1; int colLead = colModel.getLeadSelectionIndex(); int colMax = table.getModel().getColumnCount() - 1; if (e.getActionCommand().equals("selectPreviousRowExtendSelection")) { rowModel.setLeadSelectionIndex(Math.max(rowLead - 1, 0)); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("selectLastColumn")) { table.clearSelection(); rowModel.setSelectionInterval(rowLead, rowLead); colModel.setSelectionInterval(colMax, colMax); } else if (e.getActionCommand().equals("startEditing")) { if (table.isCellEditable(rowLead, colLead)) table.editCellAt(rowLead,colLead); } else if (e.getActionCommand().equals("selectFirstRowExtendSelection")) { rowModel.setLeadSelectionIndex(0); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("selectFirstColumn")) { rowModel.setSelectionInterval(rowLead, rowLead); colModel.setSelectionInterval(0, 0); } else if (e.getActionCommand().equals("selectFirstColumnExtendSelection")) { colModel.setLeadSelectionIndex(0); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectLastRow")) { rowModel.setSelectionInterval(rowMax,rowMax); colModel.setSelectionInterval(colLead, colLead); } else if (e.getActionCommand().equals("selectNextRowExtendSelection")) { rowModel.setLeadSelectionIndex(Math.min(rowLead + 1, rowMax)); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("selectFirstRow")) { rowModel.setSelectionInterval(0,0); colModel.setSelectionInterval(colLead, colLead); } else if (e.getActionCommand().equals("selectNextColumnExtendSelection")) { colModel.setLeadSelectionIndex(Math.min(colLead + 1, colMax)); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectLastColumnExtendSelection")) { colModel.setLeadSelectionIndex(colMax); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectPreviousColumnExtendSelection")) { colModel.setLeadSelectionIndex(Math.max(colLead - 1, 0)); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectNextRow")) { rowModel.setSelectionInterval(Math.min(rowLead + 1, rowMax), Math.min(rowLead + 1, rowMax)); colModel.setSelectionInterval(colLead,colLead); } else if (e.getActionCommand().equals("scrollUpExtendSelection")) { int target; if (rowLead == getFirstVisibleRowIndex()) target = Math.max (0, rowLead - (getLastVisibleRowIndex() - getFirstVisibleRowIndex() + 1)); else target = getFirstVisibleRowIndex(); rowModel.setLeadSelectionIndex(target); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("selectPreviousRow")) { rowModel.setSelectionInterval(Math.max(rowLead - 1, 0), Math.max(rowLead - 1, 0)); colModel.setSelectionInterval(colLead,colLead); } else if (e.getActionCommand().equals("scrollRightChangeSelection")) { int target; if (colLead == getLastVisibleColumnIndex()) target = Math.min (colMax, colLead + (getLastVisibleColumnIndex() - getFirstVisibleColumnIndex() + 1)); else target = getLastVisibleColumnIndex(); colModel.setSelectionInterval(target, target); rowModel.setSelectionInterval(rowLead, rowLead); } else if (e.getActionCommand().equals("selectPreviousColumn")) { rowModel.setSelectionInterval(rowLead,rowLead); colModel.setSelectionInterval(Math.max(colLead - 1, 0), Math.max(colLead - 1, 0)); } else if (e.getActionCommand().equals("scrollLeftChangeSelection")) { int target; if (colLead == getFirstVisibleColumnIndex()) target = Math.max (0, colLead - (getLastVisibleColumnIndex() - getFirstVisibleColumnIndex() + 1)); else target = getFirstVisibleColumnIndex(); colModel.setSelectionInterval(target, target); rowModel.setSelectionInterval(rowLead, rowLead); } else if (e.getActionCommand().equals("clearSelection")) { table.clearSelection(); } else if (e.getActionCommand().equals("cancel")) { // FIXME: implement other parts of "cancel" like undo-ing last // selection. Right now it just calls editingCancelled if // we're currently editing. if (table.isEditing()) table.editingCanceled(new ChangeEvent("cancel")); } else if (e.getActionCommand().equals("selectNextRowCell") || e.getActionCommand().equals("selectPreviousRowCell") || e.getActionCommand().equals("selectNextColumnCell") || e.getActionCommand().equals("selectPreviousColumnCell")) { // If nothing is selected, select the first cell in the table if (table.getSelectedRowCount() == 0 && table.getSelectedColumnCount() == 0) { rowModel.setSelectionInterval(0, 0); colModel.setSelectionInterval(0, 0); return; } // If the lead selection index isn't selected (ie a remove operation // happened, then set the lead to the first selected cell in the // table if (!table.isCellSelected(rowLead, colLead)) { rowModel.addSelectionInterval(rowModel.getMinSelectionIndex(), rowModel.getMinSelectionIndex()); colModel.addSelectionInterval(colModel.getMinSelectionIndex(), colModel.getMinSelectionIndex()); return; } // multRowsSelected and multColsSelected tell us if multiple rows or // columns are selected, respectively boolean multRowsSelected, multColsSelected; multRowsSelected = table.getSelectedRowCount() > 1 && table.getRowSelectionAllowed(); multColsSelected = table.getSelectedColumnCount() > 1 && table.getColumnSelectionAllowed(); // If there is just one selection, select the next cell, and wrap // when you get to the edges of the table. if (!multColsSelected && !multRowsSelected) { if (e.getActionCommand().indexOf("Column") != -1) advanceSingleSelection(colModel, colMax, rowModel, rowMax, (e.getActionCommand().equals ("selectPreviousColumnCell"))); else advanceSingleSelection(rowModel, rowMax, colModel, colMax, (e.getActionCommand().equals ("selectPreviousRowCell"))); return; } // rowMinSelected and rowMaxSelected are the minimum and maximum // values respectively of selected cells in the row selection model // Similarly for colMinSelected and colMaxSelected. int rowMaxSelected = table.getRowSelectionAllowed() ? rowModel.getMaxSelectionIndex() : table.getModel().getRowCount() - 1; int rowMinSelected = table.getRowSelectionAllowed() ? rowModel.getMinSelectionIndex() : 0; int colMaxSelected = table.getColumnSelectionAllowed() ? colModel.getMaxSelectionIndex() : table.getModel().getColumnCount() - 1; int colMinSelected = table.getColumnSelectionAllowed() ? colModel.getMinSelectionIndex() : 0; // If there are multiple rows and columns selected, select the next // cell and wrap at the edges of the selection. if (e.getActionCommand().indexOf("Column") != -1) advanceMultipleSelection(colModel, colMinSelected, colMaxSelected, rowModel, rowMinSelected, rowMaxSelected, (e.getActionCommand().equals ("selectPreviousColumnCell")), true); else advanceMultipleSelection(rowModel, rowMinSelected, rowMaxSelected, colModel, colMinSelected, colMaxSelected, (e.getActionCommand().equals ("selectPreviousRowCell")), false); } else if (e.getActionCommand().equals("selectNextColumn")) { rowModel.setSelectionInterval(rowLead,rowLead); colModel.setSelectionInterval(Math.min(colLead + 1, colMax), Math.min(colLead + 1, colMax)); } else if (e.getActionCommand().equals("scrollLeftExtendSelection")) { int target; if (colLead == getFirstVisibleColumnIndex()) target = Math.max (0, colLead - (getLastVisibleColumnIndex() - getFirstVisibleColumnIndex() + 1)); else target = getFirstVisibleColumnIndex(); colModel.setLeadSelectionIndex(target); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("scrollDownChangeSelection")) { int target; if (rowLead == getLastVisibleRowIndex()) target = Math.min (rowMax, rowLead + (getLastVisibleRowIndex() - getFirstVisibleRowIndex() + 1)); else target = getLastVisibleRowIndex(); rowModel.setSelectionInterval(target, target); colModel.setSelectionInterval(colLead, colLead); } else if (e.getActionCommand().equals("scrollRightExtendSelection")) { int target; if (colLead == getLastVisibleColumnIndex()) target = Math.min (colMax, colLead + (getLastVisibleColumnIndex() - getFirstVisibleColumnIndex() + 1)); else target = getLastVisibleColumnIndex(); colModel.setLeadSelectionIndex(target); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectAll")) { table.selectAll(); } else if (e.getActionCommand().equals("selectLastRowExtendSelection")) { rowModel.setLeadSelectionIndex(rowMax); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("scrollDownExtendSelection")) { int target; if (rowLead == getLastVisibleRowIndex()) target = Math.min (rowMax, rowLead + (getLastVisibleRowIndex() - getFirstVisibleRowIndex() + 1)); else target = getLastVisibleRowIndex(); rowModel.setLeadSelectionIndex(target); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("scrollUpChangeSelection")) { int target; if (rowLead == getFirstVisibleRowIndex()) target = Math.max (0, rowLead - (getLastVisibleRowIndex() - getFirstVisibleRowIndex() + 1)); else target = getFirstVisibleRowIndex(); rowModel.setSelectionInterval(target, target); colModel.setSelectionInterval(colLead, colLead); } else { // If we're here that means we bound this TableAction class // to a keyboard input but we either want to ignore that input // or we just haven't implemented its action yet. } if (table.isEditing() && e.getActionCommand() != "startEditing") table.editingCanceled(new ChangeEvent("update")); table.repaint(); table.scrollRectToVisible (table.getCellRect(rowModel.getLeadSelectionIndex(), colModel.getLeadSelectionIndex(), false)); }
1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/963ae61676e8c35a9e0998e0b7de1f942db82a26/BasicTableUI.java/buggy/core/src/classpath/javax/javax/swing/plaf/basic/BasicTableUI.java
else if (e.getActionCommand().equals("selectLastColumnExtendSelection"))
else if (command.equals("selectLastColumnExtendSelection"))
public void actionPerformed (ActionEvent e) { ListSelectionModel rowModel = table.getSelectionModel(); ListSelectionModel colModel = table.getColumnModel().getSelectionModel(); int rowLead = rowModel.getLeadSelectionIndex(); int rowMax = table.getModel().getRowCount() - 1; int colLead = colModel.getLeadSelectionIndex(); int colMax = table.getModel().getColumnCount() - 1; if (e.getActionCommand().equals("selectPreviousRowExtendSelection")) { rowModel.setLeadSelectionIndex(Math.max(rowLead - 1, 0)); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("selectLastColumn")) { table.clearSelection(); rowModel.setSelectionInterval(rowLead, rowLead); colModel.setSelectionInterval(colMax, colMax); } else if (e.getActionCommand().equals("startEditing")) { if (table.isCellEditable(rowLead, colLead)) table.editCellAt(rowLead,colLead); } else if (e.getActionCommand().equals("selectFirstRowExtendSelection")) { rowModel.setLeadSelectionIndex(0); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("selectFirstColumn")) { rowModel.setSelectionInterval(rowLead, rowLead); colModel.setSelectionInterval(0, 0); } else if (e.getActionCommand().equals("selectFirstColumnExtendSelection")) { colModel.setLeadSelectionIndex(0); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectLastRow")) { rowModel.setSelectionInterval(rowMax,rowMax); colModel.setSelectionInterval(colLead, colLead); } else if (e.getActionCommand().equals("selectNextRowExtendSelection")) { rowModel.setLeadSelectionIndex(Math.min(rowLead + 1, rowMax)); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("selectFirstRow")) { rowModel.setSelectionInterval(0,0); colModel.setSelectionInterval(colLead, colLead); } else if (e.getActionCommand().equals("selectNextColumnExtendSelection")) { colModel.setLeadSelectionIndex(Math.min(colLead + 1, colMax)); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectLastColumnExtendSelection")) { colModel.setLeadSelectionIndex(colMax); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectPreviousColumnExtendSelection")) { colModel.setLeadSelectionIndex(Math.max(colLead - 1, 0)); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectNextRow")) { rowModel.setSelectionInterval(Math.min(rowLead + 1, rowMax), Math.min(rowLead + 1, rowMax)); colModel.setSelectionInterval(colLead,colLead); } else if (e.getActionCommand().equals("scrollUpExtendSelection")) { int target; if (rowLead == getFirstVisibleRowIndex()) target = Math.max (0, rowLead - (getLastVisibleRowIndex() - getFirstVisibleRowIndex() + 1)); else target = getFirstVisibleRowIndex(); rowModel.setLeadSelectionIndex(target); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("selectPreviousRow")) { rowModel.setSelectionInterval(Math.max(rowLead - 1, 0), Math.max(rowLead - 1, 0)); colModel.setSelectionInterval(colLead,colLead); } else if (e.getActionCommand().equals("scrollRightChangeSelection")) { int target; if (colLead == getLastVisibleColumnIndex()) target = Math.min (colMax, colLead + (getLastVisibleColumnIndex() - getFirstVisibleColumnIndex() + 1)); else target = getLastVisibleColumnIndex(); colModel.setSelectionInterval(target, target); rowModel.setSelectionInterval(rowLead, rowLead); } else if (e.getActionCommand().equals("selectPreviousColumn")) { rowModel.setSelectionInterval(rowLead,rowLead); colModel.setSelectionInterval(Math.max(colLead - 1, 0), Math.max(colLead - 1, 0)); } else if (e.getActionCommand().equals("scrollLeftChangeSelection")) { int target; if (colLead == getFirstVisibleColumnIndex()) target = Math.max (0, colLead - (getLastVisibleColumnIndex() - getFirstVisibleColumnIndex() + 1)); else target = getFirstVisibleColumnIndex(); colModel.setSelectionInterval(target, target); rowModel.setSelectionInterval(rowLead, rowLead); } else if (e.getActionCommand().equals("clearSelection")) { table.clearSelection(); } else if (e.getActionCommand().equals("cancel")) { // FIXME: implement other parts of "cancel" like undo-ing last // selection. Right now it just calls editingCancelled if // we're currently editing. if (table.isEditing()) table.editingCanceled(new ChangeEvent("cancel")); } else if (e.getActionCommand().equals("selectNextRowCell") || e.getActionCommand().equals("selectPreviousRowCell") || e.getActionCommand().equals("selectNextColumnCell") || e.getActionCommand().equals("selectPreviousColumnCell")) { // If nothing is selected, select the first cell in the table if (table.getSelectedRowCount() == 0 && table.getSelectedColumnCount() == 0) { rowModel.setSelectionInterval(0, 0); colModel.setSelectionInterval(0, 0); return; } // If the lead selection index isn't selected (ie a remove operation // happened, then set the lead to the first selected cell in the // table if (!table.isCellSelected(rowLead, colLead)) { rowModel.addSelectionInterval(rowModel.getMinSelectionIndex(), rowModel.getMinSelectionIndex()); colModel.addSelectionInterval(colModel.getMinSelectionIndex(), colModel.getMinSelectionIndex()); return; } // multRowsSelected and multColsSelected tell us if multiple rows or // columns are selected, respectively boolean multRowsSelected, multColsSelected; multRowsSelected = table.getSelectedRowCount() > 1 && table.getRowSelectionAllowed(); multColsSelected = table.getSelectedColumnCount() > 1 && table.getColumnSelectionAllowed(); // If there is just one selection, select the next cell, and wrap // when you get to the edges of the table. if (!multColsSelected && !multRowsSelected) { if (e.getActionCommand().indexOf("Column") != -1) advanceSingleSelection(colModel, colMax, rowModel, rowMax, (e.getActionCommand().equals ("selectPreviousColumnCell"))); else advanceSingleSelection(rowModel, rowMax, colModel, colMax, (e.getActionCommand().equals ("selectPreviousRowCell"))); return; } // rowMinSelected and rowMaxSelected are the minimum and maximum // values respectively of selected cells in the row selection model // Similarly for colMinSelected and colMaxSelected. int rowMaxSelected = table.getRowSelectionAllowed() ? rowModel.getMaxSelectionIndex() : table.getModel().getRowCount() - 1; int rowMinSelected = table.getRowSelectionAllowed() ? rowModel.getMinSelectionIndex() : 0; int colMaxSelected = table.getColumnSelectionAllowed() ? colModel.getMaxSelectionIndex() : table.getModel().getColumnCount() - 1; int colMinSelected = table.getColumnSelectionAllowed() ? colModel.getMinSelectionIndex() : 0; // If there are multiple rows and columns selected, select the next // cell and wrap at the edges of the selection. if (e.getActionCommand().indexOf("Column") != -1) advanceMultipleSelection(colModel, colMinSelected, colMaxSelected, rowModel, rowMinSelected, rowMaxSelected, (e.getActionCommand().equals ("selectPreviousColumnCell")), true); else advanceMultipleSelection(rowModel, rowMinSelected, rowMaxSelected, colModel, colMinSelected, colMaxSelected, (e.getActionCommand().equals ("selectPreviousRowCell")), false); } else if (e.getActionCommand().equals("selectNextColumn")) { rowModel.setSelectionInterval(rowLead,rowLead); colModel.setSelectionInterval(Math.min(colLead + 1, colMax), Math.min(colLead + 1, colMax)); } else if (e.getActionCommand().equals("scrollLeftExtendSelection")) { int target; if (colLead == getFirstVisibleColumnIndex()) target = Math.max (0, colLead - (getLastVisibleColumnIndex() - getFirstVisibleColumnIndex() + 1)); else target = getFirstVisibleColumnIndex(); colModel.setLeadSelectionIndex(target); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("scrollDownChangeSelection")) { int target; if (rowLead == getLastVisibleRowIndex()) target = Math.min (rowMax, rowLead + (getLastVisibleRowIndex() - getFirstVisibleRowIndex() + 1)); else target = getLastVisibleRowIndex(); rowModel.setSelectionInterval(target, target); colModel.setSelectionInterval(colLead, colLead); } else if (e.getActionCommand().equals("scrollRightExtendSelection")) { int target; if (colLead == getLastVisibleColumnIndex()) target = Math.min (colMax, colLead + (getLastVisibleColumnIndex() - getFirstVisibleColumnIndex() + 1)); else target = getLastVisibleColumnIndex(); colModel.setLeadSelectionIndex(target); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectAll")) { table.selectAll(); } else if (e.getActionCommand().equals("selectLastRowExtendSelection")) { rowModel.setLeadSelectionIndex(rowMax); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("scrollDownExtendSelection")) { int target; if (rowLead == getLastVisibleRowIndex()) target = Math.min (rowMax, rowLead + (getLastVisibleRowIndex() - getFirstVisibleRowIndex() + 1)); else target = getLastVisibleRowIndex(); rowModel.setLeadSelectionIndex(target); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("scrollUpChangeSelection")) { int target; if (rowLead == getFirstVisibleRowIndex()) target = Math.max (0, rowLead - (getLastVisibleRowIndex() - getFirstVisibleRowIndex() + 1)); else target = getFirstVisibleRowIndex(); rowModel.setSelectionInterval(target, target); colModel.setSelectionInterval(colLead, colLead); } else { // If we're here that means we bound this TableAction class // to a keyboard input but we either want to ignore that input // or we just haven't implemented its action yet. } if (table.isEditing() && e.getActionCommand() != "startEditing") table.editingCanceled(new ChangeEvent("update")); table.repaint(); table.scrollRectToVisible (table.getCellRect(rowModel.getLeadSelectionIndex(), colModel.getLeadSelectionIndex(), false)); }
1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/963ae61676e8c35a9e0998e0b7de1f942db82a26/BasicTableUI.java/buggy/core/src/classpath/javax/javax/swing/plaf/basic/BasicTableUI.java
else if (e.getActionCommand().equals("selectPreviousColumnExtendSelection"))
else if (command.equals("selectPreviousColumnExtendSelection"))
public void actionPerformed (ActionEvent e) { ListSelectionModel rowModel = table.getSelectionModel(); ListSelectionModel colModel = table.getColumnModel().getSelectionModel(); int rowLead = rowModel.getLeadSelectionIndex(); int rowMax = table.getModel().getRowCount() - 1; int colLead = colModel.getLeadSelectionIndex(); int colMax = table.getModel().getColumnCount() - 1; if (e.getActionCommand().equals("selectPreviousRowExtendSelection")) { rowModel.setLeadSelectionIndex(Math.max(rowLead - 1, 0)); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("selectLastColumn")) { table.clearSelection(); rowModel.setSelectionInterval(rowLead, rowLead); colModel.setSelectionInterval(colMax, colMax); } else if (e.getActionCommand().equals("startEditing")) { if (table.isCellEditable(rowLead, colLead)) table.editCellAt(rowLead,colLead); } else if (e.getActionCommand().equals("selectFirstRowExtendSelection")) { rowModel.setLeadSelectionIndex(0); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("selectFirstColumn")) { rowModel.setSelectionInterval(rowLead, rowLead); colModel.setSelectionInterval(0, 0); } else if (e.getActionCommand().equals("selectFirstColumnExtendSelection")) { colModel.setLeadSelectionIndex(0); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectLastRow")) { rowModel.setSelectionInterval(rowMax,rowMax); colModel.setSelectionInterval(colLead, colLead); } else if (e.getActionCommand().equals("selectNextRowExtendSelection")) { rowModel.setLeadSelectionIndex(Math.min(rowLead + 1, rowMax)); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("selectFirstRow")) { rowModel.setSelectionInterval(0,0); colModel.setSelectionInterval(colLead, colLead); } else if (e.getActionCommand().equals("selectNextColumnExtendSelection")) { colModel.setLeadSelectionIndex(Math.min(colLead + 1, colMax)); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectLastColumnExtendSelection")) { colModel.setLeadSelectionIndex(colMax); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectPreviousColumnExtendSelection")) { colModel.setLeadSelectionIndex(Math.max(colLead - 1, 0)); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectNextRow")) { rowModel.setSelectionInterval(Math.min(rowLead + 1, rowMax), Math.min(rowLead + 1, rowMax)); colModel.setSelectionInterval(colLead,colLead); } else if (e.getActionCommand().equals("scrollUpExtendSelection")) { int target; if (rowLead == getFirstVisibleRowIndex()) target = Math.max (0, rowLead - (getLastVisibleRowIndex() - getFirstVisibleRowIndex() + 1)); else target = getFirstVisibleRowIndex(); rowModel.setLeadSelectionIndex(target); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("selectPreviousRow")) { rowModel.setSelectionInterval(Math.max(rowLead - 1, 0), Math.max(rowLead - 1, 0)); colModel.setSelectionInterval(colLead,colLead); } else if (e.getActionCommand().equals("scrollRightChangeSelection")) { int target; if (colLead == getLastVisibleColumnIndex()) target = Math.min (colMax, colLead + (getLastVisibleColumnIndex() - getFirstVisibleColumnIndex() + 1)); else target = getLastVisibleColumnIndex(); colModel.setSelectionInterval(target, target); rowModel.setSelectionInterval(rowLead, rowLead); } else if (e.getActionCommand().equals("selectPreviousColumn")) { rowModel.setSelectionInterval(rowLead,rowLead); colModel.setSelectionInterval(Math.max(colLead - 1, 0), Math.max(colLead - 1, 0)); } else if (e.getActionCommand().equals("scrollLeftChangeSelection")) { int target; if (colLead == getFirstVisibleColumnIndex()) target = Math.max (0, colLead - (getLastVisibleColumnIndex() - getFirstVisibleColumnIndex() + 1)); else target = getFirstVisibleColumnIndex(); colModel.setSelectionInterval(target, target); rowModel.setSelectionInterval(rowLead, rowLead); } else if (e.getActionCommand().equals("clearSelection")) { table.clearSelection(); } else if (e.getActionCommand().equals("cancel")) { // FIXME: implement other parts of "cancel" like undo-ing last // selection. Right now it just calls editingCancelled if // we're currently editing. if (table.isEditing()) table.editingCanceled(new ChangeEvent("cancel")); } else if (e.getActionCommand().equals("selectNextRowCell") || e.getActionCommand().equals("selectPreviousRowCell") || e.getActionCommand().equals("selectNextColumnCell") || e.getActionCommand().equals("selectPreviousColumnCell")) { // If nothing is selected, select the first cell in the table if (table.getSelectedRowCount() == 0 && table.getSelectedColumnCount() == 0) { rowModel.setSelectionInterval(0, 0); colModel.setSelectionInterval(0, 0); return; } // If the lead selection index isn't selected (ie a remove operation // happened, then set the lead to the first selected cell in the // table if (!table.isCellSelected(rowLead, colLead)) { rowModel.addSelectionInterval(rowModel.getMinSelectionIndex(), rowModel.getMinSelectionIndex()); colModel.addSelectionInterval(colModel.getMinSelectionIndex(), colModel.getMinSelectionIndex()); return; } // multRowsSelected and multColsSelected tell us if multiple rows or // columns are selected, respectively boolean multRowsSelected, multColsSelected; multRowsSelected = table.getSelectedRowCount() > 1 && table.getRowSelectionAllowed(); multColsSelected = table.getSelectedColumnCount() > 1 && table.getColumnSelectionAllowed(); // If there is just one selection, select the next cell, and wrap // when you get to the edges of the table. if (!multColsSelected && !multRowsSelected) { if (e.getActionCommand().indexOf("Column") != -1) advanceSingleSelection(colModel, colMax, rowModel, rowMax, (e.getActionCommand().equals ("selectPreviousColumnCell"))); else advanceSingleSelection(rowModel, rowMax, colModel, colMax, (e.getActionCommand().equals ("selectPreviousRowCell"))); return; } // rowMinSelected and rowMaxSelected are the minimum and maximum // values respectively of selected cells in the row selection model // Similarly for colMinSelected and colMaxSelected. int rowMaxSelected = table.getRowSelectionAllowed() ? rowModel.getMaxSelectionIndex() : table.getModel().getRowCount() - 1; int rowMinSelected = table.getRowSelectionAllowed() ? rowModel.getMinSelectionIndex() : 0; int colMaxSelected = table.getColumnSelectionAllowed() ? colModel.getMaxSelectionIndex() : table.getModel().getColumnCount() - 1; int colMinSelected = table.getColumnSelectionAllowed() ? colModel.getMinSelectionIndex() : 0; // If there are multiple rows and columns selected, select the next // cell and wrap at the edges of the selection. if (e.getActionCommand().indexOf("Column") != -1) advanceMultipleSelection(colModel, colMinSelected, colMaxSelected, rowModel, rowMinSelected, rowMaxSelected, (e.getActionCommand().equals ("selectPreviousColumnCell")), true); else advanceMultipleSelection(rowModel, rowMinSelected, rowMaxSelected, colModel, colMinSelected, colMaxSelected, (e.getActionCommand().equals ("selectPreviousRowCell")), false); } else if (e.getActionCommand().equals("selectNextColumn")) { rowModel.setSelectionInterval(rowLead,rowLead); colModel.setSelectionInterval(Math.min(colLead + 1, colMax), Math.min(colLead + 1, colMax)); } else if (e.getActionCommand().equals("scrollLeftExtendSelection")) { int target; if (colLead == getFirstVisibleColumnIndex()) target = Math.max (0, colLead - (getLastVisibleColumnIndex() - getFirstVisibleColumnIndex() + 1)); else target = getFirstVisibleColumnIndex(); colModel.setLeadSelectionIndex(target); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("scrollDownChangeSelection")) { int target; if (rowLead == getLastVisibleRowIndex()) target = Math.min (rowMax, rowLead + (getLastVisibleRowIndex() - getFirstVisibleRowIndex() + 1)); else target = getLastVisibleRowIndex(); rowModel.setSelectionInterval(target, target); colModel.setSelectionInterval(colLead, colLead); } else if (e.getActionCommand().equals("scrollRightExtendSelection")) { int target; if (colLead == getLastVisibleColumnIndex()) target = Math.min (colMax, colLead + (getLastVisibleColumnIndex() - getFirstVisibleColumnIndex() + 1)); else target = getLastVisibleColumnIndex(); colModel.setLeadSelectionIndex(target); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectAll")) { table.selectAll(); } else if (e.getActionCommand().equals("selectLastRowExtendSelection")) { rowModel.setLeadSelectionIndex(rowMax); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("scrollDownExtendSelection")) { int target; if (rowLead == getLastVisibleRowIndex()) target = Math.min (rowMax, rowLead + (getLastVisibleRowIndex() - getFirstVisibleRowIndex() + 1)); else target = getLastVisibleRowIndex(); rowModel.setLeadSelectionIndex(target); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("scrollUpChangeSelection")) { int target; if (rowLead == getFirstVisibleRowIndex()) target = Math.max (0, rowLead - (getLastVisibleRowIndex() - getFirstVisibleRowIndex() + 1)); else target = getFirstVisibleRowIndex(); rowModel.setSelectionInterval(target, target); colModel.setSelectionInterval(colLead, colLead); } else { // If we're here that means we bound this TableAction class // to a keyboard input but we either want to ignore that input // or we just haven't implemented its action yet. } if (table.isEditing() && e.getActionCommand() != "startEditing") table.editingCanceled(new ChangeEvent("update")); table.repaint(); table.scrollRectToVisible (table.getCellRect(rowModel.getLeadSelectionIndex(), colModel.getLeadSelectionIndex(), false)); }
1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/963ae61676e8c35a9e0998e0b7de1f942db82a26/BasicTableUI.java/buggy/core/src/classpath/javax/javax/swing/plaf/basic/BasicTableUI.java
else if (e.getActionCommand().equals("selectNextRow"))
else if (command.equals("selectNextRow"))
public void actionPerformed (ActionEvent e) { ListSelectionModel rowModel = table.getSelectionModel(); ListSelectionModel colModel = table.getColumnModel().getSelectionModel(); int rowLead = rowModel.getLeadSelectionIndex(); int rowMax = table.getModel().getRowCount() - 1; int colLead = colModel.getLeadSelectionIndex(); int colMax = table.getModel().getColumnCount() - 1; if (e.getActionCommand().equals("selectPreviousRowExtendSelection")) { rowModel.setLeadSelectionIndex(Math.max(rowLead - 1, 0)); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("selectLastColumn")) { table.clearSelection(); rowModel.setSelectionInterval(rowLead, rowLead); colModel.setSelectionInterval(colMax, colMax); } else if (e.getActionCommand().equals("startEditing")) { if (table.isCellEditable(rowLead, colLead)) table.editCellAt(rowLead,colLead); } else if (e.getActionCommand().equals("selectFirstRowExtendSelection")) { rowModel.setLeadSelectionIndex(0); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("selectFirstColumn")) { rowModel.setSelectionInterval(rowLead, rowLead); colModel.setSelectionInterval(0, 0); } else if (e.getActionCommand().equals("selectFirstColumnExtendSelection")) { colModel.setLeadSelectionIndex(0); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectLastRow")) { rowModel.setSelectionInterval(rowMax,rowMax); colModel.setSelectionInterval(colLead, colLead); } else if (e.getActionCommand().equals("selectNextRowExtendSelection")) { rowModel.setLeadSelectionIndex(Math.min(rowLead + 1, rowMax)); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("selectFirstRow")) { rowModel.setSelectionInterval(0,0); colModel.setSelectionInterval(colLead, colLead); } else if (e.getActionCommand().equals("selectNextColumnExtendSelection")) { colModel.setLeadSelectionIndex(Math.min(colLead + 1, colMax)); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectLastColumnExtendSelection")) { colModel.setLeadSelectionIndex(colMax); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectPreviousColumnExtendSelection")) { colModel.setLeadSelectionIndex(Math.max(colLead - 1, 0)); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectNextRow")) { rowModel.setSelectionInterval(Math.min(rowLead + 1, rowMax), Math.min(rowLead + 1, rowMax)); colModel.setSelectionInterval(colLead,colLead); } else if (e.getActionCommand().equals("scrollUpExtendSelection")) { int target; if (rowLead == getFirstVisibleRowIndex()) target = Math.max (0, rowLead - (getLastVisibleRowIndex() - getFirstVisibleRowIndex() + 1)); else target = getFirstVisibleRowIndex(); rowModel.setLeadSelectionIndex(target); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("selectPreviousRow")) { rowModel.setSelectionInterval(Math.max(rowLead - 1, 0), Math.max(rowLead - 1, 0)); colModel.setSelectionInterval(colLead,colLead); } else if (e.getActionCommand().equals("scrollRightChangeSelection")) { int target; if (colLead == getLastVisibleColumnIndex()) target = Math.min (colMax, colLead + (getLastVisibleColumnIndex() - getFirstVisibleColumnIndex() + 1)); else target = getLastVisibleColumnIndex(); colModel.setSelectionInterval(target, target); rowModel.setSelectionInterval(rowLead, rowLead); } else if (e.getActionCommand().equals("selectPreviousColumn")) { rowModel.setSelectionInterval(rowLead,rowLead); colModel.setSelectionInterval(Math.max(colLead - 1, 0), Math.max(colLead - 1, 0)); } else if (e.getActionCommand().equals("scrollLeftChangeSelection")) { int target; if (colLead == getFirstVisibleColumnIndex()) target = Math.max (0, colLead - (getLastVisibleColumnIndex() - getFirstVisibleColumnIndex() + 1)); else target = getFirstVisibleColumnIndex(); colModel.setSelectionInterval(target, target); rowModel.setSelectionInterval(rowLead, rowLead); } else if (e.getActionCommand().equals("clearSelection")) { table.clearSelection(); } else if (e.getActionCommand().equals("cancel")) { // FIXME: implement other parts of "cancel" like undo-ing last // selection. Right now it just calls editingCancelled if // we're currently editing. if (table.isEditing()) table.editingCanceled(new ChangeEvent("cancel")); } else if (e.getActionCommand().equals("selectNextRowCell") || e.getActionCommand().equals("selectPreviousRowCell") || e.getActionCommand().equals("selectNextColumnCell") || e.getActionCommand().equals("selectPreviousColumnCell")) { // If nothing is selected, select the first cell in the table if (table.getSelectedRowCount() == 0 && table.getSelectedColumnCount() == 0) { rowModel.setSelectionInterval(0, 0); colModel.setSelectionInterval(0, 0); return; } // If the lead selection index isn't selected (ie a remove operation // happened, then set the lead to the first selected cell in the // table if (!table.isCellSelected(rowLead, colLead)) { rowModel.addSelectionInterval(rowModel.getMinSelectionIndex(), rowModel.getMinSelectionIndex()); colModel.addSelectionInterval(colModel.getMinSelectionIndex(), colModel.getMinSelectionIndex()); return; } // multRowsSelected and multColsSelected tell us if multiple rows or // columns are selected, respectively boolean multRowsSelected, multColsSelected; multRowsSelected = table.getSelectedRowCount() > 1 && table.getRowSelectionAllowed(); multColsSelected = table.getSelectedColumnCount() > 1 && table.getColumnSelectionAllowed(); // If there is just one selection, select the next cell, and wrap // when you get to the edges of the table. if (!multColsSelected && !multRowsSelected) { if (e.getActionCommand().indexOf("Column") != -1) advanceSingleSelection(colModel, colMax, rowModel, rowMax, (e.getActionCommand().equals ("selectPreviousColumnCell"))); else advanceSingleSelection(rowModel, rowMax, colModel, colMax, (e.getActionCommand().equals ("selectPreviousRowCell"))); return; } // rowMinSelected and rowMaxSelected are the minimum and maximum // values respectively of selected cells in the row selection model // Similarly for colMinSelected and colMaxSelected. int rowMaxSelected = table.getRowSelectionAllowed() ? rowModel.getMaxSelectionIndex() : table.getModel().getRowCount() - 1; int rowMinSelected = table.getRowSelectionAllowed() ? rowModel.getMinSelectionIndex() : 0; int colMaxSelected = table.getColumnSelectionAllowed() ? colModel.getMaxSelectionIndex() : table.getModel().getColumnCount() - 1; int colMinSelected = table.getColumnSelectionAllowed() ? colModel.getMinSelectionIndex() : 0; // If there are multiple rows and columns selected, select the next // cell and wrap at the edges of the selection. if (e.getActionCommand().indexOf("Column") != -1) advanceMultipleSelection(colModel, colMinSelected, colMaxSelected, rowModel, rowMinSelected, rowMaxSelected, (e.getActionCommand().equals ("selectPreviousColumnCell")), true); else advanceMultipleSelection(rowModel, rowMinSelected, rowMaxSelected, colModel, colMinSelected, colMaxSelected, (e.getActionCommand().equals ("selectPreviousRowCell")), false); } else if (e.getActionCommand().equals("selectNextColumn")) { rowModel.setSelectionInterval(rowLead,rowLead); colModel.setSelectionInterval(Math.min(colLead + 1, colMax), Math.min(colLead + 1, colMax)); } else if (e.getActionCommand().equals("scrollLeftExtendSelection")) { int target; if (colLead == getFirstVisibleColumnIndex()) target = Math.max (0, colLead - (getLastVisibleColumnIndex() - getFirstVisibleColumnIndex() + 1)); else target = getFirstVisibleColumnIndex(); colModel.setLeadSelectionIndex(target); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("scrollDownChangeSelection")) { int target; if (rowLead == getLastVisibleRowIndex()) target = Math.min (rowMax, rowLead + (getLastVisibleRowIndex() - getFirstVisibleRowIndex() + 1)); else target = getLastVisibleRowIndex(); rowModel.setSelectionInterval(target, target); colModel.setSelectionInterval(colLead, colLead); } else if (e.getActionCommand().equals("scrollRightExtendSelection")) { int target; if (colLead == getLastVisibleColumnIndex()) target = Math.min (colMax, colLead + (getLastVisibleColumnIndex() - getFirstVisibleColumnIndex() + 1)); else target = getLastVisibleColumnIndex(); colModel.setLeadSelectionIndex(target); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectAll")) { table.selectAll(); } else if (e.getActionCommand().equals("selectLastRowExtendSelection")) { rowModel.setLeadSelectionIndex(rowMax); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("scrollDownExtendSelection")) { int target; if (rowLead == getLastVisibleRowIndex()) target = Math.min (rowMax, rowLead + (getLastVisibleRowIndex() - getFirstVisibleRowIndex() + 1)); else target = getLastVisibleRowIndex(); rowModel.setLeadSelectionIndex(target); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("scrollUpChangeSelection")) { int target; if (rowLead == getFirstVisibleRowIndex()) target = Math.max (0, rowLead - (getLastVisibleRowIndex() - getFirstVisibleRowIndex() + 1)); else target = getFirstVisibleRowIndex(); rowModel.setSelectionInterval(target, target); colModel.setSelectionInterval(colLead, colLead); } else { // If we're here that means we bound this TableAction class // to a keyboard input but we either want to ignore that input // or we just haven't implemented its action yet. } if (table.isEditing() && e.getActionCommand() != "startEditing") table.editingCanceled(new ChangeEvent("update")); table.repaint(); table.scrollRectToVisible (table.getCellRect(rowModel.getLeadSelectionIndex(), colModel.getLeadSelectionIndex(), false)); }
1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/963ae61676e8c35a9e0998e0b7de1f942db82a26/BasicTableUI.java/buggy/core/src/classpath/javax/javax/swing/plaf/basic/BasicTableUI.java
else if (e.getActionCommand().equals("scrollUpExtendSelection"))
else if (command.equals("scrollUpExtendSelection"))
public void actionPerformed (ActionEvent e) { ListSelectionModel rowModel = table.getSelectionModel(); ListSelectionModel colModel = table.getColumnModel().getSelectionModel(); int rowLead = rowModel.getLeadSelectionIndex(); int rowMax = table.getModel().getRowCount() - 1; int colLead = colModel.getLeadSelectionIndex(); int colMax = table.getModel().getColumnCount() - 1; if (e.getActionCommand().equals("selectPreviousRowExtendSelection")) { rowModel.setLeadSelectionIndex(Math.max(rowLead - 1, 0)); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("selectLastColumn")) { table.clearSelection(); rowModel.setSelectionInterval(rowLead, rowLead); colModel.setSelectionInterval(colMax, colMax); } else if (e.getActionCommand().equals("startEditing")) { if (table.isCellEditable(rowLead, colLead)) table.editCellAt(rowLead,colLead); } else if (e.getActionCommand().equals("selectFirstRowExtendSelection")) { rowModel.setLeadSelectionIndex(0); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("selectFirstColumn")) { rowModel.setSelectionInterval(rowLead, rowLead); colModel.setSelectionInterval(0, 0); } else if (e.getActionCommand().equals("selectFirstColumnExtendSelection")) { colModel.setLeadSelectionIndex(0); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectLastRow")) { rowModel.setSelectionInterval(rowMax,rowMax); colModel.setSelectionInterval(colLead, colLead); } else if (e.getActionCommand().equals("selectNextRowExtendSelection")) { rowModel.setLeadSelectionIndex(Math.min(rowLead + 1, rowMax)); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("selectFirstRow")) { rowModel.setSelectionInterval(0,0); colModel.setSelectionInterval(colLead, colLead); } else if (e.getActionCommand().equals("selectNextColumnExtendSelection")) { colModel.setLeadSelectionIndex(Math.min(colLead + 1, colMax)); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectLastColumnExtendSelection")) { colModel.setLeadSelectionIndex(colMax); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectPreviousColumnExtendSelection")) { colModel.setLeadSelectionIndex(Math.max(colLead - 1, 0)); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectNextRow")) { rowModel.setSelectionInterval(Math.min(rowLead + 1, rowMax), Math.min(rowLead + 1, rowMax)); colModel.setSelectionInterval(colLead,colLead); } else if (e.getActionCommand().equals("scrollUpExtendSelection")) { int target; if (rowLead == getFirstVisibleRowIndex()) target = Math.max (0, rowLead - (getLastVisibleRowIndex() - getFirstVisibleRowIndex() + 1)); else target = getFirstVisibleRowIndex(); rowModel.setLeadSelectionIndex(target); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("selectPreviousRow")) { rowModel.setSelectionInterval(Math.max(rowLead - 1, 0), Math.max(rowLead - 1, 0)); colModel.setSelectionInterval(colLead,colLead); } else if (e.getActionCommand().equals("scrollRightChangeSelection")) { int target; if (colLead == getLastVisibleColumnIndex()) target = Math.min (colMax, colLead + (getLastVisibleColumnIndex() - getFirstVisibleColumnIndex() + 1)); else target = getLastVisibleColumnIndex(); colModel.setSelectionInterval(target, target); rowModel.setSelectionInterval(rowLead, rowLead); } else if (e.getActionCommand().equals("selectPreviousColumn")) { rowModel.setSelectionInterval(rowLead,rowLead); colModel.setSelectionInterval(Math.max(colLead - 1, 0), Math.max(colLead - 1, 0)); } else if (e.getActionCommand().equals("scrollLeftChangeSelection")) { int target; if (colLead == getFirstVisibleColumnIndex()) target = Math.max (0, colLead - (getLastVisibleColumnIndex() - getFirstVisibleColumnIndex() + 1)); else target = getFirstVisibleColumnIndex(); colModel.setSelectionInterval(target, target); rowModel.setSelectionInterval(rowLead, rowLead); } else if (e.getActionCommand().equals("clearSelection")) { table.clearSelection(); } else if (e.getActionCommand().equals("cancel")) { // FIXME: implement other parts of "cancel" like undo-ing last // selection. Right now it just calls editingCancelled if // we're currently editing. if (table.isEditing()) table.editingCanceled(new ChangeEvent("cancel")); } else if (e.getActionCommand().equals("selectNextRowCell") || e.getActionCommand().equals("selectPreviousRowCell") || e.getActionCommand().equals("selectNextColumnCell") || e.getActionCommand().equals("selectPreviousColumnCell")) { // If nothing is selected, select the first cell in the table if (table.getSelectedRowCount() == 0 && table.getSelectedColumnCount() == 0) { rowModel.setSelectionInterval(0, 0); colModel.setSelectionInterval(0, 0); return; } // If the lead selection index isn't selected (ie a remove operation // happened, then set the lead to the first selected cell in the // table if (!table.isCellSelected(rowLead, colLead)) { rowModel.addSelectionInterval(rowModel.getMinSelectionIndex(), rowModel.getMinSelectionIndex()); colModel.addSelectionInterval(colModel.getMinSelectionIndex(), colModel.getMinSelectionIndex()); return; } // multRowsSelected and multColsSelected tell us if multiple rows or // columns are selected, respectively boolean multRowsSelected, multColsSelected; multRowsSelected = table.getSelectedRowCount() > 1 && table.getRowSelectionAllowed(); multColsSelected = table.getSelectedColumnCount() > 1 && table.getColumnSelectionAllowed(); // If there is just one selection, select the next cell, and wrap // when you get to the edges of the table. if (!multColsSelected && !multRowsSelected) { if (e.getActionCommand().indexOf("Column") != -1) advanceSingleSelection(colModel, colMax, rowModel, rowMax, (e.getActionCommand().equals ("selectPreviousColumnCell"))); else advanceSingleSelection(rowModel, rowMax, colModel, colMax, (e.getActionCommand().equals ("selectPreviousRowCell"))); return; } // rowMinSelected and rowMaxSelected are the minimum and maximum // values respectively of selected cells in the row selection model // Similarly for colMinSelected and colMaxSelected. int rowMaxSelected = table.getRowSelectionAllowed() ? rowModel.getMaxSelectionIndex() : table.getModel().getRowCount() - 1; int rowMinSelected = table.getRowSelectionAllowed() ? rowModel.getMinSelectionIndex() : 0; int colMaxSelected = table.getColumnSelectionAllowed() ? colModel.getMaxSelectionIndex() : table.getModel().getColumnCount() - 1; int colMinSelected = table.getColumnSelectionAllowed() ? colModel.getMinSelectionIndex() : 0; // If there are multiple rows and columns selected, select the next // cell and wrap at the edges of the selection. if (e.getActionCommand().indexOf("Column") != -1) advanceMultipleSelection(colModel, colMinSelected, colMaxSelected, rowModel, rowMinSelected, rowMaxSelected, (e.getActionCommand().equals ("selectPreviousColumnCell")), true); else advanceMultipleSelection(rowModel, rowMinSelected, rowMaxSelected, colModel, colMinSelected, colMaxSelected, (e.getActionCommand().equals ("selectPreviousRowCell")), false); } else if (e.getActionCommand().equals("selectNextColumn")) { rowModel.setSelectionInterval(rowLead,rowLead); colModel.setSelectionInterval(Math.min(colLead + 1, colMax), Math.min(colLead + 1, colMax)); } else if (e.getActionCommand().equals("scrollLeftExtendSelection")) { int target; if (colLead == getFirstVisibleColumnIndex()) target = Math.max (0, colLead - (getLastVisibleColumnIndex() - getFirstVisibleColumnIndex() + 1)); else target = getFirstVisibleColumnIndex(); colModel.setLeadSelectionIndex(target); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("scrollDownChangeSelection")) { int target; if (rowLead == getLastVisibleRowIndex()) target = Math.min (rowMax, rowLead + (getLastVisibleRowIndex() - getFirstVisibleRowIndex() + 1)); else target = getLastVisibleRowIndex(); rowModel.setSelectionInterval(target, target); colModel.setSelectionInterval(colLead, colLead); } else if (e.getActionCommand().equals("scrollRightExtendSelection")) { int target; if (colLead == getLastVisibleColumnIndex()) target = Math.min (colMax, colLead + (getLastVisibleColumnIndex() - getFirstVisibleColumnIndex() + 1)); else target = getLastVisibleColumnIndex(); colModel.setLeadSelectionIndex(target); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectAll")) { table.selectAll(); } else if (e.getActionCommand().equals("selectLastRowExtendSelection")) { rowModel.setLeadSelectionIndex(rowMax); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("scrollDownExtendSelection")) { int target; if (rowLead == getLastVisibleRowIndex()) target = Math.min (rowMax, rowLead + (getLastVisibleRowIndex() - getFirstVisibleRowIndex() + 1)); else target = getLastVisibleRowIndex(); rowModel.setLeadSelectionIndex(target); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("scrollUpChangeSelection")) { int target; if (rowLead == getFirstVisibleRowIndex()) target = Math.max (0, rowLead - (getLastVisibleRowIndex() - getFirstVisibleRowIndex() + 1)); else target = getFirstVisibleRowIndex(); rowModel.setSelectionInterval(target, target); colModel.setSelectionInterval(colLead, colLead); } else { // If we're here that means we bound this TableAction class // to a keyboard input but we either want to ignore that input // or we just haven't implemented its action yet. } if (table.isEditing() && e.getActionCommand() != "startEditing") table.editingCanceled(new ChangeEvent("update")); table.repaint(); table.scrollRectToVisible (table.getCellRect(rowModel.getLeadSelectionIndex(), colModel.getLeadSelectionIndex(), false)); }
1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/963ae61676e8c35a9e0998e0b7de1f942db82a26/BasicTableUI.java/buggy/core/src/classpath/javax/javax/swing/plaf/basic/BasicTableUI.java
else if (e.getActionCommand().equals("selectPreviousRow"))
else if (command.equals("selectPreviousRow"))
public void actionPerformed (ActionEvent e) { ListSelectionModel rowModel = table.getSelectionModel(); ListSelectionModel colModel = table.getColumnModel().getSelectionModel(); int rowLead = rowModel.getLeadSelectionIndex(); int rowMax = table.getModel().getRowCount() - 1; int colLead = colModel.getLeadSelectionIndex(); int colMax = table.getModel().getColumnCount() - 1; if (e.getActionCommand().equals("selectPreviousRowExtendSelection")) { rowModel.setLeadSelectionIndex(Math.max(rowLead - 1, 0)); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("selectLastColumn")) { table.clearSelection(); rowModel.setSelectionInterval(rowLead, rowLead); colModel.setSelectionInterval(colMax, colMax); } else if (e.getActionCommand().equals("startEditing")) { if (table.isCellEditable(rowLead, colLead)) table.editCellAt(rowLead,colLead); } else if (e.getActionCommand().equals("selectFirstRowExtendSelection")) { rowModel.setLeadSelectionIndex(0); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("selectFirstColumn")) { rowModel.setSelectionInterval(rowLead, rowLead); colModel.setSelectionInterval(0, 0); } else if (e.getActionCommand().equals("selectFirstColumnExtendSelection")) { colModel.setLeadSelectionIndex(0); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectLastRow")) { rowModel.setSelectionInterval(rowMax,rowMax); colModel.setSelectionInterval(colLead, colLead); } else if (e.getActionCommand().equals("selectNextRowExtendSelection")) { rowModel.setLeadSelectionIndex(Math.min(rowLead + 1, rowMax)); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("selectFirstRow")) { rowModel.setSelectionInterval(0,0); colModel.setSelectionInterval(colLead, colLead); } else if (e.getActionCommand().equals("selectNextColumnExtendSelection")) { colModel.setLeadSelectionIndex(Math.min(colLead + 1, colMax)); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectLastColumnExtendSelection")) { colModel.setLeadSelectionIndex(colMax); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectPreviousColumnExtendSelection")) { colModel.setLeadSelectionIndex(Math.max(colLead - 1, 0)); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectNextRow")) { rowModel.setSelectionInterval(Math.min(rowLead + 1, rowMax), Math.min(rowLead + 1, rowMax)); colModel.setSelectionInterval(colLead,colLead); } else if (e.getActionCommand().equals("scrollUpExtendSelection")) { int target; if (rowLead == getFirstVisibleRowIndex()) target = Math.max (0, rowLead - (getLastVisibleRowIndex() - getFirstVisibleRowIndex() + 1)); else target = getFirstVisibleRowIndex(); rowModel.setLeadSelectionIndex(target); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("selectPreviousRow")) { rowModel.setSelectionInterval(Math.max(rowLead - 1, 0), Math.max(rowLead - 1, 0)); colModel.setSelectionInterval(colLead,colLead); } else if (e.getActionCommand().equals("scrollRightChangeSelection")) { int target; if (colLead == getLastVisibleColumnIndex()) target = Math.min (colMax, colLead + (getLastVisibleColumnIndex() - getFirstVisibleColumnIndex() + 1)); else target = getLastVisibleColumnIndex(); colModel.setSelectionInterval(target, target); rowModel.setSelectionInterval(rowLead, rowLead); } else if (e.getActionCommand().equals("selectPreviousColumn")) { rowModel.setSelectionInterval(rowLead,rowLead); colModel.setSelectionInterval(Math.max(colLead - 1, 0), Math.max(colLead - 1, 0)); } else if (e.getActionCommand().equals("scrollLeftChangeSelection")) { int target; if (colLead == getFirstVisibleColumnIndex()) target = Math.max (0, colLead - (getLastVisibleColumnIndex() - getFirstVisibleColumnIndex() + 1)); else target = getFirstVisibleColumnIndex(); colModel.setSelectionInterval(target, target); rowModel.setSelectionInterval(rowLead, rowLead); } else if (e.getActionCommand().equals("clearSelection")) { table.clearSelection(); } else if (e.getActionCommand().equals("cancel")) { // FIXME: implement other parts of "cancel" like undo-ing last // selection. Right now it just calls editingCancelled if // we're currently editing. if (table.isEditing()) table.editingCanceled(new ChangeEvent("cancel")); } else if (e.getActionCommand().equals("selectNextRowCell") || e.getActionCommand().equals("selectPreviousRowCell") || e.getActionCommand().equals("selectNextColumnCell") || e.getActionCommand().equals("selectPreviousColumnCell")) { // If nothing is selected, select the first cell in the table if (table.getSelectedRowCount() == 0 && table.getSelectedColumnCount() == 0) { rowModel.setSelectionInterval(0, 0); colModel.setSelectionInterval(0, 0); return; } // If the lead selection index isn't selected (ie a remove operation // happened, then set the lead to the first selected cell in the // table if (!table.isCellSelected(rowLead, colLead)) { rowModel.addSelectionInterval(rowModel.getMinSelectionIndex(), rowModel.getMinSelectionIndex()); colModel.addSelectionInterval(colModel.getMinSelectionIndex(), colModel.getMinSelectionIndex()); return; } // multRowsSelected and multColsSelected tell us if multiple rows or // columns are selected, respectively boolean multRowsSelected, multColsSelected; multRowsSelected = table.getSelectedRowCount() > 1 && table.getRowSelectionAllowed(); multColsSelected = table.getSelectedColumnCount() > 1 && table.getColumnSelectionAllowed(); // If there is just one selection, select the next cell, and wrap // when you get to the edges of the table. if (!multColsSelected && !multRowsSelected) { if (e.getActionCommand().indexOf("Column") != -1) advanceSingleSelection(colModel, colMax, rowModel, rowMax, (e.getActionCommand().equals ("selectPreviousColumnCell"))); else advanceSingleSelection(rowModel, rowMax, colModel, colMax, (e.getActionCommand().equals ("selectPreviousRowCell"))); return; } // rowMinSelected and rowMaxSelected are the minimum and maximum // values respectively of selected cells in the row selection model // Similarly for colMinSelected and colMaxSelected. int rowMaxSelected = table.getRowSelectionAllowed() ? rowModel.getMaxSelectionIndex() : table.getModel().getRowCount() - 1; int rowMinSelected = table.getRowSelectionAllowed() ? rowModel.getMinSelectionIndex() : 0; int colMaxSelected = table.getColumnSelectionAllowed() ? colModel.getMaxSelectionIndex() : table.getModel().getColumnCount() - 1; int colMinSelected = table.getColumnSelectionAllowed() ? colModel.getMinSelectionIndex() : 0; // If there are multiple rows and columns selected, select the next // cell and wrap at the edges of the selection. if (e.getActionCommand().indexOf("Column") != -1) advanceMultipleSelection(colModel, colMinSelected, colMaxSelected, rowModel, rowMinSelected, rowMaxSelected, (e.getActionCommand().equals ("selectPreviousColumnCell")), true); else advanceMultipleSelection(rowModel, rowMinSelected, rowMaxSelected, colModel, colMinSelected, colMaxSelected, (e.getActionCommand().equals ("selectPreviousRowCell")), false); } else if (e.getActionCommand().equals("selectNextColumn")) { rowModel.setSelectionInterval(rowLead,rowLead); colModel.setSelectionInterval(Math.min(colLead + 1, colMax), Math.min(colLead + 1, colMax)); } else if (e.getActionCommand().equals("scrollLeftExtendSelection")) { int target; if (colLead == getFirstVisibleColumnIndex()) target = Math.max (0, colLead - (getLastVisibleColumnIndex() - getFirstVisibleColumnIndex() + 1)); else target = getFirstVisibleColumnIndex(); colModel.setLeadSelectionIndex(target); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("scrollDownChangeSelection")) { int target; if (rowLead == getLastVisibleRowIndex()) target = Math.min (rowMax, rowLead + (getLastVisibleRowIndex() - getFirstVisibleRowIndex() + 1)); else target = getLastVisibleRowIndex(); rowModel.setSelectionInterval(target, target); colModel.setSelectionInterval(colLead, colLead); } else if (e.getActionCommand().equals("scrollRightExtendSelection")) { int target; if (colLead == getLastVisibleColumnIndex()) target = Math.min (colMax, colLead + (getLastVisibleColumnIndex() - getFirstVisibleColumnIndex() + 1)); else target = getLastVisibleColumnIndex(); colModel.setLeadSelectionIndex(target); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectAll")) { table.selectAll(); } else if (e.getActionCommand().equals("selectLastRowExtendSelection")) { rowModel.setLeadSelectionIndex(rowMax); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("scrollDownExtendSelection")) { int target; if (rowLead == getLastVisibleRowIndex()) target = Math.min (rowMax, rowLead + (getLastVisibleRowIndex() - getFirstVisibleRowIndex() + 1)); else target = getLastVisibleRowIndex(); rowModel.setLeadSelectionIndex(target); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("scrollUpChangeSelection")) { int target; if (rowLead == getFirstVisibleRowIndex()) target = Math.max (0, rowLead - (getLastVisibleRowIndex() - getFirstVisibleRowIndex() + 1)); else target = getFirstVisibleRowIndex(); rowModel.setSelectionInterval(target, target); colModel.setSelectionInterval(colLead, colLead); } else { // If we're here that means we bound this TableAction class // to a keyboard input but we either want to ignore that input // or we just haven't implemented its action yet. } if (table.isEditing() && e.getActionCommand() != "startEditing") table.editingCanceled(new ChangeEvent("update")); table.repaint(); table.scrollRectToVisible (table.getCellRect(rowModel.getLeadSelectionIndex(), colModel.getLeadSelectionIndex(), false)); }
1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/963ae61676e8c35a9e0998e0b7de1f942db82a26/BasicTableUI.java/buggy/core/src/classpath/javax/javax/swing/plaf/basic/BasicTableUI.java
else if (e.getActionCommand().equals("scrollRightChangeSelection"))
else if (command.equals("scrollRightChangeSelection"))
public void actionPerformed (ActionEvent e) { ListSelectionModel rowModel = table.getSelectionModel(); ListSelectionModel colModel = table.getColumnModel().getSelectionModel(); int rowLead = rowModel.getLeadSelectionIndex(); int rowMax = table.getModel().getRowCount() - 1; int colLead = colModel.getLeadSelectionIndex(); int colMax = table.getModel().getColumnCount() - 1; if (e.getActionCommand().equals("selectPreviousRowExtendSelection")) { rowModel.setLeadSelectionIndex(Math.max(rowLead - 1, 0)); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("selectLastColumn")) { table.clearSelection(); rowModel.setSelectionInterval(rowLead, rowLead); colModel.setSelectionInterval(colMax, colMax); } else if (e.getActionCommand().equals("startEditing")) { if (table.isCellEditable(rowLead, colLead)) table.editCellAt(rowLead,colLead); } else if (e.getActionCommand().equals("selectFirstRowExtendSelection")) { rowModel.setLeadSelectionIndex(0); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("selectFirstColumn")) { rowModel.setSelectionInterval(rowLead, rowLead); colModel.setSelectionInterval(0, 0); } else if (e.getActionCommand().equals("selectFirstColumnExtendSelection")) { colModel.setLeadSelectionIndex(0); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectLastRow")) { rowModel.setSelectionInterval(rowMax,rowMax); colModel.setSelectionInterval(colLead, colLead); } else if (e.getActionCommand().equals("selectNextRowExtendSelection")) { rowModel.setLeadSelectionIndex(Math.min(rowLead + 1, rowMax)); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("selectFirstRow")) { rowModel.setSelectionInterval(0,0); colModel.setSelectionInterval(colLead, colLead); } else if (e.getActionCommand().equals("selectNextColumnExtendSelection")) { colModel.setLeadSelectionIndex(Math.min(colLead + 1, colMax)); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectLastColumnExtendSelection")) { colModel.setLeadSelectionIndex(colMax); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectPreviousColumnExtendSelection")) { colModel.setLeadSelectionIndex(Math.max(colLead - 1, 0)); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectNextRow")) { rowModel.setSelectionInterval(Math.min(rowLead + 1, rowMax), Math.min(rowLead + 1, rowMax)); colModel.setSelectionInterval(colLead,colLead); } else if (e.getActionCommand().equals("scrollUpExtendSelection")) { int target; if (rowLead == getFirstVisibleRowIndex()) target = Math.max (0, rowLead - (getLastVisibleRowIndex() - getFirstVisibleRowIndex() + 1)); else target = getFirstVisibleRowIndex(); rowModel.setLeadSelectionIndex(target); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("selectPreviousRow")) { rowModel.setSelectionInterval(Math.max(rowLead - 1, 0), Math.max(rowLead - 1, 0)); colModel.setSelectionInterval(colLead,colLead); } else if (e.getActionCommand().equals("scrollRightChangeSelection")) { int target; if (colLead == getLastVisibleColumnIndex()) target = Math.min (colMax, colLead + (getLastVisibleColumnIndex() - getFirstVisibleColumnIndex() + 1)); else target = getLastVisibleColumnIndex(); colModel.setSelectionInterval(target, target); rowModel.setSelectionInterval(rowLead, rowLead); } else if (e.getActionCommand().equals("selectPreviousColumn")) { rowModel.setSelectionInterval(rowLead,rowLead); colModel.setSelectionInterval(Math.max(colLead - 1, 0), Math.max(colLead - 1, 0)); } else if (e.getActionCommand().equals("scrollLeftChangeSelection")) { int target; if (colLead == getFirstVisibleColumnIndex()) target = Math.max (0, colLead - (getLastVisibleColumnIndex() - getFirstVisibleColumnIndex() + 1)); else target = getFirstVisibleColumnIndex(); colModel.setSelectionInterval(target, target); rowModel.setSelectionInterval(rowLead, rowLead); } else if (e.getActionCommand().equals("clearSelection")) { table.clearSelection(); } else if (e.getActionCommand().equals("cancel")) { // FIXME: implement other parts of "cancel" like undo-ing last // selection. Right now it just calls editingCancelled if // we're currently editing. if (table.isEditing()) table.editingCanceled(new ChangeEvent("cancel")); } else if (e.getActionCommand().equals("selectNextRowCell") || e.getActionCommand().equals("selectPreviousRowCell") || e.getActionCommand().equals("selectNextColumnCell") || e.getActionCommand().equals("selectPreviousColumnCell")) { // If nothing is selected, select the first cell in the table if (table.getSelectedRowCount() == 0 && table.getSelectedColumnCount() == 0) { rowModel.setSelectionInterval(0, 0); colModel.setSelectionInterval(0, 0); return; } // If the lead selection index isn't selected (ie a remove operation // happened, then set the lead to the first selected cell in the // table if (!table.isCellSelected(rowLead, colLead)) { rowModel.addSelectionInterval(rowModel.getMinSelectionIndex(), rowModel.getMinSelectionIndex()); colModel.addSelectionInterval(colModel.getMinSelectionIndex(), colModel.getMinSelectionIndex()); return; } // multRowsSelected and multColsSelected tell us if multiple rows or // columns are selected, respectively boolean multRowsSelected, multColsSelected; multRowsSelected = table.getSelectedRowCount() > 1 && table.getRowSelectionAllowed(); multColsSelected = table.getSelectedColumnCount() > 1 && table.getColumnSelectionAllowed(); // If there is just one selection, select the next cell, and wrap // when you get to the edges of the table. if (!multColsSelected && !multRowsSelected) { if (e.getActionCommand().indexOf("Column") != -1) advanceSingleSelection(colModel, colMax, rowModel, rowMax, (e.getActionCommand().equals ("selectPreviousColumnCell"))); else advanceSingleSelection(rowModel, rowMax, colModel, colMax, (e.getActionCommand().equals ("selectPreviousRowCell"))); return; } // rowMinSelected and rowMaxSelected are the minimum and maximum // values respectively of selected cells in the row selection model // Similarly for colMinSelected and colMaxSelected. int rowMaxSelected = table.getRowSelectionAllowed() ? rowModel.getMaxSelectionIndex() : table.getModel().getRowCount() - 1; int rowMinSelected = table.getRowSelectionAllowed() ? rowModel.getMinSelectionIndex() : 0; int colMaxSelected = table.getColumnSelectionAllowed() ? colModel.getMaxSelectionIndex() : table.getModel().getColumnCount() - 1; int colMinSelected = table.getColumnSelectionAllowed() ? colModel.getMinSelectionIndex() : 0; // If there are multiple rows and columns selected, select the next // cell and wrap at the edges of the selection. if (e.getActionCommand().indexOf("Column") != -1) advanceMultipleSelection(colModel, colMinSelected, colMaxSelected, rowModel, rowMinSelected, rowMaxSelected, (e.getActionCommand().equals ("selectPreviousColumnCell")), true); else advanceMultipleSelection(rowModel, rowMinSelected, rowMaxSelected, colModel, colMinSelected, colMaxSelected, (e.getActionCommand().equals ("selectPreviousRowCell")), false); } else if (e.getActionCommand().equals("selectNextColumn")) { rowModel.setSelectionInterval(rowLead,rowLead); colModel.setSelectionInterval(Math.min(colLead + 1, colMax), Math.min(colLead + 1, colMax)); } else if (e.getActionCommand().equals("scrollLeftExtendSelection")) { int target; if (colLead == getFirstVisibleColumnIndex()) target = Math.max (0, colLead - (getLastVisibleColumnIndex() - getFirstVisibleColumnIndex() + 1)); else target = getFirstVisibleColumnIndex(); colModel.setLeadSelectionIndex(target); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("scrollDownChangeSelection")) { int target; if (rowLead == getLastVisibleRowIndex()) target = Math.min (rowMax, rowLead + (getLastVisibleRowIndex() - getFirstVisibleRowIndex() + 1)); else target = getLastVisibleRowIndex(); rowModel.setSelectionInterval(target, target); colModel.setSelectionInterval(colLead, colLead); } else if (e.getActionCommand().equals("scrollRightExtendSelection")) { int target; if (colLead == getLastVisibleColumnIndex()) target = Math.min (colMax, colLead + (getLastVisibleColumnIndex() - getFirstVisibleColumnIndex() + 1)); else target = getLastVisibleColumnIndex(); colModel.setLeadSelectionIndex(target); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectAll")) { table.selectAll(); } else if (e.getActionCommand().equals("selectLastRowExtendSelection")) { rowModel.setLeadSelectionIndex(rowMax); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("scrollDownExtendSelection")) { int target; if (rowLead == getLastVisibleRowIndex()) target = Math.min (rowMax, rowLead + (getLastVisibleRowIndex() - getFirstVisibleRowIndex() + 1)); else target = getLastVisibleRowIndex(); rowModel.setLeadSelectionIndex(target); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("scrollUpChangeSelection")) { int target; if (rowLead == getFirstVisibleRowIndex()) target = Math.max (0, rowLead - (getLastVisibleRowIndex() - getFirstVisibleRowIndex() + 1)); else target = getFirstVisibleRowIndex(); rowModel.setSelectionInterval(target, target); colModel.setSelectionInterval(colLead, colLead); } else { // If we're here that means we bound this TableAction class // to a keyboard input but we either want to ignore that input // or we just haven't implemented its action yet. } if (table.isEditing() && e.getActionCommand() != "startEditing") table.editingCanceled(new ChangeEvent("update")); table.repaint(); table.scrollRectToVisible (table.getCellRect(rowModel.getLeadSelectionIndex(), colModel.getLeadSelectionIndex(), false)); }
1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/963ae61676e8c35a9e0998e0b7de1f942db82a26/BasicTableUI.java/buggy/core/src/classpath/javax/javax/swing/plaf/basic/BasicTableUI.java
else if (e.getActionCommand().equals("selectPreviousColumn"))
else if (command.equals("selectPreviousColumn"))
public void actionPerformed (ActionEvent e) { ListSelectionModel rowModel = table.getSelectionModel(); ListSelectionModel colModel = table.getColumnModel().getSelectionModel(); int rowLead = rowModel.getLeadSelectionIndex(); int rowMax = table.getModel().getRowCount() - 1; int colLead = colModel.getLeadSelectionIndex(); int colMax = table.getModel().getColumnCount() - 1; if (e.getActionCommand().equals("selectPreviousRowExtendSelection")) { rowModel.setLeadSelectionIndex(Math.max(rowLead - 1, 0)); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("selectLastColumn")) { table.clearSelection(); rowModel.setSelectionInterval(rowLead, rowLead); colModel.setSelectionInterval(colMax, colMax); } else if (e.getActionCommand().equals("startEditing")) { if (table.isCellEditable(rowLead, colLead)) table.editCellAt(rowLead,colLead); } else if (e.getActionCommand().equals("selectFirstRowExtendSelection")) { rowModel.setLeadSelectionIndex(0); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("selectFirstColumn")) { rowModel.setSelectionInterval(rowLead, rowLead); colModel.setSelectionInterval(0, 0); } else if (e.getActionCommand().equals("selectFirstColumnExtendSelection")) { colModel.setLeadSelectionIndex(0); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectLastRow")) { rowModel.setSelectionInterval(rowMax,rowMax); colModel.setSelectionInterval(colLead, colLead); } else if (e.getActionCommand().equals("selectNextRowExtendSelection")) { rowModel.setLeadSelectionIndex(Math.min(rowLead + 1, rowMax)); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("selectFirstRow")) { rowModel.setSelectionInterval(0,0); colModel.setSelectionInterval(colLead, colLead); } else if (e.getActionCommand().equals("selectNextColumnExtendSelection")) { colModel.setLeadSelectionIndex(Math.min(colLead + 1, colMax)); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectLastColumnExtendSelection")) { colModel.setLeadSelectionIndex(colMax); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectPreviousColumnExtendSelection")) { colModel.setLeadSelectionIndex(Math.max(colLead - 1, 0)); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectNextRow")) { rowModel.setSelectionInterval(Math.min(rowLead + 1, rowMax), Math.min(rowLead + 1, rowMax)); colModel.setSelectionInterval(colLead,colLead); } else if (e.getActionCommand().equals("scrollUpExtendSelection")) { int target; if (rowLead == getFirstVisibleRowIndex()) target = Math.max (0, rowLead - (getLastVisibleRowIndex() - getFirstVisibleRowIndex() + 1)); else target = getFirstVisibleRowIndex(); rowModel.setLeadSelectionIndex(target); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("selectPreviousRow")) { rowModel.setSelectionInterval(Math.max(rowLead - 1, 0), Math.max(rowLead - 1, 0)); colModel.setSelectionInterval(colLead,colLead); } else if (e.getActionCommand().equals("scrollRightChangeSelection")) { int target; if (colLead == getLastVisibleColumnIndex()) target = Math.min (colMax, colLead + (getLastVisibleColumnIndex() - getFirstVisibleColumnIndex() + 1)); else target = getLastVisibleColumnIndex(); colModel.setSelectionInterval(target, target); rowModel.setSelectionInterval(rowLead, rowLead); } else if (e.getActionCommand().equals("selectPreviousColumn")) { rowModel.setSelectionInterval(rowLead,rowLead); colModel.setSelectionInterval(Math.max(colLead - 1, 0), Math.max(colLead - 1, 0)); } else if (e.getActionCommand().equals("scrollLeftChangeSelection")) { int target; if (colLead == getFirstVisibleColumnIndex()) target = Math.max (0, colLead - (getLastVisibleColumnIndex() - getFirstVisibleColumnIndex() + 1)); else target = getFirstVisibleColumnIndex(); colModel.setSelectionInterval(target, target); rowModel.setSelectionInterval(rowLead, rowLead); } else if (e.getActionCommand().equals("clearSelection")) { table.clearSelection(); } else if (e.getActionCommand().equals("cancel")) { // FIXME: implement other parts of "cancel" like undo-ing last // selection. Right now it just calls editingCancelled if // we're currently editing. if (table.isEditing()) table.editingCanceled(new ChangeEvent("cancel")); } else if (e.getActionCommand().equals("selectNextRowCell") || e.getActionCommand().equals("selectPreviousRowCell") || e.getActionCommand().equals("selectNextColumnCell") || e.getActionCommand().equals("selectPreviousColumnCell")) { // If nothing is selected, select the first cell in the table if (table.getSelectedRowCount() == 0 && table.getSelectedColumnCount() == 0) { rowModel.setSelectionInterval(0, 0); colModel.setSelectionInterval(0, 0); return; } // If the lead selection index isn't selected (ie a remove operation // happened, then set the lead to the first selected cell in the // table if (!table.isCellSelected(rowLead, colLead)) { rowModel.addSelectionInterval(rowModel.getMinSelectionIndex(), rowModel.getMinSelectionIndex()); colModel.addSelectionInterval(colModel.getMinSelectionIndex(), colModel.getMinSelectionIndex()); return; } // multRowsSelected and multColsSelected tell us if multiple rows or // columns are selected, respectively boolean multRowsSelected, multColsSelected; multRowsSelected = table.getSelectedRowCount() > 1 && table.getRowSelectionAllowed(); multColsSelected = table.getSelectedColumnCount() > 1 && table.getColumnSelectionAllowed(); // If there is just one selection, select the next cell, and wrap // when you get to the edges of the table. if (!multColsSelected && !multRowsSelected) { if (e.getActionCommand().indexOf("Column") != -1) advanceSingleSelection(colModel, colMax, rowModel, rowMax, (e.getActionCommand().equals ("selectPreviousColumnCell"))); else advanceSingleSelection(rowModel, rowMax, colModel, colMax, (e.getActionCommand().equals ("selectPreviousRowCell"))); return; } // rowMinSelected and rowMaxSelected are the minimum and maximum // values respectively of selected cells in the row selection model // Similarly for colMinSelected and colMaxSelected. int rowMaxSelected = table.getRowSelectionAllowed() ? rowModel.getMaxSelectionIndex() : table.getModel().getRowCount() - 1; int rowMinSelected = table.getRowSelectionAllowed() ? rowModel.getMinSelectionIndex() : 0; int colMaxSelected = table.getColumnSelectionAllowed() ? colModel.getMaxSelectionIndex() : table.getModel().getColumnCount() - 1; int colMinSelected = table.getColumnSelectionAllowed() ? colModel.getMinSelectionIndex() : 0; // If there are multiple rows and columns selected, select the next // cell and wrap at the edges of the selection. if (e.getActionCommand().indexOf("Column") != -1) advanceMultipleSelection(colModel, colMinSelected, colMaxSelected, rowModel, rowMinSelected, rowMaxSelected, (e.getActionCommand().equals ("selectPreviousColumnCell")), true); else advanceMultipleSelection(rowModel, rowMinSelected, rowMaxSelected, colModel, colMinSelected, colMaxSelected, (e.getActionCommand().equals ("selectPreviousRowCell")), false); } else if (e.getActionCommand().equals("selectNextColumn")) { rowModel.setSelectionInterval(rowLead,rowLead); colModel.setSelectionInterval(Math.min(colLead + 1, colMax), Math.min(colLead + 1, colMax)); } else if (e.getActionCommand().equals("scrollLeftExtendSelection")) { int target; if (colLead == getFirstVisibleColumnIndex()) target = Math.max (0, colLead - (getLastVisibleColumnIndex() - getFirstVisibleColumnIndex() + 1)); else target = getFirstVisibleColumnIndex(); colModel.setLeadSelectionIndex(target); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("scrollDownChangeSelection")) { int target; if (rowLead == getLastVisibleRowIndex()) target = Math.min (rowMax, rowLead + (getLastVisibleRowIndex() - getFirstVisibleRowIndex() + 1)); else target = getLastVisibleRowIndex(); rowModel.setSelectionInterval(target, target); colModel.setSelectionInterval(colLead, colLead); } else if (e.getActionCommand().equals("scrollRightExtendSelection")) { int target; if (colLead == getLastVisibleColumnIndex()) target = Math.min (colMax, colLead + (getLastVisibleColumnIndex() - getFirstVisibleColumnIndex() + 1)); else target = getLastVisibleColumnIndex(); colModel.setLeadSelectionIndex(target); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectAll")) { table.selectAll(); } else if (e.getActionCommand().equals("selectLastRowExtendSelection")) { rowModel.setLeadSelectionIndex(rowMax); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("scrollDownExtendSelection")) { int target; if (rowLead == getLastVisibleRowIndex()) target = Math.min (rowMax, rowLead + (getLastVisibleRowIndex() - getFirstVisibleRowIndex() + 1)); else target = getLastVisibleRowIndex(); rowModel.setLeadSelectionIndex(target); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("scrollUpChangeSelection")) { int target; if (rowLead == getFirstVisibleRowIndex()) target = Math.max (0, rowLead - (getLastVisibleRowIndex() - getFirstVisibleRowIndex() + 1)); else target = getFirstVisibleRowIndex(); rowModel.setSelectionInterval(target, target); colModel.setSelectionInterval(colLead, colLead); } else { // If we're here that means we bound this TableAction class // to a keyboard input but we either want to ignore that input // or we just haven't implemented its action yet. } if (table.isEditing() && e.getActionCommand() != "startEditing") table.editingCanceled(new ChangeEvent("update")); table.repaint(); table.scrollRectToVisible (table.getCellRect(rowModel.getLeadSelectionIndex(), colModel.getLeadSelectionIndex(), false)); }
1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/963ae61676e8c35a9e0998e0b7de1f942db82a26/BasicTableUI.java/buggy/core/src/classpath/javax/javax/swing/plaf/basic/BasicTableUI.java
else if (e.getActionCommand().equals("scrollLeftChangeSelection"))
else if (command.equals("scrollLeftChangeSelection"))
public void actionPerformed (ActionEvent e) { ListSelectionModel rowModel = table.getSelectionModel(); ListSelectionModel colModel = table.getColumnModel().getSelectionModel(); int rowLead = rowModel.getLeadSelectionIndex(); int rowMax = table.getModel().getRowCount() - 1; int colLead = colModel.getLeadSelectionIndex(); int colMax = table.getModel().getColumnCount() - 1; if (e.getActionCommand().equals("selectPreviousRowExtendSelection")) { rowModel.setLeadSelectionIndex(Math.max(rowLead - 1, 0)); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("selectLastColumn")) { table.clearSelection(); rowModel.setSelectionInterval(rowLead, rowLead); colModel.setSelectionInterval(colMax, colMax); } else if (e.getActionCommand().equals("startEditing")) { if (table.isCellEditable(rowLead, colLead)) table.editCellAt(rowLead,colLead); } else if (e.getActionCommand().equals("selectFirstRowExtendSelection")) { rowModel.setLeadSelectionIndex(0); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("selectFirstColumn")) { rowModel.setSelectionInterval(rowLead, rowLead); colModel.setSelectionInterval(0, 0); } else if (e.getActionCommand().equals("selectFirstColumnExtendSelection")) { colModel.setLeadSelectionIndex(0); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectLastRow")) { rowModel.setSelectionInterval(rowMax,rowMax); colModel.setSelectionInterval(colLead, colLead); } else if (e.getActionCommand().equals("selectNextRowExtendSelection")) { rowModel.setLeadSelectionIndex(Math.min(rowLead + 1, rowMax)); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("selectFirstRow")) { rowModel.setSelectionInterval(0,0); colModel.setSelectionInterval(colLead, colLead); } else if (e.getActionCommand().equals("selectNextColumnExtendSelection")) { colModel.setLeadSelectionIndex(Math.min(colLead + 1, colMax)); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectLastColumnExtendSelection")) { colModel.setLeadSelectionIndex(colMax); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectPreviousColumnExtendSelection")) { colModel.setLeadSelectionIndex(Math.max(colLead - 1, 0)); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectNextRow")) { rowModel.setSelectionInterval(Math.min(rowLead + 1, rowMax), Math.min(rowLead + 1, rowMax)); colModel.setSelectionInterval(colLead,colLead); } else if (e.getActionCommand().equals("scrollUpExtendSelection")) { int target; if (rowLead == getFirstVisibleRowIndex()) target = Math.max (0, rowLead - (getLastVisibleRowIndex() - getFirstVisibleRowIndex() + 1)); else target = getFirstVisibleRowIndex(); rowModel.setLeadSelectionIndex(target); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("selectPreviousRow")) { rowModel.setSelectionInterval(Math.max(rowLead - 1, 0), Math.max(rowLead - 1, 0)); colModel.setSelectionInterval(colLead,colLead); } else if (e.getActionCommand().equals("scrollRightChangeSelection")) { int target; if (colLead == getLastVisibleColumnIndex()) target = Math.min (colMax, colLead + (getLastVisibleColumnIndex() - getFirstVisibleColumnIndex() + 1)); else target = getLastVisibleColumnIndex(); colModel.setSelectionInterval(target, target); rowModel.setSelectionInterval(rowLead, rowLead); } else if (e.getActionCommand().equals("selectPreviousColumn")) { rowModel.setSelectionInterval(rowLead,rowLead); colModel.setSelectionInterval(Math.max(colLead - 1, 0), Math.max(colLead - 1, 0)); } else if (e.getActionCommand().equals("scrollLeftChangeSelection")) { int target; if (colLead == getFirstVisibleColumnIndex()) target = Math.max (0, colLead - (getLastVisibleColumnIndex() - getFirstVisibleColumnIndex() + 1)); else target = getFirstVisibleColumnIndex(); colModel.setSelectionInterval(target, target); rowModel.setSelectionInterval(rowLead, rowLead); } else if (e.getActionCommand().equals("clearSelection")) { table.clearSelection(); } else if (e.getActionCommand().equals("cancel")) { // FIXME: implement other parts of "cancel" like undo-ing last // selection. Right now it just calls editingCancelled if // we're currently editing. if (table.isEditing()) table.editingCanceled(new ChangeEvent("cancel")); } else if (e.getActionCommand().equals("selectNextRowCell") || e.getActionCommand().equals("selectPreviousRowCell") || e.getActionCommand().equals("selectNextColumnCell") || e.getActionCommand().equals("selectPreviousColumnCell")) { // If nothing is selected, select the first cell in the table if (table.getSelectedRowCount() == 0 && table.getSelectedColumnCount() == 0) { rowModel.setSelectionInterval(0, 0); colModel.setSelectionInterval(0, 0); return; } // If the lead selection index isn't selected (ie a remove operation // happened, then set the lead to the first selected cell in the // table if (!table.isCellSelected(rowLead, colLead)) { rowModel.addSelectionInterval(rowModel.getMinSelectionIndex(), rowModel.getMinSelectionIndex()); colModel.addSelectionInterval(colModel.getMinSelectionIndex(), colModel.getMinSelectionIndex()); return; } // multRowsSelected and multColsSelected tell us if multiple rows or // columns are selected, respectively boolean multRowsSelected, multColsSelected; multRowsSelected = table.getSelectedRowCount() > 1 && table.getRowSelectionAllowed(); multColsSelected = table.getSelectedColumnCount() > 1 && table.getColumnSelectionAllowed(); // If there is just one selection, select the next cell, and wrap // when you get to the edges of the table. if (!multColsSelected && !multRowsSelected) { if (e.getActionCommand().indexOf("Column") != -1) advanceSingleSelection(colModel, colMax, rowModel, rowMax, (e.getActionCommand().equals ("selectPreviousColumnCell"))); else advanceSingleSelection(rowModel, rowMax, colModel, colMax, (e.getActionCommand().equals ("selectPreviousRowCell"))); return; } // rowMinSelected and rowMaxSelected are the minimum and maximum // values respectively of selected cells in the row selection model // Similarly for colMinSelected and colMaxSelected. int rowMaxSelected = table.getRowSelectionAllowed() ? rowModel.getMaxSelectionIndex() : table.getModel().getRowCount() - 1; int rowMinSelected = table.getRowSelectionAllowed() ? rowModel.getMinSelectionIndex() : 0; int colMaxSelected = table.getColumnSelectionAllowed() ? colModel.getMaxSelectionIndex() : table.getModel().getColumnCount() - 1; int colMinSelected = table.getColumnSelectionAllowed() ? colModel.getMinSelectionIndex() : 0; // If there are multiple rows and columns selected, select the next // cell and wrap at the edges of the selection. if (e.getActionCommand().indexOf("Column") != -1) advanceMultipleSelection(colModel, colMinSelected, colMaxSelected, rowModel, rowMinSelected, rowMaxSelected, (e.getActionCommand().equals ("selectPreviousColumnCell")), true); else advanceMultipleSelection(rowModel, rowMinSelected, rowMaxSelected, colModel, colMinSelected, colMaxSelected, (e.getActionCommand().equals ("selectPreviousRowCell")), false); } else if (e.getActionCommand().equals("selectNextColumn")) { rowModel.setSelectionInterval(rowLead,rowLead); colModel.setSelectionInterval(Math.min(colLead + 1, colMax), Math.min(colLead + 1, colMax)); } else if (e.getActionCommand().equals("scrollLeftExtendSelection")) { int target; if (colLead == getFirstVisibleColumnIndex()) target = Math.max (0, colLead - (getLastVisibleColumnIndex() - getFirstVisibleColumnIndex() + 1)); else target = getFirstVisibleColumnIndex(); colModel.setLeadSelectionIndex(target); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("scrollDownChangeSelection")) { int target; if (rowLead == getLastVisibleRowIndex()) target = Math.min (rowMax, rowLead + (getLastVisibleRowIndex() - getFirstVisibleRowIndex() + 1)); else target = getLastVisibleRowIndex(); rowModel.setSelectionInterval(target, target); colModel.setSelectionInterval(colLead, colLead); } else if (e.getActionCommand().equals("scrollRightExtendSelection")) { int target; if (colLead == getLastVisibleColumnIndex()) target = Math.min (colMax, colLead + (getLastVisibleColumnIndex() - getFirstVisibleColumnIndex() + 1)); else target = getLastVisibleColumnIndex(); colModel.setLeadSelectionIndex(target); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectAll")) { table.selectAll(); } else if (e.getActionCommand().equals("selectLastRowExtendSelection")) { rowModel.setLeadSelectionIndex(rowMax); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("scrollDownExtendSelection")) { int target; if (rowLead == getLastVisibleRowIndex()) target = Math.min (rowMax, rowLead + (getLastVisibleRowIndex() - getFirstVisibleRowIndex() + 1)); else target = getLastVisibleRowIndex(); rowModel.setLeadSelectionIndex(target); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("scrollUpChangeSelection")) { int target; if (rowLead == getFirstVisibleRowIndex()) target = Math.max (0, rowLead - (getLastVisibleRowIndex() - getFirstVisibleRowIndex() + 1)); else target = getFirstVisibleRowIndex(); rowModel.setSelectionInterval(target, target); colModel.setSelectionInterval(colLead, colLead); } else { // If we're here that means we bound this TableAction class // to a keyboard input but we either want to ignore that input // or we just haven't implemented its action yet. } if (table.isEditing() && e.getActionCommand() != "startEditing") table.editingCanceled(new ChangeEvent("update")); table.repaint(); table.scrollRectToVisible (table.getCellRect(rowModel.getLeadSelectionIndex(), colModel.getLeadSelectionIndex(), false)); }
1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/963ae61676e8c35a9e0998e0b7de1f942db82a26/BasicTableUI.java/buggy/core/src/classpath/javax/javax/swing/plaf/basic/BasicTableUI.java
else if (e.getActionCommand().equals("clearSelection"))
else if (command.equals("clearSelection"))
public void actionPerformed (ActionEvent e) { ListSelectionModel rowModel = table.getSelectionModel(); ListSelectionModel colModel = table.getColumnModel().getSelectionModel(); int rowLead = rowModel.getLeadSelectionIndex(); int rowMax = table.getModel().getRowCount() - 1; int colLead = colModel.getLeadSelectionIndex(); int colMax = table.getModel().getColumnCount() - 1; if (e.getActionCommand().equals("selectPreviousRowExtendSelection")) { rowModel.setLeadSelectionIndex(Math.max(rowLead - 1, 0)); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("selectLastColumn")) { table.clearSelection(); rowModel.setSelectionInterval(rowLead, rowLead); colModel.setSelectionInterval(colMax, colMax); } else if (e.getActionCommand().equals("startEditing")) { if (table.isCellEditable(rowLead, colLead)) table.editCellAt(rowLead,colLead); } else if (e.getActionCommand().equals("selectFirstRowExtendSelection")) { rowModel.setLeadSelectionIndex(0); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("selectFirstColumn")) { rowModel.setSelectionInterval(rowLead, rowLead); colModel.setSelectionInterval(0, 0); } else if (e.getActionCommand().equals("selectFirstColumnExtendSelection")) { colModel.setLeadSelectionIndex(0); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectLastRow")) { rowModel.setSelectionInterval(rowMax,rowMax); colModel.setSelectionInterval(colLead, colLead); } else if (e.getActionCommand().equals("selectNextRowExtendSelection")) { rowModel.setLeadSelectionIndex(Math.min(rowLead + 1, rowMax)); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("selectFirstRow")) { rowModel.setSelectionInterval(0,0); colModel.setSelectionInterval(colLead, colLead); } else if (e.getActionCommand().equals("selectNextColumnExtendSelection")) { colModel.setLeadSelectionIndex(Math.min(colLead + 1, colMax)); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectLastColumnExtendSelection")) { colModel.setLeadSelectionIndex(colMax); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectPreviousColumnExtendSelection")) { colModel.setLeadSelectionIndex(Math.max(colLead - 1, 0)); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectNextRow")) { rowModel.setSelectionInterval(Math.min(rowLead + 1, rowMax), Math.min(rowLead + 1, rowMax)); colModel.setSelectionInterval(colLead,colLead); } else if (e.getActionCommand().equals("scrollUpExtendSelection")) { int target; if (rowLead == getFirstVisibleRowIndex()) target = Math.max (0, rowLead - (getLastVisibleRowIndex() - getFirstVisibleRowIndex() + 1)); else target = getFirstVisibleRowIndex(); rowModel.setLeadSelectionIndex(target); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("selectPreviousRow")) { rowModel.setSelectionInterval(Math.max(rowLead - 1, 0), Math.max(rowLead - 1, 0)); colModel.setSelectionInterval(colLead,colLead); } else if (e.getActionCommand().equals("scrollRightChangeSelection")) { int target; if (colLead == getLastVisibleColumnIndex()) target = Math.min (colMax, colLead + (getLastVisibleColumnIndex() - getFirstVisibleColumnIndex() + 1)); else target = getLastVisibleColumnIndex(); colModel.setSelectionInterval(target, target); rowModel.setSelectionInterval(rowLead, rowLead); } else if (e.getActionCommand().equals("selectPreviousColumn")) { rowModel.setSelectionInterval(rowLead,rowLead); colModel.setSelectionInterval(Math.max(colLead - 1, 0), Math.max(colLead - 1, 0)); } else if (e.getActionCommand().equals("scrollLeftChangeSelection")) { int target; if (colLead == getFirstVisibleColumnIndex()) target = Math.max (0, colLead - (getLastVisibleColumnIndex() - getFirstVisibleColumnIndex() + 1)); else target = getFirstVisibleColumnIndex(); colModel.setSelectionInterval(target, target); rowModel.setSelectionInterval(rowLead, rowLead); } else if (e.getActionCommand().equals("clearSelection")) { table.clearSelection(); } else if (e.getActionCommand().equals("cancel")) { // FIXME: implement other parts of "cancel" like undo-ing last // selection. Right now it just calls editingCancelled if // we're currently editing. if (table.isEditing()) table.editingCanceled(new ChangeEvent("cancel")); } else if (e.getActionCommand().equals("selectNextRowCell") || e.getActionCommand().equals("selectPreviousRowCell") || e.getActionCommand().equals("selectNextColumnCell") || e.getActionCommand().equals("selectPreviousColumnCell")) { // If nothing is selected, select the first cell in the table if (table.getSelectedRowCount() == 0 && table.getSelectedColumnCount() == 0) { rowModel.setSelectionInterval(0, 0); colModel.setSelectionInterval(0, 0); return; } // If the lead selection index isn't selected (ie a remove operation // happened, then set the lead to the first selected cell in the // table if (!table.isCellSelected(rowLead, colLead)) { rowModel.addSelectionInterval(rowModel.getMinSelectionIndex(), rowModel.getMinSelectionIndex()); colModel.addSelectionInterval(colModel.getMinSelectionIndex(), colModel.getMinSelectionIndex()); return; } // multRowsSelected and multColsSelected tell us if multiple rows or // columns are selected, respectively boolean multRowsSelected, multColsSelected; multRowsSelected = table.getSelectedRowCount() > 1 && table.getRowSelectionAllowed(); multColsSelected = table.getSelectedColumnCount() > 1 && table.getColumnSelectionAllowed(); // If there is just one selection, select the next cell, and wrap // when you get to the edges of the table. if (!multColsSelected && !multRowsSelected) { if (e.getActionCommand().indexOf("Column") != -1) advanceSingleSelection(colModel, colMax, rowModel, rowMax, (e.getActionCommand().equals ("selectPreviousColumnCell"))); else advanceSingleSelection(rowModel, rowMax, colModel, colMax, (e.getActionCommand().equals ("selectPreviousRowCell"))); return; } // rowMinSelected and rowMaxSelected are the minimum and maximum // values respectively of selected cells in the row selection model // Similarly for colMinSelected and colMaxSelected. int rowMaxSelected = table.getRowSelectionAllowed() ? rowModel.getMaxSelectionIndex() : table.getModel().getRowCount() - 1; int rowMinSelected = table.getRowSelectionAllowed() ? rowModel.getMinSelectionIndex() : 0; int colMaxSelected = table.getColumnSelectionAllowed() ? colModel.getMaxSelectionIndex() : table.getModel().getColumnCount() - 1; int colMinSelected = table.getColumnSelectionAllowed() ? colModel.getMinSelectionIndex() : 0; // If there are multiple rows and columns selected, select the next // cell and wrap at the edges of the selection. if (e.getActionCommand().indexOf("Column") != -1) advanceMultipleSelection(colModel, colMinSelected, colMaxSelected, rowModel, rowMinSelected, rowMaxSelected, (e.getActionCommand().equals ("selectPreviousColumnCell")), true); else advanceMultipleSelection(rowModel, rowMinSelected, rowMaxSelected, colModel, colMinSelected, colMaxSelected, (e.getActionCommand().equals ("selectPreviousRowCell")), false); } else if (e.getActionCommand().equals("selectNextColumn")) { rowModel.setSelectionInterval(rowLead,rowLead); colModel.setSelectionInterval(Math.min(colLead + 1, colMax), Math.min(colLead + 1, colMax)); } else if (e.getActionCommand().equals("scrollLeftExtendSelection")) { int target; if (colLead == getFirstVisibleColumnIndex()) target = Math.max (0, colLead - (getLastVisibleColumnIndex() - getFirstVisibleColumnIndex() + 1)); else target = getFirstVisibleColumnIndex(); colModel.setLeadSelectionIndex(target); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("scrollDownChangeSelection")) { int target; if (rowLead == getLastVisibleRowIndex()) target = Math.min (rowMax, rowLead + (getLastVisibleRowIndex() - getFirstVisibleRowIndex() + 1)); else target = getLastVisibleRowIndex(); rowModel.setSelectionInterval(target, target); colModel.setSelectionInterval(colLead, colLead); } else if (e.getActionCommand().equals("scrollRightExtendSelection")) { int target; if (colLead == getLastVisibleColumnIndex()) target = Math.min (colMax, colLead + (getLastVisibleColumnIndex() - getFirstVisibleColumnIndex() + 1)); else target = getLastVisibleColumnIndex(); colModel.setLeadSelectionIndex(target); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectAll")) { table.selectAll(); } else if (e.getActionCommand().equals("selectLastRowExtendSelection")) { rowModel.setLeadSelectionIndex(rowMax); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("scrollDownExtendSelection")) { int target; if (rowLead == getLastVisibleRowIndex()) target = Math.min (rowMax, rowLead + (getLastVisibleRowIndex() - getFirstVisibleRowIndex() + 1)); else target = getLastVisibleRowIndex(); rowModel.setLeadSelectionIndex(target); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("scrollUpChangeSelection")) { int target; if (rowLead == getFirstVisibleRowIndex()) target = Math.max (0, rowLead - (getLastVisibleRowIndex() - getFirstVisibleRowIndex() + 1)); else target = getFirstVisibleRowIndex(); rowModel.setSelectionInterval(target, target); colModel.setSelectionInterval(colLead, colLead); } else { // If we're here that means we bound this TableAction class // to a keyboard input but we either want to ignore that input // or we just haven't implemented its action yet. } if (table.isEditing() && e.getActionCommand() != "startEditing") table.editingCanceled(new ChangeEvent("update")); table.repaint(); table.scrollRectToVisible (table.getCellRect(rowModel.getLeadSelectionIndex(), colModel.getLeadSelectionIndex(), false)); }
1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/963ae61676e8c35a9e0998e0b7de1f942db82a26/BasicTableUI.java/buggy/core/src/classpath/javax/javax/swing/plaf/basic/BasicTableUI.java
else if (e.getActionCommand().equals("cancel"))
else if (command.equals("cancel"))
public void actionPerformed (ActionEvent e) { ListSelectionModel rowModel = table.getSelectionModel(); ListSelectionModel colModel = table.getColumnModel().getSelectionModel(); int rowLead = rowModel.getLeadSelectionIndex(); int rowMax = table.getModel().getRowCount() - 1; int colLead = colModel.getLeadSelectionIndex(); int colMax = table.getModel().getColumnCount() - 1; if (e.getActionCommand().equals("selectPreviousRowExtendSelection")) { rowModel.setLeadSelectionIndex(Math.max(rowLead - 1, 0)); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("selectLastColumn")) { table.clearSelection(); rowModel.setSelectionInterval(rowLead, rowLead); colModel.setSelectionInterval(colMax, colMax); } else if (e.getActionCommand().equals("startEditing")) { if (table.isCellEditable(rowLead, colLead)) table.editCellAt(rowLead,colLead); } else if (e.getActionCommand().equals("selectFirstRowExtendSelection")) { rowModel.setLeadSelectionIndex(0); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("selectFirstColumn")) { rowModel.setSelectionInterval(rowLead, rowLead); colModel.setSelectionInterval(0, 0); } else if (e.getActionCommand().equals("selectFirstColumnExtendSelection")) { colModel.setLeadSelectionIndex(0); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectLastRow")) { rowModel.setSelectionInterval(rowMax,rowMax); colModel.setSelectionInterval(colLead, colLead); } else if (e.getActionCommand().equals("selectNextRowExtendSelection")) { rowModel.setLeadSelectionIndex(Math.min(rowLead + 1, rowMax)); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("selectFirstRow")) { rowModel.setSelectionInterval(0,0); colModel.setSelectionInterval(colLead, colLead); } else if (e.getActionCommand().equals("selectNextColumnExtendSelection")) { colModel.setLeadSelectionIndex(Math.min(colLead + 1, colMax)); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectLastColumnExtendSelection")) { colModel.setLeadSelectionIndex(colMax); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectPreviousColumnExtendSelection")) { colModel.setLeadSelectionIndex(Math.max(colLead - 1, 0)); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectNextRow")) { rowModel.setSelectionInterval(Math.min(rowLead + 1, rowMax), Math.min(rowLead + 1, rowMax)); colModel.setSelectionInterval(colLead,colLead); } else if (e.getActionCommand().equals("scrollUpExtendSelection")) { int target; if (rowLead == getFirstVisibleRowIndex()) target = Math.max (0, rowLead - (getLastVisibleRowIndex() - getFirstVisibleRowIndex() + 1)); else target = getFirstVisibleRowIndex(); rowModel.setLeadSelectionIndex(target); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("selectPreviousRow")) { rowModel.setSelectionInterval(Math.max(rowLead - 1, 0), Math.max(rowLead - 1, 0)); colModel.setSelectionInterval(colLead,colLead); } else if (e.getActionCommand().equals("scrollRightChangeSelection")) { int target; if (colLead == getLastVisibleColumnIndex()) target = Math.min (colMax, colLead + (getLastVisibleColumnIndex() - getFirstVisibleColumnIndex() + 1)); else target = getLastVisibleColumnIndex(); colModel.setSelectionInterval(target, target); rowModel.setSelectionInterval(rowLead, rowLead); } else if (e.getActionCommand().equals("selectPreviousColumn")) { rowModel.setSelectionInterval(rowLead,rowLead); colModel.setSelectionInterval(Math.max(colLead - 1, 0), Math.max(colLead - 1, 0)); } else if (e.getActionCommand().equals("scrollLeftChangeSelection")) { int target; if (colLead == getFirstVisibleColumnIndex()) target = Math.max (0, colLead - (getLastVisibleColumnIndex() - getFirstVisibleColumnIndex() + 1)); else target = getFirstVisibleColumnIndex(); colModel.setSelectionInterval(target, target); rowModel.setSelectionInterval(rowLead, rowLead); } else if (e.getActionCommand().equals("clearSelection")) { table.clearSelection(); } else if (e.getActionCommand().equals("cancel")) { // FIXME: implement other parts of "cancel" like undo-ing last // selection. Right now it just calls editingCancelled if // we're currently editing. if (table.isEditing()) table.editingCanceled(new ChangeEvent("cancel")); } else if (e.getActionCommand().equals("selectNextRowCell") || e.getActionCommand().equals("selectPreviousRowCell") || e.getActionCommand().equals("selectNextColumnCell") || e.getActionCommand().equals("selectPreviousColumnCell")) { // If nothing is selected, select the first cell in the table if (table.getSelectedRowCount() == 0 && table.getSelectedColumnCount() == 0) { rowModel.setSelectionInterval(0, 0); colModel.setSelectionInterval(0, 0); return; } // If the lead selection index isn't selected (ie a remove operation // happened, then set the lead to the first selected cell in the // table if (!table.isCellSelected(rowLead, colLead)) { rowModel.addSelectionInterval(rowModel.getMinSelectionIndex(), rowModel.getMinSelectionIndex()); colModel.addSelectionInterval(colModel.getMinSelectionIndex(), colModel.getMinSelectionIndex()); return; } // multRowsSelected and multColsSelected tell us if multiple rows or // columns are selected, respectively boolean multRowsSelected, multColsSelected; multRowsSelected = table.getSelectedRowCount() > 1 && table.getRowSelectionAllowed(); multColsSelected = table.getSelectedColumnCount() > 1 && table.getColumnSelectionAllowed(); // If there is just one selection, select the next cell, and wrap // when you get to the edges of the table. if (!multColsSelected && !multRowsSelected) { if (e.getActionCommand().indexOf("Column") != -1) advanceSingleSelection(colModel, colMax, rowModel, rowMax, (e.getActionCommand().equals ("selectPreviousColumnCell"))); else advanceSingleSelection(rowModel, rowMax, colModel, colMax, (e.getActionCommand().equals ("selectPreviousRowCell"))); return; } // rowMinSelected and rowMaxSelected are the minimum and maximum // values respectively of selected cells in the row selection model // Similarly for colMinSelected and colMaxSelected. int rowMaxSelected = table.getRowSelectionAllowed() ? rowModel.getMaxSelectionIndex() : table.getModel().getRowCount() - 1; int rowMinSelected = table.getRowSelectionAllowed() ? rowModel.getMinSelectionIndex() : 0; int colMaxSelected = table.getColumnSelectionAllowed() ? colModel.getMaxSelectionIndex() : table.getModel().getColumnCount() - 1; int colMinSelected = table.getColumnSelectionAllowed() ? colModel.getMinSelectionIndex() : 0; // If there are multiple rows and columns selected, select the next // cell and wrap at the edges of the selection. if (e.getActionCommand().indexOf("Column") != -1) advanceMultipleSelection(colModel, colMinSelected, colMaxSelected, rowModel, rowMinSelected, rowMaxSelected, (e.getActionCommand().equals ("selectPreviousColumnCell")), true); else advanceMultipleSelection(rowModel, rowMinSelected, rowMaxSelected, colModel, colMinSelected, colMaxSelected, (e.getActionCommand().equals ("selectPreviousRowCell")), false); } else if (e.getActionCommand().equals("selectNextColumn")) { rowModel.setSelectionInterval(rowLead,rowLead); colModel.setSelectionInterval(Math.min(colLead + 1, colMax), Math.min(colLead + 1, colMax)); } else if (e.getActionCommand().equals("scrollLeftExtendSelection")) { int target; if (colLead == getFirstVisibleColumnIndex()) target = Math.max (0, colLead - (getLastVisibleColumnIndex() - getFirstVisibleColumnIndex() + 1)); else target = getFirstVisibleColumnIndex(); colModel.setLeadSelectionIndex(target); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("scrollDownChangeSelection")) { int target; if (rowLead == getLastVisibleRowIndex()) target = Math.min (rowMax, rowLead + (getLastVisibleRowIndex() - getFirstVisibleRowIndex() + 1)); else target = getLastVisibleRowIndex(); rowModel.setSelectionInterval(target, target); colModel.setSelectionInterval(colLead, colLead); } else if (e.getActionCommand().equals("scrollRightExtendSelection")) { int target; if (colLead == getLastVisibleColumnIndex()) target = Math.min (colMax, colLead + (getLastVisibleColumnIndex() - getFirstVisibleColumnIndex() + 1)); else target = getLastVisibleColumnIndex(); colModel.setLeadSelectionIndex(target); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectAll")) { table.selectAll(); } else if (e.getActionCommand().equals("selectLastRowExtendSelection")) { rowModel.setLeadSelectionIndex(rowMax); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("scrollDownExtendSelection")) { int target; if (rowLead == getLastVisibleRowIndex()) target = Math.min (rowMax, rowLead + (getLastVisibleRowIndex() - getFirstVisibleRowIndex() + 1)); else target = getLastVisibleRowIndex(); rowModel.setLeadSelectionIndex(target); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("scrollUpChangeSelection")) { int target; if (rowLead == getFirstVisibleRowIndex()) target = Math.max (0, rowLead - (getLastVisibleRowIndex() - getFirstVisibleRowIndex() + 1)); else target = getFirstVisibleRowIndex(); rowModel.setSelectionInterval(target, target); colModel.setSelectionInterval(colLead, colLead); } else { // If we're here that means we bound this TableAction class // to a keyboard input but we either want to ignore that input // or we just haven't implemented its action yet. } if (table.isEditing() && e.getActionCommand() != "startEditing") table.editingCanceled(new ChangeEvent("update")); table.repaint(); table.scrollRectToVisible (table.getCellRect(rowModel.getLeadSelectionIndex(), colModel.getLeadSelectionIndex(), false)); }
1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/963ae61676e8c35a9e0998e0b7de1f942db82a26/BasicTableUI.java/buggy/core/src/classpath/javax/javax/swing/plaf/basic/BasicTableUI.java
else if (e.getActionCommand().equals("selectNextRowCell") || e.getActionCommand().equals("selectPreviousRowCell") || e.getActionCommand().equals("selectNextColumnCell") || e.getActionCommand().equals("selectPreviousColumnCell"))
else if (command.equals("selectNextRowCell") || command.equals("selectPreviousRowCell") || command.equals("selectNextColumnCell") || command.equals("selectPreviousColumnCell"))
public void actionPerformed (ActionEvent e) { ListSelectionModel rowModel = table.getSelectionModel(); ListSelectionModel colModel = table.getColumnModel().getSelectionModel(); int rowLead = rowModel.getLeadSelectionIndex(); int rowMax = table.getModel().getRowCount() - 1; int colLead = colModel.getLeadSelectionIndex(); int colMax = table.getModel().getColumnCount() - 1; if (e.getActionCommand().equals("selectPreviousRowExtendSelection")) { rowModel.setLeadSelectionIndex(Math.max(rowLead - 1, 0)); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("selectLastColumn")) { table.clearSelection(); rowModel.setSelectionInterval(rowLead, rowLead); colModel.setSelectionInterval(colMax, colMax); } else if (e.getActionCommand().equals("startEditing")) { if (table.isCellEditable(rowLead, colLead)) table.editCellAt(rowLead,colLead); } else if (e.getActionCommand().equals("selectFirstRowExtendSelection")) { rowModel.setLeadSelectionIndex(0); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("selectFirstColumn")) { rowModel.setSelectionInterval(rowLead, rowLead); colModel.setSelectionInterval(0, 0); } else if (e.getActionCommand().equals("selectFirstColumnExtendSelection")) { colModel.setLeadSelectionIndex(0); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectLastRow")) { rowModel.setSelectionInterval(rowMax,rowMax); colModel.setSelectionInterval(colLead, colLead); } else if (e.getActionCommand().equals("selectNextRowExtendSelection")) { rowModel.setLeadSelectionIndex(Math.min(rowLead + 1, rowMax)); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("selectFirstRow")) { rowModel.setSelectionInterval(0,0); colModel.setSelectionInterval(colLead, colLead); } else if (e.getActionCommand().equals("selectNextColumnExtendSelection")) { colModel.setLeadSelectionIndex(Math.min(colLead + 1, colMax)); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectLastColumnExtendSelection")) { colModel.setLeadSelectionIndex(colMax); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectPreviousColumnExtendSelection")) { colModel.setLeadSelectionIndex(Math.max(colLead - 1, 0)); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectNextRow")) { rowModel.setSelectionInterval(Math.min(rowLead + 1, rowMax), Math.min(rowLead + 1, rowMax)); colModel.setSelectionInterval(colLead,colLead); } else if (e.getActionCommand().equals("scrollUpExtendSelection")) { int target; if (rowLead == getFirstVisibleRowIndex()) target = Math.max (0, rowLead - (getLastVisibleRowIndex() - getFirstVisibleRowIndex() + 1)); else target = getFirstVisibleRowIndex(); rowModel.setLeadSelectionIndex(target); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("selectPreviousRow")) { rowModel.setSelectionInterval(Math.max(rowLead - 1, 0), Math.max(rowLead - 1, 0)); colModel.setSelectionInterval(colLead,colLead); } else if (e.getActionCommand().equals("scrollRightChangeSelection")) { int target; if (colLead == getLastVisibleColumnIndex()) target = Math.min (colMax, colLead + (getLastVisibleColumnIndex() - getFirstVisibleColumnIndex() + 1)); else target = getLastVisibleColumnIndex(); colModel.setSelectionInterval(target, target); rowModel.setSelectionInterval(rowLead, rowLead); } else if (e.getActionCommand().equals("selectPreviousColumn")) { rowModel.setSelectionInterval(rowLead,rowLead); colModel.setSelectionInterval(Math.max(colLead - 1, 0), Math.max(colLead - 1, 0)); } else if (e.getActionCommand().equals("scrollLeftChangeSelection")) { int target; if (colLead == getFirstVisibleColumnIndex()) target = Math.max (0, colLead - (getLastVisibleColumnIndex() - getFirstVisibleColumnIndex() + 1)); else target = getFirstVisibleColumnIndex(); colModel.setSelectionInterval(target, target); rowModel.setSelectionInterval(rowLead, rowLead); } else if (e.getActionCommand().equals("clearSelection")) { table.clearSelection(); } else if (e.getActionCommand().equals("cancel")) { // FIXME: implement other parts of "cancel" like undo-ing last // selection. Right now it just calls editingCancelled if // we're currently editing. if (table.isEditing()) table.editingCanceled(new ChangeEvent("cancel")); } else if (e.getActionCommand().equals("selectNextRowCell") || e.getActionCommand().equals("selectPreviousRowCell") || e.getActionCommand().equals("selectNextColumnCell") || e.getActionCommand().equals("selectPreviousColumnCell")) { // If nothing is selected, select the first cell in the table if (table.getSelectedRowCount() == 0 && table.getSelectedColumnCount() == 0) { rowModel.setSelectionInterval(0, 0); colModel.setSelectionInterval(0, 0); return; } // If the lead selection index isn't selected (ie a remove operation // happened, then set the lead to the first selected cell in the // table if (!table.isCellSelected(rowLead, colLead)) { rowModel.addSelectionInterval(rowModel.getMinSelectionIndex(), rowModel.getMinSelectionIndex()); colModel.addSelectionInterval(colModel.getMinSelectionIndex(), colModel.getMinSelectionIndex()); return; } // multRowsSelected and multColsSelected tell us if multiple rows or // columns are selected, respectively boolean multRowsSelected, multColsSelected; multRowsSelected = table.getSelectedRowCount() > 1 && table.getRowSelectionAllowed(); multColsSelected = table.getSelectedColumnCount() > 1 && table.getColumnSelectionAllowed(); // If there is just one selection, select the next cell, and wrap // when you get to the edges of the table. if (!multColsSelected && !multRowsSelected) { if (e.getActionCommand().indexOf("Column") != -1) advanceSingleSelection(colModel, colMax, rowModel, rowMax, (e.getActionCommand().equals ("selectPreviousColumnCell"))); else advanceSingleSelection(rowModel, rowMax, colModel, colMax, (e.getActionCommand().equals ("selectPreviousRowCell"))); return; } // rowMinSelected and rowMaxSelected are the minimum and maximum // values respectively of selected cells in the row selection model // Similarly for colMinSelected and colMaxSelected. int rowMaxSelected = table.getRowSelectionAllowed() ? rowModel.getMaxSelectionIndex() : table.getModel().getRowCount() - 1; int rowMinSelected = table.getRowSelectionAllowed() ? rowModel.getMinSelectionIndex() : 0; int colMaxSelected = table.getColumnSelectionAllowed() ? colModel.getMaxSelectionIndex() : table.getModel().getColumnCount() - 1; int colMinSelected = table.getColumnSelectionAllowed() ? colModel.getMinSelectionIndex() : 0; // If there are multiple rows and columns selected, select the next // cell and wrap at the edges of the selection. if (e.getActionCommand().indexOf("Column") != -1) advanceMultipleSelection(colModel, colMinSelected, colMaxSelected, rowModel, rowMinSelected, rowMaxSelected, (e.getActionCommand().equals ("selectPreviousColumnCell")), true); else advanceMultipleSelection(rowModel, rowMinSelected, rowMaxSelected, colModel, colMinSelected, colMaxSelected, (e.getActionCommand().equals ("selectPreviousRowCell")), false); } else if (e.getActionCommand().equals("selectNextColumn")) { rowModel.setSelectionInterval(rowLead,rowLead); colModel.setSelectionInterval(Math.min(colLead + 1, colMax), Math.min(colLead + 1, colMax)); } else if (e.getActionCommand().equals("scrollLeftExtendSelection")) { int target; if (colLead == getFirstVisibleColumnIndex()) target = Math.max (0, colLead - (getLastVisibleColumnIndex() - getFirstVisibleColumnIndex() + 1)); else target = getFirstVisibleColumnIndex(); colModel.setLeadSelectionIndex(target); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("scrollDownChangeSelection")) { int target; if (rowLead == getLastVisibleRowIndex()) target = Math.min (rowMax, rowLead + (getLastVisibleRowIndex() - getFirstVisibleRowIndex() + 1)); else target = getLastVisibleRowIndex(); rowModel.setSelectionInterval(target, target); colModel.setSelectionInterval(colLead, colLead); } else if (e.getActionCommand().equals("scrollRightExtendSelection")) { int target; if (colLead == getLastVisibleColumnIndex()) target = Math.min (colMax, colLead + (getLastVisibleColumnIndex() - getFirstVisibleColumnIndex() + 1)); else target = getLastVisibleColumnIndex(); colModel.setLeadSelectionIndex(target); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectAll")) { table.selectAll(); } else if (e.getActionCommand().equals("selectLastRowExtendSelection")) { rowModel.setLeadSelectionIndex(rowMax); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("scrollDownExtendSelection")) { int target; if (rowLead == getLastVisibleRowIndex()) target = Math.min (rowMax, rowLead + (getLastVisibleRowIndex() - getFirstVisibleRowIndex() + 1)); else target = getLastVisibleRowIndex(); rowModel.setLeadSelectionIndex(target); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("scrollUpChangeSelection")) { int target; if (rowLead == getFirstVisibleRowIndex()) target = Math.max (0, rowLead - (getLastVisibleRowIndex() - getFirstVisibleRowIndex() + 1)); else target = getFirstVisibleRowIndex(); rowModel.setSelectionInterval(target, target); colModel.setSelectionInterval(colLead, colLead); } else { // If we're here that means we bound this TableAction class // to a keyboard input but we either want to ignore that input // or we just haven't implemented its action yet. } if (table.isEditing() && e.getActionCommand() != "startEditing") table.editingCanceled(new ChangeEvent("update")); table.repaint(); table.scrollRectToVisible (table.getCellRect(rowModel.getLeadSelectionIndex(), colModel.getLeadSelectionIndex(), false)); }
1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/963ae61676e8c35a9e0998e0b7de1f942db82a26/BasicTableUI.java/buggy/core/src/classpath/javax/javax/swing/plaf/basic/BasicTableUI.java
if (e.getActionCommand().indexOf("Column") != -1)
if (command.indexOf("Column") != -1)
public void actionPerformed (ActionEvent e) { ListSelectionModel rowModel = table.getSelectionModel(); ListSelectionModel colModel = table.getColumnModel().getSelectionModel(); int rowLead = rowModel.getLeadSelectionIndex(); int rowMax = table.getModel().getRowCount() - 1; int colLead = colModel.getLeadSelectionIndex(); int colMax = table.getModel().getColumnCount() - 1; if (e.getActionCommand().equals("selectPreviousRowExtendSelection")) { rowModel.setLeadSelectionIndex(Math.max(rowLead - 1, 0)); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("selectLastColumn")) { table.clearSelection(); rowModel.setSelectionInterval(rowLead, rowLead); colModel.setSelectionInterval(colMax, colMax); } else if (e.getActionCommand().equals("startEditing")) { if (table.isCellEditable(rowLead, colLead)) table.editCellAt(rowLead,colLead); } else if (e.getActionCommand().equals("selectFirstRowExtendSelection")) { rowModel.setLeadSelectionIndex(0); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("selectFirstColumn")) { rowModel.setSelectionInterval(rowLead, rowLead); colModel.setSelectionInterval(0, 0); } else if (e.getActionCommand().equals("selectFirstColumnExtendSelection")) { colModel.setLeadSelectionIndex(0); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectLastRow")) { rowModel.setSelectionInterval(rowMax,rowMax); colModel.setSelectionInterval(colLead, colLead); } else if (e.getActionCommand().equals("selectNextRowExtendSelection")) { rowModel.setLeadSelectionIndex(Math.min(rowLead + 1, rowMax)); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("selectFirstRow")) { rowModel.setSelectionInterval(0,0); colModel.setSelectionInterval(colLead, colLead); } else if (e.getActionCommand().equals("selectNextColumnExtendSelection")) { colModel.setLeadSelectionIndex(Math.min(colLead + 1, colMax)); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectLastColumnExtendSelection")) { colModel.setLeadSelectionIndex(colMax); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectPreviousColumnExtendSelection")) { colModel.setLeadSelectionIndex(Math.max(colLead - 1, 0)); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectNextRow")) { rowModel.setSelectionInterval(Math.min(rowLead + 1, rowMax), Math.min(rowLead + 1, rowMax)); colModel.setSelectionInterval(colLead,colLead); } else if (e.getActionCommand().equals("scrollUpExtendSelection")) { int target; if (rowLead == getFirstVisibleRowIndex()) target = Math.max (0, rowLead - (getLastVisibleRowIndex() - getFirstVisibleRowIndex() + 1)); else target = getFirstVisibleRowIndex(); rowModel.setLeadSelectionIndex(target); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("selectPreviousRow")) { rowModel.setSelectionInterval(Math.max(rowLead - 1, 0), Math.max(rowLead - 1, 0)); colModel.setSelectionInterval(colLead,colLead); } else if (e.getActionCommand().equals("scrollRightChangeSelection")) { int target; if (colLead == getLastVisibleColumnIndex()) target = Math.min (colMax, colLead + (getLastVisibleColumnIndex() - getFirstVisibleColumnIndex() + 1)); else target = getLastVisibleColumnIndex(); colModel.setSelectionInterval(target, target); rowModel.setSelectionInterval(rowLead, rowLead); } else if (e.getActionCommand().equals("selectPreviousColumn")) { rowModel.setSelectionInterval(rowLead,rowLead); colModel.setSelectionInterval(Math.max(colLead - 1, 0), Math.max(colLead - 1, 0)); } else if (e.getActionCommand().equals("scrollLeftChangeSelection")) { int target; if (colLead == getFirstVisibleColumnIndex()) target = Math.max (0, colLead - (getLastVisibleColumnIndex() - getFirstVisibleColumnIndex() + 1)); else target = getFirstVisibleColumnIndex(); colModel.setSelectionInterval(target, target); rowModel.setSelectionInterval(rowLead, rowLead); } else if (e.getActionCommand().equals("clearSelection")) { table.clearSelection(); } else if (e.getActionCommand().equals("cancel")) { // FIXME: implement other parts of "cancel" like undo-ing last // selection. Right now it just calls editingCancelled if // we're currently editing. if (table.isEditing()) table.editingCanceled(new ChangeEvent("cancel")); } else if (e.getActionCommand().equals("selectNextRowCell") || e.getActionCommand().equals("selectPreviousRowCell") || e.getActionCommand().equals("selectNextColumnCell") || e.getActionCommand().equals("selectPreviousColumnCell")) { // If nothing is selected, select the first cell in the table if (table.getSelectedRowCount() == 0 && table.getSelectedColumnCount() == 0) { rowModel.setSelectionInterval(0, 0); colModel.setSelectionInterval(0, 0); return; } // If the lead selection index isn't selected (ie a remove operation // happened, then set the lead to the first selected cell in the // table if (!table.isCellSelected(rowLead, colLead)) { rowModel.addSelectionInterval(rowModel.getMinSelectionIndex(), rowModel.getMinSelectionIndex()); colModel.addSelectionInterval(colModel.getMinSelectionIndex(), colModel.getMinSelectionIndex()); return; } // multRowsSelected and multColsSelected tell us if multiple rows or // columns are selected, respectively boolean multRowsSelected, multColsSelected; multRowsSelected = table.getSelectedRowCount() > 1 && table.getRowSelectionAllowed(); multColsSelected = table.getSelectedColumnCount() > 1 && table.getColumnSelectionAllowed(); // If there is just one selection, select the next cell, and wrap // when you get to the edges of the table. if (!multColsSelected && !multRowsSelected) { if (e.getActionCommand().indexOf("Column") != -1) advanceSingleSelection(colModel, colMax, rowModel, rowMax, (e.getActionCommand().equals ("selectPreviousColumnCell"))); else advanceSingleSelection(rowModel, rowMax, colModel, colMax, (e.getActionCommand().equals ("selectPreviousRowCell"))); return; } // rowMinSelected and rowMaxSelected are the minimum and maximum // values respectively of selected cells in the row selection model // Similarly for colMinSelected and colMaxSelected. int rowMaxSelected = table.getRowSelectionAllowed() ? rowModel.getMaxSelectionIndex() : table.getModel().getRowCount() - 1; int rowMinSelected = table.getRowSelectionAllowed() ? rowModel.getMinSelectionIndex() : 0; int colMaxSelected = table.getColumnSelectionAllowed() ? colModel.getMaxSelectionIndex() : table.getModel().getColumnCount() - 1; int colMinSelected = table.getColumnSelectionAllowed() ? colModel.getMinSelectionIndex() : 0; // If there are multiple rows and columns selected, select the next // cell and wrap at the edges of the selection. if (e.getActionCommand().indexOf("Column") != -1) advanceMultipleSelection(colModel, colMinSelected, colMaxSelected, rowModel, rowMinSelected, rowMaxSelected, (e.getActionCommand().equals ("selectPreviousColumnCell")), true); else advanceMultipleSelection(rowModel, rowMinSelected, rowMaxSelected, colModel, colMinSelected, colMaxSelected, (e.getActionCommand().equals ("selectPreviousRowCell")), false); } else if (e.getActionCommand().equals("selectNextColumn")) { rowModel.setSelectionInterval(rowLead,rowLead); colModel.setSelectionInterval(Math.min(colLead + 1, colMax), Math.min(colLead + 1, colMax)); } else if (e.getActionCommand().equals("scrollLeftExtendSelection")) { int target; if (colLead == getFirstVisibleColumnIndex()) target = Math.max (0, colLead - (getLastVisibleColumnIndex() - getFirstVisibleColumnIndex() + 1)); else target = getFirstVisibleColumnIndex(); colModel.setLeadSelectionIndex(target); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("scrollDownChangeSelection")) { int target; if (rowLead == getLastVisibleRowIndex()) target = Math.min (rowMax, rowLead + (getLastVisibleRowIndex() - getFirstVisibleRowIndex() + 1)); else target = getLastVisibleRowIndex(); rowModel.setSelectionInterval(target, target); colModel.setSelectionInterval(colLead, colLead); } else if (e.getActionCommand().equals("scrollRightExtendSelection")) { int target; if (colLead == getLastVisibleColumnIndex()) target = Math.min (colMax, colLead + (getLastVisibleColumnIndex() - getFirstVisibleColumnIndex() + 1)); else target = getLastVisibleColumnIndex(); colModel.setLeadSelectionIndex(target); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectAll")) { table.selectAll(); } else if (e.getActionCommand().equals("selectLastRowExtendSelection")) { rowModel.setLeadSelectionIndex(rowMax); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("scrollDownExtendSelection")) { int target; if (rowLead == getLastVisibleRowIndex()) target = Math.min (rowMax, rowLead + (getLastVisibleRowIndex() - getFirstVisibleRowIndex() + 1)); else target = getLastVisibleRowIndex(); rowModel.setLeadSelectionIndex(target); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("scrollUpChangeSelection")) { int target; if (rowLead == getFirstVisibleRowIndex()) target = Math.max (0, rowLead - (getLastVisibleRowIndex() - getFirstVisibleRowIndex() + 1)); else target = getFirstVisibleRowIndex(); rowModel.setSelectionInterval(target, target); colModel.setSelectionInterval(colLead, colLead); } else { // If we're here that means we bound this TableAction class // to a keyboard input but we either want to ignore that input // or we just haven't implemented its action yet. } if (table.isEditing() && e.getActionCommand() != "startEditing") table.editingCanceled(new ChangeEvent("update")); table.repaint(); table.scrollRectToVisible (table.getCellRect(rowModel.getLeadSelectionIndex(), colModel.getLeadSelectionIndex(), false)); }
1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/963ae61676e8c35a9e0998e0b7de1f942db82a26/BasicTableUI.java/buggy/core/src/classpath/javax/javax/swing/plaf/basic/BasicTableUI.java
(e.getActionCommand().equals
(command.equals
public void actionPerformed (ActionEvent e) { ListSelectionModel rowModel = table.getSelectionModel(); ListSelectionModel colModel = table.getColumnModel().getSelectionModel(); int rowLead = rowModel.getLeadSelectionIndex(); int rowMax = table.getModel().getRowCount() - 1; int colLead = colModel.getLeadSelectionIndex(); int colMax = table.getModel().getColumnCount() - 1; if (e.getActionCommand().equals("selectPreviousRowExtendSelection")) { rowModel.setLeadSelectionIndex(Math.max(rowLead - 1, 0)); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("selectLastColumn")) { table.clearSelection(); rowModel.setSelectionInterval(rowLead, rowLead); colModel.setSelectionInterval(colMax, colMax); } else if (e.getActionCommand().equals("startEditing")) { if (table.isCellEditable(rowLead, colLead)) table.editCellAt(rowLead,colLead); } else if (e.getActionCommand().equals("selectFirstRowExtendSelection")) { rowModel.setLeadSelectionIndex(0); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("selectFirstColumn")) { rowModel.setSelectionInterval(rowLead, rowLead); colModel.setSelectionInterval(0, 0); } else if (e.getActionCommand().equals("selectFirstColumnExtendSelection")) { colModel.setLeadSelectionIndex(0); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectLastRow")) { rowModel.setSelectionInterval(rowMax,rowMax); colModel.setSelectionInterval(colLead, colLead); } else if (e.getActionCommand().equals("selectNextRowExtendSelection")) { rowModel.setLeadSelectionIndex(Math.min(rowLead + 1, rowMax)); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("selectFirstRow")) { rowModel.setSelectionInterval(0,0); colModel.setSelectionInterval(colLead, colLead); } else if (e.getActionCommand().equals("selectNextColumnExtendSelection")) { colModel.setLeadSelectionIndex(Math.min(colLead + 1, colMax)); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectLastColumnExtendSelection")) { colModel.setLeadSelectionIndex(colMax); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectPreviousColumnExtendSelection")) { colModel.setLeadSelectionIndex(Math.max(colLead - 1, 0)); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectNextRow")) { rowModel.setSelectionInterval(Math.min(rowLead + 1, rowMax), Math.min(rowLead + 1, rowMax)); colModel.setSelectionInterval(colLead,colLead); } else if (e.getActionCommand().equals("scrollUpExtendSelection")) { int target; if (rowLead == getFirstVisibleRowIndex()) target = Math.max (0, rowLead - (getLastVisibleRowIndex() - getFirstVisibleRowIndex() + 1)); else target = getFirstVisibleRowIndex(); rowModel.setLeadSelectionIndex(target); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("selectPreviousRow")) { rowModel.setSelectionInterval(Math.max(rowLead - 1, 0), Math.max(rowLead - 1, 0)); colModel.setSelectionInterval(colLead,colLead); } else if (e.getActionCommand().equals("scrollRightChangeSelection")) { int target; if (colLead == getLastVisibleColumnIndex()) target = Math.min (colMax, colLead + (getLastVisibleColumnIndex() - getFirstVisibleColumnIndex() + 1)); else target = getLastVisibleColumnIndex(); colModel.setSelectionInterval(target, target); rowModel.setSelectionInterval(rowLead, rowLead); } else if (e.getActionCommand().equals("selectPreviousColumn")) { rowModel.setSelectionInterval(rowLead,rowLead); colModel.setSelectionInterval(Math.max(colLead - 1, 0), Math.max(colLead - 1, 0)); } else if (e.getActionCommand().equals("scrollLeftChangeSelection")) { int target; if (colLead == getFirstVisibleColumnIndex()) target = Math.max (0, colLead - (getLastVisibleColumnIndex() - getFirstVisibleColumnIndex() + 1)); else target = getFirstVisibleColumnIndex(); colModel.setSelectionInterval(target, target); rowModel.setSelectionInterval(rowLead, rowLead); } else if (e.getActionCommand().equals("clearSelection")) { table.clearSelection(); } else if (e.getActionCommand().equals("cancel")) { // FIXME: implement other parts of "cancel" like undo-ing last // selection. Right now it just calls editingCancelled if // we're currently editing. if (table.isEditing()) table.editingCanceled(new ChangeEvent("cancel")); } else if (e.getActionCommand().equals("selectNextRowCell") || e.getActionCommand().equals("selectPreviousRowCell") || e.getActionCommand().equals("selectNextColumnCell") || e.getActionCommand().equals("selectPreviousColumnCell")) { // If nothing is selected, select the first cell in the table if (table.getSelectedRowCount() == 0 && table.getSelectedColumnCount() == 0) { rowModel.setSelectionInterval(0, 0); colModel.setSelectionInterval(0, 0); return; } // If the lead selection index isn't selected (ie a remove operation // happened, then set the lead to the first selected cell in the // table if (!table.isCellSelected(rowLead, colLead)) { rowModel.addSelectionInterval(rowModel.getMinSelectionIndex(), rowModel.getMinSelectionIndex()); colModel.addSelectionInterval(colModel.getMinSelectionIndex(), colModel.getMinSelectionIndex()); return; } // multRowsSelected and multColsSelected tell us if multiple rows or // columns are selected, respectively boolean multRowsSelected, multColsSelected; multRowsSelected = table.getSelectedRowCount() > 1 && table.getRowSelectionAllowed(); multColsSelected = table.getSelectedColumnCount() > 1 && table.getColumnSelectionAllowed(); // If there is just one selection, select the next cell, and wrap // when you get to the edges of the table. if (!multColsSelected && !multRowsSelected) { if (e.getActionCommand().indexOf("Column") != -1) advanceSingleSelection(colModel, colMax, rowModel, rowMax, (e.getActionCommand().equals ("selectPreviousColumnCell"))); else advanceSingleSelection(rowModel, rowMax, colModel, colMax, (e.getActionCommand().equals ("selectPreviousRowCell"))); return; } // rowMinSelected and rowMaxSelected are the minimum and maximum // values respectively of selected cells in the row selection model // Similarly for colMinSelected and colMaxSelected. int rowMaxSelected = table.getRowSelectionAllowed() ? rowModel.getMaxSelectionIndex() : table.getModel().getRowCount() - 1; int rowMinSelected = table.getRowSelectionAllowed() ? rowModel.getMinSelectionIndex() : 0; int colMaxSelected = table.getColumnSelectionAllowed() ? colModel.getMaxSelectionIndex() : table.getModel().getColumnCount() - 1; int colMinSelected = table.getColumnSelectionAllowed() ? colModel.getMinSelectionIndex() : 0; // If there are multiple rows and columns selected, select the next // cell and wrap at the edges of the selection. if (e.getActionCommand().indexOf("Column") != -1) advanceMultipleSelection(colModel, colMinSelected, colMaxSelected, rowModel, rowMinSelected, rowMaxSelected, (e.getActionCommand().equals ("selectPreviousColumnCell")), true); else advanceMultipleSelection(rowModel, rowMinSelected, rowMaxSelected, colModel, colMinSelected, colMaxSelected, (e.getActionCommand().equals ("selectPreviousRowCell")), false); } else if (e.getActionCommand().equals("selectNextColumn")) { rowModel.setSelectionInterval(rowLead,rowLead); colModel.setSelectionInterval(Math.min(colLead + 1, colMax), Math.min(colLead + 1, colMax)); } else if (e.getActionCommand().equals("scrollLeftExtendSelection")) { int target; if (colLead == getFirstVisibleColumnIndex()) target = Math.max (0, colLead - (getLastVisibleColumnIndex() - getFirstVisibleColumnIndex() + 1)); else target = getFirstVisibleColumnIndex(); colModel.setLeadSelectionIndex(target); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("scrollDownChangeSelection")) { int target; if (rowLead == getLastVisibleRowIndex()) target = Math.min (rowMax, rowLead + (getLastVisibleRowIndex() - getFirstVisibleRowIndex() + 1)); else target = getLastVisibleRowIndex(); rowModel.setSelectionInterval(target, target); colModel.setSelectionInterval(colLead, colLead); } else if (e.getActionCommand().equals("scrollRightExtendSelection")) { int target; if (colLead == getLastVisibleColumnIndex()) target = Math.min (colMax, colLead + (getLastVisibleColumnIndex() - getFirstVisibleColumnIndex() + 1)); else target = getLastVisibleColumnIndex(); colModel.setLeadSelectionIndex(target); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectAll")) { table.selectAll(); } else if (e.getActionCommand().equals("selectLastRowExtendSelection")) { rowModel.setLeadSelectionIndex(rowMax); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("scrollDownExtendSelection")) { int target; if (rowLead == getLastVisibleRowIndex()) target = Math.min (rowMax, rowLead + (getLastVisibleRowIndex() - getFirstVisibleRowIndex() + 1)); else target = getLastVisibleRowIndex(); rowModel.setLeadSelectionIndex(target); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("scrollUpChangeSelection")) { int target; if (rowLead == getFirstVisibleRowIndex()) target = Math.max (0, rowLead - (getLastVisibleRowIndex() - getFirstVisibleRowIndex() + 1)); else target = getFirstVisibleRowIndex(); rowModel.setSelectionInterval(target, target); colModel.setSelectionInterval(colLead, colLead); } else { // If we're here that means we bound this TableAction class // to a keyboard input but we either want to ignore that input // or we just haven't implemented its action yet. } if (table.isEditing() && e.getActionCommand() != "startEditing") table.editingCanceled(new ChangeEvent("update")); table.repaint(); table.scrollRectToVisible (table.getCellRect(rowModel.getLeadSelectionIndex(), colModel.getLeadSelectionIndex(), false)); }
1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/963ae61676e8c35a9e0998e0b7de1f942db82a26/BasicTableUI.java/buggy/core/src/classpath/javax/javax/swing/plaf/basic/BasicTableUI.java
(e.getActionCommand().equals
(command.equals
public void actionPerformed (ActionEvent e) { ListSelectionModel rowModel = table.getSelectionModel(); ListSelectionModel colModel = table.getColumnModel().getSelectionModel(); int rowLead = rowModel.getLeadSelectionIndex(); int rowMax = table.getModel().getRowCount() - 1; int colLead = colModel.getLeadSelectionIndex(); int colMax = table.getModel().getColumnCount() - 1; if (e.getActionCommand().equals("selectPreviousRowExtendSelection")) { rowModel.setLeadSelectionIndex(Math.max(rowLead - 1, 0)); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("selectLastColumn")) { table.clearSelection(); rowModel.setSelectionInterval(rowLead, rowLead); colModel.setSelectionInterval(colMax, colMax); } else if (e.getActionCommand().equals("startEditing")) { if (table.isCellEditable(rowLead, colLead)) table.editCellAt(rowLead,colLead); } else if (e.getActionCommand().equals("selectFirstRowExtendSelection")) { rowModel.setLeadSelectionIndex(0); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("selectFirstColumn")) { rowModel.setSelectionInterval(rowLead, rowLead); colModel.setSelectionInterval(0, 0); } else if (e.getActionCommand().equals("selectFirstColumnExtendSelection")) { colModel.setLeadSelectionIndex(0); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectLastRow")) { rowModel.setSelectionInterval(rowMax,rowMax); colModel.setSelectionInterval(colLead, colLead); } else if (e.getActionCommand().equals("selectNextRowExtendSelection")) { rowModel.setLeadSelectionIndex(Math.min(rowLead + 1, rowMax)); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("selectFirstRow")) { rowModel.setSelectionInterval(0,0); colModel.setSelectionInterval(colLead, colLead); } else if (e.getActionCommand().equals("selectNextColumnExtendSelection")) { colModel.setLeadSelectionIndex(Math.min(colLead + 1, colMax)); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectLastColumnExtendSelection")) { colModel.setLeadSelectionIndex(colMax); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectPreviousColumnExtendSelection")) { colModel.setLeadSelectionIndex(Math.max(colLead - 1, 0)); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectNextRow")) { rowModel.setSelectionInterval(Math.min(rowLead + 1, rowMax), Math.min(rowLead + 1, rowMax)); colModel.setSelectionInterval(colLead,colLead); } else if (e.getActionCommand().equals("scrollUpExtendSelection")) { int target; if (rowLead == getFirstVisibleRowIndex()) target = Math.max (0, rowLead - (getLastVisibleRowIndex() - getFirstVisibleRowIndex() + 1)); else target = getFirstVisibleRowIndex(); rowModel.setLeadSelectionIndex(target); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("selectPreviousRow")) { rowModel.setSelectionInterval(Math.max(rowLead - 1, 0), Math.max(rowLead - 1, 0)); colModel.setSelectionInterval(colLead,colLead); } else if (e.getActionCommand().equals("scrollRightChangeSelection")) { int target; if (colLead == getLastVisibleColumnIndex()) target = Math.min (colMax, colLead + (getLastVisibleColumnIndex() - getFirstVisibleColumnIndex() + 1)); else target = getLastVisibleColumnIndex(); colModel.setSelectionInterval(target, target); rowModel.setSelectionInterval(rowLead, rowLead); } else if (e.getActionCommand().equals("selectPreviousColumn")) { rowModel.setSelectionInterval(rowLead,rowLead); colModel.setSelectionInterval(Math.max(colLead - 1, 0), Math.max(colLead - 1, 0)); } else if (e.getActionCommand().equals("scrollLeftChangeSelection")) { int target; if (colLead == getFirstVisibleColumnIndex()) target = Math.max (0, colLead - (getLastVisibleColumnIndex() - getFirstVisibleColumnIndex() + 1)); else target = getFirstVisibleColumnIndex(); colModel.setSelectionInterval(target, target); rowModel.setSelectionInterval(rowLead, rowLead); } else if (e.getActionCommand().equals("clearSelection")) { table.clearSelection(); } else if (e.getActionCommand().equals("cancel")) { // FIXME: implement other parts of "cancel" like undo-ing last // selection. Right now it just calls editingCancelled if // we're currently editing. if (table.isEditing()) table.editingCanceled(new ChangeEvent("cancel")); } else if (e.getActionCommand().equals("selectNextRowCell") || e.getActionCommand().equals("selectPreviousRowCell") || e.getActionCommand().equals("selectNextColumnCell") || e.getActionCommand().equals("selectPreviousColumnCell")) { // If nothing is selected, select the first cell in the table if (table.getSelectedRowCount() == 0 && table.getSelectedColumnCount() == 0) { rowModel.setSelectionInterval(0, 0); colModel.setSelectionInterval(0, 0); return; } // If the lead selection index isn't selected (ie a remove operation // happened, then set the lead to the first selected cell in the // table if (!table.isCellSelected(rowLead, colLead)) { rowModel.addSelectionInterval(rowModel.getMinSelectionIndex(), rowModel.getMinSelectionIndex()); colModel.addSelectionInterval(colModel.getMinSelectionIndex(), colModel.getMinSelectionIndex()); return; } // multRowsSelected and multColsSelected tell us if multiple rows or // columns are selected, respectively boolean multRowsSelected, multColsSelected; multRowsSelected = table.getSelectedRowCount() > 1 && table.getRowSelectionAllowed(); multColsSelected = table.getSelectedColumnCount() > 1 && table.getColumnSelectionAllowed(); // If there is just one selection, select the next cell, and wrap // when you get to the edges of the table. if (!multColsSelected && !multRowsSelected) { if (e.getActionCommand().indexOf("Column") != -1) advanceSingleSelection(colModel, colMax, rowModel, rowMax, (e.getActionCommand().equals ("selectPreviousColumnCell"))); else advanceSingleSelection(rowModel, rowMax, colModel, colMax, (e.getActionCommand().equals ("selectPreviousRowCell"))); return; } // rowMinSelected and rowMaxSelected are the minimum and maximum // values respectively of selected cells in the row selection model // Similarly for colMinSelected and colMaxSelected. int rowMaxSelected = table.getRowSelectionAllowed() ? rowModel.getMaxSelectionIndex() : table.getModel().getRowCount() - 1; int rowMinSelected = table.getRowSelectionAllowed() ? rowModel.getMinSelectionIndex() : 0; int colMaxSelected = table.getColumnSelectionAllowed() ? colModel.getMaxSelectionIndex() : table.getModel().getColumnCount() - 1; int colMinSelected = table.getColumnSelectionAllowed() ? colModel.getMinSelectionIndex() : 0; // If there are multiple rows and columns selected, select the next // cell and wrap at the edges of the selection. if (e.getActionCommand().indexOf("Column") != -1) advanceMultipleSelection(colModel, colMinSelected, colMaxSelected, rowModel, rowMinSelected, rowMaxSelected, (e.getActionCommand().equals ("selectPreviousColumnCell")), true); else advanceMultipleSelection(rowModel, rowMinSelected, rowMaxSelected, colModel, colMinSelected, colMaxSelected, (e.getActionCommand().equals ("selectPreviousRowCell")), false); } else if (e.getActionCommand().equals("selectNextColumn")) { rowModel.setSelectionInterval(rowLead,rowLead); colModel.setSelectionInterval(Math.min(colLead + 1, colMax), Math.min(colLead + 1, colMax)); } else if (e.getActionCommand().equals("scrollLeftExtendSelection")) { int target; if (colLead == getFirstVisibleColumnIndex()) target = Math.max (0, colLead - (getLastVisibleColumnIndex() - getFirstVisibleColumnIndex() + 1)); else target = getFirstVisibleColumnIndex(); colModel.setLeadSelectionIndex(target); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("scrollDownChangeSelection")) { int target; if (rowLead == getLastVisibleRowIndex()) target = Math.min (rowMax, rowLead + (getLastVisibleRowIndex() - getFirstVisibleRowIndex() + 1)); else target = getLastVisibleRowIndex(); rowModel.setSelectionInterval(target, target); colModel.setSelectionInterval(colLead, colLead); } else if (e.getActionCommand().equals("scrollRightExtendSelection")) { int target; if (colLead == getLastVisibleColumnIndex()) target = Math.min (colMax, colLead + (getLastVisibleColumnIndex() - getFirstVisibleColumnIndex() + 1)); else target = getLastVisibleColumnIndex(); colModel.setLeadSelectionIndex(target); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectAll")) { table.selectAll(); } else if (e.getActionCommand().equals("selectLastRowExtendSelection")) { rowModel.setLeadSelectionIndex(rowMax); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("scrollDownExtendSelection")) { int target; if (rowLead == getLastVisibleRowIndex()) target = Math.min (rowMax, rowLead + (getLastVisibleRowIndex() - getFirstVisibleRowIndex() + 1)); else target = getLastVisibleRowIndex(); rowModel.setLeadSelectionIndex(target); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("scrollUpChangeSelection")) { int target; if (rowLead == getFirstVisibleRowIndex()) target = Math.max (0, rowLead - (getLastVisibleRowIndex() - getFirstVisibleRowIndex() + 1)); else target = getFirstVisibleRowIndex(); rowModel.setSelectionInterval(target, target); colModel.setSelectionInterval(colLead, colLead); } else { // If we're here that means we bound this TableAction class // to a keyboard input but we either want to ignore that input // or we just haven't implemented its action yet. } if (table.isEditing() && e.getActionCommand() != "startEditing") table.editingCanceled(new ChangeEvent("update")); table.repaint(); table.scrollRectToVisible (table.getCellRect(rowModel.getLeadSelectionIndex(), colModel.getLeadSelectionIndex(), false)); }
1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/963ae61676e8c35a9e0998e0b7de1f942db82a26/BasicTableUI.java/buggy/core/src/classpath/javax/javax/swing/plaf/basic/BasicTableUI.java
if (e.getActionCommand().indexOf("Column") != -1)
if (command.indexOf("Column") != -1)
public void actionPerformed (ActionEvent e) { ListSelectionModel rowModel = table.getSelectionModel(); ListSelectionModel colModel = table.getColumnModel().getSelectionModel(); int rowLead = rowModel.getLeadSelectionIndex(); int rowMax = table.getModel().getRowCount() - 1; int colLead = colModel.getLeadSelectionIndex(); int colMax = table.getModel().getColumnCount() - 1; if (e.getActionCommand().equals("selectPreviousRowExtendSelection")) { rowModel.setLeadSelectionIndex(Math.max(rowLead - 1, 0)); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("selectLastColumn")) { table.clearSelection(); rowModel.setSelectionInterval(rowLead, rowLead); colModel.setSelectionInterval(colMax, colMax); } else if (e.getActionCommand().equals("startEditing")) { if (table.isCellEditable(rowLead, colLead)) table.editCellAt(rowLead,colLead); } else if (e.getActionCommand().equals("selectFirstRowExtendSelection")) { rowModel.setLeadSelectionIndex(0); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("selectFirstColumn")) { rowModel.setSelectionInterval(rowLead, rowLead); colModel.setSelectionInterval(0, 0); } else if (e.getActionCommand().equals("selectFirstColumnExtendSelection")) { colModel.setLeadSelectionIndex(0); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectLastRow")) { rowModel.setSelectionInterval(rowMax,rowMax); colModel.setSelectionInterval(colLead, colLead); } else if (e.getActionCommand().equals("selectNextRowExtendSelection")) { rowModel.setLeadSelectionIndex(Math.min(rowLead + 1, rowMax)); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("selectFirstRow")) { rowModel.setSelectionInterval(0,0); colModel.setSelectionInterval(colLead, colLead); } else if (e.getActionCommand().equals("selectNextColumnExtendSelection")) { colModel.setLeadSelectionIndex(Math.min(colLead + 1, colMax)); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectLastColumnExtendSelection")) { colModel.setLeadSelectionIndex(colMax); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectPreviousColumnExtendSelection")) { colModel.setLeadSelectionIndex(Math.max(colLead - 1, 0)); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectNextRow")) { rowModel.setSelectionInterval(Math.min(rowLead + 1, rowMax), Math.min(rowLead + 1, rowMax)); colModel.setSelectionInterval(colLead,colLead); } else if (e.getActionCommand().equals("scrollUpExtendSelection")) { int target; if (rowLead == getFirstVisibleRowIndex()) target = Math.max (0, rowLead - (getLastVisibleRowIndex() - getFirstVisibleRowIndex() + 1)); else target = getFirstVisibleRowIndex(); rowModel.setLeadSelectionIndex(target); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("selectPreviousRow")) { rowModel.setSelectionInterval(Math.max(rowLead - 1, 0), Math.max(rowLead - 1, 0)); colModel.setSelectionInterval(colLead,colLead); } else if (e.getActionCommand().equals("scrollRightChangeSelection")) { int target; if (colLead == getLastVisibleColumnIndex()) target = Math.min (colMax, colLead + (getLastVisibleColumnIndex() - getFirstVisibleColumnIndex() + 1)); else target = getLastVisibleColumnIndex(); colModel.setSelectionInterval(target, target); rowModel.setSelectionInterval(rowLead, rowLead); } else if (e.getActionCommand().equals("selectPreviousColumn")) { rowModel.setSelectionInterval(rowLead,rowLead); colModel.setSelectionInterval(Math.max(colLead - 1, 0), Math.max(colLead - 1, 0)); } else if (e.getActionCommand().equals("scrollLeftChangeSelection")) { int target; if (colLead == getFirstVisibleColumnIndex()) target = Math.max (0, colLead - (getLastVisibleColumnIndex() - getFirstVisibleColumnIndex() + 1)); else target = getFirstVisibleColumnIndex(); colModel.setSelectionInterval(target, target); rowModel.setSelectionInterval(rowLead, rowLead); } else if (e.getActionCommand().equals("clearSelection")) { table.clearSelection(); } else if (e.getActionCommand().equals("cancel")) { // FIXME: implement other parts of "cancel" like undo-ing last // selection. Right now it just calls editingCancelled if // we're currently editing. if (table.isEditing()) table.editingCanceled(new ChangeEvent("cancel")); } else if (e.getActionCommand().equals("selectNextRowCell") || e.getActionCommand().equals("selectPreviousRowCell") || e.getActionCommand().equals("selectNextColumnCell") || e.getActionCommand().equals("selectPreviousColumnCell")) { // If nothing is selected, select the first cell in the table if (table.getSelectedRowCount() == 0 && table.getSelectedColumnCount() == 0) { rowModel.setSelectionInterval(0, 0); colModel.setSelectionInterval(0, 0); return; } // If the lead selection index isn't selected (ie a remove operation // happened, then set the lead to the first selected cell in the // table if (!table.isCellSelected(rowLead, colLead)) { rowModel.addSelectionInterval(rowModel.getMinSelectionIndex(), rowModel.getMinSelectionIndex()); colModel.addSelectionInterval(colModel.getMinSelectionIndex(), colModel.getMinSelectionIndex()); return; } // multRowsSelected and multColsSelected tell us if multiple rows or // columns are selected, respectively boolean multRowsSelected, multColsSelected; multRowsSelected = table.getSelectedRowCount() > 1 && table.getRowSelectionAllowed(); multColsSelected = table.getSelectedColumnCount() > 1 && table.getColumnSelectionAllowed(); // If there is just one selection, select the next cell, and wrap // when you get to the edges of the table. if (!multColsSelected && !multRowsSelected) { if (e.getActionCommand().indexOf("Column") != -1) advanceSingleSelection(colModel, colMax, rowModel, rowMax, (e.getActionCommand().equals ("selectPreviousColumnCell"))); else advanceSingleSelection(rowModel, rowMax, colModel, colMax, (e.getActionCommand().equals ("selectPreviousRowCell"))); return; } // rowMinSelected and rowMaxSelected are the minimum and maximum // values respectively of selected cells in the row selection model // Similarly for colMinSelected and colMaxSelected. int rowMaxSelected = table.getRowSelectionAllowed() ? rowModel.getMaxSelectionIndex() : table.getModel().getRowCount() - 1; int rowMinSelected = table.getRowSelectionAllowed() ? rowModel.getMinSelectionIndex() : 0; int colMaxSelected = table.getColumnSelectionAllowed() ? colModel.getMaxSelectionIndex() : table.getModel().getColumnCount() - 1; int colMinSelected = table.getColumnSelectionAllowed() ? colModel.getMinSelectionIndex() : 0; // If there are multiple rows and columns selected, select the next // cell and wrap at the edges of the selection. if (e.getActionCommand().indexOf("Column") != -1) advanceMultipleSelection(colModel, colMinSelected, colMaxSelected, rowModel, rowMinSelected, rowMaxSelected, (e.getActionCommand().equals ("selectPreviousColumnCell")), true); else advanceMultipleSelection(rowModel, rowMinSelected, rowMaxSelected, colModel, colMinSelected, colMaxSelected, (e.getActionCommand().equals ("selectPreviousRowCell")), false); } else if (e.getActionCommand().equals("selectNextColumn")) { rowModel.setSelectionInterval(rowLead,rowLead); colModel.setSelectionInterval(Math.min(colLead + 1, colMax), Math.min(colLead + 1, colMax)); } else if (e.getActionCommand().equals("scrollLeftExtendSelection")) { int target; if (colLead == getFirstVisibleColumnIndex()) target = Math.max (0, colLead - (getLastVisibleColumnIndex() - getFirstVisibleColumnIndex() + 1)); else target = getFirstVisibleColumnIndex(); colModel.setLeadSelectionIndex(target); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("scrollDownChangeSelection")) { int target; if (rowLead == getLastVisibleRowIndex()) target = Math.min (rowMax, rowLead + (getLastVisibleRowIndex() - getFirstVisibleRowIndex() + 1)); else target = getLastVisibleRowIndex(); rowModel.setSelectionInterval(target, target); colModel.setSelectionInterval(colLead, colLead); } else if (e.getActionCommand().equals("scrollRightExtendSelection")) { int target; if (colLead == getLastVisibleColumnIndex()) target = Math.min (colMax, colLead + (getLastVisibleColumnIndex() - getFirstVisibleColumnIndex() + 1)); else target = getLastVisibleColumnIndex(); colModel.setLeadSelectionIndex(target); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectAll")) { table.selectAll(); } else if (e.getActionCommand().equals("selectLastRowExtendSelection")) { rowModel.setLeadSelectionIndex(rowMax); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("scrollDownExtendSelection")) { int target; if (rowLead == getLastVisibleRowIndex()) target = Math.min (rowMax, rowLead + (getLastVisibleRowIndex() - getFirstVisibleRowIndex() + 1)); else target = getLastVisibleRowIndex(); rowModel.setLeadSelectionIndex(target); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("scrollUpChangeSelection")) { int target; if (rowLead == getFirstVisibleRowIndex()) target = Math.max (0, rowLead - (getLastVisibleRowIndex() - getFirstVisibleRowIndex() + 1)); else target = getFirstVisibleRowIndex(); rowModel.setSelectionInterval(target, target); colModel.setSelectionInterval(colLead, colLead); } else { // If we're here that means we bound this TableAction class // to a keyboard input but we either want to ignore that input // or we just haven't implemented its action yet. } if (table.isEditing() && e.getActionCommand() != "startEditing") table.editingCanceled(new ChangeEvent("update")); table.repaint(); table.scrollRectToVisible (table.getCellRect(rowModel.getLeadSelectionIndex(), colModel.getLeadSelectionIndex(), false)); }
1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/963ae61676e8c35a9e0998e0b7de1f942db82a26/BasicTableUI.java/buggy/core/src/classpath/javax/javax/swing/plaf/basic/BasicTableUI.java
(e.getActionCommand().equals
(command.equals
public void actionPerformed (ActionEvent e) { ListSelectionModel rowModel = table.getSelectionModel(); ListSelectionModel colModel = table.getColumnModel().getSelectionModel(); int rowLead = rowModel.getLeadSelectionIndex(); int rowMax = table.getModel().getRowCount() - 1; int colLead = colModel.getLeadSelectionIndex(); int colMax = table.getModel().getColumnCount() - 1; if (e.getActionCommand().equals("selectPreviousRowExtendSelection")) { rowModel.setLeadSelectionIndex(Math.max(rowLead - 1, 0)); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("selectLastColumn")) { table.clearSelection(); rowModel.setSelectionInterval(rowLead, rowLead); colModel.setSelectionInterval(colMax, colMax); } else if (e.getActionCommand().equals("startEditing")) { if (table.isCellEditable(rowLead, colLead)) table.editCellAt(rowLead,colLead); } else if (e.getActionCommand().equals("selectFirstRowExtendSelection")) { rowModel.setLeadSelectionIndex(0); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("selectFirstColumn")) { rowModel.setSelectionInterval(rowLead, rowLead); colModel.setSelectionInterval(0, 0); } else if (e.getActionCommand().equals("selectFirstColumnExtendSelection")) { colModel.setLeadSelectionIndex(0); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectLastRow")) { rowModel.setSelectionInterval(rowMax,rowMax); colModel.setSelectionInterval(colLead, colLead); } else if (e.getActionCommand().equals("selectNextRowExtendSelection")) { rowModel.setLeadSelectionIndex(Math.min(rowLead + 1, rowMax)); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("selectFirstRow")) { rowModel.setSelectionInterval(0,0); colModel.setSelectionInterval(colLead, colLead); } else if (e.getActionCommand().equals("selectNextColumnExtendSelection")) { colModel.setLeadSelectionIndex(Math.min(colLead + 1, colMax)); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectLastColumnExtendSelection")) { colModel.setLeadSelectionIndex(colMax); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectPreviousColumnExtendSelection")) { colModel.setLeadSelectionIndex(Math.max(colLead - 1, 0)); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectNextRow")) { rowModel.setSelectionInterval(Math.min(rowLead + 1, rowMax), Math.min(rowLead + 1, rowMax)); colModel.setSelectionInterval(colLead,colLead); } else if (e.getActionCommand().equals("scrollUpExtendSelection")) { int target; if (rowLead == getFirstVisibleRowIndex()) target = Math.max (0, rowLead - (getLastVisibleRowIndex() - getFirstVisibleRowIndex() + 1)); else target = getFirstVisibleRowIndex(); rowModel.setLeadSelectionIndex(target); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("selectPreviousRow")) { rowModel.setSelectionInterval(Math.max(rowLead - 1, 0), Math.max(rowLead - 1, 0)); colModel.setSelectionInterval(colLead,colLead); } else if (e.getActionCommand().equals("scrollRightChangeSelection")) { int target; if (colLead == getLastVisibleColumnIndex()) target = Math.min (colMax, colLead + (getLastVisibleColumnIndex() - getFirstVisibleColumnIndex() + 1)); else target = getLastVisibleColumnIndex(); colModel.setSelectionInterval(target, target); rowModel.setSelectionInterval(rowLead, rowLead); } else if (e.getActionCommand().equals("selectPreviousColumn")) { rowModel.setSelectionInterval(rowLead,rowLead); colModel.setSelectionInterval(Math.max(colLead - 1, 0), Math.max(colLead - 1, 0)); } else if (e.getActionCommand().equals("scrollLeftChangeSelection")) { int target; if (colLead == getFirstVisibleColumnIndex()) target = Math.max (0, colLead - (getLastVisibleColumnIndex() - getFirstVisibleColumnIndex() + 1)); else target = getFirstVisibleColumnIndex(); colModel.setSelectionInterval(target, target); rowModel.setSelectionInterval(rowLead, rowLead); } else if (e.getActionCommand().equals("clearSelection")) { table.clearSelection(); } else if (e.getActionCommand().equals("cancel")) { // FIXME: implement other parts of "cancel" like undo-ing last // selection. Right now it just calls editingCancelled if // we're currently editing. if (table.isEditing()) table.editingCanceled(new ChangeEvent("cancel")); } else if (e.getActionCommand().equals("selectNextRowCell") || e.getActionCommand().equals("selectPreviousRowCell") || e.getActionCommand().equals("selectNextColumnCell") || e.getActionCommand().equals("selectPreviousColumnCell")) { // If nothing is selected, select the first cell in the table if (table.getSelectedRowCount() == 0 && table.getSelectedColumnCount() == 0) { rowModel.setSelectionInterval(0, 0); colModel.setSelectionInterval(0, 0); return; } // If the lead selection index isn't selected (ie a remove operation // happened, then set the lead to the first selected cell in the // table if (!table.isCellSelected(rowLead, colLead)) { rowModel.addSelectionInterval(rowModel.getMinSelectionIndex(), rowModel.getMinSelectionIndex()); colModel.addSelectionInterval(colModel.getMinSelectionIndex(), colModel.getMinSelectionIndex()); return; } // multRowsSelected and multColsSelected tell us if multiple rows or // columns are selected, respectively boolean multRowsSelected, multColsSelected; multRowsSelected = table.getSelectedRowCount() > 1 && table.getRowSelectionAllowed(); multColsSelected = table.getSelectedColumnCount() > 1 && table.getColumnSelectionAllowed(); // If there is just one selection, select the next cell, and wrap // when you get to the edges of the table. if (!multColsSelected && !multRowsSelected) { if (e.getActionCommand().indexOf("Column") != -1) advanceSingleSelection(colModel, colMax, rowModel, rowMax, (e.getActionCommand().equals ("selectPreviousColumnCell"))); else advanceSingleSelection(rowModel, rowMax, colModel, colMax, (e.getActionCommand().equals ("selectPreviousRowCell"))); return; } // rowMinSelected and rowMaxSelected are the minimum and maximum // values respectively of selected cells in the row selection model // Similarly for colMinSelected and colMaxSelected. int rowMaxSelected = table.getRowSelectionAllowed() ? rowModel.getMaxSelectionIndex() : table.getModel().getRowCount() - 1; int rowMinSelected = table.getRowSelectionAllowed() ? rowModel.getMinSelectionIndex() : 0; int colMaxSelected = table.getColumnSelectionAllowed() ? colModel.getMaxSelectionIndex() : table.getModel().getColumnCount() - 1; int colMinSelected = table.getColumnSelectionAllowed() ? colModel.getMinSelectionIndex() : 0; // If there are multiple rows and columns selected, select the next // cell and wrap at the edges of the selection. if (e.getActionCommand().indexOf("Column") != -1) advanceMultipleSelection(colModel, colMinSelected, colMaxSelected, rowModel, rowMinSelected, rowMaxSelected, (e.getActionCommand().equals ("selectPreviousColumnCell")), true); else advanceMultipleSelection(rowModel, rowMinSelected, rowMaxSelected, colModel, colMinSelected, colMaxSelected, (e.getActionCommand().equals ("selectPreviousRowCell")), false); } else if (e.getActionCommand().equals("selectNextColumn")) { rowModel.setSelectionInterval(rowLead,rowLead); colModel.setSelectionInterval(Math.min(colLead + 1, colMax), Math.min(colLead + 1, colMax)); } else if (e.getActionCommand().equals("scrollLeftExtendSelection")) { int target; if (colLead == getFirstVisibleColumnIndex()) target = Math.max (0, colLead - (getLastVisibleColumnIndex() - getFirstVisibleColumnIndex() + 1)); else target = getFirstVisibleColumnIndex(); colModel.setLeadSelectionIndex(target); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("scrollDownChangeSelection")) { int target; if (rowLead == getLastVisibleRowIndex()) target = Math.min (rowMax, rowLead + (getLastVisibleRowIndex() - getFirstVisibleRowIndex() + 1)); else target = getLastVisibleRowIndex(); rowModel.setSelectionInterval(target, target); colModel.setSelectionInterval(colLead, colLead); } else if (e.getActionCommand().equals("scrollRightExtendSelection")) { int target; if (colLead == getLastVisibleColumnIndex()) target = Math.min (colMax, colLead + (getLastVisibleColumnIndex() - getFirstVisibleColumnIndex() + 1)); else target = getLastVisibleColumnIndex(); colModel.setLeadSelectionIndex(target); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectAll")) { table.selectAll(); } else if (e.getActionCommand().equals("selectLastRowExtendSelection")) { rowModel.setLeadSelectionIndex(rowMax); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("scrollDownExtendSelection")) { int target; if (rowLead == getLastVisibleRowIndex()) target = Math.min (rowMax, rowLead + (getLastVisibleRowIndex() - getFirstVisibleRowIndex() + 1)); else target = getLastVisibleRowIndex(); rowModel.setLeadSelectionIndex(target); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("scrollUpChangeSelection")) { int target; if (rowLead == getFirstVisibleRowIndex()) target = Math.max (0, rowLead - (getLastVisibleRowIndex() - getFirstVisibleRowIndex() + 1)); else target = getFirstVisibleRowIndex(); rowModel.setSelectionInterval(target, target); colModel.setSelectionInterval(colLead, colLead); } else { // If we're here that means we bound this TableAction class // to a keyboard input but we either want to ignore that input // or we just haven't implemented its action yet. } if (table.isEditing() && e.getActionCommand() != "startEditing") table.editingCanceled(new ChangeEvent("update")); table.repaint(); table.scrollRectToVisible (table.getCellRect(rowModel.getLeadSelectionIndex(), colModel.getLeadSelectionIndex(), false)); }
1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/963ae61676e8c35a9e0998e0b7de1f942db82a26/BasicTableUI.java/buggy/core/src/classpath/javax/javax/swing/plaf/basic/BasicTableUI.java
(e.getActionCommand().equals
(command.equals
public void actionPerformed (ActionEvent e) { ListSelectionModel rowModel = table.getSelectionModel(); ListSelectionModel colModel = table.getColumnModel().getSelectionModel(); int rowLead = rowModel.getLeadSelectionIndex(); int rowMax = table.getModel().getRowCount() - 1; int colLead = colModel.getLeadSelectionIndex(); int colMax = table.getModel().getColumnCount() - 1; if (e.getActionCommand().equals("selectPreviousRowExtendSelection")) { rowModel.setLeadSelectionIndex(Math.max(rowLead - 1, 0)); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("selectLastColumn")) { table.clearSelection(); rowModel.setSelectionInterval(rowLead, rowLead); colModel.setSelectionInterval(colMax, colMax); } else if (e.getActionCommand().equals("startEditing")) { if (table.isCellEditable(rowLead, colLead)) table.editCellAt(rowLead,colLead); } else if (e.getActionCommand().equals("selectFirstRowExtendSelection")) { rowModel.setLeadSelectionIndex(0); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("selectFirstColumn")) { rowModel.setSelectionInterval(rowLead, rowLead); colModel.setSelectionInterval(0, 0); } else if (e.getActionCommand().equals("selectFirstColumnExtendSelection")) { colModel.setLeadSelectionIndex(0); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectLastRow")) { rowModel.setSelectionInterval(rowMax,rowMax); colModel.setSelectionInterval(colLead, colLead); } else if (e.getActionCommand().equals("selectNextRowExtendSelection")) { rowModel.setLeadSelectionIndex(Math.min(rowLead + 1, rowMax)); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("selectFirstRow")) { rowModel.setSelectionInterval(0,0); colModel.setSelectionInterval(colLead, colLead); } else if (e.getActionCommand().equals("selectNextColumnExtendSelection")) { colModel.setLeadSelectionIndex(Math.min(colLead + 1, colMax)); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectLastColumnExtendSelection")) { colModel.setLeadSelectionIndex(colMax); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectPreviousColumnExtendSelection")) { colModel.setLeadSelectionIndex(Math.max(colLead - 1, 0)); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectNextRow")) { rowModel.setSelectionInterval(Math.min(rowLead + 1, rowMax), Math.min(rowLead + 1, rowMax)); colModel.setSelectionInterval(colLead,colLead); } else if (e.getActionCommand().equals("scrollUpExtendSelection")) { int target; if (rowLead == getFirstVisibleRowIndex()) target = Math.max (0, rowLead - (getLastVisibleRowIndex() - getFirstVisibleRowIndex() + 1)); else target = getFirstVisibleRowIndex(); rowModel.setLeadSelectionIndex(target); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("selectPreviousRow")) { rowModel.setSelectionInterval(Math.max(rowLead - 1, 0), Math.max(rowLead - 1, 0)); colModel.setSelectionInterval(colLead,colLead); } else if (e.getActionCommand().equals("scrollRightChangeSelection")) { int target; if (colLead == getLastVisibleColumnIndex()) target = Math.min (colMax, colLead + (getLastVisibleColumnIndex() - getFirstVisibleColumnIndex() + 1)); else target = getLastVisibleColumnIndex(); colModel.setSelectionInterval(target, target); rowModel.setSelectionInterval(rowLead, rowLead); } else if (e.getActionCommand().equals("selectPreviousColumn")) { rowModel.setSelectionInterval(rowLead,rowLead); colModel.setSelectionInterval(Math.max(colLead - 1, 0), Math.max(colLead - 1, 0)); } else if (e.getActionCommand().equals("scrollLeftChangeSelection")) { int target; if (colLead == getFirstVisibleColumnIndex()) target = Math.max (0, colLead - (getLastVisibleColumnIndex() - getFirstVisibleColumnIndex() + 1)); else target = getFirstVisibleColumnIndex(); colModel.setSelectionInterval(target, target); rowModel.setSelectionInterval(rowLead, rowLead); } else if (e.getActionCommand().equals("clearSelection")) { table.clearSelection(); } else if (e.getActionCommand().equals("cancel")) { // FIXME: implement other parts of "cancel" like undo-ing last // selection. Right now it just calls editingCancelled if // we're currently editing. if (table.isEditing()) table.editingCanceled(new ChangeEvent("cancel")); } else if (e.getActionCommand().equals("selectNextRowCell") || e.getActionCommand().equals("selectPreviousRowCell") || e.getActionCommand().equals("selectNextColumnCell") || e.getActionCommand().equals("selectPreviousColumnCell")) { // If nothing is selected, select the first cell in the table if (table.getSelectedRowCount() == 0 && table.getSelectedColumnCount() == 0) { rowModel.setSelectionInterval(0, 0); colModel.setSelectionInterval(0, 0); return; } // If the lead selection index isn't selected (ie a remove operation // happened, then set the lead to the first selected cell in the // table if (!table.isCellSelected(rowLead, colLead)) { rowModel.addSelectionInterval(rowModel.getMinSelectionIndex(), rowModel.getMinSelectionIndex()); colModel.addSelectionInterval(colModel.getMinSelectionIndex(), colModel.getMinSelectionIndex()); return; } // multRowsSelected and multColsSelected tell us if multiple rows or // columns are selected, respectively boolean multRowsSelected, multColsSelected; multRowsSelected = table.getSelectedRowCount() > 1 && table.getRowSelectionAllowed(); multColsSelected = table.getSelectedColumnCount() > 1 && table.getColumnSelectionAllowed(); // If there is just one selection, select the next cell, and wrap // when you get to the edges of the table. if (!multColsSelected && !multRowsSelected) { if (e.getActionCommand().indexOf("Column") != -1) advanceSingleSelection(colModel, colMax, rowModel, rowMax, (e.getActionCommand().equals ("selectPreviousColumnCell"))); else advanceSingleSelection(rowModel, rowMax, colModel, colMax, (e.getActionCommand().equals ("selectPreviousRowCell"))); return; } // rowMinSelected and rowMaxSelected are the minimum and maximum // values respectively of selected cells in the row selection model // Similarly for colMinSelected and colMaxSelected. int rowMaxSelected = table.getRowSelectionAllowed() ? rowModel.getMaxSelectionIndex() : table.getModel().getRowCount() - 1; int rowMinSelected = table.getRowSelectionAllowed() ? rowModel.getMinSelectionIndex() : 0; int colMaxSelected = table.getColumnSelectionAllowed() ? colModel.getMaxSelectionIndex() : table.getModel().getColumnCount() - 1; int colMinSelected = table.getColumnSelectionAllowed() ? colModel.getMinSelectionIndex() : 0; // If there are multiple rows and columns selected, select the next // cell and wrap at the edges of the selection. if (e.getActionCommand().indexOf("Column") != -1) advanceMultipleSelection(colModel, colMinSelected, colMaxSelected, rowModel, rowMinSelected, rowMaxSelected, (e.getActionCommand().equals ("selectPreviousColumnCell")), true); else advanceMultipleSelection(rowModel, rowMinSelected, rowMaxSelected, colModel, colMinSelected, colMaxSelected, (e.getActionCommand().equals ("selectPreviousRowCell")), false); } else if (e.getActionCommand().equals("selectNextColumn")) { rowModel.setSelectionInterval(rowLead,rowLead); colModel.setSelectionInterval(Math.min(colLead + 1, colMax), Math.min(colLead + 1, colMax)); } else if (e.getActionCommand().equals("scrollLeftExtendSelection")) { int target; if (colLead == getFirstVisibleColumnIndex()) target = Math.max (0, colLead - (getLastVisibleColumnIndex() - getFirstVisibleColumnIndex() + 1)); else target = getFirstVisibleColumnIndex(); colModel.setLeadSelectionIndex(target); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("scrollDownChangeSelection")) { int target; if (rowLead == getLastVisibleRowIndex()) target = Math.min (rowMax, rowLead + (getLastVisibleRowIndex() - getFirstVisibleRowIndex() + 1)); else target = getLastVisibleRowIndex(); rowModel.setSelectionInterval(target, target); colModel.setSelectionInterval(colLead, colLead); } else if (e.getActionCommand().equals("scrollRightExtendSelection")) { int target; if (colLead == getLastVisibleColumnIndex()) target = Math.min (colMax, colLead + (getLastVisibleColumnIndex() - getFirstVisibleColumnIndex() + 1)); else target = getLastVisibleColumnIndex(); colModel.setLeadSelectionIndex(target); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectAll")) { table.selectAll(); } else if (e.getActionCommand().equals("selectLastRowExtendSelection")) { rowModel.setLeadSelectionIndex(rowMax); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("scrollDownExtendSelection")) { int target; if (rowLead == getLastVisibleRowIndex()) target = Math.min (rowMax, rowLead + (getLastVisibleRowIndex() - getFirstVisibleRowIndex() + 1)); else target = getLastVisibleRowIndex(); rowModel.setLeadSelectionIndex(target); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("scrollUpChangeSelection")) { int target; if (rowLead == getFirstVisibleRowIndex()) target = Math.max (0, rowLead - (getLastVisibleRowIndex() - getFirstVisibleRowIndex() + 1)); else target = getFirstVisibleRowIndex(); rowModel.setSelectionInterval(target, target); colModel.setSelectionInterval(colLead, colLead); } else { // If we're here that means we bound this TableAction class // to a keyboard input but we either want to ignore that input // or we just haven't implemented its action yet. } if (table.isEditing() && e.getActionCommand() != "startEditing") table.editingCanceled(new ChangeEvent("update")); table.repaint(); table.scrollRectToVisible (table.getCellRect(rowModel.getLeadSelectionIndex(), colModel.getLeadSelectionIndex(), false)); }
1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/963ae61676e8c35a9e0998e0b7de1f942db82a26/BasicTableUI.java/buggy/core/src/classpath/javax/javax/swing/plaf/basic/BasicTableUI.java
else if (e.getActionCommand().equals("selectNextColumn"))
else if (command.equals("selectNextColumn"))
public void actionPerformed (ActionEvent e) { ListSelectionModel rowModel = table.getSelectionModel(); ListSelectionModel colModel = table.getColumnModel().getSelectionModel(); int rowLead = rowModel.getLeadSelectionIndex(); int rowMax = table.getModel().getRowCount() - 1; int colLead = colModel.getLeadSelectionIndex(); int colMax = table.getModel().getColumnCount() - 1; if (e.getActionCommand().equals("selectPreviousRowExtendSelection")) { rowModel.setLeadSelectionIndex(Math.max(rowLead - 1, 0)); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("selectLastColumn")) { table.clearSelection(); rowModel.setSelectionInterval(rowLead, rowLead); colModel.setSelectionInterval(colMax, colMax); } else if (e.getActionCommand().equals("startEditing")) { if (table.isCellEditable(rowLead, colLead)) table.editCellAt(rowLead,colLead); } else if (e.getActionCommand().equals("selectFirstRowExtendSelection")) { rowModel.setLeadSelectionIndex(0); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("selectFirstColumn")) { rowModel.setSelectionInterval(rowLead, rowLead); colModel.setSelectionInterval(0, 0); } else if (e.getActionCommand().equals("selectFirstColumnExtendSelection")) { colModel.setLeadSelectionIndex(0); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectLastRow")) { rowModel.setSelectionInterval(rowMax,rowMax); colModel.setSelectionInterval(colLead, colLead); } else if (e.getActionCommand().equals("selectNextRowExtendSelection")) { rowModel.setLeadSelectionIndex(Math.min(rowLead + 1, rowMax)); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("selectFirstRow")) { rowModel.setSelectionInterval(0,0); colModel.setSelectionInterval(colLead, colLead); } else if (e.getActionCommand().equals("selectNextColumnExtendSelection")) { colModel.setLeadSelectionIndex(Math.min(colLead + 1, colMax)); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectLastColumnExtendSelection")) { colModel.setLeadSelectionIndex(colMax); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectPreviousColumnExtendSelection")) { colModel.setLeadSelectionIndex(Math.max(colLead - 1, 0)); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectNextRow")) { rowModel.setSelectionInterval(Math.min(rowLead + 1, rowMax), Math.min(rowLead + 1, rowMax)); colModel.setSelectionInterval(colLead,colLead); } else if (e.getActionCommand().equals("scrollUpExtendSelection")) { int target; if (rowLead == getFirstVisibleRowIndex()) target = Math.max (0, rowLead - (getLastVisibleRowIndex() - getFirstVisibleRowIndex() + 1)); else target = getFirstVisibleRowIndex(); rowModel.setLeadSelectionIndex(target); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("selectPreviousRow")) { rowModel.setSelectionInterval(Math.max(rowLead - 1, 0), Math.max(rowLead - 1, 0)); colModel.setSelectionInterval(colLead,colLead); } else if (e.getActionCommand().equals("scrollRightChangeSelection")) { int target; if (colLead == getLastVisibleColumnIndex()) target = Math.min (colMax, colLead + (getLastVisibleColumnIndex() - getFirstVisibleColumnIndex() + 1)); else target = getLastVisibleColumnIndex(); colModel.setSelectionInterval(target, target); rowModel.setSelectionInterval(rowLead, rowLead); } else if (e.getActionCommand().equals("selectPreviousColumn")) { rowModel.setSelectionInterval(rowLead,rowLead); colModel.setSelectionInterval(Math.max(colLead - 1, 0), Math.max(colLead - 1, 0)); } else if (e.getActionCommand().equals("scrollLeftChangeSelection")) { int target; if (colLead == getFirstVisibleColumnIndex()) target = Math.max (0, colLead - (getLastVisibleColumnIndex() - getFirstVisibleColumnIndex() + 1)); else target = getFirstVisibleColumnIndex(); colModel.setSelectionInterval(target, target); rowModel.setSelectionInterval(rowLead, rowLead); } else if (e.getActionCommand().equals("clearSelection")) { table.clearSelection(); } else if (e.getActionCommand().equals("cancel")) { // FIXME: implement other parts of "cancel" like undo-ing last // selection. Right now it just calls editingCancelled if // we're currently editing. if (table.isEditing()) table.editingCanceled(new ChangeEvent("cancel")); } else if (e.getActionCommand().equals("selectNextRowCell") || e.getActionCommand().equals("selectPreviousRowCell") || e.getActionCommand().equals("selectNextColumnCell") || e.getActionCommand().equals("selectPreviousColumnCell")) { // If nothing is selected, select the first cell in the table if (table.getSelectedRowCount() == 0 && table.getSelectedColumnCount() == 0) { rowModel.setSelectionInterval(0, 0); colModel.setSelectionInterval(0, 0); return; } // If the lead selection index isn't selected (ie a remove operation // happened, then set the lead to the first selected cell in the // table if (!table.isCellSelected(rowLead, colLead)) { rowModel.addSelectionInterval(rowModel.getMinSelectionIndex(), rowModel.getMinSelectionIndex()); colModel.addSelectionInterval(colModel.getMinSelectionIndex(), colModel.getMinSelectionIndex()); return; } // multRowsSelected and multColsSelected tell us if multiple rows or // columns are selected, respectively boolean multRowsSelected, multColsSelected; multRowsSelected = table.getSelectedRowCount() > 1 && table.getRowSelectionAllowed(); multColsSelected = table.getSelectedColumnCount() > 1 && table.getColumnSelectionAllowed(); // If there is just one selection, select the next cell, and wrap // when you get to the edges of the table. if (!multColsSelected && !multRowsSelected) { if (e.getActionCommand().indexOf("Column") != -1) advanceSingleSelection(colModel, colMax, rowModel, rowMax, (e.getActionCommand().equals ("selectPreviousColumnCell"))); else advanceSingleSelection(rowModel, rowMax, colModel, colMax, (e.getActionCommand().equals ("selectPreviousRowCell"))); return; } // rowMinSelected and rowMaxSelected are the minimum and maximum // values respectively of selected cells in the row selection model // Similarly for colMinSelected and colMaxSelected. int rowMaxSelected = table.getRowSelectionAllowed() ? rowModel.getMaxSelectionIndex() : table.getModel().getRowCount() - 1; int rowMinSelected = table.getRowSelectionAllowed() ? rowModel.getMinSelectionIndex() : 0; int colMaxSelected = table.getColumnSelectionAllowed() ? colModel.getMaxSelectionIndex() : table.getModel().getColumnCount() - 1; int colMinSelected = table.getColumnSelectionAllowed() ? colModel.getMinSelectionIndex() : 0; // If there are multiple rows and columns selected, select the next // cell and wrap at the edges of the selection. if (e.getActionCommand().indexOf("Column") != -1) advanceMultipleSelection(colModel, colMinSelected, colMaxSelected, rowModel, rowMinSelected, rowMaxSelected, (e.getActionCommand().equals ("selectPreviousColumnCell")), true); else advanceMultipleSelection(rowModel, rowMinSelected, rowMaxSelected, colModel, colMinSelected, colMaxSelected, (e.getActionCommand().equals ("selectPreviousRowCell")), false); } else if (e.getActionCommand().equals("selectNextColumn")) { rowModel.setSelectionInterval(rowLead,rowLead); colModel.setSelectionInterval(Math.min(colLead + 1, colMax), Math.min(colLead + 1, colMax)); } else if (e.getActionCommand().equals("scrollLeftExtendSelection")) { int target; if (colLead == getFirstVisibleColumnIndex()) target = Math.max (0, colLead - (getLastVisibleColumnIndex() - getFirstVisibleColumnIndex() + 1)); else target = getFirstVisibleColumnIndex(); colModel.setLeadSelectionIndex(target); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("scrollDownChangeSelection")) { int target; if (rowLead == getLastVisibleRowIndex()) target = Math.min (rowMax, rowLead + (getLastVisibleRowIndex() - getFirstVisibleRowIndex() + 1)); else target = getLastVisibleRowIndex(); rowModel.setSelectionInterval(target, target); colModel.setSelectionInterval(colLead, colLead); } else if (e.getActionCommand().equals("scrollRightExtendSelection")) { int target; if (colLead == getLastVisibleColumnIndex()) target = Math.min (colMax, colLead + (getLastVisibleColumnIndex() - getFirstVisibleColumnIndex() + 1)); else target = getLastVisibleColumnIndex(); colModel.setLeadSelectionIndex(target); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectAll")) { table.selectAll(); } else if (e.getActionCommand().equals("selectLastRowExtendSelection")) { rowModel.setLeadSelectionIndex(rowMax); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("scrollDownExtendSelection")) { int target; if (rowLead == getLastVisibleRowIndex()) target = Math.min (rowMax, rowLead + (getLastVisibleRowIndex() - getFirstVisibleRowIndex() + 1)); else target = getLastVisibleRowIndex(); rowModel.setLeadSelectionIndex(target); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("scrollUpChangeSelection")) { int target; if (rowLead == getFirstVisibleRowIndex()) target = Math.max (0, rowLead - (getLastVisibleRowIndex() - getFirstVisibleRowIndex() + 1)); else target = getFirstVisibleRowIndex(); rowModel.setSelectionInterval(target, target); colModel.setSelectionInterval(colLead, colLead); } else { // If we're here that means we bound this TableAction class // to a keyboard input but we either want to ignore that input // or we just haven't implemented its action yet. } if (table.isEditing() && e.getActionCommand() != "startEditing") table.editingCanceled(new ChangeEvent("update")); table.repaint(); table.scrollRectToVisible (table.getCellRect(rowModel.getLeadSelectionIndex(), colModel.getLeadSelectionIndex(), false)); }
1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/963ae61676e8c35a9e0998e0b7de1f942db82a26/BasicTableUI.java/buggy/core/src/classpath/javax/javax/swing/plaf/basic/BasicTableUI.java
else if (e.getActionCommand().equals("scrollLeftExtendSelection"))
else if (command.equals("scrollLeftExtendSelection"))
public void actionPerformed (ActionEvent e) { ListSelectionModel rowModel = table.getSelectionModel(); ListSelectionModel colModel = table.getColumnModel().getSelectionModel(); int rowLead = rowModel.getLeadSelectionIndex(); int rowMax = table.getModel().getRowCount() - 1; int colLead = colModel.getLeadSelectionIndex(); int colMax = table.getModel().getColumnCount() - 1; if (e.getActionCommand().equals("selectPreviousRowExtendSelection")) { rowModel.setLeadSelectionIndex(Math.max(rowLead - 1, 0)); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("selectLastColumn")) { table.clearSelection(); rowModel.setSelectionInterval(rowLead, rowLead); colModel.setSelectionInterval(colMax, colMax); } else if (e.getActionCommand().equals("startEditing")) { if (table.isCellEditable(rowLead, colLead)) table.editCellAt(rowLead,colLead); } else if (e.getActionCommand().equals("selectFirstRowExtendSelection")) { rowModel.setLeadSelectionIndex(0); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("selectFirstColumn")) { rowModel.setSelectionInterval(rowLead, rowLead); colModel.setSelectionInterval(0, 0); } else if (e.getActionCommand().equals("selectFirstColumnExtendSelection")) { colModel.setLeadSelectionIndex(0); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectLastRow")) { rowModel.setSelectionInterval(rowMax,rowMax); colModel.setSelectionInterval(colLead, colLead); } else if (e.getActionCommand().equals("selectNextRowExtendSelection")) { rowModel.setLeadSelectionIndex(Math.min(rowLead + 1, rowMax)); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("selectFirstRow")) { rowModel.setSelectionInterval(0,0); colModel.setSelectionInterval(colLead, colLead); } else if (e.getActionCommand().equals("selectNextColumnExtendSelection")) { colModel.setLeadSelectionIndex(Math.min(colLead + 1, colMax)); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectLastColumnExtendSelection")) { colModel.setLeadSelectionIndex(colMax); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectPreviousColumnExtendSelection")) { colModel.setLeadSelectionIndex(Math.max(colLead - 1, 0)); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectNextRow")) { rowModel.setSelectionInterval(Math.min(rowLead + 1, rowMax), Math.min(rowLead + 1, rowMax)); colModel.setSelectionInterval(colLead,colLead); } else if (e.getActionCommand().equals("scrollUpExtendSelection")) { int target; if (rowLead == getFirstVisibleRowIndex()) target = Math.max (0, rowLead - (getLastVisibleRowIndex() - getFirstVisibleRowIndex() + 1)); else target = getFirstVisibleRowIndex(); rowModel.setLeadSelectionIndex(target); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("selectPreviousRow")) { rowModel.setSelectionInterval(Math.max(rowLead - 1, 0), Math.max(rowLead - 1, 0)); colModel.setSelectionInterval(colLead,colLead); } else if (e.getActionCommand().equals("scrollRightChangeSelection")) { int target; if (colLead == getLastVisibleColumnIndex()) target = Math.min (colMax, colLead + (getLastVisibleColumnIndex() - getFirstVisibleColumnIndex() + 1)); else target = getLastVisibleColumnIndex(); colModel.setSelectionInterval(target, target); rowModel.setSelectionInterval(rowLead, rowLead); } else if (e.getActionCommand().equals("selectPreviousColumn")) { rowModel.setSelectionInterval(rowLead,rowLead); colModel.setSelectionInterval(Math.max(colLead - 1, 0), Math.max(colLead - 1, 0)); } else if (e.getActionCommand().equals("scrollLeftChangeSelection")) { int target; if (colLead == getFirstVisibleColumnIndex()) target = Math.max (0, colLead - (getLastVisibleColumnIndex() - getFirstVisibleColumnIndex() + 1)); else target = getFirstVisibleColumnIndex(); colModel.setSelectionInterval(target, target); rowModel.setSelectionInterval(rowLead, rowLead); } else if (e.getActionCommand().equals("clearSelection")) { table.clearSelection(); } else if (e.getActionCommand().equals("cancel")) { // FIXME: implement other parts of "cancel" like undo-ing last // selection. Right now it just calls editingCancelled if // we're currently editing. if (table.isEditing()) table.editingCanceled(new ChangeEvent("cancel")); } else if (e.getActionCommand().equals("selectNextRowCell") || e.getActionCommand().equals("selectPreviousRowCell") || e.getActionCommand().equals("selectNextColumnCell") || e.getActionCommand().equals("selectPreviousColumnCell")) { // If nothing is selected, select the first cell in the table if (table.getSelectedRowCount() == 0 && table.getSelectedColumnCount() == 0) { rowModel.setSelectionInterval(0, 0); colModel.setSelectionInterval(0, 0); return; } // If the lead selection index isn't selected (ie a remove operation // happened, then set the lead to the first selected cell in the // table if (!table.isCellSelected(rowLead, colLead)) { rowModel.addSelectionInterval(rowModel.getMinSelectionIndex(), rowModel.getMinSelectionIndex()); colModel.addSelectionInterval(colModel.getMinSelectionIndex(), colModel.getMinSelectionIndex()); return; } // multRowsSelected and multColsSelected tell us if multiple rows or // columns are selected, respectively boolean multRowsSelected, multColsSelected; multRowsSelected = table.getSelectedRowCount() > 1 && table.getRowSelectionAllowed(); multColsSelected = table.getSelectedColumnCount() > 1 && table.getColumnSelectionAllowed(); // If there is just one selection, select the next cell, and wrap // when you get to the edges of the table. if (!multColsSelected && !multRowsSelected) { if (e.getActionCommand().indexOf("Column") != -1) advanceSingleSelection(colModel, colMax, rowModel, rowMax, (e.getActionCommand().equals ("selectPreviousColumnCell"))); else advanceSingleSelection(rowModel, rowMax, colModel, colMax, (e.getActionCommand().equals ("selectPreviousRowCell"))); return; } // rowMinSelected and rowMaxSelected are the minimum and maximum // values respectively of selected cells in the row selection model // Similarly for colMinSelected and colMaxSelected. int rowMaxSelected = table.getRowSelectionAllowed() ? rowModel.getMaxSelectionIndex() : table.getModel().getRowCount() - 1; int rowMinSelected = table.getRowSelectionAllowed() ? rowModel.getMinSelectionIndex() : 0; int colMaxSelected = table.getColumnSelectionAllowed() ? colModel.getMaxSelectionIndex() : table.getModel().getColumnCount() - 1; int colMinSelected = table.getColumnSelectionAllowed() ? colModel.getMinSelectionIndex() : 0; // If there are multiple rows and columns selected, select the next // cell and wrap at the edges of the selection. if (e.getActionCommand().indexOf("Column") != -1) advanceMultipleSelection(colModel, colMinSelected, colMaxSelected, rowModel, rowMinSelected, rowMaxSelected, (e.getActionCommand().equals ("selectPreviousColumnCell")), true); else advanceMultipleSelection(rowModel, rowMinSelected, rowMaxSelected, colModel, colMinSelected, colMaxSelected, (e.getActionCommand().equals ("selectPreviousRowCell")), false); } else if (e.getActionCommand().equals("selectNextColumn")) { rowModel.setSelectionInterval(rowLead,rowLead); colModel.setSelectionInterval(Math.min(colLead + 1, colMax), Math.min(colLead + 1, colMax)); } else if (e.getActionCommand().equals("scrollLeftExtendSelection")) { int target; if (colLead == getFirstVisibleColumnIndex()) target = Math.max (0, colLead - (getLastVisibleColumnIndex() - getFirstVisibleColumnIndex() + 1)); else target = getFirstVisibleColumnIndex(); colModel.setLeadSelectionIndex(target); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("scrollDownChangeSelection")) { int target; if (rowLead == getLastVisibleRowIndex()) target = Math.min (rowMax, rowLead + (getLastVisibleRowIndex() - getFirstVisibleRowIndex() + 1)); else target = getLastVisibleRowIndex(); rowModel.setSelectionInterval(target, target); colModel.setSelectionInterval(colLead, colLead); } else if (e.getActionCommand().equals("scrollRightExtendSelection")) { int target; if (colLead == getLastVisibleColumnIndex()) target = Math.min (colMax, colLead + (getLastVisibleColumnIndex() - getFirstVisibleColumnIndex() + 1)); else target = getLastVisibleColumnIndex(); colModel.setLeadSelectionIndex(target); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectAll")) { table.selectAll(); } else if (e.getActionCommand().equals("selectLastRowExtendSelection")) { rowModel.setLeadSelectionIndex(rowMax); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("scrollDownExtendSelection")) { int target; if (rowLead == getLastVisibleRowIndex()) target = Math.min (rowMax, rowLead + (getLastVisibleRowIndex() - getFirstVisibleRowIndex() + 1)); else target = getLastVisibleRowIndex(); rowModel.setLeadSelectionIndex(target); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("scrollUpChangeSelection")) { int target; if (rowLead == getFirstVisibleRowIndex()) target = Math.max (0, rowLead - (getLastVisibleRowIndex() - getFirstVisibleRowIndex() + 1)); else target = getFirstVisibleRowIndex(); rowModel.setSelectionInterval(target, target); colModel.setSelectionInterval(colLead, colLead); } else { // If we're here that means we bound this TableAction class // to a keyboard input but we either want to ignore that input // or we just haven't implemented its action yet. } if (table.isEditing() && e.getActionCommand() != "startEditing") table.editingCanceled(new ChangeEvent("update")); table.repaint(); table.scrollRectToVisible (table.getCellRect(rowModel.getLeadSelectionIndex(), colModel.getLeadSelectionIndex(), false)); }
1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/963ae61676e8c35a9e0998e0b7de1f942db82a26/BasicTableUI.java/buggy/core/src/classpath/javax/javax/swing/plaf/basic/BasicTableUI.java
else if (e.getActionCommand().equals("scrollDownChangeSelection"))
else if (command.equals("scrollDownChangeSelection"))
public void actionPerformed (ActionEvent e) { ListSelectionModel rowModel = table.getSelectionModel(); ListSelectionModel colModel = table.getColumnModel().getSelectionModel(); int rowLead = rowModel.getLeadSelectionIndex(); int rowMax = table.getModel().getRowCount() - 1; int colLead = colModel.getLeadSelectionIndex(); int colMax = table.getModel().getColumnCount() - 1; if (e.getActionCommand().equals("selectPreviousRowExtendSelection")) { rowModel.setLeadSelectionIndex(Math.max(rowLead - 1, 0)); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("selectLastColumn")) { table.clearSelection(); rowModel.setSelectionInterval(rowLead, rowLead); colModel.setSelectionInterval(colMax, colMax); } else if (e.getActionCommand().equals("startEditing")) { if (table.isCellEditable(rowLead, colLead)) table.editCellAt(rowLead,colLead); } else if (e.getActionCommand().equals("selectFirstRowExtendSelection")) { rowModel.setLeadSelectionIndex(0); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("selectFirstColumn")) { rowModel.setSelectionInterval(rowLead, rowLead); colModel.setSelectionInterval(0, 0); } else if (e.getActionCommand().equals("selectFirstColumnExtendSelection")) { colModel.setLeadSelectionIndex(0); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectLastRow")) { rowModel.setSelectionInterval(rowMax,rowMax); colModel.setSelectionInterval(colLead, colLead); } else if (e.getActionCommand().equals("selectNextRowExtendSelection")) { rowModel.setLeadSelectionIndex(Math.min(rowLead + 1, rowMax)); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("selectFirstRow")) { rowModel.setSelectionInterval(0,0); colModel.setSelectionInterval(colLead, colLead); } else if (e.getActionCommand().equals("selectNextColumnExtendSelection")) { colModel.setLeadSelectionIndex(Math.min(colLead + 1, colMax)); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectLastColumnExtendSelection")) { colModel.setLeadSelectionIndex(colMax); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectPreviousColumnExtendSelection")) { colModel.setLeadSelectionIndex(Math.max(colLead - 1, 0)); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectNextRow")) { rowModel.setSelectionInterval(Math.min(rowLead + 1, rowMax), Math.min(rowLead + 1, rowMax)); colModel.setSelectionInterval(colLead,colLead); } else if (e.getActionCommand().equals("scrollUpExtendSelection")) { int target; if (rowLead == getFirstVisibleRowIndex()) target = Math.max (0, rowLead - (getLastVisibleRowIndex() - getFirstVisibleRowIndex() + 1)); else target = getFirstVisibleRowIndex(); rowModel.setLeadSelectionIndex(target); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("selectPreviousRow")) { rowModel.setSelectionInterval(Math.max(rowLead - 1, 0), Math.max(rowLead - 1, 0)); colModel.setSelectionInterval(colLead,colLead); } else if (e.getActionCommand().equals("scrollRightChangeSelection")) { int target; if (colLead == getLastVisibleColumnIndex()) target = Math.min (colMax, colLead + (getLastVisibleColumnIndex() - getFirstVisibleColumnIndex() + 1)); else target = getLastVisibleColumnIndex(); colModel.setSelectionInterval(target, target); rowModel.setSelectionInterval(rowLead, rowLead); } else if (e.getActionCommand().equals("selectPreviousColumn")) { rowModel.setSelectionInterval(rowLead,rowLead); colModel.setSelectionInterval(Math.max(colLead - 1, 0), Math.max(colLead - 1, 0)); } else if (e.getActionCommand().equals("scrollLeftChangeSelection")) { int target; if (colLead == getFirstVisibleColumnIndex()) target = Math.max (0, colLead - (getLastVisibleColumnIndex() - getFirstVisibleColumnIndex() + 1)); else target = getFirstVisibleColumnIndex(); colModel.setSelectionInterval(target, target); rowModel.setSelectionInterval(rowLead, rowLead); } else if (e.getActionCommand().equals("clearSelection")) { table.clearSelection(); } else if (e.getActionCommand().equals("cancel")) { // FIXME: implement other parts of "cancel" like undo-ing last // selection. Right now it just calls editingCancelled if // we're currently editing. if (table.isEditing()) table.editingCanceled(new ChangeEvent("cancel")); } else if (e.getActionCommand().equals("selectNextRowCell") || e.getActionCommand().equals("selectPreviousRowCell") || e.getActionCommand().equals("selectNextColumnCell") || e.getActionCommand().equals("selectPreviousColumnCell")) { // If nothing is selected, select the first cell in the table if (table.getSelectedRowCount() == 0 && table.getSelectedColumnCount() == 0) { rowModel.setSelectionInterval(0, 0); colModel.setSelectionInterval(0, 0); return; } // If the lead selection index isn't selected (ie a remove operation // happened, then set the lead to the first selected cell in the // table if (!table.isCellSelected(rowLead, colLead)) { rowModel.addSelectionInterval(rowModel.getMinSelectionIndex(), rowModel.getMinSelectionIndex()); colModel.addSelectionInterval(colModel.getMinSelectionIndex(), colModel.getMinSelectionIndex()); return; } // multRowsSelected and multColsSelected tell us if multiple rows or // columns are selected, respectively boolean multRowsSelected, multColsSelected; multRowsSelected = table.getSelectedRowCount() > 1 && table.getRowSelectionAllowed(); multColsSelected = table.getSelectedColumnCount() > 1 && table.getColumnSelectionAllowed(); // If there is just one selection, select the next cell, and wrap // when you get to the edges of the table. if (!multColsSelected && !multRowsSelected) { if (e.getActionCommand().indexOf("Column") != -1) advanceSingleSelection(colModel, colMax, rowModel, rowMax, (e.getActionCommand().equals ("selectPreviousColumnCell"))); else advanceSingleSelection(rowModel, rowMax, colModel, colMax, (e.getActionCommand().equals ("selectPreviousRowCell"))); return; } // rowMinSelected and rowMaxSelected are the minimum and maximum // values respectively of selected cells in the row selection model // Similarly for colMinSelected and colMaxSelected. int rowMaxSelected = table.getRowSelectionAllowed() ? rowModel.getMaxSelectionIndex() : table.getModel().getRowCount() - 1; int rowMinSelected = table.getRowSelectionAllowed() ? rowModel.getMinSelectionIndex() : 0; int colMaxSelected = table.getColumnSelectionAllowed() ? colModel.getMaxSelectionIndex() : table.getModel().getColumnCount() - 1; int colMinSelected = table.getColumnSelectionAllowed() ? colModel.getMinSelectionIndex() : 0; // If there are multiple rows and columns selected, select the next // cell and wrap at the edges of the selection. if (e.getActionCommand().indexOf("Column") != -1) advanceMultipleSelection(colModel, colMinSelected, colMaxSelected, rowModel, rowMinSelected, rowMaxSelected, (e.getActionCommand().equals ("selectPreviousColumnCell")), true); else advanceMultipleSelection(rowModel, rowMinSelected, rowMaxSelected, colModel, colMinSelected, colMaxSelected, (e.getActionCommand().equals ("selectPreviousRowCell")), false); } else if (e.getActionCommand().equals("selectNextColumn")) { rowModel.setSelectionInterval(rowLead,rowLead); colModel.setSelectionInterval(Math.min(colLead + 1, colMax), Math.min(colLead + 1, colMax)); } else if (e.getActionCommand().equals("scrollLeftExtendSelection")) { int target; if (colLead == getFirstVisibleColumnIndex()) target = Math.max (0, colLead - (getLastVisibleColumnIndex() - getFirstVisibleColumnIndex() + 1)); else target = getFirstVisibleColumnIndex(); colModel.setLeadSelectionIndex(target); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("scrollDownChangeSelection")) { int target; if (rowLead == getLastVisibleRowIndex()) target = Math.min (rowMax, rowLead + (getLastVisibleRowIndex() - getFirstVisibleRowIndex() + 1)); else target = getLastVisibleRowIndex(); rowModel.setSelectionInterval(target, target); colModel.setSelectionInterval(colLead, colLead); } else if (e.getActionCommand().equals("scrollRightExtendSelection")) { int target; if (colLead == getLastVisibleColumnIndex()) target = Math.min (colMax, colLead + (getLastVisibleColumnIndex() - getFirstVisibleColumnIndex() + 1)); else target = getLastVisibleColumnIndex(); colModel.setLeadSelectionIndex(target); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectAll")) { table.selectAll(); } else if (e.getActionCommand().equals("selectLastRowExtendSelection")) { rowModel.setLeadSelectionIndex(rowMax); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("scrollDownExtendSelection")) { int target; if (rowLead == getLastVisibleRowIndex()) target = Math.min (rowMax, rowLead + (getLastVisibleRowIndex() - getFirstVisibleRowIndex() + 1)); else target = getLastVisibleRowIndex(); rowModel.setLeadSelectionIndex(target); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("scrollUpChangeSelection")) { int target; if (rowLead == getFirstVisibleRowIndex()) target = Math.max (0, rowLead - (getLastVisibleRowIndex() - getFirstVisibleRowIndex() + 1)); else target = getFirstVisibleRowIndex(); rowModel.setSelectionInterval(target, target); colModel.setSelectionInterval(colLead, colLead); } else { // If we're here that means we bound this TableAction class // to a keyboard input but we either want to ignore that input // or we just haven't implemented its action yet. } if (table.isEditing() && e.getActionCommand() != "startEditing") table.editingCanceled(new ChangeEvent("update")); table.repaint(); table.scrollRectToVisible (table.getCellRect(rowModel.getLeadSelectionIndex(), colModel.getLeadSelectionIndex(), false)); }
1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/963ae61676e8c35a9e0998e0b7de1f942db82a26/BasicTableUI.java/buggy/core/src/classpath/javax/javax/swing/plaf/basic/BasicTableUI.java
else if (e.getActionCommand().equals("scrollRightExtendSelection"))
else if (command.equals("scrollRightExtendSelection"))
public void actionPerformed (ActionEvent e) { ListSelectionModel rowModel = table.getSelectionModel(); ListSelectionModel colModel = table.getColumnModel().getSelectionModel(); int rowLead = rowModel.getLeadSelectionIndex(); int rowMax = table.getModel().getRowCount() - 1; int colLead = colModel.getLeadSelectionIndex(); int colMax = table.getModel().getColumnCount() - 1; if (e.getActionCommand().equals("selectPreviousRowExtendSelection")) { rowModel.setLeadSelectionIndex(Math.max(rowLead - 1, 0)); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("selectLastColumn")) { table.clearSelection(); rowModel.setSelectionInterval(rowLead, rowLead); colModel.setSelectionInterval(colMax, colMax); } else if (e.getActionCommand().equals("startEditing")) { if (table.isCellEditable(rowLead, colLead)) table.editCellAt(rowLead,colLead); } else if (e.getActionCommand().equals("selectFirstRowExtendSelection")) { rowModel.setLeadSelectionIndex(0); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("selectFirstColumn")) { rowModel.setSelectionInterval(rowLead, rowLead); colModel.setSelectionInterval(0, 0); } else if (e.getActionCommand().equals("selectFirstColumnExtendSelection")) { colModel.setLeadSelectionIndex(0); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectLastRow")) { rowModel.setSelectionInterval(rowMax,rowMax); colModel.setSelectionInterval(colLead, colLead); } else if (e.getActionCommand().equals("selectNextRowExtendSelection")) { rowModel.setLeadSelectionIndex(Math.min(rowLead + 1, rowMax)); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("selectFirstRow")) { rowModel.setSelectionInterval(0,0); colModel.setSelectionInterval(colLead, colLead); } else if (e.getActionCommand().equals("selectNextColumnExtendSelection")) { colModel.setLeadSelectionIndex(Math.min(colLead + 1, colMax)); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectLastColumnExtendSelection")) { colModel.setLeadSelectionIndex(colMax); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectPreviousColumnExtendSelection")) { colModel.setLeadSelectionIndex(Math.max(colLead - 1, 0)); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectNextRow")) { rowModel.setSelectionInterval(Math.min(rowLead + 1, rowMax), Math.min(rowLead + 1, rowMax)); colModel.setSelectionInterval(colLead,colLead); } else if (e.getActionCommand().equals("scrollUpExtendSelection")) { int target; if (rowLead == getFirstVisibleRowIndex()) target = Math.max (0, rowLead - (getLastVisibleRowIndex() - getFirstVisibleRowIndex() + 1)); else target = getFirstVisibleRowIndex(); rowModel.setLeadSelectionIndex(target); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("selectPreviousRow")) { rowModel.setSelectionInterval(Math.max(rowLead - 1, 0), Math.max(rowLead - 1, 0)); colModel.setSelectionInterval(colLead,colLead); } else if (e.getActionCommand().equals("scrollRightChangeSelection")) { int target; if (colLead == getLastVisibleColumnIndex()) target = Math.min (colMax, colLead + (getLastVisibleColumnIndex() - getFirstVisibleColumnIndex() + 1)); else target = getLastVisibleColumnIndex(); colModel.setSelectionInterval(target, target); rowModel.setSelectionInterval(rowLead, rowLead); } else if (e.getActionCommand().equals("selectPreviousColumn")) { rowModel.setSelectionInterval(rowLead,rowLead); colModel.setSelectionInterval(Math.max(colLead - 1, 0), Math.max(colLead - 1, 0)); } else if (e.getActionCommand().equals("scrollLeftChangeSelection")) { int target; if (colLead == getFirstVisibleColumnIndex()) target = Math.max (0, colLead - (getLastVisibleColumnIndex() - getFirstVisibleColumnIndex() + 1)); else target = getFirstVisibleColumnIndex(); colModel.setSelectionInterval(target, target); rowModel.setSelectionInterval(rowLead, rowLead); } else if (e.getActionCommand().equals("clearSelection")) { table.clearSelection(); } else if (e.getActionCommand().equals("cancel")) { // FIXME: implement other parts of "cancel" like undo-ing last // selection. Right now it just calls editingCancelled if // we're currently editing. if (table.isEditing()) table.editingCanceled(new ChangeEvent("cancel")); } else if (e.getActionCommand().equals("selectNextRowCell") || e.getActionCommand().equals("selectPreviousRowCell") || e.getActionCommand().equals("selectNextColumnCell") || e.getActionCommand().equals("selectPreviousColumnCell")) { // If nothing is selected, select the first cell in the table if (table.getSelectedRowCount() == 0 && table.getSelectedColumnCount() == 0) { rowModel.setSelectionInterval(0, 0); colModel.setSelectionInterval(0, 0); return; } // If the lead selection index isn't selected (ie a remove operation // happened, then set the lead to the first selected cell in the // table if (!table.isCellSelected(rowLead, colLead)) { rowModel.addSelectionInterval(rowModel.getMinSelectionIndex(), rowModel.getMinSelectionIndex()); colModel.addSelectionInterval(colModel.getMinSelectionIndex(), colModel.getMinSelectionIndex()); return; } // multRowsSelected and multColsSelected tell us if multiple rows or // columns are selected, respectively boolean multRowsSelected, multColsSelected; multRowsSelected = table.getSelectedRowCount() > 1 && table.getRowSelectionAllowed(); multColsSelected = table.getSelectedColumnCount() > 1 && table.getColumnSelectionAllowed(); // If there is just one selection, select the next cell, and wrap // when you get to the edges of the table. if (!multColsSelected && !multRowsSelected) { if (e.getActionCommand().indexOf("Column") != -1) advanceSingleSelection(colModel, colMax, rowModel, rowMax, (e.getActionCommand().equals ("selectPreviousColumnCell"))); else advanceSingleSelection(rowModel, rowMax, colModel, colMax, (e.getActionCommand().equals ("selectPreviousRowCell"))); return; } // rowMinSelected and rowMaxSelected are the minimum and maximum // values respectively of selected cells in the row selection model // Similarly for colMinSelected and colMaxSelected. int rowMaxSelected = table.getRowSelectionAllowed() ? rowModel.getMaxSelectionIndex() : table.getModel().getRowCount() - 1; int rowMinSelected = table.getRowSelectionAllowed() ? rowModel.getMinSelectionIndex() : 0; int colMaxSelected = table.getColumnSelectionAllowed() ? colModel.getMaxSelectionIndex() : table.getModel().getColumnCount() - 1; int colMinSelected = table.getColumnSelectionAllowed() ? colModel.getMinSelectionIndex() : 0; // If there are multiple rows and columns selected, select the next // cell and wrap at the edges of the selection. if (e.getActionCommand().indexOf("Column") != -1) advanceMultipleSelection(colModel, colMinSelected, colMaxSelected, rowModel, rowMinSelected, rowMaxSelected, (e.getActionCommand().equals ("selectPreviousColumnCell")), true); else advanceMultipleSelection(rowModel, rowMinSelected, rowMaxSelected, colModel, colMinSelected, colMaxSelected, (e.getActionCommand().equals ("selectPreviousRowCell")), false); } else if (e.getActionCommand().equals("selectNextColumn")) { rowModel.setSelectionInterval(rowLead,rowLead); colModel.setSelectionInterval(Math.min(colLead + 1, colMax), Math.min(colLead + 1, colMax)); } else if (e.getActionCommand().equals("scrollLeftExtendSelection")) { int target; if (colLead == getFirstVisibleColumnIndex()) target = Math.max (0, colLead - (getLastVisibleColumnIndex() - getFirstVisibleColumnIndex() + 1)); else target = getFirstVisibleColumnIndex(); colModel.setLeadSelectionIndex(target); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("scrollDownChangeSelection")) { int target; if (rowLead == getLastVisibleRowIndex()) target = Math.min (rowMax, rowLead + (getLastVisibleRowIndex() - getFirstVisibleRowIndex() + 1)); else target = getLastVisibleRowIndex(); rowModel.setSelectionInterval(target, target); colModel.setSelectionInterval(colLead, colLead); } else if (e.getActionCommand().equals("scrollRightExtendSelection")) { int target; if (colLead == getLastVisibleColumnIndex()) target = Math.min (colMax, colLead + (getLastVisibleColumnIndex() - getFirstVisibleColumnIndex() + 1)); else target = getLastVisibleColumnIndex(); colModel.setLeadSelectionIndex(target); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectAll")) { table.selectAll(); } else if (e.getActionCommand().equals("selectLastRowExtendSelection")) { rowModel.setLeadSelectionIndex(rowMax); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("scrollDownExtendSelection")) { int target; if (rowLead == getLastVisibleRowIndex()) target = Math.min (rowMax, rowLead + (getLastVisibleRowIndex() - getFirstVisibleRowIndex() + 1)); else target = getLastVisibleRowIndex(); rowModel.setLeadSelectionIndex(target); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("scrollUpChangeSelection")) { int target; if (rowLead == getFirstVisibleRowIndex()) target = Math.max (0, rowLead - (getLastVisibleRowIndex() - getFirstVisibleRowIndex() + 1)); else target = getFirstVisibleRowIndex(); rowModel.setSelectionInterval(target, target); colModel.setSelectionInterval(colLead, colLead); } else { // If we're here that means we bound this TableAction class // to a keyboard input but we either want to ignore that input // or we just haven't implemented its action yet. } if (table.isEditing() && e.getActionCommand() != "startEditing") table.editingCanceled(new ChangeEvent("update")); table.repaint(); table.scrollRectToVisible (table.getCellRect(rowModel.getLeadSelectionIndex(), colModel.getLeadSelectionIndex(), false)); }
1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/963ae61676e8c35a9e0998e0b7de1f942db82a26/BasicTableUI.java/buggy/core/src/classpath/javax/javax/swing/plaf/basic/BasicTableUI.java
else if (e.getActionCommand().equals("selectAll"))
else if (command.equals("selectAll"))
public void actionPerformed (ActionEvent e) { ListSelectionModel rowModel = table.getSelectionModel(); ListSelectionModel colModel = table.getColumnModel().getSelectionModel(); int rowLead = rowModel.getLeadSelectionIndex(); int rowMax = table.getModel().getRowCount() - 1; int colLead = colModel.getLeadSelectionIndex(); int colMax = table.getModel().getColumnCount() - 1; if (e.getActionCommand().equals("selectPreviousRowExtendSelection")) { rowModel.setLeadSelectionIndex(Math.max(rowLead - 1, 0)); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("selectLastColumn")) { table.clearSelection(); rowModel.setSelectionInterval(rowLead, rowLead); colModel.setSelectionInterval(colMax, colMax); } else if (e.getActionCommand().equals("startEditing")) { if (table.isCellEditable(rowLead, colLead)) table.editCellAt(rowLead,colLead); } else if (e.getActionCommand().equals("selectFirstRowExtendSelection")) { rowModel.setLeadSelectionIndex(0); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("selectFirstColumn")) { rowModel.setSelectionInterval(rowLead, rowLead); colModel.setSelectionInterval(0, 0); } else if (e.getActionCommand().equals("selectFirstColumnExtendSelection")) { colModel.setLeadSelectionIndex(0); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectLastRow")) { rowModel.setSelectionInterval(rowMax,rowMax); colModel.setSelectionInterval(colLead, colLead); } else if (e.getActionCommand().equals("selectNextRowExtendSelection")) { rowModel.setLeadSelectionIndex(Math.min(rowLead + 1, rowMax)); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("selectFirstRow")) { rowModel.setSelectionInterval(0,0); colModel.setSelectionInterval(colLead, colLead); } else if (e.getActionCommand().equals("selectNextColumnExtendSelection")) { colModel.setLeadSelectionIndex(Math.min(colLead + 1, colMax)); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectLastColumnExtendSelection")) { colModel.setLeadSelectionIndex(colMax); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectPreviousColumnExtendSelection")) { colModel.setLeadSelectionIndex(Math.max(colLead - 1, 0)); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectNextRow")) { rowModel.setSelectionInterval(Math.min(rowLead + 1, rowMax), Math.min(rowLead + 1, rowMax)); colModel.setSelectionInterval(colLead,colLead); } else if (e.getActionCommand().equals("scrollUpExtendSelection")) { int target; if (rowLead == getFirstVisibleRowIndex()) target = Math.max (0, rowLead - (getLastVisibleRowIndex() - getFirstVisibleRowIndex() + 1)); else target = getFirstVisibleRowIndex(); rowModel.setLeadSelectionIndex(target); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("selectPreviousRow")) { rowModel.setSelectionInterval(Math.max(rowLead - 1, 0), Math.max(rowLead - 1, 0)); colModel.setSelectionInterval(colLead,colLead); } else if (e.getActionCommand().equals("scrollRightChangeSelection")) { int target; if (colLead == getLastVisibleColumnIndex()) target = Math.min (colMax, colLead + (getLastVisibleColumnIndex() - getFirstVisibleColumnIndex() + 1)); else target = getLastVisibleColumnIndex(); colModel.setSelectionInterval(target, target); rowModel.setSelectionInterval(rowLead, rowLead); } else if (e.getActionCommand().equals("selectPreviousColumn")) { rowModel.setSelectionInterval(rowLead,rowLead); colModel.setSelectionInterval(Math.max(colLead - 1, 0), Math.max(colLead - 1, 0)); } else if (e.getActionCommand().equals("scrollLeftChangeSelection")) { int target; if (colLead == getFirstVisibleColumnIndex()) target = Math.max (0, colLead - (getLastVisibleColumnIndex() - getFirstVisibleColumnIndex() + 1)); else target = getFirstVisibleColumnIndex(); colModel.setSelectionInterval(target, target); rowModel.setSelectionInterval(rowLead, rowLead); } else if (e.getActionCommand().equals("clearSelection")) { table.clearSelection(); } else if (e.getActionCommand().equals("cancel")) { // FIXME: implement other parts of "cancel" like undo-ing last // selection. Right now it just calls editingCancelled if // we're currently editing. if (table.isEditing()) table.editingCanceled(new ChangeEvent("cancel")); } else if (e.getActionCommand().equals("selectNextRowCell") || e.getActionCommand().equals("selectPreviousRowCell") || e.getActionCommand().equals("selectNextColumnCell") || e.getActionCommand().equals("selectPreviousColumnCell")) { // If nothing is selected, select the first cell in the table if (table.getSelectedRowCount() == 0 && table.getSelectedColumnCount() == 0) { rowModel.setSelectionInterval(0, 0); colModel.setSelectionInterval(0, 0); return; } // If the lead selection index isn't selected (ie a remove operation // happened, then set the lead to the first selected cell in the // table if (!table.isCellSelected(rowLead, colLead)) { rowModel.addSelectionInterval(rowModel.getMinSelectionIndex(), rowModel.getMinSelectionIndex()); colModel.addSelectionInterval(colModel.getMinSelectionIndex(), colModel.getMinSelectionIndex()); return; } // multRowsSelected and multColsSelected tell us if multiple rows or // columns are selected, respectively boolean multRowsSelected, multColsSelected; multRowsSelected = table.getSelectedRowCount() > 1 && table.getRowSelectionAllowed(); multColsSelected = table.getSelectedColumnCount() > 1 && table.getColumnSelectionAllowed(); // If there is just one selection, select the next cell, and wrap // when you get to the edges of the table. if (!multColsSelected && !multRowsSelected) { if (e.getActionCommand().indexOf("Column") != -1) advanceSingleSelection(colModel, colMax, rowModel, rowMax, (e.getActionCommand().equals ("selectPreviousColumnCell"))); else advanceSingleSelection(rowModel, rowMax, colModel, colMax, (e.getActionCommand().equals ("selectPreviousRowCell"))); return; } // rowMinSelected and rowMaxSelected are the minimum and maximum // values respectively of selected cells in the row selection model // Similarly for colMinSelected and colMaxSelected. int rowMaxSelected = table.getRowSelectionAllowed() ? rowModel.getMaxSelectionIndex() : table.getModel().getRowCount() - 1; int rowMinSelected = table.getRowSelectionAllowed() ? rowModel.getMinSelectionIndex() : 0; int colMaxSelected = table.getColumnSelectionAllowed() ? colModel.getMaxSelectionIndex() : table.getModel().getColumnCount() - 1; int colMinSelected = table.getColumnSelectionAllowed() ? colModel.getMinSelectionIndex() : 0; // If there are multiple rows and columns selected, select the next // cell and wrap at the edges of the selection. if (e.getActionCommand().indexOf("Column") != -1) advanceMultipleSelection(colModel, colMinSelected, colMaxSelected, rowModel, rowMinSelected, rowMaxSelected, (e.getActionCommand().equals ("selectPreviousColumnCell")), true); else advanceMultipleSelection(rowModel, rowMinSelected, rowMaxSelected, colModel, colMinSelected, colMaxSelected, (e.getActionCommand().equals ("selectPreviousRowCell")), false); } else if (e.getActionCommand().equals("selectNextColumn")) { rowModel.setSelectionInterval(rowLead,rowLead); colModel.setSelectionInterval(Math.min(colLead + 1, colMax), Math.min(colLead + 1, colMax)); } else if (e.getActionCommand().equals("scrollLeftExtendSelection")) { int target; if (colLead == getFirstVisibleColumnIndex()) target = Math.max (0, colLead - (getLastVisibleColumnIndex() - getFirstVisibleColumnIndex() + 1)); else target = getFirstVisibleColumnIndex(); colModel.setLeadSelectionIndex(target); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("scrollDownChangeSelection")) { int target; if (rowLead == getLastVisibleRowIndex()) target = Math.min (rowMax, rowLead + (getLastVisibleRowIndex() - getFirstVisibleRowIndex() + 1)); else target = getLastVisibleRowIndex(); rowModel.setSelectionInterval(target, target); colModel.setSelectionInterval(colLead, colLead); } else if (e.getActionCommand().equals("scrollRightExtendSelection")) { int target; if (colLead == getLastVisibleColumnIndex()) target = Math.min (colMax, colLead + (getLastVisibleColumnIndex() - getFirstVisibleColumnIndex() + 1)); else target = getLastVisibleColumnIndex(); colModel.setLeadSelectionIndex(target); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectAll")) { table.selectAll(); } else if (e.getActionCommand().equals("selectLastRowExtendSelection")) { rowModel.setLeadSelectionIndex(rowMax); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("scrollDownExtendSelection")) { int target; if (rowLead == getLastVisibleRowIndex()) target = Math.min (rowMax, rowLead + (getLastVisibleRowIndex() - getFirstVisibleRowIndex() + 1)); else target = getLastVisibleRowIndex(); rowModel.setLeadSelectionIndex(target); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("scrollUpChangeSelection")) { int target; if (rowLead == getFirstVisibleRowIndex()) target = Math.max (0, rowLead - (getLastVisibleRowIndex() - getFirstVisibleRowIndex() + 1)); else target = getFirstVisibleRowIndex(); rowModel.setSelectionInterval(target, target); colModel.setSelectionInterval(colLead, colLead); } else { // If we're here that means we bound this TableAction class // to a keyboard input but we either want to ignore that input // or we just haven't implemented its action yet. } if (table.isEditing() && e.getActionCommand() != "startEditing") table.editingCanceled(new ChangeEvent("update")); table.repaint(); table.scrollRectToVisible (table.getCellRect(rowModel.getLeadSelectionIndex(), colModel.getLeadSelectionIndex(), false)); }
1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/963ae61676e8c35a9e0998e0b7de1f942db82a26/BasicTableUI.java/buggy/core/src/classpath/javax/javax/swing/plaf/basic/BasicTableUI.java
else if (e.getActionCommand().equals("selectLastRowExtendSelection"))
else if (command.equals("selectLastRowExtendSelection"))
public void actionPerformed (ActionEvent e) { ListSelectionModel rowModel = table.getSelectionModel(); ListSelectionModel colModel = table.getColumnModel().getSelectionModel(); int rowLead = rowModel.getLeadSelectionIndex(); int rowMax = table.getModel().getRowCount() - 1; int colLead = colModel.getLeadSelectionIndex(); int colMax = table.getModel().getColumnCount() - 1; if (e.getActionCommand().equals("selectPreviousRowExtendSelection")) { rowModel.setLeadSelectionIndex(Math.max(rowLead - 1, 0)); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("selectLastColumn")) { table.clearSelection(); rowModel.setSelectionInterval(rowLead, rowLead); colModel.setSelectionInterval(colMax, colMax); } else if (e.getActionCommand().equals("startEditing")) { if (table.isCellEditable(rowLead, colLead)) table.editCellAt(rowLead,colLead); } else if (e.getActionCommand().equals("selectFirstRowExtendSelection")) { rowModel.setLeadSelectionIndex(0); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("selectFirstColumn")) { rowModel.setSelectionInterval(rowLead, rowLead); colModel.setSelectionInterval(0, 0); } else if (e.getActionCommand().equals("selectFirstColumnExtendSelection")) { colModel.setLeadSelectionIndex(0); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectLastRow")) { rowModel.setSelectionInterval(rowMax,rowMax); colModel.setSelectionInterval(colLead, colLead); } else if (e.getActionCommand().equals("selectNextRowExtendSelection")) { rowModel.setLeadSelectionIndex(Math.min(rowLead + 1, rowMax)); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("selectFirstRow")) { rowModel.setSelectionInterval(0,0); colModel.setSelectionInterval(colLead, colLead); } else if (e.getActionCommand().equals("selectNextColumnExtendSelection")) { colModel.setLeadSelectionIndex(Math.min(colLead + 1, colMax)); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectLastColumnExtendSelection")) { colModel.setLeadSelectionIndex(colMax); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectPreviousColumnExtendSelection")) { colModel.setLeadSelectionIndex(Math.max(colLead - 1, 0)); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectNextRow")) { rowModel.setSelectionInterval(Math.min(rowLead + 1, rowMax), Math.min(rowLead + 1, rowMax)); colModel.setSelectionInterval(colLead,colLead); } else if (e.getActionCommand().equals("scrollUpExtendSelection")) { int target; if (rowLead == getFirstVisibleRowIndex()) target = Math.max (0, rowLead - (getLastVisibleRowIndex() - getFirstVisibleRowIndex() + 1)); else target = getFirstVisibleRowIndex(); rowModel.setLeadSelectionIndex(target); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("selectPreviousRow")) { rowModel.setSelectionInterval(Math.max(rowLead - 1, 0), Math.max(rowLead - 1, 0)); colModel.setSelectionInterval(colLead,colLead); } else if (e.getActionCommand().equals("scrollRightChangeSelection")) { int target; if (colLead == getLastVisibleColumnIndex()) target = Math.min (colMax, colLead + (getLastVisibleColumnIndex() - getFirstVisibleColumnIndex() + 1)); else target = getLastVisibleColumnIndex(); colModel.setSelectionInterval(target, target); rowModel.setSelectionInterval(rowLead, rowLead); } else if (e.getActionCommand().equals("selectPreviousColumn")) { rowModel.setSelectionInterval(rowLead,rowLead); colModel.setSelectionInterval(Math.max(colLead - 1, 0), Math.max(colLead - 1, 0)); } else if (e.getActionCommand().equals("scrollLeftChangeSelection")) { int target; if (colLead == getFirstVisibleColumnIndex()) target = Math.max (0, colLead - (getLastVisibleColumnIndex() - getFirstVisibleColumnIndex() + 1)); else target = getFirstVisibleColumnIndex(); colModel.setSelectionInterval(target, target); rowModel.setSelectionInterval(rowLead, rowLead); } else if (e.getActionCommand().equals("clearSelection")) { table.clearSelection(); } else if (e.getActionCommand().equals("cancel")) { // FIXME: implement other parts of "cancel" like undo-ing last // selection. Right now it just calls editingCancelled if // we're currently editing. if (table.isEditing()) table.editingCanceled(new ChangeEvent("cancel")); } else if (e.getActionCommand().equals("selectNextRowCell") || e.getActionCommand().equals("selectPreviousRowCell") || e.getActionCommand().equals("selectNextColumnCell") || e.getActionCommand().equals("selectPreviousColumnCell")) { // If nothing is selected, select the first cell in the table if (table.getSelectedRowCount() == 0 && table.getSelectedColumnCount() == 0) { rowModel.setSelectionInterval(0, 0); colModel.setSelectionInterval(0, 0); return; } // If the lead selection index isn't selected (ie a remove operation // happened, then set the lead to the first selected cell in the // table if (!table.isCellSelected(rowLead, colLead)) { rowModel.addSelectionInterval(rowModel.getMinSelectionIndex(), rowModel.getMinSelectionIndex()); colModel.addSelectionInterval(colModel.getMinSelectionIndex(), colModel.getMinSelectionIndex()); return; } // multRowsSelected and multColsSelected tell us if multiple rows or // columns are selected, respectively boolean multRowsSelected, multColsSelected; multRowsSelected = table.getSelectedRowCount() > 1 && table.getRowSelectionAllowed(); multColsSelected = table.getSelectedColumnCount() > 1 && table.getColumnSelectionAllowed(); // If there is just one selection, select the next cell, and wrap // when you get to the edges of the table. if (!multColsSelected && !multRowsSelected) { if (e.getActionCommand().indexOf("Column") != -1) advanceSingleSelection(colModel, colMax, rowModel, rowMax, (e.getActionCommand().equals ("selectPreviousColumnCell"))); else advanceSingleSelection(rowModel, rowMax, colModel, colMax, (e.getActionCommand().equals ("selectPreviousRowCell"))); return; } // rowMinSelected and rowMaxSelected are the minimum and maximum // values respectively of selected cells in the row selection model // Similarly for colMinSelected and colMaxSelected. int rowMaxSelected = table.getRowSelectionAllowed() ? rowModel.getMaxSelectionIndex() : table.getModel().getRowCount() - 1; int rowMinSelected = table.getRowSelectionAllowed() ? rowModel.getMinSelectionIndex() : 0; int colMaxSelected = table.getColumnSelectionAllowed() ? colModel.getMaxSelectionIndex() : table.getModel().getColumnCount() - 1; int colMinSelected = table.getColumnSelectionAllowed() ? colModel.getMinSelectionIndex() : 0; // If there are multiple rows and columns selected, select the next // cell and wrap at the edges of the selection. if (e.getActionCommand().indexOf("Column") != -1) advanceMultipleSelection(colModel, colMinSelected, colMaxSelected, rowModel, rowMinSelected, rowMaxSelected, (e.getActionCommand().equals ("selectPreviousColumnCell")), true); else advanceMultipleSelection(rowModel, rowMinSelected, rowMaxSelected, colModel, colMinSelected, colMaxSelected, (e.getActionCommand().equals ("selectPreviousRowCell")), false); } else if (e.getActionCommand().equals("selectNextColumn")) { rowModel.setSelectionInterval(rowLead,rowLead); colModel.setSelectionInterval(Math.min(colLead + 1, colMax), Math.min(colLead + 1, colMax)); } else if (e.getActionCommand().equals("scrollLeftExtendSelection")) { int target; if (colLead == getFirstVisibleColumnIndex()) target = Math.max (0, colLead - (getLastVisibleColumnIndex() - getFirstVisibleColumnIndex() + 1)); else target = getFirstVisibleColumnIndex(); colModel.setLeadSelectionIndex(target); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("scrollDownChangeSelection")) { int target; if (rowLead == getLastVisibleRowIndex()) target = Math.min (rowMax, rowLead + (getLastVisibleRowIndex() - getFirstVisibleRowIndex() + 1)); else target = getLastVisibleRowIndex(); rowModel.setSelectionInterval(target, target); colModel.setSelectionInterval(colLead, colLead); } else if (e.getActionCommand().equals("scrollRightExtendSelection")) { int target; if (colLead == getLastVisibleColumnIndex()) target = Math.min (colMax, colLead + (getLastVisibleColumnIndex() - getFirstVisibleColumnIndex() + 1)); else target = getLastVisibleColumnIndex(); colModel.setLeadSelectionIndex(target); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectAll")) { table.selectAll(); } else if (e.getActionCommand().equals("selectLastRowExtendSelection")) { rowModel.setLeadSelectionIndex(rowMax); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("scrollDownExtendSelection")) { int target; if (rowLead == getLastVisibleRowIndex()) target = Math.min (rowMax, rowLead + (getLastVisibleRowIndex() - getFirstVisibleRowIndex() + 1)); else target = getLastVisibleRowIndex(); rowModel.setLeadSelectionIndex(target); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("scrollUpChangeSelection")) { int target; if (rowLead == getFirstVisibleRowIndex()) target = Math.max (0, rowLead - (getLastVisibleRowIndex() - getFirstVisibleRowIndex() + 1)); else target = getFirstVisibleRowIndex(); rowModel.setSelectionInterval(target, target); colModel.setSelectionInterval(colLead, colLead); } else { // If we're here that means we bound this TableAction class // to a keyboard input but we either want to ignore that input // or we just haven't implemented its action yet. } if (table.isEditing() && e.getActionCommand() != "startEditing") table.editingCanceled(new ChangeEvent("update")); table.repaint(); table.scrollRectToVisible (table.getCellRect(rowModel.getLeadSelectionIndex(), colModel.getLeadSelectionIndex(), false)); }
1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/963ae61676e8c35a9e0998e0b7de1f942db82a26/BasicTableUI.java/buggy/core/src/classpath/javax/javax/swing/plaf/basic/BasicTableUI.java
else if (e.getActionCommand().equals("scrollDownExtendSelection"))
else if (command.equals("scrollDownExtendSelection"))
public void actionPerformed (ActionEvent e) { ListSelectionModel rowModel = table.getSelectionModel(); ListSelectionModel colModel = table.getColumnModel().getSelectionModel(); int rowLead = rowModel.getLeadSelectionIndex(); int rowMax = table.getModel().getRowCount() - 1; int colLead = colModel.getLeadSelectionIndex(); int colMax = table.getModel().getColumnCount() - 1; if (e.getActionCommand().equals("selectPreviousRowExtendSelection")) { rowModel.setLeadSelectionIndex(Math.max(rowLead - 1, 0)); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("selectLastColumn")) { table.clearSelection(); rowModel.setSelectionInterval(rowLead, rowLead); colModel.setSelectionInterval(colMax, colMax); } else if (e.getActionCommand().equals("startEditing")) { if (table.isCellEditable(rowLead, colLead)) table.editCellAt(rowLead,colLead); } else if (e.getActionCommand().equals("selectFirstRowExtendSelection")) { rowModel.setLeadSelectionIndex(0); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("selectFirstColumn")) { rowModel.setSelectionInterval(rowLead, rowLead); colModel.setSelectionInterval(0, 0); } else if (e.getActionCommand().equals("selectFirstColumnExtendSelection")) { colModel.setLeadSelectionIndex(0); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectLastRow")) { rowModel.setSelectionInterval(rowMax,rowMax); colModel.setSelectionInterval(colLead, colLead); } else if (e.getActionCommand().equals("selectNextRowExtendSelection")) { rowModel.setLeadSelectionIndex(Math.min(rowLead + 1, rowMax)); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("selectFirstRow")) { rowModel.setSelectionInterval(0,0); colModel.setSelectionInterval(colLead, colLead); } else if (e.getActionCommand().equals("selectNextColumnExtendSelection")) { colModel.setLeadSelectionIndex(Math.min(colLead + 1, colMax)); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectLastColumnExtendSelection")) { colModel.setLeadSelectionIndex(colMax); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectPreviousColumnExtendSelection")) { colModel.setLeadSelectionIndex(Math.max(colLead - 1, 0)); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectNextRow")) { rowModel.setSelectionInterval(Math.min(rowLead + 1, rowMax), Math.min(rowLead + 1, rowMax)); colModel.setSelectionInterval(colLead,colLead); } else if (e.getActionCommand().equals("scrollUpExtendSelection")) { int target; if (rowLead == getFirstVisibleRowIndex()) target = Math.max (0, rowLead - (getLastVisibleRowIndex() - getFirstVisibleRowIndex() + 1)); else target = getFirstVisibleRowIndex(); rowModel.setLeadSelectionIndex(target); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("selectPreviousRow")) { rowModel.setSelectionInterval(Math.max(rowLead - 1, 0), Math.max(rowLead - 1, 0)); colModel.setSelectionInterval(colLead,colLead); } else if (e.getActionCommand().equals("scrollRightChangeSelection")) { int target; if (colLead == getLastVisibleColumnIndex()) target = Math.min (colMax, colLead + (getLastVisibleColumnIndex() - getFirstVisibleColumnIndex() + 1)); else target = getLastVisibleColumnIndex(); colModel.setSelectionInterval(target, target); rowModel.setSelectionInterval(rowLead, rowLead); } else if (e.getActionCommand().equals("selectPreviousColumn")) { rowModel.setSelectionInterval(rowLead,rowLead); colModel.setSelectionInterval(Math.max(colLead - 1, 0), Math.max(colLead - 1, 0)); } else if (e.getActionCommand().equals("scrollLeftChangeSelection")) { int target; if (colLead == getFirstVisibleColumnIndex()) target = Math.max (0, colLead - (getLastVisibleColumnIndex() - getFirstVisibleColumnIndex() + 1)); else target = getFirstVisibleColumnIndex(); colModel.setSelectionInterval(target, target); rowModel.setSelectionInterval(rowLead, rowLead); } else if (e.getActionCommand().equals("clearSelection")) { table.clearSelection(); } else if (e.getActionCommand().equals("cancel")) { // FIXME: implement other parts of "cancel" like undo-ing last // selection. Right now it just calls editingCancelled if // we're currently editing. if (table.isEditing()) table.editingCanceled(new ChangeEvent("cancel")); } else if (e.getActionCommand().equals("selectNextRowCell") || e.getActionCommand().equals("selectPreviousRowCell") || e.getActionCommand().equals("selectNextColumnCell") || e.getActionCommand().equals("selectPreviousColumnCell")) { // If nothing is selected, select the first cell in the table if (table.getSelectedRowCount() == 0 && table.getSelectedColumnCount() == 0) { rowModel.setSelectionInterval(0, 0); colModel.setSelectionInterval(0, 0); return; } // If the lead selection index isn't selected (ie a remove operation // happened, then set the lead to the first selected cell in the // table if (!table.isCellSelected(rowLead, colLead)) { rowModel.addSelectionInterval(rowModel.getMinSelectionIndex(), rowModel.getMinSelectionIndex()); colModel.addSelectionInterval(colModel.getMinSelectionIndex(), colModel.getMinSelectionIndex()); return; } // multRowsSelected and multColsSelected tell us if multiple rows or // columns are selected, respectively boolean multRowsSelected, multColsSelected; multRowsSelected = table.getSelectedRowCount() > 1 && table.getRowSelectionAllowed(); multColsSelected = table.getSelectedColumnCount() > 1 && table.getColumnSelectionAllowed(); // If there is just one selection, select the next cell, and wrap // when you get to the edges of the table. if (!multColsSelected && !multRowsSelected) { if (e.getActionCommand().indexOf("Column") != -1) advanceSingleSelection(colModel, colMax, rowModel, rowMax, (e.getActionCommand().equals ("selectPreviousColumnCell"))); else advanceSingleSelection(rowModel, rowMax, colModel, colMax, (e.getActionCommand().equals ("selectPreviousRowCell"))); return; } // rowMinSelected and rowMaxSelected are the minimum and maximum // values respectively of selected cells in the row selection model // Similarly for colMinSelected and colMaxSelected. int rowMaxSelected = table.getRowSelectionAllowed() ? rowModel.getMaxSelectionIndex() : table.getModel().getRowCount() - 1; int rowMinSelected = table.getRowSelectionAllowed() ? rowModel.getMinSelectionIndex() : 0; int colMaxSelected = table.getColumnSelectionAllowed() ? colModel.getMaxSelectionIndex() : table.getModel().getColumnCount() - 1; int colMinSelected = table.getColumnSelectionAllowed() ? colModel.getMinSelectionIndex() : 0; // If there are multiple rows and columns selected, select the next // cell and wrap at the edges of the selection. if (e.getActionCommand().indexOf("Column") != -1) advanceMultipleSelection(colModel, colMinSelected, colMaxSelected, rowModel, rowMinSelected, rowMaxSelected, (e.getActionCommand().equals ("selectPreviousColumnCell")), true); else advanceMultipleSelection(rowModel, rowMinSelected, rowMaxSelected, colModel, colMinSelected, colMaxSelected, (e.getActionCommand().equals ("selectPreviousRowCell")), false); } else if (e.getActionCommand().equals("selectNextColumn")) { rowModel.setSelectionInterval(rowLead,rowLead); colModel.setSelectionInterval(Math.min(colLead + 1, colMax), Math.min(colLead + 1, colMax)); } else if (e.getActionCommand().equals("scrollLeftExtendSelection")) { int target; if (colLead == getFirstVisibleColumnIndex()) target = Math.max (0, colLead - (getLastVisibleColumnIndex() - getFirstVisibleColumnIndex() + 1)); else target = getFirstVisibleColumnIndex(); colModel.setLeadSelectionIndex(target); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("scrollDownChangeSelection")) { int target; if (rowLead == getLastVisibleRowIndex()) target = Math.min (rowMax, rowLead + (getLastVisibleRowIndex() - getFirstVisibleRowIndex() + 1)); else target = getLastVisibleRowIndex(); rowModel.setSelectionInterval(target, target); colModel.setSelectionInterval(colLead, colLead); } else if (e.getActionCommand().equals("scrollRightExtendSelection")) { int target; if (colLead == getLastVisibleColumnIndex()) target = Math.min (colMax, colLead + (getLastVisibleColumnIndex() - getFirstVisibleColumnIndex() + 1)); else target = getLastVisibleColumnIndex(); colModel.setLeadSelectionIndex(target); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectAll")) { table.selectAll(); } else if (e.getActionCommand().equals("selectLastRowExtendSelection")) { rowModel.setLeadSelectionIndex(rowMax); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("scrollDownExtendSelection")) { int target; if (rowLead == getLastVisibleRowIndex()) target = Math.min (rowMax, rowLead + (getLastVisibleRowIndex() - getFirstVisibleRowIndex() + 1)); else target = getLastVisibleRowIndex(); rowModel.setLeadSelectionIndex(target); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("scrollUpChangeSelection")) { int target; if (rowLead == getFirstVisibleRowIndex()) target = Math.max (0, rowLead - (getLastVisibleRowIndex() - getFirstVisibleRowIndex() + 1)); else target = getFirstVisibleRowIndex(); rowModel.setSelectionInterval(target, target); colModel.setSelectionInterval(colLead, colLead); } else { // If we're here that means we bound this TableAction class // to a keyboard input but we either want to ignore that input // or we just haven't implemented its action yet. } if (table.isEditing() && e.getActionCommand() != "startEditing") table.editingCanceled(new ChangeEvent("update")); table.repaint(); table.scrollRectToVisible (table.getCellRect(rowModel.getLeadSelectionIndex(), colModel.getLeadSelectionIndex(), false)); }
1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/963ae61676e8c35a9e0998e0b7de1f942db82a26/BasicTableUI.java/buggy/core/src/classpath/javax/javax/swing/plaf/basic/BasicTableUI.java
else if (e.getActionCommand().equals("scrollUpChangeSelection"))
else if (command.equals("scrollUpChangeSelection"))
public void actionPerformed (ActionEvent e) { ListSelectionModel rowModel = table.getSelectionModel(); ListSelectionModel colModel = table.getColumnModel().getSelectionModel(); int rowLead = rowModel.getLeadSelectionIndex(); int rowMax = table.getModel().getRowCount() - 1; int colLead = colModel.getLeadSelectionIndex(); int colMax = table.getModel().getColumnCount() - 1; if (e.getActionCommand().equals("selectPreviousRowExtendSelection")) { rowModel.setLeadSelectionIndex(Math.max(rowLead - 1, 0)); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("selectLastColumn")) { table.clearSelection(); rowModel.setSelectionInterval(rowLead, rowLead); colModel.setSelectionInterval(colMax, colMax); } else if (e.getActionCommand().equals("startEditing")) { if (table.isCellEditable(rowLead, colLead)) table.editCellAt(rowLead,colLead); } else if (e.getActionCommand().equals("selectFirstRowExtendSelection")) { rowModel.setLeadSelectionIndex(0); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("selectFirstColumn")) { rowModel.setSelectionInterval(rowLead, rowLead); colModel.setSelectionInterval(0, 0); } else if (e.getActionCommand().equals("selectFirstColumnExtendSelection")) { colModel.setLeadSelectionIndex(0); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectLastRow")) { rowModel.setSelectionInterval(rowMax,rowMax); colModel.setSelectionInterval(colLead, colLead); } else if (e.getActionCommand().equals("selectNextRowExtendSelection")) { rowModel.setLeadSelectionIndex(Math.min(rowLead + 1, rowMax)); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("selectFirstRow")) { rowModel.setSelectionInterval(0,0); colModel.setSelectionInterval(colLead, colLead); } else if (e.getActionCommand().equals("selectNextColumnExtendSelection")) { colModel.setLeadSelectionIndex(Math.min(colLead + 1, colMax)); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectLastColumnExtendSelection")) { colModel.setLeadSelectionIndex(colMax); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectPreviousColumnExtendSelection")) { colModel.setLeadSelectionIndex(Math.max(colLead - 1, 0)); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectNextRow")) { rowModel.setSelectionInterval(Math.min(rowLead + 1, rowMax), Math.min(rowLead + 1, rowMax)); colModel.setSelectionInterval(colLead,colLead); } else if (e.getActionCommand().equals("scrollUpExtendSelection")) { int target; if (rowLead == getFirstVisibleRowIndex()) target = Math.max (0, rowLead - (getLastVisibleRowIndex() - getFirstVisibleRowIndex() + 1)); else target = getFirstVisibleRowIndex(); rowModel.setLeadSelectionIndex(target); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("selectPreviousRow")) { rowModel.setSelectionInterval(Math.max(rowLead - 1, 0), Math.max(rowLead - 1, 0)); colModel.setSelectionInterval(colLead,colLead); } else if (e.getActionCommand().equals("scrollRightChangeSelection")) { int target; if (colLead == getLastVisibleColumnIndex()) target = Math.min (colMax, colLead + (getLastVisibleColumnIndex() - getFirstVisibleColumnIndex() + 1)); else target = getLastVisibleColumnIndex(); colModel.setSelectionInterval(target, target); rowModel.setSelectionInterval(rowLead, rowLead); } else if (e.getActionCommand().equals("selectPreviousColumn")) { rowModel.setSelectionInterval(rowLead,rowLead); colModel.setSelectionInterval(Math.max(colLead - 1, 0), Math.max(colLead - 1, 0)); } else if (e.getActionCommand().equals("scrollLeftChangeSelection")) { int target; if (colLead == getFirstVisibleColumnIndex()) target = Math.max (0, colLead - (getLastVisibleColumnIndex() - getFirstVisibleColumnIndex() + 1)); else target = getFirstVisibleColumnIndex(); colModel.setSelectionInterval(target, target); rowModel.setSelectionInterval(rowLead, rowLead); } else if (e.getActionCommand().equals("clearSelection")) { table.clearSelection(); } else if (e.getActionCommand().equals("cancel")) { // FIXME: implement other parts of "cancel" like undo-ing last // selection. Right now it just calls editingCancelled if // we're currently editing. if (table.isEditing()) table.editingCanceled(new ChangeEvent("cancel")); } else if (e.getActionCommand().equals("selectNextRowCell") || e.getActionCommand().equals("selectPreviousRowCell") || e.getActionCommand().equals("selectNextColumnCell") || e.getActionCommand().equals("selectPreviousColumnCell")) { // If nothing is selected, select the first cell in the table if (table.getSelectedRowCount() == 0 && table.getSelectedColumnCount() == 0) { rowModel.setSelectionInterval(0, 0); colModel.setSelectionInterval(0, 0); return; } // If the lead selection index isn't selected (ie a remove operation // happened, then set the lead to the first selected cell in the // table if (!table.isCellSelected(rowLead, colLead)) { rowModel.addSelectionInterval(rowModel.getMinSelectionIndex(), rowModel.getMinSelectionIndex()); colModel.addSelectionInterval(colModel.getMinSelectionIndex(), colModel.getMinSelectionIndex()); return; } // multRowsSelected and multColsSelected tell us if multiple rows or // columns are selected, respectively boolean multRowsSelected, multColsSelected; multRowsSelected = table.getSelectedRowCount() > 1 && table.getRowSelectionAllowed(); multColsSelected = table.getSelectedColumnCount() > 1 && table.getColumnSelectionAllowed(); // If there is just one selection, select the next cell, and wrap // when you get to the edges of the table. if (!multColsSelected && !multRowsSelected) { if (e.getActionCommand().indexOf("Column") != -1) advanceSingleSelection(colModel, colMax, rowModel, rowMax, (e.getActionCommand().equals ("selectPreviousColumnCell"))); else advanceSingleSelection(rowModel, rowMax, colModel, colMax, (e.getActionCommand().equals ("selectPreviousRowCell"))); return; } // rowMinSelected and rowMaxSelected are the minimum and maximum // values respectively of selected cells in the row selection model // Similarly for colMinSelected and colMaxSelected. int rowMaxSelected = table.getRowSelectionAllowed() ? rowModel.getMaxSelectionIndex() : table.getModel().getRowCount() - 1; int rowMinSelected = table.getRowSelectionAllowed() ? rowModel.getMinSelectionIndex() : 0; int colMaxSelected = table.getColumnSelectionAllowed() ? colModel.getMaxSelectionIndex() : table.getModel().getColumnCount() - 1; int colMinSelected = table.getColumnSelectionAllowed() ? colModel.getMinSelectionIndex() : 0; // If there are multiple rows and columns selected, select the next // cell and wrap at the edges of the selection. if (e.getActionCommand().indexOf("Column") != -1) advanceMultipleSelection(colModel, colMinSelected, colMaxSelected, rowModel, rowMinSelected, rowMaxSelected, (e.getActionCommand().equals ("selectPreviousColumnCell")), true); else advanceMultipleSelection(rowModel, rowMinSelected, rowMaxSelected, colModel, colMinSelected, colMaxSelected, (e.getActionCommand().equals ("selectPreviousRowCell")), false); } else if (e.getActionCommand().equals("selectNextColumn")) { rowModel.setSelectionInterval(rowLead,rowLead); colModel.setSelectionInterval(Math.min(colLead + 1, colMax), Math.min(colLead + 1, colMax)); } else if (e.getActionCommand().equals("scrollLeftExtendSelection")) { int target; if (colLead == getFirstVisibleColumnIndex()) target = Math.max (0, colLead - (getLastVisibleColumnIndex() - getFirstVisibleColumnIndex() + 1)); else target = getFirstVisibleColumnIndex(); colModel.setLeadSelectionIndex(target); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("scrollDownChangeSelection")) { int target; if (rowLead == getLastVisibleRowIndex()) target = Math.min (rowMax, rowLead + (getLastVisibleRowIndex() - getFirstVisibleRowIndex() + 1)); else target = getLastVisibleRowIndex(); rowModel.setSelectionInterval(target, target); colModel.setSelectionInterval(colLead, colLead); } else if (e.getActionCommand().equals("scrollRightExtendSelection")) { int target; if (colLead == getLastVisibleColumnIndex()) target = Math.min (colMax, colLead + (getLastVisibleColumnIndex() - getFirstVisibleColumnIndex() + 1)); else target = getLastVisibleColumnIndex(); colModel.setLeadSelectionIndex(target); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectAll")) { table.selectAll(); } else if (e.getActionCommand().equals("selectLastRowExtendSelection")) { rowModel.setLeadSelectionIndex(rowMax); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("scrollDownExtendSelection")) { int target; if (rowLead == getLastVisibleRowIndex()) target = Math.min (rowMax, rowLead + (getLastVisibleRowIndex() - getFirstVisibleRowIndex() + 1)); else target = getLastVisibleRowIndex(); rowModel.setLeadSelectionIndex(target); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("scrollUpChangeSelection")) { int target; if (rowLead == getFirstVisibleRowIndex()) target = Math.max (0, rowLead - (getLastVisibleRowIndex() - getFirstVisibleRowIndex() + 1)); else target = getFirstVisibleRowIndex(); rowModel.setSelectionInterval(target, target); colModel.setSelectionInterval(colLead, colLead); } else { // If we're here that means we bound this TableAction class // to a keyboard input but we either want to ignore that input // or we just haven't implemented its action yet. } if (table.isEditing() && e.getActionCommand() != "startEditing") table.editingCanceled(new ChangeEvent("update")); table.repaint(); table.scrollRectToVisible (table.getCellRect(rowModel.getLeadSelectionIndex(), colModel.getLeadSelectionIndex(), false)); }
1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/963ae61676e8c35a9e0998e0b7de1f942db82a26/BasicTableUI.java/buggy/core/src/classpath/javax/javax/swing/plaf/basic/BasicTableUI.java
if (table.isEditing() && e.getActionCommand() != "startEditing") table.editingCanceled(new ChangeEvent("update")); table.repaint();
if (table.isEditing() && command != "startEditing" && command != "addToSelection") table.editingStopped(new ChangeEvent("update"));
public void actionPerformed (ActionEvent e) { ListSelectionModel rowModel = table.getSelectionModel(); ListSelectionModel colModel = table.getColumnModel().getSelectionModel(); int rowLead = rowModel.getLeadSelectionIndex(); int rowMax = table.getModel().getRowCount() - 1; int colLead = colModel.getLeadSelectionIndex(); int colMax = table.getModel().getColumnCount() - 1; if (e.getActionCommand().equals("selectPreviousRowExtendSelection")) { rowModel.setLeadSelectionIndex(Math.max(rowLead - 1, 0)); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("selectLastColumn")) { table.clearSelection(); rowModel.setSelectionInterval(rowLead, rowLead); colModel.setSelectionInterval(colMax, colMax); } else if (e.getActionCommand().equals("startEditing")) { if (table.isCellEditable(rowLead, colLead)) table.editCellAt(rowLead,colLead); } else if (e.getActionCommand().equals("selectFirstRowExtendSelection")) { rowModel.setLeadSelectionIndex(0); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("selectFirstColumn")) { rowModel.setSelectionInterval(rowLead, rowLead); colModel.setSelectionInterval(0, 0); } else if (e.getActionCommand().equals("selectFirstColumnExtendSelection")) { colModel.setLeadSelectionIndex(0); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectLastRow")) { rowModel.setSelectionInterval(rowMax,rowMax); colModel.setSelectionInterval(colLead, colLead); } else if (e.getActionCommand().equals("selectNextRowExtendSelection")) { rowModel.setLeadSelectionIndex(Math.min(rowLead + 1, rowMax)); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("selectFirstRow")) { rowModel.setSelectionInterval(0,0); colModel.setSelectionInterval(colLead, colLead); } else if (e.getActionCommand().equals("selectNextColumnExtendSelection")) { colModel.setLeadSelectionIndex(Math.min(colLead + 1, colMax)); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectLastColumnExtendSelection")) { colModel.setLeadSelectionIndex(colMax); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectPreviousColumnExtendSelection")) { colModel.setLeadSelectionIndex(Math.max(colLead - 1, 0)); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectNextRow")) { rowModel.setSelectionInterval(Math.min(rowLead + 1, rowMax), Math.min(rowLead + 1, rowMax)); colModel.setSelectionInterval(colLead,colLead); } else if (e.getActionCommand().equals("scrollUpExtendSelection")) { int target; if (rowLead == getFirstVisibleRowIndex()) target = Math.max (0, rowLead - (getLastVisibleRowIndex() - getFirstVisibleRowIndex() + 1)); else target = getFirstVisibleRowIndex(); rowModel.setLeadSelectionIndex(target); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("selectPreviousRow")) { rowModel.setSelectionInterval(Math.max(rowLead - 1, 0), Math.max(rowLead - 1, 0)); colModel.setSelectionInterval(colLead,colLead); } else if (e.getActionCommand().equals("scrollRightChangeSelection")) { int target; if (colLead == getLastVisibleColumnIndex()) target = Math.min (colMax, colLead + (getLastVisibleColumnIndex() - getFirstVisibleColumnIndex() + 1)); else target = getLastVisibleColumnIndex(); colModel.setSelectionInterval(target, target); rowModel.setSelectionInterval(rowLead, rowLead); } else if (e.getActionCommand().equals("selectPreviousColumn")) { rowModel.setSelectionInterval(rowLead,rowLead); colModel.setSelectionInterval(Math.max(colLead - 1, 0), Math.max(colLead - 1, 0)); } else if (e.getActionCommand().equals("scrollLeftChangeSelection")) { int target; if (colLead == getFirstVisibleColumnIndex()) target = Math.max (0, colLead - (getLastVisibleColumnIndex() - getFirstVisibleColumnIndex() + 1)); else target = getFirstVisibleColumnIndex(); colModel.setSelectionInterval(target, target); rowModel.setSelectionInterval(rowLead, rowLead); } else if (e.getActionCommand().equals("clearSelection")) { table.clearSelection(); } else if (e.getActionCommand().equals("cancel")) { // FIXME: implement other parts of "cancel" like undo-ing last // selection. Right now it just calls editingCancelled if // we're currently editing. if (table.isEditing()) table.editingCanceled(new ChangeEvent("cancel")); } else if (e.getActionCommand().equals("selectNextRowCell") || e.getActionCommand().equals("selectPreviousRowCell") || e.getActionCommand().equals("selectNextColumnCell") || e.getActionCommand().equals("selectPreviousColumnCell")) { // If nothing is selected, select the first cell in the table if (table.getSelectedRowCount() == 0 && table.getSelectedColumnCount() == 0) { rowModel.setSelectionInterval(0, 0); colModel.setSelectionInterval(0, 0); return; } // If the lead selection index isn't selected (ie a remove operation // happened, then set the lead to the first selected cell in the // table if (!table.isCellSelected(rowLead, colLead)) { rowModel.addSelectionInterval(rowModel.getMinSelectionIndex(), rowModel.getMinSelectionIndex()); colModel.addSelectionInterval(colModel.getMinSelectionIndex(), colModel.getMinSelectionIndex()); return; } // multRowsSelected and multColsSelected tell us if multiple rows or // columns are selected, respectively boolean multRowsSelected, multColsSelected; multRowsSelected = table.getSelectedRowCount() > 1 && table.getRowSelectionAllowed(); multColsSelected = table.getSelectedColumnCount() > 1 && table.getColumnSelectionAllowed(); // If there is just one selection, select the next cell, and wrap // when you get to the edges of the table. if (!multColsSelected && !multRowsSelected) { if (e.getActionCommand().indexOf("Column") != -1) advanceSingleSelection(colModel, colMax, rowModel, rowMax, (e.getActionCommand().equals ("selectPreviousColumnCell"))); else advanceSingleSelection(rowModel, rowMax, colModel, colMax, (e.getActionCommand().equals ("selectPreviousRowCell"))); return; } // rowMinSelected and rowMaxSelected are the minimum and maximum // values respectively of selected cells in the row selection model // Similarly for colMinSelected and colMaxSelected. int rowMaxSelected = table.getRowSelectionAllowed() ? rowModel.getMaxSelectionIndex() : table.getModel().getRowCount() - 1; int rowMinSelected = table.getRowSelectionAllowed() ? rowModel.getMinSelectionIndex() : 0; int colMaxSelected = table.getColumnSelectionAllowed() ? colModel.getMaxSelectionIndex() : table.getModel().getColumnCount() - 1; int colMinSelected = table.getColumnSelectionAllowed() ? colModel.getMinSelectionIndex() : 0; // If there are multiple rows and columns selected, select the next // cell and wrap at the edges of the selection. if (e.getActionCommand().indexOf("Column") != -1) advanceMultipleSelection(colModel, colMinSelected, colMaxSelected, rowModel, rowMinSelected, rowMaxSelected, (e.getActionCommand().equals ("selectPreviousColumnCell")), true); else advanceMultipleSelection(rowModel, rowMinSelected, rowMaxSelected, colModel, colMinSelected, colMaxSelected, (e.getActionCommand().equals ("selectPreviousRowCell")), false); } else if (e.getActionCommand().equals("selectNextColumn")) { rowModel.setSelectionInterval(rowLead,rowLead); colModel.setSelectionInterval(Math.min(colLead + 1, colMax), Math.min(colLead + 1, colMax)); } else if (e.getActionCommand().equals("scrollLeftExtendSelection")) { int target; if (colLead == getFirstVisibleColumnIndex()) target = Math.max (0, colLead - (getLastVisibleColumnIndex() - getFirstVisibleColumnIndex() + 1)); else target = getFirstVisibleColumnIndex(); colModel.setLeadSelectionIndex(target); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("scrollDownChangeSelection")) { int target; if (rowLead == getLastVisibleRowIndex()) target = Math.min (rowMax, rowLead + (getLastVisibleRowIndex() - getFirstVisibleRowIndex() + 1)); else target = getLastVisibleRowIndex(); rowModel.setSelectionInterval(target, target); colModel.setSelectionInterval(colLead, colLead); } else if (e.getActionCommand().equals("scrollRightExtendSelection")) { int target; if (colLead == getLastVisibleColumnIndex()) target = Math.min (colMax, colLead + (getLastVisibleColumnIndex() - getFirstVisibleColumnIndex() + 1)); else target = getLastVisibleColumnIndex(); colModel.setLeadSelectionIndex(target); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectAll")) { table.selectAll(); } else if (e.getActionCommand().equals("selectLastRowExtendSelection")) { rowModel.setLeadSelectionIndex(rowMax); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("scrollDownExtendSelection")) { int target; if (rowLead == getLastVisibleRowIndex()) target = Math.min (rowMax, rowLead + (getLastVisibleRowIndex() - getFirstVisibleRowIndex() + 1)); else target = getLastVisibleRowIndex(); rowModel.setLeadSelectionIndex(target); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("scrollUpChangeSelection")) { int target; if (rowLead == getFirstVisibleRowIndex()) target = Math.max (0, rowLead - (getLastVisibleRowIndex() - getFirstVisibleRowIndex() + 1)); else target = getFirstVisibleRowIndex(); rowModel.setSelectionInterval(target, target); colModel.setSelectionInterval(colLead, colLead); } else { // If we're here that means we bound this TableAction class // to a keyboard input but we either want to ignore that input // or we just haven't implemented its action yet. } if (table.isEditing() && e.getActionCommand() != "startEditing") table.editingCanceled(new ChangeEvent("update")); table.repaint(); table.scrollRectToVisible (table.getCellRect(rowModel.getLeadSelectionIndex(), colModel.getLeadSelectionIndex(), false)); }
1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/963ae61676e8c35a9e0998e0b7de1f942db82a26/BasicTableUI.java/buggy/core/src/classpath/javax/javax/swing/plaf/basic/BasicTableUI.java
table.repaint();
public void actionPerformed (ActionEvent e) { ListSelectionModel rowModel = table.getSelectionModel(); ListSelectionModel colModel = table.getColumnModel().getSelectionModel(); int rowLead = rowModel.getLeadSelectionIndex(); int rowMax = table.getModel().getRowCount() - 1; int colLead = colModel.getLeadSelectionIndex(); int colMax = table.getModel().getColumnCount() - 1; if (e.getActionCommand().equals("selectPreviousRowExtendSelection")) { rowModel.setLeadSelectionIndex(Math.max(rowLead - 1, 0)); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("selectLastColumn")) { table.clearSelection(); rowModel.setSelectionInterval(rowLead, rowLead); colModel.setSelectionInterval(colMax, colMax); } else if (e.getActionCommand().equals("startEditing")) { if (table.isCellEditable(rowLead, colLead)) table.editCellAt(rowLead,colLead); } else if (e.getActionCommand().equals("selectFirstRowExtendSelection")) { rowModel.setLeadSelectionIndex(0); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("selectFirstColumn")) { rowModel.setSelectionInterval(rowLead, rowLead); colModel.setSelectionInterval(0, 0); } else if (e.getActionCommand().equals("selectFirstColumnExtendSelection")) { colModel.setLeadSelectionIndex(0); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectLastRow")) { rowModel.setSelectionInterval(rowMax,rowMax); colModel.setSelectionInterval(colLead, colLead); } else if (e.getActionCommand().equals("selectNextRowExtendSelection")) { rowModel.setLeadSelectionIndex(Math.min(rowLead + 1, rowMax)); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("selectFirstRow")) { rowModel.setSelectionInterval(0,0); colModel.setSelectionInterval(colLead, colLead); } else if (e.getActionCommand().equals("selectNextColumnExtendSelection")) { colModel.setLeadSelectionIndex(Math.min(colLead + 1, colMax)); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectLastColumnExtendSelection")) { colModel.setLeadSelectionIndex(colMax); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectPreviousColumnExtendSelection")) { colModel.setLeadSelectionIndex(Math.max(colLead - 1, 0)); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectNextRow")) { rowModel.setSelectionInterval(Math.min(rowLead + 1, rowMax), Math.min(rowLead + 1, rowMax)); colModel.setSelectionInterval(colLead,colLead); } else if (e.getActionCommand().equals("scrollUpExtendSelection")) { int target; if (rowLead == getFirstVisibleRowIndex()) target = Math.max (0, rowLead - (getLastVisibleRowIndex() - getFirstVisibleRowIndex() + 1)); else target = getFirstVisibleRowIndex(); rowModel.setLeadSelectionIndex(target); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("selectPreviousRow")) { rowModel.setSelectionInterval(Math.max(rowLead - 1, 0), Math.max(rowLead - 1, 0)); colModel.setSelectionInterval(colLead,colLead); } else if (e.getActionCommand().equals("scrollRightChangeSelection")) { int target; if (colLead == getLastVisibleColumnIndex()) target = Math.min (colMax, colLead + (getLastVisibleColumnIndex() - getFirstVisibleColumnIndex() + 1)); else target = getLastVisibleColumnIndex(); colModel.setSelectionInterval(target, target); rowModel.setSelectionInterval(rowLead, rowLead); } else if (e.getActionCommand().equals("selectPreviousColumn")) { rowModel.setSelectionInterval(rowLead,rowLead); colModel.setSelectionInterval(Math.max(colLead - 1, 0), Math.max(colLead - 1, 0)); } else if (e.getActionCommand().equals("scrollLeftChangeSelection")) { int target; if (colLead == getFirstVisibleColumnIndex()) target = Math.max (0, colLead - (getLastVisibleColumnIndex() - getFirstVisibleColumnIndex() + 1)); else target = getFirstVisibleColumnIndex(); colModel.setSelectionInterval(target, target); rowModel.setSelectionInterval(rowLead, rowLead); } else if (e.getActionCommand().equals("clearSelection")) { table.clearSelection(); } else if (e.getActionCommand().equals("cancel")) { // FIXME: implement other parts of "cancel" like undo-ing last // selection. Right now it just calls editingCancelled if // we're currently editing. if (table.isEditing()) table.editingCanceled(new ChangeEvent("cancel")); } else if (e.getActionCommand().equals("selectNextRowCell") || e.getActionCommand().equals("selectPreviousRowCell") || e.getActionCommand().equals("selectNextColumnCell") || e.getActionCommand().equals("selectPreviousColumnCell")) { // If nothing is selected, select the first cell in the table if (table.getSelectedRowCount() == 0 && table.getSelectedColumnCount() == 0) { rowModel.setSelectionInterval(0, 0); colModel.setSelectionInterval(0, 0); return; } // If the lead selection index isn't selected (ie a remove operation // happened, then set the lead to the first selected cell in the // table if (!table.isCellSelected(rowLead, colLead)) { rowModel.addSelectionInterval(rowModel.getMinSelectionIndex(), rowModel.getMinSelectionIndex()); colModel.addSelectionInterval(colModel.getMinSelectionIndex(), colModel.getMinSelectionIndex()); return; } // multRowsSelected and multColsSelected tell us if multiple rows or // columns are selected, respectively boolean multRowsSelected, multColsSelected; multRowsSelected = table.getSelectedRowCount() > 1 && table.getRowSelectionAllowed(); multColsSelected = table.getSelectedColumnCount() > 1 && table.getColumnSelectionAllowed(); // If there is just one selection, select the next cell, and wrap // when you get to the edges of the table. if (!multColsSelected && !multRowsSelected) { if (e.getActionCommand().indexOf("Column") != -1) advanceSingleSelection(colModel, colMax, rowModel, rowMax, (e.getActionCommand().equals ("selectPreviousColumnCell"))); else advanceSingleSelection(rowModel, rowMax, colModel, colMax, (e.getActionCommand().equals ("selectPreviousRowCell"))); return; } // rowMinSelected and rowMaxSelected are the minimum and maximum // values respectively of selected cells in the row selection model // Similarly for colMinSelected and colMaxSelected. int rowMaxSelected = table.getRowSelectionAllowed() ? rowModel.getMaxSelectionIndex() : table.getModel().getRowCount() - 1; int rowMinSelected = table.getRowSelectionAllowed() ? rowModel.getMinSelectionIndex() : 0; int colMaxSelected = table.getColumnSelectionAllowed() ? colModel.getMaxSelectionIndex() : table.getModel().getColumnCount() - 1; int colMinSelected = table.getColumnSelectionAllowed() ? colModel.getMinSelectionIndex() : 0; // If there are multiple rows and columns selected, select the next // cell and wrap at the edges of the selection. if (e.getActionCommand().indexOf("Column") != -1) advanceMultipleSelection(colModel, colMinSelected, colMaxSelected, rowModel, rowMinSelected, rowMaxSelected, (e.getActionCommand().equals ("selectPreviousColumnCell")), true); else advanceMultipleSelection(rowModel, rowMinSelected, rowMaxSelected, colModel, colMinSelected, colMaxSelected, (e.getActionCommand().equals ("selectPreviousRowCell")), false); } else if (e.getActionCommand().equals("selectNextColumn")) { rowModel.setSelectionInterval(rowLead,rowLead); colModel.setSelectionInterval(Math.min(colLead + 1, colMax), Math.min(colLead + 1, colMax)); } else if (e.getActionCommand().equals("scrollLeftExtendSelection")) { int target; if (colLead == getFirstVisibleColumnIndex()) target = Math.max (0, colLead - (getLastVisibleColumnIndex() - getFirstVisibleColumnIndex() + 1)); else target = getFirstVisibleColumnIndex(); colModel.setLeadSelectionIndex(target); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("scrollDownChangeSelection")) { int target; if (rowLead == getLastVisibleRowIndex()) target = Math.min (rowMax, rowLead + (getLastVisibleRowIndex() - getFirstVisibleRowIndex() + 1)); else target = getLastVisibleRowIndex(); rowModel.setSelectionInterval(target, target); colModel.setSelectionInterval(colLead, colLead); } else if (e.getActionCommand().equals("scrollRightExtendSelection")) { int target; if (colLead == getLastVisibleColumnIndex()) target = Math.min (colMax, colLead + (getLastVisibleColumnIndex() - getFirstVisibleColumnIndex() + 1)); else target = getLastVisibleColumnIndex(); colModel.setLeadSelectionIndex(target); rowModel.setLeadSelectionIndex(rowLead); } else if (e.getActionCommand().equals("selectAll")) { table.selectAll(); } else if (e.getActionCommand().equals("selectLastRowExtendSelection")) { rowModel.setLeadSelectionIndex(rowMax); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("scrollDownExtendSelection")) { int target; if (rowLead == getLastVisibleRowIndex()) target = Math.min (rowMax, rowLead + (getLastVisibleRowIndex() - getFirstVisibleRowIndex() + 1)); else target = getLastVisibleRowIndex(); rowModel.setLeadSelectionIndex(target); colModel.setLeadSelectionIndex(colLead); } else if (e.getActionCommand().equals("scrollUpChangeSelection")) { int target; if (rowLead == getFirstVisibleRowIndex()) target = Math.max (0, rowLead - (getLastVisibleRowIndex() - getFirstVisibleRowIndex() + 1)); else target = getFirstVisibleRowIndex(); rowModel.setSelectionInterval(target, target); colModel.setSelectionInterval(colLead, colLead); } else { // If we're here that means we bound this TableAction class // to a keyboard input but we either want to ignore that input // or we just haven't implemented its action yet. } if (table.isEditing() && e.getActionCommand() != "startEditing") table.editingCanceled(new ChangeEvent("update")); table.repaint(); table.scrollRectToVisible (table.getCellRect(rowModel.getLeadSelectionIndex(), colModel.getLeadSelectionIndex(), false)); }
1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/963ae61676e8c35a9e0998e0b7de1f942db82a26/BasicTableUI.java/buggy/core/src/classpath/javax/javax/swing/plaf/basic/BasicTableUI.java
protected void uninstallKeyboardActions() { }
1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/963ae61676e8c35a9e0998e0b7de1f942db82a26/BasicTableUI.java/buggy/core/src/classpath/javax/javax/swing/plaf/basic/BasicTableUI.java
public NetworkException(String message, Throwable cause) { super(message); initCause(cause);
public NetworkException() { super();
public NetworkException(String message, Throwable cause) { super(message); initCause(cause); }
1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/51e4aed2205f326c2698e2154ea7f83ae5dfc2b6/NetworkException.java/buggy/net/src/driver/org/jnode/driver/net/NetworkException.java
if (instance == null)
if (instances == null) instances = new HashMap(); Object o = instances.get(component); MetalComboBoxUI instance; if (o == null) {
public static ComponentUI createUI(JComponent component) { if (instance == null) instance = new MetalComboBoxUI(); return instance; }
1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/c5671ff077399b85034dffa0f9635da50cef54a9/MetalComboBoxUI.java/clean/core/src/classpath/javax/javax/swing/plaf/metal/MetalComboBoxUI.java
instances.put(component, instance); } else instance = (MetalComboBoxUI) o;
public static ComponentUI createUI(JComponent component) { if (instance == null) instance = new MetalComboBoxUI(); return instance; }
1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/c5671ff077399b85034dffa0f9635da50cef54a9/MetalComboBoxUI.java/clean/core/src/classpath/javax/javax/swing/plaf/metal/MetalComboBoxUI.java
public void addLayoutComponent(String name, Component c) { }
1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/963ae61676e8c35a9e0998e0b7de1f942db82a26/BasicInternalFrameUI.java/clean/core/src/classpath/javax/javax/swing/plaf/basic/BasicInternalFrameUI.java
public void removeLayoutComponent(Component c) { }
1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/963ae61676e8c35a9e0998e0b7de1f942db82a26/BasicInternalFrameUI.java/clean/core/src/classpath/javax/javax/swing/plaf/basic/BasicInternalFrameUI.java
public BasicInternalFrameUI(JInternalFrame b) { }
1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/963ae61676e8c35a9e0998e0b7de1f942db82a26/BasicInternalFrameUI.java/clean/core/src/classpath/javax/javax/swing/plaf/basic/BasicInternalFrameUI.java
public void mouseClicked(MouseEvent event) { }
public void mouseClicked(MouseEvent event) { }
public void mouseClicked(MouseEvent event) { } // mouseClicked()
1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/53b78dd1e4587254262f4618d2aa7551de8e0cbf/MouseInputAdapter.java/buggy/core/src/classpath/javax/javax/swing/event/MouseInputAdapter.java
public void mouseDragged(MouseEvent event) { }
public void mouseDragged(MouseEvent event) { }
public void mouseDragged(MouseEvent event) { } // mouseDragged()
1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/53b78dd1e4587254262f4618d2aa7551de8e0cbf/MouseInputAdapter.java/buggy/core/src/classpath/javax/javax/swing/event/MouseInputAdapter.java
public void mouseExited(MouseEvent event) { }
public void mouseExited(MouseEvent event) { }
public void mouseExited(MouseEvent event) { } // mouseExited()
1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/53b78dd1e4587254262f4618d2aa7551de8e0cbf/MouseInputAdapter.java/buggy/core/src/classpath/javax/javax/swing/event/MouseInputAdapter.java
public void mouseMoved(MouseEvent event) { }
public void mouseMoved(MouseEvent event) { }
public void mouseMoved(MouseEvent event) { } // mouseMoved()
1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/53b78dd1e4587254262f4618d2aa7551de8e0cbf/MouseInputAdapter.java/buggy/core/src/classpath/javax/javax/swing/event/MouseInputAdapter.java
public void mousePressed(MouseEvent event) { }
public void mousePressed(MouseEvent event) { }
public void mousePressed(MouseEvent event) { } // mousePressed()
1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/53b78dd1e4587254262f4618d2aa7551de8e0cbf/MouseInputAdapter.java/buggy/core/src/classpath/javax/javax/swing/event/MouseInputAdapter.java
public void mouseReleased(MouseEvent event) { }
public void mouseReleased(MouseEvent event) { }
public void mouseReleased(MouseEvent event) { } // mouseReleased()
1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/53b78dd1e4587254262f4618d2aa7551de8e0cbf/MouseInputAdapter.java/buggy/core/src/classpath/javax/javax/swing/event/MouseInputAdapter.java
screen52.setPendingInsert(false,1,1);
screen52.setPendingInsert(false);
private void processCC1 (byte byte1) {// System.out.println(" Control byte1 " + Integer.toBinaryString(byte1 & 0xff)); if ((byte1 & 0x04) == 0x04) { Toolkit.getDefaultToolkit().beep(); } if ((byte1 & 0x02) == 0x02) { screen52.setMessageLightOff(); } if ((byte1 & 0x01) == 0x01) { screen52.setMessageLightOn(); } if ((byte1 & 0x01) == 0x01 && (byte1 & 0x02) == 0x02) { screen52.setMessageLightOn(); } // reset blinking cursor seems to control whether to set or not set the // the cursor position. No documentation for this just testing and // looking at the bit settings of this field. This was a pain in the ass! // // if it is off '0' then keep existing cursor positioning information // if it is on '1' then reset the cursor positioning information // *** Note *** unless we receive bit 4 on at the same time // this seems to work so far if ((byte1 & 0x20) == 0x20 && (byte1 & 0x08) == 0x00) { screen52.setPendingInsert(false,1,1); } // in enhanced mode we sometimes only receive bit 6 turned on which // is reset blinking cursor if ((byte1 & 0x20) == 0x20 && enhanced) { cursorOn = true; } if (!screen52.isStatusErrorCode() && (byte1 & 0x08) == 0x08) {// screen52.setStatus(screen52.STATUS_SYSTEM,screen52.STATUS_VALUE_OFF,null); cursorOn = true; } if ((byte1 & 0x20) == 0x20 && (byte1 & 0x08) == 0x00) { screen52.setPendingInsert(false,1,1); } }
1179 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1179/bcfd5ba28d22d8100110257f977fd7c577f652c2/tnvt.java/buggy/tn5250j/src/org/tn5250j/tnvt.java
screen52.setPendingInsert(true); }
private void processCC1 (byte byte1) {// System.out.println(" Control byte1 " + Integer.toBinaryString(byte1 & 0xff)); if ((byte1 & 0x04) == 0x04) { Toolkit.getDefaultToolkit().beep(); } if ((byte1 & 0x02) == 0x02) { screen52.setMessageLightOff(); } if ((byte1 & 0x01) == 0x01) { screen52.setMessageLightOn(); } if ((byte1 & 0x01) == 0x01 && (byte1 & 0x02) == 0x02) { screen52.setMessageLightOn(); } // reset blinking cursor seems to control whether to set or not set the // the cursor position. No documentation for this just testing and // looking at the bit settings of this field. This was a pain in the ass! // // if it is off '0' then keep existing cursor positioning information // if it is on '1' then reset the cursor positioning information // *** Note *** unless we receive bit 4 on at the same time // this seems to work so far if ((byte1 & 0x20) == 0x20 && (byte1 & 0x08) == 0x00) { screen52.setPendingInsert(false,1,1); } // in enhanced mode we sometimes only receive bit 6 turned on which // is reset blinking cursor if ((byte1 & 0x20) == 0x20 && enhanced) { cursorOn = true; } if (!screen52.isStatusErrorCode() && (byte1 & 0x08) == 0x08) {// screen52.setStatus(screen52.STATUS_SYSTEM,screen52.STATUS_VALUE_OFF,null); cursorOn = true; } if ((byte1 & 0x20) == 0x20 && (byte1 & 0x08) == 0x00) { screen52.setPendingInsert(false,1,1); } }
1179 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1179/bcfd5ba28d22d8100110257f977fd7c577f652c2/tnvt.java/buggy/tn5250j/src/org/tn5250j/tnvt.java
public void run () { while (keepTrucking) { try { bk = (Stream5250)dsq.get(); } catch (InterruptedException ie) { System.out.println(" vt thread interrupted and stopping "); keepTrucking = false; continue; } // lets play nicely with the others on the playground// me.yield(); pthread.yield(); invited = false; screen52.setCursorOff();// System.out.println("operation code: " + bk.getOpCode()); if (bk == null) continue; switch (bk.getOpCode()) { case 00:// System.out.println("No operation"); break; case 1:// System.out.println("Invite Operation"); parseIncoming();// screen52.setKeyboardLocked(false); pendingUnlock = true; cursorOn = true; setInvited(); break; case 2:// System.out.println("Output Only"); parseIncoming();// System.out.println(screen52.dirty); screen52.updateDirty(); // invited = true; break; case 3:// System.out.println("Put/Get Operation"); parseIncoming();// inviteIt =true; setInvited(); break; case 4:// System.out.println("Save Screen Operation"); parseIncoming(); break; case 5:// System.out.println("Restore Screen Operation"); parseIncoming(); break; case 6:// System.out.println("Read Immediate"); sendAidKey(0); break; case 7:// System.out.println("Reserved"); break; case 8:// System.out.println("Read Screen Operation"); try { readScreen(); } catch (IOException ex) { } break; case 9:// System.out.println("Reserved"); break; case 10:// System.out.println("Cancel Invite Operation"); cancelInvite(); break; case 11:// System.out.println("Turn on message light"); screen52.setMessageLightOn(); screen52.setCursorOn(); break; case 12:// System.out.println("Turn off Message light"); screen52.setMessageLightOff(); screen52.setCursorOn(); break; default: break; } if (screen52.isUsingGuiInterface()) screen52.drawFields();// if (screen52.screen[0][1].getChar() == '#' &&// screen52.screen[0][2].getChar() == '!')// execCmd();// else { if (screen52.isHotSpots()) { screen52.checkHotSpots(); } try { screen52.updateDirty(); } catch (Exception exd ) { System.out.println(" tnvt.run: " + exd.getMessage()); exd.printStackTrace(); } if (pendingUnlock) screen52.setKeyboardLocked(false); if (cursorOn && !screen52.isKeyboardLocked()) { screen52.setCursorOn(); cursorOn = false; } // lets play nicely with the others on the playground// me.yield(); pthread.yield(); } }
1179 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1179/bcfd5ba28d22d8100110257f977fd7c577f652c2/tnvt.java/buggy/tn5250j/src/org/tn5250j/tnvt.java
case 20:
private boolean writeToDisplay(boolean controlsExist) { int pos = 0; boolean error=false; boolean done=false; int attr; byte nextOne; byte control0 = 0; byte control1 = 0; int saRows = screen52.getRows(); int saCols = screen52.getCols(); try { if (controlsExist) { control0 = bk.getNextByte(); control1 = bk.getNextByte(); processCC0(control0); } while (bk.hasNext() && !done) {// pos = bk.getCurrentPos();// int rowc = screen52.getCurrentRow();// int colc = screen52.getCurrentCol(); switch (bk.getNextByte()) { case 1: // SOH - Start of Header Order error = processSOH(); break; case 02: // RA - Repeat to address int row = screen52.getCurrentRow(); int col = screen52.getCurrentCol(); int toRow = bk.getNextByte(); int toCol = bk.getNextByte() & 0xff; if (toRow >= row) { int repeat = bk.getNextByte(); // a little intelligence here I hope if (row == 1 && col == 2 && toRow == screen52.getRows() && toCol == screen52.getCols()) screen52.clearScreen(); else { if (repeat != 0) repeat = getASCIIChar(repeat); int times = ((toRow * screen52.getCols()) + toCol) - ((row * screen52.getCols()) + col); while (times-- >= 0) { screen52.setChar(repeat); } } } else { sendNegResponse(NR_REQUEST_ERROR,0x05,0x01,0x23," RA invalid"); error =true; } break; case 03: // EA - Erase to address int EArow = screen52.getCurrentRow(); int EAcol = screen52.getCurrentCol(); int toEARow = bk.getNextByte(); int toEACol = bk.getNextByte() & 0xff; int EALength = bk.getNextByte() & 0xff; while (--EALength > 0) { bk.getNextByte(); } char EAAttr = (char)0; // a little intelligence here I hope if (EArow == 1 && EAcol == 2 && toEARow == screen52.getRows() && toEACol == screen52.getCols()) screen52.clearScreen(); else { int times = ((toEARow * screen52.getCols()) + toEACol) - ((EArow * screen52.getCols()) + EAcol); while (times-- >= 0) { screen52.setChar(EAAttr); } } break; case 04: // Command - Escape done = true; break; case 16: // TD - Transparent Data bk.getNextByte(); int j = bk.getNextByte(); // length while (j-- > 0) bk.getNextByte(); break; case 17: // SBA - set buffer address order (row column) int saRow = bk.getNextByte(); int saCol = bk.getNextByte() & 0xff; // make sure it is in bounds if (saRow >= 0 && saRow <= screen52.getRows() && saCol >= 0 && saCol <= screen52.getCols()) { screen52.goto_XY(saRow,saCol); // now set screen position for output } else { sendNegResponse(NR_REQUEST_ERROR,0x05,0x01,0x22,"invalid row/col order" + " saRow = " + saRow + " saRows = " + screen52.getRows() + " saCol = " + saCol); error = true; } break; case 18: // WEA - Extended Attribute bk.getNextByte(); bk.getNextByte(); break; case 19: // IC - Insert Cursor case 20: // MC - Move Cursor int icX = bk.getNextByte(); int icY = bk.getNextByte() & 0xff; if (icX >= 0 && icX <= saRows && icY >= 0 && icY <= saCols)// System.out.println(" IC " + icX + " " + icY); screen52.setPendingInsert(true,icX,icY); else { sendNegResponse(NR_REQUEST_ERROR,0x05,0x01,0x22," IC/IM position invalid "); error = true; } break; case 21: // WTDSF - Write To Display Structured Field order error = writeToDisplayStructuredField(); break; case 29: // SF - Start of Field int fcw1 = 0; int fcw2 = 0; int ffw1 = 0; int ffw0 = bk.getNextByte() & 0xff; // FFW if ((ffw0 & 0x40) == 0x40) { ffw1 = bk.getNextByte() & 0xff; // FFW 1 fcw1 = bk.getNextByte() & 0xff; // check for field control word if (!isAttribute(fcw1)) { fcw2 = bk.getNextByte() & 0xff; // FCW 2 attr = bk.getNextByte() & 0xff; // attribute field } else { attr = fcw1; // attribute of field fcw1 = 0; } } else { attr = ffw0; } int fLength = (bk.getNextByte() & 0xff) << 8 | bk.getNextByte() & 0xff; screen52.addField(attr,fLength, ffw0,ffw1,fcw1,fcw2); break; default: // all others must be output to screen byte byte0 = bk.getByteOffset(-1); if (isAttribute(byte0)) { screen52.setAttr(byte0); } else { if (!screen52.isStatusErrorCode()) { if (!isData(byte0)) {// if (byte0 == 255) {// sendNegResponse(NR_REQUEST_ERROR,0x05,0x01,0x42,// " Attempt to send FF to screen");// }// else screen52.setChar(byte0); } else// screen52.setChar(getASCIIChar(byte0)); screen52.setChar(codePage.ebcdic2uni(byte0)); } else { if (byte0 == 0) screen52.setChar(byte0); else screen52.setChar(getASCIIChar(byte0)); } } break; } if (error) done = true; } } catch (Exception e) { System.out.println("write to display " + e.getMessage()); }; processCC1(control1); return error; }
1179 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1179/bcfd5ba28d22d8100110257f977fd7c577f652c2/tnvt.java/buggy/tn5250j/src/org/tn5250j/tnvt.java
icY <= saCols)
icY <= saCols) {
private boolean writeToDisplay(boolean controlsExist) { int pos = 0; boolean error=false; boolean done=false; int attr; byte nextOne; byte control0 = 0; byte control1 = 0; int saRows = screen52.getRows(); int saCols = screen52.getCols(); try { if (controlsExist) { control0 = bk.getNextByte(); control1 = bk.getNextByte(); processCC0(control0); } while (bk.hasNext() && !done) {// pos = bk.getCurrentPos();// int rowc = screen52.getCurrentRow();// int colc = screen52.getCurrentCol(); switch (bk.getNextByte()) { case 1: // SOH - Start of Header Order error = processSOH(); break; case 02: // RA - Repeat to address int row = screen52.getCurrentRow(); int col = screen52.getCurrentCol(); int toRow = bk.getNextByte(); int toCol = bk.getNextByte() & 0xff; if (toRow >= row) { int repeat = bk.getNextByte(); // a little intelligence here I hope if (row == 1 && col == 2 && toRow == screen52.getRows() && toCol == screen52.getCols()) screen52.clearScreen(); else { if (repeat != 0) repeat = getASCIIChar(repeat); int times = ((toRow * screen52.getCols()) + toCol) - ((row * screen52.getCols()) + col); while (times-- >= 0) { screen52.setChar(repeat); } } } else { sendNegResponse(NR_REQUEST_ERROR,0x05,0x01,0x23," RA invalid"); error =true; } break; case 03: // EA - Erase to address int EArow = screen52.getCurrentRow(); int EAcol = screen52.getCurrentCol(); int toEARow = bk.getNextByte(); int toEACol = bk.getNextByte() & 0xff; int EALength = bk.getNextByte() & 0xff; while (--EALength > 0) { bk.getNextByte(); } char EAAttr = (char)0; // a little intelligence here I hope if (EArow == 1 && EAcol == 2 && toEARow == screen52.getRows() && toEACol == screen52.getCols()) screen52.clearScreen(); else { int times = ((toEARow * screen52.getCols()) + toEACol) - ((EArow * screen52.getCols()) + EAcol); while (times-- >= 0) { screen52.setChar(EAAttr); } } break; case 04: // Command - Escape done = true; break; case 16: // TD - Transparent Data bk.getNextByte(); int j = bk.getNextByte(); // length while (j-- > 0) bk.getNextByte(); break; case 17: // SBA - set buffer address order (row column) int saRow = bk.getNextByte(); int saCol = bk.getNextByte() & 0xff; // make sure it is in bounds if (saRow >= 0 && saRow <= screen52.getRows() && saCol >= 0 && saCol <= screen52.getCols()) { screen52.goto_XY(saRow,saCol); // now set screen position for output } else { sendNegResponse(NR_REQUEST_ERROR,0x05,0x01,0x22,"invalid row/col order" + " saRow = " + saRow + " saRows = " + screen52.getRows() + " saCol = " + saCol); error = true; } break; case 18: // WEA - Extended Attribute bk.getNextByte(); bk.getNextByte(); break; case 19: // IC - Insert Cursor case 20: // MC - Move Cursor int icX = bk.getNextByte(); int icY = bk.getNextByte() & 0xff; if (icX >= 0 && icX <= saRows && icY >= 0 && icY <= saCols)// System.out.println(" IC " + icX + " " + icY); screen52.setPendingInsert(true,icX,icY); else { sendNegResponse(NR_REQUEST_ERROR,0x05,0x01,0x22," IC/IM position invalid "); error = true; } break; case 21: // WTDSF - Write To Display Structured Field order error = writeToDisplayStructuredField(); break; case 29: // SF - Start of Field int fcw1 = 0; int fcw2 = 0; int ffw1 = 0; int ffw0 = bk.getNextByte() & 0xff; // FFW if ((ffw0 & 0x40) == 0x40) { ffw1 = bk.getNextByte() & 0xff; // FFW 1 fcw1 = bk.getNextByte() & 0xff; // check for field control word if (!isAttribute(fcw1)) { fcw2 = bk.getNextByte() & 0xff; // FCW 2 attr = bk.getNextByte() & 0xff; // attribute field } else { attr = fcw1; // attribute of field fcw1 = 0; } } else { attr = ffw0; } int fLength = (bk.getNextByte() & 0xff) << 8 | bk.getNextByte() & 0xff; screen52.addField(attr,fLength, ffw0,ffw1,fcw1,fcw2); break; default: // all others must be output to screen byte byte0 = bk.getByteOffset(-1); if (isAttribute(byte0)) { screen52.setAttr(byte0); } else { if (!screen52.isStatusErrorCode()) { if (!isData(byte0)) {// if (byte0 == 255) {// sendNegResponse(NR_REQUEST_ERROR,0x05,0x01,0x42,// " Attempt to send FF to screen");// }// else screen52.setChar(byte0); } else// screen52.setChar(getASCIIChar(byte0)); screen52.setChar(codePage.ebcdic2uni(byte0)); } else { if (byte0 == 0) screen52.setChar(byte0); else screen52.setChar(getASCIIChar(byte0)); } } break; } if (error) done = true; } } catch (Exception e) { System.out.println("write to display " + e.getMessage()); }; processCC1(control1); return error; }
1179 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1179/bcfd5ba28d22d8100110257f977fd7c577f652c2/tnvt.java/buggy/tn5250j/src/org/tn5250j/tnvt.java
} else { sendNegResponse(NR_REQUEST_ERROR,0x05,0x01,0x22," IC/IM position invalid "); error = true; } break; case 20: int imcX = bk.getNextByte(); int imcY = bk.getNextByte() & 0xff; if (imcX >= 0 && imcX <= saRows && imcY >= 0 && imcY <= saCols) { screen52.setPendingInsert(false,imcX,imcY); }
private boolean writeToDisplay(boolean controlsExist) { int pos = 0; boolean error=false; boolean done=false; int attr; byte nextOne; byte control0 = 0; byte control1 = 0; int saRows = screen52.getRows(); int saCols = screen52.getCols(); try { if (controlsExist) { control0 = bk.getNextByte(); control1 = bk.getNextByte(); processCC0(control0); } while (bk.hasNext() && !done) {// pos = bk.getCurrentPos();// int rowc = screen52.getCurrentRow();// int colc = screen52.getCurrentCol(); switch (bk.getNextByte()) { case 1: // SOH - Start of Header Order error = processSOH(); break; case 02: // RA - Repeat to address int row = screen52.getCurrentRow(); int col = screen52.getCurrentCol(); int toRow = bk.getNextByte(); int toCol = bk.getNextByte() & 0xff; if (toRow >= row) { int repeat = bk.getNextByte(); // a little intelligence here I hope if (row == 1 && col == 2 && toRow == screen52.getRows() && toCol == screen52.getCols()) screen52.clearScreen(); else { if (repeat != 0) repeat = getASCIIChar(repeat); int times = ((toRow * screen52.getCols()) + toCol) - ((row * screen52.getCols()) + col); while (times-- >= 0) { screen52.setChar(repeat); } } } else { sendNegResponse(NR_REQUEST_ERROR,0x05,0x01,0x23," RA invalid"); error =true; } break; case 03: // EA - Erase to address int EArow = screen52.getCurrentRow(); int EAcol = screen52.getCurrentCol(); int toEARow = bk.getNextByte(); int toEACol = bk.getNextByte() & 0xff; int EALength = bk.getNextByte() & 0xff; while (--EALength > 0) { bk.getNextByte(); } char EAAttr = (char)0; // a little intelligence here I hope if (EArow == 1 && EAcol == 2 && toEARow == screen52.getRows() && toEACol == screen52.getCols()) screen52.clearScreen(); else { int times = ((toEARow * screen52.getCols()) + toEACol) - ((EArow * screen52.getCols()) + EAcol); while (times-- >= 0) { screen52.setChar(EAAttr); } } break; case 04: // Command - Escape done = true; break; case 16: // TD - Transparent Data bk.getNextByte(); int j = bk.getNextByte(); // length while (j-- > 0) bk.getNextByte(); break; case 17: // SBA - set buffer address order (row column) int saRow = bk.getNextByte(); int saCol = bk.getNextByte() & 0xff; // make sure it is in bounds if (saRow >= 0 && saRow <= screen52.getRows() && saCol >= 0 && saCol <= screen52.getCols()) { screen52.goto_XY(saRow,saCol); // now set screen position for output } else { sendNegResponse(NR_REQUEST_ERROR,0x05,0x01,0x22,"invalid row/col order" + " saRow = " + saRow + " saRows = " + screen52.getRows() + " saCol = " + saCol); error = true; } break; case 18: // WEA - Extended Attribute bk.getNextByte(); bk.getNextByte(); break; case 19: // IC - Insert Cursor case 20: // MC - Move Cursor int icX = bk.getNextByte(); int icY = bk.getNextByte() & 0xff; if (icX >= 0 && icX <= saRows && icY >= 0 && icY <= saCols)// System.out.println(" IC " + icX + " " + icY); screen52.setPendingInsert(true,icX,icY); else { sendNegResponse(NR_REQUEST_ERROR,0x05,0x01,0x22," IC/IM position invalid "); error = true; } break; case 21: // WTDSF - Write To Display Structured Field order error = writeToDisplayStructuredField(); break; case 29: // SF - Start of Field int fcw1 = 0; int fcw2 = 0; int ffw1 = 0; int ffw0 = bk.getNextByte() & 0xff; // FFW if ((ffw0 & 0x40) == 0x40) { ffw1 = bk.getNextByte() & 0xff; // FFW 1 fcw1 = bk.getNextByte() & 0xff; // check for field control word if (!isAttribute(fcw1)) { fcw2 = bk.getNextByte() & 0xff; // FCW 2 attr = bk.getNextByte() & 0xff; // attribute field } else { attr = fcw1; // attribute of field fcw1 = 0; } } else { attr = ffw0; } int fLength = (bk.getNextByte() & 0xff) << 8 | bk.getNextByte() & 0xff; screen52.addField(attr,fLength, ffw0,ffw1,fcw1,fcw2); break; default: // all others must be output to screen byte byte0 = bk.getByteOffset(-1); if (isAttribute(byte0)) { screen52.setAttr(byte0); } else { if (!screen52.isStatusErrorCode()) { if (!isData(byte0)) {// if (byte0 == 255) {// sendNegResponse(NR_REQUEST_ERROR,0x05,0x01,0x42,// " Attempt to send FF to screen");// }// else screen52.setChar(byte0); } else// screen52.setChar(getASCIIChar(byte0)); screen52.setChar(codePage.ebcdic2uni(byte0)); } else { if (byte0 == 0) screen52.setChar(byte0); else screen52.setChar(getASCIIChar(byte0)); } } break; } if (error) done = true; } } catch (Exception e) { System.out.println("write to display " + e.getMessage()); }; processCC1(control1); return error; }
1179 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1179/bcfd5ba28d22d8100110257f977fd7c577f652c2/tnvt.java/buggy/tn5250j/src/org/tn5250j/tnvt.java
cr = true;
cr = true;
private boolean writeToDisplayStructuredField() { boolean error = false; boolean done = false; int nextone; try { int length = (( bk.getNextByte() & 0xff )<< 8 | (bk.getNextByte() & 0xff)); while (!done) { int s = bk.getNextByte() & 0xff; switch (s) { case 0xD9: // Class Type 0xD9 - Create Window switch (bk.getNextByte()) {// case 0x50: // Define Selection Field//// defineSelectionField(length);// done = true;// break; case 0x51: // Create Window boolean cr = false; int rows = 0; int cols = 0; // pull down not supported yet if ((bk.getNextByte() & 0x80) == 0x80) cr = true; bk.getNextByte(); // get reserved field pos 6 bk.getNextByte(); // get reserved field pos 7 rows = bk.getNextByte(); // get window depth rows pos 8 cols = bk.getNextByte(); // get window width cols pos 9 length -= 9; if (length == 0) { done = true;// System.out.println("Create Window");// System.out.println(" restrict cursor " + cr);// System.out.println(" Depth = " + rows + " Width = " + cols); screen52.createWindow(rows,cols,1,true,32,58, '.', '.', '.', ':', ':', ':', '.', ':'); break; } // pos 10 is Minor Structure int ml = 0; int type = 0; int lastPos = screen52.getLastPos(); int mAttr = 0; int cAttr = 0; while (length > 0) { // get minor length ml = ( bk.getNextByte() & 0xff ); length -= ml; // only normal windows are supported at this time type = bk.getNextByte(); switch (type) { case 0x01 : // Border presentation boolean gui = false; if ((bk.getNextByte() & 0x80) == 0x80) gui = true; mAttr = bk.getNextByte(); cAttr = bk.getNextByte(); char ul = '.'; char upper = '.'; char ur = '.'; char left = ':'; char right = ':'; char ll = ':'; char bottom = '.'; char lr = ':'; // if minor length is greater than 5 then // the border characters are specified if (ml > 5) { ul = getASCIIChar(bk.getNextByte()); if (ul == 0) ul = '.'; upper = getASCIIChar(bk.getNextByte()); if (upper == 0) upper = '.'; ur = getASCIIChar(bk.getNextByte()); if (ur == 0) ur = '.'; left = getASCIIChar(bk.getNextByte()); if (left == 0) left = ':'; right = getASCIIChar(bk.getNextByte()); if (right == 0) right = ':'; ll = getASCIIChar(bk.getNextByte()); if (ll == 0) ll = ':'; bottom = getASCIIChar(bk.getNextByte()); if (bottom == 0) bottom = '.'; lr = getASCIIChar(bk.getNextByte()); if (lr == 0) lr = ':'; }// System.out.println("Create Window");// System.out.println(" restrict cursor " + cr);// System.out.println(" Depth = " + rows + " Width = " + cols);// System.out.println(" type = " + type + " gui = " + gui);// System.out.println(" mono attr = " + mAttr + " color attr = " + cAttr);// System.out.println(" ul = " + ul + " upper = " + upper +// " ur = " + ur +// " left = " + left +// " right = " + right +// " ll = " + ll +// " bottom = " + bottom +// " lr = " + lr// ); screen52.createWindow(rows,cols,type,gui,mAttr,cAttr, ul, upper, ur, left, right, ll, bottom, lr); break; // // The following shows the input for window with a title // // +0000 019A12A0 00000400 00020411 00200107 .......... // +0010 00000018 00000011 06131500 37D95180 ...........R // +0020 00000A24 0D018023 23404040 40404040 ....؃ // +0030 40211000 000000D7 C2C1D9C4 C5D4D67A \uFFFD.....PBARDEMO: // +0040 40D79996 879985A2 A2408281 99408485 Progress bar de // +0050 94961108 1520D5A4 94828599 40968640 mo.Number of // +0060 8595A399 8985A24B 4B4B4B4B 4B7A2011 entries......:. // +0070 082E2040 404040F5 F0F06BF0 F0F02011 . 500,000. // +0080 091520C3 A4999985 95A34085 95A399A8 \uFFFDCurrent entry // +0090 4095A494 8285994B 4B4B7A20 11092E20 number...:.\uFFFD. // +00A0 40404040 4040F56B F0F0F020 110A1520 5,000. // +00B0 D9859481 89958995 87408595 A3998985 Remaining entrie // +00C0 A24B4B4B 4B4B4B7A 20110A2E 20404040 s......:.. // +00D0 40F4F9F5 6BF0F0F0 20110C15 20E2A381 495,000..Sta // +00E0 99A340A3 8994854B 4B4B4B4B 4B4B4B4B rt time......... // +00F0 4B4B4B4B 7A20110C 2F2040F7 7AF5F37A ....:... 7:53: case 0x10 : // Window title/footer byte orientation = bk.getNextByte(); mAttr = bk.getNextByte(); cAttr = bk.getNextByte(); //reserved bk.getNextByte(); ml -= 6; StringBuffer hfBuffer = new StringBuffer(ml); while (ml-- > 0) { hfBuffer.append(getASCIIChar(bk.getNextByte())); } System.out.println( " orientation " + Integer.toBinaryString(orientation) + " mAttr " + mAttr + " cAttr " + cAttr + " Header/Footer " + hfBuffer); screen52.writeWindowTitle(lastPos, rows, cols, orientation, mAttr, cAttr, hfBuffer); break; default: System.out.println("Invalid Window minor structure"); length = 0; done = true; } } done = true; break; case 0x53: // Scroll Bar int sblen = 15; byte sbflag = bk.getNextByte(); // flag position 5 bk.getNextByte(); // reserved position 6 // position 7,8 int totalRowScrollable = (( bk.getNextByte() & 0xff )<< 8 | (bk.getNextByte() & 0xff)); // position 9,10 int totalColScrollable = (( bk.getNextByte() & 0xff )<< 8 | (bk.getNextByte() & 0xff)); // position 11,12 int sliderRowPos = (( bk.getNextByte() & 0xff )<< 8 | (bk.getNextByte() & 0xff)); // position 13,14 int sliderColPos = (( bk.getNextByte() & 0xff )<< 8 | (bk.getNextByte() & 0xff)); // position 15 int sliderRC = bk.getNextByte(); screen52.createScrollBar(sbflag,totalRowScrollable, totalColScrollable, sliderRowPos, sliderColPos, sliderRC); length -= 15; done = true; break; case 0x5B: // Remove GUI ScrollBar field bk.getNextByte(); // reserved must be set to off pos 5 bk.getNextByte(); // reserved must be set to zero pos 6 done = true; break; case 0x5F: // Remove All GUI Constructs// System.out.println("remove all gui contructs"); int len = 4; int d = 0; length -= s; while (--len > 0) d = bk.getNextByte();// if (length > 0) {// len = (bk.getNextByte() & 0xff )<< 8;//// while (--len > 0)// d = bk.getNextByte();// } // per 14.6.13.4 documentation we should clear the // format table after this command screen52.clearTable(); done = true; break; case 0x60: // Erase/Draw Grid Lines - not supported // do not know what they are // as of 03/11/2002 we should not be getting // this anymore but I will leave it here // just in case.// System.out.println("erase/draw grid lines " + length); len = 6; d = 0; length -= 9; while (--len > 0) d = bk.getNextByte(); if (length > 0) { len = (bk.getNextByte() & 0xff )<< 8; while (--len > 0) { d = bk.getNextByte(); } } done = true; break; default: sendNegResponse(NR_REQUEST_ERROR,0x03,0x01,0x01,"invalid wtd structured field sub command " + bk.getByteOffset(-1)); error = true; break; } break; default: sendNegResponse(NR_REQUEST_ERROR,0x03,0x01,0x01, "invalid wtd structured field command " + bk.getByteOffset(-1)); error = true; break; } if (error) done = true; } } catch (Exception e) {}; return error; }
1179 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1179/bcfd5ba28d22d8100110257f977fd7c577f652c2/tnvt.java/buggy/tn5250j/src/org/tn5250j/tnvt.java
private boolean writeToDisplayStructuredField() { boolean error = false; boolean done = false; int nextone; try { int length = (( bk.getNextByte() & 0xff )<< 8 | (bk.getNextByte() & 0xff)); while (!done) { int s = bk.getNextByte() & 0xff; switch (s) { case 0xD9: // Class Type 0xD9 - Create Window switch (bk.getNextByte()) {// case 0x50: // Define Selection Field//// defineSelectionField(length);// done = true;// break; case 0x51: // Create Window boolean cr = false; int rows = 0; int cols = 0; // pull down not supported yet if ((bk.getNextByte() & 0x80) == 0x80) cr = true; bk.getNextByte(); // get reserved field pos 6 bk.getNextByte(); // get reserved field pos 7 rows = bk.getNextByte(); // get window depth rows pos 8 cols = bk.getNextByte(); // get window width cols pos 9 length -= 9; if (length == 0) { done = true;// System.out.println("Create Window");// System.out.println(" restrict cursor " + cr);// System.out.println(" Depth = " + rows + " Width = " + cols); screen52.createWindow(rows,cols,1,true,32,58, '.', '.', '.', ':', ':', ':', '.', ':'); break; } // pos 10 is Minor Structure int ml = 0; int type = 0; int lastPos = screen52.getLastPos(); int mAttr = 0; int cAttr = 0; while (length > 0) { // get minor length ml = ( bk.getNextByte() & 0xff ); length -= ml; // only normal windows are supported at this time type = bk.getNextByte(); switch (type) { case 0x01 : // Border presentation boolean gui = false; if ((bk.getNextByte() & 0x80) == 0x80) gui = true; mAttr = bk.getNextByte(); cAttr = bk.getNextByte(); char ul = '.'; char upper = '.'; char ur = '.'; char left = ':'; char right = ':'; char ll = ':'; char bottom = '.'; char lr = ':'; // if minor length is greater than 5 then // the border characters are specified if (ml > 5) { ul = getASCIIChar(bk.getNextByte()); if (ul == 0) ul = '.'; upper = getASCIIChar(bk.getNextByte()); if (upper == 0) upper = '.'; ur = getASCIIChar(bk.getNextByte()); if (ur == 0) ur = '.'; left = getASCIIChar(bk.getNextByte()); if (left == 0) left = ':'; right = getASCIIChar(bk.getNextByte()); if (right == 0) right = ':'; ll = getASCIIChar(bk.getNextByte()); if (ll == 0) ll = ':'; bottom = getASCIIChar(bk.getNextByte()); if (bottom == 0) bottom = '.'; lr = getASCIIChar(bk.getNextByte()); if (lr == 0) lr = ':'; }// System.out.println("Create Window");// System.out.println(" restrict cursor " + cr);// System.out.println(" Depth = " + rows + " Width = " + cols);// System.out.println(" type = " + type + " gui = " + gui);// System.out.println(" mono attr = " + mAttr + " color attr = " + cAttr);// System.out.println(" ul = " + ul + " upper = " + upper +// " ur = " + ur +// " left = " + left +// " right = " + right +// " ll = " + ll +// " bottom = " + bottom +// " lr = " + lr// ); screen52.createWindow(rows,cols,type,gui,mAttr,cAttr, ul, upper, ur, left, right, ll, bottom, lr); break; // // The following shows the input for window with a title // // +0000 019A12A0 00000400 00020411 00200107 .......... // +0010 00000018 00000011 06131500 37D95180 ...........R // +0020 00000A24 0D018023 23404040 40404040 ....؃ // +0030 40211000 000000D7 C2C1D9C4 C5D4D67A \uFFFD.....PBARDEMO: // +0040 40D79996 879985A2 A2408281 99408485 Progress bar de // +0050 94961108 1520D5A4 94828599 40968640 mo.Number of // +0060 8595A399 8985A24B 4B4B4B4B 4B7A2011 entries......:. // +0070 082E2040 404040F5 F0F06BF0 F0F02011 . 500,000. // +0080 091520C3 A4999985 95A34085 95A399A8 \uFFFDCurrent entry // +0090 4095A494 8285994B 4B4B7A20 11092E20 number...:.\uFFFD. // +00A0 40404040 4040F56B F0F0F020 110A1520 5,000. // +00B0 D9859481 89958995 87408595 A3998985 Remaining entrie // +00C0 A24B4B4B 4B4B4B7A 20110A2E 20404040 s......:.. // +00D0 40F4F9F5 6BF0F0F0 20110C15 20E2A381 495,000..Sta // +00E0 99A340A3 8994854B 4B4B4B4B 4B4B4B4B rt time......... // +00F0 4B4B4B4B 7A20110C 2F2040F7 7AF5F37A ....:... 7:53: case 0x10 : // Window title/footer byte orientation = bk.getNextByte(); mAttr = bk.getNextByte(); cAttr = bk.getNextByte(); //reserved bk.getNextByte(); ml -= 6; StringBuffer hfBuffer = new StringBuffer(ml); while (ml-- > 0) { hfBuffer.append(getASCIIChar(bk.getNextByte())); } System.out.println( " orientation " + Integer.toBinaryString(orientation) + " mAttr " + mAttr + " cAttr " + cAttr + " Header/Footer " + hfBuffer); screen52.writeWindowTitle(lastPos, rows, cols, orientation, mAttr, cAttr, hfBuffer); break; default: System.out.println("Invalid Window minor structure"); length = 0; done = true; } } done = true; break; case 0x53: // Scroll Bar int sblen = 15; byte sbflag = bk.getNextByte(); // flag position 5 bk.getNextByte(); // reserved position 6 // position 7,8 int totalRowScrollable = (( bk.getNextByte() & 0xff )<< 8 | (bk.getNextByte() & 0xff)); // position 9,10 int totalColScrollable = (( bk.getNextByte() & 0xff )<< 8 | (bk.getNextByte() & 0xff)); // position 11,12 int sliderRowPos = (( bk.getNextByte() & 0xff )<< 8 | (bk.getNextByte() & 0xff)); // position 13,14 int sliderColPos = (( bk.getNextByte() & 0xff )<< 8 | (bk.getNextByte() & 0xff)); // position 15 int sliderRC = bk.getNextByte(); screen52.createScrollBar(sbflag,totalRowScrollable, totalColScrollable, sliderRowPos, sliderColPos, sliderRC); length -= 15; done = true; break; case 0x5B: // Remove GUI ScrollBar field bk.getNextByte(); // reserved must be set to off pos 5 bk.getNextByte(); // reserved must be set to zero pos 6 done = true; break; case 0x5F: // Remove All GUI Constructs// System.out.println("remove all gui contructs"); int len = 4; int d = 0; length -= s; while (--len > 0) d = bk.getNextByte();// if (length > 0) {// len = (bk.getNextByte() & 0xff )<< 8;//// while (--len > 0)// d = bk.getNextByte();// } // per 14.6.13.4 documentation we should clear the // format table after this command screen52.clearTable(); done = true; break; case 0x60: // Erase/Draw Grid Lines - not supported // do not know what they are // as of 03/11/2002 we should not be getting // this anymore but I will leave it here // just in case.// System.out.println("erase/draw grid lines " + length); len = 6; d = 0; length -= 9; while (--len > 0) d = bk.getNextByte(); if (length > 0) { len = (bk.getNextByte() & 0xff )<< 8; while (--len > 0) { d = bk.getNextByte(); } } done = true; break; default: sendNegResponse(NR_REQUEST_ERROR,0x03,0x01,0x01,"invalid wtd structured field sub command " + bk.getByteOffset(-1)); error = true; break; } break; default: sendNegResponse(NR_REQUEST_ERROR,0x03,0x01,0x01, "invalid wtd structured field command " + bk.getByteOffset(-1)); error = true; break; } if (error) done = true; } } catch (Exception e) {}; return error; }
1179 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1179/bcfd5ba28d22d8100110257f977fd7c577f652c2/tnvt.java/buggy/tn5250j/src/org/tn5250j/tnvt.java
public void activate_object_with_id(byte[] an_Object_Id, Servant a_servant, boolean use_forwarding )
public void activate_object_with_id(byte[] an_Object_Id, Servant a_servant)
public void activate_object_with_id(byte[] an_Object_Id, Servant a_servant, boolean use_forwarding ) throws ServantAlreadyActive, ObjectAlreadyActive, WrongPolicy { checkDiscarding(); required(ServantRetentionPolicyValue.RETAIN); // If the UNIQUE_ID applies, the servant being passed must not be // already active. if (applies(IdUniquenessPolicyValue.UNIQUE_ID)) { activeObjectMap.Obj sx = aom.findServant(a_servant, false); if (sx != null) throw new ServantAlreadyActive(); } activeObjectMap.Obj exists = aom.get(an_Object_Id); if (exists != null) { if (exists.servant == null) { locateServant(an_Object_Id, a_servant, exists, use_forwarding); exists.setDeactivated(false); } else if (exists.isDeactiveted()) { exists.setDeactivated(false); incarnate(exists, an_Object_Id, a_servant, use_forwarding); } else throw new ObjectAlreadyActive(); } else { servantDelegate delegate = new servantDelegate(a_servant, this, an_Object_Id); connectDelegate(an_Object_Id, delegate); } }
1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/44e3ea509d80974dab547c4d1cf8c070d32bac86/gnuPOA.java/clean/core/src/classpath/gnu/gnu/CORBA/Poa/gnuPOA.java
checkDiscarding(); required(ServantRetentionPolicyValue.RETAIN); if (applies(IdUniquenessPolicyValue.UNIQUE_ID)) { activeObjectMap.Obj sx = aom.findServant(a_servant, false); if (sx != null) throw new ServantAlreadyActive(); } activeObjectMap.Obj exists = aom.get(an_Object_Id); if (exists != null) { if (exists.servant == null) { locateServant(an_Object_Id, a_servant, exists, use_forwarding); exists.setDeactivated(false); } else if (exists.isDeactiveted()) { exists.setDeactivated(false); incarnate(exists, an_Object_Id, a_servant, use_forwarding); } else throw new ObjectAlreadyActive(); } else { servantDelegate delegate = new servantDelegate(a_servant, this, an_Object_Id); connectDelegate(an_Object_Id, delegate); }
activate_object_with_id(an_Object_Id, a_servant, false);
public void activate_object_with_id(byte[] an_Object_Id, Servant a_servant, boolean use_forwarding ) throws ServantAlreadyActive, ObjectAlreadyActive, WrongPolicy { checkDiscarding(); required(ServantRetentionPolicyValue.RETAIN); // If the UNIQUE_ID applies, the servant being passed must not be // already active. if (applies(IdUniquenessPolicyValue.UNIQUE_ID)) { activeObjectMap.Obj sx = aom.findServant(a_servant, false); if (sx != null) throw new ServantAlreadyActive(); } activeObjectMap.Obj exists = aom.get(an_Object_Id); if (exists != null) { if (exists.servant == null) { locateServant(an_Object_Id, a_servant, exists, use_forwarding); exists.setDeactivated(false); } else if (exists.isDeactiveted()) { exists.setDeactivated(false); incarnate(exists, an_Object_Id, a_servant, use_forwarding); } else throw new ObjectAlreadyActive(); } else { servantDelegate delegate = new servantDelegate(a_servant, this, an_Object_Id); connectDelegate(an_Object_Id, delegate); } }
1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/44e3ea509d80974dab547c4d1cf8c070d32bac86/gnuPOA.java/clean/core/src/classpath/gnu/gnu/CORBA/Poa/gnuPOA.java
public TRANSIENT(String reason, int minor, CompletionStatus completed)
public TRANSIENT(String message)
public TRANSIENT(String reason, int minor, CompletionStatus completed) { super(reason, minor, completed); }
1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/20f5673386408fafdc5023d9aa75062c49b110c6/TRANSIENT.java/buggy/core/src/classpath/org/org/omg/CORBA/TRANSIENT.java
super(reason, minor, completed);
super(message, 0, CompletionStatus.COMPLETED_NO);
public TRANSIENT(String reason, int minor, CompletionStatus completed) { super(reason, minor, completed); }
1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/20f5673386408fafdc5023d9aa75062c49b110c6/TRANSIENT.java/buggy/core/src/classpath/org/org/omg/CORBA/TRANSIENT.java
public void setLocation(Point2D p) { setLocation(p.getX(), p.getY()); }
public abstract void setLocation(double x, double y);
public void setLocation(Point2D p) { setLocation(p.getX(), p.getY()); }
1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/560cf787ab92cba97cf57ce7b258e72947e5efbc/Point2D.java/buggy/core/src/classpath/java/java/awt/geom/Point2D.java
if (isAcceleratorHidden()) return super.getPreferredSize(c); else { Insets insets = c.getInsets(); JToolTip tt = (JToolTip) c; String tipText = tt.getTipText(); if (tipText != null)
Dimension d = super.getPreferredSize(c); String acc = getAcceleratorString(); if (acc != null && ! acc.equals(""))
public Dimension getPreferredSize(JComponent c) { if (isAcceleratorHidden()) return super.getPreferredSize(c); else { Insets insets = c.getInsets(); JToolTip tt = (JToolTip) c; String tipText = tt.getTipText(); if (tipText != null) { FontMetrics fm = c.getFontMetrics(c.getFont()); int prefH = fm.getHeight() + insets.top + insets.bottom; int prefW = fm.stringWidth(tipText) + insets.left + insets.right; // this seems to be the first opportunity we have to get the // accelerator string from the component (if it has one) acceleratorString = fetchAcceleratorString(c); if (acceleratorString != null) { prefW += padSpaceBetweenStrings; fm = c.getFontMetrics(acceleratorFont); prefW += fm.stringWidth(acceleratorString); } return new Dimension(prefW, prefH); } else return new Dimension(0, 0); } }
1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/ff4d557efcee4a2c3a25a9cac2252bc626fb10fe/MetalToolTipUI.java/buggy/core/src/classpath/javax/javax/swing/plaf/metal/MetalToolTipUI.java
int prefH = fm.getHeight() + insets.top + insets.bottom; int prefW = fm.stringWidth(tipText) + insets.left + insets.right; acceleratorString = fetchAcceleratorString(c); if (acceleratorString != null) { prefW += padSpaceBetweenStrings; fm = c.getFontMetrics(acceleratorFont); prefW += fm.stringWidth(acceleratorString); } return new Dimension(prefW, prefH); } else return new Dimension(0, 0);
d.width += fm.stringWidth(acc);
public Dimension getPreferredSize(JComponent c) { if (isAcceleratorHidden()) return super.getPreferredSize(c); else { Insets insets = c.getInsets(); JToolTip tt = (JToolTip) c; String tipText = tt.getTipText(); if (tipText != null) { FontMetrics fm = c.getFontMetrics(c.getFont()); int prefH = fm.getHeight() + insets.top + insets.bottom; int prefW = fm.stringWidth(tipText) + insets.left + insets.right; // this seems to be the first opportunity we have to get the // accelerator string from the component (if it has one) acceleratorString = fetchAcceleratorString(c); if (acceleratorString != null) { prefW += padSpaceBetweenStrings; fm = c.getFontMetrics(acceleratorFont); prefW += fm.stringWidth(acceleratorString); } return new Dimension(prefW, prefH); } else return new Dimension(0, 0); } }
1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/ff4d557efcee4a2c3a25a9cac2252bc626fb10fe/MetalToolTipUI.java/buggy/core/src/classpath/javax/javax/swing/plaf/metal/MetalToolTipUI.java
return d;
public Dimension getPreferredSize(JComponent c) { if (isAcceleratorHidden()) return super.getPreferredSize(c); else { Insets insets = c.getInsets(); JToolTip tt = (JToolTip) c; String tipText = tt.getTipText(); if (tipText != null) { FontMetrics fm = c.getFontMetrics(c.getFont()); int prefH = fm.getHeight() + insets.top + insets.bottom; int prefW = fm.stringWidth(tipText) + insets.left + insets.right; // this seems to be the first opportunity we have to get the // accelerator string from the component (if it has one) acceleratorString = fetchAcceleratorString(c); if (acceleratorString != null) { prefW += padSpaceBetweenStrings; fm = c.getFontMetrics(acceleratorFont); prefW += fm.stringWidth(acceleratorString); } return new Dimension(prefW, prefH); } else return new Dimension(0, 0); } }
1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/ff4d557efcee4a2c3a25a9cac2252bc626fb10fe/MetalToolTipUI.java/buggy/core/src/classpath/javax/javax/swing/plaf/metal/MetalToolTipUI.java
JToolTip tip = (JToolTip) c; String text = tip.getTipText(); Toolkit t = tip.getToolkit(); if (text == null) return; Rectangle vr = new Rectangle(); vr = SwingUtilities.calculateInnerArea(tip, vr); Rectangle ir = new Rectangle(); Rectangle tr = new Rectangle(); FontMetrics fm = t.getFontMetrics(tip.getFont()); int ascent = fm.getAscent(); SwingUtilities.layoutCompoundLabel(tip, fm, text, null, SwingConstants.CENTER, SwingConstants.LEFT, SwingConstants.CENTER, SwingConstants.CENTER, vr, ir, tr, 0); Color saved = g.getColor(); g.setColor(Color.BLACK); g.drawString(text, vr.x, vr.y + ascent); if (acceleratorString != null) { g.setFont(acceleratorFont); g.setColor(acceleratorForeground); fm = t.getFontMetrics(acceleratorFont); int width = fm.stringWidth(acceleratorString); g.drawString(acceleratorString, vr.x + vr.width - width - padSpaceBetweenStrings / 2, vr.y + vr.height - fm.getDescent()); } g.setColor(saved);
super.paint(g, c);
public void paint(Graphics g, JComponent c) { JToolTip tip = (JToolTip) c; String text = tip.getTipText(); Toolkit t = tip.getToolkit(); if (text == null) return; Rectangle vr = new Rectangle(); vr = SwingUtilities.calculateInnerArea(tip, vr); Rectangle ir = new Rectangle(); Rectangle tr = new Rectangle(); FontMetrics fm = t.getFontMetrics(tip.getFont()); int ascent = fm.getAscent(); SwingUtilities.layoutCompoundLabel(tip, fm, text, null, SwingConstants.CENTER, SwingConstants.LEFT, SwingConstants.CENTER, SwingConstants.CENTER, vr, ir, tr, 0); Color saved = g.getColor(); g.setColor(Color.BLACK); g.drawString(text, vr.x, vr.y + ascent); // paint accelerator if (acceleratorString != null) { g.setFont(acceleratorFont); g.setColor(acceleratorForeground); fm = t.getFontMetrics(acceleratorFont); int width = fm.stringWidth(acceleratorString); g.drawString(acceleratorString, vr.x + vr.width - width - padSpaceBetweenStrings / 2, vr.y + vr.height - fm.getDescent()); } g.setColor(saved); }
1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/ff4d557efcee4a2c3a25a9cac2252bc626fb10fe/MetalToolTipUI.java/buggy/core/src/classpath/javax/javax/swing/plaf/metal/MetalToolTipUI.java
super(ClassLoader.getSystemResource("/org/jnode/security/jnode.policy"));
this.policyFile = new PolicyFile(ClassLoader.getSystemResource("/org/jnode/security/jnode.policy"));
public JNodePolicy(ExtensionPoint permissionsEp) { super(ClassLoader.getSystemResource("/org/jnode/security/jnode.policy")); this.codeSource2Permissions = new HashMap(); this.permissionsEp = permissionsEp; loadExtensions(); }
1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/e7ba6ccc0138cc0edd9484ef9d447008e8271fd1/JNodePolicy.java/clean/core/src/core/org/jnode/security/JNodePolicy.java
protected void addPermissions(CodeSource codeSource, Permissions perms) {
protected void addPermissions(CodeSource codeSource, PermissionCollection perms) {
protected void addPermissions(CodeSource codeSource, Permissions perms) { for (Iterator it = codeSource2Permissions.entrySet().iterator(); it .hasNext();) { final Map.Entry e = (Map.Entry) it.next(); final CodeSource cs = (CodeSource) e.getKey(); if (cs.implies(codeSource)) { // BootLog.info(cs + " -> " + codeSource); final PermissionCollection pc = (PermissionCollection) e .getValue(); for (Enumeration ee = pc.elements(); ee.hasMoreElements();) { perms.add((Permission) ee.nextElement()); } } } }
1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/e7ba6ccc0138cc0edd9484ef9d447008e8271fd1/JNodePolicy.java/clean/core/src/core/org/jnode/security/JNodePolicy.java
super.refresh();
policyFile.refresh();
public synchronized void refresh() { super.refresh(); loadExtensions(); }
1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/e7ba6ccc0138cc0edd9484ef9d447008e8271fd1/JNodePolicy.java/clean/core/src/core/org/jnode/security/JNodePolicy.java
this.width = (int) (w * units + 0.5f); this.height = (int) (h * units + 0.5f);
this.w = (int) (w * units + 0.5f); this.h = (int) (h * units + 0.5f);
public MediaPrintableArea(float x, float y, float w, float h, int units) { if (x < 0.0f || y < 0.0f || w <= 0.0f || h <= 0.0f) throw new IllegalArgumentException(); this.x = (int) (x * units + 0.5f); this.y = (int) (y * units + 0.5f); this.width = (int) (w * units + 0.5f); this.height = (int) (h * units + 0.5f); }
1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/b9aa2b76c5fb6ec27c94f7eecf71cb3bc137fe2f/MediaPrintableArea.java/clean/core/src/classpath/javax/javax/print/attribute/standard/MediaPrintableArea.java
&& width == tmp.getWidth(1) && height == tmp.getHeight(1));
&& w == tmp.getWidth(1) && h == tmp.getHeight(1));
public boolean equals(Object obj) { if (! (obj instanceof MediaPrintableArea)) return false; MediaPrintableArea tmp = (MediaPrintableArea) obj; return (x == tmp.getX(1) && y == tmp.getY(1) && width == tmp.getWidth(1) && height == tmp.getHeight(1)); }
1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/b9aa2b76c5fb6ec27c94f7eecf71cb3bc137fe2f/MediaPrintableArea.java/clean/core/src/classpath/javax/javax/print/attribute/standard/MediaPrintableArea.java
return height / ((float)units);
return h / ((float)units);
public float getHeight(int units) { if (units < 1) throw new IllegalArgumentException("units may not be less than 1"); return height / ((float)units); }
1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/b9aa2b76c5fb6ec27c94f7eecf71cb3bc137fe2f/MediaPrintableArea.java/clean/core/src/classpath/javax/javax/print/attribute/standard/MediaPrintableArea.java
return width / ((float)units);
return w / ((float)units);
public float getWidth(int units) { if (units < 1) throw new IllegalArgumentException("units may not be less than 1"); return width / ((float)units); }
1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/b9aa2b76c5fb6ec27c94f7eecf71cb3bc137fe2f/MediaPrintableArea.java/clean/core/src/classpath/javax/javax/print/attribute/standard/MediaPrintableArea.java
return x ^ y + width ^ height;
return x ^ y + w ^ h;
public int hashCode() { return x ^ y + width ^ height; }
1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/b9aa2b76c5fb6ec27c94f7eecf71cb3bc137fe2f/MediaPrintableArea.java/clean/core/src/classpath/javax/javax/print/attribute/standard/MediaPrintableArea.java
public InvalidKeyException(String msg)
public InvalidKeyException()
public InvalidKeyException(String msg) { super(msg); }
1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/e8834e60eedea5a65712de1e0c0fa2d875e22b9c/InvalidKeyException.java/buggy/core/src/classpath/java/java/security/InvalidKeyException.java
super(msg);
public InvalidKeyException(String msg) { super(msg); }
1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/e8834e60eedea5a65712de1e0c0fa2d875e22b9c/InvalidKeyException.java/buggy/core/src/classpath/java/java/security/InvalidKeyException.java
if (model.isArmed() && model.isPressed())
if ((model.isArmed() && model.isPressed()) || (comboBox.isFocusOwner() && !comboBox.isPopupVisible()))
public void paintComponent(Graphics g) { super.paintComponent(g); Insets insets = this.getInsets(); int w = getWidth() - (insets.left + insets.right); int h = getHeight() - (insets.top + insets.bottom); if (h > 0 && w > 0) { int x1 = insets.left; int y1 = insets.top; int x2 = x1 + (w - 1); int y2 = y1 + (h - 1); int iconWidth = 0; int iconX = x2; if (comboIcon != null) { iconWidth = comboIcon.getIconWidth(); int iconHeight = comboIcon.getIconHeight(); int iconY; if (iconOnly) { iconX = getWidth() / 2 - iconWidth / 2; iconY = getHeight() / 2 - iconHeight / 2; } else { iconX = x1 + (w - 1) - iconWidth; iconY = y1 + (y2 - y1) / 2 - iconHeight / 2; } comboIcon.paintIcon(this, g, iconX, iconY); if (this.hasFocus()) { g.setColor(MetalLookAndFeel.getFocusColor()); g.drawRect(x1 - 1, y1 - 1, w + 3, h + 1); } } if (! iconOnly && comboBox != null) { ListCellRenderer renderer = comboBox.getRenderer(); boolean pressed = this.getModel().isPressed(); Component comp = renderer.getListCellRendererComponent(listBox, comboBox.getSelectedItem(), -1, false, false); comp.setFont(rendererPane.getFont()); if (model.isArmed() && model.isPressed()) { if (isOpaque()) { comp.setBackground(UIManager.getColor("Button.select")); comp.setForeground(comboBox.getForeground()); } } else if (! comboBox.isEnabled()) { if (this.isOpaque()) { Color dbg = UIManager.getColor("ComboBox.disabledBackground"); comp.setBackground(dbg); Color dfg = UIManager.getColor("ComboBox.disabledForeground"); comp.setForeground(dfg); } } else { comp.setForeground(comboBox.getForeground()); comp.setBackground(comboBox.getBackground()); } int wr = w - (insets.right + iconWidth); rendererPane.paintComponent(g, comp, this, x1, y1, wr, h); } } }
1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/ff4d557efcee4a2c3a25a9cac2252bc626fb10fe/MetalComboBoxButton.java/clean/core/src/classpath/javax/javax/swing/plaf/metal/MetalComboBoxButton.java
public synchronized void addComponentListener(ComponentListener l)
public synchronized void addComponentListener(ComponentListener listener)
public synchronized void addComponentListener(ComponentListener l) { componentListener = AWTEventMulticaster.add(componentListener, l); if (componentListener != null) enableEvents(AWTEvent.COMPONENT_EVENT_MASK); }
1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/cdb624bf4a3742cc4374523f5c6856a06dcd8f92/Component.java/clean/core/src/classpath/java/java/awt/Component.java
componentListener = AWTEventMulticaster.add(componentListener, l);
componentListener = AWTEventMulticaster.add(componentListener, listener);
public synchronized void addComponentListener(ComponentListener l) { componentListener = AWTEventMulticaster.add(componentListener, l); if (componentListener != null) enableEvents(AWTEvent.COMPONENT_EVENT_MASK); }
1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/cdb624bf4a3742cc4374523f5c6856a06dcd8f92/Component.java/clean/core/src/classpath/java/java/awt/Component.java
public synchronized void addFocusListener(FocusListener l)
public synchronized void addFocusListener(FocusListener listener)
public synchronized void addFocusListener(FocusListener l) { focusListener = AWTEventMulticaster.add(focusListener, l); if (focusListener != null) enableEvents(AWTEvent.FOCUS_EVENT_MASK); }
1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/cdb624bf4a3742cc4374523f5c6856a06dcd8f92/Component.java/clean/core/src/classpath/java/java/awt/Component.java
focusListener = AWTEventMulticaster.add(focusListener, l);
focusListener = AWTEventMulticaster.add(focusListener, listener);
public synchronized void addFocusListener(FocusListener l) { focusListener = AWTEventMulticaster.add(focusListener, l); if (focusListener != null) enableEvents(AWTEvent.FOCUS_EVENT_MASK); }
1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/cdb624bf4a3742cc4374523f5c6856a06dcd8f92/Component.java/clean/core/src/classpath/java/java/awt/Component.java
addHierarchyBoundsListener(HierarchyBoundsListener l)
addHierarchyBoundsListener(HierarchyBoundsListener listener)
addHierarchyBoundsListener(HierarchyBoundsListener l) { hierarchyBoundsListener = AWTEventMulticaster.add(hierarchyBoundsListener, l); if (hierarchyBoundsListener != null) enableEvents(AWTEvent.HIERARCHY_BOUNDS_EVENT_MASK); }
1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/cdb624bf4a3742cc4374523f5c6856a06dcd8f92/Component.java/clean/core/src/classpath/java/java/awt/Component.java
AWTEventMulticaster.add(hierarchyBoundsListener, l);
AWTEventMulticaster.add(hierarchyBoundsListener, listener);
addHierarchyBoundsListener(HierarchyBoundsListener l) { hierarchyBoundsListener = AWTEventMulticaster.add(hierarchyBoundsListener, l); if (hierarchyBoundsListener != null) enableEvents(AWTEvent.HIERARCHY_BOUNDS_EVENT_MASK); }
1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/cdb624bf4a3742cc4374523f5c6856a06dcd8f92/Component.java/clean/core/src/classpath/java/java/awt/Component.java
public synchronized void addHierarchyListener(HierarchyListener l)
public synchronized void addHierarchyListener(HierarchyListener listener)
public synchronized void addHierarchyListener(HierarchyListener l) { hierarchyListener = AWTEventMulticaster.add(hierarchyListener, l); if (hierarchyListener != null) enableEvents(AWTEvent.HIERARCHY_EVENT_MASK); }
1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/cdb624bf4a3742cc4374523f5c6856a06dcd8f92/Component.java/clean/core/src/classpath/java/java/awt/Component.java
hierarchyListener = AWTEventMulticaster.add(hierarchyListener, l);
hierarchyListener = AWTEventMulticaster.add(hierarchyListener, listener);
public synchronized void addHierarchyListener(HierarchyListener l) { hierarchyListener = AWTEventMulticaster.add(hierarchyListener, l); if (hierarchyListener != null) enableEvents(AWTEvent.HIERARCHY_EVENT_MASK); }
1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/cdb624bf4a3742cc4374523f5c6856a06dcd8f92/Component.java/clean/core/src/classpath/java/java/awt/Component.java
public synchronized void addInputMethodListener(InputMethodListener l)
public synchronized void addInputMethodListener(InputMethodListener listener)
public synchronized void addInputMethodListener(InputMethodListener l) { inputMethodListener = AWTEventMulticaster.add(inputMethodListener, l); if (inputMethodListener != null) enableEvents(AWTEvent.INPUT_METHOD_EVENT_MASK); }
1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/cdb624bf4a3742cc4374523f5c6856a06dcd8f92/Component.java/clean/core/src/classpath/java/java/awt/Component.java
inputMethodListener = AWTEventMulticaster.add(inputMethodListener, l);
inputMethodListener = AWTEventMulticaster.add(inputMethodListener, listener);
public synchronized void addInputMethodListener(InputMethodListener l) { inputMethodListener = AWTEventMulticaster.add(inputMethodListener, l); if (inputMethodListener != null) enableEvents(AWTEvent.INPUT_METHOD_EVENT_MASK); }
1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/cdb624bf4a3742cc4374523f5c6856a06dcd8f92/Component.java/clean/core/src/classpath/java/java/awt/Component.java
public synchronized void addKeyListener(KeyListener l)
public synchronized void addKeyListener(KeyListener listener)
public synchronized void addKeyListener(KeyListener l) { keyListener = AWTEventMulticaster.add(keyListener, l); if (keyListener != null) enableEvents(AWTEvent.KEY_EVENT_MASK); }
1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/cdb624bf4a3742cc4374523f5c6856a06dcd8f92/Component.java/clean/core/src/classpath/java/java/awt/Component.java
keyListener = AWTEventMulticaster.add(keyListener, l);
keyListener = AWTEventMulticaster.add(keyListener, listener);
public synchronized void addKeyListener(KeyListener l) { keyListener = AWTEventMulticaster.add(keyListener, l); if (keyListener != null) enableEvents(AWTEvent.KEY_EVENT_MASK); }
1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/cdb624bf4a3742cc4374523f5c6856a06dcd8f92/Component.java/clean/core/src/classpath/java/java/awt/Component.java
public synchronized void addMouseListener(MouseListener l)
public synchronized void addMouseListener(MouseListener listener)
public synchronized void addMouseListener(MouseListener l) { mouseListener = AWTEventMulticaster.add(mouseListener, l); if (mouseListener != null) enableEvents(AWTEvent.MOUSE_EVENT_MASK); }
1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/cdb624bf4a3742cc4374523f5c6856a06dcd8f92/Component.java/clean/core/src/classpath/java/java/awt/Component.java
mouseListener = AWTEventMulticaster.add(mouseListener, l);
mouseListener = AWTEventMulticaster.add(mouseListener, listener);
public synchronized void addMouseListener(MouseListener l) { mouseListener = AWTEventMulticaster.add(mouseListener, l); if (mouseListener != null) enableEvents(AWTEvent.MOUSE_EVENT_MASK); }
1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/cdb624bf4a3742cc4374523f5c6856a06dcd8f92/Component.java/clean/core/src/classpath/java/java/awt/Component.java
public synchronized void addMouseMotionListener(MouseMotionListener l)
public synchronized void addMouseMotionListener(MouseMotionListener listener)
public synchronized void addMouseMotionListener(MouseMotionListener l) { mouseMotionListener = AWTEventMulticaster.add(mouseMotionListener, l); if (mouseMotionListener != null) enableEvents(AWTEvent.MOUSE_EVENT_MASK); }
1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/cdb624bf4a3742cc4374523f5c6856a06dcd8f92/Component.java/clean/core/src/classpath/java/java/awt/Component.java
mouseMotionListener = AWTEventMulticaster.add(mouseMotionListener, l);
mouseMotionListener = AWTEventMulticaster.add(mouseMotionListener, listener);
public synchronized void addMouseMotionListener(MouseMotionListener l) { mouseMotionListener = AWTEventMulticaster.add(mouseMotionListener, l); if (mouseMotionListener != null) enableEvents(AWTEvent.MOUSE_EVENT_MASK); }
1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/cdb624bf4a3742cc4374523f5c6856a06dcd8f92/Component.java/clean/core/src/classpath/java/java/awt/Component.java
public synchronized void addMouseWheelListener(MouseWheelListener l)
public synchronized void addMouseWheelListener(MouseWheelListener listener)
public synchronized void addMouseWheelListener(MouseWheelListener l) { mouseWheelListener = AWTEventMulticaster.add(mouseWheelListener, l); if (mouseWheelListener != null) enableEvents(AWTEvent.MOUSE_WHEEL_EVENT_MASK); }
1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/cdb624bf4a3742cc4374523f5c6856a06dcd8f92/Component.java/clean/core/src/classpath/java/java/awt/Component.java
mouseWheelListener = AWTEventMulticaster.add(mouseWheelListener, l);
mouseWheelListener = AWTEventMulticaster.add(mouseWheelListener, listener);
public synchronized void addMouseWheelListener(MouseWheelListener l) { mouseWheelListener = AWTEventMulticaster.add(mouseWheelListener, l); if (mouseWheelListener != null) enableEvents(AWTEvent.MOUSE_WHEEL_EVENT_MASK); }
1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/cdb624bf4a3742cc4374523f5c6856a06dcd8f92/Component.java/clean/core/src/classpath/java/java/awt/Component.java
public synchronized void removeComponentListener(ComponentListener l)
public synchronized void removeComponentListener(ComponentListener listener)
public synchronized void removeComponentListener(ComponentListener l) { componentListener = AWTEventMulticaster.remove(componentListener, l); }
1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/cdb624bf4a3742cc4374523f5c6856a06dcd8f92/Component.java/clean/core/src/classpath/java/java/awt/Component.java
componentListener = AWTEventMulticaster.remove(componentListener, l);
componentListener = AWTEventMulticaster.remove(componentListener, listener);
public synchronized void removeComponentListener(ComponentListener l) { componentListener = AWTEventMulticaster.remove(componentListener, l); }
1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/cdb624bf4a3742cc4374523f5c6856a06dcd8f92/Component.java/clean/core/src/classpath/java/java/awt/Component.java
public synchronized void removeFocusListener(FocusListener l)
public synchronized void removeFocusListener(FocusListener listener)
public synchronized void removeFocusListener(FocusListener l) { focusListener = AWTEventMulticaster.remove(focusListener, l); }
1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/cdb624bf4a3742cc4374523f5c6856a06dcd8f92/Component.java/clean/core/src/classpath/java/java/awt/Component.java
focusListener = AWTEventMulticaster.remove(focusListener, l);
focusListener = AWTEventMulticaster.remove(focusListener, listener);
public synchronized void removeFocusListener(FocusListener l) { focusListener = AWTEventMulticaster.remove(focusListener, l); }
1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/cdb624bf4a3742cc4374523f5c6856a06dcd8f92/Component.java/clean/core/src/classpath/java/java/awt/Component.java
removeHierarchyBoundsListener(HierarchyBoundsListener l)
removeHierarchyBoundsListener(HierarchyBoundsListener listener)
removeHierarchyBoundsListener(HierarchyBoundsListener l) { hierarchyBoundsListener = AWTEventMulticaster.remove(hierarchyBoundsListener, l); }
1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/cdb624bf4a3742cc4374523f5c6856a06dcd8f92/Component.java/clean/core/src/classpath/java/java/awt/Component.java
AWTEventMulticaster.remove(hierarchyBoundsListener, l);
AWTEventMulticaster.remove(hierarchyBoundsListener, listener);
removeHierarchyBoundsListener(HierarchyBoundsListener l) { hierarchyBoundsListener = AWTEventMulticaster.remove(hierarchyBoundsListener, l); }
1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/cdb624bf4a3742cc4374523f5c6856a06dcd8f92/Component.java/clean/core/src/classpath/java/java/awt/Component.java
public synchronized void removeHierarchyListener(HierarchyListener l)
public synchronized void removeHierarchyListener(HierarchyListener listener)
public synchronized void removeHierarchyListener(HierarchyListener l) { hierarchyListener = AWTEventMulticaster.remove(hierarchyListener, l); }
1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/cdb624bf4a3742cc4374523f5c6856a06dcd8f92/Component.java/clean/core/src/classpath/java/java/awt/Component.java
hierarchyListener = AWTEventMulticaster.remove(hierarchyListener, l);
hierarchyListener = AWTEventMulticaster.remove(hierarchyListener, listener);
public synchronized void removeHierarchyListener(HierarchyListener l) { hierarchyListener = AWTEventMulticaster.remove(hierarchyListener, l); }
1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/cdb624bf4a3742cc4374523f5c6856a06dcd8f92/Component.java/clean/core/src/classpath/java/java/awt/Component.java
public synchronized void removeInputMethodListener(InputMethodListener l)
public synchronized void removeInputMethodListener(InputMethodListener listener)
public synchronized void removeInputMethodListener(InputMethodListener l) { inputMethodListener = AWTEventMulticaster.remove(inputMethodListener, l); }
1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/cdb624bf4a3742cc4374523f5c6856a06dcd8f92/Component.java/clean/core/src/classpath/java/java/awt/Component.java
inputMethodListener = AWTEventMulticaster.remove(inputMethodListener, l);
inputMethodListener = AWTEventMulticaster.remove(inputMethodListener, listener);
public synchronized void removeInputMethodListener(InputMethodListener l) { inputMethodListener = AWTEventMulticaster.remove(inputMethodListener, l); }
1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/cdb624bf4a3742cc4374523f5c6856a06dcd8f92/Component.java/clean/core/src/classpath/java/java/awt/Component.java
public synchronized void removeKeyListener(KeyListener l)
public synchronized void removeKeyListener(KeyListener listener)
public synchronized void removeKeyListener(KeyListener l) { keyListener = AWTEventMulticaster.remove(keyListener, l); }
1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/cdb624bf4a3742cc4374523f5c6856a06dcd8f92/Component.java/clean/core/src/classpath/java/java/awt/Component.java
keyListener = AWTEventMulticaster.remove(keyListener, l);
keyListener = AWTEventMulticaster.remove(keyListener, listener);
public synchronized void removeKeyListener(KeyListener l) { keyListener = AWTEventMulticaster.remove(keyListener, l); }
1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/cdb624bf4a3742cc4374523f5c6856a06dcd8f92/Component.java/clean/core/src/classpath/java/java/awt/Component.java
public synchronized void removeMouseListener(MouseListener l)
public synchronized void removeMouseListener(MouseListener listener)
public synchronized void removeMouseListener(MouseListener l) { mouseListener = AWTEventMulticaster.remove(mouseListener, l); }
1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/cdb624bf4a3742cc4374523f5c6856a06dcd8f92/Component.java/clean/core/src/classpath/java/java/awt/Component.java