Browse Source

Merge pull request #529 in DESIGN/design from release/10.0 to 10.0

* commit 'a9fed084d005f8bb11d84ad2474ec6273141aab0':
  无JIRA任务 改一部分findbugs
  无JIRA任务 修改严重findbugs
master
ju 6 years ago
parent
commit
9dabbcc26e
  1. 11
      designer-base/src/main/java/com/fr/design/gui/itree/filetree/FileNodeComparator.java
  2. 4
      designer-base/src/main/java/com/fr/design/remote/ui/UserManagerPane.java
  3. 10
      designer-base/src/main/java/com/fr/file/FILEChooserPane.java
  4. 36
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/RecentSearchManager.java
  5. 2
      designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java

11
designer-base/src/main/java/com/fr/design/gui/itree/filetree/FileNodeComparator.java

@ -1,6 +1,6 @@
package com.fr.design.gui.itree.filetree; package com.fr.design.gui.itree.filetree;
import com.fr.file.filetree.LocalFileNodes; import com.fr.base.FRContext;
import com.fr.file.filetree.FileNode; import com.fr.file.filetree.FileNode;
import java.util.Comparator; import java.util.Comparator;
@ -59,13 +59,14 @@ public class FileNodeComparator implements Comparator<FileNode> {
private int groupByFileType(FileNode nameNode1, FileNode nameNode2, private int groupByFileType(FileNode nameNode1, FileNode nameNode2,
int i) { int i) {
if (i < LocalFileNodes.FILE_TYPE.length) { String[] supportTypes = FRContext.getFileNodes().getSupportedTypes();
if (nameNode1.isFileType(LocalFileNodes.FILE_TYPE[i])) if (i < supportTypes.length) {
if (nameNode2.isFileType(LocalFileNodes.FILE_TYPE[i])) if (nameNode1.isFileType(supportTypes[i]))
if (nameNode2.isFileType(supportTypes[i]))
return nameNode1.getName().toLowerCase().compareTo(nameNode2.getName().toLowerCase()); return nameNode1.getName().toLowerCase().compareTo(nameNode2.getName().toLowerCase());
else else
return-1; return-1;
else if (nameNode2.isFileType(LocalFileNodes.FILE_TYPE[i])) else if (nameNode2.isFileType(supportTypes[i]))
return 1; return 1;
else{ else{
return groupByFileType(nameNode1, nameNode2, i+1); return groupByFileType(nameNode1, nameNode2, i+1);

4
designer-base/src/main/java/com/fr/design/remote/ui/UserManagerPane.java

@ -58,7 +58,7 @@ public class UserManagerPane extends BasicPane {
/** /**
* 每页个数 * 每页个数
*/ */
private final int DEFAULT_NUM_EACH_PAGE = 50; private static final int DEFAULT_NUM_EACH_PAGE = 50;
/** /**
* 获取的决策平台成员 * 获取的决策平台成员
@ -171,7 +171,7 @@ public class UserManagerPane extends BasicPane {
/** /**
* 搜索关键词变更监听 * 搜索关键词变更监听
*/ */
private DocumentListener documentListener = new DocumentListener() { private transient DocumentListener documentListener = new DocumentListener() {
@Override @Override
public void insertUpdate(DocumentEvent e) { public void insertUpdate(DocumentEvent e) {
keyWord = keyField.getText(); keyWord = keyField.getText();

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

@ -23,7 +23,6 @@ import com.fr.design.mainframe.DesignerFrame;
import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.JTemplate;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.file.filetree.FileNode; import com.fr.file.filetree.FileNode;
import com.fr.file.filetree.LocalFileNodes;
import com.fr.file.filter.ChooseFileFilter; import com.fr.file.filter.ChooseFileFilter;
import com.fr.file.filter.FILEFilter; import com.fr.file.filter.FILEFilter;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
@ -693,14 +692,9 @@ public class FILEChooserPane extends BasicPane {
String appName = ProductConstants.APP_NAME; String appName = ProductConstants.APP_NAME;
JTemplate editing = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); JTemplate editing = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
if (editing == null || !editing.isChartBook()) { if (editing == null || !editing.isChartBook()) {
String[] fileSuffix_local = LocalFileNodes.FILE_TYPE;
EnumSet<FileExtension> fileExtensions = EnumSet.of(FileExtension.CPT, FileExtension.CPTX, FileExtension.FRM, FileExtension.FRMX, FileExtension.CHT);
if (type == JFileChooser.OPEN_DIALOG) { if (type == JFileChooser.OPEN_DIALOG) {
if (WorkContext.getCurrent().isLocal()) { //本地连接 this.addChooseFILEFilter(new ChooseFileFilter(FRContext.getFileNodes().getSupportedTypes(), appName + Toolkit.i18nText("Fine-Design_Report_Template_File")));
this.addChooseFILEFilter(new ChooseFileFilter(fileSuffix_local, appName + Toolkit.i18nText("Fine-Design_Report_Template_File")));
} else {
this.addChooseFILEFilter(new ChooseFileFilter(fileExtensions, appName + Toolkit.i18nText("Fine-Design_Report_Template_File")));
}
} }
// ben:filefilter设置初值为cpt过滤 // ben:filefilter设置初值为cpt过滤

36
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/RecentSearchManager.java

@ -45,9 +45,10 @@ import java.util.List;
*/ */
public class RecentSearchManager implements AlphaFineSearchProvider { public class RecentSearchManager implements AlphaFineSearchProvider {
private static final int MAX_SIZE = 100; private static final int MAX_SIZE = 100;
private static volatile RecentSearchManager instance;
IndexReader indexReader = null; private static final RecentSearchManager INSTANCE = new RecentSearchManager();
IndexSearcher indexSearcher = null;
private IndexReader indexReader = null;
//索引存储路径 //索引存储路径
private String path = ProductConstants.getEnvHome() + File.separator + "searchIndex"; private String path = ProductConstants.getEnvHome() + File.separator + "searchIndex";
//分词器,暂时先用这个 //分词器,暂时先用这个
@ -57,25 +58,18 @@ public class RecentSearchManager implements AlphaFineSearchProvider {
private IndexWriterConfig config = new IndexWriterConfig(Version.LUCENE_40, analyzer); private IndexWriterConfig config = new IndexWriterConfig(Version.LUCENE_40, analyzer);
private IndexWriter indexWriter = null; private IndexWriter indexWriter = null;
private SearchResult recentModelList; private SearchResult recentModelList;
private SearchResult modelList;
public static RecentSearchManager getInstance() { public static RecentSearchManager getInstance() {
if (instance == null) {
synchronized (RecentSearchManager.class) { return INSTANCE;
if (instance == null) {
instance = new RecentSearchManager();
instance.initWriter();
}
}
}
return instance;
} }
@Override @Override
public SearchResult getLessSearchResult(String[] searchText) { public SearchResult getLessSearchResult(String[] searchText) {
this.modelList = new SearchResult();
for (int j = 0; j < searchText.length; j++) { SearchResult modelList = new SearchResult();
recentModelList = getRecentModelList(searchText[j]); for (String aSearchText : searchText) {
recentModelList = getRecentModelList(aSearchText);
} }
if (recentModelList != null && recentModelList.size() > 0) { if (recentModelList != null && recentModelList.size() > 0) {
modelList.add(new MoreModel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_AlphaFine_Latest"))); modelList.add(new MoreModel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_AlphaFine_Latest")));
@ -93,7 +87,7 @@ public class RecentSearchManager implements AlphaFineSearchProvider {
return new SearchResult(); return new SearchResult();
} }
public synchronized SearchResult getRecentModelList(String searchText) { private synchronized SearchResult getRecentModelList(String searchText) {
return searchBySort(searchText); return searchBySort(searchText);
} }
@ -121,7 +115,6 @@ public class RecentSearchManager implements AlphaFineSearchProvider {
try { try {
indexWriter.close(); indexWriter.close();
indexReader = DirectoryReader.open(directory); indexReader = DirectoryReader.open(directory);
indexSearcher = new IndexSearcher(indexReader);
} catch (IOException e) { } catch (IOException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
@ -130,8 +123,6 @@ public class RecentSearchManager implements AlphaFineSearchProvider {
/** /**
* 添加模型 * 添加模型
* *
* @param searchKey
* @param cellModel
*/ */
public void addModel(String searchKey, AlphaCellModel cellModel) { public void addModel(String searchKey, AlphaCellModel cellModel) {
if(cellModel == null){ if(cellModel == null){
@ -151,8 +142,6 @@ public class RecentSearchManager implements AlphaFineSearchProvider {
/** /**
* 写文档建立索引 * 写文档建立索引
*
* @param doc
*/ */
private void writeDoc(Document doc) { private void writeDoc(Document doc) {
try { try {
@ -166,9 +155,6 @@ public class RecentSearchManager implements AlphaFineSearchProvider {
/** /**
* 按序搜索 * 按序搜索
*
* @param key
* @return
*/ */
private synchronized SearchResult searchBySort(String key) { private synchronized SearchResult searchBySort(String key) {
recentModelList = new SearchResult(); recentModelList = new SearchResult();

2
designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java

@ -38,7 +38,7 @@ public class DesignerSocketIO {
} }
private static Optional<Socket> socketIO = Optional.absent(); private static Optional<Socket> socketIO = Optional.absent();
public static Status status = Status.Disconnected; private static Status status = Status.Disconnected;
private static final Emitter.Listener printLog = new Emitter.Listener() { private static final Emitter.Listener printLog = new Emitter.Listener() {
@Override @Override

Loading…
Cancel
Save