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

44
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.SwingConstants;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import javax.swing.event.ListSelectionEvent;
@ -1545,25 +1546,34 @@ public class FILEChooserPane extends BasicPane {
String userInput = nameField.getText().trim();
currentDirectory.createFolder(userInput);
refreshSubFileListModel();
setSelectedFileName(userInput);
// ben:这里处理有些不妥,取文件时没有考虑filefilter,不过效果一样,取的时候应该用subfilelist得data
FILE[] allFiles = currentDirectory.listFiles();
int place = 0;
for (int i = 0; i < allFiles.length; i++) {
if (ComparatorUtils.equals(allFiles[i].getName(), userInput) && allFiles[i].isDirectory()) {
place = i;
break;
// 处理不合法的文件夹名称
userInput = userInput.replaceAll("[\\\\/:*?\"<>|]", StringUtils.EMPTY);
if (currentDirectory.createFolder(userInput)) {
refreshSubFileListModel();
setSelectedFileName(userInput);
// ben:这里处理有些不妥,取文件时没有考虑filefilter,不过效果一样,取的时候应该用subfilelist得data
FILE[] allFiles = currentDirectory.listFiles();
int place = 0;
for (int i = 0; i < allFiles.length; i++) {
if (ComparatorUtils.equals(allFiles[i].getName(), userInput) && allFiles[i].isDirectory()) {
place = i;
break;
}
}
scrollPane.revalidate();
scrollPane.repaint();
int total = scrollPane.getVerticalScrollBar().getMaximum();
int value = total * place / subFileList.getModel().getSize();
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);
}
scrollPane.revalidate();
scrollPane.repaint();
int total = scrollPane.getVerticalScrollBar().getMaximum();
int value = total * place / subFileList.getModel().getSize();
scrollPane.getVerticalScrollBar().setValue(value);
this.dispose();
}

Loading…
Cancel
Save