Browse Source

Merge pull request #3 in ~NEIL/design from release/10.0 to feature/10.0

* commit '4fc61bd00cb8c9f8515f7b2b166adb732cc96fa9':
  规范
  REPORT-11886 远程设计目录树刷新卡顿
  REPORT-11016 10.0版本mac上点击最大化会卡死
  REPORT-11993 普通用户远程设计数据连接权限设置无效
  无JIRA任务 findbugs问题
  REPORT-11880 SimilarSearchManeger拼错了....
  change to protected method
  CHART-3208 继承&创建含默认值“自动”的下拉选项
  REPORT-11950 设计器内插件管理与平台内插件管理的授权字样不一致
  CHART-3211 第三方图表插件有些没有type pane
  REPORT-11690 【集群】【远程设计】添加服务器数据集异常
research/10.0
neil 6 years ago
parent
commit
3043b60379
  1. 10
      designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionComboBoxPanel.java
  2. 682
      designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java
  3. 2
      designer-base/src/main/java/com/fr/design/extra/PluginUtils.java
  4. 14
      designer-base/src/main/java/com/fr/design/gui/itree/filetree/EnvFileTree.java
  5. 109
      designer-base/src/main/java/com/fr/design/gui/itree/filetree/FileNodeComparator.java
  6. 203
      designer-base/src/main/java/com/fr/design/gui/itree/filetree/JFileTree.java
  7. 2
      designer-base/src/main/java/com/fr/design/gui/itree/filetree/TemplateFileTree.java
  8. 6
      designer-base/src/main/java/com/fr/design/mingche.java
  9. 16
      designer-base/src/main/java/com/fr/design/onlineupdate/domain/UpdateConstants.java
  10. 5
      designer-base/src/main/java/com/fr/design/onlineupdate/ui/dialog/RestoreResultDialog.java
  11. 36
      designer-base/src/main/java/com/fr/design/onlineupdate/ui/dialog/UpdateMainDialog.java
  12. 8
      designer-base/src/main/java/com/fr/file/FileNodeFILE.java
  13. 6
      designer-chart/src/main/java/com/fr/design/ChartTypeInterfaceManager.java
  14. 8
      designer-chart/src/main/java/com/fr/design/chart/fun/impl/AbstractIndependentChartsUI.java
  15. 12
      designer-chart/src/main/java/com/fr/extended/chart/UIComboBoxWithNone.java
  16. 4
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/AlphaFineHelper.java
  17. 4
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/cell/CellModelHelper.java
  18. 6
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java
  19. 10
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/SimilarSearchManager.java
  20. BIN
      designer-realize/src/main/resources/com/fr/start/jni/splash.dylib
  21. 10
      designer-realize/src/test/java/com.fr/design/mainframe/alphafine/search/manager/impl/SearchManegerTest.java

10
designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionComboBoxPanel.java

