private AbstractButton createButton(AppAction action) { if (action instanceof CustomizableAppAction) { ((CustomizableAppAction) action).requestUpdate(this); } if (action.isToggle()) { JToggleButton bt = new JToggleButton(action); bt.setOpaque(false); bt.setContentAreaFilled(false); bt.setBorderPainted(false); bt.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { hideThreadrunning = false; TrayIconPopup.this.dispose(); } }); Icon icon; bt.setIcon(icon = NewTheme.I().getCheckBoxImage(action.getIconKey(), false, ICON_SIZE)); bt.setRolloverIcon(icon); bt.setSelectedIcon( icon = NewTheme.I().getCheckBoxImage(action.getIconKey(), true, ICON_SIZE)); bt.setRolloverSelectedIcon(icon); bt.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); bt.setFocusPainted(false); bt.setHorizontalAlignment(JButton.LEFT); bt.setIconTextGap(5); bt.addMouseListener(new HoverEffect(bt)); return bt; } else { // we use a JToggleButton here, because JToggle buttons seem to have a different left icon gap // the jbuttons JToggleButton bt = new JToggleButton(action); bt.setOpaque(false); bt.setContentAreaFilled(false); bt.setBorderPainted(false); bt.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { hideThreadrunning = false; TrayIconPopup.this.dispose(); } }); bt.setIcon(NewTheme.I().getIcon(action.getIconKey(), ICON_SIZE)); bt.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); bt.setFocusPainted(false); bt.setHorizontalAlignment(JButton.LEFT); bt.setIconTextGap(5); bt.addMouseListener(new HoverEffect(bt)); return bt; } }
public ChunksEditor(boolean b) { super(b); add(lbl = getLbl(_GUI._.ChunksEditor_ChunksEditor_(), NewTheme.I().getIcon("chunks", 18))); config = JsonConfig.create(GeneralSettings.class); spinner = new ExtSpinner(new ConfigIntSpinnerModel(org.jdownloader.settings.staticreferences.CFG_GENERAL.MAX_CHUNKS_PER_FILE)); try { ((DefaultEditor) spinner.getEditor()).getTextField().addFocusListener(new FocusListener() { @Override public void focusLost(FocusEvent e) { } @Override public void focusGained(FocusEvent e) { // requires invoke later! SwingUtilities.invokeLater(new Runnable() { @Override public void run() { ((DefaultEditor) spinner.getEditor()).getTextField().selectAll(); } }); } }); } catch (Exception e) { e.printStackTrace(); // too much fancy Casting. } // new SpinnerNumberModel(config.getMaxChunksPerFile(), 1, 20, 1) add(spinner, "height " + Math.max(spinner.getEditor().getPreferredSize().height, 20) + "!,width " + getEditorWidth() + "!"); }
public ParalellDownloadsEditor(boolean b) { super(b); config = JsonConfig.create(GeneralSettings.class); add(getLbl(_GUI._.ParalellDownloadsEditor_ParalellDownloadsEditor_(), NewTheme.I().getIcon("paralell", 18))); spinner = new ExtSpinner(new ConfigIntSpinnerModel(org.jdownloader.settings.staticreferences.CFG_GENERAL.MAX_SIMULTANE_DOWNLOADS)); try { ((DefaultEditor) spinner.getEditor()).getTextField().addFocusListener(new FocusListener() { @Override public void focusLost(FocusEvent e) { } @Override public void focusGained(FocusEvent e) { // requires invoke later! SwingUtilities.invokeLater(new Runnable() { @Override public void run() { ((DefaultEditor) spinner.getEditor()).getTextField().selectAll(); } }); } }); } catch (Exception e) { e.printStackTrace(); // too much fancy Casting. } add(spinner, "height " + Math.max(spinner.getEditor().getPreferredSize().height, 20) + "!,width " + getEditorWidth() + "!"); }
/** * returns a high quality icon for this domain. most domains do not support this and will return * null; the icon is NOT cached. use with care * * @param i * @return */ public Icon getIcon(int size) { Icon ret = null; if (NewTheme.I().hasIcon("fav/big." + getTld())) { ret = NewTheme.I().getIcon("fav/big." + getTld(), -1); } if (ret == null && NewTheme.I().hasIcon("fav/" + getTld())) { ret = NewTheme.I().getIcon("fav/" + getTld(), -1); } if (ret != null && ret.getIconHeight() >= size && ret.getIconWidth() >= size) { return IconIO.getScaledInstance(ret, size, size); } ret = FavIcons.getFavIcon(getTld(), null); if (ret.getIconHeight() >= size && ret.getIconWidth() >= size) { return IconIO.getScaledInstance(ret, size, size); } return null; }
public ConfigPanelGeneral() { super(); downloadFolder = new FolderChooser(); simpleContainer = new Checkbox(); this.addHeader(_GUI._.gui_config_general_downloaddirectory(), NewTheme.I().getIcon("downloadpath", 32)); this.addDescription(_JDT._.gui_settings_downloadpath_description()); this.add(downloadFolder); this.addHeader(_JDT._.gui_settings_downloadcontroll_title(), NewTheme.I().getIcon("downloadmanagment", 32)); this.addDescription(_JDT._.gui_settings_downloadcontroll_description()); maxSimPerHost = new Spinner(new ConfigIntSpinnerModel(org.jdownloader.settings.staticreferences.CFG_GENERAL.MAX_SIMULTANE_DOWNLOADS_PER_HOST)); maxSim = new Spinner(new ConfigIntSpinnerModel(org.jdownloader.settings.staticreferences.CFG_GENERAL.MAX_SIMULTANE_DOWNLOADS)); maxchunks = new Spinner(new ConfigIntSpinnerModel(org.jdownloader.settings.staticreferences.CFG_GENERAL.MAX_CHUNKS_PER_FILE)); startDownloadTimeout = new Spinner(new ConfigIntSpinnerModel(org.jdownloader.settings.staticreferences.CFG_GENERAL.AUTO_START_COUNTDOWN_SECONDS)); String[] removeDownloads = new String[] { _GUI._.gui_config_general_toDoWithDownloads_immediate(), _GUI._.gui_config_general_toDoWithDownloads_atstart(), _GUI._.gui_config_general_toDoWithDownloads_packageready(), _GUI._.gui_config_general_toDoWithDownloads_never() }; remove = new ComboBox<CleanAfterDownloadAction>(CleanAfterDownloadAction.values(), removeDownloads); startDownloadsAfterAppStart = new ComboBox<AutoDownloadStartOption>(CFG_GENERAL.SH.getKeyHandler("AutoStartDownloadOption", KeyHandler.class), AutoDownloadStartOption.values(), new String[] { _GUI._.gui_config_general_AutoDownloadStartOption_always(), _GUI._.gui_config_general_AutoDownloadStartOption_only_if_closed_running(), _GUI._.gui_config_general_AutoDownloadStartOption_never() }); String[] fileExists = new String[] { _GUI._.system_download_triggerfileexists_overwrite(), _GUI._.system_download_triggerfileexists_skip(), _GUI._.system_download_triggerfileexists_rename(), _GUI._.system_download_triggerfileexists_ask(), _GUI._.system_download_triggerfileexists_ask() }; ifFileExists = new ComboBox<IfFileExistsAction>(IfFileExistsAction.values(), fileExists); this.addPair(_GUI._.gui_config_download_simultan_downloads(), null, maxSim); this.addPair(_GUI._.gui_config_download_simultan_downloads_per_host2(), org.jdownloader.settings.staticreferences.CFG_GENERAL.MAX_DOWNLOADS_PER_HOST_ENABLED, maxSimPerHost); this.addPair(_GUI._.gui_config_download_max_chunks(), null, maxchunks); this.addPair(_GUI._.gui_config_general_todowithdownloads(), null, remove); this.addPair(_GUI._.system_download_triggerfileexists(), null, ifFileExists); this.addHeader(_GUI._.gui_config_download_autostart(), NewTheme.I().getIcon("resume", 32)); this.addDescription(_GUI._.gui_config_download_autostart_desc()); addPair(_GUI._.system_download_autostart(), null, startDownloadsAfterAppStart); addPair(_GUI._.system_download_autostart_countdown(), CFG_GENERAL.SHOW_COUNTDOWNON_AUTO_START_DOWNLOADS, startDownloadTimeout); config = org.jdownloader.settings.staticreferences.CFG_GENERAL.CFG; /* File Writing */ autoCRC = new Checkbox(); this.addHeader(_GUI._.gui_config_download_write(), NewTheme.I().getIcon("hashsum", 32)); this.addDescription(_JDT._.gui_settings_filewriting_description()); this.addPair(_GUI._.gui_config_download_crc(), null, autoCRC); this.addHeader(_GUI._.gui_config_various(), NewTheme.I().getIcon("settings", 32)); this.addPair(_GUI._.gui_config_simple_container(), null, simpleContainer); }
public Packagizer() { super(); add(new Header(getTitle(), NewTheme.I().getIcon("packagizer", 32), PackagizerSettings.ENABLED), "spanx,newline,growx,pushx"); this.addDescriptionPlain(_JDT._.gui_settings_linkgrabber_packagizer_description()); packagizer = new PackagizerFilter(); add(packagizer); }
public AddToLibraryAction(StreamingExtension streamingExtension, SelectionInfo<CrawledPackage, CrawledLink> selectionInfo) { this.selection = selectionInfo; this.extension = streamingExtension; setName(T._.AddToLibraryAction()); setSmallIcon(new ImageIcon(ImageProvider.merge(NewTheme.I().getImage("go-next", 20), NewTheme.I().getImage("video", 14), 0, 0, 6, 6))); }
public Object getValue(String key) { if (LARGE_ICON_KEY == (key)) { return NewTheme.I().getIcon(getIconKey(), 24); } if (SMALL_ICON == (key)) { return NewTheme.I().getIcon(getIconKey(), 18); } if (MNEMONIC_KEY == key || DISPLAYED_MNEMONIC_INDEX_KEY == key) { Object ret = super.getValue(key); if (ret == null) { if (getName() == null) setName(createTooltip()); setMnemonic(createMnemonic()); } return super.getValue(key); } if (SHORT_DESCRIPTION == key) { return createTooltip(); } return super.getValue(key); }
public SearchField() { super(); img = NewTheme.I().getImage("search", SIZE); LAFOptions lafo = LookAndFeelController.getInstance().getLAFOptions(); bgColor = new Color(lafo.getPanelHeaderColor()); setHelpText(_GUI._.pluginsettings_search_helptext()); setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); popIcon = NewTheme.I().getImage("popupButton", -1); delayedFilter = new DelayedRunnable(IOEQ.TIMINGQUEUE, 150l, 2000l) { @Override public void delayedrun() { updateFilter(); } }; orgBorder = getBorder(); setBorder(BorderFactory.createCompoundBorder(orgBorder, BorderFactory.createEmptyBorder(0, 28, 0, 0))); addMouseMotionListener(this); addMouseListener(this); }
@Override public JComponent layoutDialogContent() { final JPanel panel = new JPanel(new MigLayout("ins 5,wrap 1", "[fill,grow]")); ImageIcon imageIcon = null; if (this.imagefile != null && this.imagefile.exists()) { imageIcon = new ImageIcon(this.imagefile.getAbsolutePath()); } else { imageIcon = NewTheme.I().getIcon("ocr", 0); } final int size = SubConfiguration.getConfig("JAC").getIntegerProperty(Configuration.PARAM_CAPTCHA_SIZE, 100); if (size != 100) { imageIcon = new ImageIcon( imageIcon .getImage() .getScaledInstance( (int) (imageIcon.getIconWidth() * size / 100.0f), (int) (imageIcon.getIconHeight() * size / 100.0f), Image.SCALE_SMOOTH)); } final JLabel captcha = new JLabel(imageIcon); captcha.addMouseListener(this); captcha.setCursor(Cursor.getPredefinedCursor(Cursor.CROSSHAIR_CURSOR)); captcha.setToolTipText(this.explain); if (this.explain != null) { final JTextPane tf = new JTextPane(); tf.setBorder(null); tf.setBackground(null); tf.setContentType("text/html"); tf.setOpaque(false); tf.putClientProperty("Synthetica.opaque", Boolean.FALSE); tf.setText(this.explain); tf.setEditable(false); panel.add(tf, ""); } panel.add(captcha, "w pref!, h pref!, alignx center"); return panel; }
public ConnectionColumn() { super(_GUI._.ConnectionColumn_ConnectionColumn(), null); panel = new RendererMigPanel("ins 0 0 0 0", "[]", "[grow,fill]"); labels = new RenderLabel[DEFAULT_ICON_COUNT + 1]; // panel.add(Box.createGlue(), "pushx,growx"); StringBuilder sb = new StringBuilder(); for (int i = 0; i <= DEFAULT_ICON_COUNT; i++) { labels[i] = new RenderLabel(); // labels[i].setBorder(BorderFactory.createMatteBorder(1, 1, 1, 1, // Color.RED)); labels[i].setOpaque(false); labels[i].setBackground(null); if (sb.length() > 0) sb.append("1"); sb.append("[18!]"); panel.add(labels[i]); } dlWatchdog = DownloadWatchDog.getInstance(); skipped = NewTheme.I().getIcon("skipped", 16); forced = NewTheme.I().getIcon("media-playback-start_forced", 16); resumeIndicator = NewTheme.I().getIcon("refresh", 16); directConnection = NewTheme.I().getIcon("modem", 16); proxyConnection = NewTheme.I().getIcon("proxy_rotate", 16); accountInUse = NewTheme.I().getIcon("users", 16); connections = NewTheme.I().getIcon("paralell", 16); panel.setLayout(new MigLayout("ins 0 0 0 0", sb.toString(), "[]")); // panel.add(Box.createGlue(), "pushx,growx"); this.setRowSorter(new ExtDefaultRowSorter<AbstractNode>() { @Override public int compare(final AbstractNode o1, final AbstractNode o2) { final long l1 = getDownloads(o1); final long l2 = getDownloads(o2); if (l1 == l2) { return 0; } if (this.getSortOrderIdentifier() == ExtColumn.SORT_ASC) { return l1 > l2 ? -1 : 1; } else { return l1 < l2 ? -1 : 1; } } }); resetRenderer(); }
public static Icon getIcon(final String name, final ExtensionsFilterInterface extension) { Icon newIcon = null; final String ext = Files.getExtension(name); if (CrossSystem.isWindows() && ext != null) { try { newIcon = CrossSystem.getMime().getFileIcon(ext, 16, 16); } catch (Throwable e) { LogController.CL().log(e); } } if (newIcon == null) { String iconID = null; if (extension != null && extension.getIconID() != null) { iconID = extension.getIconID(); } if (StringUtils.isEmpty(iconID)) { iconID = "file"; } newIcon = NewTheme.I().getIcon(iconID, 16); } return newIcon; }
@Override public Icon getIcon() { return NewTheme.I().getIcon(getIconKey(), ConfigPanel.ICON_SIZE); }
public SpeedlimitEditor(boolean b) { super(b); setLayout(new MigLayout("ins 0", "6[grow,fill][][]", "[]")); setOpaque(false); lbl = getLbl(_GUI._.SpeedlimitEditor_SpeedlimitEditor_(), NewTheme.I().getIcon("speed", 18)); spinner = new SizeSpinner(new ConfigIntSpinnerModel(org.jdownloader.settings.staticreferences.CFG_GENERAL.DOWNLOAD_SPEED_LIMIT) { /** * */ private static final long serialVersionUID = -8549816276073605186L; @Override public void setValue(Object value) { if (DownloadWatchDog.getInstance().isPaused()) { try { org.jdownloader.settings.staticreferences.CFG_GENERAL.PAUSE_SPEED.setValue(((Number) value).intValue()); } catch (ValidationException e) { java.awt.Toolkit.getDefaultToolkit().beep(); } } super.setValue(value); } }) { /** * */ private static final long serialVersionUID = 1L; @Override protected Object textToObject(String text) { if (text != null && text.trim().matches("^[0-9]+$")) { return super.textToObject(text + " kb/s"); } return super.textToObject(text); } protected String longToText(long longValue) { if (longValue <= 0) { return _GUI._.SpeedlimitEditor_format(_AWU.T.literally_kibibyte("0")); } else { return _GUI._.SpeedlimitEditor_format(SizeFormatter.formatBytes(longValue)); } } }; try { ((DefaultEditor) spinner.getEditor()).getTextField().addFocusListener(new FocusListener() { @Override public void focusLost(FocusEvent e) { } @Override public void focusGained(FocusEvent e) { // requires invoke later! SwingUtilities.invokeLater(new Runnable() { @Override public void run() { ((DefaultEditor) spinner.getEditor()).getTextField().selectAll(); } }); } }); } catch (Exception e) { e.printStackTrace(); // too much fancy Casting. } add(lbl); add(checkbox = new ExtCheckBox(org.jdownloader.settings.staticreferences.CFG_GENERAL.DOWNLOAD_SPEED_LIMIT_ENABLED, lbl, spinner), "width 20!"); DownloadWatchDog.getInstance().getEventSender().addListener(this, true); add(spinner, "height " + Math.max(spinner.getEditor().getPreferredSize().height, 20) + "!,width " + getEditorWidth() + "!"); DownloadWatchDog.getInstance().notifyCurrentState(this); }
@Override public ImageIcon getIcon() { return NewTheme.I().getIcon("packagizer", 32); }
@Override protected ConfigContainer setupContainer() { ConfigEntry ce; final ConfigContainer look = new ConfigContainer(); look.setGroup(new ConfigGroup(_GUI._.gui_config_gui_view(), "gui")); look.addEntry(ce = new ConfigEntry(ConfigContainer.TYPE_COMBOBOX, SubConfiguration.getConfig(JDL.CONFIG), JDL.LOCALE_PARAM_ID, JDL.getLocaleIDs().toArray(new JDLocale[] {}), _GUI._.gui_config_gui_language())); ce.setDefaultValue(JDL.DEFAULT_LOCALE); ce.setPropertyType(PropertyType.NEEDS_RESTART); // if // (LookAndFeelController.getInstance().getSupportedLookAndFeels().length // > 1) { // look.addEntry(ce = new ConfigEntry(ConfigContainer.TYPE_COMBOBOX, // this.subConfig, LookAndFeelController.PARAM_PLAF, // LookAndFeelController.getInstance().getSupportedLookAndFeels(), // T._.gui_config_gui_plaf())); // ce.setDefaultValue(LookAndFeelController.getInstance().getPlaf()); // ce.setPropertyType(PropertyType.NEEDS_RESTART); // } look.setGroup(new ConfigGroup(_GUI._.gui_config_gui_feel(), "settings")); // look.addEntry(ce = new ConfigEntry(ConfigContainer.TYPE_SPINNER, // this.subConfig, JDGuiConstants.PARAM_INPUTTIMEOUT, // JDL.L("gui.config.gui.inputtimeout", "Timeout for InputWindows"), 0, // 600, 5)); // ce.setDefaultValue(20); // ce.setPropertyType(PropertyType.NEEDS_RESTART); // look.addEntry(ce = new ConfigEntry(ConfigContainer.TYPE_CHECKBOX, // this.subConfig, JDGuiConstants.PARAM_SHOW_BALLOON, // JDL.L("gui.config.gui.showBalloon", "Show Balloon infos"))); // ce.setDefaultValue(false); look.addEntry(ce = new ConfigEntry(ConfigContainer.TYPE_BUTTON, new ActionListener() { public void actionPerformed(final ActionEvent e) { AbstractDialog.resetDialogInformations(); UserIO.getInstance().requestMessageDialog(_GUI._.gui_config_gui_resetdialogs_message()); } }, _GUI._.gui_config_gui_resetdialogs_short(), _GUI._.gui_config_gui_resetdialogs2(), NewTheme.I().getIcon("restart", 16))); look.setGroup(new ConfigGroup(_GUI._.gui_config_gui_performance(), "guiperformance")); look.addEntry(ce = new ConfigEntry(ConfigContainer.TYPE_CHECKBOX, this.subConfig, JDGuiConstants.DECORATION_ENABLED, _GUI._.gui_config_gui_decoration())); ce.setDefaultValue(true); ce.setPropertyType(PropertyType.NEEDS_RESTART); look.setGroup(new ConfigGroup(_GUI._.gui_config_gui_barrierfree(), "barrierfreesettings")); look.addEntry(ce = new ConfigEntry(ConfigContainer.TYPE_SPINNER, this.subConfig, JDGuiConstants.PARAM_GENERAL_FONT_SIZE, _GUI._.gui_config_gui_font_size(), 50, 200, 10).setDefaultValue(100)); ce.setPropertyType(PropertyType.NEEDS_RESTART); return look; }
public void setAnswer(AbstractResponse<T> abstractResponse) { answered = true; job.addAnswer(abstractResponse); setStatus(_GUI._.DeathByCaptchaSolver_solveBasicCaptchaChallenge_answer(abstractResponse.getValue() + ""), NewTheme.I().getIcon(IconKey.ICON_OK, 20)); }
public AddOptionsAction(JButton addLinks) { setSmallIcon(NewTheme.I().getIcon("popupButton", -1)); setTooltipText(_GUI._.AddOptionsAction_AddOptionsAction_tt()); positionComp = addLinks; }
@Override public void onAction(ActionEvent e) { StringBuilder def = new StringBuilder(); try { String newText = ClipboardHandler.getClipboard().getCurrentClipboardLinks(); String[] links = HTMLParser.getHttpLinks(newText, null); ArrayList<String> pws = HTMLParser.findPasswords(newText); for (String l : links) def.append(l).append("\r\n"); for (String pw : pws) { def.append("password: "******"\r\n"); } } catch (Exception e2) { } String link = UserIO.getInstance().requestInputDialog(UserIO.NO_COUNTDOWN | UserIO.STYLE_LARGE, _GUI._.gui_dialog_addurl_title(), _GUI._.gui_dialog_addurl_message(), def.toString(), NewTheme.I().getIcon("linkgrabber", 32), _GUI._.gui_dialog_addurl_okoption_parse(), null); if (link == null || link.length() == 0) return; if (CNL2.checkText(link)) return; DistributeData tmp = new DistributeData(link, false); tmp.setDisableDeepEmergencyScan(false); tmp.start(); }
@Override public ImageIcon getIcon() { return NewTheme.I().getIcon("home", 32); }