Browse Source

bug 处理

research/10.0
yaoh.wu 6 years ago
parent
commit
bfc608c6b0
  1. 10
      designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java
  2. 15
      designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java
  3. 14
      designer-base/src/main/java/com/fr/file/FILEChooserPane.java

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

@ -266,14 +266,14 @@ public class TemplateTreePane extends JPanel implements FileOperations {
if (JOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), if (JOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(),
tipContent, tipContent,
UIManager.getString("OptionPane.titleText"), UIManager.getString("OptionPane.messageDialogTitle"),
YES_NO_OPTION) YES_NO_OPTION)
== JOptionPane.YES_OPTION) { == JOptionPane.YES_OPTION) {
// 删除所有选中的即可 // 删除所有选中的即可
if (!deleteNodes(Arrays.asList(treeNodes))) { if (!deleteNodes(Arrays.asList(treeNodes))) {
JOptionPane.showConfirmDialog(null, JOptionPane.showConfirmDialog(null,
Toolkit.i18nText("Fine-Design_Basic_Delete_Failure"), Toolkit.i18nText("Fine-Design_Basic_Delete_Failure"),
UIManager.getString("OptionPane.titleText"), UIManager.getString("OptionPane.messageDialogTitle"),
JOptionPane.DEFAULT_OPTION, JOptionPane.DEFAULT_OPTION,
JOptionPane.ERROR_MESSAGE); JOptionPane.ERROR_MESSAGE);
} }
@ -287,14 +287,14 @@ public class TemplateTreePane extends JPanel implements FileOperations {
if (JOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), if (JOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(),
tipContent, tipContent,
UIManager.getString("OptionPane.titleText"), UIManager.getString("OptionPane.messageDialogTitle"),
YES_NO_OPTION) YES_NO_OPTION)
== JOptionPane.YES_OPTION) { == JOptionPane.YES_OPTION) {
// 删除其他 // 删除其他
if (!deleteNodes(deletableNodes)) { if (!deleteNodes(deletableNodes)) {
JOptionPane.showConfirmDialog(null, JOptionPane.showConfirmDialog(null,
Toolkit.i18nText("Fine-Design_Basic_Delete_Failure"), Toolkit.i18nText("Fine-Design_Basic_Delete_Failure"),
UIManager.getString("OptionPane.titleText"), UIManager.getString("OptionPane.messageDialogTitle"),
JOptionPane.DEFAULT_OPTION, JOptionPane.DEFAULT_OPTION,
JOptionPane.ERROR_MESSAGE); JOptionPane.ERROR_MESSAGE);
} }
@ -406,7 +406,7 @@ public class TemplateTreePane extends JPanel implements FileOperations {
if (!lockedNodes.isEmpty()) { if (!lockedNodes.isEmpty()) {
JOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), JOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(),
Toolkit.i18nText("Fine-Design_Basic_Warn_Rename_Lock_File"), Toolkit.i18nText("Fine-Design_Basic_Warn_Rename_Lock_File"),
UIManager.getString("OptionPane.titleText"), UIManager.getString("OptionPane.messageDialogTitle"),
JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE); JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE);
return true; return true;
} }

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

