Browse Source

Merge branch 'release/10.0' of http://cloud.finedevelop.com:2015/scm/~mata.li/designrel into release/10.0

final/10.0
Mata.Li 6 years ago
parent
commit
926384e7f0
  1. 87
      designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java
  2. 7
      designer-base/src/main/java/com/fr/design/gui/controlpane/shortcutfactory/OldShortCutFactory.java
  3. 7
      designer-base/src/main/java/com/fr/design/gui/controlpane/shortcutfactory/ShortCutFactory.java
  4. 14
      designer-base/src/main/java/com/fr/design/gui/frpane/BaseHyperlinkGroup.java
  5. 22
      designer-base/src/main/java/com/fr/design/gui/frpane/HyperLinkGroupFilter.java
  6. 16
      designer-base/src/main/java/com/fr/design/gui/frpane/HyperlinkGroupType.java
  7. 5
      designer-base/src/main/java/com/fr/design/gui/frpane/UICorrelationComboBoxPane.java
  8. 11
      designer-base/src/main/java/com/fr/design/gui/itree/filetree/FileNodeComparator.java
  9. 1
      designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java
  10. 1
      designer-base/src/main/java/com/fr/design/preview/MobilePreview.java
  11. 4
      designer-base/src/main/java/com/fr/design/remote/ui/UserManagerPane.java
  12. 10
      designer-base/src/main/java/com/fr/file/FILEChooserPane.java
  13. 22
      designer-chart/src/main/java/com/fr/design/module/ChartHyperlinkGroup.java
  14. 32
      designer-chart/src/main/java/com/fr/extended/chart/ExtendedOtherPane.java
  15. 4
      designer-form/src/main/java/com/fr/design/mainframe/JForm.java
  16. 3
      designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java
  17. 40
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/RecentSearchManager.java
  18. 2
      designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java

87
designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java

