Browse Source

Merge branch 'release/10.0' of ssh://cloud.finedevelop.com:7999/~hzzz/design61 into release/10.0

master
hzzz 7 years ago
parent
commit
7e5c6599a5
  1. 1
      designer-base/src/main/java/com/fr/file/FileNodeFILE.java
  2. 14
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/ActionSearchManager.java
  3. 17
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/DocumentSearchManager.java
  4. 22
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/FileSearchManager.java
  5. 18
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/PluginSearchManager.java
  6. 48
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/RecentSearchManager.java
  7. 16
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/RecommendSearchManager.java
  8. 10
      designer-realize/src/main/java/com/fr/start/fx/FastGifImage.java
  9. 7
      designer-realize/src/main/java/com/fr/start/fx/SplashFxWindow.java

1
designer-base/src/main/java/com/fr/file/FileNodeFILE.java

@ -198,7 +198,6 @@ public class FileNodeFILE implements FILE {
return FRContext.getFileNodes().listWebRootFile(rootFilePath);
} else {
return FRContext.getFileNodes().list(rootFilePath);
}
} catch (Exception e) {
FRContext.getLogger().error(e.getMessage(), e);

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

@ -22,16 +22,20 @@ import java.util.List;
* Created by XiaXiang on 2017/3/27.
*/
public class ActionSearchManager implements AlphaFineSearchProvider {
private static ActionSearchManager actionSearchManager = null;
private static ActionSearchManager instance;
private SearchResult filterModelList;
private SearchResult lessModelList;
private SearchResult moreModelList;
public synchronized static ActionSearchManager getInstance() {
if (actionSearchManager == null) {
actionSearchManager = new ActionSearchManager();
public static ActionSearchManager getInstance() {
if (instance == null) {
synchronized (ActionSearchManager.class) {
if (instance == null) {
instance = new ActionSearchManager();
}
}
}
return actionSearchManager;
return instance;
}
/**

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

@ -8,28 +8,31 @@ import com.fr.design.mainframe.alphafine.cell.model.DocumentModel;
import com.fr.design.mainframe.alphafine.cell.model.MoreModel;
import com.fr.design.mainframe.alphafine.model.SearchResult;
import com.fr.design.mainframe.alphafine.search.manager.fun.AlphaFineSearchProvider;
import com.fr.log.FineLoggerFactory;
import com.fr.general.Inter;
import com.fr.general.http.HttpClient;
import com.fr.json.JSONArray;
import com.fr.json.JSONException;
import com.fr.json.JSONObject;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils;
/**
* Created by XiaXiang on 2017/3/27.
*/
public class DocumentSearchManager implements AlphaFineSearchProvider {
private static DocumentSearchManager documentSearchManager = null;
private static DocumentSearchManager instance;
private SearchResult lessModelList;
private SearchResult moreModelList;
public synchronized static DocumentSearchManager getInstance() {
if (documentSearchManager == null) {
documentSearchManager = new DocumentSearchManager();
public static DocumentSearchManager getInstance() {
if (instance == null) {
synchronized (DocumentSearchManager.class) {
if (instance == null) {
instance = new DocumentSearchManager();
}
}
}
return documentSearchManager;
return instance;
}
/**

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

@ -35,7 +35,7 @@ public class FileSearchManager implements AlphaFineSearchProvider {
private static final String DS_NAME = "dsname=\"";
private static final String FRM_PREFIX = "k:frm ";
private static final String CPT_PREFIX = "k:cpt ";
private static FileSearchManager fileSearchManager = null;
private static FileSearchManager instance;
private SearchResult filterModelList;
private SearchResult lessModelList;
private SearchResult moreModelList;
@ -47,15 +47,19 @@ public class FileSearchManager implements AlphaFineSearchProvider {
private boolean isContainCpt = true;
private boolean isContainFrm = true;
public synchronized static FileSearchManager getInstance() {
init();
return fileSearchManager;
public static FileSearchManager getInstance() {
if (instance == null) {
synchronized (FileSearchManager.class) {
if (instance == null) {
instance = new FileSearchManager();
}
}
}
return instance;
}
public synchronized static void init() {
if (fileSearchManager == null) {
fileSearchManager = new FileSearchManager();
}
}
/**
@ -114,7 +118,7 @@ public class FileSearchManager implements AlphaFineSearchProvider {
moreModelList.addAll(filterModelList.subList(AlphaFineConstants.SHOW_SIZE, filterModelList.size()));
return moreModelList;
}
private void doSearch(String searchText, boolean needMore) {
for (FileNode node : fileNodes) {
boolean isAlreadyContain = false;
@ -230,7 +234,7 @@ public class FileSearchManager implements AlphaFineSearchProvider {
* @throws Exception
*/
private void listAll(String rootFilePath, List<FileNode> nodeList, boolean recurse) throws Exception {
FileNode[] fns = FRContext.getFileNodes().list(rootFilePath);
for (int i = 0; i < fns.length; i++) {
FileNode fileNode = fns[i];

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

@ -9,12 +9,12 @@ import com.fr.design.mainframe.alphafine.cell.model.PluginModel;
import com.fr.design.mainframe.alphafine.model.SearchResult;
import com.fr.design.mainframe.alphafine.search.manager.fun.AlphaFineSearchProvider;
import com.fr.general.ComparatorUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.general.Inter;
import com.fr.general.http.HttpClient;
import com.fr.json.JSONArray;
import com.fr.json.JSONException;
import com.fr.json.JSONObject;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.basic.version.Version;
import com.fr.plugin.basic.version.VersionIntervalFactory;
import com.fr.stable.StringUtils;
@ -26,20 +26,24 @@ import java.net.URLEncoder;
* Created by XiaXiang on 2017/3/27.
*/
public class PluginSearchManager implements AlphaFineSearchProvider {
private static PluginSearchManager pluginSearchManager = null;
private static PluginSearchManager instance;
private SearchResult lessModelList;
private SearchResult moreModelList;
public synchronized static PluginSearchManager getInstance() {
if (pluginSearchManager == null) {
pluginSearchManager = new PluginSearchManager();
public static PluginSearchManager getInstance() {
if (instance == null) {
synchronized (PluginSearchManager.class) {
if (instance == null) {
instance = new PluginSearchManager();
}
}
}
return pluginSearchManager;
return instance;
}
private static boolean isCompatibleCurrentEnv(String envVersion){
private static boolean isCompatibleCurrentEnv(String envVersion) {
return VersionIntervalFactory.create(envVersion).contain(Version.currentEnvVersion());
}

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

@ -45,7 +45,7 @@ import java.util.List;
*/
public class RecentSearchManager implements AlphaFineSearchProvider {
private static final int MAX_SIZE = 3;
private static RecentSearchManager recentSearchManager = null;
private static RecentSearchManager instance;
IndexReader indexReader = null;
IndexSearcher indexSearcher = null;
//索引存储路径
@ -59,11 +59,16 @@ public class RecentSearchManager implements AlphaFineSearchProvider {
private SearchResult recentModelList;
private SearchResult modelList;
public synchronized static RecentSearchManager getInstance() {
if (recentSearchManager == null) {
recentSearchManager = new RecentSearchManager();
public static RecentSearchManager getInstance() {
if (instance == null) {
synchronized (RecentSearchManager.class) {
if (instance == null) {
instance = new RecentSearchManager();
instance.initWriter();
}
}
}
return recentSearchManager;
return instance;
}
@Override
@ -94,17 +99,11 @@ public class RecentSearchManager implements AlphaFineSearchProvider {
* 初始化indexWriter
*/
private void initWriter() {
if (indexWriter == null) {
try {
directory = FSDirectory.open(new File(path));
} catch (IOException e) {
FineLoggerFactory.getLogger().error("cannot open directory " + path);
}
try {
indexWriter = new IndexWriter(directory, config);
} catch (IOException e) {
FineLoggerFactory.getLogger().error("not privilege to write to" + path);
}
try {
directory = FSDirectory.open(new File(path));
indexWriter = new IndexWriter(directory, config);
} catch (IOException e) {
FineLoggerFactory.getLogger().error(e.getMessage());
}
}
@ -113,20 +112,18 @@ public class RecentSearchManager implements AlphaFineSearchProvider {
* 初始化indexReader
*/
private void initReader() {
if (indexReader == null) {
try {
directory = FSDirectory.open(new File(path));
indexReader = DirectoryReader.open(directory);
} catch (IOException e) {
FineLoggerFactory.getLogger().error("not privilege to read " + path);
}
try {
indexWriter.close();
indexReader = DirectoryReader.open(directory);
indexSearcher = new IndexSearcher(indexReader);
} catch (IOException e) {
FineLoggerFactory.getLogger().error(e.getMessage());
}
}
/**
* 添加模型
*
* @param searchKey
* @param cellModel
* @param searchCount
@ -146,6 +143,7 @@ public class RecentSearchManager implements AlphaFineSearchProvider {
/**
* 写文档建立索引
*
* @param doc
*/
private void writeDoc(Document doc) {
@ -160,12 +158,14 @@ public class RecentSearchManager implements AlphaFineSearchProvider {
/**
* 按序搜索
*
* @param key
* @return
*/
private synchronized SearchResult searchBySort(String key) {
recentModelList = new SearchResult();
try {
initReader();
IndexSearcher searcher = new IndexSearcher(indexReader);
//构建排序字段

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

@ -10,12 +10,12 @@ import com.fr.design.mainframe.alphafine.cell.model.AlphaCellModel;
import com.fr.design.mainframe.alphafine.cell.model.MoreModel;
import com.fr.design.mainframe.alphafine.model.SearchResult;
import com.fr.design.mainframe.alphafine.search.manager.fun.AlphaFineSearchProvider;
import com.fr.log.FineLoggerFactory;
import com.fr.general.Inter;
import com.fr.general.http.HttpClient;
import com.fr.json.JSONArray;
import com.fr.json.JSONException;
import com.fr.json.JSONObject;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.CodeUtils;
import com.fr.stable.StringUtils;
@ -26,15 +26,19 @@ import java.util.List;
* Created by XiaXiang on 2017/3/31.
*/
public class RecommendSearchManager implements AlphaFineSearchProvider {
private static RecommendSearchManager recommendSearchManager = null;
private static RecommendSearchManager instance;
private SearchResult modelList;
private SearchResult recommendModelList;
public synchronized static RecommendSearchManager getInstance() {
if (recommendSearchManager == null) {
recommendSearchManager = new RecommendSearchManager();
public static RecommendSearchManager getInstance() {
if (instance == null) {
synchronized (RecentSearchManager.class) {
if (instance == null) {
instance = new RecommendSearchManager();
}
}
}
return recommendSearchManager;
return instance;
}
@Override

10
designer-realize/src/main/java/com/fr/start/fx/FastGifImage.java

@ -114,7 +114,7 @@ public class FastGifImage extends WritableImage {
private static final class Animation {
final WeakReference<FastGifImage> imageRef;
final Timeline timeline;
final ImageLoader loader;
private ImageLoader loader;
public Animation(final FastGifImage image, final ImageLoader loader) {
this.loader = loader;
@ -141,6 +141,7 @@ public class FastGifImage extends WritableImage {
public void stop() {
timeline.stop();
loader = null;
}
private void updateImage(final int frameIndex) {
@ -197,4 +198,11 @@ public class FastGifImage extends WritableImage {
finishImage(new PrismImageLoader2(url, gifCount, (int) getRequestedWidth(), (int) getRequestedHeight(), isPreserveRatio(), isSmooth()));
}
/**
* 销毁gif动画
*/
public void destroy() {
animation.stop();
}
}

7
designer-realize/src/main/java/com/fr/start/fx/SplashFxWindow.java

@ -9,7 +9,6 @@ import javafx.application.Application;
import javafx.application.Platform;
import javafx.geometry.Rectangle2D;
import javafx.scene.Scene;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.layout.AnchorPane;
import javafx.scene.paint.Color;
@ -51,6 +50,7 @@ public class SplashFxWindow extends Application {
private Text moduleInfo;
private Text thanks;
private FastGifImage image;
private List<SplashFxActionListener> listeners = new ArrayList<SplashFxActionListener>();
private static int uiScale(int i) {
@ -84,7 +84,7 @@ public class SplashFxWindow extends Application {
public void start(Stage primaryStage) {
AnchorPane root = new AnchorPane();
primaryStage.initStyle(StageStyle.TRANSPARENT);
Image image = new FastGifImage(SplashContext.SPLASH_PATH, FRAME_COUNT, WINDOW_WIDTH, WINDOW_HEIGHT);
image = new FastGifImage(SplashContext.SPLASH_PATH, FRAME_COUNT, WINDOW_WIDTH, WINDOW_HEIGHT);
ImageView gif = new ImageView(image);
@ -129,6 +129,7 @@ public class SplashFxWindow extends Application {
public void run() {
try {
((Stage) moduleInfo.getScene().getWindow()).close();
image.destroy();
fireSplashClose();
} catch (Exception e) {
FRContext.getLogger().error(e.getMessage(), e);
@ -181,8 +182,10 @@ public class SplashFxWindow extends Application {
});
}
/**
* 添加一个动画状态监听
*
* @param listener
*/
public void addSplashActionListener(SplashFxActionListener listener) {

Loading…
Cancel
Save