Browse Source

Pull request #15012: REPORT-136934 远程设计下双击目录卡顿优化

Merge in DESIGN/design from ~VITO/c-design:fbp/release to fbp/release

* commit '068b68d647910df9f956eae8bac0125c4548a600':
  REPORT-136934 远程设计下双击目录卡顿优化
fbp/release
vito-刘恒霖 2 months ago
parent
commit
3494efc1f8
  1. 34
      designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java

34
designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java

@ -37,11 +37,17 @@ import com.fr.workspace.base.UserInfo;
import com.fr.workspace.server.repository.vcs.VcsRepository;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;
import javax.swing.SwingWorker;
import javax.swing.ToolTipManager;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.TreeNode;
import javax.swing.tree.TreePath;
import java.awt.*;
import java.awt.BorderLayout;
import java.awt.Desktop;
import java.awt.Dimension;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.awt.event.MouseAdapter;
@ -53,8 +59,6 @@ import java.util.Arrays;
import java.util.Collection;
import java.util.Enumeration;
import java.util.Objects;
import java.util.Observable;
import java.util.Observer;
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.ExecutionException;
@ -88,12 +92,7 @@ public class TemplateTreePane extends JPanel implements FileOperations {
ToolTipManager.sharedInstance().registerComponent(reportletsTree);
FileLockStateObservable.getInstance().addObserver(new Observer() {
@Override
public void update(Observable o, Object arg) {
TemplateTreePane.this.refresh();
}
});
FileLockStateObservable.getInstance().addObserver((o, arg) -> TemplateTreePane.this.refresh());
/*
* Tree.MouseAdapter
@ -102,6 +101,9 @@ public class TemplateTreePane extends JPanel implements FileOperations {
@Override
public void mousePressed(MouseEvent evt) {
if (isDirectorySelection()) {
return;
}
if (evt.getClickCount() == 2) {
DesignCacheManager.processByCacheTableData(() -> openFile());
}
@ -157,6 +159,16 @@ public class TemplateTreePane extends JPanel implements FileOperations {
});
}
/**
* 选中的是否目录
*
* @return 是否目录
*/
private boolean isDirectorySelection() {
FileNode fileNode = reportletsTree.getSelectedFileNode();
return fileNode != null && fileNode.isDirectory();
}
public TemplateFileTree getTemplateFileTree() {
return this.reportletsTree;
}
@ -415,6 +427,7 @@ public class TemplateTreePane extends JPanel implements FileOperations {
}
return success;
}
@Override
protected void done() {
try {
@ -518,6 +531,7 @@ public class TemplateTreePane extends JPanel implements FileOperations {
}
return false;
}
public void setToolbarStateChangeListener(FileToolbarStateChangeListener listener) {
this.toolBarStateChangeListener = listener;
}

Loading…
Cancel
Save