@ -52,19 +52,28 @@ public class EnvChangeEntrance {
});
}
private boolean envListOkAction(EnvListPane envListPane) {
private boolean envListOkAction(EnvListPane envListPane, PopTipStrategy strategy) {
final String selectedName = envListPane.updateEnvManager();
return switch2Env(selectedName);
return switch2Env(selectedName, strategy);
}
/**
* 切换到指定名称的工作目录
*
* @param envName 目标工作目录名称
*/
public void switch2Env(final String envName) {
switch2Env(envName, PopTipStrategy.LATER);
}
/**
* 切换到新环境
*
* @param envName 新工作环境名称
* @return 是否成功
*/
public boolean switch2Env(final String envName) {
private boolean switch2Env(final String envName, PopTipStrategy strategy) {
DesignerEnvManager envManager = DesignerEnvManager.getEnvManager();
DesignerWorkspaceInfo selectedEnv = envManager.getWorkspaceInfo(envName);
@ -72,8 +81,13 @@ public class EnvChangeEntrance {
Workspace workspace = DesignerWorkspaceGenerator.generate(selectedEnv);
boolean checkValid = workspace != null && selectedEnv.checkValid();
if (!checkValid) {
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Basic_Switch_Workspace_Failed"),
UIManager.getString("OptionPane.messageDialogTitle"), ERROR_MESSAGE, UIManager.getIcon("OptionPane.errorIcon"));
strategy.showTip(new PopTip() {
@Override
public void show() {
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Basic_Switch_Workspace_Failed"),
UIManager.getString("OptionPane.messageDialogTitle"), ERROR_MESSAGE, UIManager.getIcon("OptionPane.errorIcon"));
}
});
return false;
}
WorkContext.switchTo(workspace, new WorkContextCallback() {
@ -96,13 +110,24 @@ public class EnvChangeEntrance {
} catch (AuthException | RegistEditionException e) {
// String title = Toolkit.i18nText("Fine-Design_Basic_Remote_Connect_Auth_Failed");
// String title = Toolkit.i18nText("Fine-Design_Basic_Lic_Does_Not_Support_Remote");
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Basic_Switch_Workspace_Failed"),
UIManager.getString("OptionPane.messageDialogTitle"), ERROR_MESSAGE, UIManager.getIcon("OptionPane.errorIcon"));
strategy.showTip(new PopTip() {
@Override
public void show() {
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Basic_Switch_Workspace_Failed"),
UIManager.getString("OptionPane.messageDialogTitle"), ERROR_MESSAGE, UIManager.getIcon("OptionPane.errorIcon"));
}
});
return false;
} catch (Exception exception) {
FineLoggerFactory.getLogger().error(exception.getMessage(), exception);
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Basic_Switch_Workspace_Failed"),
UIManager.getString("OptionPane.messageDialogTitle"), ERROR_MESSAGE, UIManager.getIcon("OptionPane.errorIcon"));
strategy.showTip(new PopTip() {
@Override
public void show() {
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Basic_Switch_Workspace_Failed"),
UIManager.getString("OptionPane.messageDialogTitle"), ERROR_MESSAGE, UIManager.getIcon("OptionPane.errorIcon"));
}
});
return false;
}
TemplateTreePane.getInstance().refreshDockingView();
@ -136,13 +161,11 @@ public class EnvChangeEntrance {
@Override
public void doOk() {
envListDialog.dispose();
envListOkAction(envListPane);
envListOkAction(envListPane, PopTipStrategy.LATER);
}
@Override
public void doCancel() {
envListDialog.dispose();
}
});
@ -160,11 +183,9 @@ public class EnvChangeEntrance {
@Override
public void doOk() {
if (!envListOkAction(envListPane)) {
if (!envListOkAction(envListPane, PopTipStrategy.NOW)) {
System.exit(0);
}
}
@Override
@ -175,4 +196,40 @@ public class EnvChangeEntrance {
envListDialog.setVisible(true);
}
/**
* 提示显示策略
*/
enum PopTipStrategy {
/**
* 切换失败就马上提示失败不关闭选择列表对话框
*/
NOW {
@Override
void showTip(PopTip tip) {
tip.show();
}
},
/**
* 切换失败自动关闭选择列表对话框然后提示切换失败
*/
LATER {
@Override
void showTip(final PopTip tip) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
tip.show();
}
});
}
};
abstract void showTip(PopTip tip);
}
interface PopTip {
void show();
}
}

7
designer-base/src/main/java/com/fr/design/gui/controlpane/shortcutfactory/OldShortCutFactory.java

