PageRenderTime 47ms CodeModel.GetById 18ms RepoModel.GetById 1ms app.codeStats 0ms

/projects/azureus-4.7.0.2/org/gudy/azureus2/ui/swt/views/configsections/ConfigSectionTrackerClient.java

https://gitlab.com/essere.lab.public/qualitas.class-corpus
Java | 276 lines | 167 code | 72 blank | 37 comment | 6 complexity | a27abe7600837b5c1f90035e6688467f MD5 | raw file
  1. /*
  2. * File : ConfigPanel*.java
  3. * Created : 11 mar. 2004
  4. * By : TuxPaper
  5. *
  6. * Copyright (C) 2004, 2005, 2006 Aelitis SAS, All rights Reserved
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation; either version 2 of the License.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details ( see the LICENSE file ).
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, write to the Free Software
  19. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  20. *
  21. * AELITIS, SAS au capital de 46,603.30 euros,
  22. * 8 Allee Lenotre, La Grille Royale, 78600 Le Mesnil le Roi, France.
  23. */
  24. package org.gudy.azureus2.ui.swt.views.configsections;
  25. import org.eclipse.swt.SWT;
  26. import org.eclipse.swt.widgets.Group;
  27. import org.eclipse.swt.widgets.Label;
  28. import org.eclipse.swt.widgets.Composite;
  29. import org.eclipse.swt.layout.GridData;
  30. import org.eclipse.swt.layout.GridLayout;
  31. import org.gudy.azureus2.ui.swt.Messages;
  32. import org.gudy.azureus2.ui.swt.Utils;
  33. import org.gudy.azureus2.core3.config.COConfigurationManager;
  34. import org.gudy.azureus2.plugins.ui.config.ConfigSection;
  35. import org.gudy.azureus2.ui.swt.config.*;
  36. import org.gudy.azureus2.ui.swt.plugins.UISWTConfigSection;
  37. public class
  38. ConfigSectionTrackerClient
  39. implements UISWTConfigSection
  40. {
  41. public String configSectionGetParentSection() {
  42. return ConfigSection.SECTION_TRACKER;
  43. }
  44. public String configSectionGetName() {
  45. return "tracker.client";
  46. }
  47. public void configSectionSave() {
  48. }
  49. public void configSectionDelete() {
  50. }
  51. public int maxUserMode() {
  52. return 2;
  53. }
  54. public Composite configSectionCreate(final Composite parent) {
  55. GridData gridData;
  56. GridLayout layout;
  57. Label label;
  58. int userMode = COConfigurationManager.getIntParameter("User Mode");
  59. // extensions tab set up
  60. Composite gMainTab = new Composite(parent, SWT.NULL);
  61. gridData = new GridData(GridData.VERTICAL_ALIGN_FILL | GridData.HORIZONTAL_ALIGN_FILL);
  62. gMainTab.setLayoutData(gridData);
  63. layout = new GridLayout();
  64. layout.numColumns = 3;
  65. gMainTab.setLayout(layout);
  66. //////////////////////SCRAPE GROUP ///////////////////
  67. Group scrapeGroup = new Group(gMainTab,SWT.NULL);
  68. Messages.setLanguageText(scrapeGroup,"ConfigView.group.scrape");
  69. GridLayout gridLayout = new GridLayout();
  70. gridLayout.numColumns = 1;
  71. scrapeGroup.setLayout(gridLayout);
  72. gridData = new GridData(GridData.FILL_HORIZONTAL);
  73. gridData.horizontalSpan = 3;
  74. scrapeGroup.setLayoutData( gridData );
  75. label = new Label(scrapeGroup, SWT.WRAP);
  76. label.setLayoutData(Utils.getWrappableLabelGridData(1, GridData.FILL_HORIZONTAL));
  77. Messages.setLanguageText(label, "ConfigView.section.tracker.client.scrapeinfo");
  78. BooleanParameter scrape =
  79. new BooleanParameter(scrapeGroup, "Tracker Client Scrape Enable",
  80. "ConfigView.section.tracker.client.scrapeenable");
  81. BooleanParameter scrape_stopped =
  82. new BooleanParameter(scrapeGroup, "Tracker Client Scrape Stopped Enable",
  83. "ConfigView.section.tracker.client.scrapestoppedenable");
  84. scrape.setAdditionalActionPerformer(new ChangeSelectionActionPerformer( scrape_stopped.getControls()));
  85. new BooleanParameter(scrapeGroup, "Tracker Client Scrape Single Only",
  86. "ConfigView.section.tracker.client.scrapesingleonly");
  87. /////////////////////////
  88. // row
  89. gridData = new GridData();
  90. gridData.horizontalSpan = 2;
  91. new BooleanParameter(gMainTab, "Tracker Client Send OS and Java Version",
  92. "ConfigView.section.tracker.sendjavaversionandos").setLayoutData(gridData);
  93. label = new Label(gMainTab, SWT.NULL);
  94. //////////////////////
  95. BooleanParameter enableUDP = new BooleanParameter(gMainTab, "Server Enable UDP", "ConfigView.section.server.enableudp");
  96. gridData = new GridData();
  97. gridData.horizontalSpan = 2;
  98. enableUDP.setLayoutData(gridData);
  99. label = new Label(gMainTab, SWT.NULL);
  100. //////////////////////
  101. BooleanParameter enableUDPProbe = new BooleanParameter(gMainTab, "Tracker UDP Probe Enable", "ConfigView.section.server.enableudpprobe");
  102. gridData = new GridData();
  103. gridData.horizontalSpan = 2;
  104. enableUDPProbe.setLayoutData(gridData);
  105. label = new Label(gMainTab, SWT.NULL);
  106. enableUDP.setAdditionalActionPerformer(new ChangeSelectionActionPerformer( enableUDPProbe.getControls()));
  107. //////////////////////
  108. BooleanParameter showWarnings = new BooleanParameter(gMainTab, "Tracker Client Show Warnings", "ConfigView.section.tracker.client.showwarnings" );
  109. gridData = new GridData();
  110. gridData.horizontalSpan = 2;
  111. showWarnings.setLayoutData(gridData);
  112. label = new Label(gMainTab, SWT.NULL);
  113. if (userMode > 0) {
  114. //////////////////////OVERRIDE GROUP ///////////////////
  115. Group overrideGroup = new Group(gMainTab,SWT.NULL);
  116. Messages.setLanguageText(overrideGroup,"ConfigView.group.override");
  117. gridLayout = new GridLayout();
  118. gridLayout.numColumns = 2;
  119. overrideGroup.setLayout(gridLayout);
  120. gridData = new GridData(GridData.FILL_HORIZONTAL);
  121. gridData.horizontalSpan = 3;
  122. overrideGroup.setLayoutData( gridData );
  123. label = new Label(overrideGroup, SWT.WRAP);
  124. label.setLayoutData(Utils.getWrappableLabelGridData(1, GridData.FILL_HORIZONTAL));
  125. Messages.setLanguageText(label, "ConfigView.label.overrideip");
  126. StringParameter overrideip = new StringParameter(overrideGroup, "Override Ip", "");
  127. GridData data = new GridData(GridData.FILL_HORIZONTAL);
  128. data.widthHint = 100;
  129. overrideip.setLayoutData(data);
  130. label = new Label(overrideGroup, SWT.WRAP);
  131. label.setLayoutData(Utils.getWrappableLabelGridData(1, GridData.FILL_HORIZONTAL));
  132. Messages.setLanguageText(label, "ConfigView.label.announceport");
  133. StringParameter tcpOverride = new StringParameter(overrideGroup, "TCP.Listen.Port.Override");
  134. data = new GridData();
  135. data.widthHint = 50;
  136. tcpOverride.setLayoutData(data);
  137. tcpOverride.addChangeListener(new ParameterChangeAdapter() {
  138. public void stringParameterChanging(Parameter p, String toValue)
  139. {
  140. if(toValue == "")
  141. return;
  142. try
  143. {
  144. int portVal = Integer.parseInt(toValue);
  145. if(portVal >= 0 && portVal <= 65535)
  146. return;
  147. } catch (NumberFormatException e) {}
  148. p.setValue("");
  149. }
  150. });
  151. label = new Label(overrideGroup, SWT.WRAP);
  152. label.setLayoutData(Utils.getWrappableLabelGridData(1, GridData.FILL_HORIZONTAL));
  153. Messages.setLanguageText(label, "ConfigView.label.noportannounce");
  154. BooleanParameter noPortAnnounce = new BooleanParameter(overrideGroup,"Tracker Client No Port Announce");
  155. data = new GridData();
  156. noPortAnnounce.setLayoutData(data);
  157. label = new Label(overrideGroup, SWT.WRAP);
  158. label.setLayoutData(Utils.getWrappableLabelGridData(1, GridData.FILL_HORIZONTAL));
  159. Messages.setLanguageText(label, "ConfigView.label.maxnumwant");
  160. IntParameter numwant = new IntParameter(overrideGroup, "Tracker Client Numwant Limit",0,100);
  161. data = new GridData();
  162. numwant.setLayoutData(data);
  163. label = new Label(overrideGroup, SWT.WRAP);
  164. label.setLayoutData(Utils.getWrappableLabelGridData(1, GridData.FILL_HORIZONTAL));
  165. Messages.setLanguageText(label, "ConfigView.label.minannounce");
  166. IntParameter minmininterval = new IntParameter(overrideGroup, "Tracker Client Min Announce Interval");
  167. data = new GridData();
  168. minmininterval.setLayoutData(data);
  169. //////////////////////////
  170. if(userMode>1) {
  171. // row
  172. label = new Label(gMainTab, SWT.NULL);
  173. Messages.setLanguageText(label, "ConfigView.section.tracker.client.connecttimeout");
  174. gridData = new GridData();
  175. IntParameter connect_timeout = new IntParameter(gMainTab, "Tracker Client Connect Timeout" );
  176. connect_timeout.setLayoutData(gridData);
  177. label = new Label(gMainTab, SWT.NULL);
  178. // row
  179. label = new Label(gMainTab, SWT.NULL);
  180. Messages.setLanguageText(label, "ConfigView.section.tracker.client.readtimeout");
  181. gridData = new GridData();
  182. IntParameter read_timeout = new IntParameter(gMainTab, "Tracker Client Read Timeout" );
  183. read_timeout.setLayoutData(gridData);
  184. label = new Label(gMainTab, SWT.NULL);
  185. ////// main tab
  186. // row
  187. gridData = new GridData();
  188. gridData.horizontalSpan = 2;
  189. new BooleanParameter(gMainTab, "Tracker Key Enable Client",
  190. "ConfigView.section.tracker.enablekey").setLayoutData(gridData);
  191. label = new Label(gMainTab, SWT.NULL);
  192. // row
  193. gridData = new GridData();
  194. gridData.horizontalSpan = 2;
  195. new BooleanParameter(gMainTab, "Tracker Separate Peer IDs",
  196. "ConfigView.section.tracker.separatepeerids").setLayoutData(gridData);
  197. label = new Label(gMainTab, SWT.WRAP);
  198. label.setLayoutData(Utils.getWrappableLabelGridData(1, GridData.FILL_HORIZONTAL));
  199. Messages.setLanguageText(label, "ConfigView.section.tracker.separatepeerids.info");
  200. }
  201. }
  202. return gMainTab;
  203. }
  204. }