コード例 #1
0
ファイル: AddedDateColumn.java プロジェクト: sn0w/jdownloader
 protected String getDateFormatString() {
   String custom = CFG_GUI.CFG.getDateTimeFormatDownloadListAddedDateColumn();
   if (StringUtils.isNotEmpty(custom)) {
     return custom;
   }
   DateFormat sd = SimpleDateFormat.getDateTimeInstance();
   if (sd instanceof SimpleDateFormat) {
     return ((SimpleDateFormat) sd).toPattern();
   }
   return _GUI.T.added_date_column_dateformat();
 }
コード例 #2
0
    @Override
    public void onGuiMainTabSwitch(View oldView, final View newView) {
        if (newView instanceof LinkGrabberView && CFG_GUI.CFG.getStartButtonActionInLinkgrabberContext() == StartButtonAction.DISABLED) {
            new EDTRunner() {

                @Override
                protected void runInEDT() {
                    setEnabled(false);
                }
            };
        } else {
            DownloadWatchDog.getInstance().notifyCurrentState(this);
        }
    }
コード例 #3
0
  protected void layoutInfoPanel(MigPanel info) {
    info.removeAll();
    HashMap<String, Position> map = CFG_GUI.CFG.getOverviewPositions();
    boolean save = false;
    if (map == null) {
      map = new HashMap<String, Position>();
      save = true;
    }
    HashMap<String, DataEntry<T>> idMap = new HashMap<String, DataEntry<T>>();
    this.dataEntries = new ArrayList<DataEntry<T>>();
    for (DataEntry<T> s : createDataEntries()) {
      Position ret = map.get(s.getId());
      if (ret == null) {
        ret = new Position();
        map.put(s.getId(), ret);
        save = true;
      }
      idMap.put(s.getId(), s);
      if (s.getVisibleKeyHandler() == null || s.getVisibleKeyHandler().isEnabled()) {
        dataEntries.add(s);
      }
      if (s.getVisibleKeyHandler() != null) {
        s.getVisibleKeyHandler().getEventSender().addListener(relayoutListener);
      }
    }
    // selected
    // filtered
    // speed
    // eta

    ArrayList<DataEntry<T>> row1 = new ArrayList<DataEntry<T>>();
    ArrayList<DataEntry<T>> row2 = new ArrayList<DataEntry<T>>();

    for (Entry<String, Position> es : map.entrySet()) {
      DataEntry<T> v = idMap.get(es.getKey());
      if (v == null) {
        continue;
      }
      int x = es.getValue().getX();
      int y = es.getValue().getY();
      ArrayList<DataEntry<T>> row;
      if (y == 0) {
        row = row1;
      } else {
        row = row2;
      }
      while (x >= 0 && y >= 0) {
        while (x >= row.size()) {
          row.add(null);
        }
        if (row.get(x) != null) {
          x++;
          continue;
        }

        row.set(x, v);
        idMap.remove(v.getId());
        break;
      }
    }

    addloop:
    for (int i = 0; i < dataEntries.size(); i++) {
      DataEntry<T> v = dataEntries.get(i);
      if (!idMap.containsKey(v.getId())) {
        continue;
      }

      if (i % 2 == 0) {
        int index = 0;
        while (true) {
          while (index >= row1.size()) {
            row1.add(null);
          }
          if (row1.get(index) == null) {
            row1.set(index, v);
            continue addloop;
          } else {
            index++;
          }
        }

      } else {
        int index = 0;
        while (true) {
          while (index >= row2.size()) {
            row2.add(null);
          }
          if (row2.get(index) == null) {
            row2.set(index, v);
            continue addloop;
          } else {
            index++;
          }
        }
      }
    }

    if (save) {
      CFG_GUI.CFG.setOverviewPositions(map);
    }

    for (DataEntry<T> de : row1) {
      if (de == null) {
        continue;
      }
      de.addTo(info);
    }

    boolean first = true;
    for (DataEntry<T> de : row2) {
      if (de == null) {
        continue;
      }
      if (first) {
        de.addTo(info, ",newline");
      } else {
        de.addTo(info);
      }

      first = false;
    }
  }