1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.xnap.transfer.action;
21
22 import java.awt.event.ActionEvent;
23
24 import javax.swing.AbstractAction;
25 import javax.swing.Action;
26
27 import org.xnap.XNap;
28 import org.xnap.gui.util.IconHelper;
29 import org.xnap.transfer.Priorizable;
30
31 /***
32 * Provides the default raise action.
33 */
34 public abstract class RaisePriorityAction extends AbstractAction {
35
36
37
38
39
40 private Priorizable transfer;
41
42
43
44 public RaisePriorityAction(Priorizable transfer)
45 {
46 this.transfer = transfer;
47
48 putValue(Action.NAME, XNap.tr("Raise Priority"));
49 putValue(Action.SHORT_DESCRIPTION,
50 XNap.tr("Raises the priority of the selected transfers."));
51 putValue(IconHelper.XNAP_ICON, "1uparrow.png");
52 }
53
54
55
56 public void actionPerformed(ActionEvent event)
57 {
58 int priority = transfer.getPriority();
59 if (priority < Priorizable.MAX_PRIORITY) {
60 transfer.setPriority(priority + 1);
61 }
62 }
63
64 public boolean equals(Object o)
65 {
66 return o instanceof RaisePriorityAction;
67 }
68
69 }