From 28298be0d6f8758495f9cafa28282486e7514c6c Mon Sep 17 00:00:00 2001 From: rinoux Date: Fri, 13 Jul 2018 16:28:32 +0800 Subject: [PATCH] method name --- .../design/actions/file/SwitchExistEnv.java | 2 +- .../design/data/DesignTableDataManager.java | 4 ++-- .../design/file/HistoryTemplateListPane.java | 10 +++++----- .../com/fr/design/file/TemplateTreePane.java | 2 +- .../com/fr/design/mainframe/JTemplate.java | 19 +++---------------- .../fr/design/mainframe/JVirtualTemplate.java | 4 ++-- 6 files changed, 14 insertions(+), 27 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/actions/file/SwitchExistEnv.java b/designer-base/src/main/java/com/fr/design/actions/file/SwitchExistEnv.java index f378d7f5e2..a07f428526 100644 --- a/designer-base/src/main/java/com/fr/design/actions/file/SwitchExistEnv.java +++ b/designer-base/src/main/java/com/fr/design/actions/file/SwitchExistEnv.java @@ -38,7 +38,7 @@ public class SwitchExistEnv extends MenuDef { JTemplate t = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); if (t != null) { GeneralContext.addEnvWillChangedListener( - t.getFullPathName(), + t.getPath(), new EnvChangedListener() { public void envChanged() { SwitchExistEnv.this.clearShortCuts(); diff --git a/designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java b/designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java index 635ba239a7..9e45309ff4 100644 --- a/designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java +++ b/designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java @@ -105,7 +105,7 @@ public abstract class DesignTableDataManager { public static void closeTemplate(JTemplate template) { if (template != null) { - dsListenersMap.remove(template.getFullPathName()); + dsListenersMap.remove(template.getPath()); } } @@ -164,7 +164,7 @@ public abstract class DesignTableDataManager { JTemplate template = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); String key = StringUtils.EMPTY; if (template != null) { - key = template.getFullPathName(); + key = template.getPath(); } List dsListeners = dsListenersMap.get(key); if (dsListeners == null) { diff --git a/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListPane.java b/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListPane.java index 4974e53e4a..cff8675c4c 100644 --- a/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListPane.java +++ b/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListPane.java @@ -114,7 +114,7 @@ public class HistoryTemplateListPane extends JPanel implements FileOperations, C public void closeSelectedReport(JTemplate selected) { DesignModuleFactory.clearChartPropertyPane(); DesignTableDataManager.closeTemplate(selected); - GeneralContext.removeEnvWillChangedListener(selected.getFullPathName()); + GeneralContext.removeEnvWillChangedListener(selected.getPath()); if (contains(selected) == -1) { return; } @@ -139,7 +139,7 @@ public class HistoryTemplateListPane extends JPanel implements FileOperations, C public void closeVirtualSelectedReport(JTemplate selected) { DesignModuleFactory.clearChartPropertyPane(); DesignTableDataManager.closeTemplate(selected); - GeneralContext.removeEnvWillChangedListener(selected.getFullPathName()); + GeneralContext.removeEnvWillChangedListener(selected.getPath()); if (contains(selected) == -1) { return; } @@ -185,7 +185,7 @@ public class HistoryTemplateListPane extends JPanel implements FileOperations, C if (editingTemplate == null) { return; } - DesignerEnvManager.getEnvManager().addRecentOpenedFilePath(editingTemplate.getFullPathName()); + DesignerEnvManager.getEnvManager().addRecentOpenedFilePath(editingTemplate.getPath()); ((HistoryListDataMode) list.getModel()).add(editingTemplate); } @@ -246,7 +246,7 @@ public class HistoryTemplateListPane extends JPanel implements FileOperations, C */ public int contains(String filename) { for (int i = 0; i < historyList.size(); i++) { - String historyPath = historyList.get(i).getFullPathName(); + String historyPath = historyList.get(i).getPath(); if (ComparatorUtils.equals(historyPath, filename)) { return i; } @@ -261,7 +261,7 @@ public class HistoryTemplateListPane extends JPanel implements FileOperations, C * @return 是则返回TRUE */ public boolean isCurrentEditingFile(String filename) { - String editingFileName = editingTemplate.getFullPathName(); + String editingFileName = editingTemplate.getPath(); return ComparatorUtils.equals(filename, editingFileName); } diff --git a/designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java b/designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java index 0ce0917a68..5deef13df7 100644 --- a/designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java +++ b/designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java @@ -218,7 +218,7 @@ public class TemplateTreePane extends JPanel implements FileOperations { MutilTempalteTabPane.getInstance().setSelectedIndex(index - 1); } JTemplate selectedfile = MutilTempalteTabPane.getInstance().getSelectedFile(); - if (!HistoryTemplateListPane.getInstance().isCurrentEditingFile(selectedfile.getFullPathName())) { + if (!HistoryTemplateListPane.getInstance().isCurrentEditingFile(selectedfile.getPath())) { //如果此时面板上的实时刷新的selectedIndex得到的和历史的不一样 DesignerContext.getDesignerFrame().activateJTemplate(selectedfile); } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java b/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java index 6733feedfb..c683488e86 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java @@ -40,7 +40,6 @@ import com.fr.design.write.submit.DBManipulationInWidgetEventPane; import com.fr.design.write.submit.DBManipulationPane; import com.fr.file.FILE; import com.fr.file.FILEChooserPane; -import com.fr.file.FileNodeFILE; import com.fr.file.MemFILE; import com.fr.form.ui.NoneWidget; import com.fr.form.ui.Widget; @@ -50,17 +49,14 @@ import com.fr.log.FineLoggerFactory; import com.fr.report.cell.Elem; import com.fr.report.cell.cellattr.CellImage; import com.fr.stable.ArrayUtils; -import com.fr.stable.OperatingSystem; import com.fr.stable.ProductConstants; import com.fr.stable.StringUtils; import com.fr.stable.core.UUID; -import com.fr.stable.project.ProjectConstants; import javax.swing.*; import javax.swing.tree.DefaultMutableTreeNode; import javax.swing.undo.UndoManager; import java.awt.*; -import java.io.File; import java.util.ArrayList; import java.util.Arrays; import java.util.Set; @@ -202,16 +198,7 @@ public abstract class JTemplate> return -1; } - public String getFullPathName() { - /*String editingFileName = getEditingFILE().getPath(); - if (editingFileName.startsWith(ProjectConstants.REPORTLETS_NAME)) { - editingFileName = ((FileNodeFILE) getEditingFILE()).getEnvPath() + File.separator + editingFileName; - } - if (OperatingSystem.isWindows()) { - return editingFileName.replaceAll("/", "\\\\"); - } else { - return editingFileName.replaceAll("\\\\", "/"); - }*/ + public String getPath() { return getEditingFILE().getPath(); } @@ -580,7 +567,7 @@ public abstract class JTemplate> * @return */ public boolean saveAsTemplate(boolean isShowLoc, String fileName) { - String oldName = this.getFullPathName(); + String oldName = this.getPath(); // alex:如果是SaveAs的话需要让用户来选择路径了 FILEChooserPane fileChooser = getFILEChooserPane(isShowLoc); fileChooser.setFileNameTextField(fileName, this.suffix()); @@ -619,7 +606,7 @@ public abstract class JTemplate> collectInfo(); } //更换最近打开 - DesignerEnvManager.getEnvManager().replaceRecentOpenedFilePath(oldName, this.getFullPathName()); + DesignerEnvManager.getEnvManager().replaceRecentOpenedFilePath(oldName, this.getPath()); return result; } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/JVirtualTemplate.java b/designer-base/src/main/java/com/fr/design/mainframe/JVirtualTemplate.java index 25570ee941..d472cc062f 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/JVirtualTemplate.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/JVirtualTemplate.java @@ -37,7 +37,7 @@ public class JVirtualTemplate extends JTemplate { } @Override - public String getFullPathName() { + public String getPath() { String editingFileName = getEditingFILE().getPath(); if (editingFileName.startsWith(ProjectConstants.REPORTLETS_NAME)) { editingFileName = ((FileNodeFILE) getEditingFILE()).getEnvPath() + File.separator + editingFileName; @@ -258,7 +258,7 @@ public class JVirtualTemplate extends JTemplate { @Override public Icon getIcon() { - if (getFullPathName().endsWith("cpt")) { + if (getPath().endsWith("cpt")) { return BaseUtils.readIcon("/com/fr/design/images/buttonicon/newcpts.png"); } else { return BaseUtils.readIcon("/com/fr/web/images/form/new_form3.png");