@ -15,11 +15,13 @@ import com.fr.transaction.CallBackAdaptor;
import com.fr.transaction.Configurations; import com.fr.transaction.Configurations;
import com.fr.transaction.WorkerFacade; import com.fr.transaction.WorkerFacade;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
import com.fr.workspace.server.connection.DBConnectAuth;
import javax.swing.SwingUtilities; import javax.swing.SwingUtilities;
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;
import java.util.Collection;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
@ -62,8 +64,16 @@ public class ConnectionComboBoxPanel extends ItemEditableComboBoxPanel {
ConnectionConfig mgr = ConnectionConfig.getInstance(); ConnectionConfig mgr = ConnectionConfig.getInstance();
Iterator<String> nameIt = mgr.getConnections().keySet().iterator(); Iterator<String> nameIt = mgr.getConnections().keySet().iterator();
Collection<String> noAuthConnections = WorkContext.getCurrent().get(DBConnectAuth.class).getNoAuthConnections();
if (noAuthConnections == null) {
return nameList.iterator();
}
while (nameIt.hasNext()) { while (nameIt.hasNext()) {
String conName = nameIt.next(); String conName = nameIt.next();
if (noAuthConnections.contains(conName)) {
continue;
}
Connection connection = mgr.getConnection(conName); Connection connection = mgr.getConnection(conName);
filterConnection(connection, conName, nameList); filterConnection(connection, conName, nameList);
} }

682
designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java

@ -1,7 +1,6 @@
package com.fr.design.data.tabledata.tabledatapane; package com.fr.design.data.tabledata.tabledatapane;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.FRContext;
import com.fr.base.Parameter; import com.fr.base.Parameter;
import com.fr.base.ParameterHelper; import com.fr.base.ParameterHelper;
import com.fr.data.core.db.TableProcedure; import com.fr.data.core.db.TableProcedure;
@ -35,17 +34,25 @@ import com.fr.design.menu.SeparatorDef;
import com.fr.design.menu.ToolBarDef; import com.fr.design.menu.ToolBarDef;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.sql.SqlUtils; import com.fr.general.sql.SqlUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.script.Calculator; import com.fr.script.Calculator;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.stable.ParameterProvider; import com.fr.stable.ParameterProvider;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.*; import javax.swing.BorderFactory;
import javax.swing.Box;
import javax.swing.BoxLayout;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JSplitPane;
import javax.swing.JToolBar;
import javax.swing.text.BadLocationException; import javax.swing.text.BadLocationException;
import javax.swing.text.Document; import javax.swing.text.Document;
import java.awt.*; import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.FocusEvent; import java.awt.event.FocusEvent;
import java.awt.event.FocusListener; import java.awt.event.FocusListener;
@ -53,334 +60,343 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
public class DBTableDataPane extends AbstractTableDataPane<DBTableData> { public class DBTableDataPane extends AbstractTableDataPane<DBTableData> {
private static final int BOTTOM = 6; private static final int BOTTOM = 6;
private static final String PREVIEW_BUTTON = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preview"); private static final String PREVIEW_BUTTON = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preview");
private static final String REFRESH_BUTTON = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Refresh"); private static final String REFRESH_BUTTON = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Refresh");
private ConnectionTableProcedurePane connectionTableProcedurePane; private ConnectionTableProcedurePane connectionTableProcedurePane;
private UITableEditorPane<ParameterProvider> editorPane; private UITableEditorPane<ParameterProvider> editorPane;
private DBTableDataMenuHandler dbTableDataMenuHandler; private DBTableDataMenuHandler dbTableDataMenuHandler;
private SQLEditPane sqlTextPane; private SQLEditPane sqlTextPane;
private UICheckBox isShareCheckBox; private UICheckBox isShareCheckBox;
private MaxMemRowCountPanel maxPanel; private MaxMemRowCountPanel maxPanel;
private String pageQuery = null; private String pageQuery = null;
private DBTableData dbTableData; private DBTableData dbTableData;
private void init() { private void init() {
this.setLayout(new BorderLayout(4, 4)); this.setLayout(new BorderLayout(4, 4));
sqlTextPane = new SQLEditPane(); sqlTextPane = new SQLEditPane();
sqlTextPane.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_SQL); sqlTextPane.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_SQL);
ParameterTableModel model = new ParameterTableModel() { ParameterTableModel model = new ParameterTableModel() {
@Override @Override
public UITableEditAction[] createAction() { public UITableEditAction[] createAction() {
return (UITableEditAction[]) ArrayUtils.add(super.createDBTableAction(), new RefreshAction()); return ArrayUtils.add(super.createDBTableAction(), new RefreshAction());
} }
}; };
editorPane = new UITableEditorPane<ParameterProvider>(model); editorPane = new UITableEditorPane<ParameterProvider>(model);
// 左边的Panel,上面是选择DatabaseConnection的ComboBox,下面DatabaseConnection对应的Table // 左边的Panel,上面是选择DatabaseConnection的ComboBox,下面DatabaseConnection对应的Table
connectionTableProcedurePane = new ConnectionTableProcedurePane() { connectionTableProcedurePane = new ConnectionTableProcedurePane() {
@Override @Override
protected void filter(Connection connection, String conName, List<String> nameList) { protected void filter(Connection connection, String conName, List<String> nameList) {
connection.addConnection(nameList, conName, new Class[]{JDBCDatabaseConnection.class, JNDIDatabaseConnection.class});
} connection.addConnection(nameList, conName, new Class[]{JDBCDatabaseConnection.class, JNDIDatabaseConnection.class});
}; }
connectionTableProcedurePane.addDoubleClickListener(new DoubleClickSelectedNodeOnTreeListener() { };
connectionTableProcedurePane.addDoubleClickListener(new DoubleClickSelectedNodeOnTreeListener() {
@Override
public void actionPerformed(TableProcedure target) { @Override
Document document = sqlTextPane.getDocument(); public void actionPerformed(TableProcedure target) {
try { Document document = sqlTextPane.getDocument();
document.insertString(sqlTextPane.getCaretPosition(), target.toString(), null); try {
} catch (BadLocationException e) { document.insertString(sqlTextPane.getCaretPosition(), target.toString(), null);
FRContext.getLogger().error(e.getMessage(), e); } catch (BadLocationException e) {
} FineLoggerFactory.getLogger().error(e.getMessage(), e);
// 这里开始作色,本来可以给sqlTextPane添加DocumentListener来实现的, }
// 后来发现insertString的时候,锁定了JTextPane,不能调用setXXX来作色,先这样了. // 这里开始作色,本来可以给sqlTextPane添加DocumentListener来实现的,
// sqlTextPane.syntaxTexts(); // 后来发现insertString的时候,锁定了JTextPane,不能调用setXXX来作色,先这样了.
sqlTextPane.requestFocus(); // sqlTextPane.syntaxTexts();
} sqlTextPane.requestFocus();
}); }
sqlTextPane.addFocusListener(new FocusListener() { });
public void focusGained(FocusEvent e) { sqlTextPane.addFocusListener(new FocusListener() {
// unsupport @Override
} public void focusGained(FocusEvent e) {
// do nothing
public void focusLost(FocusEvent e) { }
if (isPreviewOrRefreshButton(e)) {
checkParameter(); @Override
} public void focusLost(FocusEvent e) {
} if (isPreviewOrRefreshButton(e)) {
}); checkParameter();
} }
}
});
private void initMainSplitPane() { }
Box box = new Box(BoxLayout.Y_AXIS);
private void initMainSplitPane() {
JPanel northPane = new JPanel(new BorderLayout(4, 4)); Box box = new Box(BoxLayout.Y_AXIS);
JToolBar editToolBar = createToolBar();
northPane.add(editToolBar, BorderLayout.CENTER);
northPane.setBorder(BorderFactory.createEmptyBorder(0, 0, BOTTOM, 0)); JPanel northPane = new JPanel(new BorderLayout(4, 4));
JToolBar editToolBar = createToolBar();
RTextScrollPane sqlTextScrollPane = new RTextScrollPane(sqlTextPane); northPane.add(editToolBar, BorderLayout.CENTER);
sqlTextScrollPane.setLineNumbersEnabled(true); northPane.setBorder(BorderFactory.createEmptyBorder(0, 0, BOTTOM, 0));
sqlTextScrollPane.setBorder(new UIRoundedBorder(UIConstants.LINE_COLOR, 1, UIConstants.ARC));
sqlTextScrollPane.setPreferredSize(new Dimension(680, 600)); RTextScrollPane sqlTextScrollPane = new RTextScrollPane(sqlTextPane);
sqlTextScrollPane.setLineNumbersEnabled(true);
JPanel paraMeanPane = new JPanel(new BorderLayout()); sqlTextScrollPane.setBorder(new UIRoundedBorder(UIConstants.LINE_COLOR, 1, UIConstants.ARC));
paraMeanPane.setPreferredSize(new Dimension(680, 90)); sqlTextScrollPane.setPreferredSize(new Dimension(680, 600));
UILabel paraMean = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Datasource_Param_DES"));
paraMeanPane.add(paraMean, BorderLayout.CENTER); JPanel paraMeanPane = new JPanel(new BorderLayout());
paraMeanPane.setPreferredSize(new Dimension(680, 90));
UILabel paraMean = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Datasource_Param_DES"));
box.add(northPane); paraMeanPane.add(paraMean, BorderLayout.CENTER);
box.add(sqlTextScrollPane);
box.add(paraMeanPane);
box.add(editorPane); box.add(northPane);
box.add(sqlTextScrollPane);
JPanel sqlSplitPane = new JPanel(new BorderLayout(4, 4)); box.add(paraMeanPane);
sqlSplitPane.add(box, BorderLayout.CENTER); box.add(editorPane);
JPanel sqlSplitPane = new JPanel(new BorderLayout(4, 4));
box.setMinimumSize(new Dimension(310, 400)); sqlSplitPane.add(box, BorderLayout.CENTER);
// 使用SplitPane
JSplitPane mainSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true, connectionTableProcedurePane, sqlSplitPane);
mainSplitPane.setBorder(BorderFactory.createLineBorder(GUICoreUtils.getTitleLineBorderColor())); box.setMinimumSize(new Dimension(300, 400));
mainSplitPane.setOneTouchExpandable(true); // 防止数据连接名过长时影响 split pane 分割效果
this.add(mainSplitPane, BorderLayout.CENTER); connectionTableProcedurePane.setMinimumSize(new Dimension(250, 400));
} connectionTableProcedurePane.setMaximumSize(new Dimension(500, 400));
// 使用SplitPane
public DBTableDataPane() { JSplitPane mainSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true, connectionTableProcedurePane, sqlSplitPane);
init(); mainSplitPane.setBorder(BorderFactory.createLineBorder(GUICoreUtils.getTitleLineBorderColor()));
initMainSplitPane(); mainSplitPane.setOneTouchExpandable(true);
} this.add(mainSplitPane, BorderLayout.CENTER);
}
public DBTableDataPane() {
private boolean isPreviewOrRefreshButton (FocusEvent e) { init();
if (e.getOppositeComponent() != null) { initMainSplitPane();
String name = e.getOppositeComponent().getName(); }
return ComparatorUtils.equals(name, PREVIEW_BUTTON) || ComparatorUtils.equals(name, REFRESH_BUTTON);
}
return false; private boolean isPreviewOrRefreshButton(FocusEvent e) {
} if (e.getOppositeComponent() != null) {
String name = e.getOppositeComponent().getName();
@Override return ComparatorUtils.equals(name, PREVIEW_BUTTON) || ComparatorUtils.equals(name, REFRESH_BUTTON);
protected String title4PopupWindow() { }
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_DS-Database_Query"); return false;
} }
private void refresh() { @Override
String[] paramTexts = new String[2]; protected String title4PopupWindow() {
paramTexts[0] = SqlUtils.tryPureSqlText(sqlTextPane.getText()); return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_DS-Database_Query");
paramTexts[1] = SqlUtils.tryPureSqlText(pageQuery); }
List<ParameterProvider> existParameterList = editorPane.update();
Parameter[] ps = existParameterList == null ? new Parameter[0] : existParameterList.toArray(new Parameter[existParameterList.size()]); private void refresh() {
String[] paramTexts = new String[2];
editorPane.populate(ParameterHelper.analyzeAndUnionSameParameters(paramTexts, ps)); paramTexts[0] = SqlUtils.tryPureSqlText(sqlTextPane.getText());
} paramTexts[1] = SqlUtils.tryPureSqlText(pageQuery);
List<ParameterProvider> existParameterList = editorPane.update();
private JToolBar createToolBar() { Parameter[] ps = existParameterList == null ? new Parameter[0] : existParameterList.toArray(new Parameter[existParameterList.size()]);
// p:工具栏.
ToolBarDef toolBarDef = new ToolBarDef(); editorPane.populate(ParameterHelper.analyzeAndUnionSameParameters(paramTexts, ps));
toolBarDef.addShortCut(new PreviewAction()); }
toolBarDef.addShortCut(SeparatorDef.DEFAULT);
toolBarDef.addShortCut(new EditPageQueryAction()); private JToolBar createToolBar() {
dbTableDataMenuHandler = ExtraDesignClassManager.getInstance().getSingle(DBTableDataMenuHandler.MARK_STRING); // p:工具栏.
if (dbTableDataMenuHandler != null) { ToolBarDef toolBarDef = new ToolBarDef();
toolBarDef.addShortCut(SeparatorDef.DEFAULT); toolBarDef.addShortCut(new PreviewAction());
toolBarDef.addShortCut(dbTableDataMenuHandler.createQueryAction()); toolBarDef.addShortCut(SeparatorDef.DEFAULT);
} toolBarDef.addShortCut(new EditPageQueryAction());
isShareCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Is_Share_DBTableData")); dbTableDataMenuHandler = ExtraDesignClassManager.getInstance().getSingle(DBTableDataMenuHandler.MARK_STRING);
isShareCheckBox.setBackground(Color.WHITE); if (dbTableDataMenuHandler != null) {
maxPanel = new MaxMemRowCountPanel(); toolBarDef.addShortCut(SeparatorDef.DEFAULT);
maxPanel.setBorder(null); toolBarDef.addShortCut(dbTableDataMenuHandler.createQueryAction());
UIToolbar editToolBar = ToolBarDef.createJToolBar(); }
toolBarDef.updateToolBar(editToolBar); isShareCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Is_Share_DBTableData"));
editToolBar.add(isShareCheckBox); isShareCheckBox.setBackground(Color.WHITE);
editToolBar.add(maxPanel); maxPanel = new MaxMemRowCountPanel();
return editToolBar; maxPanel.setBorder(null);
} UIToolbar editToolBar = ToolBarDef.createJToolBar();
toolBarDef.updateToolBar(editToolBar);
private void checkParameter() { editToolBar.add(isShareCheckBox);
String[] paramTexts = new String[2]; editToolBar.add(maxPanel);
paramTexts[0] = sqlTextPane.getText(); return editToolBar;
paramTexts[1] = pageQuery; }
Parameter[] parameters = ParameterHelper.analyze4Parameters(paramTexts, false);
private void checkParameter() {
if (parameters.length < 1 && editorPane.update().size() < 1) { String[] paramTexts = new String[2];
return; paramTexts[0] = sqlTextPane.getText();
} paramTexts[1] = pageQuery;
boolean isIn = true; Parameter[] parameters = ParameterHelper.analyze4Parameters(paramTexts, false);
List<ParameterProvider> list = editorPane.update();
List<String> name = new ArrayList<String>(); if (parameters.length < 1 && editorPane.update().size() < 1) {
for (int i = 0; i < list.size(); i++) { return;
name.add(list.get(i).getName()); }
} boolean isIn = true;
for (int i = 0; i < parameters.length; i++) { List<ParameterProvider> list = editorPane.update();
if (!name.contains(parameters[i].getName())) { List<String> name = new ArrayList<String>();
isIn = false; for (int i = 0; i < list.size(); i++) {
break; name.add(list.get(i).getName());
} }
} for (int i = 0; i < parameters.length; i++) {
if (list.size() == parameters.length && isIn) { if (!name.contains(parameters[i].getName())) {
return; isIn = false;
} break;
// bug:34175 删了是否刷新对话框, 均直接刷新 }
refresh(); }
} if (list.size() == parameters.length && isIn) {
return;
@Override }
public void populateBean(DBTableData dbtabledata) { // bug:34175 删了是否刷新对话框, 均直接刷新
this.dbTableData = dbtabledata; refresh();
if (dbTableDataMenuHandler != null) { }
dbTableDataMenuHandler.populate(dbtabledata);
} @Override
ParameterProvider[] parameters = null; public void populateBean(DBTableData dbtabledata) {
this.dbTableData = dbtabledata;
Calculator c = Calculator.createCalculator(); if (dbTableDataMenuHandler != null) {
dbTableDataMenuHandler.populate(dbtabledata);
parameters = dbtabledata.getParameters(c); }
editorPane.populate(parameters); ParameterProvider[] parameters = null;
com.fr.data.impl.Connection db = null; Calculator c = Calculator.createCalculator();
String query = null;
boolean isShare = false; parameters = dbtabledata.getParameters(c);
int maxMemeryRow = -1; editorPane.populate(parameters);
db = dbtabledata.getDatabase(); com.fr.data.impl.Connection db = null;
query = dbtabledata.getQuery(); String query = null;
isShare = dbtabledata.isShare(); boolean isShare = false;
maxMemeryRow = dbtabledata.getMaxMemRowCount(); int maxMemeryRow = -1;
this.pageQuery = dbtabledata.getPageQuerySql();
this.connectionTableProcedurePane.setSelectedDatabaseConnection(db); db = dbtabledata.getDatabase();
this.sqlTextPane.setText(query); query = dbtabledata.getQuery();
this.sqlTextPane.requestFocus(); isShare = dbtabledata.isShare();
this.sqlTextPane.moveCaretPosition(this.sqlTextPane.getCaretPosition()); maxMemeryRow = dbtabledata.getMaxMemRowCount();
this.pageQuery = dbtabledata.getPageQuerySql();
isShareCheckBox.setSelected(isShare); this.connectionTableProcedurePane.setSelectedDatabaseConnection(db);
maxPanel.setValue(maxMemeryRow); this.sqlTextPane.setText(query);
} this.sqlTextPane.requestFocus();
this.sqlTextPane.moveCaretPosition(this.sqlTextPane.getCaretPosition());
@Override
public DBTableData updateBean() { isShareCheckBox.setSelected(isShare);
String dbName = this.connectionTableProcedurePane.getSelectedDatabaseConnnectonName(); maxPanel.setValue(maxMemeryRow);
if (StringUtils.isBlank(dbName) || StringUtils.isBlank(this.sqlTextPane.getText())) { }
try {
throw new Exception(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Connect_SQL_Cannot_Null") + "."); @Override
} catch (Exception e) { public DBTableData updateBean() {
// JOptionPane.showMessageDialog(DBTableDataPane.this, String dbName = this.connectionTableProcedurePane.getSelectedDatabaseConnnectonName();
// com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Connect_SQL_Cannot_Null") + "."); if (StringUtils.isBlank(dbName) || StringUtils.isBlank(this.sqlTextPane.getText())) {
} try {
} throw new Exception(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Connect_SQL_Cannot_Null") + ".");
} catch (Exception ignore) {
List<ParameterProvider> parameterList = editorPane.update(); // JOptionPane.showMessageDialog(DBTableDataPane.this,
Parameter[] parameters = parameterList.toArray(new Parameter[parameterList.size()]); // com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Connect_SQL_Cannot_Null") + ".");
}
dbTableData.setDatabase(new NameDatabaseConnection(dbName)); }
// p:必须先设置Parameters数组,因为setQuery里面会自动设置的 List<ParameterProvider> parameterList = editorPane.update();
Parameter[] parameters = parameterList.toArray(new Parameter[parameterList.size()]);
dbTableData.setParameters(parameters);
dbTableData.setQuery(this.sqlTextPane.getText()); dbTableData.setDatabase(new NameDatabaseConnection(dbName));
dbTableData.setShare(isShareCheckBox.isSelected()); // p:必须先设置Parameters数组,因为setQuery里面会自动设置的
dbTableData.setMaxMemRowCount(maxPanel.getValue());
dbTableData.setPageQuerySql(this.pageQuery); dbTableData.setParameters(parameters);
if (dbTableDataMenuHandler != null) { dbTableData.setQuery(this.sqlTextPane.getText());
dbTableDataMenuHandler.update();
} dbTableData.setShare(isShareCheckBox.isSelected());
return dbTableData; dbTableData.setMaxMemRowCount(maxPanel.getValue());
} dbTableData.setPageQuerySql(this.pageQuery);
if (dbTableDataMenuHandler != null) {
protected class RefreshAction extends UITableEditAction { dbTableDataMenuHandler.update();
public RefreshAction() { }
this.setName(REFRESH_BUTTON); return dbTableData;
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/control/refresh.png")); }
}
protected class RefreshAction extends UITableEditAction {
public void actionPerformed(ActionEvent e) { public RefreshAction() {
refresh(); this.setName(REFRESH_BUTTON);
} this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/control/refresh.png"));
}
@Override
public void checkEnabled() { @Override
// unsupport public void actionPerformed(ActionEvent e) {
} refresh();
} }
private class PreviewAction extends UpdateAction { @Override
public PreviewAction() { public void checkEnabled() {
this.setName(PREVIEW_BUTTON); // do nothing
this.setMnemonic('P'); }
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_file/preview.png")); }
}
private class PreviewAction extends UpdateAction {
public void actionPerformed(ActionEvent evt) { public PreviewAction() {
checkParameter(); this.setName(PREVIEW_BUTTON);
PreviewTablePane.previewTableData(DBTableDataPane.this.updateBean()); this.setMnemonic('P');
} this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_file/preview.png"));
} }
private class EditPageQueryAction extends UpdateAction { @Override
public EditPageQueryAction() { public void actionPerformed(ActionEvent evt) {
this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Layer_Page_Report_Page_Query")); checkParameter();
this.setMnemonic('L'); PreviewTablePane.previewTableData(DBTableDataPane.this.updateBean());
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_file/text.png")); }
} }
public void actionPerformed(ActionEvent e) { private class EditPageQueryAction extends UpdateAction {
final QueryPane pane = new QueryPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Layer_Page_Report_Define_Page_Query_SQL")); public EditPageQueryAction() {
pane.populate(pageQuery); this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Layer_Page_Report_Page_Query"));
BasicDialog dialog = pane.showWindow(DesignerContext.getDesignerFrame()); this.setMnemonic('L');
dialog.addDialogActionListener(new DialogActionAdapter() { this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_file/text.png"));
public void doOk() { }
pageQuery = pane.update();
checkParameter(); @Override
} public void actionPerformed(ActionEvent e) {
}); final QueryPane pane = new QueryPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Layer_Page_Report_Define_Page_Query_SQL"));
dialog.setVisible(true); pane.populate(pageQuery);
} BasicDialog dialog = pane.showWindow(DesignerContext.getDesignerFrame());
} dialog.addDialogActionListener(new DialogActionAdapter() {
@Override
private class QueryPane extends BasicPane { public void doOk() {
private SQLEditPane pageQueryPane; pageQuery = pane.update();
private String title; checkParameter();
}
public QueryPane(String title) { });
this.title = title; dialog.setVisible(true);
this.initComponents(); }
} }
public void initComponents() { private class QueryPane extends BasicPane {
this.setLayout(new BorderLayout()); private SQLEditPane pageQueryPane;
pageQueryPane = new SQLEditPane(); private String title;
this.add(new JScrollPane(pageQueryPane));
} public QueryPane(String title) {
this.title = title;
public void populate(String text) { this.initComponents();
if (StringUtils.isBlank(text)) { }
return;
} public void initComponents() {
pageQueryPane.setText(text); this.setLayout(new BorderLayout());
} pageQueryPane = new SQLEditPane();
this.add(new JScrollPane(pageQueryPane));
public String update() { }
String text = pageQueryPane.getText();
if (StringUtils.isBlank(text)) { public void populate(String text) {
return null; if (StringUtils.isBlank(text)) {
} else { return;
return text; }
} pageQueryPane.setText(text);
} }
@Override public String update() {
protected String title4PopupWindow() { String text = pageQueryPane.getText();
return title; if (StringUtils.isBlank(text)) {
} return null;
} } else {
return text;
}
}
@Override
protected String title4PopupWindow() {
return title;
}
}
} }

2
designer-base/src/main/java/com/fr/design/extra/PluginUtils.java

@ -230,7 +230,7 @@ public class PluginUtils {
jo.put("licDamaged", pluginContext.isLicDamaged()); jo.put("licDamaged", pluginContext.isLicDamaged());
jo.put("available", pluginContext.isAvailable()); jo.put("available", pluginContext.isAvailable());
jo.put("leftDays", pluginContext.getLeftDays()); jo.put("leftDays", pluginContext.getLeftDays());
jo.put("trial", pluginContext.isOnTrial()); jo.put("onTrial", pluginContext.isOnTrial());
jo.put("deadline", getDeadline(pluginContext)); jo.put("deadline", getDeadline(pluginContext));
jo.put("registerFailed", pluginContext.isRegisterFailed()); jo.put("registerFailed", pluginContext.isRegisterFailed());
ja.put(jo); ja.put(jo);

14
designer-base/src/main/java/com/fr/design/gui/itree/filetree/EnvFileTree.java

@ -146,14 +146,14 @@ public class EnvFileTree extends RefreshableJTree {
* *
* 返回currentTreeNode下是否找到了filePath * 返回currentTreeNode下是否找到了filePath
*/ */
private boolean selectFilePath(ExpandMutableTreeNode currentTreeNode, String prefix, String filePath, DefaultTreeModel m_model) { private boolean selectFilePath(ExpandMutableTreeNode currentTreeNode, String prefix, String filePath, DefaultTreeModel model) {
FileNode fileNode = (FileNode) currentTreeNode.getUserObject(); FileNode fileNode = (FileNode) currentTreeNode.getUserObject();
String nodePath = fileNode.getName(); String nodePath = fileNode.getName();
String currentTreePath = prefix + nodePath; String currentTreePath = prefix + nodePath;
// 如果equals,说明找到了,不必再找下去了 // 如果equals,说明找到了,不必再找下去了
if (ComparatorUtils.equals(new File(currentTreePath), new File(filePath))) { if (ComparatorUtils.equals(new File(currentTreePath), new File(filePath))) {
this.setSelectionPath(new TreePath(m_model.getPathToRoot(currentTreeNode))); this.setSelectionPath(new TreePath(model.getPathToRoot(currentTreeNode)));
return true; return true;
} }
// 如果当前路径是currentFilePath的ParentFile,则expandTreeNode,并继续往下找 // 如果当前路径是currentFilePath的ParentFile,则expandTreeNode,并继续往下找
@ -164,7 +164,7 @@ public class EnvFileTree extends RefreshableJTree {
for (int i = 0, len = currentTreeNode.getChildCount(); i < len; i++) { for (int i = 0, len = currentTreeNode.getChildCount(); i < len; i++) {
ExpandMutableTreeNode childTreeNode = (ExpandMutableTreeNode) currentTreeNode.getChildAt(i); ExpandMutableTreeNode childTreeNode = (ExpandMutableTreeNode) currentTreeNode.getChildAt(i);
if (selectFilePath(childTreeNode, prefix, filePath, m_model)) { if (selectFilePath(childTreeNode, prefix, filePath, model)) {
return true; return true;
} }
} }
@ -219,7 +219,7 @@ public class EnvFileTree extends RefreshableJTree {
resFns = tList.toArray(new FileNode[tList.size()]); resFns = tList.toArray(new FileNode[tList.size()]);
} }
Arrays.sort(resFns, new FileNodeComparator()); Arrays.sort(resFns, new FileNodeComparator(FRContext.getFileNodes().getSupportedTypes()));
return resFns; return resFns;
} }
@ -248,8 +248,8 @@ public class EnvFileTree extends RefreshableJTree {
*/ */
public void refreshEnv() { public void refreshEnv() {
DefaultTreeModel m_model = (DefaultTreeModel) this.getModel(); DefaultTreeModel model = (DefaultTreeModel) this.getModel();
ExpandMutableTreeNode rootTreeNode = (ExpandMutableTreeNode) m_model.getRoot(); ExpandMutableTreeNode rootTreeNode = (ExpandMutableTreeNode) model.getRoot();
rootTreeNode.removeAllChildren(); rootTreeNode.removeAllChildren();
FileNode[] fns; FileNode[] fns;
@ -273,7 +273,7 @@ public class EnvFileTree extends RefreshableJTree {
rootTreeNode.add(node); rootTreeNode.add(node);
} }
m_model.reload(rootTreeNode); model.reload(rootTreeNode);
} }
/* /*

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

@ -10,17 +10,45 @@ import java.util.Comparator;
* Directory is in the first. and normal file the in the last. * Directory is in the first. and normal file the in the last.
*/ */
public class FileNodeComparator implements Comparator<FileNode> { public class FileNodeComparator implements Comparator<FileNode> {
// 正序还是倒序 /**
private boolean isReverse = false; * 正序还是倒序
*/
public FileNodeComparator() { private boolean isReverse;
this(false);
} /**
* 文件扩展名类型
public FileNodeComparator(boolean reverse) { */
this.isReverse = reverse; private String[] supportTypes;
}
/**
* @see FileNodeComparator#FileNodeComparator(boolean, String[])
* @deprecated
*/
@Deprecated
public FileNodeComparator() {
this(false);
}
public FileNodeComparator(String[] types) {
this(false, types);
}
/**
* @param reverse 是否是倒序{@code true} 倒序{@code false} 正序
* @see FileNodeComparator#FileNodeComparator(boolean, String[])
* @deprecated
*/
@Deprecated
public FileNodeComparator(boolean reverse) {
this.isReverse = reverse;
this.supportTypes = FRContext.getFileNodes().getSupportedTypes();
}
public FileNodeComparator(boolean reverse, String[] types) {
this.isReverse = reverse;
this.supportTypes = types;
}
/** /**
* This method should return > 0 if v1 is greater than v2, 0 if * This method should return > 0 if v1 is greater than v2, 0 if
* v1 is equal to v2, or < 0 if v1 is less than v2. * v1 is equal to v2, or < 0 if v1 is less than v2.
@ -29,49 +57,48 @@ public class FileNodeComparator implements Comparator<FileNode> {
* @return < 0, 0, or > 0 for v1<v2, v1==v2, or v1>v2. * @return < 0, 0, or > 0 for v1<v2, v1==v2, or v1>v2.
*/ */
public int compare(FileNode nameNode1, FileNode nameNode2) { public int compare(FileNode nameNode1, FileNode nameNode2) {
int returnVal; int returnVal;
if (nameNode1.isDirectory()) { if (nameNode1.isDirectory()) {
if (nameNode2.isDirectory()) { if (nameNode2.isDirectory()) {
returnVal = nameNode1.getName().toLowerCase().compareTo(nameNode2.getName().toLowerCase()); returnVal = nameNode1.getName().toLowerCase().compareTo(nameNode2.getName().toLowerCase());
} else { } else {
returnVal = -1; returnVal = -1;
} }
} else { } else {
if (nameNode2.isDirectory()) { if (nameNode2.isDirectory()) {
returnVal = 1; returnVal = 1;
} else { } else {
returnVal=groupByFileType(nameNode1, nameNode2, 0); returnVal = groupByFileType(nameNode1, nameNode2, 0);
} }
} }
if (isReverse) { if (isReverse) {
returnVal = 0 - returnVal; returnVal = 0 - returnVal;
} }
return returnVal; return returnVal;
} }
/** /**
* 一个简单的递归判断算法 * 一个简单的递归判断算法依据文件类型排序
* @param nameNode1 *
* @param nameNode2 * @param nameNode1 节点1
* @param i * @param nameNode2 节点2
* @return * @param i i
* @return value
*/ */
private int groupByFileType(FileNode nameNode1, FileNode nameNode2, private int groupByFileType(FileNode nameNode1, FileNode nameNode2,
int i) { int i) {
if (i < supportTypes.length) {
String[] supportTypes = FRContext.getFileNodes().getSupportedTypes(); if (nameNode1.isFileType(supportTypes[i]))
if (i < supportTypes.length) { if (nameNode2.isFileType(supportTypes[i]))
if (nameNode1.isFileType(supportTypes[i])) return nameNode1.getName().toLowerCase().compareTo(nameNode2.getName().toLowerCase());
if (nameNode2.isFileType(supportTypes[i])) else
return nameNode1.getName().toLowerCase().compareTo(nameNode2.getName().toLowerCase()); return -1;
else else if (nameNode2.isFileType(supportTypes[i]))
return-1; return 1;
else if (nameNode2.isFileType(supportTypes[i])) else {
return 1; return groupByFileType(nameNode1, nameNode2, i + 1);
else{ }
return groupByFileType(nameNode1, nameNode2, i+1); } else
} return -1;
}else }
return -1; }
}
}

203
designer-base/src/main/java/com/fr/design/gui/itree/filetree/JFileTree.java

@ -1,5 +1,18 @@
package com.fr.design.gui.itree.filetree; package com.fr.design.gui.itree.filetree;
import com.fr.base.BaseUtils;
import com.fr.design.i18n.Toolkit;
import com.fr.general.ComparatorUtils;
import com.fr.stable.ArrayUtils;
import com.fr.stable.project.ProjectConstants;
import javax.swing.Icon;
import javax.swing.JTree;
import javax.swing.filechooser.FileSystemView;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.DefaultTreeCellRenderer;
import javax.swing.tree.DefaultTreeModel;
import javax.swing.tree.TreePath;
import java.awt.Color; import java.awt.Color;
import java.awt.Component; import java.awt.Component;
import java.awt.Font; import java.awt.Font;
@ -11,26 +24,12 @@ import java.util.Comparator;
import java.util.List; import java.util.List;
import java.util.Stack; import java.util.Stack;
import javax.swing.Icon;
import javax.swing.JTree;
import javax.swing.filechooser.FileSystemView;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.DefaultTreeCellRenderer;
import javax.swing.tree.DefaultTreeModel;
import javax.swing.tree.TreePath;
import com.fr.base.BaseUtils;
import com.fr.general.ComparatorUtils;
import com.fr.stable.ArrayUtils;
import com.fr.stable.project.ProjectConstants;
/** /**
* File Tree. * File Tree.
*/ */
public class JFileTree extends AbstractFileTree { public class JFileTree extends AbstractFileTree {
protected FileFilter fileFilter ; protected FileFilter fileFilter;
public JFileTree() { public JFileTree() {
this(null); this(null);
@ -43,9 +42,9 @@ public class JFileTree extends AbstractFileTree {
private void init(FileFilter filter) { private void init(FileFilter filter) {
this.fileFilter = filter; this.fileFilter = filter;
DefaultTreeModel m_model = new DefaultTreeModel(new DefaultMutableTreeNode(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_My_Computer"))); DefaultTreeModel treeModel = new DefaultTreeModel(new DefaultMutableTreeNode(Toolkit.i18nText("Fine-Design_Basic_My_Computer")));
this.setModel(m_model); this.setModel(treeModel);
this.putClientProperty("JTree.lineStyle", "Angled"); this.putClientProperty("JTree.lineStyle", "Angled");
this.addTreeExpansionListener(this); this.addTreeExpansionListener(this);
@ -57,7 +56,7 @@ public class JFileTree extends AbstractFileTree {
} }
public void setRootFile(File rootFile) { public void setRootFile(File rootFile) {
setRootFiles(new File[] { rootFile }); setRootFiles(new File[]{rootFile});
} }
public void setRootFiles(File[] rootFiles) { public void setRootFiles(File[] rootFiles) {
@ -65,8 +64,8 @@ public class JFileTree extends AbstractFileTree {
return; return;
} }
DefaultTreeModel m_model = (DefaultTreeModel) this.getModel(); DefaultTreeModel defaultTreeModel = (DefaultTreeModel) this.getModel();
DefaultMutableTreeNode rootTreeNode = (DefaultMutableTreeNode) m_model.getRoot(); DefaultMutableTreeNode rootTreeNode = (DefaultMutableTreeNode) defaultTreeModel.getRoot();
rootTreeNode.removeAllChildren(); rootTreeNode.removeAllChildren();
for (int k = 0; k < rootFiles.length; k++) { for (int k = 0; k < rootFiles.length; k++) {
@ -78,7 +77,7 @@ public class JFileTree extends AbstractFileTree {
} }
} }
// richer:不是LocalEnv根本就不会运行到这儿 // richer:不是LocalEnv根本就不会运行到这儿
m_model.reload(rootTreeNode); defaultTreeModel.reload(rootTreeNode);
if (rootFiles.length == 1) { if (rootFiles.length == 1) {
File expandFile = rootFiles[0]; File expandFile = rootFiles[0];
@ -96,22 +95,19 @@ public class JFileTree extends AbstractFileTree {
public File getSelectedFile() { public File getSelectedFile() {
TreePath selectedTreePath = this.getSelectionPath(); TreePath selectedTreePath = this.getSelectionPath();
if(selectedTreePath == null) { if (selectedTreePath == null) {
return null; return null;
} }
DefaultMutableTreeNode currentTreeNode = this.getMutableTreeNode(selectedTreePath); DefaultMutableTreeNode currentTreeNode = this.getMutableTreeNode(selectedTreePath);
StringBuffer fBuf = new StringBuffer(); StringBuilder fBuf = new StringBuilder();
while (true) { while (currentTreeNode != null) {
// 如果已经到了根节点,直接退出. // 如果已经到了根节点,直接退出.
if (currentTreeNode == null) {
break;
}
Object object = currentTreeNode.getUserObject(); Object object = currentTreeNode.getUserObject();
if (object instanceof RootFile) { if (object instanceof RootFile) {
// 当前文件. // 当前文件.
RootFile rootFileNode = (RootFile) object; RootFile rootFileNode = (RootFile) object;
return new File(rootFileNode.getFile() + fBuf.toString()); return new File(rootFileNode.getFile() + fBuf.toString());
} }
@ -128,6 +124,7 @@ public class JFileTree extends AbstractFileTree {
/** /**
* 通过文件夹寻找展开路径 * 通过文件夹寻找展开路径
*
* @param currentFile 当前文件 * @param currentFile 当前文件
*/ */
public void selectFile(File currentFile) { public void selectFile(File currentFile) {
@ -181,26 +178,25 @@ public class JFileTree extends AbstractFileTree {
/** /**
* 列出当前所有的File * 列出当前所有的File
*
* @param currentTreeNode 当前文件节点 * @param currentTreeNode 当前文件节点
* @return 当前节点下的所有File * @return 当前节点下的所有File
*/ */
@Override
public FileDirectoryNode[] listFileNodes(DefaultMutableTreeNode currentTreeNode) { public FileDirectoryNode[] listFileNodes(DefaultMutableTreeNode currentTreeNode) {
StringBuffer fBuf = new StringBuffer(); StringBuilder fBuf = new StringBuilder();
while (true) { while (currentTreeNode != null) {
// 如果已经到了根节点,直接退出. // 如果已经到了根节点,直接退出.
if (currentTreeNode == null) {
break;
}
Object object = currentTreeNode.getUserObject(); Object object = currentTreeNode.getUserObject();
if (object instanceof RootFile) { if (object instanceof RootFile) {
RootFile rootFileNode = (RootFile) object; RootFile rootFileNode = (RootFile) object;
// 当前文件. (rootFileNode + fBuf.toString = Path  local地址) // 当前文件. (rootFileNode + fBuf.toString = Path  local地址)
File currentFile = new File(rootFileNode.getFile() + fBuf.toString()); File currentFile = new File(rootFileNode.getFile() + fBuf.toString());
// 列出当前文件的所有子文件,要判断下是否是系统保护的文件 能否打开. 打不开的话显示为null // 列出当前文件的所有子文件,要判断下是否是系统保护的文件 能否打开. 打不开的话显示为null
File[] files = currentFile.listFiles(); File[] files = currentFile.listFiles();
// 如果文件列表为null 或者为File[0] = []返回null // 如果文件列表为null 或者为File[0] = []返回null
if (files == null ) { if (files == null) {
return new FileDirectoryNode[0]; return new FileDirectoryNode[0];
} }
List fileNodeList = new ArrayList(); List fileNodeList = new ArrayList();
for (int k = 0; k < files.length; k++) { for (int k = 0; k < files.length; k++) {
@ -211,8 +207,8 @@ public class JFileTree extends AbstractFileTree {
} }
// 过滤只显示文件夹 并进行 名字简化 // 过滤只显示文件夹 并进行 名字简化
if (fileFilter.accept(tmpFile)) { if (fileFilter.accept(tmpFile)) {
// newNode 传递 isDirectory属性 并且只显示文件夹名字 // newNode 传递 isDirectory属性 并且只显示文件夹名字
FileDirectoryNode newNode = FileDirectoryNode.createFileDirectoryNode(tmpFile); FileDirectoryNode newNode = FileDirectoryNode.createFileDirectoryNode(tmpFile);
fileNodeList.add(newNode); fileNodeList.add(newNode);
} }
} }
@ -220,78 +216,77 @@ public class JFileTree extends AbstractFileTree {
FileDirectoryNode[] fileNodes = new FileDirectoryNode[fileNodeList.size()]; FileDirectoryNode[] fileNodes = new FileDirectoryNode[fileNodeList.size()];
fileNodeList.toArray(fileNodes); fileNodeList.toArray(fileNodes);
// 对文件夹进行排序 // 对文件夹进行排序
Arrays.sort(fileNodes, new FileNodeComparator()); Arrays.sort(fileNodes, new FileDirectoryNodeComparator());
return fileNodes; return fileNodes;
} }
// 名字进行逐层反序的回加. 例: Doload ==> C:\java\Doload ,返回到文件夹的path,因为有可能是String. 所以加上instanceof // 名字进行逐层反序的回加. 例: Doload ==> C:\java\Doload ,返回到文件夹的path,因为有可能是String. 所以加上instanceof
if (object instanceof FileDirectoryNode) { if (object instanceof FileDirectoryNode) {
FileDirectoryNode nameNode = (FileDirectoryNode)object; FileDirectoryNode nameNode = (FileDirectoryNode) object;
fBuf.insert(0, nameNode.getName()); fBuf.insert(0, nameNode.getName());
fBuf.insert(0, "/"); fBuf.insert(0, "/");
} }
// 逐层返回 // 逐层返回
currentTreeNode = (DefaultMutableTreeNode) currentTreeNode.getParent(); currentTreeNode = (DefaultMutableTreeNode) currentTreeNode.getParent();
} }
return new FileDirectoryNode[0]; return new FileDirectoryNode[0];
} }
/** /**
* cellRenderer: tree中显示文件的类型图标 * cellRenderer: tree中显示文件的类型图标
*/ */
private DefaultTreeCellRenderer fileTreeCellRenderer = new DefaultTreeCellRenderer() { private DefaultTreeCellRenderer fileTreeCellRenderer = new DefaultTreeCellRenderer() {
public Component getTreeCellRendererComponent(JTree tree, Object value, @Override
boolean selected, boolean expanded, boolean leaf, int row, public Component getTreeCellRendererComponent(JTree tree, Object value,
boolean hasFocus) { boolean selected, boolean expanded, boolean leaf, int row,
super.getTreeCellRendererComponent(tree, value, selected, expanded, boolean hasFocus) {
leaf, row, hasFocus); super.getTreeCellRendererComponent(tree, value, selected, expanded,
leaf, row, hasFocus);
DefaultMutableTreeNode treeNode = (DefaultMutableTreeNode) value;
StringBuffer fBuf = new StringBuffer(); DefaultMutableTreeNode treeNode = (DefaultMutableTreeNode) value;
while(true) { StringBuilder fBuf = new StringBuilder();
if (treeNode == null) { while (treeNode != null) {
break; Object userObj = treeNode.getUserObject();
} if (userObj instanceof RootFile) {
Object userObj = treeNode.getUserObject(); RootFile rootFileNode = (RootFile) userObj;
if (userObj instanceof RootFile) { // 当前文件的全部路径. (rootFileNode + fBuf.toString = Path  local地址)
RootFile rootFileNode = (RootFile) userObj; File currentFile = new File(rootFileNode.getFile() + fBuf.toString());
// 当前文件的全部路径. (rootFileNode + fBuf.toString = Path  local地址) FileSystemView view = FileSystemView.getFileSystemView();
File currentFile = new File(rootFileNode.getFile() + fBuf.toString()); // File的全部路径.
FileSystemView view = FileSystemView.getFileSystemView(); // 得到本地tree图标
// File的全部路径. Icon tmpIcon = view.getSystemIcon(currentFile);
// 得到本地tree图标
Icon tmpIcon = view.getSystemIcon(currentFile);
if (currentFile.isDirectory() && fBuf.length() > 0) { if (currentFile.isDirectory() && fBuf.length() > 0) {
tmpIcon=BaseUtils.readIcon("/com/fr/design/images/gui/folder.png"); tmpIcon = BaseUtils.readIcon("/com/fr/design/images/gui/folder.png");
} }
this.setIcon(tmpIcon); this.setIcon(tmpIcon);
this.setName(null); this.setName(null);
Font oldFont = this.getFont(); Font oldFont = this.getFont();
if(ComparatorUtils.equals(currentFile.getName(), ProjectConstants.WEBINF_NAME)){ if (ComparatorUtils.equals(currentFile.getName(), ProjectConstants.WEBINF_NAME)) {
this.setForeground(Color.blue); this.setForeground(Color.blue);
this.setFont(new Font(oldFont.getName(),1,oldFont.getSize())); this.setFont(new Font(oldFont.getName(), Font.BOLD, oldFont.getSize()));
}else{ } else {
this.setFont(new Font(oldFont.getName(),0,oldFont.getSize())); this.setFont(new Font(oldFont.getName(), Font.PLAIN, oldFont.getSize()));
} }
} }
// 名字进行逐层反序的回加. 例: Doload ==> C:\java\Doload // 名字进行逐层反序的回加. 例: Doload ==> C:\java\Doload
if (userObj instanceof FileDirectoryNode ) { if (userObj instanceof FileDirectoryNode) {
FileDirectoryNode nameNode = (FileDirectoryNode)userObj; FileDirectoryNode nameNode = (FileDirectoryNode) userObj;
fBuf.insert(0, nameNode.getName()); fBuf.insert(0, nameNode.getName());
fBuf.insert(0, "/"); fBuf.insert(0, "/");
} }
// 逐层往上 倒退返回 // 逐层往上 倒退返回
treeNode = (DefaultMutableTreeNode) treeNode.getParent(); treeNode = (DefaultMutableTreeNode) treeNode.getParent();
} }
return this; return this;
} }
}; };
/** /**
* 对文件夹进行排序 先文件夹 然后各种类型文件 * 对文件夹进行排序 先文件夹 然后各种类型文件
*
* @author kunsnat * @author kunsnat
*/ */
public class FileNodeComparator implements Comparator { public class FileDirectoryNodeComparator implements Comparator<FileDirectoryNode> {
/** /**
* This method should return > 0 if v1 is greater than v2, 0 if * This method should return > 0 if v1 is greater than v2, 0 if
* v1 is equal to v2, or < 0 if v1 is less than v2. * v1 is equal to v2, or < 0 if v1 is less than v2.
@ -302,21 +297,19 @@ public class JFileTree extends AbstractFileTree {
* @param v2 comparison value.值2 * @param v2 comparison value.值2
* @return < 0, 0, or > 0 for v1<v2, v1==v2, or v1>v2 .值1大于值2返回大于0相等返回0小于和大于相反 * @return < 0, 0, or > 0 for v1<v2, v1==v2, or v1>v2 .值1大于值2返回大于0相等返回0小于和大于相反
*/ */
public int compare(Object v1, Object v2) { @Override
FileDirectoryNode nameNode1 = (FileDirectoryNode) v1; public int compare(FileDirectoryNode v1, FileDirectoryNode v2) {
FileDirectoryNode nameNode2 = (FileDirectoryNode) v2; if (v1.isDirectory()) {
if (v2.isDirectory()) {
if (nameNode1.isDirectory()) { return v1.getName().toLowerCase().compareTo(v2.getName().toLowerCase());
if (nameNode2.isDirectory()) {
return nameNode1.getName().toLowerCase().compareTo(nameNode2.getName().toLowerCase());
} else { } else {
return -1; return -1;
} }
} else { } else {
if (nameNode2.isDirectory()) { if (v2.isDirectory()) {
return 1; return 1;
} else { } else {
return nameNode1.getName().toLowerCase().compareTo(nameNode2.getName().toLowerCase()); return v1.getName().toLowerCase().compareTo(v2.getName().toLowerCase());
} }
} }
} }

2
designer-base/src/main/java/com/fr/design/gui/itree/filetree/TemplateFileTree.java

@ -217,7 +217,7 @@ public class TemplateFileTree extends EnvFileTree {
fileNodes = list.toArray(new FileNode[list.size()]); fileNodes = list.toArray(new FileNode[list.size()]);
} }
Arrays.sort(fileNodes, new FileNodeComparator()); Arrays.sort(fileNodes, new FileNodeComparator(FRContext.getFileNodes().getSupportedTypes()));
return fileNodes; return fileNodes;
} }

6
designer-base/src/main/java/com/fr/design/mingche.java

@ -1,6 +0,0 @@
package com.fr.design;
public class mingche
{
}

16
designer-base/src/main/java/com/fr/design/onlineupdate/domain/UpdateConstants.java

@ -4,7 +4,11 @@ package com.fr.design.onlineupdate.domain;
* Created by XINZAI on 2018/8/21. * Created by XINZAI on 2018/8/21.
*/ */
import com.fr.third.org.apache.commons.collections4.collection.UnmodifiableCollection;
import com.fr.third.org.apache.commons.collections4.list.UnmodifiableList;
import java.awt.Color; import java.awt.Color;
import java.util.Arrays;
/** /**
* 更新升级的常量 * 更新升级的常量
@ -28,7 +32,7 @@ public interface UpdateConstants {
int BYTE = 153600; int BYTE = 153600;
String[] JARS_FOR_SERVER_X = new String[]{ UnmodifiableList JARS_FOR_SERVER_X = new UnmodifiableList(Arrays.asList(new String[]{
"fine-activator-10.0.jar", "fine-activator-10.0.jar",
"fine-core-10.0.jar", "fine-core-10.0.jar",
"fine-report-engine-10.0.jar", "fine-report-engine-10.0.jar",
@ -41,16 +45,16 @@ public interface UpdateConstants {
"fine-datasource-10.0.jar", "fine-datasource-10.0.jar",
"fine-third-10.0.jar", "fine-third-10.0.jar",
"fine-accumulator-10.0.jar" "fine-accumulator-10.0.jar"
}; }));
String[] JARS_FOR_DESIGNER_X = new String[]{ UnmodifiableList JARS_FOR_DESIGNER_X = new UnmodifiableList(Arrays.asList(new String[]{
"fine-report-designer-10.0.jar", "fine-report-designer-10.0.jar",
"aspectjrt.jar" "aspectjrt.jar"
}; }));
String[] LOG_TYPE = new String[]{ UnmodifiableList LOG_TYPE = new UnmodifiableList(Arrays.asList(new String[]{
"REPORT", "MOBILE", "CHART", "PFC", "BI" "REPORT", "MOBILE", "CHART", "PFC", "BI"
}; }));
} }

5
designer-base/src/main/java/com/fr/design/onlineupdate/ui/dialog/RestoreResultDialog.java

@ -27,6 +27,7 @@ import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
@ -161,7 +162,7 @@ public class RestoreResultDialog extends JDialog {
} }
private void putJarBackupFilesToInstallLib(String installHome, Map<String, String> map, java.util.List<String> list) { private void putJarBackupFilesToInstallLib(String installHome, Map<String, String> map, java.util.List<String> list) {
String[] files = UpdateConstants.JARS_FOR_DESIGNER_X; List<String> files = UpdateConstants.JARS_FOR_DESIGNER_X;
String backupDir = UpdateConstants.DESIGNER_BACKUP_DIR; String backupDir = UpdateConstants.DESIGNER_BACKUP_DIR;
for (String file : files) { for (String file : files) {
map.put(StableUtils.pathJoin(installHome, backupDir, jarRestoreDir, file), map.put(StableUtils.pathJoin(installHome, backupDir, jarRestoreDir, file),
@ -171,7 +172,7 @@ public class RestoreResultDialog extends JDialog {
} }
private void putJarBackupFilesToInstallEnv(String installHome, Map<String, String> map, java.util.List<String> list) { private void putJarBackupFilesToInstallEnv(String installHome, Map<String, String> map, java.util.List<String> list) {
String[] files = UpdateConstants.JARS_FOR_SERVER_X; List<String> files = UpdateConstants.JARS_FOR_SERVER_X;
String backupDir = UpdateConstants.DESIGNER_BACKUP_DIR; String backupDir = UpdateConstants.DESIGNER_BACKUP_DIR;
for (String file : files) { for (String file : files) {
map.put(StableUtils.pathJoin(installHome, backupDir, jarRestoreDir, file), map.put(StableUtils.pathJoin(installHome, backupDir, jarRestoreDir, file),

36
designer-base/src/main/java/com/fr/design/onlineupdate/ui/dialog/UpdateMainDialog.java

@ -58,12 +58,7 @@ import java.awt.Dimension;
import java.awt.Frame; import java.awt.Frame;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.io.BufferedReader; import java.io.*;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.text.ParsePosition; import java.text.ParsePosition;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
@ -443,8 +438,8 @@ public class UpdateMainDialog extends UIDialog {
return; return;
} }
if (cacheFile.exists()) { if (cacheFile.exists()) {
FileReader reader = new FileReader(cacheFile); InputStreamReader streamReader = new InputStreamReader(new FileInputStream(cacheFile), "UTF-8");
BufferedReader br = new BufferedReader(reader); BufferedReader br = new BufferedReader(streamReader);
String readStr, updateTimeStr; String readStr, updateTimeStr;
while ((readStr = br.readLine()) != null) { while ((readStr = br.readLine()) != null) {
@ -466,7 +461,7 @@ public class UpdateMainDialog extends UIDialog {
} }
} }
br.close(); br.close();
reader.close(); streamReader.close();
} }
} }
@ -490,8 +485,8 @@ public class UpdateMainDialog extends UIDialog {
if (endTime.equals(lastUpdateCacheTime) || jsonArray.length() == 0 || ComparatorUtils.compare(endTime, lastUpdateCacheTime) <= 0) { if (endTime.equals(lastUpdateCacheTime) || jsonArray.length() == 0 || ComparatorUtils.compare(endTime, lastUpdateCacheTime) <= 0) {
return; return;
} }
FileWriter fileWriter = new FileWriter(cacheFile, true); OutputStreamWriter writerStream = new OutputStreamWriter(new FileOutputStream(cacheFile), "UTF-8");
BufferedWriter bufferWriter = new BufferedWriter(fileWriter); BufferedWriter bufferWriter = new BufferedWriter(writerStream);
for (int i = 0; i < jsonArray.length(); i++) { for (int i = 0; i < jsonArray.length(); i++) {
JSONObject jo = (JSONObject) jsonArray.get(i); JSONObject jo = (JSONObject) jsonArray.get(i);
bufferWriter.write((String) jo.get("update") + '\t' + jo.get("title")); bufferWriter.write((String) jo.get("update") + '\t' + jo.get("title"));
@ -499,7 +494,7 @@ public class UpdateMainDialog extends UIDialog {
bufferWriter.flush(); bufferWriter.flush();
} }
bufferWriter.close(); bufferWriter.close();
fileWriter.close(); writerStream.close();
lastUpdateCacheState = UPDATE_CACHE_STATE_SUCCESS; lastUpdateCacheState = UPDATE_CACHE_STATE_SUCCESS;
lastUpdateCacheTime = endTime; lastUpdateCacheTime = endTime;
cacheProperty.updateProperty("updateTime", lastUpdateCacheTime); cacheProperty.updateProperty("updateTime", lastUpdateCacheTime);
@ -678,7 +673,7 @@ public class UpdateMainDialog extends UIDialog {
jarCurrentLabel.setText(downloadFileConfig.optString("buildNO")); jarCurrentLabel.setText(downloadFileConfig.optString("buildNO"));
} }
private void backupFilesFromInstallEnv(String installHome, String todayBackupDir, String[] files) { private void backupFilesFromInstallEnv(String installHome, String todayBackupDir, List<String> files) {
for (String file : files) { for (String file : files) {
try { try {
IOUtils.copy( IOUtils.copy(
@ -690,7 +685,7 @@ public class UpdateMainDialog extends UIDialog {
} }
} }
private void backupFilesFromInstallLib(String installHome, String todayBackupDir, String[] files) { private void backupFilesFromInstallLib(String installHome, String todayBackupDir, List<String> files) {
for (String file : files) { for (String file : files) {
try { try {
IOUtils.copy( IOUtils.copy(
@ -734,21 +729,22 @@ public class UpdateMainDialog extends UIDialog {
} }
//获取服务器jar包列表 //获取服务器jar包列表
private String[] getJARList4Server() { private List<String> getJARList4Server() {
return UpdateConstants.JARS_FOR_SERVER_X; return UpdateConstants.JARS_FOR_SERVER_X;
} }
//获取设计器jar包列表 //获取设计器jar包列表
private String[] getJARList4Designer() { private List<String> getJARList4Designer() {
return UpdateConstants.JARS_FOR_DESIGNER_X; return UpdateConstants.JARS_FOR_DESIGNER_X;
} }
//获取服务器jar包下载列表 //获取服务器jar包下载列表
private String[] getDownLoadJAR4Server() { private String[] getDownLoadJAR4Server() {
ArrayList<String> jarList = new ArrayList<String>(); ArrayList<String> jarList = new ArrayList<String>();
List<String> serverItems = getJARList4Server();
for (DownloadItem downloadItem : downloadItems) { for (DownloadItem downloadItem : downloadItems) {
String downloadItemName = downloadItem.getName(); String downloadItemName = downloadItem.getName();
if (ArrayUtils.contains(getJARList4Server(), downloadItemName)) { if (serverItems.contains(downloadItemName)) {
jarList.add(downloadItemName); jarList.add(downloadItemName);
} }
} }
@ -758,9 +754,10 @@ public class UpdateMainDialog extends UIDialog {
//获取设计器jar包下载列表 //获取设计器jar包下载列表
private String[] getDownLoadJAR4Designer() { private String[] getDownLoadJAR4Designer() {
ArrayList<String> jarList = new ArrayList<String>(); ArrayList<String> jarList = new ArrayList<String>();
List<String> designerJarItems = getJARList4Designer();
for (DownloadItem downloadItem : downloadItems) { for (DownloadItem downloadItem : downloadItems) {
String downloadItemName = downloadItem.getName(); String downloadItemName = downloadItem.getName();
if (ArrayUtils.contains(getJARList4Designer(), downloadItemName)) { if (designerJarItems.contains(downloadItemName)) {
jarList.add(downloadItemName); jarList.add(downloadItemName);
} }
} }
@ -791,7 +788,8 @@ public class UpdateMainDialog extends UIDialog {
//判断是否是有效的日志内容 //判断是否是有效的日志内容
private boolean isValidLogInfo(String logContent) { private boolean isValidLogInfo(String logContent) {
String log = logContent.toUpperCase(); String log = logContent.toUpperCase();
for (String s : UpdateConstants.LOG_TYPE) { List<String> logType = UpdateConstants.LOG_TYPE;
for (String s : logType) {
if (log.startsWith(s)) { if (log.startsWith(s)) {
return true; return true;
} }

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

@ -211,7 +211,7 @@ public class FileNodeFILE implements FILE {
try { try {
FileNode[] nodeArray; FileNode[] nodeArray;
nodeArray = listFile(node.getEnvPath()); nodeArray = listFile(node.getEnvPath());
Arrays.sort(nodeArray, new FileNodeComparator()); Arrays.sort(nodeArray, new FileNodeComparator(FRContext.getFileNodes().getSupportedTypes()));
return fileNodeArray2FILEArray(nodeArray, envPath); return fileNodeArray2FILEArray(nodeArray, envPath);
} catch (Exception e) { } catch (Exception e) {
@ -240,7 +240,7 @@ public class FileNodeFILE implements FILE {
return FRContext.getFileNodes().list(rootFilePath); return FRContext.getFileNodes().list(rootFilePath);
} }
} catch (Exception e) { } catch (Exception e) {
FRContext.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
return new FileNode[0]; return new FileNode[0];
} }
@ -280,7 +280,7 @@ public class FileNodeFILE implements FILE {
try { try {
return FRContext.getCommonOperator().fileLocked(node.getEnvPath()); return FRContext.getCommonOperator().fileLocked(node.getEnvPath());
} catch (Exception e) { } catch (Exception e) {
FRContext.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
return false; return false;
} }
} }
@ -304,7 +304,7 @@ public class FileNodeFILE implements FILE {
try { try {
return WorkContext.getWorkResource().exist(node.getEnvPath()); return WorkContext.getWorkResource().exist(node.getEnvPath());
} catch (Exception e) { } catch (Exception e) {
FRContext.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
return false; return false;
} }
} }

6
designer-chart/src/main/java/com/fr/design/ChartTypeInterfaceManager.java

@ -61,6 +61,7 @@ import com.fr.plugin.injectable.PluginModule;
import com.fr.plugin.injectable.PluginSingleInjection; import com.fr.plugin.injectable.PluginSingleInjection;
import com.fr.plugin.solution.closeable.CloseableContainedMap; import com.fr.plugin.solution.closeable.CloseableContainedMap;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.stable.AssistUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.stable.plugin.ExtraChartDesignClassManagerProvider; import com.fr.stable.plugin.ExtraChartDesignClassManagerProvider;
import com.fr.van.chart.area.AreaIndependentVanChartInterface; import com.fr.van.chart.area.AreaIndependentVanChartInterface;
@ -107,6 +108,8 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr
private static Map<String, String> idAndPriorityMap = new HashMap<String, String>(); private static Map<String, String> idAndPriorityMap = new HashMap<String, String>();
public static final String TYPE_PANE_DEFAULT_TITLE = "DEFAULT_NAME";
public synchronized static ChartTypeInterfaceManager getInstance() { public synchronized static ChartTypeInterfaceManager getInstance() {
return classManager; return classManager;
@ -260,6 +263,9 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr
String plotID = entry.getKey(); String plotID = entry.getKey();
AbstractChartTypePane pane = entry.getValue().getPlotTypePane(); AbstractChartTypePane pane = entry.getValue().getPlotTypePane();
if (AssistUtils.equals(pane.title4PopupWindow(), TYPE_PANE_DEFAULT_TITLE)) {
continue;
}
pane.setPlotID(plotID); pane.setPlotID(plotID);
paneList.add(pane); paneList.add(pane);

8
designer-chart/src/main/java/com/fr/design/chart/fun/impl/AbstractIndependentChartsUI.java

@ -1,6 +1,7 @@
package com.fr.design.chart.fun.impl; package com.fr.design.chart.fun.impl;
import com.fr.chart.chartattr.Plot; import com.fr.chart.chartattr.Plot;
import com.fr.design.ChartTypeInterfaceManager;
import com.fr.design.beans.BasicBeanPane; import com.fr.design.beans.BasicBeanPane;
import com.fr.design.chart.fun.IndependentChartUIProvider; import com.fr.design.chart.fun.IndependentChartUIProvider;
import com.fr.design.condition.ConditionAttributesPane; import com.fr.design.condition.ConditionAttributesPane;
@ -40,7 +41,12 @@ public abstract class AbstractIndependentChartsUI extends AbstractProvider imple
@Override @Override
public AbstractChartTypePane getPlotTypePane() { public AbstractChartTypePane getPlotTypePane() {
return new PiePlotPane(); return new PiePlotPane() {
@Override
public String title4PopupWindow() {
return ChartTypeInterfaceManager.TYPE_PANE_DEFAULT_TITLE;
}
};
} }
@Override @Override

12
designer-chart/src/main/java/com/fr/extended/chart/UIComboBoxWithNone.java

@ -10,25 +10,25 @@ import java.util.List;
*/ */
public class UIComboBoxWithNone extends UIComboBox { public class UIComboBoxWithNone extends UIComboBox {
private static String getNoneLocaleString() { protected String getDefaultLocaleString() {
return Toolkit.i18nText("Fine-Design_Chart_Use_None"); return Toolkit.i18nText("Fine-Design_Chart_Use_None");
} }
@Override @Override
public void refreshBoxItems(List list) { public void refreshBoxItems(List list) {
super.refreshBoxItems(list); super.refreshBoxItems(list);
addNoneItem(); addDefaultItem();
} }
@Override @Override
public void clearBoxItems() { public void clearBoxItems() {
super.clearBoxItems(); super.clearBoxItems();
addNoneItem(); addDefaultItem();
} }
private void addNoneItem() { private void addDefaultItem() {
addItem(getNoneLocaleString()); addItem(getDefaultLocaleString());
} }
@ -37,7 +37,7 @@ public class UIComboBoxWithNone extends UIComboBox {
super.setSelectedItem(anObject); super.setSelectedItem(anObject);
if (getSelectedIndex() == -1) {//找不到的都选中无。中文的无 英文下是none。 if (getSelectedIndex() == -1) {//找不到的都选中无。中文的无 英文下是none。
super.setSelectedItem(getNoneLocaleString()); super.setSelectedItem(getDefaultLocaleString());
} }
} }

4
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/AlphaFineHelper.java

@ -14,7 +14,7 @@ import com.fr.design.mainframe.alphafine.search.manager.impl.HotIssuesManager;
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.alphafine.search.manager.impl.SimilarSearchManeger; import com.fr.design.mainframe.alphafine.search.manager.impl.SimilarSearchManager;
import com.fr.general.ProcessCanceledException; import com.fr.general.ProcessCanceledException;
import com.fr.general.http.HttpToolbox; import com.fr.general.http.HttpToolbox;
import com.fr.json.JSONArray; import com.fr.json.JSONArray;
@ -142,7 +142,7 @@ public class AlphaFineHelper {
result.add(0, new MoreModel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Community_Help"))); result.add(0, new MoreModel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Community_Help")));
} else if (object instanceof PluginSearchManager) { } else if (object instanceof PluginSearchManager) {
result.add(0, new MoreModel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Plugin_Addon"))); result.add(0, new MoreModel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Plugin_Addon")));
} else if (object instanceof SimilarSearchManeger) { } else if (object instanceof SimilarSearchManager) {
result.add(0, new MoreModel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_AlphaFine_Relation_Item"))); result.add(0, new MoreModel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_AlphaFine_Relation_Item")));
} else if (object instanceof HotIssuesManager) { } else if (object instanceof HotIssuesManager) {
return new SearchResult(); return new SearchResult();

4
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/cell/CellModelHelper.java

@ -6,7 +6,7 @@ import com.fr.design.mainframe.alphafine.search.manager.impl.ActionSearchManager
import com.fr.design.mainframe.alphafine.search.manager.impl.DocumentSearchManager; import com.fr.design.mainframe.alphafine.search.manager.impl.DocumentSearchManager;
import com.fr.design.mainframe.alphafine.search.manager.impl.FileSearchManager; 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.SimilarSearchManeger; import com.fr.design.mainframe.alphafine.search.manager.impl.SimilarSearchManager;
import com.fr.json.JSONObject; import com.fr.json.JSONObject;
/** /**
@ -34,7 +34,7 @@ public class CellModelHelper {
break; break;
case ROBOT: case ROBOT:
case RECOMMEND_ROBOT: case RECOMMEND_ROBOT:
cellModel = SimilarSearchManeger.getModelFromCloud(object.optJSONObject(RESULT)); cellModel = SimilarSearchManager.getModelFromCloud(object.optJSONObject(RESULT));
break; break;
} }
return cellModel; return cellModel;

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

@ -32,7 +32,7 @@ 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.alphafine.search.manager.impl.SegmentationManager; import com.fr.design.mainframe.alphafine.search.manager.impl.SegmentationManager;
import com.fr.design.mainframe.alphafine.search.manager.impl.SimilarSearchManeger; import com.fr.design.mainframe.alphafine.search.manager.impl.SimilarSearchManager;
import com.fr.design.mainframe.errorinfo.ErrorInfoUploader; import com.fr.design.mainframe.errorinfo.ErrorInfoUploader;
import com.fr.design.mainframe.templateinfo.TemplateInfoCollector; import com.fr.design.mainframe.templateinfo.TemplateInfoCollector;
import com.fr.form.main.Form; import com.fr.form.main.Form;
@ -573,7 +573,7 @@ public class AlphaFineDialog extends UIDialog {
} }
private void buildSimilarList(final String[] searchText) { private void buildSimilarList(final String[] searchText) {
addSearchResult(SimilarSearchManeger.getInstance().getLessSearchResult(searchText)); addSearchResult(SimilarSearchManager.getInstance().getLessSearchResult(searchText));
} }
private synchronized void addSearchResult(SearchResult searchResult) { private synchronized void addSearchResult(SearchResult searchResult) {
@ -1052,7 +1052,7 @@ public class AlphaFineDialog extends UIDialog {
break; break;
case ROBOT: case ROBOT:
case RECOMMEND_ROBOT: case RECOMMEND_ROBOT:
moreResult = SimilarSearchManeger.getInstance().getMoreSearchResult(searchTextField.getText()); moreResult = SimilarSearchManager.getInstance().getMoreSearchResult(searchTextField.getText());
break; break;
case RECOMMEND: case RECOMMEND:
moreResult = RecommendSearchManager.getInstance().getMoreSearchResult(searchTextField.getText()); moreResult = RecommendSearchManager.getInstance().getMoreSearchResult(searchTextField.getText());

10
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/SimilarSearchManeger.java → designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/SimilarSearchManager.java

@ -17,16 +17,16 @@ import com.fr.third.org.apache.commons.codec.digest.DigestUtils;
/** /**
* Created by alex.sung on 2018/8/3. * Created by alex.sung on 2018/8/3.
*/ */
public class SimilarSearchManeger implements AlphaFineSearchProvider { public class SimilarSearchManager implements AlphaFineSearchProvider {
private static volatile SimilarSearchManeger instance; private static volatile SimilarSearchManager instance;
private SearchResult lessModelList; private SearchResult lessModelList;
private SearchResult moreModelList = new SearchResult(); private SearchResult moreModelList = new SearchResult();
public static SimilarSearchManeger getInstance() { public static SimilarSearchManager getInstance() {
if (instance == null) { if (instance == null) {
synchronized (SimilarSearchManeger.class) { synchronized (SimilarSearchManager.class) {
if (instance == null) { if (instance == null) {
instance = new SimilarSearchManeger(); instance = new SimilarSearchManager();
} }
} }
} }

BIN
designer-realize/src/main/resources/com/fr/start/jni/splash.dylib

Binary file not shown.

10
designer-realize/src/test/java/com.fr/design/mainframe/alphafine/search/manager/impl/SearchManegerTest.java

@ -9,7 +9,7 @@ import org.junit.Before;
import org.junit.Test; import org.junit.Test;
public class SearchManegerTest { public class SearchManegerTest {
SimilarSearchManeger similarSearchManeger; SimilarSearchManager similarSearchManager;
ComplementAdviceManager complementAdviceManager; ComplementAdviceManager complementAdviceManager;
DocumentSearchManager documentSearchManager; DocumentSearchManager documentSearchManager;
PluginSearchManager pluginSearchManager; PluginSearchManager pluginSearchManager;
@ -23,7 +23,7 @@ public class SearchManegerTest {
public void setUp() { public void setUp() {
recentSearchManager = RecentSearchManager.getInstance(); recentSearchManager = RecentSearchManager.getInstance();
recommendSearchManager = RecommendSearchManager.getInstance(); recommendSearchManager = RecommendSearchManager.getInstance();
similarSearchManeger = SimilarSearchManeger.getInstance(); similarSearchManager = SimilarSearchManager.getInstance();
complementAdviceManager = ComplementAdviceManager.getInstance(); complementAdviceManager = ComplementAdviceManager.getInstance();
documentSearchManager = DocumentSearchManager.getInstance(); documentSearchManager = DocumentSearchManager.getInstance();
pluginSearchManager = PluginSearchManager.getInstance(); pluginSearchManager = PluginSearchManager.getInstance();
@ -43,7 +43,7 @@ public class SearchManegerTest {
lessModelList = recentSearchManager.getLessSearchResult(new String[]{"数据集"}); lessModelList = recentSearchManager.getLessSearchResult(new String[]{"数据集"});
Assert.assertNotNull(lessModelList); Assert.assertNotNull(lessModelList);
lessModelList = similarSearchManeger.getLessSearchResult(new String[]{"数据集"}); lessModelList = similarSearchManager.getLessSearchResult(new String[]{"数据集"});
Assert.assertEquals(lessModelList.get(1).getType(), CellType.ROBOT); Assert.assertEquals(lessModelList.get(1).getType(), CellType.ROBOT);
lessModelList = complementAdviceManager.getAllSearchResult(new String[]{"数据集"}); lessModelList = complementAdviceManager.getAllSearchResult(new String[]{"数据集"});
@ -51,7 +51,7 @@ public class SearchManegerTest {
//返回MoreSearchResult //返回MoreSearchResult
SearchResult moreModelList; SearchResult moreModelList;
moreModelList = similarSearchManeger.getMoreSearchResult("数据集"); moreModelList = similarSearchManager.getMoreSearchResult("数据集");
Assert.assertNotNull(moreModelList); Assert.assertNotNull(moreModelList);
moreModelList = recommendSearchManager.getMoreSearchResult("数据集"); moreModelList = recommendSearchManager.getMoreSearchResult("数据集");
@ -60,7 +60,7 @@ public class SearchManegerTest {
@Test @Test
public void getModelFromCloudTest() { public void getModelFromCloudTest() {
Assert.assertNotNull(SimilarSearchManeger.getModelFromCloud(new JSONObject())); Assert.assertNotNull(SimilarSearchManager.getModelFromCloud(new JSONObject()));
Assert.assertNotNull(DocumentSearchManager.getModelFromCloud(new JSONObject())); Assert.assertNotNull(DocumentSearchManager.getModelFromCloud(new JSONObject()));
Assert.assertNotNull(PluginSearchManager.getModelFromCloud(new JSONObject())); Assert.assertNotNull(PluginSearchManager.getModelFromCloud(new JSONObject()));
} }

Loading…
Cancel
Save