home *** CD-ROM | disk | FTP | other *** search
- package javax.swing.plaf.basic;
-
- import java.awt.event.ActionEvent;
- import javax.swing.AbstractAction;
- import javax.swing.ListSelectionModel;
-
- class BasicTableUI$NavigationalAction extends AbstractAction {
- // $FF: synthetic field
- private final BasicTableUI this$0;
- // $FF: renamed from: dx int
- private int field_0;
- // $FF: renamed from: dy int
- private int field_1;
- private boolean toggle;
- private boolean extend;
- private boolean moveAnchor;
- private boolean inSelection;
- private int anchorRow;
- private int anchorColumn;
- private int leadRow;
- private int leadColumn;
-
- private BasicTableUI$NavigationalAction(BasicTableUI var1, int var2, int var3, boolean var4, boolean var5, boolean var6, boolean var7) {
- this.this$0 = var1;
- this.field_0 = var2;
- this.field_1 = var3;
- this.toggle = var4;
- this.extend = var5;
- this.moveAnchor = var6;
- this.inSelection = var7;
- }
-
- // $FF: synthetic method
- BasicTableUI$NavigationalAction(BasicTableUI var1, BasicTableUI.3 var2, int var3, int var4, boolean var5, boolean var6, boolean var7, boolean var8) {
- this(var1, var3, var4, var5, var6, var7, var8);
- }
-
- public void actionPerformed(ActionEvent var1) {
- ListSelectionModel var2 = this.this$0.table.getSelectionModel();
- this.anchorRow = var2.getAnchorSelectionIndex();
- this.leadRow = var2.getLeadSelectionIndex();
- ListSelectionModel var3 = this.this$0.table.getColumnModel().getSelectionModel();
- this.anchorColumn = var3.getAnchorSelectionIndex();
- this.leadColumn = var3.getLeadSelectionIndex();
- int var4 = this.anchorRow;
- int var5 = this.anchorColumn;
- boolean var6 = this.selectionSpan(var2) * this.selectionSpan(var3) == 1;
- if (this.inSelection && !var6) {
- this.anchorRow += this.field_1;
- this.anchorColumn += this.field_0;
- this.limitToSelectedRange(false);
- var2.setAnchorSelectionIndex(this.anchorRow);
- var3.setAnchorSelectionIndex(this.anchorColumn);
- } else if (this.moveAnchor) {
- this.anchorRow += this.field_1;
- this.anchorColumn += this.field_0;
- if (this.inTableRange(this.anchorRow, this.anchorColumn)) {
- BasicTableUI.access$0(this.this$0, this.anchorRow, this.anchorColumn, false, this.extend);
- }
- } else {
- this.leadRow += this.field_1;
- this.leadColumn += this.field_0;
- if (this.inTableRange(this.leadRow, this.leadColumn)) {
- BasicTableUI.access$0(this.this$0, this.leadRow, this.leadColumn, false, this.extend);
- }
- }
-
- if (this.this$0.table.isEditing() && (var4 != var2.getAnchorSelectionIndex() || var5 != var3.getAnchorSelectionIndex())) {
- this.this$0.table.getCellEditor().stopCellEditing();
- }
-
- }
-
- private boolean inRange(int var1, int var2, int var3) {
- return var1 >= var2 && var1 < var3;
- }
-
- private boolean inTableRange(int var1, int var2) {
- return this.inRange(var1, 0, this.this$0.table.getRowCount()) && this.inRange(var2, 0, this.this$0.table.getColumnCount());
- }
-
- private int indexSign(int var1, ListSelectionModel var2) {
- if (var1 < var2.getMinSelectionIndex()) {
- return -1;
- } else {
- return var1 > var2.getMaxSelectionIndex() ? 1 : 0;
- }
- }
-
- private void limitToSelectedRange(boolean var1) {
- ListSelectionModel var2 = this.this$0.table.getSelectionModel();
- ListSelectionModel var3 = this.this$0.table.getColumnModel().getSelectionModel();
- int var4 = this.indexSign(this.anchorRow, var2);
- int var5 = this.indexSign(this.anchorColumn, var3);
- this.anchorRow -= this.selectionSpan(var2) * var4;
- this.anchorColumn -= this.selectionSpan(var3) * var5;
- if (!var1) {
- this.anchorRow += var5;
- this.anchorColumn += var4;
- this.limitToSelectedRange(true);
- }
-
- }
-
- private int selectionSpan(ListSelectionModel var1) {
- return var1.getMaxSelectionIndex() - var1.getMinSelectionIndex() + 1;
- }
- }
-