示例#1
0
  /**
   * Override this method if you like to apply and save changes made on settings pane. To trigger
   * saving of the configuration if any value was changed call triggerConfigSave().
   */
  @Override
  public void saveAndApplyChanges(HashMap inputDic) {
    Integer totalWorkerInt = (Integer) inputDic.get(MAX_TOTAL_WORKER_KEY);
    DownloadPrefs.MaxTotalDownloadWorker.set(totalWorkerInt);

    Integer initialSegmentSizeInt = (Integer) inputDic.get(INITIAL_SEGMENT_SIZE_KEY);
    DownloadPrefs.SegmentInitialSize.set(Integer.valueOf(initialSegmentSizeInt.intValue() * 1024));

    Integer segmentTransferTimeInt = (Integer) inputDic.get(SEGMENT_TRANSFER_TIME_KEY);
    DownloadPrefs.SegmentTransferTargetTime.set(segmentTransferTimeInt);

    Integer maxWorkerPerDownloadInt = (Integer) inputDic.get(WORKER_PER_DOWNLOAD_KEY);
    DownloadPrefs.MaxWorkerPerDownload.set(maxWorkerPerDownloadInt);

    Integer pushTimeoutInt = (Integer) inputDic.get(PUSH_TIMEOUT_KEY);
    int pushTimeout = pushTimeoutInt.intValue();
    DownloadPrefs.PushRequestTimeout.set(Integer.valueOf(pushTimeout * 1000));

    boolean readoutMagmas = readoutMagmaChkbx.isSelected();
    DownloadPrefs.AutoReadoutMagmaFiles.set(Boolean.valueOf(readoutMagmas));

    boolean readoutMetalinks = readoutMetalinkChkbx.isSelected();
    DownloadPrefs.AutoReadoutMetalinkFiles.set(Boolean.valueOf(readoutMetalinks));

    boolean readoutRSS = readoutRSSChkbx.isSelected();
    DownloadPrefs.AutoReadoutRSSFiles.set(Boolean.valueOf(readoutRSS));

    boolean silentSubscriptions = silentSubscriptionsChkbx.isSelected();
    SubscriptionPrefs.DownloadSilently.set(Boolean.valueOf(silentSubscriptions));

    boolean removeCompletedDownloads = removeCompletedDownloadsChkbx.isSelected();
    DownloadPrefs.AutoRemoveCompleted.set(Boolean.valueOf(removeCompletedDownloads));

    boolean enableHitSnooping = enableHitSnoopingChkbx.isSelected();
    ConnectionPrefs.EnableQueryHitSnooping.set(Boolean.valueOf(enableHitSnooping));
  }
