|
|
@ -37,19 +37,10 @@ import com.fr.stable.CoreConstants; |
|
|
|
import com.fr.stable.StableUtils; |
|
|
|
import com.fr.stable.StableUtils; |
|
|
|
import com.fr.stable.project.ProjectConstants; |
|
|
|
import com.fr.stable.project.ProjectConstants; |
|
|
|
|
|
|
|
|
|
|
|
import javax.swing.BorderFactory; |
|
|
|
import javax.swing.*; |
|
|
|
import javax.swing.Box; |
|
|
|
|
|
|
|
import javax.swing.BoxLayout; |
|
|
|
|
|
|
|
import javax.swing.JDialog; |
|
|
|
|
|
|
|
import javax.swing.JPanel; |
|
|
|
|
|
|
|
import javax.swing.SwingConstants; |
|
|
|
|
|
|
|
import javax.swing.event.DocumentEvent; |
|
|
|
import javax.swing.event.DocumentEvent; |
|
|
|
import javax.swing.event.DocumentListener; |
|
|
|
import javax.swing.event.DocumentListener; |
|
|
|
import java.awt.BorderLayout; |
|
|
|
import java.awt.*; |
|
|
|
import java.awt.CardLayout; |
|
|
|
|
|
|
|
import java.awt.Color; |
|
|
|
|
|
|
|
import java.awt.Dimension; |
|
|
|
|
|
|
|
import java.awt.GridLayout; |
|
|
|
|
|
|
|
import java.awt.event.ActionEvent; |
|
|
|
import java.awt.event.ActionEvent; |
|
|
|
import java.awt.event.ActionListener; |
|
|
|
import java.awt.event.ActionListener; |
|
|
|
import java.awt.event.KeyAdapter; |
|
|
|
import java.awt.event.KeyAdapter; |
|
|
@ -59,19 +50,27 @@ import java.util.Map; |
|
|
|
import java.util.Set; |
|
|
|
import java.util.Set; |
|
|
|
|
|
|
|
|
|
|
|
public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarStateChangeListener, ResponseDataSourceChange { |
|
|
|
public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarStateChangeListener, ResponseDataSourceChange { |
|
|
|
|
|
|
|
|
|
|
|
private static final String FILE = "file"; |
|
|
|
private static final String FILE = "file"; |
|
|
|
|
|
|
|
|
|
|
|
private static DesignerFrameFileDealerPane THIS; |
|
|
|
private static DesignerFrameFileDealerPane THIS; |
|
|
|
|
|
|
|
|
|
|
|
private CardLayout card; |
|
|
|
private CardLayout card; |
|
|
|
|
|
|
|
|
|
|
|
private JPanel cardPane; |
|
|
|
private JPanel cardPane; |
|
|
|
|
|
|
|
|
|
|
|
private FileOperations selectedOperation; |
|
|
|
private FileOperations selectedOperation; |
|
|
|
|
|
|
|
|
|
|
|
private UIToolbar toolBar; |
|
|
|
private UIToolbar toolBar; |
|
|
|
|
|
|
|
|
|
|
|
private OpenReportAction openReportAction = new OpenReportAction(); |
|
|
|
private OpenReportAction openReportAction = new OpenReportAction(); |
|
|
|
|
|
|
|
|
|
|
|
private RefreshTreeAction refreshTreeAction = new RefreshTreeAction(); |
|
|
|
private RefreshTreeAction refreshTreeAction = new RefreshTreeAction(); |
|
|
|
|
|
|
|
|
|
|
|
private OpenFolderAction openFolderAction = new OpenFolderAction(); |
|
|
|
private OpenFolderAction openFolderAction = new OpenFolderAction(); |
|
|
|
|
|
|
|
|
|
|
|
private RenameAction renameAction = new RenameAction(); |
|
|
|
private RenameAction renameAction = new RenameAction(); |
|
|
|
|
|
|
|
|
|
|
|
private DelFileAction delFileAction = new DelFileAction(); |
|
|
|
private DelFileAction delFileAction = new DelFileAction(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -79,10 +78,12 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt |
|
|
|
* 刷新 |
|
|
|
* 刷新 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public void refresh() { |
|
|
|
public void refresh() { |
|
|
|
|
|
|
|
|
|
|
|
selectedOperation.refresh(); |
|
|
|
selectedOperation.refresh(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static final DesignerFrameFileDealerPane getInstance() { |
|
|
|
public static final DesignerFrameFileDealerPane getInstance() { |
|
|
|
|
|
|
|
|
|
|
|
if (THIS == null) { |
|
|
|
if (THIS == null) { |
|
|
|
THIS = new DesignerFrameFileDealerPane(); |
|
|
|
THIS = new DesignerFrameFileDealerPane(); |
|
|
|
} |
|
|
|
} |
|
|
@ -90,6 +91,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private DesignerFrameFileDealerPane() { |
|
|
|
private DesignerFrameFileDealerPane() { |
|
|
|
|
|
|
|
|
|
|
|
setLayout(new BorderLayout()); |
|
|
|
setLayout(new BorderLayout()); |
|
|
|
toolBar = ToolBarDef.createJToolBar(); |
|
|
|
toolBar = ToolBarDef.createJToolBar(); |
|
|
|
toolBar.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, UIConstants.TOOLBAR_BORDER_COLOR)); |
|
|
|
toolBar.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, UIConstants.TOOLBAR_BORDER_COLOR)); |
|
|
@ -116,6 +118,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public final void setCurrentEditingTemplate(JTemplate<?, ?> jt) { |
|
|
|
public final void setCurrentEditingTemplate(JTemplate<?, ?> jt) { |
|
|
|
|
|
|
|
|
|
|
|
DesignModelAdapter.setCurrentModelAdapter(jt == null ? null : jt.getModel()); |
|
|
|
DesignModelAdapter.setCurrentModelAdapter(jt == null ? null : jt.getModel()); |
|
|
|
fireDSChanged(); |
|
|
|
fireDSChanged(); |
|
|
|
TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter()); |
|
|
|
TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter()); |
|
|
@ -139,12 +142,13 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt |
|
|
|
* 刷新菜单 |
|
|
|
* 刷新菜单 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public void refreshDockingView() { |
|
|
|
public void refreshDockingView() { |
|
|
|
|
|
|
|
|
|
|
|
ToolBarDef toolbarDef = new ToolBarDef(); |
|
|
|
ToolBarDef toolbarDef = new ToolBarDef(); |
|
|
|
toolbarDef.addShortCut(openReportAction, refreshTreeAction); |
|
|
|
toolbarDef.addShortCut(openReportAction, refreshTreeAction); |
|
|
|
toolbarDef.addShortCut(openFolderAction, renameAction); |
|
|
|
toolbarDef.addShortCut(openFolderAction, renameAction); |
|
|
|
toolbarDef.addShortCut(delFileAction); |
|
|
|
toolbarDef.addShortCut(delFileAction); |
|
|
|
Set<ShortCut> extraShortCuts = ExtraDesignClassManager.getInstance().getExtraShortCuts(); |
|
|
|
Set<ShortCut> extraShortCuts = ExtraDesignClassManager.getInstance().getExtraShortCuts(); |
|
|
|
for (ShortCut shortCut : extraShortCuts){ |
|
|
|
for (ShortCut shortCut : extraShortCuts) { |
|
|
|
toolbarDef.addShortCut(shortCut); |
|
|
|
toolbarDef.addShortCut(shortCut); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -154,6 +158,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void refreshActions() { |
|
|
|
private void refreshActions() { |
|
|
|
|
|
|
|
|
|
|
|
openReportAction.setEnabled(false); |
|
|
|
openReportAction.setEnabled(false); |
|
|
|
refreshTreeAction.setEnabled(true); |
|
|
|
refreshTreeAction.setEnabled(true); |
|
|
|
openFolderAction.setEnabled(false); |
|
|
|
openFolderAction.setEnabled(false); |
|
|
@ -166,14 +171,17 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt |
|
|
|
* 响应数据集改变 |
|
|
|
* 响应数据集改变 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public void fireDSChanged() { |
|
|
|
public void fireDSChanged() { |
|
|
|
|
|
|
|
|
|
|
|
fireDSChanged(new HashMap<String, String>()); |
|
|
|
fireDSChanged(new HashMap<String, String>()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 响应数据集改变 |
|
|
|
* 响应数据集改变 |
|
|
|
|
|
|
|
* |
|
|
|
* @param map 改变名字的数据集 |
|
|
|
* @param map 改变名字的数据集 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public void fireDSChanged(Map<String, String> map) { |
|
|
|
public void fireDSChanged(Map<String, String> map) { |
|
|
|
|
|
|
|
|
|
|
|
DesignTableDataManager.fireDSChanged(map); |
|
|
|
DesignTableDataManager.fireDSChanged(map); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -184,12 +192,14 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt |
|
|
|
private class OpenReportAction extends UpdateAction { |
|
|
|
private class OpenReportAction extends UpdateAction { |
|
|
|
|
|
|
|
|
|
|
|
public OpenReportAction() { |
|
|
|
public OpenReportAction() { |
|
|
|
|
|
|
|
|
|
|
|
this.setName(KeySetUtils.OPEN_TEMPLATE.getMenuKeySetName()); |
|
|
|
this.setName(KeySetUtils.OPEN_TEMPLATE.getMenuKeySetName()); |
|
|
|
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/buttonicon/open.png")); |
|
|
|
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/buttonicon/open.png")); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void actionPerformed(ActionEvent evt) { |
|
|
|
public void actionPerformed(ActionEvent evt) { |
|
|
|
|
|
|
|
|
|
|
|
selectedOperation.openSelectedReport(); |
|
|
|
selectedOperation.openSelectedReport(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -198,12 +208,14 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt |
|
|
|
private class OpenFolderAction extends UpdateAction { |
|
|
|
private class OpenFolderAction extends UpdateAction { |
|
|
|
|
|
|
|
|
|
|
|
public OpenFolderAction() { |
|
|
|
public OpenFolderAction() { |
|
|
|
|
|
|
|
|
|
|
|
this.setName(Inter.getLocText("FR-Designer_Show_in_Containing_Folder")); |
|
|
|
this.setName(Inter.getLocText("FR-Designer_Show_in_Containing_Folder")); |
|
|
|
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_file/view_folder.png")); |
|
|
|
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_file/view_folder.png")); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void actionPerformed(ActionEvent evt) { |
|
|
|
public void actionPerformed(ActionEvent evt) { |
|
|
|
|
|
|
|
|
|
|
|
selectedOperation.openContainerFolder(); |
|
|
|
selectedOperation.openContainerFolder(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -214,12 +226,14 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt |
|
|
|
private class RefreshTreeAction extends UpdateAction { |
|
|
|
private class RefreshTreeAction extends UpdateAction { |
|
|
|
|
|
|
|
|
|
|
|
public RefreshTreeAction() { |
|
|
|
public RefreshTreeAction() { |
|
|
|
|
|
|
|
|
|
|
|
this.setName(Inter.getLocText("FR-Designer_Refresh")); |
|
|
|
this.setName(Inter.getLocText("FR-Designer_Refresh")); |
|
|
|
this.setSmallIcon(UIConstants.REFRESH_ICON); |
|
|
|
this.setSmallIcon(UIConstants.REFRESH_ICON); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void actionPerformed(ActionEvent evt) { |
|
|
|
public void actionPerformed(ActionEvent evt) { |
|
|
|
|
|
|
|
|
|
|
|
selectedOperation.refresh(); |
|
|
|
selectedOperation.refresh(); |
|
|
|
stateChange(); |
|
|
|
stateChange(); |
|
|
|
} |
|
|
|
} |
|
|
@ -231,12 +245,14 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt |
|
|
|
private class RenameAction extends UpdateAction { |
|
|
|
private class RenameAction extends UpdateAction { |
|
|
|
|
|
|
|
|
|
|
|
public RenameAction() { |
|
|
|
public RenameAction() { |
|
|
|
|
|
|
|
|
|
|
|
this.setName(Inter.getLocText("FR-Designer_Rename")); |
|
|
|
this.setName(Inter.getLocText("FR-Designer_Rename")); |
|
|
|
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/data/source/rename.png")); |
|
|
|
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/data/source/rename.png")); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void actionPerformed(ActionEvent evt) { |
|
|
|
public void actionPerformed(ActionEvent evt) { |
|
|
|
|
|
|
|
|
|
|
|
new RenameDialog(); |
|
|
|
new RenameDialog(); |
|
|
|
MutilTempalteTabPane.getInstance().repaint(); |
|
|
|
MutilTempalteTabPane.getInstance().repaint(); |
|
|
|
} |
|
|
|
} |
|
|
@ -249,12 +265,14 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt |
|
|
|
private class DelFileAction extends UpdateAction { |
|
|
|
private class DelFileAction extends UpdateAction { |
|
|
|
|
|
|
|
|
|
|
|
public DelFileAction() { |
|
|
|
public DelFileAction() { |
|
|
|
|
|
|
|
|
|
|
|
this.setName(Inter.getLocText("FR-Designer_Remove")); |
|
|
|
this.setName(Inter.getLocText("FR-Designer_Remove")); |
|
|
|
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/data/source/delete.png")); |
|
|
|
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/data/source/delete.png")); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void actionPerformed(ActionEvent evt) { |
|
|
|
public void actionPerformed(ActionEvent evt) { |
|
|
|
|
|
|
|
|
|
|
|
selectedOperation.deleteFile(); |
|
|
|
selectedOperation.deleteFile(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -264,9 +282,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void stateChange() { |
|
|
|
public void stateChange() { |
|
|
|
//当前环境为远程环境时
|
|
|
|
|
|
|
|
if (FRContext.getCommonOperator() != null) { |
|
|
|
|
|
|
|
//当前环境为本地环境时
|
|
|
|
|
|
|
|
if (selectedOperation.getSelectedTemplatePath() != null) { |
|
|
|
if (selectedOperation.getSelectedTemplatePath() != null) { |
|
|
|
openReportAction.setEnabled(true); |
|
|
|
openReportAction.setEnabled(true); |
|
|
|
renameAction.setEnabled(true); |
|
|
|
renameAction.setEnabled(true); |
|
|
@ -277,7 +293,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt |
|
|
|
delFileAction.setEnabled(false); |
|
|
|
delFileAction.setEnabled(false); |
|
|
|
} |
|
|
|
} |
|
|
|
openFolderAction.setEnabled(containsFolderNums() + seletedTemplateNums() != 0); |
|
|
|
openFolderAction.setEnabled(containsFolderNums() + seletedTemplateNums() != 0); |
|
|
|
} |
|
|
|
|
|
|
|
refreshTreeAction.setEnabled(true); |
|
|
|
refreshTreeAction.setEnabled(true); |
|
|
|
if (containsFolderNums() > 0 && (containsFolderNums() + seletedTemplateNums() > 1)) { |
|
|
|
if (containsFolderNums() > 0 && (containsFolderNums() + seletedTemplateNums() > 1)) { |
|
|
|
refreshActions(); |
|
|
|
refreshActions(); |
|
|
@ -298,6 +314,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
|
|
private int containsFolderNums() { |
|
|
|
private int containsFolderNums() { |
|
|
|
|
|
|
|
|
|
|
|
TemplateFileTree fileTree = TemplateTreePane.getInstance().getTemplateFileTree(); |
|
|
|
TemplateFileTree fileTree = TemplateTreePane.getInstance().getTemplateFileTree(); |
|
|
|
if (fileTree.getSelectionPaths() == null) { |
|
|
|
if (fileTree.getSelectionPaths() == null) { |
|
|
|
return 0; |
|
|
|
return 0; |
|
|
@ -317,6 +334,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt |
|
|
|
* @return |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private int seletedTemplateNums() { |
|
|
|
private int seletedTemplateNums() { |
|
|
|
|
|
|
|
|
|
|
|
TemplateFileTree fileTree = TemplateTreePane.getInstance().getTemplateFileTree(); |
|
|
|
TemplateFileTree fileTree = TemplateTreePane.getInstance().getTemplateFileTree(); |
|
|
|
if (fileTree.getSelectionPaths() == null) { |
|
|
|
if (fileTree.getSelectionPaths() == null) { |
|
|
|
return 0; |
|
|
|
return 0; |
|
|
@ -330,14 +348,21 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt |
|
|
|
private class RenameDialog { |
|
|
|
private class RenameDialog { |
|
|
|
|
|
|
|
|
|
|
|
private UITextField jt; |
|
|
|
private UITextField jt; |
|
|
|
|
|
|
|
|
|
|
|
private String userInput; |
|
|
|
private String userInput; |
|
|
|
|
|
|
|
|
|
|
|
private String oldName; |
|
|
|
private String oldName; |
|
|
|
|
|
|
|
|
|
|
|
private UILabel hintsLabel; |
|
|
|
private UILabel hintsLabel; |
|
|
|
|
|
|
|
|
|
|
|
private UIButton confirmButton; |
|
|
|
private UIButton confirmButton; |
|
|
|
|
|
|
|
|
|
|
|
private JDialog jd; |
|
|
|
private JDialog jd; |
|
|
|
|
|
|
|
|
|
|
|
private String suffix; |
|
|
|
private String suffix; |
|
|
|
|
|
|
|
|
|
|
|
public RenameDialog() { |
|
|
|
public RenameDialog() { |
|
|
|
|
|
|
|
|
|
|
|
final String reportPath = selectedOperation.getSelectedTemplatePath(); |
|
|
|
final String reportPath = selectedOperation.getSelectedTemplatePath(); |
|
|
|
if (reportPath == null) { |
|
|
|
if (reportPath == null) { |
|
|
|
return; |
|
|
|
return; |
|
|
@ -391,7 +416,9 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt |
|
|
|
confirmButton.setMinimumSize(new Dimension(80, 25)); |
|
|
|
confirmButton.setMinimumSize(new Dimension(80, 25)); |
|
|
|
confirmButton.setMaximumSize(new Dimension(80, 25)); |
|
|
|
confirmButton.setMaximumSize(new Dimension(80, 25)); |
|
|
|
confirmButton.addActionListener(new ActionListener() { |
|
|
|
confirmButton.addActionListener(new ActionListener() { |
|
|
|
|
|
|
|
|
|
|
|
public void actionPerformed(ActionEvent e) { |
|
|
|
public void actionPerformed(ActionEvent e) { |
|
|
|
|
|
|
|
|
|
|
|
confirmClose(nodeFile, path); |
|
|
|
confirmClose(nodeFile, path); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
@ -402,7 +429,9 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt |
|
|
|
cancelButton.setMaximumSize(new Dimension(80, 25)); |
|
|
|
cancelButton.setMaximumSize(new Dimension(80, 25)); |
|
|
|
|
|
|
|
|
|
|
|
cancelButton.addActionListener(new ActionListener() { |
|
|
|
cancelButton.addActionListener(new ActionListener() { |
|
|
|
|
|
|
|
|
|
|
|
public void actionPerformed(ActionEvent e) { |
|
|
|
public void actionPerformed(ActionEvent e) { |
|
|
|
|
|
|
|
|
|
|
|
jd.dispose(); |
|
|
|
jd.dispose(); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
@ -432,6 +461,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void confirmClose(FileNodeFILE nodeFile, String path) { |
|
|
|
public void confirmClose(FileNodeFILE nodeFile, String path) { |
|
|
|
|
|
|
|
|
|
|
|
userInput = userInput == null ? oldName : userInput; |
|
|
|
userInput = userInput == null ? oldName : userInput; |
|
|
|
String oldPath = path.replaceAll("/", "\\\\"); |
|
|
|
String oldPath = path.replaceAll("/", "\\\\"); |
|
|
|
String newPath = path.replace(nodeFile.getName(), userInput + suffix); |
|
|
|
String newPath = path.replace(nodeFile.getName(), userInput + suffix); |
|
|
@ -446,6 +476,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void renameTemplateInMemory(FILE tplFile, String newName, String oldName) { |
|
|
|
private void renameTemplateInMemory(FILE tplFile, String newName, String oldName) { |
|
|
|
|
|
|
|
|
|
|
|
JTemplate<?, ?> dPane = getSpecialTemplateByFILE(tplFile); |
|
|
|
JTemplate<?, ?> dPane = getSpecialTemplateByFILE(tplFile); |
|
|
|
if (dPane == null) { |
|
|
|
if (dPane == null) { |
|
|
|
return; |
|
|
|
return; |
|
|
@ -458,7 +489,9 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt |
|
|
|
public void addUITextFieldListener(final FileNodeFILE nodeFile, final String path) { |
|
|
|
public void addUITextFieldListener(final FileNodeFILE nodeFile, final String path) { |
|
|
|
|
|
|
|
|
|
|
|
jt.addKeyListener(new KeyAdapter() { |
|
|
|
jt.addKeyListener(new KeyAdapter() { |
|
|
|
|
|
|
|
|
|
|
|
public void keyPressed(KeyEvent e) { |
|
|
|
public void keyPressed(KeyEvent e) { |
|
|
|
|
|
|
|
|
|
|
|
if (e.getKeyCode() == KeyEvent.VK_ESCAPE) { |
|
|
|
if (e.getKeyCode() == KeyEvent.VK_ESCAPE) { |
|
|
|
jd.dispose(); |
|
|
|
jd.dispose(); |
|
|
|
} |
|
|
|
} |
|
|
@ -466,7 +499,9 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
jt.addKeyListener(new KeyAdapter() { |
|
|
|
jt.addKeyListener(new KeyAdapter() { |
|
|
|
|
|
|
|
|
|
|
|
public void keyPressed(KeyEvent e) { |
|
|
|
public void keyPressed(KeyEvent e) { |
|
|
|
|
|
|
|
|
|
|
|
if (e.getKeyCode() == KeyEvent.VK_ENTER) { |
|
|
|
if (e.getKeyCode() == KeyEvent.VK_ENTER) { |
|
|
|
if (confirmButton.isEnabled()) { |
|
|
|
if (confirmButton.isEnabled()) { |
|
|
|
confirmClose(nodeFile, path); |
|
|
|
confirmClose(nodeFile, path); |
|
|
@ -479,17 +514,21 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt |
|
|
|
|
|
|
|
|
|
|
|
// UITextField的输入监听
|
|
|
|
// UITextField的输入监听
|
|
|
|
public DocumentListener getdoDocumentListener() { |
|
|
|
public DocumentListener getdoDocumentListener() { |
|
|
|
|
|
|
|
|
|
|
|
DocumentListener dl = new DocumentListener() { |
|
|
|
DocumentListener dl = new DocumentListener() { |
|
|
|
|
|
|
|
|
|
|
|
public void changedUpdate(DocumentEvent e) { |
|
|
|
public void changedUpdate(DocumentEvent e) { |
|
|
|
|
|
|
|
|
|
|
|
isNameAlreadyExist(); |
|
|
|
isNameAlreadyExist(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void insertUpdate(DocumentEvent e) { |
|
|
|
public void insertUpdate(DocumentEvent e) { |
|
|
|
|
|
|
|
|
|
|
|
isNameAlreadyExist(); |
|
|
|
isNameAlreadyExist(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void removeUpdate(DocumentEvent e) { |
|
|
|
public void removeUpdate(DocumentEvent e) { |
|
|
|
|
|
|
|
|
|
|
|
isNameAlreadyExist(); |
|
|
|
isNameAlreadyExist(); |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
@ -498,6 +537,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void isNameAlreadyExist() { |
|
|
|
private void isNameAlreadyExist() { |
|
|
|
|
|
|
|
|
|
|
|
userInput = jt.getText().trim(); |
|
|
|
userInput = jt.getText().trim(); |
|
|
|
if (selectedOperation.isNameAlreadyExist(userInput, oldName, suffix)) { |
|
|
|
if (selectedOperation.isNameAlreadyExist(userInput, oldName, suffix)) { |
|
|
|
jt.selectAll(); |
|
|
|
jt.selectAll(); |
|
|
@ -517,6 +557,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt |
|
|
|
* @return 内存中的template重命名一下 |
|
|
|
* @return 内存中的template重命名一下 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private JTemplate<?, ?> getSpecialTemplateByFILE(FILE tplFile) { |
|
|
|
private JTemplate<?, ?> getSpecialTemplateByFILE(FILE tplFile) { |
|
|
|
|
|
|
|
|
|
|
|
HistoryTemplateListPane historyHandle = HistoryTemplateListPane.getInstance(); |
|
|
|
HistoryTemplateListPane historyHandle = HistoryTemplateListPane.getInstance(); |
|
|
|
if (ComparatorUtils.equals(historyHandle.getCurrentEditingTemplate().getEditingFILE(), tplFile)) { |
|
|
|
if (ComparatorUtils.equals(historyHandle.getCurrentEditingTemplate().getEditingFILE(), tplFile)) { |
|
|
|
return historyHandle.getCurrentEditingTemplate(); |
|
|
|
return historyHandle.getCurrentEditingTemplate(); |
|
|
|