예제 #1
0
    public LinkGrabberSidebar(LinkGrabberTable table) {
        super("ins 0,wrap 1", "[grow,fill]", "[]");
        LAFOptions.getInstance().applyPanelBackground(this);
        // header
        hosterFilter = new Header(org.jdownloader.settings.staticreferences.CFG_LINKFILTER.LINKGRABBER_HOSTER_QUICKFILTER_ENABLED, _GUI._.LinkGrabberSidebar_LinkGrabberSidebar_hosterfilter());
        exceptions = new CustomFilterHeader();
        filetypeFilter = new Header(org.jdownloader.settings.staticreferences.CFG_LINKFILTER.LINKGRABBER_FILETYPE_QUICKFILTER_ENABLED, _GUI._.LinkGrabberSidebar_LinkGrabberSidebar_extensionfilter());

        //
        exceptionsFilterTable = new QuickFilterExceptionsTable(exceptions, table);
        exceptionsFilterTable.setVisible(org.jdownloader.settings.staticreferences.CFG_LINKFILTER.LINKGRABBER_EXCEPTIONS_QUICKFILTER_ENABLED.isEnabled());
        hosterFilterTable = new QuickFilterHosterTable(hosterFilter, table);
        hosterFilterTable.setVisible(org.jdownloader.settings.staticreferences.CFG_LINKFILTER.LINKGRABBER_HOSTER_QUICKFILTER_ENABLED.isEnabled());
        filetypeFilterTable = new QuickFilterTypeTable(filetypeFilter, table);
        filetypeFilterTable.setVisible(org.jdownloader.settings.staticreferences.CFG_LINKFILTER.LINKGRABBER_FILETYPE_QUICKFILTER_ENABLED.isEnabled());

        // disable auto confirm if user closed sidebar
        org.jdownloader.settings.staticreferences.CFG_GUI.LINKGRABBER_SIDEBAR_VISIBLE.getEventSender().addListener(new GenericConfigEventListener<Boolean>() {

            public void onConfigValidatorError(KeyHandler<Boolean> keyHandler, Boolean invalidValue, ValidationException validateException) {
            }

            public void onConfigValueModified(KeyHandler<Boolean> keyHandler, Boolean newValue) {
                if (org.jdownloader.settings.staticreferences.CFG_GUI.LINKGRABBER_SIDEBAR_VISIBLE.isEnabled()) {
                    org.jdownloader.settings.staticreferences.CFG_LINKGRABBER.LINKGRABBER_AUTO_CONFIRM_ENABLED.setValue(org.jdownloader.settings.staticreferences.CFG_LINKGRABBER.LINKGRABBER_AUTO_CONFIRM_ENABLED.getDefaultValue());
                }
            }
        });

        add(exceptions, "gaptop 7,hidemode 3");
        add(exceptionsFilterTable, "hidemode 3");
        add(filetypeFilter, "gaptop 7,hidemode 3");
        add(filetypeFilterTable, "hidemode 3");
        add(hosterFilter, "gaptop 7,hidemode 3");
        add(hosterFilterTable, "hidemode 3");

        if (System.getProperty("nativeswing") != null) {
            try {
                panel = (SponsoringPanelInterface) Class.forName("org.jdownloader.sponsor.bt.DJBTSponsoringPanel").newInstance();
                panel.setHttpClient(new SimpleHttpInterface() {

                    @Override
                    public SimpleHttpResponse get(final String url) throws IOException {
                        final String str = new Browser().getPage(url);
                        return new SimpleHttpResponse() {

                            @Override
                            public String getHtmlText() {

                                return str;

                            }
                        };
                    }
                });
                add(Box.createVerticalGlue(), "pushy,growy");

                add(sponsoringPanel = panel.getPanel(), "hidemode 3");
                GUIEventSender.getInstance().addListener(new GUIListener() {

                    @Override
                    public void onKeyModifier(int parameter) {
                    }

                    @Override
                    public void onGuiMainTabSwitch(View oldView, View newView) {
                        if (newView instanceof LinkGrabberView) {
                            sponsoringPanel.setVisible(true);
                        } else {
                            sponsoringPanel.setVisible(false);
                        }
                    }
                });
                panel.init();
            } catch (Throwable t) {
                t.printStackTrace();
            }
        }

    }
예제 #2
0
 private JLabel lbl(String string, Icon icon, int left) {
   JLabel ret = new JLabel(string, icon, left);
   ret.setForeground(LAFOptions.getInstance().getColorForTooltipForeground());
   return ret;
 }
