-
Notifications
You must be signed in to change notification settings - Fork 2
/
ConfigSectionDownloading.java
151 lines (124 loc) · 5.21 KB
/
ConfigSectionDownloading.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
/*
* Copyright (C) 2004, 2005, 2006 Aelitis SAS, All rights Reserved
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details ( see the LICENSE file ).
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* AELITIS, SAS au capital de 46,603.30 euros,
* 8 Allee Lenotre, La Grille Royale, 78600 Le Mesnil le Roi, France.
*/
package com.aelitis.azureus.plugins.startstoprules.defaultplugin.ui.swt;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.MouseAdapter;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.*;
import org.gudy.azureus2.core3.internat.MessageText;
import org.gudy.azureus2.ui.swt.Messages;
import org.gudy.azureus2.ui.swt.Utils;
import org.gudy.azureus2.ui.swt.config.BooleanParameter;
import org.gudy.azureus2.ui.swt.config.ChangeSelectionActionPerformer;
import org.gudy.azureus2.ui.swt.config.IntParameter;
import org.gudy.azureus2.ui.swt.mainwindow.Colors;
import org.gudy.azureus2.ui.swt.plugins.UISWTConfigSection;
/** Seeding Automation Specific options
* @author TuxPaper
* @created Jan 12, 2004
*
* TODO: StartStopManager_fAddForSeedingULCopyCount
*/
public class ConfigSectionDownloading implements UISWTConfigSection {
public String configSectionGetParentSection() {
return "queue";
}
public String configSectionGetName() {
return "queue.downloading";
}
public void configSectionSave() {
}
public void configSectionDelete() {
}
public int maxUserMode() {
return 0;
}
public Composite configSectionCreate(Composite parent) {
// Seeding Automation Setup
GridData gridData;
GridLayout layout;
Label label;
Composite cDownloading = new Composite(parent, SWT.NULL);
layout = new GridLayout();
layout.numColumns = 2;
layout.marginHeight = 0;
cDownloading.setLayout(layout);
gridData = new GridData(GridData.VERTICAL_ALIGN_FILL | GridData.HORIZONTAL_ALIGN_FILL);
cDownloading.setLayoutData(gridData);
// info
label = new Label(cDownloading, SWT.WRAP);
gridData = new GridData(GridData.FILL_HORIZONTAL);
gridData.horizontalSpan = 2;
gridData.widthHint = 300;
label.setLayoutData(gridData);
Messages.setLanguageText(label, "ConfigView.label.downloading.info");
// wiki link
final Label linkLabel = new Label(cDownloading, SWT.NULL);
linkLabel.setText(MessageText.getString("ConfigView.label.please.visit.here"));
linkLabel.setData("http://wiki.vuze.com/w/Downloading_Rules");
linkLabel.setCursor(linkLabel.getDisplay().getSystemCursor(SWT.CURSOR_HAND));
linkLabel.setForeground(Colors.blue);
gridData = new GridData();
gridData.horizontalSpan = 2;
linkLabel.setLayoutData(gridData);
linkLabel.addMouseListener(new MouseAdapter() {
public void mouseDoubleClick(MouseEvent arg0) {
Utils.launch((String) ((Label) arg0.widget).getData());
}
public void mouseDown(MouseEvent arg0) {
Utils.launch((String) ((Label) arg0.widget).getData());
}
});
// enable
gridData = new GridData();
gridData.horizontalSpan = 2;
BooleanParameter autoRepos = new BooleanParameter(cDownloading, "StartStopManager_Downloading_bAutoReposition",
"ConfigView.label.downloading.autoReposition");
autoRepos.setLayoutData(gridData);
// test time
label = new Label(cDownloading, SWT.NULL);
Messages.setLanguageText(label, "ConfigView.label.downloading.testTime");
gridData = new GridData();
IntParameter testTime = new IntParameter(cDownloading, "StartStopManager_Downloading_iTestTimeSecs");
testTime.setLayoutData(gridData);
testTime.setMinimumValue( 60 );
autoRepos.setAdditionalActionPerformer(new ChangeSelectionActionPerformer(label));
autoRepos.setAdditionalActionPerformer(new ChangeSelectionActionPerformer(testTime));
// re-test
label = new Label(cDownloading, SWT.NULL);
Messages.setLanguageText(label, "ConfigView.label.downloading.reTest");
gridData = new GridData();
IntParameter reTest = new IntParameter(cDownloading, "StartStopManager_Downloading_iRetestTimeMins");
reTest.setLayoutData(gridData);
reTest.setMinimumValue( 0 );
autoRepos.setAdditionalActionPerformer(new ChangeSelectionActionPerformer(label));
autoRepos.setAdditionalActionPerformer(new ChangeSelectionActionPerformer(reTest));
return cDownloading;
}
private void controlsSetEnabled(Control[] controls, boolean bEnabled) {
for(int i = 0 ; i < controls.length ; i++) {
if (controls[i] instanceof Composite)
controlsSetEnabled(((Composite)controls[i]).getChildren(), bEnabled);
controls[i].setEnabled(bEnabled);
}
}
}