@ -510,6 +510,8 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
private void confirmClose() { private void confirmClose() {
String userInput = nameField.getText().trim(); String userInput = nameField.getText().trim();
// 处理不合法的文件夹名称
userInput = userInput.replaceAll("[\\\\/:*?\"<>|]", StringUtils.EMPTY);
String path = FilenameUtils.standard(fnf.getPath()); String path = FilenameUtils.standard(fnf.getPath());
@ -527,13 +529,12 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
// 简单执行old new 替换是不可行的,例如 /abc/abc/abc/abc/ // 简单执行old new 替换是不可行的,例如 /abc/abc/abc/abc/
String newPath = parentPath + CoreConstants.SEPARATOR + userInput + suffix; String newPath = parentPath + CoreConstants.SEPARATOR + userInput + suffix;
//模版重命名
this.dispose(); this.dispose();
//模版重命名
boolean success = false; boolean success = false;
// 提醒保存文件
SaveSomeTemplatePane saveSomeTempaltePane = new SaveSomeTemplatePane(true); SaveSomeTemplatePane saveSomeTempaltePane = new SaveSomeTemplatePane(true);
// 只有一个文件未保存时 // 只有一个文件未保存时
if (HistoryTemplateListCache.getInstance().getHistoryCount() == 1) { if (HistoryTemplateListCache.getInstance().getHistoryCount() == 1) {
@ -572,6 +573,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
if (StringUtils.isEmpty(userInput)) { if (StringUtils.isEmpty(userInput)) {
confirmButton.setEnabled(false); confirmButton.setEnabled(false);
return;
} }
if (ComparatorUtils.equals(userInput, oldName)) { if (ComparatorUtils.equals(userInput, oldName)) {
@ -724,6 +726,9 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
private void confirmClose() { private void confirmClose() {
String userInput = nameField.getText().trim(); String userInput = nameField.getText().trim();
// 处理不合法的文件夹名称
userInput = userInput.replaceAll("[\\\\/:*?\"<>|]", StringUtils.EMPTY);
if (StringUtils.isEmpty(userInput)) { if (StringUtils.isEmpty(userInput)) {
return; return;
} }
@ -737,7 +742,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
if (!success) { if (!success) {
JOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), JOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(),
Toolkit.i18nText("Fine-Design_Basic_Make_Failure"), Toolkit.i18nText("Fine-Design_Basic_Make_Failure"),
UIManager.getString("OptionPane.titleText"), UIManager.getString("OptionPane.messageDialogTitle"),
JOptionPane.DEFAULT_OPTION, JOptionPane.DEFAULT_OPTION,
JOptionPane.ERROR_MESSAGE); JOptionPane.ERROR_MESSAGE);
} }

14
designer-base/src/main/java/com/fr/file/FILEChooserPane.java

@ -58,6 +58,7 @@ import javax.swing.ListModel;
import javax.swing.ListSelectionModel; import javax.swing.ListSelectionModel;
import javax.swing.SwingConstants; import javax.swing.SwingConstants;
import javax.swing.SwingUtilities; import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener; import javax.swing.event.DocumentListener;
import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionEvent;
@ -1545,10 +1546,11 @@ public class FILEChooserPane extends BasicPane {
String userInput = nameField.getText().trim(); String userInput = nameField.getText().trim();
currentDirectory.createFolder(userInput); // 处理不合法的文件夹名称
userInput = userInput.replaceAll("[\\\\/:*?\"<>|]", StringUtils.EMPTY);
if (currentDirectory.createFolder(userInput)) {
refreshSubFileListModel(); refreshSubFileListModel();
setSelectedFileName(userInput); setSelectedFileName(userInput);
// ben:这里处理有些不妥,取文件时没有考虑filefilter,不过效果一样,取的时候应该用subfilelist得data // ben:这里处理有些不妥,取文件时没有考虑filefilter,不过效果一样,取的时候应该用subfilelist得data
FILE[] allFiles = currentDirectory.listFiles(); FILE[] allFiles = currentDirectory.listFiles();
@ -1564,6 +1566,14 @@ public class FILEChooserPane extends BasicPane {
int total = scrollPane.getVerticalScrollBar().getMaximum(); int total = scrollPane.getVerticalScrollBar().getMaximum();
int value = total * place / subFileList.getModel().getSize(); int value = total * place / subFileList.getModel().getSize();
scrollPane.getVerticalScrollBar().setValue(value); scrollPane.getVerticalScrollBar().setValue(value);
} else {
JOptionPane.showConfirmDialog(FILEChooserPane.this,
Toolkit.i18nText("Fine-Design_Basic_Make_Failure"),
UIManager.getString("OptionPane.messageDialogTitle"),
JOptionPane.DEFAULT_OPTION,
JOptionPane.ERROR_MESSAGE);
}
this.dispose(); this.dispose();
} }

Loading…
Cancel
Save