예제 #3
0
  public EndCaptchaTooltip(ServicePanel owner, final EndCaptchaSolver solver) {

    super(new TooltipPanel("ins 0,wrap 1", "[grow,fill]", "[grow,fill]"));
    this.owner = owner;
    color = (LAFOptions.getInstance().getColorForTooltipForeground());
    JProgressBar progress = new JProgressBar();
    progress.setIndeterminate(true);
    panel.setLayout(new MigLayout("ins 0,wrap 1", "[grow,fill]", "[]"));
    JLabel header =
        new JLabel("EndCaptcha.com Solver", new AbstractIcon("endCaptcha", 18), JLabel.LEFT);
    header.setBorder(
        BorderFactory.createMatteBorder(
            0, 0, 1, 0, LAFOptions.getInstance().getColorForTooltipForeground()));
    SwingUtils.toBold(header);
    header.setForeground(LAFOptions.getInstance().getColorForTooltipForeground());
    panel.add(header, "gapbottom 5,spanx");
    panel.add(progress);
    // panel.setPreferredSize(new Dimension(300, 100));
    new Thread() {
      public void run() {

        final EndCaptchaAccount account = solver.loadAccount();
        new EDTRunner() {

          @Override
          protected void runInEDT() {
            panel.removeAll();
            // panel.setPreferredSize(null);
            if (!account.isValid()) {
              panel.setLayout(new MigLayout("ins 0,wrap 1", "[grow,fill]", "[]"));
              JLabel header =
                  new JLabel(
                      "EndCaptcha.com Solver", new AbstractIcon("endCaptcha", 18), JLabel.LEFT);
              header.setBorder(
                  BorderFactory.createMatteBorder(
                      0, 0, 1, 0, LAFOptions.getInstance().getColorForTooltipForeground()));
              SwingUtils.toBold(header);
              header.setForeground(LAFOptions.getInstance().getColorForTooltipForeground());
              panel.add(header, "gapbottom 5,spanx");
              panel.add(
                  lbl(
                      _GUI.T.ServicePanel9kwTooltip_runInEDT_error2(""),
                      NewTheme.I().getIcon(IconKey.ICON_ERROR, 18),
                      JLabel.LEFT));
              panel.add(lbl(account.getError()), "gapleft 22");
            } else {
              panel.setLayout(new MigLayout("ins 0,wrap 2", "[][grow,align right]", "[]0"));
              JLabel header =
                  new JLabel(
                      "EndCaptcha.com Solver", new AbstractIcon("endCaptcha", 18), JLabel.LEFT);
              header.setBorder(
                  BorderFactory.createMatteBorder(
                      0, 0, 1, 0, LAFOptions.getInstance().getColorForTooltipForeground()));
              SwingUtils.toBold(header);
              header.setForeground(LAFOptions.getInstance().getColorForTooltipForeground());
              panel.add(header, "spanx,gapbottom 5,pushx,growx");

              panel.add(
                  lbl(
                      _GUI.T.lit_accountid(),
                      NewTheme.I().getIcon(IconKey.ICON_PREMIUM, 18),
                      JLabel.LEFT));
              panel.add(lbl(account.getUserName() + ""));
              panel.add(
                  lbl(
                      _GUI.T.ServicePanel9kwTooltip_runInEDT_credits_(),
                      NewTheme.I().getIcon(IconKey.ICON_MONEY, 18),
                      JLabel.LEFT));
              panel.add(lbl(account.getBalance() + " USD"));

              // panel.add(lbl(_GUI.T.lit_rate(), NewTheme.I().getIcon(IconKey.ICON_PLAY, 18),
              // JLabel.LEFT));
              // panel.add(lbl(account.getRate() + " USD Cent/Captcha"));
              // panel.add(lbl(_GUI.T.ServicePanelDBCTooltip_captcha_free(),
              // NewTheme.I().getIcon(IconKey.ICON_OCR, 18),
              // JLabel.LEFT));
              // panel.add(lbl((int) (account.getBalance() / account.getRate())));
              // if (account.isBanned()) {
              // panel.add(lbl(_GUI.T.ServicePanel9kwTooltip_runInEDT_banned(),
              // NewTheme.I().getIcon(IconKey.ICON_ERROR, 18),
              // JLabel.LEFT));
              //
              // }

            }
            // panel.revalidate();
            // revalidate();
            // repaint();
            ToolTipController.getInstance().show(EndCaptchaTooltip.this);
          }
        };
      }
    }.start();
  }
  public AbstractOverviewPanel(PackageControllerTableModel tableModel) {
    super("ins 0", "[][grow,fill][]", "[grow,fill]");
    this.tableModel = tableModel;
    LAFOptions.getInstance().applyPanelBackground(this);
    GUIEventSender.getInstance().addListener(this, true);
    final MigPanel info = new MigPanel("ins 2 0 0 0", "[grow]10[grow]", "[grow,fill]2[grow,fill]");
    info.setOpaque(false);
    relayoutListener =
        new GenericConfigEventListener<Boolean>() {

          @Override
          public void onConfigValueModified(KeyHandler<Boolean> keyHandler, Boolean newValue) {
            new EDTRunner() {

              @Override
              protected void runInEDT() {
                layoutInfoPanel(info);
                update();

                revalidate();
              }
            };
          }

          @Override
          public void onConfigValidatorError(
              KeyHandler<Boolean> keyHandler,
              Boolean invalidValue,
              ValidationException validateException) {}
        };
    layoutInfoPanel(info);
    add(info, "pushy,growy");
    slowDelayer =
        new DelayedRunnable(SERVICE, 500, 5000) {

          @Override
          public void delayedrun() {
            update();
          }
        };
    fastDelayer =
        new DelayedRunnable(SERVICE, 50, 200) {

          @Override
          public void delayedrun() {
            update();
          }
        };
    CFG_GUI.OVERVIEW_PANEL_TOTAL_INFO_VISIBLE.getEventSender().addListener(this, true);
    CFG_GUI.OVERVIEW_PANEL_SELECTED_INFO_VISIBLE.getEventSender().addListener(this, true);
    CFG_GUI.OVERVIEW_PANEL_VISIBLE_ONLY_INFO_VISIBLE.getEventSender().addListener(this, true);

    CFG_GUI.OVERVIEW_PANEL_SMART_INFO_VISIBLE.getEventSender().addListener(this, true);

    this.addHierarchyListener(this);
    onConfigValueModified(null, null);

    SecondLevelLaunch.GUI_COMPLETE.executeWhenReached(
        new Runnable() {

          public void run() {
            visible.set(isViewActive());
            fastDelayer.run();
          }
        });
    onConfigValueModified(null, null);
  }