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
a5b6ac0431
  1. 682
      designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java
  2. 2
      designer-base/src/main/java/com/fr/design/extra/PluginUtils.java
  3. 6
      designer-chart/src/main/java/com/fr/design/ChartTypeInterfaceManager.java
  4. 8
      designer-chart/src/main/java/com/fr/design/chart/fun/impl/AbstractIndependentChartsUI.java
  5. 12
      designer-chart/src/main/java/com/fr/extended/chart/UIComboBoxWithNone.java
  6. 9
      designer-chart/src/main/java/com/fr/van/chart/range/component/SectionIntervalConfigPaneWithOutNum.java
  7. 4
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/AlphaFineHelper.java
  8. 4
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/cell/CellModelHelper.java
  9. 6
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java
  10. 10
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/SimilarSearchManager.java
  11. 10
      designer-realize/src/test/java/com.fr/design/mainframe/alphafine/search/manager/impl/SearchManegerTest.java

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);

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());
} }
} }

9
designer-chart/src/main/java/com/fr/van/chart/range/component/SectionIntervalConfigPaneWithOutNum.java

@ -3,6 +3,7 @@ package com.fr.van.chart.range.component;
import com.fr.chart.chartglyph.MapHotAreaColor; import com.fr.chart.chartglyph.MapHotAreaColor;
import com.fr.design.gui.frpane.AbstractAttrNoScrollPane; import com.fr.design.gui.frpane.AbstractAttrNoScrollPane;
import com.fr.design.gui.ilable.BoldFontTextLabel; import com.fr.design.gui.ilable.BoldFontTextLabel;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.chart.gui.style.series.MapColorPickerPaneWithFormula; import com.fr.design.mainframe.chart.gui.style.series.MapColorPickerPaneWithFormula;
import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.TableLayout4VanChartHelper;
@ -19,6 +20,10 @@ import java.awt.Dimension;
public class SectionIntervalConfigPaneWithOutNum extends MapColorPickerPaneWithFormula { public class SectionIntervalConfigPaneWithOutNum extends MapColorPickerPaneWithFormula {
private BoldFontTextLabel numLabel; private BoldFontTextLabel numLabel;
public String getNameOfSubRange() {
return Toolkit.i18nText("Fine-Design_Chart_Range_Num");
}
public SectionIntervalConfigPaneWithOutNum(AbstractAttrNoScrollPane container) { public SectionIntervalConfigPaneWithOutNum(AbstractAttrNoScrollPane container) {
super(container); super(container);
getDesignTypeButtonGroup().addChangeListener(new ChangeListener() { getDesignTypeButtonGroup().addChangeListener(new ChangeListener() {
@ -49,12 +54,12 @@ public class SectionIntervalConfigPaneWithOutNum extends MapColorPickerPaneWithF
@Override @Override
protected Component[][] createComponents() { protected Component[][] createComponents() {
numLabel = new BoldFontTextLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Value_Divided_Stage")); numLabel = new BoldFontTextLabel(Toolkit.i18nText("Fine-Design_Chart_Value_Divided_Stage"));
setRegionVisible(false); setRegionVisible(false);
return new Component[][]{ return new Component[][]{
new Component[]{new BoldFontTextLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Range_Num")), getDesignTypeButtonGroup()}, new Component[]{new BoldFontTextLabel(getNameOfSubRange()), getDesignTypeButtonGroup()},
new Component[]{numLabel, getRegionNumPane()}, new Component[]{numLabel, getRegionNumPane()},
}; };
} }

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();
} }
} }
} }

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