home *** CD-ROM | disk | FTP | other *** search
- package javax.swing.plaf.basic;
-
- import java.awt.event.ActionEvent;
- import javax.swing.ListSelectionModel;
-
- class BasicListUI$IncrementLeadSelectionAction extends BasicListUI.ListAction {
- // $FF: synthetic field
- private final BasicListUI this$0;
- protected int amount;
- protected int selectionType;
-
- protected BasicListUI$IncrementLeadSelectionAction(BasicListUI var1, String var2, int var3) {
- this(var1, var2, var3, -1);
- }
-
- protected BasicListUI$IncrementLeadSelectionAction(BasicListUI var1, String var2, int var3, int var4) {
- super(var1, var2);
- this.this$0 = var1;
- this.amount = var4;
- this.selectionType = var3;
- }
-
- public void actionPerformed(ActionEvent var1) {
- int var2 = this.getNextIndex();
- if (var2 >= 0 && var2 < this.this$0.list.getModel().getSize()) {
- ListSelectionModel var3 = this.this$0.list.getSelectionModel();
- if (this.selectionType == 2) {
- int var4 = var3.getAnchorSelectionIndex();
- if (var4 == -1) {
- var4 = var2;
- }
-
- this.this$0.list.setSelectionInterval(var4, var2);
- var3.setAnchorSelectionIndex(var4);
- var3.setLeadSelectionIndex(var2);
- } else if (this.selectionType == 1) {
- this.this$0.list.setSelectedIndex(var2);
- } else {
- var3.setLeadSelectionIndex(var2);
- }
-
- this.ensureIndexIsVisible(var2);
- }
-
- }
-
- protected void ensureIndexIsVisible(int var1) {
- this.this$0.list.ensureIndexIsVisible(var1);
- }
-
- protected int getNextIndex() {
- int var1 = this.this$0.list.getLeadSelectionIndex();
- int var2 = this.this$0.list.getModel().getSize();
- if (var1 == -1) {
- if (var2 > 0) {
- if (this.amount > 0) {
- var1 = 0;
- } else {
- var1 = var2 - 1;
- }
- }
- } else {
- var1 += this.amount;
- }
-
- return var1;
- }
- }
-