Browse Source

Merge pull request #895 in BA/design from ~XIAOXIA/design:9.0 to 9.0

* commit '016396ce78c6b1765dce56fcdac3f6855cf45b5c':
  rt
  代码质量
  rt
  rt
  RT
  rt
master
superman 8 years ago
parent
commit
806732465b
  1. 2
      designer/src/com/fr/design/mainframe/alphafine/AlphaFineHelper.java
  2. 6
      designer/src/com/fr/design/mainframe/alphafine/cell/model/FileModel.java
  3. 13
      designer/src/com/fr/design/mainframe/alphafine/search/manager/FileSearchManager.java
  4. 6
      designer/src/com/fr/design/mainframe/alphafine/search/manager/RecentSearchManager.java

2
designer/src/com/fr/design/mainframe/alphafine/AlphaFineHelper.java

@ -34,7 +34,7 @@ public class AlphaFineHelper {
*/
private static String getSplitText(String text, int index) {
if (StringUtils.isNotBlank(text)) {
String[] textArray = text.split("/");
String[] textArray = text.replaceAll("\\\\", "/").split("/");
if (textArray != null && textArray.length > 1) {
return textArray[textArray.length - index];
}

6
designer/src/com/fr/design/mainframe/alphafine/cell/model/FileModel.java

@ -16,10 +16,10 @@ public class FileModel extends AlphaCellModel{
super(name, content, type);
}
public FileModel(String name, String content, String filePath) {
super(name, content, CellType.FILE);
public FileModel(String name, String filePath) {
super(name, null, CellType.FILE);
this.filePath = filePath;
setDescription(AlphaFineHelper.findFolderName(content));
setDescription(AlphaFineHelper.findFolderName(filePath));
}
public String getFilePath() {

13
designer/src/com/fr/design/mainframe/alphafine/search/manager/FileSearchManager.java

@ -87,15 +87,15 @@ public class FileSearchManager implements AlphaFineSearchProcessor {
BufferedReader reader = new BufferedReader(new FileReader(filePath));
String line;
int columnNumber;
boolean test = false;
boolean isFoundInContent = false;
while ((line = reader.readLine()) != null) {
columnNumber = line.toLowerCase().indexOf(searchText);
if (columnNumber != -1) {
test = true;
isFoundInContent = true;
}
}
if (test && !isAlreadyContain) {
FileModel model = new FileModel(node.getName(), node.getEnvPath().substring(ProjectConstants.REPORTLETS_NAME.length()), node.getEnvPath());
if (isFoundInContent && !isAlreadyContain) {
FileModel model = new FileModel(node.getName(), node.getEnvPath());
this.filterModelList.add(model);
}
reader.close();
@ -117,7 +117,7 @@ public class FileSearchManager implements AlphaFineSearchProcessor {
private boolean searchFile(String searchText, FileNode node, boolean isAlreadyContain) {
if (DesignerEnvManager.getEnvManager().getAlphafineConfigManager().isContainTemplate()) {
if (node.getName().toLowerCase().contains(searchText.toLowerCase())) {
FileModel model = new FileModel(node.getName(), node.getEnvPath().substring(node.getName().length(), node.getEnvPath().length()),node.getEnvPath());
FileModel model = new FileModel(node.getName(), node.getEnvPath());
this.filterModelList.add(model);
isAlreadyContain = true;
}
@ -178,8 +178,7 @@ public class FileSearchManager implements AlphaFineSearchProcessor {
*/
public static FileModel getModelFromCloud(String filePath) {
String name = AlphaFineHelper.findFileName(filePath);
String content = AlphaFineHelper.findFolderName(filePath);
return new FileModel(name, content, filePath);
return new FileModel(name, filePath);
}
}

6
designer/src/com/fr/design/mainframe/alphafine/search/manager/RecentSearchManager.java

@ -35,6 +35,7 @@ import java.util.Map;
public class RecentSearchManager extends XMLFileManager implements AlphaFineSearchProcessor {
private static final String XML_TAG = "AlphafineRecent";
private static final int MAX_SIZE = 3;
private static RecentSearchManager recentSearchManager = null;
private static File recentFile = null;
private List<String> fileList;
@ -248,8 +249,9 @@ public class RecentSearchManager extends XMLFileManager implements AlphaFineSear
for (String key : recentKVModelMap.keySet()) {
if (ComparatorUtils.equals(key, searchText)) {
recentModelList = recentKVModelMap.get(searchText);
if (recentModelList.size() > 3) {
return recentModelList.subList(0, 2);
int size = recentModelList.size();
if (size > MAX_SIZE) {
return recentModelList.subList(size - MAX_SIZE, size);
}
return recentModelList;
}

Loading…
Cancel
Save