@ -5,13 +5,14 @@ import com.fr.design.actions.UpdateAction;
import com.fr.design.gui.controlpane.NameableCreator;
import com.fr.design.gui.controlpane.ShortCut4JControlPane;
import com.fr.design.gui.controlpane.ShortCutListenerProvider;
import com.fr.design.gui.frpane.HyperLinkGroupFilter;
import com.fr.design.menu.LineSeparator;
import com.fr.design.menu.MenuDef;
import com.fr.design.menu.ShortCut;
import com.fr.design.module.DesignModuleFactory;
import com.fr.general.ComparatorUtils;
import com.fr.general.Inter;
import com.fr.js.JavaScript;
import com.fr.stable.Filter;
import javax.swing.Icon;
import java.awt.event.ActionEvent;
@ -84,8 +85,8 @@ public class OldShortCutFactory extends AbstractShortCutFactory {
private void wrapActionListener(NameableCreator[] creators) {
for (final NameableCreator creator : creators) {
HyperLinkGroupFilter filter = DesignModuleFactory.getHyperlinkGroupType().getFilter();
if (!filter.filter(creator.getHyperlink())) {
Filter<Class<? extends JavaScript>> filter = DesignModuleFactory.getHyperlinkGroupType().getFilter();
if (!filter.accept(creator.getHyperlink())) {
continue;
}
boolean isTrue = ComparatorUtils.equals(creator.menuName(), Inter.getLocText("Datasource-Stored_Procedure")) ||

7
designer-base/src/main/java/com/fr/design/gui/controlpane/shortcutfactory/ShortCutFactory.java

@ -6,13 +6,14 @@ import com.fr.design.actions.core.ActionFactory;
import com.fr.design.gui.controlpane.NameableCreator;
import com.fr.design.gui.controlpane.ShortCut4JControlPane;
import com.fr.design.gui.controlpane.ShortCutListenerProvider;
import com.fr.design.gui.frpane.HyperLinkGroupFilter;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.menu.LineSeparator;
import com.fr.design.menu.MenuDef;
import com.fr.design.menu.ShortCut;
import com.fr.design.module.DesignModuleFactory;
import com.fr.general.ComparatorUtils;
import com.fr.js.JavaScript;
import com.fr.stable.Filter;
import com.fr.stable.StringUtils;
import javax.swing.AbstractButton;
@ -141,8 +142,8 @@ public class ShortCutFactory extends AbstractShortCutFactory {
private void wrapActionListener(NameableCreator[] creators) {
for (final NameableCreator creator : creators) {
HyperLinkGroupFilter filter = DesignModuleFactory.getHyperlinkGroupType().getFilter();
if (!filter.filter(creator.getHyperlink())) {
Filter<Class<? extends JavaScript>> filter = DesignModuleFactory.getHyperlinkGroupType().getFilter();
if (!filter.accept(creator.getHyperlink())) {
continue;
}
boolean isTrue = ComparatorUtils.equals(creator.menuName(), com.fr.design.i18n.Toolkit.i18nText("Datasource-Stored_Procedure")) ||

14
designer-base/src/main/java/com/fr/design/gui/frpane/BaseHyperlinkGroup.java

@ -3,6 +3,7 @@ package com.fr.design.gui.frpane;
import com.fr.design.gui.controlpane.NameableCreator;
import com.fr.design.module.DesignModuleFactory;
import com.fr.js.JavaScript;
import com.fr.stable.Filter;
/**
* 基础的超级链接类型, 不包括图表相关超链.
@ -22,15 +23,20 @@ public class BaseHyperlinkGroup implements HyperlinkGroupType {
}
@Override
public HyperLinkGroupFilter getFilter() {
return new HyperLinkGroupFilter() {
public Filter<Class<? extends JavaScript>> getFilter() {
return new Filter<Class<? extends JavaScript>>() {
@Override
public boolean filter(Class<? extends JavaScript> clazz) {
public boolean accept(Class<? extends JavaScript> aClass) {
return true;
}
};
}
@Override
public Filter<Object> getOldFilter() {
return new Filter<Object>() {
@Override
public boolean filter(Object object) {
public boolean accept(Object object) {
return true;
}
};

22
designer-base/src/main/java/com/fr/design/gui/frpane/HyperLinkGroupFilter.java

@ -1,22 +0,0 @@
package com.fr.design.gui.frpane;
import com.fr.js.JavaScript;
public interface HyperLinkGroupFilter {
/**
* @param clazz clazz
* @return 是否可用返回true表示可用返回false表示不可用
*/
boolean filter(Class<? extends JavaScript> clazz);
/**
* 兼容老图表
*
* @param object object
* @return 是否可用返回true表示可用返回false表示不可用
* @see HyperLinkGroupFilter#filter(Class)
*/
boolean filter(Object object);
}

16
designer-base/src/main/java/com/fr/design/gui/frpane/HyperlinkGroupType.java

@ -1,6 +1,8 @@
package com.fr.design.gui.frpane;
import com.fr.design.gui.controlpane.NameableCreator;
import com.fr.js.JavaScript;
import com.fr.stable.Filter;
/**
* 超级链接 支持的类型 种类.
@ -18,6 +20,18 @@ public interface HyperlinkGroupType {
NameableCreator[] getHyperlinkCreators();
HyperLinkGroupFilter getFilter();
/**
* 图表超链过滤
*
* @return 图表超链过滤
*/
Filter<Class<? extends JavaScript>> getFilter();
/**
* 老图表超链的过滤
*
* @return 老图表超链的过滤
*/
Filter<Object> getOldFilter();
}

5
designer-base/src/main/java/com/fr/design/gui/frpane/UICorrelationComboBoxPane.java

@ -23,6 +23,7 @@ import com.fr.js.EmailJavaScript;
import com.fr.js.ReportletHyperlink;
import com.fr.js.WebHyperlink;
import com.fr.stable.ArrayUtils;
import com.fr.stable.Filter;
import com.fr.stable.StringUtils;
import javax.swing.JFrame;
@ -95,8 +96,8 @@ public class UICorrelationComboBoxPane extends JPanel implements UIObserver {
if (values.size() > 1) {
for (UIMenuNameableCreator value : values) {
final String itemName = value.getName();
HyperLinkGroupFilter filter = DesignModuleFactory.getHyperlinkGroupType().getFilter();
if (!filter.filter(value.getObj())) {
Filter<Object> filter = DesignModuleFactory.getHyperlinkGroupType().getOldFilter();
if (!filter.accept(value.getObj())) {
continue;
}
UIMenuItem item = new UIMenuItem(itemName);

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

1
designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java

@ -1091,7 +1091,6 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
public void previewMenuActionPerformed(PreviewProvider provider) {
setPreviewType(provider);
WebPreviewUtils.preview(this, provider);
}
/**

1
designer-base/src/main/java/com/fr/design/preview/MobilePreview.java

@ -1,7 +1,6 @@
package com.fr.design.preview;
import com.fr.design.fun.impl.AbstractPreviewProvider;
import java.util.HashMap;
import java.util.Map;

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
public void insertUpdate(DocumentEvent e) {
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.utils.gui.GUICoreUtils;
import com.fr.file.filetree.FileNode;
import com.fr.file.filetree.LocalFileNodes;
import com.fr.file.filter.ChooseFileFilter;
import com.fr.file.filter.FILEFilter;
import com.fr.general.ComparatorUtils;
@ -693,14 +692,9 @@ public class FILEChooserPane extends BasicPane {
String appName = ProductConstants.APP_NAME;
JTemplate editing = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
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 (WorkContext.getCurrent().isLocal()) { //本地连接
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")));
}
this.addChooseFILEFilter(new ChooseFileFilter(FRContext.getFileNodes().getSupportedTypes(), appName + Toolkit.i18nText("Fine-Design_Report_Template_File")));
}
// ben:filefilter设置初值为cpt过滤

22
designer-chart/src/main/java/com/fr/design/module/ChartHyperlinkGroup.java

@ -11,13 +11,13 @@ import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.gui.controlpane.NameObjectCreator;
import com.fr.design.gui.controlpane.NameableCreator;
import com.fr.design.gui.frpane.BaseHyperlinkGroup;
import com.fr.design.gui.frpane.HyperLinkGroupFilter;
import com.fr.design.mainframe.BaseJForm;
import com.fr.design.mainframe.JTemplate;
import com.fr.general.ComparatorUtils;
import com.fr.js.FormHyperlinkProvider;
import com.fr.js.JavaScript;
import com.fr.stable.ArrayUtils;
import com.fr.stable.Filter;
import com.fr.stable.bridge.StableFactory;
/**
@ -46,10 +46,10 @@ public class ChartHyperlinkGroup extends BaseHyperlinkGroup {
}
@Override
public HyperLinkGroupFilter getFilter() {
return new HyperLinkGroupFilter() {
public Filter<Class<? extends JavaScript>> getFilter() {
return new Filter<Class<? extends JavaScript>>() {
@Override
public boolean filter(Class<? extends JavaScript> clazz) {
public boolean accept(Class<? extends JavaScript> clazz) {
JTemplate template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
if (template == null) {
return false;
@ -78,25 +78,23 @@ public class ChartHyperlinkGroup extends BaseHyperlinkGroup {
}
return true;
}
};
}
/**
* 兼容老图表
* @param object
* @return
*/
@Override
public Filter<Object> getOldFilter() {
return new Filter<Object>() {
@Override
public boolean filter(Object object) {
public boolean accept(Object object) {
JTemplate template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
if (template == null) {
return false;
}
if (template.isJWorkBook()) {
// 如果是普通报表单元格,那么没有 FormHyperlink 选项
FormHyperlinkProvider formHyperlink = StableFactory.getMarkedInstanceObjectFromClass(FormHyperlinkProvider.XML_TAG, FormHyperlinkProvider.class);
//返回true表示可用,返回false表示不可用
return !ComparatorUtils.equals(object.getClass(), formHyperlink.getClass());
} else {
// 如果是决策报表
Class[] classes = new Class[]{ChartHyperRelateCellLink.class, ChartHyperRelateFloatLink.class};

32
designer-chart/src/main/java/com/fr/extended/chart/ExtendedOtherPane.java

@ -16,22 +16,24 @@ import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.BorderLayout;
import java.awt.Component;
import java.util.Arrays;
/**
* Created by shine on 2018/3/12.
*/
public class ExtendedOtherPane extends AbstractChartAttrPane {
public class ExtendedOtherPane<T extends AbstractChart> extends AbstractChartAttrPane {
private ExtendedChartHyperLinkPane hyperLinkPane;
private UIButtonGroup refreshEnabled;
private UISpinner autoRefreshTime;
private JPanel contentPane;
protected AbstractChart getAbstractChart(Chart chart) {
if (chart != null && chart instanceof AbstractChart) {
return (AbstractChart) chart;
private T chart;
protected void setChart(Chart chart) {
if (chart instanceof AbstractChart) {
this.chart = (T) chart;
}
return null;
}
@Override
@ -40,7 +42,7 @@ public class ExtendedOtherPane extends AbstractChartAttrPane {
return;
}
AbstractChart chart = getAbstractChart(collection.getSelectedChart());
setChart(collection.getSelectedChart());
if (chart != null) {
hyperLinkPane.populateBean(chart);
@ -57,7 +59,7 @@ public class ExtendedOtherPane extends AbstractChartAttrPane {
return;
}
AbstractChart chart = getAbstractChart(collection.getSelectedChart());
setChart(collection.getSelectedChart());
if (chart != null) {
hyperLinkPane.updateBean(chart);
@ -77,16 +79,20 @@ public class ExtendedOtherPane extends AbstractChartAttrPane {
double f = TableLayout.FILL;
double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH;
double[] columnSize = {f, e};
double[] rowSize = {p, p, p, p, p, p};
Component[][] components = new Component[][]{
new Component[]{createRefreshPane(), null},
new Component[]{createHyperlinkPane(), null}
};
Component[][] components = getComponents(createRefreshPane(), createHyperlinkPane());
double[] rowSize = new double[components.length];
Arrays.fill(rowSize, p);
return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
}
protected Component[][] getComponents(JPanel refresh, JPanel hyperlink) {
return new Component[][]{
new Component[]{refresh, null},
new Component[]{hyperlink, null}
};
}
@Override
public String getIconPath() {
return null;

4
designer-form/src/main/java/com/fr/design/mainframe/JForm.java

@ -6,9 +6,7 @@ import com.fr.base.Parameter;
import com.fr.base.vcs.DesignerMode;
import com.fr.design.DesignState;
import com.fr.design.actions.core.WorkBookSupportable;
import com.fr.design.actions.file.WebPreviewUtils;
import com.fr.design.cell.FloatElementsProvider;
import com.fr.design.constants.UIConstants;
import com.fr.design.designer.TargetComponent;
import com.fr.design.designer.beans.actions.CopyAction;
import com.fr.design.designer.beans.actions.CutAction;
@ -938,7 +936,7 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm {
*/
@Override
public PreviewProvider[] supportPreview() {
return new PreviewProvider[]{new FormPreview(), new MobilePreview()};
return new PreviewProvider[]{new FormPreview()};
}
/**

3
designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java

@ -52,7 +52,6 @@ import com.fr.design.menu.ToolBarDef;
import com.fr.design.module.DesignModuleFactory;
import com.fr.design.parameter.ParameterDefinitePane;
import com.fr.design.parameter.ParameterInputPane;
import com.fr.design.preview.MobilePreview;
import com.fr.design.preview.PagePreview;
import com.fr.design.preview.ViewPreview;
import com.fr.design.preview.WriteEnhancePreview;
@ -890,7 +889,7 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
public PreviewProvider[] supportPreview() {
Set<PreviewProvider> set = ExtraDesignClassManager.getInstance().getArray(PreviewProvider.MARK_STRING);
return ArrayUtils.addAll(new PreviewProvider[]{
new PagePreview(), new WritePreview(), new ViewPreview(), new WriteEnhancePreview(), new MobilePreview()
new PagePreview(), new WritePreview(), new ViewPreview(), new WriteEnhancePreview()
}, set.toArray(new PreviewProvider[set.size()]));
}

40
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 {
private static final int MAX_SIZE = 100;
private static volatile RecentSearchManager instance;
IndexReader indexReader = null;
IndexSearcher indexSearcher = null;
private static final RecentSearchManager INSTANCE = new RecentSearchManager();
private IndexReader indexReader = null;
//索引存储路径
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 IndexWriter indexWriter = null;
private SearchResult recentModelList;
private SearchResult modelList;
public static RecentSearchManager getInstance() {
if (instance == null) {
synchronized (RecentSearchManager.class) {
if (instance == null) {
instance = new RecentSearchManager();
instance.initWriter();
}
}
}
return instance;
return INSTANCE;
}
@Override
public SearchResult getLessSearchResult(String[] searchText) {
this.modelList = new SearchResult();
for (int j = 0; j < searchText.length; j++) {
recentModelList = getRecentModelList(searchText[j]);
SearchResult modelList = new SearchResult();
for (String aSearchText : searchText) {
recentModelList = getRecentModelList(aSearchText);
}
if (recentModelList != null && recentModelList.size() > 0) {
modelList.add(new MoreModel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_AlphaFine_Latest")));
@ -92,8 +86,8 @@ public class RecentSearchManager implements AlphaFineSearchProvider {
public SearchResult getMoreSearchResult(String searchText) {
return new SearchResult();
}
public synchronized SearchResult getRecentModelList(String searchText) {
private synchronized SearchResult getRecentModelList(String searchText) {
return searchBySort(searchText);
}
@ -121,7 +115,6 @@ public class RecentSearchManager implements AlphaFineSearchProvider {
try {
indexWriter.close();
indexReader = DirectoryReader.open(directory);
indexSearcher = new IndexSearcher(indexReader);
} catch (IOException 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) {
if(cellModel == null){
@ -151,8 +142,6 @@ public class RecentSearchManager implements AlphaFineSearchProvider {
/**
* 写文档建立索引
*
* @param doc
*/
private void writeDoc(Document doc) {
try {
@ -166,9 +155,6 @@ public class RecentSearchManager implements AlphaFineSearchProvider {
/**
* 按序搜索
*
* @param key
* @return
*/
private synchronized SearchResult searchBySort(String key) {
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();
public static Status status = Status.Disconnected;
private static Status status = Status.Disconnected;
private static final Emitter.Listener printLog = new Emitter.Listener() {
@Override

Loading…
Cancel
Save