示例#2
0
  /**
   * Called when preparing this settings pane for display the first time. Can be overriden to
   * implement the look of the settings pane.
   */
  @Override
  protected void prepareComponent() {
    FormLayout layout =
        new FormLayout(
            "10dlu, right:d, 2dlu, d, 2dlu:grow", // columns
            "p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, p"); // rows
    layout.setRowGroups(new int[][] {{3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23}});
    setLayout(layout);

    PanelBuilder builder = new PanelBuilder(layout, this);
    CellConstraints cc = new CellConstraints();

    builder.addSeparator(Localizer.getString("GeneralDownloadSettings"), cc.xywh(1, 1, 5, 1));

    JLabel label =
        builder.addLabel(
            Localizer.getString("DownloadSettings_TotalParallelDownloads") + ": ", cc.xy(2, 3));
    label.setToolTipText(Localizer.getString("DownloadSettings_TTTTotalParallelDownloads"));
    totalWorkersTF =
        new IntegerTextField(DownloadPrefs.MaxTotalDownloadWorker.get().toString(), 6, 2);
    totalWorkersTF.setToolTipText(
        Localizer.getString("DownloadSettings_TTTTotalParallelDownloads"));
    builder.add(totalWorkersTF, cc.xy(4, 3));

    label =
        builder.addLabel(
            Localizer.getString("DownloadSettings_ParallelDownloadsPerFile") + ": ", cc.xy(2, 5));
    label.setToolTipText(Localizer.getString("DownloadSettings_TTTParallelDownloadsPerFile"));
    workerPerDownloadTF =
        new IntegerTextField(DownloadPrefs.MaxWorkerPerDownload.get().toString(), 6, 2);
    workerPerDownloadTF.setToolTipText(
        Localizer.getString("DownloadSettings_TTTParallelDownloadsPerFile"));
    builder.add(workerPerDownloadTF, cc.xy(4, 5));

    label =
        builder.addLabel(
            Localizer.getString("DownloadSettings_InitialSegmentSizeKb") + ": ", cc.xy(2, 7));
    label.setToolTipText(Localizer.getString("DownloadSettings_TTTInitialSegmentSizeKb"));
    initialSegmentSizeTF =
        new IntegerTextField(
            String.valueOf(DownloadPrefs.SegmentInitialSize.get().intValue() / 1024), 6, 4);
    initialSegmentSizeTF.setToolTipText(
        Localizer.getString("DownloadSettings_TTTInitialSegmentSizeKb"));
    builder.add(initialSegmentSizeTF, cc.xy(4, 7));

    label =
        builder.addLabel(
            Localizer.getString("DownloadSettings_SegmentTransferTimeSec") + ": ", cc.xy(2, 9));
    label.setToolTipText(Localizer.getString("DownloadSettings_TTTSegmentTransferTimeSec"));
    segmentTransferTimeTF =
        new IntegerTextField(DownloadPrefs.SegmentTransferTargetTime.get().toString(), 6, 3);
    segmentTransferTimeTF.setToolTipText(
        Localizer.getString("DownloadSettings_TTTSegmentTransferTimeSec"));
    builder.add(segmentTransferTimeTF, cc.xy(4, 9));

    builder.addLabel(Localizer.getString("PushTimeout") + ": ", cc.xy(2, 11));
    pushTimeoutTF =
        new IntegerTextField(
            String.valueOf(DownloadPrefs.PushRequestTimeout.get().intValue() / 1000), 6, 3);
    builder.add(pushTimeoutTF, cc.xy(4, 11));

    readoutMagmaChkbx =
        new JCheckBox(
            Localizer.getString("DownloadSettings_ReadoutDownloadedMagmas"),
            DownloadPrefs.AutoReadoutMagmaFiles.get().booleanValue());
    readoutMagmaChkbx.setToolTipText(
        Localizer.getString("DownloadSettings_TTTReadoutDownloadedMagmas"));
    builder.add(readoutMagmaChkbx, cc.xywh(2, 13, 4, 1));

    readoutMetalinkChkbx =
        new JCheckBox(
            Localizer.getString("DownloadSettings_ReadoutDownloadedMetalink"),
            DownloadPrefs.AutoReadoutMetalinkFiles.get().booleanValue());
    readoutMetalinkChkbx.setToolTipText(
        Localizer.getString("DownloadSettings_TTTReadoutDownloadedMetalink"));
    builder.add(readoutMetalinkChkbx, cc.xywh(2, 15, 4, 1));

    readoutRSSChkbx =
        new JCheckBox(
            Localizer.getString("DownloadSettings_ReadoutDownloadedRSS"),
            DownloadPrefs.AutoReadoutRSSFiles.get().booleanValue());
    readoutRSSChkbx.setToolTipText(Localizer.getString("DownloadSettings_TTTReadoutDownloadedRSS"));
    builder.add(readoutRSSChkbx, cc.xywh(2, 17, 4, 1));

    silentSubscriptionsChkbx =
        new JCheckBox(
            Localizer.getString("DownloadSettings_DownloadSubscriptionsSilently"),
            SubscriptionPrefs.DownloadSilently.get().booleanValue());
    silentSubscriptionsChkbx.setToolTipText(
        Localizer.getString("DownloadSettings_TTTDownloadSubscriptionsSilently"));
    builder.add(silentSubscriptionsChkbx, cc.xywh(2, 19, 4, 1));

    removeCompletedDownloadsChkbx =
        new JCheckBox(
            Localizer.getString("DownloadSettings_AutoRemoveCompletedDownloads"),
            DownloadPrefs.AutoRemoveCompleted.get().booleanValue());
    removeCompletedDownloadsChkbx.setToolTipText(
        Localizer.getString("DownloadSettings_TTTAutoRemoveCompletedDownloads"));
    builder.add(removeCompletedDownloadsChkbx, cc.xywh(2, 21, 4, 1));

    enableHitSnoopingChkbx =
        new JCheckBox(
            Localizer.getString("DownloadSettings_EnableHitSnooping"),
            ConnectionPrefs.EnableQueryHitSnooping.get().booleanValue());
    enableHitSnoopingChkbx.setToolTipText(
        Localizer.getString("DownloadSettings_TTTEnableHitSnooping"));
    builder.add(enableHitSnoopingChkbx, cc.xywh(2, 23, 4, 1));

    initConfigValues();
    refreshEnableState();
  }