Browse Source

Merge pull request #1128 in BA/design from ~VITO/design:release/9.0 to release/9.0

* commit 'e28b7a8892fd7ae4b0a4eef3343cc8b0da41e04b':
  REPORT-4097 [9.0一轮回归]Mac设计器输出文件时,路径显示问题
master
superman 7 years ago
parent
commit
d8ecba8567
  1. 2
      designer/src/com/fr/design/actions/file/export/AbstractExportAction.java
  2. 82
      designer_base/src/com/fr/file/FILEChooserPane.java

2
designer/src/com/fr/design/actions/file/export/AbstractExportAction.java

@ -72,7 +72,7 @@ public abstract class AbstractExportAction extends JWorkBookAction {
} }
// Choose a file name.... // Choose a file name....
FILEChooserPane fileChooserPane = FILEChooserPane.getInstance(false, true); FILEChooserPane fileChooserPane = FILEChooserPane.getInstance(true, true);
fileChooserPane.setFILEFilter(this.getChooseFileFilter()); fileChooserPane.setFILEFilter(this.getChooseFileFilter());
// 打开文件后输出文件名修改,eg:w.cpt.doc / w.svg.doc,去掉中间的后缀名~~ w.doc // 打开文件后输出文件名修改,eg:w.cpt.doc / w.svg.doc,去掉中间的后缀名~~ w.doc

82
designer_base/src/com/fr/file/FILEChooserPane.java

@ -1,51 +1,5 @@
package com.fr.file; package com.fr.file;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.swing.AbstractAction;
import javax.swing.AbstractListModel;
import javax.swing.ActionMap;
import javax.swing.BorderFactory;
import javax.swing.DefaultComboBoxModel;
import javax.swing.DefaultListCellRenderer;
import javax.swing.DefaultListModel;
import javax.swing.Icon;
import javax.swing.InputMap;
import javax.swing.JComponent;
import javax.swing.JFileChooser;
import javax.swing.JList;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.KeyStroke;
import javax.swing.ListCellRenderer;
import javax.swing.ListModel;
import javax.swing.ListSelectionModel;
import javax.swing.SwingConstants;
import javax.swing.SwingUtilities;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import javax.swing.filechooser.FileSystemView;
import javax.swing.plaf.basic.BasicArrowButton;
import javax.swing.plaf.basic.BasicButtonUI;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.dav.LocalEnv; import com.fr.dav.LocalEnv;
@ -70,12 +24,23 @@ import com.fr.file.filter.FILEFilter;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.GeneralContext; import com.fr.general.GeneralContext;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.stable.CoreConstants; import com.fr.stable.*;
import com.fr.stable.ProductConstants;
import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils;
import com.fr.stable.project.ProjectConstants; import com.fr.stable.project.ProjectConstants;
import javax.swing.*;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import javax.swing.filechooser.FileSystemView;
import javax.swing.plaf.basic.BasicArrowButton;
import javax.swing.plaf.basic.BasicButtonUI;
import java.awt.*;
import java.awt.event.*;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/* /*
* FileChooserPane要高亮显示某Button,以显示当前路径 * FileChooserPane要高亮显示某Button,以显示当前路径
* 边距要调整 * 边距要调整
@ -457,6 +422,7 @@ public class FILEChooserPane extends BasicPane {
/** /**
* 打开对话框 * 打开对话框
*
* @param parent 父类 * @param parent 父类
* @return 类型 * @return 类型
*/ */
@ -466,6 +432,7 @@ public class FILEChooserPane extends BasicPane {
/** /**
* 打开对话框 * 打开对话框
*
* @param parent 父类 * @param parent 父类
* @param suffix 后缀 * @param suffix 后缀
* @return 类型 * @return 类型
@ -476,6 +443,7 @@ public class FILEChooserPane extends BasicPane {
/** /**
* 打开对话框 * 打开对话框
*
* @param parent 父类 * @param parent 父类
* @return 类型 * @return 类型
*/ */
@ -485,6 +453,7 @@ public class FILEChooserPane extends BasicPane {
/** /**
* 打开对话框 * 打开对话框
*
* @param parent 父类 * @param parent 父类
* @param suffix 后缀 * @param suffix 后缀
* @return 类型 * @return 类型
@ -800,7 +769,9 @@ public class FILEChooserPane extends BasicPane {
} }
if (FILEChooserPane.this.showLoc) { if (FILEChooserPane.this.showLoc) {
// 桌面
if (OperatingSystem.isWindows()) {
// windows下展示桌面
File[] desktop = FileSystemView.getFileSystemView().getRoots(); File[] desktop = FileSystemView.getFileSystemView().getRoots();
if (desktop != null) { if (desktop != null) {
for (int i = 0; i < desktop.length; i++) { for (int i = 0; i < desktop.length; i++) {
@ -809,6 +780,9 @@ public class FILEChooserPane extends BasicPane {
} }
} }
} }
} else { // *nix下展示家目录
filesOfSystem.add(new FileFILE(FileSystemView.getFileSystemView().getDefaultDirectory()));
}
// C, D, E等盘符 // C, D, E等盘符
File[] roots = File.listRoots(); File[] roots = File.listRoots();
@ -1182,6 +1156,7 @@ public class FILEChooserPane extends BasicPane {
return; return;
} }
boolean isWebAppNamePath;
popDir = dir; popDir = dir;
this.buttonList.clear(); this.buttonList.clear();
@ -1190,12 +1165,13 @@ public class FILEChooserPane extends BasicPane {
} }
String path = dir.getPath(); String path = dir.getPath();
isWebAppNamePath = ComparatorUtils.equals(dir.prefix(), FILEFactory.WEBREPORT_PREFIX);
// 确保最后一个字符是分隔符 // 确保最后一个字符是分隔符
if (!path.endsWith("/") && !path.endsWith("\\") && !StringUtils.isBlank(path)) { if (!path.endsWith("/") && !path.endsWith("\\") && !StringUtils.isBlank(path)) {
path = path + "/"; path = path + "/";
} }
String webAppName = GeneralContext.getCurrentAppNameOfEnv(); String webAppName = GeneralContext.getCurrentAppNameOfEnv();
if (StringUtils.isBlank(path)) { if (StringUtils.isBlank(path) && isWebAppNamePath) {
this.buttonList.add(createBlankButton(new SetDirectoryAction(webAppName + '/'))); this.buttonList.add(createBlankButton(new SetDirectoryAction(webAppName + '/')));
} }
@ -1206,7 +1182,7 @@ public class FILEChooserPane extends BasicPane {
int start = matcher.start(); int start = matcher.start();
String btn_text = path.substring(node_start, start); String btn_text = path.substring(node_start, start);
String btn_path = path.substring(0, start); String btn_path = path.substring(0, start);
if (StringUtils.isBlank(btn_text)) { if (StringUtils.isBlank(btn_text) && isWebAppNamePath) {
btn_text = webAppName; btn_text = webAppName;
} }
this.buttonList.add(createBlankButton((new SetDirectoryAction(btn_text + '/', this.buttonList.add(createBlankButton((new SetDirectoryAction(btn_text + '/',

Loading…
Cancel
Save