KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > rero > dcc > DCCUtilities


1 package rero.dcc;
2
3 import java.util.*;
4 import rero.config.*;
5 import rero.dialogs.dcc.*;
6
7 import rero.client.*;
8 import rero.gui.*;
9
10 public class DCCUtilities
11 {
12    /** Resume related options *from* the resume dialog box */
13
14    public static final int RESUME_OPTION_SELECTED = 0; // these have to be in order due to the way
15
public static final int RENAME_OPTION_SELECTED = 1; // the combobox works in the DCK for dialogs
16
public static final int OVERWRITE_OPTION_SELECTED = 2;
17
18    /** Normal DCC Options from the DCC configuration setup */
19    
20    public static final int ASK_OPTION_SET = 0;
21    public static final int AUTO_ACCEPT_OPTION_SET = 1;
22    public static final int IGNORE_OPTION_SET = 2;
23
24    /** Resume related DCC Options from the DCC configuration setup */
25
26    public static final int ASK_RESUME_OPTION_SET = 0;
27    public static final int OVERWRITE_RESUME_OPTION_SET = 1;
28    public static final int RESUME_RESUME_OPTION_SET = 2;
29    public static final int IGNORE_RESUME_OPTION_SET = 3;
30
31    /** returns one of RESUME_OPTION_SELECTED, RENAME_OPTION_SELECTED, or OVERWRITE_OPTION_SELECTED */
32    public static final int DetermineResumeOption(Capabilities c, ConnectDCC connect)
33    {
34       int resumeOption = -1;
35       int selectedOption = ClientState.getClientState().getInteger("dcc.exists", ClientDefaults.dcc_accept);
36
37       switch (selectedOption)
38       {
39          case ASK_RESUME_OPTION_SET:
40            resumeOption = ResumeRequest.showDialog(c.getGlobalCapabilities().getFrame(), connect); // lets user choose a full range of resume options :)
41
break;
42          case OVERWRITE_RESUME_OPTION_SET:
43            resumeOption = OVERWRITE_OPTION_SELECTED;
44            break;
45          case RESUME_RESUME_OPTION_SET:
46            resumeOption = RESUME_OPTION_SELECTED;
47            break;
48          case IGNORE_RESUME_OPTION_SET:
49            resumeOption = -1; // do nothing basically
50
break;
51       }
52
53       return resumeOption;
54    }
55 }
56
57
58
Popular Tags