Browse Source

REPORT-78864 收起所有操作后其他按钮没有置灰等

feature/x
roger 2 years ago
parent
commit
b112a98c33
  1. 27
      designer-base/src/main/java/com/fr/design/actions/file/LocateAction.java
  2. 31
      designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java
  3. 1
      designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java

27
designer-base/src/main/java/com/fr/design/actions/file/LocateAction.java

@ -3,6 +3,7 @@ package com.fr.design.actions.file;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.file.TemplateTreePane; import com.fr.design.file.TemplateTreePane;
import com.fr.design.gui.itree.filetree.TemplateFileTree;
import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode; import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode;
import com.fr.design.gui.itree.refreshabletree.RefreshableJTree; import com.fr.design.gui.itree.refreshabletree.RefreshableJTree;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
@ -32,7 +33,7 @@ public class LocateAction extends UpdateAction {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
JTemplate<?, ?> current = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); JTemplate<?, ?> current = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
gotoEditingTemplateLeaf(current.getEditingFILE().getPath()); gotoEditingTemplateLeaf(current.getEditingFILE().getPath(), false);
} }
/** /**
@ -41,20 +42,34 @@ public class LocateAction extends UpdateAction {
* @param locatedPath * @param locatedPath
*/ */
public static void gotoEditingTemplateLeaf(String locatedPath) { public static void gotoEditingTemplateLeaf(String locatedPath) {
gotoEditingTemplateLeaf(locatedPath, true);
}
private static void gotoEditingTemplateLeaf(String locatedPath, boolean needRefreshMode) {
if (locatedPath == null) { if (locatedPath == null) {
return; return;
} }
DefaultTreeModel model = (DefaultTreeModel) TemplateTreePane.getInstance().getTemplateFileTree().getModel(); DefaultTreeModel model = (DefaultTreeModel) getTemplateFileTree().getModel();
ExpandMutableTreeNode treeNode = (ExpandMutableTreeNode) model.getRoot(); ExpandMutableTreeNode treeNode = (ExpandMutableTreeNode) model.getRoot();
if (needRefreshMode) {
treeNode.removeAllChildren();
ExpandMutableTreeNode[] childTreeNodes = getTemplateFileTree().loadChildTreeNodes(treeNode);
treeNode.addChildTreeNodes(childTreeNodes);
model.reload(treeNode);
}
recursiveSelectPath(treeNode, locatedPath, model); recursiveSelectPath(treeNode, locatedPath, model);
TreePath selectedTreePath = TemplateTreePane.getInstance().getTemplateFileTree().getSelectionPath(); TreePath selectedTreePath = getTemplateFileTree().getSelectionPath();
if (selectedTreePath != null) { if (selectedTreePath != null) {
TemplateTreePane.getInstance().getTemplateFileTree().scrollPathToVisible(selectedTreePath); getTemplateFileTree().scrollPathToVisible(selectedTreePath);
} }
} }
private static TemplateFileTree getTemplateFileTree() {
return TemplateTreePane.getInstance().getTemplateFileTree();
}
private static void recursiveSelectPath(TreeNode treeNode, String currentPath, DefaultTreeModel m_model) { private static void recursiveSelectPath(TreeNode treeNode, String currentPath, DefaultTreeModel m_model) {
for (int i = 0, len = treeNode.getChildCount(); i < len; i++) { for (int i = 0, len = treeNode.getChildCount(); i < len; i++) {
TreeNode node = treeNode.getChildAt(i); TreeNode node = treeNode.getChildAt(i);
@ -90,7 +105,7 @@ public class LocateAction extends UpdateAction {
// 如果equals,说明找到了,不必再找下去了 // 如果equals,说明找到了,不必再找下去了
if (ComparatorUtils.equals(new File(currentTreePath), new File(filePath))) { if (ComparatorUtils.equals(new File(currentTreePath), new File(filePath))) {
TemplateTreePane.getInstance().getTemplateFileTree().setSelectionPath(new TreePath(model.getPathToRoot(currentTreeNode))); getTemplateFileTree().setSelectionPath(new TreePath(model.getPathToRoot(currentTreeNode)));
result = true; result = true;
} }
// 如果当前路径是currentFilePath的ParentFile,则expandTreeNode,并继续往下找 // 如果当前路径是currentFilePath的ParentFile,则expandTreeNode,并继续往下找
@ -122,7 +137,7 @@ public class LocateAction extends UpdateAction {
// 删除所有的节点. // 删除所有的节点.
currentTreeNode.removeAllChildren(); currentTreeNode.removeAllChildren();
ExpandMutableTreeNode[] children = TemplateTreePane.getInstance().getTemplateFileTree().loadChildTreeNodes(currentTreeNode); ExpandMutableTreeNode[] children = getTemplateFileTree().loadChildTreeNodes(currentTreeNode);
for (ExpandMutableTreeNode c : children) { for (ExpandMutableTreeNode c : children) {
currentTreeNode.add(c); currentTreeNode.add(c);
} }

31
designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java

@ -68,6 +68,9 @@ import java.awt.geom.Path2D;
import java.awt.geom.RoundRectangle2D; import java.awt.geom.RoundRectangle2D;
import java.util.List; import java.util.List;
import static com.fr.design.dialog.FineJOptionPane.showConfirmDialog;
import static javax.swing.JOptionPane.*;
/** /**
* Author : daisy * Author : daisy
* Date: 13-8-5 * Date: 13-8-5
@ -265,7 +268,33 @@ public class MutilTempalteTabPane extends JComponent {
TemplateTreePane.getInstance().refreshDockingView(); TemplateTreePane.getInstance().refreshDockingView();
} }
JTemplate<?, ?> template = openedTemplate.get(this.tplIndex); JTemplate<?, ?> template = openedTemplate.get(this.tplIndex);
super.gotoEditingTemplateLeaf(template.getPath()); locateTemplate(template);
}
private void locateTemplate(JTemplate<?, ?> template) {
FILE currentTemplate = template.getEditingFILE();
//模板不属于当前环境,跟预览一样先提示保存,再定位模板
if (!currentTemplate.exists()) {
int selVal = showConfirmDialog(
DesignerContext.getDesignerFrame(),
Toolkit.i18nText("Fine-Design_Basic_Web_Preview_Message"),
Toolkit.i18nText("Fine-Design_Basic_Preview_Tool_Tips"),
OK_CANCEL_OPTION,
WARNING_MESSAGE
);
if (OK_OPTION == selVal) {
CallbackSaveWorker worker = template.saveAs();
worker.start(template.getRuntimeId());
worker.addSuccessCallback(new Runnable() {
@Override
public void run() {
gotoEditingTemplateLeaf(template.getPath());
}
});
}
} else {
gotoEditingTemplateLeaf(template.getPath());
}
} }
} }

1
designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java

@ -476,6 +476,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
TemplateTreePane.getInstance().refreshDockingView(); TemplateTreePane.getInstance().refreshDockingView();
refreshDockingView();
} }
} }

Loading…
Cancel
Save