You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
81 lines
2.6 KiB
81 lines
2.6 KiB
package com.fr.design.file; |
|
|
|
import com.fr.base.FRContext; |
|
import com.fr.design.border.FineBorderFactory; |
|
import com.fr.design.gui.itree.filetree.TemplateDirTree; |
|
import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode; |
|
import com.fr.design.i18n.Toolkit; |
|
import com.fr.design.layout.FRGUIPaneFactory; |
|
import com.fr.design.mainframe.DesignerFrameFileDealerPane; |
|
import com.fr.design.mainframe.manager.search.searcher.control.pane.TemplateDirSearchRemindPane; |
|
import com.fr.file.filetree.IOFileNodeFilter; |
|
import com.fr.log.FineLoggerFactory; |
|
import com.fr.stable.ArrayUtils; |
|
|
|
import javax.swing.JPanel; |
|
import javax.swing.tree.TreePath; |
|
import java.awt.BorderLayout; |
|
|
|
/** |
|
* 目录树面板 |
|
*/ |
|
public class TemplateDirTreePane extends JPanel { |
|
|
|
public static TemplateDirTreePane getInstance() { |
|
return TemplateDirTreePane.HOLDER.singleton; |
|
} |
|
|
|
private static class HOLDER { |
|
private static TemplateDirTreePane singleton = new TemplateDirTreePane(); |
|
} |
|
|
|
private TemplateDirTree templateDirTree; |
|
private TemplateDirSearchRemindPane remindPane; |
|
|
|
public TemplateDirTreePane() { |
|
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
|
this.setBorder(FineBorderFactory.createWrappedRoundBorder()); |
|
templateDirTree = new TemplateDirTree(); |
|
remindPane = new TemplateDirSearchRemindPane(getTemplateDirTree()); |
|
|
|
this.add(remindPane, BorderLayout.CENTER); |
|
} |
|
|
|
public TemplateDirTree getTemplateDirTree() { |
|
return this.templateDirTree; |
|
} |
|
|
|
/** |
|
* 判断所选的目录是否有权限 |
|
* |
|
* @return |
|
*/ |
|
public boolean selectedAccess() { |
|
TreePath[] selectedTreePaths = templateDirTree.getSelectionPaths(); |
|
|
|
if (ArrayUtils.isEmpty(selectedTreePaths)) { |
|
return false; |
|
} |
|
// 选中的是文件夹 |
|
TreePath treePath = selectedTreePaths[0]; |
|
ExpandMutableTreeNode currentTreeNode = (ExpandMutableTreeNode) treePath.getLastPathComponent(); |
|
return currentTreeNode != null && currentTreeNode.hasFullAuthority(); |
|
} |
|
|
|
public void refresh() { |
|
// 刷新远程文件夹权限 |
|
NodeAuthProcessor.getInstance().refresh(); |
|
templateDirTree.refresh(); |
|
DesignerFrameFileDealerPane.getInstance().refreshRightToolBarBy(null); |
|
FineLoggerFactory.getLogger().info(Toolkit.i18nText("Fine-Design_Basic_Template_File_Tree_Refresh_Successfully") + "!"); |
|
} |
|
|
|
/** |
|
* 刷新 |
|
*/ |
|
public void refreshDockingView() { |
|
templateDirTree.setFileNodeFilter(new IOFileNodeFilter(FRContext.getFileNodes().getSupportedTypes())); |
|
templateDirTree.refreshEnv(); |
|
} |
|
|
|
}
|
|
|