-Jtree refresh
This commit is contained in:
tonikelope 2016-10-13 20:12:15 +02:00
parent e3eede92db
commit ec23de9bb7
5 changed files with 27 additions and 31 deletions

View File

@ -29,7 +29,6 @@
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jPanel2" max="32767" attributes="0"/>
<Component id="jPanel1" alignment="0" max="32767" attributes="0"/>
<Component id="total_file_size_label" alignment="0" max="32767" attributes="0"/>
<Group type="102" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="warning_label" min="-2" max="-2" attributes="0"/>
@ -45,6 +44,7 @@
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
<Component id="dance_button" min="-2" pref="300" max="-2" attributes="0"/>
</Group>
<Component id="total_file_size_label" alignment="0" max="32767" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
@ -91,7 +91,7 @@
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="file_tree_scrollpane" alignment="0" pref="226" max="32767" attributes="0"/>
<Component id="file_tree_scrollpane" alignment="0" pref="275" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
</Layout>

View File

@ -173,7 +173,7 @@ public final class FileGrabberDialog extends javax.swing.JDialog {
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(file_tree_scrollpane, javax.swing.GroupLayout.DEFAULT_SIZE, 226, Short.MAX_VALUE)
.addComponent(file_tree_scrollpane, javax.swing.GroupLayout.DEFAULT_SIZE, 275, Short.MAX_VALUE)
);
upload_name_label.setFont(new java.awt.Font("Dialog", 1, 20)); // NOI18N
@ -303,7 +303,6 @@ public final class FileGrabberDialog extends javax.swing.JDialog {
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(total_file_size_label, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(warning_label)
@ -314,7 +313,8 @@ public final class FileGrabberDialog extends javax.swing.JDialog {
.addGap(0, 91, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addGap(0, 0, Short.MAX_VALUE)
.addComponent(dance_button, javax.swing.GroupLayout.PREFERRED_SIZE, 300, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addComponent(dance_button, javax.swing.GroupLayout.PREFERRED_SIZE, 300, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(total_file_size_label, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap())
);
layout.setVerticalGroup(
@ -373,7 +373,7 @@ public final class FileGrabberDialog extends javax.swing.JDialog {
if( filechooser.showOpenDialog(tthis) == JFileChooser.APPROVE_OPTION ) {
swingReflectionInvoke("setText", total_file_size_label, "");
swingReflectionInvoke("setText", total_file_size_label, "[0 B]");
File[] files_selected = filechooser.getSelectedFiles();
@ -391,14 +391,8 @@ public final class FileGrabberDialog extends javax.swing.JDialog {
root.add(current_file);
}
swingReflectionInvokeAndWait("setEnabled", file_tree, true);
file_tree.setModel(new DefaultTreeModel(sortTree(root)));
file_tree.revalidate();
file_tree.repaint();
_genFileList();
@ -426,6 +420,7 @@ public final class FileGrabberDialog extends javax.swing.JDialog {
swingReflectionInvoke("setEnabled", skip_rest_button, root_childs);
((DefaultTreeModel)file_tree.getModel()).reload();
}});
}//GEN-LAST:event_add_files_buttonActionPerformed
@ -463,7 +458,7 @@ public final class FileGrabberDialog extends javax.swing.JDialog {
if( filechooser.showOpenDialog(tthis) == JFileChooser.APPROVE_OPTION ) {
swingReflectionInvoke("setText", total_file_size_label, "");
swingReflectionInvoke("setText", total_file_size_label, "[0 B]");
_base_path = filechooser.getSelectedFile().getAbsolutePath();
@ -474,15 +469,9 @@ public final class FileGrabberDialog extends javax.swing.JDialog {
DefaultMutableTreeNode root = new DefaultMutableTreeNode(filechooser.getSelectedFile().getAbsolutePath());
_genFileTree(filechooser.getSelectedFile().getAbsolutePath(), root);
swingReflectionInvokeAndWait("setEnabled", file_tree, true);
file_tree.setModel(new DefaultTreeModel(sortTree(root)));
file_tree.revalidate();
file_tree.repaint();
_genFileList();
}
@ -508,8 +497,8 @@ public final class FileGrabberDialog extends javax.swing.JDialog {
swingReflectionInvoke("setEnabled", skip_button, root_childs);
swingReflectionInvoke("setEnabled", skip_rest_button, root_childs);
((DefaultTreeModel)file_tree.getModel()).reload();
}});
@ -699,6 +688,8 @@ public final class FileGrabberDialog extends javax.swing.JDialog {
swingReflectionInvoke("setEnabled", skip_button, root_childs);
swingReflectionInvoke("setEnabled", skip_rest_button, root_childs);
((DefaultTreeModel)file_tree.getModel()).reload();
}
}//GEN-LAST:event_skip_rest_buttonActionPerformed
@ -724,6 +715,8 @@ public final class FileGrabberDialog extends javax.swing.JDialog {
swingReflectionInvoke("setEnabled", skip_button, root_childs);
swingReflectionInvoke("setEnabled", skip_rest_button, root_childs);
((DefaultTreeModel)file_tree.getModel()).reload();
}
}//GEN-LAST:event_skip_buttonActionPerformed

View File

@ -237,8 +237,12 @@ public final class FolderLinkDialog extends javax.swing.JDialog {
if(deleteSelectedTreeItems(file_tree)) {
_genDownloadLiks();
file_tree.setRootVisible( ((MegaMutableTreeNode)file_tree.getModel().getRoot()).getChildCount() > 0 );
swingReflectionInvoke("setVisible", restore_button, true);
((DefaultTreeModel)file_tree.getModel()).reload();
}
}//GEN-LAST:event_skip_buttonActionPerformed
@ -254,8 +258,12 @@ public final class FolderLinkDialog extends javax.swing.JDialog {
if(deleteAllExceptSelectedTreeItems(file_tree)) {
_genDownloadLiks();
file_tree.setRootVisible( ((MegaMutableTreeNode)file_tree.getModel().getRoot()).getChildCount() > 0 );
swingReflectionInvoke("setVisible", restore_button, true);
((DefaultTreeModel)file_tree.getModel()).reload();
}
}//GEN-LAST:event_skip_rest_buttonActionPerformed
@ -284,6 +292,8 @@ public final class FolderLinkDialog extends javax.swing.JDialog {
file_tree.setRootVisible( ((MegaMutableTreeNode)file_tree.getModel().getRoot()).getChildCount() > 0 );
((DefaultTreeModel)file_tree.getModel()).reload();
}});
}//GEN-LAST:event_restore_buttonActionPerformed
@ -360,9 +370,6 @@ public final class FolderLinkDialog extends javax.swing.JDialog {
file_tree.setModel(new DefaultTreeModel(sortTree(root)));
file_tree.revalidate();
file_tree.repaint();
} catch (Exception ex) {

View File

@ -62,7 +62,7 @@ import static megabasterd.Transference.MAX_TRANSFERENCE_SPEED_DEFAULT;
*/
public final class MainPanel {
public static final String VERSION="1.27";
public static final String VERSION="1.28";
public static final int CONNECTION_TIMEOUT = 30000;
public static final int THROTTLE_SLICE_SIZE=16*1024;
public static final int STREAMER_PORT = 1337;

View File

@ -666,9 +666,7 @@ public final class MiscTools {
try {
tree.setModel(new DefaultTreeModel((MutableTreeNode)tree.getModel().getRoot().getClass().newInstance()));
tree.revalidate();
tree.repaint();
} catch (InstantiationException | IllegalAccessException ex) {
Logger.getLogger(MiscTools.class.getName()).log(Level.SEVERE, null, ex);
}
@ -766,9 +764,7 @@ public final class MiscTools {
tree.setModel(new DefaultTreeModel(sortTree((DefaultMutableTreeNode)new_root)));
tree.revalidate();
tree.repaint();
return true;
}