Browse Source

Merge branch 'release/10.0' of http://cloud.finedevelop.com:2015/scm/~kerry/design_10.0 into release/10.0

final/10.0
kerry 7 years ago
parent
commit
3f70704c09
  1. 46
      designer-base/src/main/java/com/fr/design/gui/style/AlignmentPane.java
  2. 24
      designer-realize/src/main/java/com/fr/design/condition/PaddingPane.java
  3. 41
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java
  4. 27
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/RecentSearchManager.java

46
designer-base/src/main/java/com/fr/design/gui/style/AlignmentPane.java

@ -20,15 +20,27 @@ import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.event.EventDispatcher;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.plugin.ExtraClassManager; import com.fr.plugin.ExtraClassManager;
import com.fr.plugin.context.PluginContext;
import com.fr.plugin.manage.PluginFilter;
import com.fr.plugin.observer.PluginEvent;
import com.fr.plugin.observer.PluginEventListener;
import com.fr.plugin.observer.PluginEventType;
import com.fr.report.fun.VerticalTextProcessor; import com.fr.report.fun.VerticalTextProcessor;
import com.fr.report.fun.impl.DefaultVerticalTextProcessor; import com.fr.report.fun.impl.DefaultVerticalTextProcessor;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import javax.swing.*; import javax.swing.BorderFactory;
import java.awt.*; import javax.swing.Icon;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.event.ItemEvent; import java.awt.event.ItemEvent;
import java.awt.event.ItemListener; import java.awt.event.ItemListener;
import java.util.ArrayList; import java.util.ArrayList;
@ -103,12 +115,32 @@ public class AlignmentPane extends AbstractBasicStylePane implements GlobalNameO
initOtherComponent(); initOtherComponent();
initAllNames(); initAllNames();
indentationUnitProcessor = ExtraDesignClassManager.getInstance().getSingle(IndentationUnitProcessor.MARK_STRING); addPluginListeners(PluginEventType.AfterRun);
if (null == indentationUnitProcessor) { addPluginListeners(PluginEventType.AfterStop);
indentationUnitProcessor = new DefaultIndentationUnitProcessor(); refreshIndentationUnit();
}
} }
private void addPluginListeners(PluginEventType type) {
EventDispatcher.listen(type, new PluginEventListener() {
@Override
public void on(PluginEvent event) {
refreshIndentationUnit();
}
}, new PluginFilter() {
@Override
public boolean accept(PluginContext context) {
return context.contain(IndentationUnitProcessor.MARK_STRING);
}
});
}
private void refreshIndentationUnit() {
this.indentationUnitProcessor = ExtraDesignClassManager.getInstance().getSingle(IndentationUnitProcessor.MARK_STRING);
if (null == this.indentationUnitProcessor) {
this.indentationUnitProcessor = new DefaultIndentationUnitProcessor();
}
}
private void initOtherComponent() { private void initOtherComponent() {
hPaneContainer.add(hAlignmentPane); hPaneContainer.add(hAlignmentPane);

24
designer-realize/src/main/java/com/fr/design/condition/PaddingPane.java

@ -7,11 +7,15 @@ import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UIBasicSpinner; import com.fr.design.gui.ispinner.UIBasicSpinner;
import com.fr.design.gui.style.DefaultIndentationUnitProcessor; import com.fr.design.gui.style.DefaultIndentationUnitProcessor;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.GeneralContext;
import com.fr.plugin.context.PluginContext;
import com.fr.plugin.manage.PluginFilter;
import com.fr.plugin.observer.PluginEvent;
import com.fr.plugin.observer.PluginEventListener;
import com.fr.report.cell.cellattr.highlight.HighlightAction; import com.fr.report.cell.cellattr.highlight.HighlightAction;
import com.fr.report.cell.cellattr.highlight.PaddingHighlightAction; import com.fr.report.cell.cellattr.highlight.PaddingHighlightAction;
import javax.swing.*; import javax.swing.SpinnerNumberModel;
/** /**
* @author richie * @author richie
@ -45,7 +49,23 @@ public class PaddingPane extends ConditionAttrSingleConditionPane<HighlightActio
this.add(this.paddingScopeComboBox); this.add(this.paddingScopeComboBox);
this.paddingLeftSpinner.setValue(new Integer(0)); this.paddingLeftSpinner.setValue(new Integer(0));
this.paddingRightSpinner.setValue(new Integer(0)); this.paddingRightSpinner.setValue(new Integer(0));
GeneralContext.listenPluginRunningChanged(new PluginEventListener() {
@Override
public void on(PluginEvent event) {
refreshIndentationUnit();
}
}, new PluginFilter() {
@Override
public boolean accept(PluginContext context) {
return context.contain(IndentationUnitProcessor.MARK_STRING);
}
});
refreshIndentationUnit();
}
private void refreshIndentationUnit() {
this.indentationUnitProcessor = ExtraDesignClassManager.getInstance().getSingle(IndentationUnitProcessor.MARK_STRING); this.indentationUnitProcessor = ExtraDesignClassManager.getInstance().getSingle(IndentationUnitProcessor.MARK_STRING);
if (null == this.indentationUnitProcessor) { if (null == this.indentationUnitProcessor) {
this.indentationUnitProcessor = new DefaultIndentationUnitProcessor(); this.indentationUnitProcessor = new DefaultIndentationUnitProcessor();

41
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java

@ -28,10 +28,11 @@ import com.fr.design.mainframe.alphafine.search.manager.impl.FileSearchManager;
import com.fr.design.mainframe.alphafine.search.manager.impl.PluginSearchManager; import com.fr.design.mainframe.alphafine.search.manager.impl.PluginSearchManager;
import com.fr.design.mainframe.alphafine.search.manager.impl.RecentSearchManager; import com.fr.design.mainframe.alphafine.search.manager.impl.RecentSearchManager;
import com.fr.design.mainframe.alphafine.search.manager.impl.RecommendSearchManager; import com.fr.design.mainframe.alphafine.search.manager.impl.RecommendSearchManager;
import com.fr.design.mainframe.errorinfo.ErrorInfoUploader;
import com.fr.design.mainframe.templateinfo.TemplateInfoCollector;
import com.fr.form.main.Form; import com.fr.form.main.Form;
import com.fr.form.main.FormIO; import com.fr.form.main.FormIO;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.http.HttpClient; import com.fr.general.http.HttpClient;
import com.fr.io.TemplateWorkBookIO; import com.fr.io.TemplateWorkBookIO;
import com.fr.io.exporter.ImageExporter; import com.fr.io.exporter.ImageExporter;
@ -44,11 +45,28 @@ import com.fr.stable.StringUtils;
import com.fr.stable.project.ProjectConstants; import com.fr.stable.project.ProjectConstants;
import javax.imageio.ImageIO; import javax.imageio.ImageIO;
import javax.swing.*; import javax.swing.BorderFactory;
import javax.swing.DefaultListModel;
import javax.swing.ImageIcon;
import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.KeyStroke;
import javax.swing.SwingUtilities;
import javax.swing.SwingWorker;
import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentEvent;
import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener; import javax.swing.event.ListSelectionListener;
import java.awt.*; import java.awt.AWTEvent;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Frame;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.Toolkit;
import java.awt.Window;
import java.awt.event.AWTEventListener; import java.awt.event.AWTEventListener;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
@ -761,11 +779,18 @@ public class AlphaFineDialog extends UIDialog {
* *
* @param cellModel * @param cellModel
*/ */
private void saveLocalHistory(AlphaCellModel cellModel) { private void saveLocalHistory(final AlphaCellModel cellModel) {
RecentSearchManager searchManager = RecentSearchManager.getInstance(); Thread sendThread = new Thread(new Runnable() {
searchManager.addModel(storeText, cellModel, cellModel.getSearchCount() + 1); @Override
sendDataToServer(storeText, cellModel); public void run() {
RecentSearchManager searchManager = RecentSearchManager.getInstance();
searchManager.addModel(storeText, cellModel);
sendDataToServer(storeText, cellModel);
TemplateInfoCollector.getInstance().sendTemplateInfo();
ErrorInfoUploader.getInstance().sendErrorInfo();
}
});
sendThread.start();
} }
/** /**

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

@ -1,6 +1,7 @@
package com.fr.design.mainframe.alphafine.search.manager.impl; package com.fr.design.mainframe.alphafine.search.manager.impl;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.design.mainframe.alphafine.AlphaFineConstants;
import com.fr.design.mainframe.alphafine.CellType; import com.fr.design.mainframe.alphafine.CellType;
import com.fr.design.mainframe.alphafine.cell.CellModelHelper; import com.fr.design.mainframe.alphafine.cell.CellModelHelper;
import com.fr.design.mainframe.alphafine.cell.model.ActionModel; import com.fr.design.mainframe.alphafine.cell.model.ActionModel;
@ -9,7 +10,6 @@ import com.fr.design.mainframe.alphafine.cell.model.MoreModel;
import com.fr.design.mainframe.alphafine.model.SearchResult; import com.fr.design.mainframe.alphafine.model.SearchResult;
import com.fr.design.mainframe.alphafine.search.manager.fun.AlphaFineSearchProvider; import com.fr.design.mainframe.alphafine.search.manager.fun.AlphaFineSearchProvider;
import com.fr.design.mainframe.toolbar.UpdateActionManager; import com.fr.design.mainframe.toolbar.UpdateActionManager;
import com.fr.json.JSONException; import com.fr.json.JSONException;
import com.fr.json.JSONObject; import com.fr.json.JSONObject;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
@ -18,7 +18,7 @@ import com.fr.third.org.apache.lucene.analysis.Analyzer;
import com.fr.third.org.apache.lucene.analysis.standard.StandardAnalyzer; import com.fr.third.org.apache.lucene.analysis.standard.StandardAnalyzer;
import com.fr.third.org.apache.lucene.document.Document; import com.fr.third.org.apache.lucene.document.Document;
import com.fr.third.org.apache.lucene.document.Field; import com.fr.third.org.apache.lucene.document.Field;
import com.fr.third.org.apache.lucene.document.IntField; import com.fr.third.org.apache.lucene.document.LongField;
import com.fr.third.org.apache.lucene.document.StringField; import com.fr.third.org.apache.lucene.document.StringField;
import com.fr.third.org.apache.lucene.index.DirectoryReader; import com.fr.third.org.apache.lucene.index.DirectoryReader;
import com.fr.third.org.apache.lucene.index.IndexReader; import com.fr.third.org.apache.lucene.index.IndexReader;
@ -44,7 +44,7 @@ import java.util.List;
* Created by XiaXiang on 2018/1/22. * Created by XiaXiang on 2018/1/22.
*/ */
public class RecentSearchManager implements AlphaFineSearchProvider { public class RecentSearchManager implements AlphaFineSearchProvider {
private static final int MAX_SIZE = 3; private static final int MAX_SIZE = 100;
private static RecentSearchManager instance; private static RecentSearchManager instance;
IndexReader indexReader = null; IndexReader indexReader = null;
IndexSearcher indexSearcher = null; IndexSearcher indexSearcher = null;
@ -78,7 +78,7 @@ public class RecentSearchManager implements AlphaFineSearchProvider {
if (recentModelList != null && recentModelList.size() > 0) { if (recentModelList != null && recentModelList.size() > 0) {
modelList.add(new MoreModel(com.fr.design.i18n.Toolkit.i18nText("FR-Designer_AlphaFine_Latest"))); modelList.add(new MoreModel(com.fr.design.i18n.Toolkit.i18nText("FR-Designer_AlphaFine_Latest")));
} }
modelList.addAll(recentModelList); modelList.addAll(recentModelList.subList(0, AlphaFineConstants.LATEST_SHOW_SIZE));
return modelList; return modelList;
} }
@ -126,15 +126,14 @@ public class RecentSearchManager implements AlphaFineSearchProvider {
* *
* @param searchKey * @param searchKey
* @param cellModel * @param cellModel
* @param searchCount
*/ */
public void addModel(String searchKey, AlphaCellModel cellModel, int searchCount) { public void addModel(String searchKey, AlphaCellModel cellModel) {
try { try {
initWriter(); initWriter();
Document doc = new Document(); Document doc = new Document();
doc.add(new StringField("searchKey", searchKey, Field.Store.YES)); doc.add(new StringField("searchKey", searchKey, Field.Store.YES));
doc.add(new StringField("cellModel", cellModel.ModelToJson().toString(), Field.Store.YES)); doc.add(new StringField("cellModel", cellModel.ModelToJson().toString(), Field.Store.YES));
doc.add(new IntField("searchCount", searchCount, Field.Store.YES)); doc.add(new LongField("time", System.currentTimeMillis(), Field.Store.YES));
writeDoc(doc); writeDoc(doc);
} catch (JSONException e) { } catch (JSONException e) {
FineLoggerFactory.getLogger().error("add document error: " + e.getMessage()); FineLoggerFactory.getLogger().error("add document error: " + e.getMessage());
@ -170,7 +169,7 @@ public class RecentSearchManager implements AlphaFineSearchProvider {
IndexSearcher searcher = new IndexSearcher(indexReader); IndexSearcher searcher = new IndexSearcher(indexReader);
//构建排序字段 //构建排序字段
SortField[] sortField = new SortField[1]; SortField[] sortField = new SortField[1];
sortField[0] = new SortField("searchCount", SortField.Type.INT, true); sortField[0] = new SortField("time", SortField.Type.LONG, true);
Sort sortKey = new Sort(sortField); Sort sortKey = new Sort(sortField);
String searchField = "searchKey"; String searchField = "searchKey";
Term term = new Term(searchField, key); Term term = new Term(searchField, key);
@ -186,13 +185,11 @@ public class RecentSearchManager implements AlphaFineSearchProvider {
UpdateAction action = UpdateActionManager.getUpdateActionManager().getActionByName(model.getName()); UpdateAction action = UpdateActionManager.getUpdateActionManager().getActionByName(model.getName());
if (action != null) { if (action != null) {
((ActionModel) model).setAction(action); ((ActionModel) model).setAction(action);
recentModelList.add(model); addModel(model);
} }
} else { } else {
recentModelList.add(model); addModel(model);
} }
} }
} catch (Exception e) { } catch (Exception e) {
FineLoggerFactory.getLogger().error("local search error: " + e.getMessage()); FineLoggerFactory.getLogger().error("local search error: " + e.getMessage());
@ -201,5 +198,11 @@ public class RecentSearchManager implements AlphaFineSearchProvider {
return recentModelList; return recentModelList;
} }
private void addModel(AlphaCellModel model) {
if (!recentModelList.contains(model)) {
recentModelList.add(model);
}
}
} }

Loading…
Cancel
Save