mirror of
https://github.com/tonikelope/megabasterd.git
synced 2025-05-02 07:34:38 +02:00
7.95
Improve folder load tree
This commit is contained in:
parent
5667ab9364
commit
754ae6a89f
2
pom.xml
2
pom.xml
@ -3,7 +3,7 @@
|
|||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>com.tonikelope</groupId>
|
<groupId>com.tonikelope</groupId>
|
||||||
<artifactId>MegaBasterd</artifactId>
|
<artifactId>MegaBasterd</artifactId>
|
||||||
<version>7.94</version>
|
<version>7.95</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
<repositories>
|
<repositories>
|
||||||
<repository>
|
<repository>
|
||||||
|
@ -822,7 +822,7 @@ public class FileGrabberDialog extends javax.swing.JDialog {
|
|||||||
|
|
||||||
private void skip_rest_buttonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_skip_rest_buttonActionPerformed
|
private void skip_rest_buttonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_skip_rest_buttonActionPerformed
|
||||||
|
|
||||||
if (deleteAllExceptSelectedTreeItems(file_tree, null)) {
|
if (deleteAllExceptSelectedTreeItems(file_tree)) {
|
||||||
|
|
||||||
_genFileList();
|
_genFileList();
|
||||||
|
|
||||||
|
@ -47,8 +47,6 @@ public class FolderLinkDialog extends javax.swing.JDialog {
|
|||||||
|
|
||||||
private volatile boolean exit = false;
|
private volatile boolean exit = false;
|
||||||
|
|
||||||
private volatile MegaMutableTreeNode _subfolder_node = null;
|
|
||||||
|
|
||||||
public List<HashMap> getDownload_links() {
|
public List<HashMap> getDownload_links() {
|
||||||
return Collections.unmodifiableList(_download_links);
|
return Collections.unmodifiableList(_download_links);
|
||||||
}
|
}
|
||||||
@ -323,7 +321,7 @@ public class FolderLinkDialog extends javax.swing.JDialog {
|
|||||||
|
|
||||||
private void skip_rest_buttonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_skip_rest_buttonActionPerformed
|
private void skip_rest_buttonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_skip_rest_buttonActionPerformed
|
||||||
|
|
||||||
if (deleteAllExceptSelectedTreeItems(file_tree, _subfolder_node)) {
|
if (deleteAllExceptSelectedTreeItems(file_tree)) {
|
||||||
file_tree.setEnabled(false);
|
file_tree.setEnabled(false);
|
||||||
node_bar.setVisible(true);
|
node_bar.setVisible(true);
|
||||||
skip_rest_button.setEnabled(false);
|
skip_rest_button.setEnabled(false);
|
||||||
|
@ -70,7 +70,7 @@ import javax.swing.UIManager;
|
|||||||
*/
|
*/
|
||||||
public final class MainPanel {
|
public final class MainPanel {
|
||||||
|
|
||||||
public static final String VERSION = "7.94";
|
public static final String VERSION = "7.95";
|
||||||
public static final boolean FORCE_SMART_PROXY = false; //TRUE FOR DEBUGING SMART PROXY
|
public static final boolean FORCE_SMART_PROXY = false; //TRUE FOR DEBUGING SMART PROXY
|
||||||
public static final int THROTTLE_SLICE_SIZE = 16 * 1024;
|
public static final int THROTTLE_SLICE_SIZE = 16 * 1024;
|
||||||
public static final int DEFAULT_BYTE_BUFFER_SIZE = 16 * 1024;
|
public static final int DEFAULT_BYTE_BUFFER_SIZE = 16 * 1024;
|
||||||
|
@ -39,6 +39,7 @@ import java.io.ObjectInputStream;
|
|||||||
import java.io.ObjectOutputStream;
|
import java.io.ObjectOutputStream;
|
||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
import java.lang.management.ManagementFactory;
|
import java.lang.management.ManagementFactory;
|
||||||
|
import java.lang.reflect.InvocationTargetException;
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
import java.net.HttpURLConnection;
|
import java.net.HttpURLConnection;
|
||||||
import java.net.InetSocketAddress;
|
import java.net.InetSocketAddress;
|
||||||
@ -807,7 +808,7 @@ public class MiscTools {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean deleteAllExceptSelectedTreeItems(JTree tree, DefaultMutableTreeNode custom_root) {
|
public static boolean deleteAllExceptSelectedTreeItems(JTree tree) {
|
||||||
|
|
||||||
TreePath[] paths = tree.getSelectionPaths();
|
TreePath[] paths = tree.getSelectionPaths();
|
||||||
|
|
||||||
@ -823,12 +824,14 @@ public class MiscTools {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
new_root = node_class.newInstance();
|
new_root = node_class.getDeclaredConstructor().newInstance();
|
||||||
|
|
||||||
((MutableTreeNode) new_root).setUserObject(((DefaultMutableTreeNode) tree_model.getRoot()).getUserObject());
|
((DefaultMutableTreeNode) new_root).setUserObject(((DefaultMutableTreeNode) tree_model.getRoot()).getUserObject());
|
||||||
|
|
||||||
} catch (InstantiationException | IllegalAccessException ex) {
|
} catch (InstantiationException | IllegalAccessException ex) {
|
||||||
Logger.getLogger(MiscTools.class.getName()).log(Level.SEVERE, ex.getMessage());
|
Logger.getLogger(MiscTools.class.getName()).log(Level.SEVERE, ex.getMessage());
|
||||||
|
} catch (NoSuchMethodException | SecurityException | IllegalArgumentException | InvocationTargetException ex) {
|
||||||
|
Logger.getLogger(MiscTools.class.getName()).log(Level.SEVERE, null, ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (TreePath path : paths) {
|
for (TreePath path : paths) {
|
||||||
@ -838,13 +841,13 @@ public class MiscTools {
|
|||||||
|
|
||||||
for (Object path_element : path.getPath()) {
|
for (Object path_element : path.getPath()) {
|
||||||
|
|
||||||
if ((MutableTreeNode) path_element != (MutableTreeNode) tree_model.getRoot()) {
|
if ((DefaultMutableTreeNode) path_element != (DefaultMutableTreeNode) tree_model.getRoot()) {
|
||||||
|
|
||||||
if (hashmap_old.get(path_element) == null) {
|
if (hashmap_old.get(path_element) == null) {
|
||||||
|
|
||||||
Object node = null;
|
Object node = null;
|
||||||
|
|
||||||
if ((MutableTreeNode) path_element == (MutableTreeNode) path.getLastPathComponent()) {
|
if ((DefaultMutableTreeNode) path_element == (DefaultMutableTreeNode) path.getLastPathComponent()) {
|
||||||
|
|
||||||
node = path_element;
|
node = path_element;
|
||||||
|
|
||||||
@ -854,7 +857,7 @@ public class MiscTools {
|
|||||||
|
|
||||||
node = node_class.newInstance();
|
node = node_class.newInstance();
|
||||||
|
|
||||||
((MutableTreeNode) node).setUserObject(((DefaultMutableTreeNode) path_element).getUserObject());
|
((DefaultMutableTreeNode) node).setUserObject(((DefaultMutableTreeNode) path_element).getUserObject());
|
||||||
|
|
||||||
} catch (InstantiationException | IllegalAccessException ex) {
|
} catch (InstantiationException | IllegalAccessException ex) {
|
||||||
Logger.getLogger(MiscTools.class.getName()).log(Level.SEVERE, ex.getMessage());
|
Logger.getLogger(MiscTools.class.getName()).log(Level.SEVERE, ex.getMessage());
|
||||||
@ -863,11 +866,11 @@ public class MiscTools {
|
|||||||
|
|
||||||
if (parent != null) {
|
if (parent != null) {
|
||||||
|
|
||||||
((DefaultMutableTreeNode) parent).add((MutableTreeNode) node);
|
((DefaultMutableTreeNode) parent).add((DefaultMutableTreeNode) node);
|
||||||
|
|
||||||
if (!((TreeNode) path_element).isLeaf()) {
|
if (!((TreeNode) path_element).isLeaf()) {
|
||||||
|
|
||||||
hashmap_old.put((MutableTreeNode) path_element, (MutableTreeNode) node);
|
hashmap_old.put((DefaultMutableTreeNode) path_element, (DefaultMutableTreeNode) node);
|
||||||
|
|
||||||
parent = node;
|
parent = node;
|
||||||
}
|
}
|
||||||
@ -886,10 +889,6 @@ public class MiscTools {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (custom_root != null) {
|
|
||||||
new_root = custom_root;
|
|
||||||
}
|
|
||||||
|
|
||||||
tree.setModel(new DefaultTreeModel(sortTree((DefaultMutableTreeNode) new_root)));
|
tree.setModel(new DefaultTreeModel(sortTree((DefaultMutableTreeNode) new_root)));
|
||||||
|
|
||||||
tree.setRootVisible(new_root != null ? ((TreeNode) new_root).getChildCount() > 0 : false);
|
tree.setRootVisible(new_root != null ? ((TreeNode) new_root).getChildCount() > 0 : false);
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 208 KiB After Width: | Height: | Size: 208 KiB |
Loading…
x
Reference in New Issue
Block a user