Browse Source

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

* commit 'fbb7db62698aa26acfdafa87812fd1319e80c472': (62 commits)
  CHART-2808 新增一方法,修改区间配置处默认名称
  REPORT-11193
  REPORT-11193
  CHART-2982 gis轮播图 修改typepane update时候会替换默认chart
  代码修改
  REPORT-11794 10.0设计器安装路径存在特殊符号会导致插件管理界面资源加载失败
  BI-33768 提供获取所有启动时间的接口
  傻逼了
  代码质量
  REPORT-10617 10.0设计器中有部份9.0移动端的功能缺失
  REPORT-11709 AlphaFine整合小帆视觉验收 REPORT-11692 alphafine分词查询结果中包含了连词结果
  REPORT-11335 设计器数据库会显示上一个的记录=>验收问题=>调整代码
  REPORT-11335 设计器数据库会显示上一个的记录=>验收问题
  REPORT-10699 屏蔽表单里面的上传事件
  无JIRA任务 不知道啥问题
  REPORT-11473
  REPORT-11473
  CHART-3043
  REPORT-11473
  CHART-3043
  ...
research/10.0
neil 6 years ago
parent
commit
469d2e32c4
  1. 92
      designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java
  2. 42
      designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java
  3. 8
      designer-base/src/main/java/com/fr/design/data/datapane/connect/JDBCDefPane.java
  4. 9
      designer-base/src/main/java/com/fr/design/extra/PluginWebPane.java
  5. 26
      designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java
  6. 2
      designer-base/src/main/java/com/fr/design/fun/JavaScriptActionProvider.java
  7. 9
      designer-base/src/main/java/com/fr/design/fun/impl/AbstractJavaScriptActionProvider.java
  8. 59
      designer-base/src/main/java/com/fr/design/gui/HyperlinkFilterHelper.java
  9. 475
      designer-base/src/main/java/com/fr/design/gui/columnrow/ColumnRowPane.java
  10. 38
      designer-base/src/main/java/com/fr/design/gui/controlpane/NameableCreator.java
  11. 7
      designer-base/src/main/java/com/fr/design/gui/controlpane/shortcutfactory/OldShortCutFactory.java
  12. 26
      designer-base/src/main/java/com/fr/design/gui/controlpane/shortcutfactory/ShortCutFactory.java
  13. 39
      designer-base/src/main/java/com/fr/design/gui/frpane/BaseHyperlinkGroup.java
  14. 33
      designer-base/src/main/java/com/fr/design/gui/frpane/HyperlinkGroupType.java
  15. 40
      designer-base/src/main/java/com/fr/design/gui/frpane/UICorrelationComboBoxPane.java
  16. 16
      designer-base/src/main/java/com/fr/design/gui/icombobox/UIComboBox.java
  17. 233
      designer-base/src/main/java/com/fr/design/gui/icombocheckbox/UICheckListPopup.java
  18. 330
      designer-base/src/main/java/com/fr/design/gui/icombocheckbox/UIComboCheckBox.java
  19. 11
      designer-base/src/main/java/com/fr/design/gui/itree/filetree/FileNodeComparator.java
  20. 4
      designer-base/src/main/java/com/fr/design/icon/IconPathConstants.java
  21. 5
      designer-base/src/main/java/com/fr/design/javascript/JavaScriptActionPane.java
  22. 7
      designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java
  23. 1
      designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java
  24. 106
      designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/ColorBackgroundQuickPane.java
  25. 1
      designer-base/src/main/java/com/fr/design/preview/MobilePreview.java
  26. 21
      designer-base/src/main/java/com/fr/design/remote/ui/AuthorityListControlPane.java
  27. 18
      designer-base/src/main/java/com/fr/design/remote/ui/UserManagerPane.java
  28. 10
      designer-base/src/main/java/com/fr/file/FILEChooserPane.java
  29. BIN
      designer-base/src/main/resources/com/fr/design/images/buttonicon/control_checkbox_normal.png
  30. BIN
      designer-base/src/main/resources/com/fr/design/images/buttonicon/control_checkbox_part.png
  31. BIN
      designer-base/src/main/resources/com/fr/design/images/buttonicon/control_checkbox_selected.png
  32. BIN
      designer-base/src/main/resources/com/fr/design/images/buttonicon/user_search_normal.png
  33. BIN
      designer-base/src/main/resources/com/fr/design/images/buttonicon/user_search_normal@2x.png
  34. 5
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypePane.java
  35. 12
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/DataPaneHelper.java
  36. 81
      designer-chart/src/main/java/com/fr/design/module/ChartHyperlinkGroup.java
  37. 8
      designer-chart/src/main/java/com/fr/design/module/FormHyperlinkGroup.java
  38. 12
      designer-chart/src/main/java/com/fr/extended/chart/AbstractExtendedChartTableDataPane.java
  39. 8
      designer-chart/src/main/java/com/fr/extended/chart/ExtendedCustomFieldComboBoxPane.java
  40. 32
      designer-chart/src/main/java/com/fr/extended/chart/ExtendedOtherPane.java
  41. 44
      designer-chart/src/main/java/com/fr/extended/chart/UIComboBoxWithNone.java
  42. 22
      designer-chart/src/main/java/com/fr/van/chart/custom/component/VanChartShortCutFactory.java
  43. 2
      designer-chart/src/main/java/com/fr/van/chart/designer/component/background/VanChartBackgroundPane.java
  44. 16
      designer-chart/src/main/java/com/fr/van/chart/map/designer/other/VanChartMapHyperLinkPane.java
  45. 33
      designer-chart/src/main/java/com/fr/van/chart/range/component/SectionIntervalConfigPaneWithOutNum.java
  46. 123
      designer-form/src/main/java/com/fr/design/designer/creator/XWFitLayout.java
  47. 5
      designer-form/src/main/java/com/fr/design/form/mobile/FormMobileAttrPane.java
  48. 2
      designer-form/src/main/java/com/fr/design/mainframe/JForm.java
  49. 1
      designer-form/src/main/java/com/fr/design/mainframe/actions/FormMobileAttrAction.java
  50. 128
      designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/FRAbsoluteBodyLayoutDefinePane.java
  51. 27
      designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/FRFitLayoutDefinePane.java
  52. 260
      designer-realize/src/main/java/com/fr/design/javascript/ListenerEditPane.java
  53. 16
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/AlphaFineConstants.java
  54. 19
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/AlphaFineHelper.java
  55. 4
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/cell/model/RobotModel.java
  56. 2
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/cell/render/BottomCellRender.java
  57. 45
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java
  58. 19
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/RobotPreviewPane.java
  59. 2
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/fun/AlphaFineSearchProvider.java
  60. 2
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/ActionSearchManager.java
  61. 16
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/ComplementAdviceManager.java
  62. 8
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/DocumentSearchManager.java
  63. 2
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/FileSearchManager.java
  64. 8
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/PluginSearchManager.java
  65. 42
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/RecentSearchManager.java
  66. 22
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/RecommendSearchManager.java
  67. 4
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/SegmentationManager.java
  68. 21
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/SimilarSearchManeger.java
  69. 2
      designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java
  70. 5
      designer-realize/src/main/java/com/fr/design/report/mobile/ReportMobileAttrPane.java
  71. 6
      designer-realize/src/main/java/com/fr/design/webattr/ReportWebWidgetConstants.java
  72. 2
      designer-realize/src/main/java/com/fr/design/webattr/printsettings/NativePrintSettingPane.java
  73. 16
      designer-realize/src/main/java/com/fr/start/fx/PrismImageLoader2.java
  74. 3
      designer-realize/src/main/java/com/fr/start/module/DesignerStartup.java
  75. 7
      designer-realize/src/main/java/com/fr/start/preload/ImagePreLoader.java
  76. BIN
      designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/back@1x.png
  77. BIN
      designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/back@2x.png

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

@ -16,6 +16,7 @@ import com.fr.general.GeneralContext;
import com.fr.license.exception.RegistEditionException; import com.fr.license.exception.RegistEditionException;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.stable.EnvChangedListener; import com.fr.stable.EnvChangedListener;
import com.fr.start.server.ServerTray;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
import com.fr.workspace.WorkContextCallback; import com.fr.workspace.WorkContextCallback;
import com.fr.workspace.Workspace; import com.fr.workspace.Workspace;
@ -51,19 +52,28 @@ public class EnvChangeEntrance {
}); });
} }
private boolean envListOkAction(EnvListPane envListPane) { private boolean envListOkAction(EnvListPane envListPane, PopTipStrategy strategy) {
final String selectedName = envListPane.updateEnvManager(); final String selectedName = envListPane.updateEnvManager();
return switch2Env(selectedName); return switch2Env(selectedName, strategy);
} }
/**
* 切换到指定名称的工作目录
*
* @param envName 目标工作目录名称
*/
public void switch2Env(final String envName) {
switch2Env(envName, PopTipStrategy.LATER);
}
/** /**
* 切换到新环境 * 切换到新环境
* *
* @param envName 新工作环境名称 * @param envName 新工作环境名称
* @return 是否成功 * @return 是否成功
*/ */
public boolean switch2Env(final String envName) { private boolean switch2Env(final String envName, PopTipStrategy strategy) {
DesignerEnvManager envManager = DesignerEnvManager.getEnvManager(); DesignerEnvManager envManager = DesignerEnvManager.getEnvManager();
DesignerWorkspaceInfo selectedEnv = envManager.getWorkspaceInfo(envName); DesignerWorkspaceInfo selectedEnv = envManager.getWorkspaceInfo(envName);
@ -71,8 +81,13 @@ public class EnvChangeEntrance {
Workspace workspace = DesignerWorkspaceGenerator.generate(selectedEnv); Workspace workspace = DesignerWorkspaceGenerator.generate(selectedEnv);
boolean checkValid = workspace != null && selectedEnv.checkValid(); boolean checkValid = workspace != null && selectedEnv.checkValid();
if (!checkValid) { if (!checkValid) {
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Basic_Switch_Workspace_Failed"), strategy.showTip(new PopTip() {
UIManager.getString("OptionPane.messageDialogTitle"), ERROR_MESSAGE, UIManager.getIcon("OptionPane.errorIcon")); @Override
public void show() {
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Basic_Switch_Workspace_Failed"),
UIManager.getString("OptionPane.messageDialogTitle"), ERROR_MESSAGE, UIManager.getIcon("OptionPane.errorIcon"));
}
});
return false; return false;
} }
WorkContext.switchTo(workspace, new WorkContextCallback() { WorkContext.switchTo(workspace, new WorkContextCallback() {
@ -85,19 +100,34 @@ public class EnvChangeEntrance {
template.refreshToolArea(); template.refreshToolArea();
} }
DesignTableDataManager.fireDSChanged(new HashMap<String, String>()); DesignTableDataManager.fireDSChanged(new HashMap<String, String>());
if (WorkContext.getCurrent().isLocal()) {
//初始化一下serverTray
ServerTray.init();
}
} }
}); });
} catch (AuthException | RegistEditionException e) { } catch (AuthException | RegistEditionException e) {
// String title = Toolkit.i18nText("Fine-Design_Basic_Remote_Connect_Auth_Failed"); // String title = Toolkit.i18nText("Fine-Design_Basic_Remote_Connect_Auth_Failed");
// String title = Toolkit.i18nText("Fine-Design_Basic_Lic_Does_Not_Support_Remote"); // String title = Toolkit.i18nText("Fine-Design_Basic_Lic_Does_Not_Support_Remote");
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Basic_Switch_Workspace_Failed"), strategy.showTip(new PopTip() {
UIManager.getString("OptionPane.messageDialogTitle"), ERROR_MESSAGE, UIManager.getIcon("OptionPane.errorIcon")); @Override
public void show() {
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Basic_Switch_Workspace_Failed"),
UIManager.getString("OptionPane.messageDialogTitle"), ERROR_MESSAGE, UIManager.getIcon("OptionPane.errorIcon"));
}
});
return false; return false;
} catch (Exception exception) { } catch (Exception exception) {
FineLoggerFactory.getLogger().error(exception.getMessage(), exception); FineLoggerFactory.getLogger().error(exception.getMessage(), exception);
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Basic_Switch_Workspace_Failed"), strategy.showTip(new PopTip() {
UIManager.getString("OptionPane.messageDialogTitle"), ERROR_MESSAGE, UIManager.getIcon("OptionPane.errorIcon")); @Override
public void show() {
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Basic_Switch_Workspace_Failed"),
UIManager.getString("OptionPane.messageDialogTitle"), ERROR_MESSAGE, UIManager.getIcon("OptionPane.errorIcon"));
}
});
return false; return false;
} }
TemplateTreePane.getInstance().refreshDockingView(); TemplateTreePane.getInstance().refreshDockingView();
@ -131,13 +161,11 @@ public class EnvChangeEntrance {
@Override @Override
public void doOk() { public void doOk() {
envListDialog.dispose(); envListOkAction(envListPane, PopTipStrategy.LATER);
envListOkAction(envListPane);
} }
@Override @Override
public void doCancel() { public void doCancel() {
envListDialog.dispose(); envListDialog.dispose();
} }
}); });
@ -155,11 +183,9 @@ public class EnvChangeEntrance {
@Override @Override
public void doOk() { public void doOk() {
if (!envListOkAction(envListPane, PopTipStrategy.NOW)) {
if (!envListOkAction(envListPane)) {
System.exit(0); System.exit(0);
} }
} }
@Override @Override
@ -170,4 +196,40 @@ public class EnvChangeEntrance {
envListDialog.setVisible(true); envListDialog.setVisible(true);
} }
/**
* 提示显示策略
*/
enum PopTipStrategy {
/**
* 切换失败就马上提示失败不关闭选择列表对话框
*/
NOW {
@Override
void showTip(PopTip tip) {
tip.show();
}
},
/**
* 切换失败自动关闭选择列表对话框然后提示切换失败
*/
LATER {
@Override
void showTip(final PopTip tip) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
tip.show();
}
});
}
};
abstract void showTip(PopTip tip);
}
interface PopTip {
void show();
}
} }

42
designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java

@ -155,8 +155,6 @@ public class PreferencePane extends BasicPane {
createServerPane(advancePane); createServerPane(advancePane);
createJdkHomePane(advancePane);
JPanel oraclePane = FRGUIPaneFactory.createTitledBorderPane("Oracle" + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Oracle_All_Tables")); JPanel oraclePane = FRGUIPaneFactory.createTitledBorderPane("Oracle" + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Oracle_All_Tables"));
oracleSpace = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Show_All_Oracle_Tables")); oracleSpace = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Show_All_Oracle_Tables"));
oraclePane.add(oracleSpace); oraclePane.add(oracleSpace);
@ -470,42 +468,6 @@ public class PreferencePane extends BasicPane {
serverPortPane.add(choosePortPane, BorderLayout.CENTER); serverPortPane.add(choosePortPane, BorderLayout.CENTER);
} }
private void createJdkHomePane(JPanel advancePane) {
double p = TableLayout.PREFERRED;
double rowSize[] = {p};
double columnSize[] = {p, p, p};
JPanel serverPortPane = FRGUIPaneFactory.createTitledBorderPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preference_JDK_Home"));
advancePane.add(serverPortPane);
jdkHomeTextField = new UITextField();
UIButton chooseBtn = new UIButton("...");
chooseBtn.setPreferredSize(new Dimension(20, 20));
JPanel panel = GUICoreUtils.createBorderLayoutPane(
jdkHomeTextField, BorderLayout.CENTER,
chooseBtn, BorderLayout.EAST
);
chooseBtn.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
JFileChooser fileChooser = new JFileChooser();
fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
int returnValue = fileChooser.showOpenDialog(PreferencePane.this);
if (returnValue == JFileChooser.APPROVE_OPTION) {
File file = fileChooser.getSelectedFile();
jdkHomeTextField.setText(file.getAbsolutePath());
}
}
});
panel.setPreferredSize(new Dimension(300, 20));
UILabel notiJlabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Work_After_Restart_Designer"));
UILabel serverPortLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preference_JDK_Home") + ":");
Component[][] portComponents = {
{serverPortLabel, panel, notiJlabel},
};
JPanel choosePortPane = TableLayoutHelper.createTableLayoutPane(portComponents, rowSize, columnSize);
serverPortPane.add(choosePortPane, BorderLayout.CENTER);
}
private JPanel createMemoryPane() { private JPanel createMemoryPane() {
JPanel memoryPane = FRGUIPaneFactory.createTitledBorderPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preference_Caching_Template")); JPanel memoryPane = FRGUIPaneFactory.createTitledBorderPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preference_Caching_Template"));
UILabel memoryLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preference_Max_Caching_Template")); UILabel memoryLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preference_Max_Caching_Template"));
@ -575,8 +537,6 @@ public class PreferencePane extends BasicPane {
this.portEditor.setValue(new Integer(designerEnvManager.getEmbedServerPort())); this.portEditor.setValue(new Integer(designerEnvManager.getEmbedServerPort()));
this.jdkHomeTextField.setText(designerEnvManager.getJdkHome());
this.oracleSpace.setSelected(designerEnvManager.isOracleSystemSpace()); this.oracleSpace.setSelected(designerEnvManager.isOracleSystemSpace());
this.cachingTemplateSpinner.setValue(designerEnvManager.getCachingTemplateLimit()); this.cachingTemplateSpinner.setValue(designerEnvManager.getCachingTemplateLimit());
this.joinProductImprove.setSelected(designerEnvManager.isJoinProductImprove()); this.joinProductImprove.setSelected(designerEnvManager.isJoinProductImprove());
@ -636,8 +596,6 @@ public class PreferencePane extends BasicPane {
designerEnvManager.setJettyServerPort(portEditor.getValue().intValue()); designerEnvManager.setJettyServerPort(portEditor.getValue().intValue());
designerEnvManager.setJdkHome(jdkHomeTextField.getText());
designerEnvManager.setOracleSystemSpace(this.oracleSpace.isSelected()); designerEnvManager.setOracleSystemSpace(this.oracleSpace.isSelected());
designerEnvManager.setCachingTemplateLimit((int) this.cachingTemplateSpinner.getValue()); designerEnvManager.setCachingTemplateLimit((int) this.cachingTemplateSpinner.getValue());
designerEnvManager.setJoinProductImprove(this.joinProductImprove.isSelected()); designerEnvManager.setJoinProductImprove(this.joinProductImprove.isSelected());

8
designer-base/src/main/java/com/fr/design/data/datapane/connect/JDBCDefPane.java

@ -35,11 +35,12 @@ public class JDBCDefPane extends JPanel {
public static final String DRIVER_TYPE = "driver_type"; public static final String DRIVER_TYPE = "driver_type";
public static final String USER_NAME = "user_name"; public static final String USER_NAME = "user_name";
public static final int TIME_MULTIPLE = 1000; public static final int TIME_MULTIPLE = 1000;
private static final String OTHER_DB = "Others";
private static Map<String, DriverURLName[]> jdbcMap = new HashMap<String, DriverURLName[]>(); private static Map<String, DriverURLName[]> jdbcMap = new HashMap<String, DriverURLName[]>();
static { static {
jdbcMap.put("Others", new DriverURLName[]{new DriverURLName("sun.jdbc.odbc.JdbcOdbcDriver", "jdbc:odbc:"), jdbcMap.put(OTHER_DB, new DriverURLName[]{new DriverURLName("sun.jdbc.odbc.JdbcOdbcDriver", "jdbc:odbc:"),
new DriverURLName("org.hsqldb.jdbcDriver", "jdbc:hsqldb:file:[PATH_TO_DB_FILES]"), new DriverURLName("com.inet.tds.TdsDriver", "jdbc:inetdae7:localhost:1433/"), new DriverURLName("org.hsqldb.jdbcDriver", "jdbc:hsqldb:file:[PATH_TO_DB_FILES]"), new DriverURLName("com.inet.tds.TdsDriver", "jdbc:inetdae7:localhost:1433/"),
new DriverURLName("COM.cloudscape.JDBCDriver", "jdbc:cloudscape:/cloudscape/"), new DriverURLName("COM.cloudscape.JDBCDriver", "jdbc:cloudscape:/cloudscape/"),
new DriverURLName("com.internetcds.jdbc.tds.Driver", "jdbc:freetds:sqlserver://localhost/")}); new DriverURLName("com.internetcds.jdbc.tds.Driver", "jdbc:freetds:sqlserver://localhost/")});
@ -64,7 +65,7 @@ public class JDBCDefPane extends JPanel {
private UITextField userNameTextField; private UITextField userNameTextField;
private JPasswordField passwordTextField; private JPasswordField passwordTextField;
// 请不要改动dbtype,只应该最后添加 // 请不要改动dbtype,只应该最后添加
private final String[] dbtype = {"", "Oracle", "DB2", "SQL Server", "MySQL", "Sybase", "Access", "Derby", "Postgre","SQLite","Inceptor", "Others"}; private final String[] dbtype = {"Oracle", "DB2", "SQL Server", "MySQL", "Sybase", "Access", "Derby", "Postgre","SQLite","Inceptor", OTHER_DB};
// carl:DBCP的一些属性 // carl:DBCP的一些属性
private IntegerEditor DBCP_INITIAL_SIZE = new IntegerEditor(); private IntegerEditor DBCP_INITIAL_SIZE = new IntegerEditor();
@ -182,6 +183,9 @@ public class JDBCDefPane extends JPanel {
break; break;
} }
} }
if (!out) {
this.dbtypeComboBox.setSelectedItem(OTHER_DB);
}
} }
this.driverComboBox.setSelectedItem(jdbcDatabase.getDriver()); this.driverComboBox.setSelectedItem(jdbcDatabase.getDriver());
this.urlTextField.setText(jdbcDatabase.getURL()); this.urlTextField.setText(jdbcDatabase.getURL());

9
designer-base/src/main/java/com/fr/design/extra/PluginWebPane.java

@ -4,6 +4,7 @@ import com.fr.base.TemplateUtils;
import com.fr.general.GeneralContext; import com.fr.general.GeneralContext;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.stable.EncodeConstants;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javafx.application.Platform; import javafx.application.Platform;
@ -32,6 +33,9 @@ import java.util.Map;
public class PluginWebPane extends JFXPanel { public class PluginWebPane extends JFXPanel {
private static final String RESOURCE_URL = "resourceURL"; private static final String RESOURCE_URL = "resourceURL";
private static final String LANGUAGE = "language"; private static final String LANGUAGE = "language";
private static final String URL_PLUS = "+";
private static final String URL_SPACING = "%20";
private static final String URL_PREFIX = "file:///";
private WebEngine webEngine; private WebEngine webEngine;
public PluginWebPane(final String installHome, final String mainJs) { public PluginWebPane(final String installHome, final String mainJs) {
@ -75,8 +79,9 @@ public class PluginWebPane extends JFXPanel {
StringBuffer sb = new StringBuffer(); StringBuffer sb = new StringBuffer();
String line; String line;
Map<String, Object> map4Tpl = new HashMap<String, Object>(); Map<String, Object> map4Tpl = new HashMap<String, Object>();
//URL中关于空格的编码与空格所在位置相关:空格被编码成+的情况只能在查询字符串部分出现,而被编码成%20则可以出现在路径和查询字符串中
map4Tpl.put(RESOURCE_URL, "file:///" + URLEncoder.encode(installHome, "UTF-8")); //URLEncoder会将空格转成+,这边需要+转成%20
map4Tpl.put(RESOURCE_URL, URL_PREFIX + URLEncoder.encode(installHome, EncodeConstants.ENCODING_UTF_8).replace(URL_PLUS, URL_SPACING));
map4Tpl.put(LANGUAGE, GeneralContext.getLocale().toString()); map4Tpl.put(LANGUAGE, GeneralContext.getLocale().toString());
while ((line = read.readLine()) != null) { while ((line = read.readLine()) != null) {
if (sb.length() > 0) { if (sb.length() > 0) {

26
designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java

@ -17,6 +17,7 @@ import com.fr.general.ComparatorUtils;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import com.fr.stable.ProductConstants; import com.fr.stable.ProductConstants;
import com.fr.third.javax.annotation.Nonnull;
import com.fr.third.org.apache.commons.io.FilenameUtils; import com.fr.third.org.apache.commons.io.FilenameUtils;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
import com.fr.workspace.server.lock.TplOperator; import com.fr.workspace.server.lock.TplOperator;
@ -677,34 +678,31 @@ public class MutilTempalteTabPane extends JComponent {
//当前激活的模板 //当前激活的模板
String filename = openedTemplate.get(selectedIndex).getPath(); String filename = openedTemplate.get(selectedIndex).getPath();
filename = FilenameUtils.standard(filename); filename = FilenameUtils.standard(filename);
if (!specifiedTemplate.isALLSaved() && !DesignerMode.isVcsMode()) { if (!specifiedTemplate.isALLSaved() && !DesignerMode.isVcsMode()) {
specifiedTemplate.stopEditing(); specifiedTemplate.stopEditing();
int returnVal = JOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Basic_Utils_Would_You_Like_To_Save") + " \"" + specifiedTemplate.getEditingFILE() + "\" ?", int returnVal = JOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Basic_Utils_Would_You_Like_To_Save") + " \"" + specifiedTemplate.getEditingFILE() + "\" ?",
ProductConstants.PRODUCT_NAME, JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE); ProductConstants.PRODUCT_NAME, JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE);
if (returnVal == JOptionPane.YES_OPTION) { if (returnVal == JOptionPane.YES_OPTION) {
specifiedTemplate.saveTemplate(); specifiedTemplate.saveTemplate();
HistoryTemplateListCache.getInstance().closeSelectedReport(specifiedTemplate);
// release lock
WorkContext.getCurrent().get(TplOperator.class).closeAndFreeFile(specifiedTemplate.getPath());
activeTemplate(filename);
FineLoggerFactory.getLogger().info(Toolkit.i18nText("Fine-Design_Basic_Template_Already_Saved", specifiedTemplate.getEditingFILE().getName())); FineLoggerFactory.getLogger().info(Toolkit.i18nText("Fine-Design_Basic_Template_Already_Saved", specifiedTemplate.getEditingFILE().getName()));
closeTpl(specifiedTemplate, filename);
} else if (returnVal == JOptionPane.NO_OPTION) {
closeTpl(specifiedTemplate, filename);
} }
} else { } else {
HistoryTemplateListCache.getInstance().closeSelectedReport(specifiedTemplate); closeTpl(specifiedTemplate, filename);
// release lock
WorkContext.getCurrent().get(TplOperator.class).closeAndFreeFile(specifiedTemplate.getPath());
activeTemplate(filename);
FineLoggerFactory.getLogger().info(Toolkit.i18nText("Fine-Design_Basic_Template_Already_Saved", specifiedTemplate.getEditingFILE().getName()));
} }
} }
private void closeTpl(@Nonnull JTemplate<?, ?> specifiedTemplate, @Nonnull String fileName) {
HistoryTemplateListCache.getInstance().closeSelectedReport(specifiedTemplate);
// release lock
WorkContext.getCurrent().get(TplOperator.class).closeAndFreeFile(specifiedTemplate.getPath());
activeTemplate(fileName);
}
/** /**
* 关闭模板 * 关闭模板
* *

2
designer-base/src/main/java/com/fr/design/fun/JavaScriptActionProvider.java

@ -18,4 +18,6 @@ public interface JavaScriptActionProvider extends Mutable{
FurtherBasicBeanPane<? extends JavaScript> getJavaScriptActionPane(JavaScriptActionPane pane); FurtherBasicBeanPane<? extends JavaScript> getJavaScriptActionPane(JavaScriptActionPane pane);
boolean isSupportType();
} }

9
designer-base/src/main/java/com/fr/design/fun/impl/AbstractJavaScriptActionProvider.java

@ -26,4 +26,13 @@ public abstract class AbstractJavaScriptActionProvider extends AbstractProvider
public FurtherBasicBeanPane<? extends JavaScript> getJavaScriptActionPane(JavaScriptActionPane pane) { public FurtherBasicBeanPane<? extends JavaScript> getJavaScriptActionPane(JavaScriptActionPane pane) {
return getJavaScriptActionPane(); return getJavaScriptActionPane();
} }
/**
* 判断是否是支持的类型cpt,frm默认是
* @return
*/
@Override
public boolean isSupportType(){
return true;
}
} }

59
designer-base/src/main/java/com/fr/design/gui/HyperlinkFilterHelper.java

@ -1,59 +0,0 @@
package com.fr.design.gui;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.mainframe.BaseJForm;
import com.fr.design.mainframe.JTemplate;
import com.fr.general.ComparatorUtils;
/**
* Created by mengao on 2017/9/22.
* 单元格超链图表超链在不同类型模版中下拉选项不同
*/
public class HyperlinkFilterHelper {
public static boolean whetherAddHyperlink4cell(String itemName) {
JTemplate jTemplate = getCurrentEditingTemplate();
if (jTemplate == null) {
return false;
}
//先屏蔽掉这个,之后还有别的
String[] names = {com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_ Hyperlink_Chart_Float")};
for (String name : names) {
if (!jTemplate.isJWorkBook() && ComparatorUtils.equals(itemName, name)) {
return false;
}
}
return whetherAddFormLink(jTemplate, itemName);
}
public static boolean whetherAddHyperlink4Chart(String itemName) {
JTemplate jTemplate = getCurrentEditingTemplate();
if (jTemplate == null) {
return false;
}
//先屏蔽掉这个,之后还有别的
String[] names = {com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_ Hyperlink_Chart_Float"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Hyperlink_Chart_Cell")};
for (String name : names) {
if (!jTemplate.isJWorkBook() && ComparatorUtils.equals(itemName, name)) {
if (jTemplate.getEditingReportIndex() == BaseJForm.ELEMENTCASE_TAB && ComparatorUtils.equals(itemName, names[0])) {
//表单报表块中图表悬浮元素超链,只屏蔽联动悬浮元素
return false;
} else if (jTemplate.getEditingReportIndex() == BaseJForm.FORM_TAB) {
//表单图表超链屏蔽掉联动悬浮元素和联动单元格
return false;
}
}
}
return whetherAddFormLink(jTemplate, itemName);
}
private static JTemplate getCurrentEditingTemplate() {
return HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
}
private static boolean whetherAddFormLink(JTemplate jTemplate, String itemName) {
String formName = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Hyperlink_Form_Link");
return !(jTemplate.isJWorkBook() && ComparatorUtils.equals(itemName, formName));
}
}

475
designer-base/src/main/java/com/fr/design/gui/columnrow/ColumnRowPane.java

@ -1,8 +1,17 @@
package com.fr.design.gui.columnrow; package com.fr.design.gui.columnrow;
import java.awt.BorderLayout; import com.fr.design.designer.IntervalConstants;
import java.awt.Dimension; import com.fr.design.event.UIObserver;
import java.awt.GridLayout; import com.fr.design.event.UIObserverListener;
import com.fr.design.gui.ispinner.ColumnRowSpinner;
import com.fr.design.gui.ispinner.UIBasicSpinner;
import com.fr.design.gui.ispinner.UpperCaseSpinner;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.ComparatorUtils;
import com.fr.stable.ColumnRow;
import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils;
import javax.swing.JFormattedTextField; import javax.swing.JFormattedTextField;
import javax.swing.JPanel; import javax.swing.JPanel;
@ -16,19 +25,9 @@ import javax.swing.text.AbstractDocument;
import javax.swing.text.AttributeSet; import javax.swing.text.AttributeSet;
import javax.swing.text.BadLocationException; import javax.swing.text.BadLocationException;
import javax.swing.text.DocumentFilter; import javax.swing.text.DocumentFilter;
import java.awt.BorderLayout;
import com.fr.design.designer.IntervalConstants; import java.awt.Dimension;
import com.fr.design.event.UIObserver; import java.awt.GridLayout;
import com.fr.design.event.UIObserverListener;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.gui.ispinner.UIBasicSpinner;
import com.fr.design.gui.ispinner.UpperCaseSpinner;
import com.fr.design.gui.ispinner.ColumnRowSpinner;
import com.fr.general.ComparatorUtils;
import com.fr.stable.ColumnRow;
import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils;
import com.fr.design.utils.gui.GUICoreUtils;
/** /**
* the component to edit ColumnRow * the component to edit ColumnRow
@ -37,224 +36,228 @@ import com.fr.design.utils.gui.GUICoreUtils;
*/ */
public class ColumnRowPane extends JPanel implements UIObserver { public class ColumnRowPane extends JPanel implements UIObserver {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private static String[] columnarray = new String[1000]; private static String[] columnarray = new String[1000];
private static String[] rowarray = new String[5000]; private static String[] rowarray = new String[5000];
protected UpperCaseSpinner columnSpinner; protected UpperCaseSpinner columnSpinner;
protected UIBasicSpinner rowSpinner; protected UIBasicSpinner rowSpinner;
static { static {
for (int i = 1; i < 1000; i++) { for (int i = 1; i <= 1000; i++) {
columnarray[i - 1] = StableUtils.convertIntToABC(i); columnarray[i - 1] = StableUtils.convertIntToABC(i);
} }
for (int i = 1; i < 5000; i++) { for (int i = 1; i <= 5000; i++) {
rowarray[i - 1] = StringUtils.EMPTY + i; rowarray[i - 1] = StringUtils.EMPTY + i;
} }
} }
protected DocumentListener d = new DocumentListener() { protected DocumentListener d = new DocumentListener() {
@Override @Override
public void removeUpdate(DocumentEvent e) { public void removeUpdate(DocumentEvent e) {
String rolText = ((DefaultEditor) columnSpinner.getEditor()).getTextField().getText(); String rolText = ((DefaultEditor) columnSpinner.getEditor()).getTextField().getText();
String rowText = ((DefaultEditor) rowSpinner.getEditor()).getTextField().getText(); String rowText = ((DefaultEditor) rowSpinner.getEditor()).getTextField().getText();
if (rolText == null || rolText.length() == 0 || rowText == null || rowText.length() == 0) { if (rolText == null || rolText.length() == 0 || rowText == null || rowText.length() == 0) {
return; return;
} }
int col = StableUtils.convertABCToInt(rolText) - 1; int col = StableUtils.convertABCToInt(rolText) - 1;
int row = Integer.parseInt(rowText) - 1; int row = Integer.parseInt(rowText) - 1;
setColumnRow(ColumnRow.valueOf(col, row)); setColumnRow(ColumnRow.valueOf(col, row));
} }
@Override @Override
public void insertUpdate(DocumentEvent e) { public void insertUpdate(DocumentEvent e) {
int col = StableUtils.convertABCToInt(((DefaultEditor) columnSpinner.getEditor()).getTextField().getText()) - 1; int col = StableUtils.convertABCToInt(((DefaultEditor) columnSpinner.getEditor()).getTextField().getText()) - 1;
int row = Integer.parseInt(((DefaultEditor) rowSpinner.getEditor()).getTextField().getText()) - 1; int row = Integer.parseInt(((DefaultEditor) rowSpinner.getEditor()).getTextField().getText()) - 1;
setColumnRow(ColumnRow.valueOf(col, row)); setColumnRow(ColumnRow.valueOf(col, row));
} }
@Override @Override
public void changedUpdate(DocumentEvent e) { public void changedUpdate(DocumentEvent e) {
} }
}; };
private UIObserverListener uiObserverListener; private UIObserverListener uiObserverListener;
private ColumnRow cr; private ColumnRow cr;
public ColumnRowPane() { public ColumnRowPane() {
this.initComponents(); this.initComponents();
iniListener(); iniListener();
} }
/** /**
* 初始化元素 * 初始化元素
*/ */
public void initComponents() { public void initComponents() {
this.setLayout(new GridLayout(0, 2, IntervalConstants.INTERVAL_L6, 0)); this.setLayout(new GridLayout(0, 2, IntervalConstants.INTERVAL_L6, 0));
initColSpinner(); initColSpinner();
this.add(columnSpinner, BorderLayout.WEST); this.add(columnSpinner, BorderLayout.WEST);
initRowSpinner(); initRowSpinner();
this.add(rowSpinner); this.add(rowSpinner);
this.addDocumentListener(d); this.addDocumentListener(d);
} }
private void iniListener() { private void iniListener() {
if (shouldResponseChangeListener()) { if (shouldResponseChangeListener()) {
this.addChangeListener(new ChangeListener() { this.addChangeListener(new ChangeListener() {
@Override @Override
public void stateChanged(ChangeEvent e) { public void stateChanged(ChangeEvent e) {
if (uiObserverListener == null) { if (uiObserverListener == null) {
return; return;
} }
uiObserverListener.doChange(); uiObserverListener.doChange();
} }
}); });
} }
} }
protected void initRowSpinner() { protected void initRowSpinner() {
rowSpinner = new ColumnRowSpinner((new SpinnerListModel(rowarray))) { rowSpinner = new ColumnRowSpinner((new SpinnerListModel(rowarray))) {
public boolean shouldResponseChangeListener() { public boolean shouldResponseChangeListener() {
return false; return false;
} }
}; };
rowSpinner.setPreferredSize(new Dimension(60, 24)); rowSpinner.setPreferredSize(new Dimension(60, 24));
JFormattedTextField rftf = GUICoreUtils.getSpinnerTextField(rowSpinner); JFormattedTextField rftf = GUICoreUtils.getSpinnerTextField(rowSpinner);
if (rftf != null) { if (rftf != null) {
rftf.setColumns(4); // specify more width than we need rftf.setColumns(4); // specify more width than we need
rftf.setHorizontalAlignment(UITextField.LEFT); rftf.setHorizontalAlignment(UITextField.LEFT);
} }
} }
protected void initColSpinner() { protected void initColSpinner() {
SpinnerListModel columnSpinnerListModel = new SpinnerListModel(columnarray); SpinnerListModel columnSpinnerListModel = new SpinnerListModel(columnarray);
columnSpinner = new UpperCaseSpinner(columnSpinnerListModel) { columnSpinner = new UpperCaseSpinner(columnSpinnerListModel) {
public boolean shouldResponseChangeListener() { public boolean shouldResponseChangeListener() {
return false; return false;
} }
}; };
columnSpinner.setPreferredSize(new Dimension(60, 24)); columnSpinner.setPreferredSize(new Dimension(60, 24));
JFormattedTextField cftf = GUICoreUtils.getSpinnerTextField(columnSpinner); JFormattedTextField cftf = GUICoreUtils.getSpinnerTextField(columnSpinner);
if (cftf != null) { if (cftf != null) {
cftf.setColumns(3); // specify more width than we need cftf.setColumns(3); // specify more width than we need
cftf.setHorizontalAlignment(UITextField.LEFT); cftf.setHorizontalAlignment(UITextField.LEFT);
} }
((AbstractDocument) cftf.getDocument()).setDocumentFilter(new DocumentFilter() { ((AbstractDocument) cftf.getDocument()).setDocumentFilter(new DocumentFilter() {
public void insertString(FilterBypass fb, int offset, String string, AttributeSet attr) throws BadLocationException { public void insertString(FilterBypass fb, int offset, String string, AttributeSet attr) throws BadLocationException {
fb.insertString(offset, string.toUpperCase(), attr); fb.insertString(offset, string.toUpperCase(), attr);
} }
public void replace(FilterBypass fb, int offset, int length, String string, AttributeSet attr) throws BadLocationException { public void replace(FilterBypass fb, int offset, int length, String string, AttributeSet attr) throws BadLocationException {
if (string != null) { if (string != null) {
string = string.toUpperCase(); string = string.toUpperCase();
} }
fb.replace(offset, length, string, attr); fb.replace(offset, length, string, attr);
} }
}); });
} }
protected void addDocumentListener(DocumentListener l) { protected void addDocumentListener(DocumentListener l) {
((DefaultEditor) columnSpinner.getEditor()).getTextField().getDocument().addDocumentListener(l); ((DefaultEditor) columnSpinner.getEditor()).getTextField().getDocument().addDocumentListener(l);
((DefaultEditor) rowSpinner.getEditor()).getTextField().getDocument().addDocumentListener(l); ((DefaultEditor) rowSpinner.getEditor()).getTextField().getDocument().addDocumentListener(l);
} }
private void removeDocumentListener(DocumentListener l) { private void removeDocumentListener(DocumentListener l) {
((DefaultEditor) columnSpinner.getEditor()).getTextField().getDocument().removeDocumentListener(l); ((DefaultEditor) columnSpinner.getEditor()).getTextField().getDocument().removeDocumentListener(l);
((DefaultEditor) rowSpinner.getEditor()).getTextField().getDocument().removeDocumentListener(l); ((DefaultEditor) rowSpinner.getEditor()).getTextField().getDocument().removeDocumentListener(l);
} }
/** /**
* columnSpinner与rowSpinner应该整体考虑设置ColumnRow应该只触发一次事件 * columnSpinner与rowSpinner应该整体考虑设置ColumnRow应该只触发一次事件
* *
* @param columnRow * @param columnRow
*/ */
public void setColumnRow(ColumnRow columnRow) { public void setColumnRow(ColumnRow columnRow) {
if (!ComparatorUtils.equals(cr, columnRow)) { if (!ComparatorUtils.equals(cr, columnRow)) {
setGlobalName(); setGlobalName();
removeDocumentListener(d); removeDocumentListener(d);
cr = columnRow; cr = columnRow;
addDocumentListener(d); addDocumentListener(d);
fireChanged(); fireChanged();
} }
} }
public void setGlobalName(){ public void setGlobalName() {
} }
public void populate(ColumnRow columnRow) { public void populate(ColumnRow columnRow) {
cr = columnRow; cr = columnRow;
int column = columnRow.getColumn(); int column = columnRow.getColumn();
if (column < 0) { if (column < 0) {
column = 0; column = 0;
} }
removeDocumentListener(d); removeDocumentListener(d);
columnSpinner.setValue(StableUtils.convertIntToABC(column + 1)); columnSpinner.setValue(StableUtils.convertIntToABC(column + 1));
int row = columnRow.getRow(); int row = columnRow.getRow();
// shoc 小于0就蹦了 // shoc 小于0就蹦了
if (row < 0) { if (row < 0) {
row = 0; row = 0;
} }
rowSpinner.setValue("" + (row + 1)); rowSpinner.setValue("" + (row + 1));
addDocumentListener(d); addDocumentListener(d);
fireChanged(); fireChanged();
} }
public ColumnRow update() { public ColumnRow update() {
return cr; return cr;
} }
/** /**
* 添加一个listener到listenerList中 * 添加一个listener到listenerList中
* @param l 监听 *
*/ * @param l 监听
public void addChangeListener(ChangeListener l) { */
this.listenerList.add(ChangeListener.class, l); public void addChangeListener(ChangeListener l) {
} this.listenerList.add(ChangeListener.class, l);
}
/**
* 从listenerList中移除一个listener /**
* @param l 监听 * 从listenerList中移除一个listener
*/ *
public void removeChangeListener(ChangeListener l) { * @param l 监听
this.listenerList.remove(ChangeListener.class, l); */
} public void removeChangeListener(ChangeListener l) {
this.listenerList.remove(ChangeListener.class, l);
// august: Process the listeners last to first }
protected void fireChanged() {
Object[] listeners = listenerList.getListenerList(); // august: Process the listeners last to first
protected void fireChanged() {
for (int i = listeners.length - 2; i >= 0; i -= 2) { Object[] listeners = listenerList.getListenerList();
if (listeners[i] == ChangeListener.class) {
((ChangeListener) listeners[i + 1]).stateChanged(new ChangeEvent(this)); for (int i = listeners.length - 2; i >= 0; i -= 2) {
} if (listeners[i] == ChangeListener.class) {
} ((ChangeListener) listeners[i + 1]).stateChanged(new ChangeEvent(this));
} }
}
/** }
* 给组件登记一个观察者监听事件
* @param listener 监听 /**
*/ * 给组件登记一个观察者监听事件
public void registerChangeListener(UIObserverListener listener) { *
uiObserverListener = listener; * @param listener 监听
} */
public void registerChangeListener(UIObserverListener listener) {
/** uiObserverListener = listener;
* 组件是否需要响应添加的观察者事件 }
* @return 如果需要响应观察者事件则返回true否则返回false
*/ /**
public boolean shouldResponseChangeListener() { * 组件是否需要响应添加的观察者事件
return true; *
} * @return 如果需要响应观察者事件则返回true否则返回false
*/
public boolean shouldResponseChangeListener() {
return true;
}
} }

38
designer-base/src/main/java/com/fr/design/gui/controlpane/NameableCreator.java

@ -5,25 +5,25 @@ import com.fr.design.gui.ilist.ListModelElement;
import com.fr.js.JavaScript; import com.fr.js.JavaScript;
import com.fr.stable.Nameable; import com.fr.stable.Nameable;
import javax.swing.*; import javax.swing.Icon;
public interface NameableCreator { public interface NameableCreator {
public String menuName(); String menuName();
public Icon menuIcon(); Icon menuIcon();
public String createTooltip(); String createTooltip();
public Nameable createNameable(UnrepeatedNameHelper helper); Nameable createNameable(UnrepeatedNameHelper helper);
public Class<? extends BasicBeanPane> getUpdatePane(); Class<? extends BasicBeanPane> getUpdatePane();
public Object acceptObject2Populate(Object ob); Object acceptObject2Populate(Object ob);
public void saveUpdatedBean(ListModelElement wrapper, Object bean); void saveUpdatedBean(ListModelElement wrapper, Object bean);
public Class <? extends JavaScript> getHyperlink(); Class<? extends JavaScript> getHyperlink();
public boolean isNeedParameterWhenPopulateJControlPane(); boolean isNeedParameterWhenPopulateJControlPane();
} }

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

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

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

@ -3,7 +3,6 @@ package com.fr.design.gui.controlpane.shortcutfactory;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.design.actions.core.ActionFactory; import com.fr.design.actions.core.ActionFactory;
import com.fr.design.gui.HyperlinkFilterHelper;
import com.fr.design.gui.controlpane.NameableCreator; import com.fr.design.gui.controlpane.NameableCreator;
import com.fr.design.gui.controlpane.ShortCut4JControlPane; import com.fr.design.gui.controlpane.ShortCut4JControlPane;
import com.fr.design.gui.controlpane.ShortCutListenerProvider; import com.fr.design.gui.controlpane.ShortCutListenerProvider;
@ -11,7 +10,10 @@ import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.menu.LineSeparator; import com.fr.design.menu.LineSeparator;
import com.fr.design.menu.MenuDef; import com.fr.design.menu.MenuDef;
import com.fr.design.menu.ShortCut; import com.fr.design.menu.ShortCut;
import com.fr.design.module.DesignModuleFactory;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.js.JavaScript;
import com.fr.stable.Filter;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.AbstractButton; import javax.swing.AbstractButton;
@ -36,11 +38,11 @@ public class ShortCutFactory extends AbstractShortCutFactory {
@Override @Override
public ShortCut4JControlPane[] createShortCuts() { public ShortCut4JControlPane[] createShortCuts() {
return new ShortCut4JControlPane[]{ return new ShortCut4JControlPane[]{
copyItemShortCut(), copyItemShortCut(),
moveUpItemShortCut(), moveUpItemShortCut(),
moveDownItemShortCut(), moveDownItemShortCut(),
sortItemShortCut(), sortItemShortCut(),
removeItemShortCut() removeItemShortCut()
}; };
} }
@ -77,7 +79,7 @@ public class ShortCutFactory extends AbstractShortCutFactory {
Object object = this.getValue(UIButton.class.getName()); Object object = this.getValue(UIButton.class.getName());
if (!(object instanceof AbstractButton)) { if (!(object instanceof AbstractButton)) {
// 直接使用默认UI // 直接使用默认UI
UIButton button = new UIButton(); UIButton button = new UIButton();
// 添加一个名字作为自动化测试用 // 添加一个名字作为自动化测试用
button.setName(getName()); button.setName(getName());
@ -124,7 +126,8 @@ public class ShortCutFactory extends AbstractShortCutFactory {
/** /**
* 生成UIButton * 生成UIButton
* @return 菜单按钮 *
* @return 菜单按钮
*/ */
public UIButton createUIButton() { public UIButton createUIButton() {
createdButton = super.createUIButton(); createdButton = super.createUIButton();
@ -139,7 +142,8 @@ public class ShortCutFactory extends AbstractShortCutFactory {
private void wrapActionListener(NameableCreator[] creators) { private void wrapActionListener(NameableCreator[] creators) {
for (final NameableCreator creator : creators) { for (final NameableCreator creator : creators) {
if (!whetherAdd(creator.menuName())) { Filter<Class<? extends JavaScript>> filter = DesignModuleFactory.getHyperlinkGroupType().getFilter();
if (!filter.accept(creator.getHyperlink())) {
continue; continue;
} }
boolean isTrue = ComparatorUtils.equals(creator.menuName(), com.fr.design.i18n.Toolkit.i18nText("Datasource-Stored_Procedure")) || boolean isTrue = ComparatorUtils.equals(creator.menuName(), com.fr.design.i18n.Toolkit.i18nText("Datasource-Stored_Procedure")) ||
@ -163,9 +167,5 @@ public class ShortCutFactory extends AbstractShortCutFactory {
}); });
} }
} }
protected boolean whetherAdd(String itemName){
return HyperlinkFilterHelper.whetherAddHyperlink4cell(itemName);
}
} }
} }

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

@ -2,6 +2,8 @@ package com.fr.design.gui.frpane;
import com.fr.design.gui.controlpane.NameableCreator; import com.fr.design.gui.controlpane.NameableCreator;
import com.fr.design.module.DesignModuleFactory; import com.fr.design.module.DesignModuleFactory;
import com.fr.js.JavaScript;
import com.fr.stable.Filter;
/** /**
* 基础的超级链接类型, 不包括图表相关超链. * 基础的超级链接类型, 不包括图表相关超链.
@ -11,13 +13,34 @@ import com.fr.design.module.DesignModuleFactory;
*/ */
public class BaseHyperlinkGroup implements HyperlinkGroupType { public class BaseHyperlinkGroup implements HyperlinkGroupType {
/** /**
* 返回支持的超级链接类型 * 返回支持的超级链接类型
* *
* @return * @return NameableCreator[]
*/ */
public NameableCreator[] getHyperlinkCreators() { public NameableCreator[] getHyperlinkCreators() {
return DesignModuleFactory.getCreators4Hyperlink(); return DesignModuleFactory.getCreators4Hyperlink();
} }
@Override
public Filter<Class<? extends JavaScript>> getFilter() {
return new Filter<Class<? extends JavaScript>>() {
@Override
public boolean accept(Class<? extends JavaScript> aClass) {
return true;
}
};
}
@Override
public Filter<Object> getOldFilter() {
return new Filter<Object>() {
@Override
public boolean accept(Object object) {
return true;
}
};
}
} }

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

@ -1,18 +1,37 @@
package com.fr.design.gui.frpane; package com.fr.design.gui.frpane;
import com.fr.design.gui.controlpane.NameableCreator; import com.fr.design.gui.controlpane.NameableCreator;
import com.fr.js.JavaScript;
import com.fr.stable.Filter;
/** /**
* 超级链接 支持的类型 种类. * 超级链接 支持的类型 种类.
*
* @author kunsnat E-mail:kunsnat@gmail.com * @author kunsnat E-mail:kunsnat@gmail.com
* @version 创建时间2013-6-26 下午04:41:55 * @version 创建时间2013-6-26 下午04:41:55
*/ */
public interface HyperlinkGroupType { public interface HyperlinkGroupType {
/** /**
* 返回支持的超级链接类型 * 返回支持的超级链接类型
* @return NameableCreator[] *
*/ * @return NameableCreator[]
public NameableCreator[] getHyperlinkCreators(); */
NameableCreator[] getHyperlinkCreators();
/**
* 图表超链过滤
*
* @return 图表超链过滤
*/
Filter<Class<? extends JavaScript>> getFilter();
/**
* 老图表超链的过滤
*
* @return 老图表超链的过滤
*/
Filter<Object> getOldFilter();
} }

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

@ -8,7 +8,6 @@ import com.fr.design.dialog.DialogActionListener;
import com.fr.design.dialog.UIDialog; import com.fr.design.dialog.UIDialog;
import com.fr.design.event.UIObserver; import com.fr.design.event.UIObserver;
import com.fr.design.event.UIObserverListener; import com.fr.design.event.UIObserverListener;
import com.fr.design.gui.HyperlinkFilterHelper;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.imenu.UIMenuItem; import com.fr.design.gui.imenu.UIMenuItem;
import com.fr.design.gui.imenutable.UIMenuNameableCreator; import com.fr.design.gui.imenutable.UIMenuNameableCreator;
@ -16,20 +15,28 @@ import com.fr.design.gui.imenutable.UIMenuTable;
import com.fr.design.hyperlink.ReportletHyperlinkPane; import com.fr.design.hyperlink.ReportletHyperlinkPane;
import com.fr.design.hyperlink.WebHyperlinkPane; import com.fr.design.hyperlink.WebHyperlinkPane;
import com.fr.design.javascript.EmailPane; import com.fr.design.javascript.EmailPane;
import com.fr.design.module.DesignModuleFactory;
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.js.AbstractJavaScript; import com.fr.js.AbstractJavaScript;
import com.fr.js.EmailJavaScript; import com.fr.js.EmailJavaScript;
import com.fr.js.ReportletHyperlink; import com.fr.js.ReportletHyperlink;
import com.fr.js.WebHyperlink; import com.fr.js.WebHyperlink;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.stable.Filter;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.*; import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JPopupMenu;
import javax.swing.SwingUtilities;
import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener; import javax.swing.event.ChangeListener;
import java.awt.*; import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.LayoutManager;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.util.ArrayList; import java.util.ArrayList;
@ -76,6 +83,7 @@ public class UICorrelationComboBoxPane extends JPanel implements UIObserver {
/** /**
* 刷新下拉列表和按钮 * 刷新下拉列表和按钮
*
* @param values 下拉列表里的值 * @param values 下拉列表里的值
*/ */
public void refreshMenuAndAddMenuAction(List<? extends UIMenuNameableCreator> values) { public void refreshMenuAndAddMenuAction(List<? extends UIMenuNameableCreator> values) {
@ -88,7 +96,8 @@ public class UICorrelationComboBoxPane extends JPanel implements UIObserver {
if (values.size() > 1) { if (values.size() > 1) {
for (UIMenuNameableCreator value : values) { for (UIMenuNameableCreator value : values) {
final String itemName = value.getName(); final String itemName = value.getName();
if(!HyperlinkFilterHelper.whetherAddHyperlink4Chart(itemName)){ Filter<Object> filter = DesignModuleFactory.getHyperlinkGroupType().getOldFilter();
if (!filter.accept(value.getObj())) {
continue; continue;
} }
UIMenuItem item = new UIMenuItem(itemName); UIMenuItem item = new UIMenuItem(itemName);
@ -238,6 +247,7 @@ public class UICorrelationComboBoxPane extends JPanel implements UIObserver {
/** /**
* 增加布局 * 增加布局
*
* @param name 名字 * @param name 名字
* @param comp 组件 * @param comp 组件
*/ */
@ -247,6 +257,7 @@ public class UICorrelationComboBoxPane extends JPanel implements UIObserver {
/** /**
* 删除组件 * 删除组件
*
* @param comp 组件 * @param comp 组件
*/ */
public void removeLayoutComponent(Component comp) { public void removeLayoutComponent(Component comp) {
@ -255,6 +266,7 @@ public class UICorrelationComboBoxPane extends JPanel implements UIObserver {
/** /**
* 获得组件的大小 * 获得组件的大小
*
* @param parent 上层容器 * @param parent 上层容器
* @return 组件的大小 * @return 组件的大小
*/ */
@ -265,6 +277,7 @@ public class UICorrelationComboBoxPane extends JPanel implements UIObserver {
/** /**
* 最小的布局大小 * 最小的布局大小
*
* @param parent 上层容器 * @param parent 上层容器
* @return 最小的大小 * @return 最小的大小
*/ */
@ -274,6 +287,7 @@ public class UICorrelationComboBoxPane extends JPanel implements UIObserver {
/** /**
* 布局容器 * 布局容器
*
* @param parent 上层容器 * @param parent 上层容器
*/ */
public void layoutContainer(Container parent) { public void layoutContainer(Container parent) {
@ -287,6 +301,7 @@ public class UICorrelationComboBoxPane extends JPanel implements UIObserver {
/** /**
* 增加监听事件 * 增加监听事件
*
* @param l 监听的对象 * @param l 监听的对象
*/ */
public void addChangeListener(ChangeListener l) { public void addChangeListener(ChangeListener l) {
@ -296,6 +311,7 @@ public class UICorrelationComboBoxPane extends JPanel implements UIObserver {
/** /**
* 删除监听事件 * 删除监听事件
*
* @param l 需要删除的事件 * @param l 需要删除的事件
*/ */
public void removeChangeListener(ChangeListener l) { public void removeChangeListener(ChangeListener l) {
@ -337,6 +353,7 @@ public class UICorrelationComboBoxPane extends JPanel implements UIObserver {
/** /**
* 更新并且重载 当前列表的值 * 更新并且重载 当前列表的值
*
* @param list 更新的列表 * @param list 更新的列表
*/ */
public void populateBean(List list) { public void populateBean(List list) {
@ -353,14 +370,14 @@ public class UICorrelationComboBoxPane extends JPanel implements UIObserver {
/** /**
* 重置每个条目的名字 * 重置每个条目的名字
*/ */
public void resetItemName(){ public void resetItemName() {
for(int i = 0; i < tablePane.getRowCount(); i++){ for (int i = 0; i < tablePane.getRowCount(); i++) {
UIMenuNameableCreator line = tablePane.getLine(i); UIMenuNameableCreator line = tablePane.getLine(i);
Object obj = line.getObj(); Object obj = line.getObj();
if(obj instanceof AbstractJavaScript){ if (obj instanceof AbstractJavaScript) {
AbstractJavaScript script = (AbstractJavaScript)obj; AbstractJavaScript script = (AbstractJavaScript) obj;
String itemName = script.getItemName(); String itemName = script.getItemName();
if(!StringUtils.isBlank(itemName)){ if (!StringUtils.isBlank(itemName)) {
line.setName(itemName); line.setName(itemName);
} }
} }
@ -369,6 +386,7 @@ public class UICorrelationComboBoxPane extends JPanel implements UIObserver {
/** /**
* 测试例子界面 * 测试例子界面
*
* @param args 参数向量 * @param args 参数向量
*/ */
public static void main(String... args) { public static void main(String... args) {
@ -397,6 +415,7 @@ public class UICorrelationComboBoxPane extends JPanel implements UIObserver {
/** /**
* 注册观察者监听事件 * 注册观察者监听事件
*
* @param listener 观察者监听事件 * @param listener 观察者监听事件
*/ */
public void registerChangeListener(UIObserverListener listener) { public void registerChangeListener(UIObserverListener listener) {
@ -406,6 +425,7 @@ public class UICorrelationComboBoxPane extends JPanel implements UIObserver {
/** /**
* 是否需要响应事件 * 是否需要响应事件
*
* @return 需要相应 * @return 需要相应
*/ */
public boolean shouldResponseChangeListener() { public boolean shouldResponseChangeListener() {

16
designer-base/src/main/java/com/fr/design/gui/icombobox/UIComboBox.java

@ -15,6 +15,7 @@ import java.awt.event.FocusAdapter;
import java.awt.event.FocusEvent; import java.awt.event.FocusEvent;
import java.awt.event.ItemEvent; import java.awt.event.ItemEvent;
import java.awt.event.ItemListener; import java.awt.event.ItemListener;
import java.util.List;
import java.util.Vector; import java.util.Vector;
/** /**
@ -131,6 +132,21 @@ public class UIComboBox extends JComboBox implements UIObserver, GlobalNameObser
return new Dimension(super.getPreferredSize().width + SIZE5, SIZE); return new Dimension(super.getPreferredSize().width + SIZE5, SIZE);
} }
public void refreshBoxItems(List list) {
Object ob = getSelectedItem();
removeAllItems();
for (Object o : list) {
addItem(o);
}
getModel().setSelectedItem(ob);
}
public void clearBoxItems() {
removeAllItems();
}
/** /**
* 鼠标进入事件 * 鼠标进入事件
*/ */

233
designer-base/src/main/java/com/fr/design/gui/icombocheckbox/UICheckListPopup.java

@ -0,0 +1,233 @@
package com.fr.design.gui.icombocheckbox;
import com.fr.base.BaseUtils;
import com.fr.design.constants.UIConstants;
import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.imenu.UIPopupMenu;
import com.fr.design.icon.IconPathConstants;
import com.fr.design.layout.FRGUIPaneFactory;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.util.ArrayList;
import java.util.List;
public class UICheckListPopup extends UIPopupMenu {
private List<ActionListener> listeners = new ArrayList<ActionListener>();
private List<JCheckBox> checkBoxList = new ArrayList<JCheckBox>();
private Object[] values;
private JPanel checkboxPane;
private UIScrollPane jScrollPane;
private Color mouseEnteredColor = UIConstants.CHECKBOX_HOVER_SELECTED;
private int maxDisplayNumber = 8;
public static final String COMMIT_EVENT = "commit";
public static final String SELECT_ALL = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Choose_All");
private static final int CHECKBOX_HEIGHT = 25;
public UICheckListPopup(Object[] value) {
super();
values = value;
initComponent();
}
public void setMouseEnteredColor(Color color) {
this.mouseEnteredColor = color;
}
public void setMaxDisplayNumber(int maxDisplayNumber) {
this.maxDisplayNumber = maxDisplayNumber;
addCheckboxValues(values);
}
private void initComponent() {
checkboxPane = new JPanel();
checkboxPane.setLayout(new GridLayout(checkBoxList.size(), 1, 0, 0));
checkboxPane.setBackground(Color.WHITE);
jScrollPane = new UIScrollPane(checkboxPane);
this.setLayout(new BorderLayout());
this.add(jScrollPane, BorderLayout.CENTER);
addCheckboxValues(values);
}
public void addCheckboxValues(Object[] value) {
checkboxPane.removeAll();
checkBoxList.clear();
//全选加在第一个位置
addOneCheckValue(SELECT_ALL);
for (Object checkValue : value) {
addOneCheckValue(checkValue);
}
addSelectListener();
jScrollPane.setPreferredSize(new Dimension(200, checkBoxList.size() * CHECKBOX_HEIGHT + 10));
//超过1页的数量时显示滚动条
if (checkBoxList.size() > maxDisplayNumber) {
jScrollPane.setPreferredSize(new Dimension(200, maxDisplayNumber * CHECKBOX_HEIGHT));
}
checkboxPane.repaint();
jScrollPane.repaint();
}
private void addOneCheckValue(Object checkValue) {
JPanel checkPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
checkPane.setPreferredSize(new Dimension(185, CHECKBOX_HEIGHT));
final JCheckBox temp = createCheckbox();
final UILabel label = new UILabel(checkValue.toString());
label.setBackground(Color.WHITE);
label.setPreferredSize(new Dimension(156, 20));
checkPane.setBackground(Color.WHITE);
checkPane.add(temp);
checkPane.add(label);
addMouseListener(temp, label);
checkBoxList.add(temp);
checkboxPane.add(checkPane);
}
private JCheckBox createCheckbox() {
JCheckBox checkBox = new JCheckBox();
checkBox.setPreferredSize(new Dimension(20, 20));
checkBox.setBackground(Color.WHITE);
checkBox.setIcon(BaseUtils.readIcon(IconPathConstants.CHECKBOX_NORMAL));
checkBox.setSelectedIcon(BaseUtils.readIcon(IconPathConstants.CHECKBOX_SELECTED));
return checkBox;
}
/**
* 设置鼠标事件鼠标进入时背景色变换
*
* @param checkBox
* @param label
*/
private void addMouseListener(final JCheckBox checkBox, final UILabel label) {
label.addMouseListener(new MouseAdapter() {
public void mouseExited(MouseEvent e) {
label.setBackground(Color.WHITE);
}
public void mouseEntered(MouseEvent e) {
label.setOpaque(true);
label.setBackground(mouseEnteredColor);
}
@Override
public void mouseClicked(MouseEvent e) {
checkBox.doClick();
}
});
}
/**
* 单选框选中事件
*/
private void addSelectListener() {
for (int i = 0; i < checkBoxList.size(); i++) {
JCheckBox checkBox = checkBoxList.get(i);
if (i == 0) {
checkBox.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent e) {
//全选checkbox事件
doSelectAll(checkBoxList.get(0).isSelected());
}
});
} else {
checkBox.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent e) {
//do半选判断放在commit事件里
commit();
}
});
}
}
}
/**
* 全选
*
* @param isSelected 选中是true未选是false
*/
private void doSelectAll(boolean isSelected) {
for (int i = 1; i < checkBoxList.size(); i++) {
//全选和反全选都不考虑全选按钮本身
if (!SELECT_ALL.equals(checkBoxList.get(i).getText()))
checkBoxList.get(i).setSelected(isSelected);
}
}
/**
* 获取所有选中的值
*
* @return
*/
public Object[] getSelectedValues() {
List<Object> selectedValues = new ArrayList<Object>();
int selectCount = 0;
for (int i = 1; i < checkBoxList.size(); i++) {
if (checkBoxList.get(i).isSelected()) {
selectedValues.add(values[i - 1]);
selectCount++;
}
}
//全选半选切换
switchSelectIcon(selectCount);
return selectedValues.toArray(new Object[selectedValues.size()]);
}
/**
* 切换全选半选图片
*/
private void switchSelectIcon(int selectCount) {
JCheckBox checkBox = checkBoxList.get(0);
if (selectCount == 0) {
checkBox.setIcon(BaseUtils.readIcon(IconPathConstants.CHECKBOX_NORMAL));
} else if (selectCount < checkBoxList.size() - 1) {
//虽然有选中,但是要判断此时全选状态去换图标
if (checkBoxList.get(0).isSelected()) {
checkBox.setSelectedIcon(BaseUtils.readIcon(IconPathConstants.CHECKBOX_HATFSELECT));
} else {
checkBox.setIcon(BaseUtils.readIcon(IconPathConstants.CHECKBOX_HATFSELECT));
}
} else {
//全选了,图标要换回来
checkBox.setSelectedIcon(BaseUtils.readIcon(IconPathConstants.CHECKBOX_SELECTED));
}
}
public void commit() {
fireActionPerformed(new ActionEvent(this, 0, COMMIT_EVENT));
}
@Override
public Insets getInsets() {
return new Insets(0, 0, 0, 0);
}
public void addActionListener(ActionListener listener) {
if (!listeners.contains(listener))
listeners.add(listener);
}
public void removeActionListener(ActionListener listener) {
if (listeners.contains(listener)) {
listeners.remove(listener);
}
}
protected void fireActionPerformed(ActionEvent e) {
for (ActionListener l : listeners) {
l.actionPerformed(e);
}
}
}

330
designer-base/src/main/java/com/fr/design/gui/icombocheckbox/UIComboCheckBox.java

@ -0,0 +1,330 @@
package com.fr.design.gui.icombocheckbox;
import com.fr.base.BaseUtils;
import com.fr.design.event.GlobalNameListener;
import com.fr.design.event.GlobalNameObserver;
import com.fr.design.event.UIObserver;
import com.fr.design.event.UIObserverListener;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.icon.IconPathConstants;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.stable.StringUtils;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.ArrayList;
import java.util.List;
/**
* 设计器下拉复选框组件
* 支持全选半选
* 可以设置悬停颜色一页最多显示单选框个数
* 可以省略显示
*/
public class UIComboCheckBox extends JComponent implements UIObserver, GlobalNameObserver {
//下拉框的值
private Object[] values;
//已经选中的值
private Object[] selectedValues;
private List<ActionListener> listeners = new ArrayList<ActionListener>();
private UICheckListPopup popup;
private UITextField editor;
private UIButton arrowButton;
//选中的值之间显示的分隔符
private String valueSperator;
private static final String DEFAULT_VALUE_SPERATOR = ",";
private static final String OMIT_TEXT = "...";
private UIObserverListener uiObserverListener;
private GlobalNameListener globalNameListener = null;
private String multiComboName = StringUtils.EMPTY;
private boolean showOmitText = true;
public UIComboCheckBox(Object[] value) {
this(value, DEFAULT_VALUE_SPERATOR);
}
/**
* 自定义分隔符的复选框
*
* @param value
* @param valueSperator
*/
public UIComboCheckBox(Object[] value, String valueSperator) {
values = value;
this.valueSperator = valueSperator;
initComponent();
}
/**
* 设置鼠标悬停的背景色
*
* @param color
*/
public void setCheckboxEnteredColor(Color color) {
this.popup.setMouseEnteredColor(color);
}
/**
* 设置弹出框最多显示单选的个数超过显示滚动条
*/
public void setPopupMaxDisplayNumber(int maxDisplayNumber) {
this.popup.setMaxDisplayNumber(maxDisplayNumber);
}
/**
* 是否要超过文本框长度后显示省略号
*
* @param isShowOmitText
*/
public void isShowOmitText(boolean isShowOmitText) {
this.showOmitText = isShowOmitText;
}
private void initComponent() {
this.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
this.popup = new UICheckListPopup(values);
this.popup.addActionListener(new PopupAction());
this.editor = createEditor();
this.arrowButton = createArrowButton();
this.add(editor);
this.add(arrowButton);
setText();
}
private UIButton createArrowButton() {
final UIButton arrowBtn = new UIButton();
arrowBtn.setNormalPainted(false);
arrowBtn.setPreferredSize(new Dimension(20, 5));
arrowBtn.setBackground(new Color(218, 218, 218));
arrowBtn.setOpaque(true);
arrowBtn.setIcon(getIcon());
arrowBtn.setExtraPainted(false);
addPopupListener(arrowBtn);
arrowBtn.addMouseListener(new MouseAdapter() {
@Override
public void mouseEntered(MouseEvent e) {
arrowBtn.setBackground(new Color(200, 200, 200));
}
@Override
public void mouseExited(MouseEvent e) {
arrowBtn.setBackground(new Color(218, 218, 218));
}
});
return arrowBtn;
}
private UITextField createEditor() {
UITextField editor = new UITextField();
editor.setEditable(false);
editor.setPreferredSize(new Dimension(180, 20));
addPopupListener(editor);
return editor;
}
/**
* 弹出框事件
*
* @param component
*/
private void addPopupListener(Component component) {
component.addMouseListener(new MouseAdapter() {
public void mouseClicked(MouseEvent e) {
togglePopup();
}
});
}
/**
* 刷新复选框的列表值
*
* @param value
*/
public void refreshCombo(Object[] value) {
this.values = value;
this.popup.addCheckboxValues(value);
}
/**
* 获取复选框选中的值
*
* @return 复选框选中的值
*/
public Object[] getSelectedValues() {
return popup.getSelectedValues();
}
private class PopupAction implements ActionListener {
public void actionPerformed(ActionEvent e) {
if (e.getActionCommand().equals(UICheckListPopup.COMMIT_EVENT)) {
selectedValues = popup.getSelectedValues();
setText();
//把事件继续传递出去
fireActionPerformed(e);
}
}
}
private void togglePopup() {
if (this.arrowButton.isEnabled()) {
popup.show(this, 0, getHeight());
}
}
/**
* 清除文本框
*/
public void clearText() {
editor.setText(StringUtils.EMPTY);
}
/**
* 获取文本框内容
*/
public String getText() {
return editor.getText();
}
/**
* 文本框设置显示值
*/
private void setText() {
StringBuilder builder = new StringBuilder();
if (selectedValues != null) {
for (Object value : selectedValues) {
builder.append(value);
builder.append(valueSperator);
}
}
//去掉末尾多余的逗号
String text = builder.length() > 0 ? builder.substring(0, builder.length() - 1) : StringUtils.EMPTY;
//计算加省略号后的文本
editor.setText(this.showOmitText ? omitEditorText(editor, text) : text);
}
/**
* 根据字体大小计算得到省略后的文字
*
* @param textEditor
* @param text
* @return 省略后的文字
*/
private static String omitEditorText(UITextField textEditor, String text) {
char[] omitChars = OMIT_TEXT.toCharArray();
//获取字体的大小
FontMetrics fontMetrics = textEditor.getFontMetrics(textEditor.getFont());
//计算省略号的长度
int omitLength = fontMetrics.charsWidth(omitChars, 0, omitChars.length);
String omitText = StringUtils.EMPTY;
char[] chars = text.toCharArray();
for (int i = 1; i <= chars.length; i++) {
//如果原文本+省略号长度超过文本框
if (fontMetrics.charsWidth(chars, 0, i) + omitLength > textEditor.getPreferredSize().getWidth()) {
//从第i-1的位置截断再拼上省略号
omitText = text.substring(0, i - 2) + OMIT_TEXT;
break;
}
}
return omitText == StringUtils.EMPTY ? text : omitText;
}
/**
* 给组件登记一个观察者监听事件
*
* @param listener 观察者监听事件
*/
@Override
public void registerChangeListener(UIObserverListener listener) {
this.uiObserverListener = listener;
}
@Override
public void setGlobalName(String name) {
multiComboName = name;
}
/**
* 组件是否需要响应添加的观察者事件
*
* @return 如果需要响应观察者事件则返回true否则返回false
*/
@Override
public boolean shouldResponseChangeListener() {
return true;
}
/**
* 注册观察者监听事件
*
* @param listener 观察者监听事件
*/
@Override
public void registerNameListener(GlobalNameListener listener) {
globalNameListener = listener;
}
private Icon getIcon() {
return BaseUtils.readIcon(IconPathConstants.ARROW_ICON_PATH);
}
/**
* 组件是否需要响应观察者事件
*
* @return 如果需要响应观察者事件则返回true否则返回false
*/
@Override
public boolean shouldResponseNameListener() {
return true;
}
public void addActionListener(ActionListener listener) {
if (!listeners.contains(listener))
listeners.add(listener);
}
public void removeActionListener(ActionListener listener) {
if (listeners.contains(listener))
listeners.remove(listener);
}
protected void fireActionPerformed(ActionEvent e) {
for (ActionListener l : listeners) {
l.actionPerformed(e);
}
}
/**
* 简单的测试demo
* @param args
*/
public static void main(String args[]) {
UIComboCheckBox comboBox = new UIComboCheckBox(new Object[]
{"MATA", "HANA", "KAKA", "KUKA", "INFI", "LILY", "RIBO", "CUBE", "MATA", "HANA", "KAKA", "KUKA"});
comboBox.isShowOmitText(false);
comboBox.setPopupMaxDisplayNumber(6);
JPanel jPanel = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
jPanel.add(comboBox);
JFrame jFrame = new JFrame();
jFrame.setVisible(true);
jFrame.setSize(600, 400);
jFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
jFrame.add(jPanel, BorderLayout.CENTER);
}
}

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

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

4
designer-base/src/main/java/com/fr/design/icon/IconPathConstants.java

@ -33,4 +33,8 @@ public class IconPathConstants {
public static final String XMLA_ICON_PATH = "/com/fr/design/images/data/cube.png"; public static final String XMLA_ICON_PATH = "/com/fr/design/images/data/cube.png";
public static final String FORBID_ICON_PATH = "/com/fr/web/images/form/forbid.png"; public static final String FORBID_ICON_PATH = "/com/fr/web/images/form/forbid.png";
public static final String EDIT_ICON_PATH = "/com/fr/design/images/control/newEdit.png"; public static final String EDIT_ICON_PATH = "/com/fr/design/images/control/newEdit.png";
public static final String ARROW_ICON_PATH = "com/fr/design/images/buttonicon/arrow.png";
public static final String CHECKBOX_NORMAL = "com/fr/design/images/buttonicon/control_checkbox_normal.png";
public static final String CHECKBOX_SELECTED = "com/fr/design/images/buttonicon/control_checkbox_selected.png";
public static final String CHECKBOX_HATFSELECT = "com/fr/design/images/buttonicon/control_checkbox_part.png";
} }

5
designer-base/src/main/java/com/fr/design/javascript/JavaScriptActionPane.java

@ -9,7 +9,6 @@ import com.fr.design.gui.frpane.UIComboBoxPane;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.write.submit.DBManipulationPane; import com.fr.design.write.submit.DBManipulationPane;
import com.fr.form.ui.WebContentUtils; import com.fr.form.ui.WebContentUtils;
import com.fr.js.JavaScript; import com.fr.js.JavaScript;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
@ -46,7 +45,9 @@ public abstract class JavaScriptActionPane extends UIComboBoxPane<JavaScript> {
Set<JavaScriptActionProvider> javaScriptActionProviders = ExtraDesignClassManager.getInstance().getArray(JavaScriptActionProvider.XML_TAG); Set<JavaScriptActionProvider> javaScriptActionProviders = ExtraDesignClassManager.getInstance().getArray(JavaScriptActionProvider.XML_TAG);
if (javaScriptActionProviders != null) { if (javaScriptActionProviders != null) {
for (JavaScriptActionProvider jsp : javaScriptActionProviders) { for (JavaScriptActionProvider jsp : javaScriptActionProviders) {
paneList.add(jsp.getJavaScriptActionPane(this)); if(jsp.isSupportType()){
paneList.add(jsp.getJavaScriptActionPane(this));
}
} }
} }
// 自定义事件 // 自定义事件

7
designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java

@ -246,6 +246,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
} }
new MkdirDialog(); new MkdirDialog();
stateChange();
} }
} }
@ -263,7 +264,6 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
@Override @Override
public void actionPerformed(ActionEvent evt) { public void actionPerformed(ActionEvent evt) {
selectedOperation.showInExplorer(); selectedOperation.showInExplorer();
} }
} }
@ -281,10 +281,8 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
@Override @Override
public void actionPerformed(ActionEvent evt) { public void actionPerformed(ActionEvent evt) {
selectedOperation.refresh(); selectedOperation.refresh();
stateChange(); stateChange();
} }
} }
@ -322,6 +320,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
new FileRenameDialog(node); new FileRenameDialog(node);
MutilTempalteTabPane.getInstance().repaint(); MutilTempalteTabPane.getInstance().repaint();
stateChange();
} }
} }
@ -347,8 +346,8 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
WARNING_MESSAGE); WARNING_MESSAGE);
return; return;
} }
selectedOperation.deleteFile(); selectedOperation.deleteFile();
stateChange();
} }
} }

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

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

106
designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/ColorBackgroundQuickPane.java

@ -18,18 +18,18 @@ import java.awt.Color;
*/ */
public class ColorBackgroundQuickPane extends BackgroundQuickPane { public class ColorBackgroundQuickPane extends BackgroundQuickPane {
private NewColorSelectPane detailColorSelectPane; private NewColorSelectPane detailColorSelectPane;
private boolean isBackGroundColor; private boolean isBackGroundColor;
public ColorBackgroundQuickPane() { public ColorBackgroundQuickPane() {
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
detailColorSelectPane = new NewColorSelectPane(); detailColorSelectPane = new NewColorSelectPane();
this.add(detailColorSelectPane, BorderLayout.NORTH); this.add(detailColorSelectPane, BorderLayout.NORTH);
} }
public void populateBean(Background background) { public void populateBean(Background background) {
ColorBackground colorBackgroud = (ColorBackground) background; ColorBackground colorBackgroud = (ColorBackground) background;
populateColor(colorBackgroud.getColor()); populateColor(colorBackgroud.getColor());
} }
@ -47,48 +47,48 @@ public class ColorBackgroundQuickPane extends BackgroundQuickPane {
return this.detailColorSelectPane.getNotNoneColor(); return this.detailColorSelectPane.getNotNoneColor();
} }
public boolean isBackGroundColor(){ public boolean isBackGroundColor() {
return isBackGroundColor; return isBackGroundColor;
} }
/** /**
* 给组件登记一个观察者监听事件 * 给组件登记一个观察者监听事件
* *
* @param listener 观察者监听事件 * @param listener 观察者监听事件
*/ */
public void registerChangeListener(final UIObserverListener listener) { public void registerChangeListener(final UIObserverListener listener) {
detailColorSelectPane.addChangeListener(new ChangeListener() { detailColorSelectPane.addChangeListener(new ChangeListener() {
public void stateChanged(ChangeEvent e) { public void stateChanged(ChangeEvent e) {
isBackGroundColor = true; isBackGroundColor = true;
listener.doChange(); listener.doChange();
isBackGroundColor = false; isBackGroundColor = false;
} }
}); });
} }
@Override @Override
/** /**
* 是否为ColorBackground 类型 * 是否为ColorBackground 类型
* *
* @param background 背景 * @param background 背景
* @return 同上 * @return 同上
* *
*/ */
public boolean accept(Background background) { public boolean accept(Background background) {
return background instanceof ColorBackground; return background instanceof ColorBackground;
} }
@Override @Override
/** /**
* 窗口名称 * 窗口名称
* @return 同上 * @return 同上
*/ */
public String title4PopupWindow() { public String title4PopupWindow() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Color"); return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Color");
} }
@Override @Override
public void reset() { public void reset() {
this.detailColorSelectPane.setColor(null); this.detailColorSelectPane.setColor(null);
} }
} }

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

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

21
designer-base/src/main/java/com/fr/design/remote/ui/AuthorityListControlPane.java

@ -253,23 +253,16 @@ public class AuthorityListControlPane extends BasicPane {
* @param authorities authority * @param authorities authority
*/ */
public void setAuthority(List<DesignAuthority> authorities) { public void setAuthority(List<DesignAuthority> authorities) {
if (authorities == null || authorities.isEmpty()) {
return;
}
DefaultListModel<DesignAuthority> model = (DefaultListModel<DesignAuthority>) authorityList.getModel(); DefaultListModel<DesignAuthority> model = (DefaultListModel<DesignAuthority>) authorityList.getModel();
model.clear(); model.clear();
if (authorities != null && !authorities.isEmpty()) {
for (DesignAuthority authority : authorities) { for (DesignAuthority authority : authorities) {
model.addElement(authority); model.addElement(authority);
}
int size = model.getSize() - 1;
authorityList.setSelectedIndex(size);
authorityList.ensureIndexIsVisible(size);
} }
int size = model.getSize() - 1;
authorityList.setSelectedIndex(size);
authorityList.ensureIndexIsVisible(size);
authorityList.revalidate(); authorityList.revalidate();
authorityList.repaint(); authorityList.repaint();
} }

18
designer-base/src/main/java/com/fr/design/remote/ui/UserManagerPane.java

@ -1,5 +1,6 @@
package com.fr.design.remote.ui; package com.fr.design.remote.ui;
import com.fr.base.BaseUtils;
import com.fr.design.border.UITitledBorder; import com.fr.design.border.UITitledBorder;
import com.fr.design.constants.LayoutConstants; import com.fr.design.constants.LayoutConstants;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
@ -57,7 +58,7 @@ public class UserManagerPane extends BasicPane {
/** /**
* 每页个数 * 每页个数
*/ */
private final int DEFAULT_NUM_EACH_PAGE = 50; private static final int DEFAULT_NUM_EACH_PAGE = 50;
/** /**
* 获取的决策平台成员 * 获取的决策平台成员
@ -170,7 +171,7 @@ public class UserManagerPane extends BasicPane {
/** /**
* 搜索关键词变更监听 * 搜索关键词变更监听
*/ */
private DocumentListener documentListener = new DocumentListener() { private transient DocumentListener documentListener = new DocumentListener() {
@Override @Override
public void insertUpdate(DocumentEvent e) { public void insertUpdate(DocumentEvent e) {
keyWord = keyField.getText(); keyWord = keyField.getText();
@ -240,13 +241,14 @@ public class UserManagerPane extends BasicPane {
); );
// 搜索 // 搜索
JPanel searchPanel = new JPanel(new FlowLayout(FlowLayout.LEFT)); JPanel searchPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 5));
searchPanel.setBorder(BorderFactory.createEmptyBorder()); searchPanel.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5));
keyField.setPreferredSize(new Dimension(250, 20)); keyField.setPreferredSize(new Dimension(270, 20));
keyField.requestFocus(); keyField.requestFocus();
keyField.addKeyListener(keyFieldKeyListener); keyField.addKeyListener(keyFieldKeyListener);
keyField.getDocument().addDocumentListener(documentListener); keyField.getDocument().addDocumentListener(documentListener);
keyButton.setText(Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Search")); keyButton.setIcon(BaseUtils.readIcon("com/fr/design/images/buttonicon/user_search_normal.png"));
keyButton.setToolTipText(Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Search"));
keyButton.addActionListener(keyButtonActionListener); keyButton.addActionListener(keyButtonActionListener);
searchPanel.add(keyField); searchPanel.add(keyField);
searchPanel.add(keyButton); searchPanel.add(keyButton);
@ -367,9 +369,9 @@ public class UserManagerPane extends BasicPane {
final SwingWorker getMemberWorker = new SwingWorker<List<RemoteDesignMember>, Void>() { final SwingWorker getMemberWorker = new SwingWorker<List<RemoteDesignMember>, Void>() {
@Override @Override
protected List<RemoteDesignMember> doInBackground() { protected List<RemoteDesignMember> doInBackground() {
addingMembers.clear();
String username = WorkContext.getCurrent().getConnection().getUserName(); String username = WorkContext.getCurrent().getConnection().getUserName();
synchronized (addingMembers) { synchronized (addingMembers) {
addingMembers.clear();
Collection<RemoteDesignMember> more = WorkContext.getCurrent().get(DecisionOperator.class).getMembers(username, keyword); Collection<RemoteDesignMember> more = WorkContext.getCurrent().get(DecisionOperator.class).getMembers(username, keyword);
pageNum = 1; pageNum = 1;
if (!more.isEmpty()) { if (!more.isEmpty()) {
@ -395,7 +397,7 @@ public class UserManagerPane extends BasicPane {
final SwingWorker loadMoreWorker = new SwingWorker<List<RemoteDesignMember>, Void>() { final SwingWorker loadMoreWorker = new SwingWorker<List<RemoteDesignMember>, Void>() {
@Override @Override
protected List<RemoteDesignMember> doInBackground() { protected List<RemoteDesignMember> doInBackground() {
String username = WorkContext.getCurrent().getConnection().getUserName(); String username = WorkContext.getCurrent().getConnection().getUserName();
synchronized (addingMembers) { synchronized (addingMembers) {
addingMembers.remove(RemoteDesignMember.DEFAULT_MEMBER); addingMembers.remove(RemoteDesignMember.DEFAULT_MEMBER);

10
designer-base/src/main/java/com/fr/file/FILEChooserPane.java

@ -23,7 +23,6 @@ import com.fr.design.mainframe.DesignerFrame;
import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.JTemplate;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.file.filetree.FileNode; import com.fr.file.filetree.FileNode;
import com.fr.file.filetree.LocalFileNodes;
import com.fr.file.filter.ChooseFileFilter; import com.fr.file.filter.ChooseFileFilter;
import com.fr.file.filter.FILEFilter; import com.fr.file.filter.FILEFilter;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
@ -693,14 +692,9 @@ public class FILEChooserPane extends BasicPane {
String appName = ProductConstants.APP_NAME; String appName = ProductConstants.APP_NAME;
JTemplate editing = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); JTemplate editing = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
if (editing == null || !editing.isChartBook()) { if (editing == null || !editing.isChartBook()) {
String[] fileSuffix_local = LocalFileNodes.FILE_TYPE;
EnumSet<FileExtension> fileExtensions = EnumSet.of(FileExtension.CPT, FileExtension.CPTX, FileExtension.FRM, FileExtension.FRMX, FileExtension.CHT);
if (type == JFileChooser.OPEN_DIALOG) { if (type == JFileChooser.OPEN_DIALOG) {
if (WorkContext.getCurrent().isLocal()) { //本地连接 this.addChooseFILEFilter(new ChooseFileFilter(FRContext.getFileNodes().getSupportedTypes(), appName + Toolkit.i18nText("Fine-Design_Report_Template_File")));
this.addChooseFILEFilter(new ChooseFileFilter(fileSuffix_local, appName + Toolkit.i18nText("Fine-Design_Report_Template_File")));
} else {
this.addChooseFILEFilter(new ChooseFileFilter(fileExtensions, appName + Toolkit.i18nText("Fine-Design_Report_Template_File")));
}
} }
// ben:filefilter设置初值为cpt过滤 // ben:filefilter设置初值为cpt过滤

BIN
designer-base/src/main/resources/com/fr/design/images/buttonicon/control_checkbox_normal.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 164 B

BIN
designer-base/src/main/resources/com/fr/design/images/buttonicon/control_checkbox_part.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 200 B

BIN
designer-base/src/main/resources/com/fr/design/images/buttonicon/control_checkbox_selected.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 337 B

BIN
designer-base/src/main/resources/com/fr/design/images/buttonicon/user_search_normal.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 444 B

BIN
designer-base/src/main/resources/com/fr/design/images/buttonicon/user_search_normal@2x.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 844 B

5
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypePane.java

@ -152,8 +152,9 @@ public class ChartTypePane extends AbstractChartAttrPane{
try{ try{
Chart newDefaultChart = (Chart)((AbstractChartTypePane)getSelectedPane()).getDefaultChart().clone(); Chart newDefaultChart = (Chart)((AbstractChartTypePane)getSelectedPane()).getDefaultChart().clone();
if(!chart.accept(newDefaultChart.getClass())){ if (!ComparatorUtils.equals(chart.getClass(), newDefaultChart.getClass())) {
//vanChart 和 chart 之间切换 //vanChart 和 chart 之间切换
//不同chart之间切换
editingCollection.removeNameObject(editingCollection.getSelectedIndex()); editingCollection.removeNameObject(editingCollection.getSelectedIndex());
editingCollection.addChart(newDefaultChart); editingCollection.addChart(newDefaultChart);
chart = newDefaultChart; chart = newDefaultChart;

12
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/DataPaneHelper.java

@ -21,15 +21,7 @@ public class DataPaneHelper {
return; return;
} }
Object ob = box.getSelectedItem(); box.refreshBoxItems(list);
box.removeAllItems();
int length = list.size();
for (int i = 0; i < length; i++) {
box.addItem(list.get(i));
}
box.getModel().setSelectedItem(ob);
} }
/** /**
@ -39,7 +31,7 @@ public class DataPaneHelper {
*/ */
public static void clearBoxItems(UIComboBox box) { public static void clearBoxItems(UIComboBox box) {
if (box != null) { if (box != null) {
box.removeAllItems(); box.clearBoxItems();
} }
} }

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

@ -7,12 +7,17 @@ import com.fr.design.chart.series.SeriesCondition.impl.ChartHyperPoplinkPane;
import com.fr.design.chart.series.SeriesCondition.impl.ChartHyperRelateCellLinkPane; import com.fr.design.chart.series.SeriesCondition.impl.ChartHyperRelateCellLinkPane;
import com.fr.design.chart.series.SeriesCondition.impl.ChartHyperRelateFloatLinkPane; import com.fr.design.chart.series.SeriesCondition.impl.ChartHyperRelateFloatLinkPane;
import com.fr.design.chart.series.SeriesCondition.impl.FormHyperlinkPane; import com.fr.design.chart.series.SeriesCondition.impl.FormHyperlinkPane;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.gui.controlpane.NameObjectCreator; import com.fr.design.gui.controlpane.NameObjectCreator;
import com.fr.design.gui.controlpane.NameableCreator; import com.fr.design.gui.controlpane.NameableCreator;
import com.fr.design.gui.frpane.BaseHyperlinkGroup; import com.fr.design.gui.frpane.BaseHyperlinkGroup;
import com.fr.design.mainframe.BaseJForm;
import com.fr.design.mainframe.JTemplate;
import com.fr.general.ComparatorUtils;
import com.fr.js.FormHyperlinkProvider; import com.fr.js.FormHyperlinkProvider;
import com.fr.js.JavaScript;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.stable.Filter;
import com.fr.stable.bridge.StableFactory; import com.fr.stable.bridge.StableFactory;
/** /**
@ -31,12 +36,82 @@ public class ChartHyperlinkGroup extends BaseHyperlinkGroup {
public NameableCreator[] getHyperlinkCreators() { public NameableCreator[] getHyperlinkCreators() {
FormHyperlinkProvider formHyperlink = StableFactory.getMarkedInstanceObjectFromClass(FormHyperlinkProvider.XML_TAG, FormHyperlinkProvider.class); FormHyperlinkProvider formHyperlink = StableFactory.getMarkedInstanceObjectFromClass(FormHyperlinkProvider.XML_TAG, FormHyperlinkProvider.class);
NameableCreator[] realted4CharthyperUse = { NameableCreator[] related4ChartHyper = {
new NameObjectCreator(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Float_Chart"), ChartHyperPoplink.class, ChartHyperPoplinkPane.ChartNoRename.class), new NameObjectCreator(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Float_Chart"), ChartHyperPoplink.class, ChartHyperPoplinkPane.ChartNoRename.class),
new NameObjectCreator(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Cell"), ChartHyperRelateCellLink.class, ChartHyperRelateCellLinkPane.ChartNoRename.class), new NameObjectCreator(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Cell"), ChartHyperRelateCellLink.class, ChartHyperRelateCellLinkPane.ChartNoRename.class),
new NameObjectCreator(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Float"), ChartHyperRelateFloatLink.class, ChartHyperRelateFloatLinkPane.ChartNoRename.class), new NameObjectCreator(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Float"), ChartHyperRelateFloatLink.class, ChartHyperRelateFloatLinkPane.ChartNoRename.class),
new NameObjectCreator(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Hyperlink_Form_Link"), formHyperlink.getClass(), FormHyperlinkPane.class)}; new NameObjectCreator(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Hyperlink_Form_Link"), formHyperlink.getClass(), FormHyperlinkPane.class)};
return (NameableCreator[]) ArrayUtils.addAll(super.getHyperlinkCreators(), realted4CharthyperUse); return ArrayUtils.addAll(super.getHyperlinkCreators(), related4ChartHyper);
}
@Override
public Filter<Class<? extends JavaScript>> getFilter() {
return new Filter<Class<? extends JavaScript>>() {
@Override
public boolean accept(Class<? extends JavaScript> clazz) {
JTemplate template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
if (template == null) {
return false;
}
if (template.isJWorkBook()) {
// 如果是普通报表单元格,那么没有 FormHyperlink 选项
FormHyperlinkProvider formHyperlink = StableFactory.getMarkedInstanceObjectFromClass(FormHyperlinkProvider.XML_TAG, FormHyperlinkProvider.class);
//返回true表示可用,返回false表示不可用
return !ComparatorUtils.equals(clazz, formHyperlink.getClass());
} else {
// 如果是决策报表
Class[] classes = new Class[]{ChartHyperRelateCellLink.class, ChartHyperRelateFloatLink.class};
for (Class aClass : classes) {
if (template.getEditingReportIndex() == BaseJForm.FORM_TAB) {
// 编辑的是决策报表中的图表,那么没有ChartHyperRelateFloatLink 和 ChartHyperRelateCellLink 选项,有FormHyperlink 选项
if (ComparatorUtils.equals(aClass, clazz)) {
return false;
}
} else if (template.getEditingReportIndex() == BaseJForm.ELEMENTCASE_TAB) {
// 编辑的是决策报表中的报表块,那么没有 ChartHyperRelateFloatLink,有ChartHyperRelateCellLink 和 FormHyperlink 选项
return !ComparatorUtils.equals(clazz, ChartHyperRelateFloatLink.class);
}
}
}
return true;
}
};
}
@Override
public Filter<Object> getOldFilter() {
return new Filter<Object>() {
@Override
public boolean accept(Object object) {
JTemplate template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
if (template == null) {
return false;
}
if (template.isJWorkBook()) {
// 如果是普通报表单元格,那么没有 FormHyperlink 选项
FormHyperlinkProvider formHyperlink = StableFactory.getMarkedInstanceObjectFromClass(FormHyperlinkProvider.XML_TAG, FormHyperlinkProvider.class);
//返回true表示可用,返回false表示不可用
return !ComparatorUtils.equals(object.getClass(), formHyperlink.getClass());
} else {
// 如果是决策报表
Class[] classes = new Class[]{ChartHyperRelateCellLink.class, ChartHyperRelateFloatLink.class};
for (Class aClass : classes) {
if (template.getEditingReportIndex() == BaseJForm.FORM_TAB) {
// 编辑的是决策报表中的图表,那么没有ChartHyperRelateFloatLink 和 ChartHyperRelateCellLink 选项,有FormHyperlink 选项
if (ComparatorUtils.equals(aClass, object.getClass())) {
return false;
}
} else if (template.getEditingReportIndex() == BaseJForm.ELEMENTCASE_TAB) {
// 编辑的是决策报表中的报表块,那么没有 ChartHyperRelateFloatLink,有ChartHyperRelateCellLink 和 FormHyperlink 选项
return !ComparatorUtils.equals(object.getClass(), ChartHyperRelateFloatLink.class);
}
}
}
return true;
}
};
} }
} }

8
designer-chart/src/main/java/com/fr/design/module/FormHyperlinkGroup.java

@ -8,7 +8,6 @@ import com.fr.design.chart.series.SeriesCondition.impl.FormHyperlinkPane;
import com.fr.design.gui.controlpane.NameObjectCreator; import com.fr.design.gui.controlpane.NameObjectCreator;
import com.fr.design.gui.controlpane.NameableCreator; import com.fr.design.gui.controlpane.NameableCreator;
import com.fr.design.gui.frpane.BaseHyperlinkGroup; import com.fr.design.gui.frpane.BaseHyperlinkGroup;
import com.fr.js.FormHyperlinkProvider; import com.fr.js.FormHyperlinkProvider;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.stable.bridge.StableFactory; import com.fr.stable.bridge.StableFactory;
@ -23,15 +22,16 @@ public class FormHyperlinkGroup extends BaseHyperlinkGroup {
/** /**
* 返回支持的超级链接类型 * 返回支持的超级链接类型
*
* @return NameableCreator[] * @return NameableCreator[]
*/ */
public NameableCreator[] getHyperlinkCreators() { public NameableCreator[] getHyperlinkCreators() {
FormHyperlinkProvider formHyperlink = StableFactory.getMarkedInstanceObjectFromClass(FormHyperlinkProvider.XML_TAG, FormHyperlinkProvider.class); FormHyperlinkProvider formHyperlink = StableFactory.getMarkedInstanceObjectFromClass(FormHyperlinkProvider.XML_TAG, FormHyperlinkProvider.class);
NameableCreator[] realted4CharthyperUse = { NameableCreator[] related4ChartHyper = {
new NameObjectCreator(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Float_Chart"), ChartHyperPoplink.class, ChartHyperPoplinkPane.ChartNoRename.class), new NameObjectCreator(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Float_Chart"), ChartHyperPoplink.class, ChartHyperPoplinkPane.ChartNoRename.class),
new NameObjectCreator(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Cell"), ChartHyperRelateCellLink.class, ChartHyperRelateCellLinkPane.ChartNoRename.class), new NameObjectCreator(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Cell"), ChartHyperRelateCellLink.class, ChartHyperRelateCellLinkPane.ChartNoRename.class),
new NameObjectCreator(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Hyperlink_Form_Link"), formHyperlink.getClass(), FormHyperlinkPane.class)}; new NameObjectCreator(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Hyperlink_Form_Link"), formHyperlink.getClass(), FormHyperlinkPane.class)};
return (NameableCreator[]) ArrayUtils.addAll(super.getHyperlinkCreators(), realted4CharthyperUse); return ArrayUtils.addAll(super.getHyperlinkCreators(), related4ChartHyper);
} }
} }

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

@ -53,8 +53,8 @@ public abstract class AbstractExtendedChartTableDataPane<T extends AbstractDataC
this.setBorder(BorderFactory.createEmptyBorder(2, 24, 0, 15)); this.setBorder(BorderFactory.createEmptyBorder(2, 24, 0, 15));
this.add(panel, BorderLayout.NORTH); this.add(panel, BorderLayout.NORTH);
if (hasCustomFieldPane()) { customFieldComboBoxPane = createExtendedCustomFieldComboBoxPane();
customFieldComboBoxPane = new ExtendedCustomFieldComboBoxPane(); if (customFieldComboBoxPane != null) {
this.add(customFieldComboBoxPane, BorderLayout.CENTER); this.add(customFieldComboBoxPane, BorderLayout.CENTER);
} }
@ -65,8 +65,8 @@ public abstract class AbstractExtendedChartTableDataPane<T extends AbstractDataC
return new JPanel(); return new JPanel();
} }
protected boolean hasCustomFieldPane() { protected ExtendedCustomFieldComboBoxPane createExtendedCustomFieldComboBoxPane() {
return false; return null;
} }
protected Component[] fieldComponents() { protected Component[] fieldComponents() {
@ -96,7 +96,7 @@ public abstract class AbstractExtendedChartTableDataPane<T extends AbstractDataC
if (dataConfig != null) { if (dataConfig != null) {
populate((T) dataConfig); populate((T) dataConfig);
if (hasCustomFieldPane()) { if (customFieldComboBoxPane != null) {
customFieldComboBoxPane.populateBean(dataConfig); customFieldComboBoxPane.populateBean(dataConfig);
} }
} }
@ -115,7 +115,7 @@ public abstract class AbstractExtendedChartTableDataPane<T extends AbstractDataC
ExtendedTableDataSet dataSet = new ExtendedTableDataSet(); ExtendedTableDataSet dataSet = new ExtendedTableDataSet();
dataSet.setDataConfig(update()); dataSet.setDataConfig(update());
if (hasCustomFieldPane()) { if (customFieldComboBoxPane != null) {
customFieldComboBoxPane.updateBean(dataSet.getDataConfig()); customFieldComboBoxPane.updateBean(dataSet.getDataConfig());
} }

8
designer-chart/src/main/java/com/fr/extended/chart/ExtendedCustomFieldComboBoxPane.java

@ -38,6 +38,7 @@ public class ExtendedCustomFieldComboBoxPane extends UIComboBoxPane<AbstractData
private static final String[] HEADS = {com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Field_Name"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Series_Name"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Summary_Method")}; private static final String[] HEADS = {com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Field_Name"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Series_Name"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Summary_Method")};
private UseFieldValuePane useFieldValuePane; private UseFieldValuePane useFieldValuePane;
private CustomFieldNamePane customFieldNamePane; private CustomFieldNamePane customFieldNamePane;
private List<String> fieldList = new ArrayList<String>(); private List<String> fieldList = new ArrayList<String>();
@ -69,6 +70,10 @@ public class ExtendedCustomFieldComboBoxPane extends UIComboBoxPane<AbstractData
return StringUtils.EMPTY; return StringUtils.EMPTY;
} }
protected boolean valueComboBoxHasNone() {
return false;
}
public void checkBoxUse(boolean hasUse) { public void checkBoxUse(boolean hasUse) {
jcb.setEnabled(hasUse); jcb.setEnabled(hasUse);
useFieldValuePane.checkBoxUse(hasUse); useFieldValuePane.checkBoxUse(hasUse);
@ -118,7 +123,8 @@ public class ExtendedCustomFieldComboBoxPane extends UIComboBoxPane<AbstractData
private void initComponents() { private void initComponents() {
series = new UIComboBox(); series = new UIComboBox();
value = new UIComboBox(); value = valueComboBoxHasNone() ? new UIComboBoxWithNone() : new UIComboBox();
function = new CalculateComboBox(); function = new CalculateComboBox();
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{

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

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

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

@ -0,0 +1,44 @@
package com.fr.extended.chart;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.i18n.Toolkit;
import java.util.List;
/**
* Created by shine on 2018/9/27.
*/
public class UIComboBoxWithNone extends UIComboBox {
private static String getNoneLocaleString() {
return Toolkit.i18nText("Fine-Design_Chart_Use_None");
}
@Override
public void refreshBoxItems(List list) {
super.refreshBoxItems(list);
addNoneItem();
}
@Override
public void clearBoxItems() {
super.clearBoxItems();
addNoneItem();
}
private void addNoneItem() {
addItem(getNoneLocaleString());
}
@Override
public void setSelectedItem(Object anObject) {
super.setSelectedItem(anObject);
if (getSelectedIndex() == -1) {//找不到的都选中无。中文的无 英文下是none。
super.setSelectedItem(getNoneLocaleString());
}
}
}

22
designer-chart/src/main/java/com/fr/van/chart/custom/component/VanChartShortCutFactory.java

@ -1,10 +1,7 @@
package com.fr.van.chart.custom.component; package com.fr.van.chart.custom.component;
import com.fr.design.gui.HyperlinkFilterHelper;
import com.fr.design.gui.controlpane.NameableCreator;
import com.fr.design.gui.controlpane.shortcutfactory.ShortCutFactory;
import com.fr.design.gui.controlpane.ShortCutListenerProvider; import com.fr.design.gui.controlpane.ShortCutListenerProvider;
import com.fr.design.menu.ShortCut; import com.fr.design.gui.controlpane.shortcutfactory.ShortCutFactory;
/** /**
* Created by plough on 2018/8/13. * Created by plough on 2018/8/13.
@ -17,21 +14,4 @@ class VanChartShortCutFactory extends ShortCutFactory {
public static VanChartShortCutFactory newInstance(ShortCutListenerProvider listenerProvider) { public static VanChartShortCutFactory newInstance(ShortCutListenerProvider listenerProvider) {
return new VanChartShortCutFactory(listenerProvider); return new VanChartShortCutFactory(listenerProvider);
} }
@Override
public ShortCut createAddItemMenuDef(NameableCreator[] creators) {
return new AddVanChartItemMenuDef(creators);
}
private class AddVanChartItemMenuDef extends AddItemMenuDef {
AddVanChartItemMenuDef(NameableCreator[] creators) {
super(creators);
}
@Override
protected boolean whetherAdd(String itemName) {
return HyperlinkFilterHelper.whetherAddHyperlink4Chart(itemName);
}
}
} }

2
designer-chart/src/main/java/com/fr/van/chart/designer/component/background/VanChartBackgroundPane.java

@ -114,7 +114,7 @@ public class VanChartBackgroundPane extends BasicPane {
} }
private void fireStateChanged() { protected void fireStateChanged() {
Object[] listeners = listenerList.getListenerList(); Object[] listeners = listenerList.getListenerList();
ChangeEvent e = null; ChangeEvent e = null;

16
designer-chart/src/main/java/com/fr/van/chart/map/designer/other/VanChartMapHyperLinkPane.java

@ -1,7 +1,11 @@
package com.fr.van.chart.map.designer.other; package com.fr.van.chart.map.designer.other;
import com.fr.base.BaseFormula;
import com.fr.base.FormulaBuilder;
import com.fr.chart.chartattr.Plot; import com.fr.chart.chartattr.Plot;
import com.fr.design.dialog.BasicScrollPane; import com.fr.design.dialog.BasicScrollPane;
import com.fr.extended.chart.HyperLinkPara;
import com.fr.extended.chart.HyperLinkParaHelper;
import com.fr.js.NameJavaScriptGroup; import com.fr.js.NameJavaScriptGroup;
import com.fr.plugin.chart.map.VanChartMapPlot; import com.fr.plugin.chart.map.VanChartMapPlot;
import com.fr.plugin.chart.type.MapType; import com.fr.plugin.chart.type.MapType;
@ -11,6 +15,8 @@ import com.fr.van.chart.map.designer.VanMapAreaPointAndLineGroupPane;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.JPanel; import javax.swing.JPanel;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.util.LinkedHashMap;
import java.util.Map;
/** /**
* Created by hufan on 2016/12/20. * Created by hufan on 2016/12/20.
@ -193,6 +199,16 @@ public class VanChartMapHyperLinkPane extends BasicScrollPane<Plot> {
protected NameJavaScriptGroup populateHotHyperLink(Plot plot) { protected NameJavaScriptGroup populateHotHyperLink(Plot plot) {
return ((VanChartMapPlot)plot).getLineHotHyperLink(); return ((VanChartMapPlot)plot).getLineHotHyperLink();
} }
@Override
protected Map<String, BaseFormula> getHyperLinkEditorMap() {
FormulaBuilder builder = BaseFormula.createFormulaBuilder();
Map<String, BaseFormula> map = new LinkedHashMap<>();
for (HyperLinkPara para : HyperLinkParaHelper.LINE_MAP) {
map.put(para.getName(), builder.build(para.getFormulaContent()));
}
return map;
}
}; };
} }

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

@ -1,9 +1,10 @@
package com.fr.van.chart.range.component; package com.fr.van.chart.range.component;
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;
import javax.swing.JPanel; import javax.swing.JPanel;
@ -16,15 +17,19 @@ import java.awt.Dimension;
* Created by Mitisky on 16/10/20. * Created by Mitisky on 16/10/20.
* 没有主题颜色,自动的时候没有划分阶段 * 没有主题颜色,自动的时候没有划分阶段
*/ */
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() {
@Override @Override
public void stateChanged(ChangeEvent e) { public void stateChanged(ChangeEvent e) {
if(getDesignTypeButtonGroup().getSelectedIndex() == 0){ if (getDesignTypeButtonGroup().getSelectedIndex() == 0) {
setRegionVisible(false); setRegionVisible(false);
} else { } else {
setRegionVisible(true); setRegionVisible(true);
@ -33,33 +38,41 @@ public class SectionIntervalConfigPaneWithOutNum extends MapColorPickerPaneWithF
}); });
} }
protected JPanel getUpControlPane (Component[][] components) { @Override
protected JPanel getUpControlPane(Component[][] components) {
double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH;
double d = TableLayout4VanChartHelper.DESCRIPTION_AREA_WIDTH; double d = TableLayout4VanChartHelper.DESCRIPTION_AREA_WIDTH;
double[] columnSize = {d, e}; double[] columnSize = {d, e};
JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(components, getRowSIze (), columnSize); JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(components, getRowSIze(), columnSize);
return panel; return panel;
} }
private void setRegionVisible(boolean visible){ private void setRegionVisible(boolean visible) {
getRegionNumPane().setVisible(visible); getRegionNumPane().setVisible(visible);
numLabel.setVisible(visible); numLabel.setVisible(visible);
} }
@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()},
}; };
} }
public Dimension getPreferredSize(){ @Override
public Dimension getPreferredSize() {
Dimension dim = super.getPreferredSize(); Dimension dim = super.getPreferredSize();
return new Dimension((int)dim.getWidth(), (int) dim.getHeight() - (numLabel.isVisible() ? 0 : 30)); return new Dimension((int) dim.getWidth(), (int) dim.getHeight() - (numLabel.isVisible() ? 0 : 30));
}
@Override
public void populateBean(MapHotAreaColor hotAreaColor) {
super.populateBean(hotAreaColor);
setRegionVisible(hotAreaColor.getUseType() == 1);
} }
} }

123
designer-form/src/main/java/com/fr/design/designer/creator/XWFitLayout.java

@ -7,26 +7,32 @@ import java.awt.Toolkit;
import java.awt.event.ContainerEvent; import java.awt.event.ContainerEvent;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.Comparator;
import java.util.List; import java.util.List;
import com.fr.design.designer.beans.LayoutAdapter; import com.fr.design.designer.beans.LayoutAdapter;
import com.fr.design.designer.beans.adapters.layout.FRFitLayoutAdapter; import com.fr.design.designer.beans.adapters.layout.FRFitLayoutAdapter;
import com.fr.design.designer.beans.location.Direction; import com.fr.design.designer.beans.location.Direction;
import com.fr.design.designer.creator.cardlayout.XWCardMainBorderLayout;
import com.fr.design.designer.creator.cardlayout.XWTabFitLayout; import com.fr.design.designer.creator.cardlayout.XWTabFitLayout;
import com.fr.design.designer.properties.mobile.BodyMobilePropertyUI; import com.fr.design.designer.properties.mobile.BodyMobilePropertyUI;
import com.fr.design.form.layout.FRFitLayout; import com.fr.design.form.layout.FRFitLayout;
import com.fr.design.fun.WidgetPropertyUIProvider; import com.fr.design.fun.WidgetPropertyUIProvider;
import com.fr.design.mainframe.FormArea; import com.fr.design.mainframe.FormArea;
import com.fr.design.mainframe.FormDesigner;
import com.fr.design.mainframe.WidgetPropertyPane;
import com.fr.design.utils.gui.LayoutUtils; import com.fr.design.utils.gui.LayoutUtils;
import com.fr.form.ui.PaddingMargin; import com.fr.form.ui.PaddingMargin;
import com.fr.form.ui.Widget; import com.fr.form.ui.Widget;
import com.fr.form.ui.container.WBodyLayoutType; import com.fr.form.ui.container.WBodyLayoutType;
import com.fr.form.ui.container.WFitLayout; import com.fr.form.ui.container.WFitLayout;
import com.fr.form.ui.container.WLayout; import com.fr.form.ui.container.WLayout;
import com.fr.general.FRLogger;
import com.fr.general.FRScreen; import com.fr.general.FRScreen;
import com.fr.form.ui.container.WAbsoluteLayout.BoundsWidget; import com.fr.form.ui.container.WAbsoluteLayout.BoundsWidget;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import edu.emory.mathcs.backport.java.util.Arrays;
import javax.swing.JOptionPane; import javax.swing.JOptionPane;
@ -38,6 +44,7 @@ import javax.swing.JOptionPane;
public class XWFitLayout extends XLayoutContainer { public class XWFitLayout extends XLayoutContainer {
private static final long serialVersionUID = 8112908607102660176L; private static final long serialVersionUID = 8112908607102660176L;
private static final int EACH_ROW_COUNT = 4;
//由于屏幕分辨率不同,界面上的容器大小可能不是默认的100%,此时拖入组件时,保存的大小按照100%时的计算 //由于屏幕分辨率不同,界面上的容器大小可能不是默认的100%,此时拖入组件时,保存的大小按照100%时的计算
protected double containerPercent = 1.0; protected double containerPercent = 1.0;
@ -1209,4 +1216,120 @@ public class XWFitLayout extends XLayoutContainer {
public boolean isMovable() { public boolean isMovable() {
return false; return false;
} }
public boolean switch2FitBodyLayout(XCreator creator) {
try {
XWFitLayout xfl = (XWFitLayout) creator.getBackupParent();
//备份一下组件间隔
int compInterval = xfl.toData().getCompInterval();
Component[] components = creator.getComponents();
Arrays.sort(components, new ComparatorComponentLocation());
xfl.getLayoutAdapter().removeBean(creator, creator.getWidth(), creator.getHeight());
xfl.remove(creator);
for (Component comp : components) {
XCreator xCreator = (XCreator) comp;
if (xCreator.shouldScaleCreator()) {
XLayoutContainer parentPanel = xCreator.initCreatorWrapper(xCreator.getHeight());
xfl.add(parentPanel, xCreator.toData().getWidgetName());
parentPanel.updateChildBound(xfl.getActualMinHeight());
continue;
}
xfl.add(xCreator);
}
//这边计算的时候会先把组件间隔去掉
moveComponents2FitLayout(xfl);
for (int i = 0; i < components.length; i++) {
Component comp = xfl.getComponent(i);
creator = (XCreator) comp;
creator.setBackupBound(components[i].getBounds());
}
//把组件间隔加上
if (xfl.toData().getCompInterval() != compInterval) {
xfl.moveContainerMargin();
xfl.moveCompInterval(xfl.getAcualInterval());
xfl.toData().setCompInterval(compInterval);
xfl.addCompInterval(xfl.getAcualInterval());
}
xfl.toData().setLayoutType(WBodyLayoutType.FIT);
FormDesigner formDesigner = WidgetPropertyPane.getInstance().getEditingFormDesigner();
formDesigner.getSelectionModel().setSelectedCreator(xfl);
return true;
} catch (Exception e) {
FRLogger.getLogger().error(e.getMessage());
return false;
}
}
private void moveComponents2FitLayout(XWFitLayout xwFitLayout) {
Component[] components = xwFitLayout.getComponents();
if (components.length == 0) {
xwFitLayout.updateBoundsWidget();
return;
}
int layoutWidth = xwFitLayout.getWidth() - xwFitLayout.toData().getMargin().getLeft() - xwFitLayout.toData().getMargin().getRight();
int layoutHeight = xwFitLayout.getHeight() - xwFitLayout.toData().getMargin().getTop() - xwFitLayout.toData().getMargin().getBottom();
int leftMargin = xwFitLayout.toData().getMargin().getLeft();
int topMargin = xwFitLayout.toData().getMargin().getTop();
xwFitLayout.toData().setCompInterval(0);
int row = (components.length / EACH_ROW_COUNT) + (components.length % EACH_ROW_COUNT == 0 ? 0 : 1);
//最后一行的列数不定
int column = components.length % EACH_ROW_COUNT == 0 ? EACH_ROW_COUNT : components.length % EACH_ROW_COUNT;
int componentWidth = layoutWidth / EACH_ROW_COUNT;
int componentHeight = layoutHeight / row;
for (int i = 0; i < row - 1; i++) {
for (int j = 0; j < EACH_ROW_COUNT; j++) {
components[EACH_ROW_COUNT * i + j].setBounds(
leftMargin + componentWidth * j,
topMargin + componentHeight * i,
j == EACH_ROW_COUNT - 1 ? layoutWidth - componentWidth * (EACH_ROW_COUNT - 1) : componentWidth,
componentHeight
);
}
}
//最后一行列数是特殊的,要单独处理
int lastRowWidth = layoutWidth / column;
int lastRowHeight = layoutHeight - componentHeight * (row - 1);
for (int i = 0; i < column; i++) {
components[EACH_ROW_COUNT * (row - 1) + i].setBounds(
leftMargin + lastRowWidth * i,
topMargin + componentHeight * (row - 1),
i == column - 1 ? layoutWidth - lastRowWidth * (column - 1) : lastRowWidth,
lastRowHeight
);
}
for (int i = 0; i < components.length; i++) {
if (components[i] instanceof XWCardMainBorderLayout) {
((XWCardMainBorderLayout) components[i]).recalculateChildWidth(components[i].getWidth(), false);
((XWCardMainBorderLayout) components[i]).recalculateChildHeight(components[i].getHeight(), false);
}
xwFitLayout.dealDirections((XCreator) components[i], false);
}
xwFitLayout.updateBoundsWidget();
}
//以组件的位置来确定先后顺序,y小的在前,x小的在前
private class ComparatorComponentLocation implements Comparator {
@Override
public int compare(Object o1, Object o2) {
if (((Component) o1).getY() < ((Component) o2).getY()) {
return -1;
} else if (((Component) o1).getY() > ((Component) o2).getY()) {
return 1;
} else {
if (((Component) o1).getX() < ((Component) o2).getX()) {
return -1;
} else if (((Component) o1).getX() > ((Component) o2).getX()) {
return 1;
} else {
return 0;
}
}
}
}
} }

5
designer-form/src/main/java/com/fr/design/form/mobile/FormMobileAttrPane.java

@ -13,8 +13,6 @@ import java.awt.*;
* Created by fanglei on 2016/11/17. * Created by fanglei on 2016/11/17.
*/ */
public class FormMobileAttrPane extends BasicBeanPane<FormMobileAttr>{ public class FormMobileAttrPane extends BasicBeanPane<FormMobileAttr>{
//工具栏容器
private MobileToolBarPane mobileToolBarPane;
// 模版设置面板 // 模版设置面板
private FormMobileTemplateSettingsPane formMobileTemplateSettingsPane; private FormMobileTemplateSettingsPane formMobileTemplateSettingsPane;
// 其他 // 其他
@ -33,7 +31,6 @@ public class FormMobileAttrPane extends BasicBeanPane<FormMobileAttr>{
panel.setBorder(BorderFactory.createEmptyBorder(PADDING, PADDING, PADDING, PADDING)); panel.setBorder(BorderFactory.createEmptyBorder(PADDING, PADDING, PADDING, PADDING));
panel.add(formMobileTemplateSettingsPane = new FormMobileTemplateSettingsPane()); panel.add(formMobileTemplateSettingsPane = new FormMobileTemplateSettingsPane());
panel.add(mobileToolBarPane = new MobileToolBarPane());
panel.add(formMobileOthersPane = new FormMobileOthersPane()); panel.add(formMobileOthersPane = new FormMobileOthersPane());
JPanel panelWrapper = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel panelWrapper = FRGUIPaneFactory.createBorderLayout_S_Pane();
@ -47,7 +44,6 @@ public class FormMobileAttrPane extends BasicBeanPane<FormMobileAttr>{
if (ob == null) { if (ob == null) {
ob = new FormMobileAttr(); ob = new FormMobileAttr();
} }
this.mobileToolBarPane.populateBean(ob);
this.formMobileTemplateSettingsPane.populateBean(ob); this.formMobileTemplateSettingsPane.populateBean(ob);
this.formMobileOthersPane.populateBean(ob); this.formMobileOthersPane.populateBean(ob);
} }
@ -55,7 +51,6 @@ public class FormMobileAttrPane extends BasicBeanPane<FormMobileAttr>{
@Override @Override
public FormMobileAttr updateBean() { public FormMobileAttr updateBean() {
FormMobileAttr formMobileAttr = new FormMobileAttr(); FormMobileAttr formMobileAttr = new FormMobileAttr();
this.mobileToolBarPane.updateBean(formMobileAttr);
this.formMobileTemplateSettingsPane.updateBean(formMobileAttr); this.formMobileTemplateSettingsPane.updateBean(formMobileAttr);
this.formMobileOthersPane.updateBean(formMobileAttr); this.formMobileOthersPane.updateBean(formMobileAttr);
return formMobileAttr; return formMobileAttr;

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

@ -6,9 +6,7 @@ import com.fr.base.Parameter;
import com.fr.base.vcs.DesignerMode; import com.fr.base.vcs.DesignerMode;
import com.fr.design.DesignState; import com.fr.design.DesignState;
import com.fr.design.actions.core.WorkBookSupportable; import com.fr.design.actions.core.WorkBookSupportable;
import com.fr.design.actions.file.WebPreviewUtils;
import com.fr.design.cell.FloatElementsProvider; import com.fr.design.cell.FloatElementsProvider;
import com.fr.design.constants.UIConstants;
import com.fr.design.designer.TargetComponent; import com.fr.design.designer.TargetComponent;
import com.fr.design.designer.beans.actions.CopyAction; import com.fr.design.designer.beans.actions.CopyAction;
import com.fr.design.designer.beans.actions.CutAction; import com.fr.design.designer.beans.actions.CutAction;

1
designer-form/src/main/java/com/fr/design/mainframe/actions/FormMobileAttrAction.java

@ -72,6 +72,7 @@ public class FormMobileAttrAction extends JTemplateAction<JForm> {
// 设置移动端属性并刷新界面 // 设置移动端属性并刷新界面
formTpl.setFormMobileAttr(formMobileAttr); // 会调整 body 的自适应布局,放到最后 formTpl.setFormMobileAttr(formMobileAttr); // 会调整 body 的自适应布局,放到最后
((FormArea)jf.getFormDesign().getParent()).onMobileAttrModified(); ((FormArea)jf.getFormDesign().getParent()).onMobileAttrModified();
jf.getFormDesign().getSelectionModel().setSelectedCreator(jf.getFormDesign().getRootComponent());
WidgetPropertyPane.getInstance().refreshDockingView(); WidgetPropertyPane.getInstance().refreshDockingView();
jf.fireTargetModified(); jf.fireTargetModified();
} }

128
designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/FRAbsoluteBodyLayoutDefinePane.java

@ -63,13 +63,13 @@ public class FRAbsoluteBodyLayoutDefinePane extends FRAbsoluteLayoutDefinePane {
watermarkEditor = new AccessibleBodyWatermarkEditor(); watermarkEditor = new AccessibleBodyWatermarkEditor();
JPanel jPanel = TableLayoutHelper.createGapTableLayoutPane( JPanel jPanel = TableLayoutHelper.createGapTableLayoutPane(
new Component[][]{ new Component[][]{
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Style")), borderStyleEditor}, new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Style")), borderStyleEditor},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_WaterMark")), watermarkEditor} new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_WaterMark")), watermarkEditor}
}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_W3, IntervalConstants.INTERVAL_L1); }, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_W3, IntervalConstants.INTERVAL_L1);
JPanel borderPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel borderPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
jPanel.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0)); jPanel.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0));
borderPane.add(jPanel, BorderLayout.CENTER); borderPane.add(jPanel, BorderLayout.CENTER);
UIExpandablePane advancedPane = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Advanced"), 280, 20, borderPane ); UIExpandablePane advancedPane = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Advanced"), 280, 20, borderPane);
centerPane.add(advancedPane, BorderLayout.NORTH); centerPane.add(advancedPane, BorderLayout.NORTH);
this.add(centerPane, BorderLayout.NORTH); this.add(centerPane, BorderLayout.NORTH);
} }
@ -122,9 +122,9 @@ public class FRAbsoluteBodyLayoutDefinePane extends FRAbsoluteLayoutDefinePane {
} }
if (layoutType == WBodyLayoutType.ABSOLUTE) { if (layoutType == WBodyLayoutType.ABSOLUTE) {
((XWFitLayout)creator.getBackupParent()).toData().resetStyle(); ((XWFitLayout) creator.getBackupParent()).toData().resetStyle();
if (state == WBodyLayoutType.FIT.getTypeValue()) { if (state == WBodyLayoutType.FIT.getTypeValue()) {
switch2FitBodyLayout(); ((XWFitLayout)creator.getBackupParent()).switch2FitBodyLayout(creator);
} }
} }
layout.setBorderStyle((LayoutBorderStyle) borderStyleEditor.getValue()); layout.setBorderStyle((LayoutBorderStyle) borderStyleEditor.getValue());
@ -149,123 +149,5 @@ public class FRAbsoluteBodyLayoutDefinePane extends FRAbsoluteLayoutDefinePane {
return null; return null;
} }
private boolean switch2FitBodyLayout() {
try {
XWFitLayout xfl = (XWFitLayout) creator.getBackupParent();
//备份一下组件间隔
int compInterval = xfl.toData().getCompInterval();
Component[] components = creator.getComponents();
Arrays.sort(components, new ComparatorComponentLocation());
xfl.getLayoutAdapter().removeBean(creator, creator.getWidth(), creator.getHeight());
xfl.remove(creator);
for (Component comp : components) {
XCreator xCreator = (XCreator) comp;
if (xCreator.shouldScaleCreator()) {
XLayoutContainer parentPanel = xCreator.initCreatorWrapper(xCreator.getHeight());
xfl.add(parentPanel, xCreator.toData().getWidgetName());
parentPanel.updateChildBound(xfl.getActualMinHeight());
continue;
}
xfl.add(xCreator);
}
//这边计算的时候会先把组件间隔去掉
moveComponents2FitLayout(xfl);
for (int i = 0; i < components.length; i++) {
Component comp = xfl.getComponent(i);
XCreator creator = (XCreator) comp;
creator.setBackupBound(components[i].getBounds());
}
//把组件间隔加上
if (xfl.toData().getCompInterval() != compInterval) {
xfl.moveContainerMargin();
xfl.moveCompInterval(xfl.getAcualInterval());
xfl.toData().setCompInterval(compInterval);
xfl.addCompInterval(xfl.getAcualInterval());
}
xfl.toData().setLayoutType(WBodyLayoutType.FIT);
FormDesigner formDesigner = WidgetPropertyPane.getInstance().getEditingFormDesigner();
formDesigner.getSelectionModel().setSelectedCreator(xfl);
return true;
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
return false;
}
}
// 把绝对布局中的元素按规则移动到自适应布局中
// 规则:各元素按顺序放置,其中每行最多4个元素,超出则换行,各元素均分body的高度和宽度
private void moveComponents2FitLayout(XWFitLayout xwFitLayout) {
Component[] components = xwFitLayout.getComponents();
if (components.length == 0) {
xwFitLayout.updateBoundsWidget();
return;
}
int layoutWidth = xwFitLayout.getWidth() - xwFitLayout.toData().getMargin().getLeft() - xwFitLayout.toData().getMargin().getRight();
int layoutHeight = xwFitLayout.getHeight() - xwFitLayout.toData().getMargin().getTop() - xwFitLayout.toData().getMargin().getBottom();
int leftMargin = xwFitLayout.toData().getMargin().getLeft();
int topMargin = xwFitLayout.toData().getMargin().getTop();
xwFitLayout.toData().setCompInterval(0);
int row = (components.length / EACH_ROW_COUNT) + (components.length % EACH_ROW_COUNT == 0 ? 0 : 1);
//最后一行的列数不定
int column = components.length % EACH_ROW_COUNT == 0 ? EACH_ROW_COUNT : components.length % EACH_ROW_COUNT;
int componentWidth = layoutWidth / EACH_ROW_COUNT;
int componentHeight = layoutHeight / row;
for (int i = 0; i < row - 1; i++) {
for (int j = 0; j < EACH_ROW_COUNT; j++) {
components[EACH_ROW_COUNT * i + j].setBounds(
leftMargin + componentWidth * j,
topMargin + componentHeight * i,
j == EACH_ROW_COUNT - 1 ? layoutWidth - componentWidth * (EACH_ROW_COUNT - 1) : componentWidth,
componentHeight
);
}
}
//最后一行列数是特殊的,要单独处理
int lastRowWidth = layoutWidth / column;
int lastRowHeight = layoutHeight - componentHeight * (row - 1);
for (int i = 0; i < column; i++) {
components[EACH_ROW_COUNT * (row - 1) + i].setBounds(
leftMargin + lastRowWidth * i,
topMargin + componentHeight * (row - 1),
i == column - 1 ? layoutWidth - lastRowWidth * (column - 1) : lastRowWidth,
lastRowHeight
);
}
for (int i = 0; i < components.length; i++) {
if (components[i] instanceof XWCardMainBorderLayout) {
((XWCardMainBorderLayout) components[i]).recalculateChildWidth(components[i].getWidth(), false);
((XWCardMainBorderLayout) components[i]).recalculateChildHeight(components[i].getHeight(), false);
}
xwFitLayout.dealDirections((XCreator) components[i], false);
}
xwFitLayout.updateBoundsWidget();
}
//以组件的位置来确定先后顺序,y小的在前,x小的在前
private class ComparatorComponentLocation implements Comparator {
@Override
public int compare(Object o1, Object o2) {
if (((Component) o1).getY() < ((Component) o2).getY()) {
return -1;
} else if (((Component) o1).getY() > ((Component) o2).getY()) {
return 1;
} else {
if (((Component) o1).getX() < ((Component) o2).getX()) {
return -1;
} else if (((Component) o1).getX() > ((Component) o2).getX()) {
return 1;
} else {
return 0;
}
}
}
}
} }

27
designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/FRFitLayoutDefinePane.java

@ -26,6 +26,7 @@ import com.fr.design.mainframe.widget.accessibles.AccessibleBodyWatermarkEditor;
import com.fr.design.mainframe.widget.accessibles.AccessibleWLayoutBorderStyleEditor; import com.fr.design.mainframe.widget.accessibles.AccessibleWLayoutBorderStyleEditor;
import com.fr.design.widget.ui.designer.AbstractDataModify; import com.fr.design.widget.ui.designer.AbstractDataModify;
import com.fr.design.widget.ui.designer.component.PaddingBoundPane; import com.fr.design.widget.ui.designer.component.PaddingBoundPane;
import com.fr.form.main.Form;
import com.fr.form.ui.LayoutBorderStyle; import com.fr.form.ui.LayoutBorderStyle;
import com.fr.form.ui.Widget; import com.fr.form.ui.Widget;
import com.fr.form.ui.container.WAbsoluteBodyLayout; import com.fr.form.ui.container.WAbsoluteBodyLayout;
@ -81,8 +82,8 @@ public class FRFitLayoutDefinePane extends AbstractDataModify<WFitLayout> {
paddingBound = new PaddingBoundPane(); paddingBound = new PaddingBoundPane();
JPanel jp2 = TableLayoutHelper.createGapTableLayoutPane( JPanel jp2 = TableLayoutHelper.createGapTableLayoutPane(
new Component[][]{ new Component[][]{
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Style")), stylePane}, new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Style")), stylePane},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_WaterMark")), watermarkEditor} new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_WaterMark")), watermarkEditor}
}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_W3, IntervalConstants.INTERVAL_L1); }, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_W3, IntervalConstants.INTERVAL_L1);
jp2.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0)); jp2.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));
jPanel.add(paddingBound, BorderLayout.CENTER); jPanel.add(paddingBound, BorderLayout.CENTER);
@ -136,8 +137,14 @@ public class FRFitLayoutDefinePane extends AbstractDataModify<WFitLayout> {
XLayoutContainer rootLayout = selectedBodyLayout(formDesigner); XLayoutContainer rootLayout = selectedBodyLayout(formDesigner);
if (rootLayout != formDesigner.getRootComponent() if (rootLayout != formDesigner.getRootComponent()
&& formDesigner.getSelectionModel().getSelection().getSelectedCreator() == formDesigner.getRootComponent()) { && formDesigner.getSelectionModel().getSelection().getSelectedCreator() == formDesigner.getRootComponent()) {
formDesigner.getSelectionModel().setSelectedCreators( //原单例面板populate根据当前样式populate属性面板,现加入移动端逻辑:可能需要根据面板属性改变样式
FormSelectionUtils.rebuildSelection(xWFitLayout, new Widget[]{selectedBodyLayout(formDesigner).toData()})); Form form = formDesigner.getTarget();
if (form.getFormMobileAttr().isMobileOnly() && form.getFormMobileAttr().isAdaptivePropertyAutoMatch()) {
((XWFitLayout)formDesigner.getRootComponent()).switch2FitBodyLayout(rootLayout);
} else {
formDesigner.getSelectionModel().setSelectedCreators(
FormSelectionUtils.rebuildSelection(xWFitLayout, new Widget[]{selectedBodyLayout(formDesigner).toData()}));
}
} }
paddingBound.populate(ob); paddingBound.populate(ob);
layoutComboBox.setSelectedIndex(ob.getBodyLayoutType().getTypeValue()); layoutComboBox.setSelectedIndex(ob.getBodyLayoutType().getTypeValue());
@ -149,8 +156,8 @@ public class FRFitLayoutDefinePane extends AbstractDataModify<WFitLayout> {
private XLayoutContainer selectedBodyLayout(FormDesigner formDesigner) { private XLayoutContainer selectedBodyLayout(FormDesigner formDesigner) {
XLayoutContainer rootLayout = formDesigner.getRootComponent(); XLayoutContainer rootLayout = formDesigner.getRootComponent();
if (rootLayout.getComponentCount() == 1 && rootLayout.getXCreator(0).acceptType(XWAbsoluteBodyLayout.class)){ if (rootLayout.getComponentCount() == 1 && rootLayout.getXCreator(0).acceptType(XWAbsoluteBodyLayout.class)) {
rootLayout = (XWAbsoluteBodyLayout)rootLayout.getXCreator(0); rootLayout = (XWAbsoluteBodyLayout) rootLayout.getXCreator(0);
} }
return rootLayout; return rootLayout;
} }
@ -162,8 +169,8 @@ public class FRFitLayoutDefinePane extends AbstractDataModify<WFitLayout> {
if (ComparatorUtils.equals(getGlobalName(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Layout_Padding_Duplicate"))) { if (ComparatorUtils.equals(getGlobalName(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Layout_Padding_Duplicate"))) {
paddingBound.update(layout); paddingBound.update(layout);
} }
LayoutBorderStyle borderStyle = (LayoutBorderStyle) stylePane.getValue(); LayoutBorderStyle borderStyle = (LayoutBorderStyle) stylePane.getValue();
if(borderStyle != null){ if (borderStyle != null) {
layout.setBorderStyle(borderStyle); layout.setBorderStyle(borderStyle);
} }
updateWatermark(); updateWatermark();
@ -205,7 +212,7 @@ public class FRFitLayoutDefinePane extends AbstractDataModify<WFitLayout> {
} }
int intervelValue = (int)componentIntervel.getValue(); int intervelValue = (int) componentIntervel.getValue();
if (xWFitLayout.canAddInterval(intervelValue)) { if (xWFitLayout.canAddInterval(intervelValue)) {
// 设置完间隔后,要同步处理界面组件,容器刷新后显示出对应效果 // 设置完间隔后,要同步处理界面组件,容器刷新后显示出对应效果
setLayoutGap(intervelValue); setLayoutGap(intervelValue);
@ -227,7 +234,7 @@ public class FRFitLayoutDefinePane extends AbstractDataModify<WFitLayout> {
} }
private void setLayoutGap(int value) { private void setLayoutGap(int value) {
int interval = wFitLayout.getCompInterval(); int interval = wFitLayout.getCompInterval();
if (value != interval) { if (value != interval) {
xWFitLayout.moveContainerMargin(); xWFitLayout.moveContainerMargin();
xWFitLayout.moveCompInterval(xWFitLayout.getAcualInterval()); xWFitLayout.moveCompInterval(xWFitLayout.getAcualInterval());

260
designer-realize/src/main/java/com/fr/design/javascript/ListenerEditPane.java

@ -7,6 +7,7 @@ import com.fr.design.fun.JavaScriptActionProvider;
import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.JTemplate;
@ -28,140 +29,143 @@ import java.util.List;
import java.util.Set; import java.util.Set;
public class ListenerEditPane extends BasicBeanPane<Listener> { public class ListenerEditPane extends BasicBeanPane<Listener> {
private UITextField nameText; private UITextField nameText;
private UIComboBox styleBox; private UIComboBox styleBox;
private CardLayout card; private CardLayout card;
private List<FurtherBasicBeanPane<? extends JavaScript>> cards; private List<FurtherBasicBeanPane<? extends JavaScript>> cards;
private JPanel hyperlinkPane; private JPanel hyperlinkPane;
private JavaScriptImplPane javaScriptPane;
private FormSubmitJavaScriptPane formSubmitScriptPane;
private Commit2DBJavaScriptPane commit2DBJavaScriptPane;
// 自定义事件
private CustomActionPane customActionPane;
// 发送邮件
private EmailPane emailPane;
private static final String JS = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_JavaScript");
private static final String FORMSUBMIT = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_JavaScript_Form_Submit");
private static final String DBCOMMIT = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_JavaScript_Commit_To_Database");
private static final String CUSTOMACTION= com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_JavaScript_Custom_Submit");
private static final String EMAIL = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Email_Sent_Email");
private Listener listener;
public ListenerEditPane() {
this.initComponents(new String[0]);
}
public ListenerEditPane(String[] defaultArgs) { private static final String JS = Toolkit.i18nText("Fine-Design_Report_JavaScript");
this.initComponents(defaultArgs); private static final String DBCOMMIT = Toolkit.i18nText("Fine-Design_Basic_JavaScript_Commit_To_Database");
} private static final String CUSTOMACTION = Toolkit.i18nText("Fine-Design_Report_Submit_Type_Custom");
private static final String EMAIL = Toolkit.i18nText("Fine-Design_Report_Email_Sent_Email");
/** private Listener listener;
* 初始化各个组件
* @param defaultArgs 初始化参数
*/
public void initComponents(String[] defaultArgs) {
cards = new ArrayList<FurtherBasicBeanPane<? extends JavaScript>>();
this.setLayout(FRGUIPaneFactory.createBorderLayout());
JPanel namePane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
nameText = new UITextField(8);
nameText.setEditable(false);
namePane.add(nameText, BorderLayout.WEST);
String[] style = {JS, DBCOMMIT, CUSTOMACTION,EMAIL};
styleBox = new UIComboBox(style);
namePane.add(styleBox);
namePane = GUICoreUtils.createFlowPane(new Component[]{new UILabel(" " + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Event_Name") + ":"), nameText, new UILabel(" " + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Event_Type") + ":"), styleBox}, FlowLayout.LEFT);
namePane.setBorder(BorderFactory.createTitledBorder(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Event_Name_Type")));
this.add(namePane, BorderLayout.NORTH);
card = new CardLayout();
hyperlinkPane = FRGUIPaneFactory.createCardLayout_S_Pane();
hyperlinkPane.setLayout(card);
javaScriptPane = new JavaScriptImplPane(defaultArgs);
hyperlinkPane.add(JS, javaScriptPane);
// 提交入库
List dbmaniList = new ArrayList();
dbmaniList.add(autoCreateDBManipulationPane());
commit2DBJavaScriptPane = new Commit2DBJavaScriptPane(JavaScriptActionPane.defaultJavaScriptActionPane,
dbmaniList);
hyperlinkPane.add(DBCOMMIT, commit2DBJavaScriptPane);
// 自定义事件
customActionPane = new CustomActionPane();
hyperlinkPane.add(CUSTOMACTION, customActionPane);
// 发送邮件
emailPane = new EmailPane();
hyperlinkPane.add(EMAIL,emailPane);
cards.add(javaScriptPane);
cards.add(commit2DBJavaScriptPane);
cards.add(customActionPane);
cards.add(emailPane);
//其他事件
addOtherEvent();
hyperlinkPane.setBorder(BorderFactory.createTitledBorder(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_JavaScript_Set")));
this.add(hyperlinkPane);
styleBox.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent e) {
card.show(hyperlinkPane, styleBox.getSelectedItem().toString());
}
});
}
private void addOtherEvent(){ public ListenerEditPane() {
Set<JavaScriptActionProvider> javaScriptActionProviders = ExtraDesignClassManager.getInstance().getArray(JavaScriptActionProvider.XML_TAG); this.initComponents(new String[0]);
if (javaScriptActionProviders != null) { }
for (JavaScriptActionProvider jsp : javaScriptActionProviders) {
FurtherBasicBeanPane pane = jsp.getJavaScriptActionPane(); public ListenerEditPane(String[] defaultArgs) {
String title = pane.title4PopupWindow(); this.initComponents(defaultArgs);
styleBox.addItem(title); }
hyperlinkPane.add(title, pane);
cards.add(pane);
}
}
}
/** /**
* 根据有无单元格创建 DBManipulationPane * 初始化各个组件
* @return 有单元格有智能添加单元格等按钮返回 SmartInsertDBManipulationPane *
* @param defaultArgs 初始化参数
*/ */
private DBManipulationPane autoCreateDBManipulationPane() { public void initComponents(String[] defaultArgs) {
JTemplate jTemplate = DesignerContext.getDesignerFrame().getSelectedJTemplate(); cards = new ArrayList<>();
return jTemplate.createDBManipulationPane(); this.setLayout(FRGUIPaneFactory.createBorderLayout());
} JPanel namePane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
nameText = new UITextField(8);
@Override nameText.setEditable(false);
protected String title4PopupWindow() { namePane.add(nameText, BorderLayout.WEST);
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Event_Set"); final String[] style = {JS, DBCOMMIT, CUSTOMACTION, EMAIL};
} styleBox = new UIComboBox(style);
namePane.add(styleBox);
@Override namePane = GUICoreUtils.createFlowPane(new Component[]{
public void populateBean(Listener listener) { new UILabel(" " + Toolkit.i18nText("Fine-Design_Report_Event_Name") + ":"),
this.listener = listener; nameText,
if (this.listener == null) { new UILabel(" " + Toolkit.i18nText("Fine-Design_Report_Event_Type") + ":"),
this.listener = new Listener(); styleBox},
} FlowLayout.LEFT);
this.nameText.setText(listener.getEventName()); namePane.setBorder(BorderFactory.createTitledBorder(Toolkit.i18nText("Fine-Design_Report_Event_Name_Type")));
JavaScript js = listener.getAction(); this.add(namePane, BorderLayout.NORTH);
for (int i = 0; i < this.cards.size(); i++) { card = new CardLayout();
FurtherBasicBeanPane pane = cards.get(i); hyperlinkPane = FRGUIPaneFactory.createCardLayout_S_Pane();
if (pane.accept(js)) { hyperlinkPane.setLayout(card);
styleBox.setSelectedItem(pane.title4PopupWindow()); JavaScriptImplPane javaScriptPane = new JavaScriptImplPane(defaultArgs);
card.show(hyperlinkPane, pane.title4PopupWindow()); hyperlinkPane.add(JS, javaScriptPane);
pane.populateBean(js); // 提交入库
return; List dbManiList = new ArrayList();
} dbManiList.add(autoCreateDBManipulationPane());
} Commit2DBJavaScriptPane commit2DBJavaScriptPane = new Commit2DBJavaScriptPane(JavaScriptActionPane.defaultJavaScriptActionPane,
} dbManiList);
hyperlinkPane.add(DBCOMMIT, commit2DBJavaScriptPane);
// 自定义事件
CustomActionPane customActionPane = new CustomActionPane();
hyperlinkPane.add(CUSTOMACTION, customActionPane);
// 发送邮件
EmailPane emailPane = new EmailPane();
hyperlinkPane.add(EMAIL, emailPane);
cards.add(javaScriptPane);
cards.add(commit2DBJavaScriptPane);
cards.add(customActionPane);
cards.add(emailPane);
//其他事件
addOtherEvent();
hyperlinkPane.setBorder(BorderFactory.createTitledBorder(Toolkit.i18nText("Fine-Design_Report_JavaScript_Set")));
this.add(hyperlinkPane);
styleBox.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
Object selected = styleBox.getSelectedItem();
if (selected == null) {
return;
}
card.show(hyperlinkPane, selected.toString());
}
});
}
private void addOtherEvent() {
Set<JavaScriptActionProvider> javaScriptActionProviders = ExtraDesignClassManager.getInstance().getArray(JavaScriptActionProvider.XML_TAG);
if (javaScriptActionProviders != null) {
for (JavaScriptActionProvider jsp : javaScriptActionProviders) {
FurtherBasicBeanPane pane = jsp.getJavaScriptActionPane();
String title = pane.title4PopupWindow();
styleBox.addItem(title);
hyperlinkPane.add(title, pane);
cards.add(pane);
}
}
}
/**
* 根据有无单元格创建 DBManipulationPane
*
* @return 有单元格有智能添加单元格等按钮返回 SmartInsertDBManipulationPane
*/
private DBManipulationPane autoCreateDBManipulationPane() {
JTemplate jTemplate = DesignerContext.getDesignerFrame().getSelectedJTemplate();
return jTemplate.createDBManipulationPane();
}
@Override
protected String title4PopupWindow() {
return Toolkit.i18nText("Fine-Design_Report_Event_Set");
}
@Override
public void populateBean(Listener listener) {
this.listener = listener;
if (this.listener == null) {
this.listener = new Listener();
}
this.nameText.setText(listener.getEventName());
JavaScript js = listener.getAction();
for (int i = 0; i < this.cards.size(); i++) {
FurtherBasicBeanPane pane = cards.get(i);
if (pane.accept(js)) {
styleBox.setSelectedItem(pane.title4PopupWindow());
card.show(hyperlinkPane, pane.title4PopupWindow());
pane.populateBean(js);
return;
}
}
}
public void checkValid() throws Exception{ public void checkValid() throws Exception {
this.cards.get(this.styleBox.getSelectedIndex()).checkValid(); this.cards.get(this.styleBox.getSelectedIndex()).checkValid();
} }
@Override @Override
public Listener updateBean(){ public Listener updateBean() {
this.listener.setEventName(this.nameText.getText()); this.listener.setEventName(this.nameText.getText());
FurtherBasicBeanPane<? extends JavaScript> pane = this.cards.get(this.styleBox.getSelectedIndex()); FurtherBasicBeanPane<? extends JavaScript> pane = this.cards.get(this.styleBox.getSelectedIndex());
this.listener.setAction(pane.updateBean()); this.listener.setAction(pane.updateBean());
return this.listener; return this.listener;
} }
} }

16
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/AlphaFineConstants.java

@ -2,9 +2,11 @@ package com.fr.design.mainframe.alphafine;
import com.fr.base.extension.FileExtension; import com.fr.base.extension.FileExtension;
import com.fr.general.CloudCenter; import com.fr.general.CloudCenter;
import java.awt.Color; import java.awt.Color;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.Font; import java.awt.Font;
import java.util.ArrayList;
/** /**
@ -49,7 +51,7 @@ public class AlphaFineConstants {
public static final Dimension HOT_ICON_LABEL_SIZE = new Dimension(36, 36); public static final Dimension HOT_ICON_LABEL_SIZE = new Dimension(36, 36);
public static final Dimension HOT_ISSUES_JAPNEL_SIZE = new Dimension(213,182); public static final Dimension HOT_ISSUES_JAPNEL_SIZE = new Dimension(213, 182);
public static final Dimension CLOSE_BUTTON_SIZE = new Dimension(40, 40); public static final Dimension CLOSE_BUTTON_SIZE = new Dimension(40, 40);
@ -83,7 +85,7 @@ public class AlphaFineConstants {
public static final String IMAGE_URL = "/com/fr/design/mainframe/alphafine/images/"; public static final String IMAGE_URL = "/com/fr/design/mainframe/alphafine/images/";
public static final String ALPHA_HOT_IMAGE_NAME = "alphafine_hot"; public static final String ALPHA_HOT_IMAGE_NAME = "alphafine_hot";
public static final String PLUGIN_SEARCH_URL = CloudCenter.getInstance().acquireUrlByKind("plugin.searchAPI"); public static final String PLUGIN_SEARCH_URL = CloudCenter.getInstance().acquireUrlByKind("plugin.searchAPI");
@ -134,8 +136,16 @@ public class AlphaFineConstants {
public static final String FIRST_PAGE = "-1"; public static final String FIRST_PAGE = "-1";
public static final FileExtension[] FILE_EXTENSIONS= new FileExtension[]{FileExtension.CPT, FileExtension.FRM}; public static final FileExtension[] FILE_EXTENSIONS = new FileExtension[]{FileExtension.CPT, FileExtension.FRM};
public static final int RECOMMEND_MAX_ITEM_NUM = 3; public static final int RECOMMEND_MAX_ITEM_NUM = 3;
public static final String BACK_ICON_NAME = "back@1x.png";
public static final ArrayList<String> CONJUNCTION = new ArrayList<String>() {{
add(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_AlphaFine_Conjunction_HE"));
add(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_AlphaFine_Conjunction_YU"));
add(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_AlphaFine_Conjunction_DE"));
}};
} }

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

@ -16,6 +16,7 @@ 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.SimilarSearchManeger;
import com.fr.general.ProcessCanceledException; import com.fr.general.ProcessCanceledException;
import com.fr.general.http.HttpToolbox;
import com.fr.json.JSONArray; import com.fr.json.JSONArray;
import com.fr.json.JSONException; import com.fr.json.JSONException;
import com.fr.json.JSONObject; import com.fr.json.JSONObject;
@ -30,6 +31,7 @@ import java.util.List;
public class AlphaFineHelper { public class AlphaFineHelper {
public static final NoResultModel NO_CONNECTION_MODEL = new NoResultModel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Connection_Failed")); public static final NoResultModel NO_CONNECTION_MODEL = new NoResultModel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Connection_Failed"));
private static AlphaFineDialog alphaFineDialog; private static AlphaFineDialog alphaFineDialog;
private static final String URL_FOR_TEST_NETWORK = "https://www.baidu.com";
/** /**
* 弹出alphafine搜索面板 * 弹出alphafine搜索面板
@ -130,6 +132,9 @@ public class AlphaFineHelper {
* @return * @return
*/ */
public static SearchResult getNoConnectList(Object object) { public static SearchResult getNoConnectList(Object object) {
if (isNetworkOk()){
return null;
}
SearchResult result = new SearchResult(); SearchResult result = new SearchResult();
if (object instanceof RecommendSearchManager) { if (object instanceof RecommendSearchManager) {
result.add(0, new MoreModel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_AlphaFine_Recommend"))); result.add(0, new MoreModel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_AlphaFine_Recommend")));
@ -145,4 +150,18 @@ public class AlphaFineHelper {
result.add(AlphaFineHelper.NO_CONNECTION_MODEL); result.add(AlphaFineHelper.NO_CONNECTION_MODEL);
return result; return result;
} }
/**
* 判断网络是否异常
* @return
*/
public static boolean isNetworkOk(){
try {
HttpToolbox.get(URL_FOR_TEST_NETWORK);
return true;
} catch (Exception ignore) {
// 网络异常
return false;
}
}
} }

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

@ -7,6 +7,7 @@ import com.fr.json.JSONException;
import com.fr.json.JSONObject; import com.fr.json.JSONObject;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.stable.AssistUtils; import com.fr.stable.AssistUtils;
import com.fr.stable.EncodeConstants;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import org.apache.commons.codec.digest.DigestUtils; import org.apache.commons.codec.digest.DigestUtils;
@ -14,6 +15,7 @@ import java.awt.Desktop;
import java.io.IOException; import java.io.IOException;
import java.net.URI; import java.net.URI;
import java.net.URISyntaxException; import java.net.URISyntaxException;
import java.net.URLEncoder;
/** /**
* Created by alex.sung on 2018/8/3. * Created by alex.sung on 2018/8/3.
@ -85,7 +87,7 @@ public class RobotModel extends AlphaCellModel {
@Override @Override
public void doAction() { public void doAction() {
try { try {
Desktop.getDesktop().browse(new URI(AlphaFineConstants.ALPHA_PREVIEW + super.getName())); Desktop.getDesktop().browse(new URI(AlphaFineConstants.ALPHA_PREVIEW + URLEncoder.encode(super.getName(), EncodeConstants.ENCODING_UTF_8)));
} catch (IOException e) { } catch (IOException e) {
FineLoggerFactory.getLogger().error(e.getMessage()); FineLoggerFactory.getLogger().error(e.getMessage());
} catch (URISyntaxException e) { } catch (URISyntaxException e) {

2
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/cell/render/BottomCellRender.java

@ -24,7 +24,7 @@ public class BottomCellRender implements ListCellRenderer<Object> {
JPanel line = new JPanel(); JPanel line = new JPanel();
line.setPreferredSize(new Dimension(200, 1)); line.setPreferredSize(new Dimension(200, 1));
line.setBackground(AlphaFineConstants.GRAY); line.setBackground(AlphaFineConstants.WHITE);
panel.add(line, BorderLayout.NORTH); panel.add(line, BorderLayout.NORTH);
goToWebLabel.setFont(AlphaFineConstants.MEDIUM_FONT); goToWebLabel.setFont(AlphaFineConstants.MEDIUM_FONT);

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

@ -39,7 +39,6 @@ import com.fr.form.main.Form;
import com.fr.form.main.FormIO; import com.fr.form.main.FormIO;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.http.HttpClient; import com.fr.general.http.HttpClient;
import com.fr.general.http.HttpToolbox;
import com.fr.io.TemplateWorkBookIO; import com.fr.io.TemplateWorkBookIO;
import com.fr.io.exporter.ImageExporter; import com.fr.io.exporter.ImageExporter;
import com.fr.json.JSONException; import com.fr.json.JSONException;
@ -49,7 +48,6 @@ import com.fr.main.impl.WorkBook;
import com.fr.stable.CodeUtils; import com.fr.stable.CodeUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.stable.project.ProjectConstants; import com.fr.stable.project.ProjectConstants;
import com.fr.third.org.apache.http.client.methods.HttpGet;
import javax.imageio.ImageIO; import javax.imageio.ImageIO;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
@ -241,28 +239,26 @@ public class AlphaFineDialog extends UIDialog {
hotPane.setLayout(new BorderLayout()); hotPane.setLayout(new BorderLayout());
UILabel uiLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_AlphaFine_Hot")); UILabel uiLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_AlphaFine_Hot"));
uiLabel.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0));
uiLabel.setFont(AlphaFineConstants.SMALL_FONT); uiLabel.setFont(AlphaFineConstants.SMALL_FONT);
uiLabel.setForeground(AlphaFineConstants.DARK_GRAY); uiLabel.setForeground(AlphaFineConstants.DARK_GRAY);
GridLayout gridLayout = new GridLayout(2, 3, 3, 3); GridLayout gridLayout = new GridLayout(2, 3, 3, 3);
JPanel panel = new JPanel(); JPanel panel = new JPanel();
panel.setLayout(gridLayout); panel.setLayout(gridLayout);
try { if (AlphaFineHelper.isNetworkOk()) {
HttpGet getHelp = new HttpGet(AlphaFineConstants.ALPHA_HOT_SEARCH);
HttpToolbox.getHttpClient(AlphaFineConstants.ALPHA_HOT_SEARCH).execute(getHelp).getStatusLine();
if (hotData == null) { if (hotData == null) {
hotData = HotIssuesManager.getInstance().getHotIssues(); hotData = HotIssuesManager.getInstance().getHotIssues();
} }
for (int i = 0; i < hotData.length; i++) { for (int i = 0; i < hotData.length; i++) {
panel.add(new HotIssueJpanel(hotData[i], i + 1)); panel.add(new HotIssueJpanel(hotData[i], i + 1));
} }
} catch (Exception e) { } else {
hotData = null; hotData = null;
for (int i = 0; i < AlphaFineConstants.HOT_ITEMS; i++) { for (int i = 0; i < AlphaFineConstants.HOT_ITEMS; i++) {
panel.add(new HotIssueJpanel(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Connection_Failed")}, i + 1)); panel.add(new HotIssueJpanel(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Connection_Failed")}, i + 1));
} }
} }
hotPane.add(uiLabel, BorderLayout.NORTH); hotPane.add(uiLabel, BorderLayout.NORTH);
hotPane.add(panel, BorderLayout.CENTER); hotPane.add(panel, BorderLayout.CENTER);
add(hotPane, BorderLayout.SOUTH); add(hotPane, BorderLayout.SOUTH);
@ -552,7 +548,7 @@ public class AlphaFineDialog extends UIDialog {
} }
private void buildDocumentList(final String[] searchText) { private void buildDocumentList(final String[] searchText) {
addSearchResult(DocumentSearchManager.getInstance().getLessSearchResult(getHotData(), searchText)); addSearchResult(DocumentSearchManager.getInstance().getLessSearchResult(searchText));
} }
private void buildFileList(String searchStr, final String[] searchText) { private void buildFileList(String searchStr, final String[] searchText) {
@ -560,24 +556,24 @@ public class AlphaFineDialog extends UIDialog {
} }
private void buildActionList(final String[] searchText) { private void buildActionList(final String[] searchText) {
addSearchResult(ActionSearchManager.getInstance().getLessSearchResult(getHotData(), searchText)); addSearchResult(ActionSearchManager.getInstance().getLessSearchResult(searchText));
} }
private void buildPluginList(final String[] searchText) { private void buildPluginList(final String[] searchText) {
addSearchResult(PluginSearchManager.getInstance().getLessSearchResult(getHotData(), searchText)); addSearchResult(PluginSearchManager.getInstance().getLessSearchResult(searchText));
} }
private void buildRecommendList(final String[] searchText) { private void buildRecommendList(final String[] searchText) {
addSearchResult(RecommendSearchManager.getInstance().getLessSearchResult(getHotData(), searchText)); addSearchResult(RecommendSearchManager.getInstance().getLessSearchResult(searchText));
} }
private void buildRecentList(final String[] searchText) { private void buildRecentList(final String[] searchText) {
addSearchResult(RecentSearchManager.getInstance().getLessSearchResult(getHotData(), searchText)); addSearchResult(RecentSearchManager.getInstance().getLessSearchResult(searchText));
} }
private void buildSimilarList(final String[] searchText) { private void buildSimilarList(final String[] searchText) {
addSearchResult(SimilarSearchManeger.getInstance().getLessSearchResult(getHotData(), searchText)); addSearchResult(SimilarSearchManeger.getInstance().getLessSearchResult(searchText));
} }
private synchronized void addSearchResult(SearchResult searchResult) { private synchronized void addSearchResult(SearchResult searchResult) {
@ -740,7 +736,7 @@ public class AlphaFineDialog extends UIDialog {
if (!isCancelled() && rightSearchResultPane != null) { if (!isCancelled() && rightSearchResultPane != null) {
rightSearchResultPane.removeAll(); rightSearchResultPane.removeAll();
try { try {
rightSearchResultPane.add(new RobotPreviewPane((selectedValue).getName(), get())); rightSearchResultPane.add(new RobotPreviewPane(selectedValue, get()));
} catch (InterruptedException e) { } catch (InterruptedException e) {
FineLoggerFactory.getLogger().error("get hot item content error: " + e.getMessage()); FineLoggerFactory.getLogger().error("get hot item content error: " + e.getMessage());
} catch (ExecutionException e) { } catch (ExecutionException e) {
@ -952,11 +948,13 @@ public class AlphaFineDialog extends UIDialog {
Thread sendThread = new Thread(new Runnable() { Thread sendThread = new Thread(new Runnable() {
@Override @Override
public void run() { public void run() {
RecentSearchManager searchManager = RecentSearchManager.getInstance(); if (StringUtils.isNotEmpty(storeText)) {
searchManager.addModel(storeText, cellModel); RecentSearchManager searchManager = RecentSearchManager.getInstance();
sendDataToServer(storeText, cellModel); searchManager.addModel(storeText, cellModel);
TemplateInfoCollector.getInstance().sendTemplateInfo(); sendDataToServer(storeText, cellModel);
ErrorInfoUploader.getInstance().sendErrorInfo(); TemplateInfoCollector.getInstance().sendTemplateInfo();
ErrorInfoUploader.getInstance().sendErrorInfo();
}
} }
}); });
sendThread.start(); sendThread.start();
@ -1380,11 +1378,14 @@ public class AlphaFineDialog extends UIDialog {
*/ */
private void initBackPane() { private void initBackPane() {
backPane = new JPanel(new BorderLayout()); backPane = new JPanel(new BorderLayout());
JLabel jLabel = new JLabel(" < " + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_AlphaFine_Back")); JLabel jLabel = new JLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_AlphaFine_Back"));
jLabel.setPreferredSize(new Dimension(680, 20)); jLabel.setIcon(IconLoader.getIcon(AlphaFineConstants.IMAGE_URL + AlphaFineConstants.BACK_ICON_NAME));
jLabel.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 0));
jLabel.setPreferredSize(new Dimension(80, 20));
jLabel.setFont(AlphaFineConstants.SMALL_FONT); jLabel.setFont(AlphaFineConstants.SMALL_FONT);
jLabel.setForeground(AlphaFineConstants.DARK_GRAY); jLabel.setForeground(AlphaFineConstants.DARK_GRAY);
backPane.add(jLabel, BorderLayout.CENTER); jLabel.setCursor(new Cursor(Cursor.HAND_CURSOR));
backPane.add(jLabel, BorderLayout.WEST);
jLabel.addMouseListener(new MouseAdapter() { jLabel.addMouseListener(new MouseAdapter() {
@Override @Override

19
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/RobotPreviewPane.java

@ -4,7 +4,10 @@ package com.fr.design.mainframe.alphafine.preview;
import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.itextarea.UITextArea; import com.fr.design.gui.itextarea.UITextArea;
import com.fr.design.mainframe.alphafine.AlphaFineConstants; import com.fr.design.mainframe.alphafine.AlphaFineConstants;
import com.fr.design.mainframe.alphafine.cell.model.AlphaCellModel;
import com.fr.design.mainframe.alphafine.cell.model.RobotModel;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.stable.EncodeConstants;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
@ -21,6 +24,7 @@ import java.io.IOException;
import java.net.URI; import java.net.URI;
import java.net.URISyntaxException; import java.net.URISyntaxException;
import java.net.URL; import java.net.URL;
import java.net.URLEncoder;
/** /**
@ -28,13 +32,14 @@ import java.net.URL;
*/ */
public class RobotPreviewPane extends JPanel { public class RobotPreviewPane extends JPanel {
private static final int TITLE_AREA_HEIGHT = 30; private static final int TITLE_AREA_HEIGHT = 15;
private static final int HOT_TITLE_AREA_HEIGHT = 30;
public RobotPreviewPane(String title, String content) { public RobotPreviewPane(AlphaCellModel model, String content) {
this.setLayout(new BorderLayout()); this.setLayout(new BorderLayout());
this.setBackground(Color.WHITE); this.setBackground(Color.WHITE);
this.setPreferredSize(new Dimension(AlphaFineConstants.RIGHT_WIDTH, AlphaFineConstants.CONTENT_HEIGHT)); this.setPreferredSize(new Dimension(AlphaFineConstants.RIGHT_WIDTH, AlphaFineConstants.CONTENT_HEIGHT));
UITextArea titleArea = new UITextArea(title); UITextArea titleArea = new UITextArea(model.getName());
titleArea.setBorder(null); titleArea.setBorder(null);
titleArea.setEditable(false); titleArea.setEditable(false);
titleArea.setForeground(AlphaFineConstants.BLUE); titleArea.setForeground(AlphaFineConstants.BLUE);
@ -55,7 +60,7 @@ public class RobotPreviewPane extends JPanel {
.replaceAll("\\('", StringUtils.EMPTY) .replaceAll("\\('", StringUtils.EMPTY)
.replaceAll("'\\)", StringUtils.EMPTY); .replaceAll("'\\)", StringUtils.EMPTY);
try { try {
Desktop.getDesktop().browse(new URI(AlphaFineConstants.ALPHA_PREVIEW + s)); Desktop.getDesktop().browse(new URI(AlphaFineConstants.ALPHA_PREVIEW + URLEncoder.encode(s, EncodeConstants.ENCODING_UTF_8)));
} catch (IOException e1) { } catch (IOException e1) {
FineLoggerFactory.getLogger().error(e1.getMessage()); FineLoggerFactory.getLogger().error(e1.getMessage());
} catch (URISyntaxException e1) { } catch (URISyntaxException e1) {
@ -76,7 +81,11 @@ public class RobotPreviewPane extends JPanel {
UIScrollPane jScrollPane = new UIScrollPane(editorPane); UIScrollPane jScrollPane = new UIScrollPane(editorPane);
jScrollPane.getVerticalScrollBar().setBorder(BorderFactory.createEmptyBorder(0, 2, 0, 0)); jScrollPane.getVerticalScrollBar().setBorder(BorderFactory.createEmptyBorder(0, 2, 0, 0));
jScrollPane.setBorder(BorderFactory.createMatteBorder(5, 10, 0, 10, Color.white)); jScrollPane.setBorder(BorderFactory.createMatteBorder(5, 10, 0, 10, Color.white));
this.setPreferredSize(new Dimension(AlphaFineConstants.RIGHT_WIDTH, AlphaFineConstants.CONTENT_HEIGHT - TITLE_AREA_HEIGHT)); if (((RobotModel) model).isHotItemModel()) {
this.setPreferredSize(new Dimension(AlphaFineConstants.RIGHT_WIDTH, AlphaFineConstants.CONTENT_HEIGHT - HOT_TITLE_AREA_HEIGHT));
} else {
this.setPreferredSize(new Dimension(AlphaFineConstants.RIGHT_WIDTH, AlphaFineConstants.CONTENT_HEIGHT - TITLE_AREA_HEIGHT));
}
add(jScrollPane, BorderLayout.CENTER); add(jScrollPane, BorderLayout.CENTER);
} }
} }

2
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/fun/AlphaFineSearchProvider.java

@ -12,7 +12,7 @@ public interface AlphaFineSearchProvider {
* @param searchText * @param searchText
* @return * @return
*/ */
SearchResult getLessSearchResult(String[][] data, String[] searchText); SearchResult getLessSearchResult(String[] searchText);
/** /**
* 获取剩余条数 * 获取剩余条数

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

@ -57,7 +57,7 @@ public class ActionSearchManager implements AlphaFineSearchProvider {
} }
@Override @Override
public SearchResult getLessSearchResult(String[][] hotData, String[] searchText) { public SearchResult getLessSearchResult(String[] searchText) {
filterModelList = new SearchResult(); filterModelList = new SearchResult();
lessModelList = new SearchResult(); lessModelList = new SearchResult();
moreModelList = new SearchResult(); moreModelList = new SearchResult();

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

@ -3,16 +3,9 @@ package com.fr.design.mainframe.alphafine.search.manager.impl;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.mainframe.alphafine.AlphaFineConstants; import com.fr.design.mainframe.alphafine.AlphaFineConstants;
import com.fr.design.mainframe.alphafine.AlphaFineHelper; import com.fr.design.mainframe.alphafine.AlphaFineHelper;
import com.fr.design.mainframe.alphafine.cell.model.RobotModel;
import com.fr.design.mainframe.alphafine.model.SearchResult; import com.fr.design.mainframe.alphafine.model.SearchResult;
import com.fr.general.http.HttpToolbox; import com.fr.general.http.HttpToolbox;
import com.fr.json.JSONArray;
import com.fr.json.JSONException;
import com.fr.json.JSONObject;
import com.fr.json.JSONUtils;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils;
import java.io.IOException;
import com.fr.third.org.apache.commons.codec.digest.DigestUtils; import com.fr.third.org.apache.commons.codec.digest.DigestUtils;
@ -37,6 +30,7 @@ public class ComplementAdviceManager {
/** /**
* 从接口中获取补全建议结果 * 从接口中获取补全建议结果
*
* @param searchText * @param searchText
* @return * @return
*/ */
@ -50,11 +44,9 @@ public class ComplementAdviceManager {
try { try {
String result = HttpToolbox.get(url); String result = HttpToolbox.get(url);
AlphaFineHelper.checkCancel(); AlphaFineHelper.checkCancel();
allModelList = AlphaFineHelper.getModelListFromJSONArray(result,"keywords"); allModelList = AlphaFineHelper.getModelListFromJSONArray(result, "keywords");
} catch(ClassCastException | JSONException e){ } catch (Exception e) {
FineLoggerFactory.getLogger().error("complement advice search error: " + e.getMessage()); FineLoggerFactory.getLogger().debug("complement advice search error. search str {}", searchText[j]);
} catch (IOException e1) {
FineLoggerFactory.getLogger().error("complement advice get result error: " + e1.getMessage());
} }
} }
if (searchResult.isEmpty()) { if (searchResult.isEmpty()) {

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

@ -51,15 +51,17 @@ public class DocumentSearchManager implements AlphaFineSearchProvider {
} }
@Override @Override
public SearchResult getLessSearchResult(String[][] hotData, String[] searchText) { public SearchResult getLessSearchResult(String[] searchText) {
lessModelList = new SearchResult(); lessModelList = new SearchResult();
moreModelList = new SearchResult(); moreModelList = new SearchResult();
if (DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isContainDocument()) { if (DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isContainDocument()) {
if (ArrayUtils.isEmpty(searchText)) { if (ArrayUtils.isEmpty(searchText)) {
lessModelList.add(new MoreModel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Community_Help"))); lessModelList.add(new MoreModel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Community_Help")));
return lessModelList; return lessModelList;
} else if (hotData == null) { }
return AlphaFineHelper.getNoConnectList(instance); SearchResult noConnectList = AlphaFineHelper.getNoConnectList(instance);
if(noConnectList != null){
return noConnectList;
} }
SearchResult searchResult = new SearchResult(); SearchResult searchResult = new SearchResult();
for (int j = 0; j < searchText.length; j++) { for (int j = 0; j < searchText.length; j++) {

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

@ -96,7 +96,7 @@ public class FileSearchManager implements AlphaFineSearchProvider {
} }
@Override @Override
public SearchResult getLessSearchResult(String[][] hotData, String[] searchText) { public SearchResult getLessSearchResult(String[] searchText) {
return null; return null;
} }

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

@ -96,7 +96,7 @@ public class PluginSearchManager implements AlphaFineSearchProvider {
} }
@Override @Override
public SearchResult getLessSearchResult(String[][] hotData, String[] searchText) { public SearchResult getLessSearchResult(String[] searchText) {
this.lessModelList = new SearchResult(); this.lessModelList = new SearchResult();
this.moreModelList = new SearchResult(); this.moreModelList = new SearchResult();
SearchResult searchResult = new SearchResult(); SearchResult searchResult = new SearchResult();
@ -104,8 +104,10 @@ public class PluginSearchManager implements AlphaFineSearchProvider {
if (ArrayUtils.isEmpty(searchText)) { if (ArrayUtils.isEmpty(searchText)) {
lessModelList.add(new MoreModel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Plugin_Addon"))); lessModelList.add(new MoreModel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Plugin_Addon")));
return lessModelList; return lessModelList;
} else if (hotData == null) { }
return AlphaFineHelper.getNoConnectList(instance); SearchResult noConnectList = AlphaFineHelper.getNoConnectList(instance);
if(noConnectList != null){
return noConnectList;
} }
for (int j = 0; j < searchText.length; j++) { for (int j = 0; j < searchText.length; j++) {
try { try {

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

@ -45,9 +45,10 @@ import java.util.List;
*/ */
public class RecentSearchManager implements AlphaFineSearchProvider { public class RecentSearchManager implements AlphaFineSearchProvider {
private static final int MAX_SIZE = 100; private static final int MAX_SIZE = 100;
private static volatile RecentSearchManager instance;
IndexReader indexReader = null; private static final RecentSearchManager INSTANCE = new RecentSearchManager();
IndexSearcher indexSearcher = null;
private IndexReader indexReader = null;
//索引存储路径 //索引存储路径
private String path = ProductConstants.getEnvHome() + File.separator + "searchIndex"; private String path = ProductConstants.getEnvHome() + File.separator + "searchIndex";
//分词器,暂时先用这个 //分词器,暂时先用这个
@ -57,25 +58,18 @@ public class RecentSearchManager implements AlphaFineSearchProvider {
private IndexWriterConfig config = new IndexWriterConfig(Version.LUCENE_40, analyzer); private IndexWriterConfig config = new IndexWriterConfig(Version.LUCENE_40, analyzer);
private IndexWriter indexWriter = null; private IndexWriter indexWriter = null;
private SearchResult recentModelList; private SearchResult recentModelList;
private SearchResult modelList;
public static RecentSearchManager getInstance() { public static RecentSearchManager getInstance() {
if (instance == null) {
synchronized (RecentSearchManager.class) { return INSTANCE;
if (instance == null) {
instance = new RecentSearchManager();
instance.initWriter();
}
}
}
return instance;
} }
@Override @Override
public SearchResult getLessSearchResult(String[][] hotData, String[] searchText) { public SearchResult getLessSearchResult(String[] searchText) {
this.modelList = new SearchResult();
for (int j = 0; j < searchText.length; j++) { SearchResult modelList = new SearchResult();
recentModelList = getRecentModelList(searchText[j]); for (String aSearchText : searchText) {
recentModelList = getRecentModelList(aSearchText);
} }
if (recentModelList != null && recentModelList.size() > 0) { if (recentModelList != null && recentModelList.size() > 0) {
modelList.add(new MoreModel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_AlphaFine_Latest"))); modelList.add(new MoreModel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_AlphaFine_Latest")));
@ -92,8 +86,8 @@ public class RecentSearchManager implements AlphaFineSearchProvider {
public SearchResult getMoreSearchResult(String searchText) { public SearchResult getMoreSearchResult(String searchText) {
return new SearchResult(); return new SearchResult();
} }
public synchronized SearchResult getRecentModelList(String searchText) { private synchronized SearchResult getRecentModelList(String searchText) {
return searchBySort(searchText); return searchBySort(searchText);
} }
@ -121,7 +115,6 @@ public class RecentSearchManager implements AlphaFineSearchProvider {
try { try {
indexWriter.close(); indexWriter.close();
indexReader = DirectoryReader.open(directory); indexReader = DirectoryReader.open(directory);
indexSearcher = new IndexSearcher(indexReader);
} catch (IOException e) { } catch (IOException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
@ -130,8 +123,6 @@ public class RecentSearchManager implements AlphaFineSearchProvider {
/** /**
* 添加模型 * 添加模型
* *
* @param searchKey
* @param cellModel
*/ */
public void addModel(String searchKey, AlphaCellModel cellModel) { public void addModel(String searchKey, AlphaCellModel cellModel) {
if(cellModel == null){ if(cellModel == null){
@ -151,8 +142,6 @@ public class RecentSearchManager implements AlphaFineSearchProvider {
/** /**
* 写文档建立索引 * 写文档建立索引
*
* @param doc
*/ */
private void writeDoc(Document doc) { private void writeDoc(Document doc) {
try { try {
@ -166,9 +155,6 @@ public class RecentSearchManager implements AlphaFineSearchProvider {
/** /**
* 按序搜索 * 按序搜索
*
* @param key
* @return
*/ */
private synchronized SearchResult searchBySort(String key) { private synchronized SearchResult searchBySort(String key) {
recentModelList = new SearchResult(); recentModelList = new SearchResult();

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

@ -12,14 +12,12 @@ import com.fr.design.mainframe.alphafine.model.SearchResult;
import com.fr.design.mainframe.alphafine.search.manager.fun.AlphaFineSearchProvider; import com.fr.design.mainframe.alphafine.search.manager.fun.AlphaFineSearchProvider;
import com.fr.general.http.HttpToolbox; import com.fr.general.http.HttpToolbox;
import com.fr.json.JSONArray; import com.fr.json.JSONArray;
import com.fr.json.JSONException;
import com.fr.json.JSONObject; import com.fr.json.JSONObject;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.stable.CodeUtils; import com.fr.stable.CodeUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import java.io.IOException;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
@ -46,14 +44,16 @@ public class RecommendSearchManager implements AlphaFineSearchProvider {
} }
@Override @Override
public SearchResult getLessSearchResult(String[][] hotData, String[] searchText) { public SearchResult getLessSearchResult(String[] searchText) {
this.modelList = new SearchResult(); this.modelList = new SearchResult();
this.recommendModelList = new SearchResult(); this.recommendModelList = new SearchResult();
if (DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isContainRecommend()) { if (DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isContainRecommend()) {
if (ArrayUtils.isEmpty(searchText)) { if (ArrayUtils.isEmpty(searchText)) {
return new SearchResult(); return new SearchResult();
} else if(hotData == null){ }
return AlphaFineHelper.getNoConnectList(instance); SearchResult noConnectList = AlphaFineHelper.getNoConnectList(instance);
if (noConnectList != null) {
return noConnectList;
} }
for (int j = 0; j < searchText.length; j++) { for (int j = 0; j < searchText.length; j++) {
searchText[j] = searchText[j].replaceAll(StringUtils.BLANK, StringUtils.EMPTY); searchText[j] = searchText[j].replaceAll(StringUtils.BLANK, StringUtils.EMPTY);
@ -74,10 +74,8 @@ public class RecommendSearchManager implements AlphaFineSearchProvider {
} }
} }
} }
} catch (JSONException e) { } catch (Exception e) {
FineLoggerFactory.getLogger().error("recommend search error! :" + e.getMessage()); FineLoggerFactory.getLogger().debug("recommend search get result error! search str {}", searchText[j]);
} catch (IOException e) {
FineLoggerFactory.getLogger().error("recommend search get result error! :" + e.getMessage());
} }
} }
@ -111,7 +109,7 @@ public class RecommendSearchManager implements AlphaFineSearchProvider {
/** /**
* 将推荐接口获取的数据分别放入显示部分显示更多的list * 将推荐接口获取的数据分别放入显示部分显示更多的list
*/ */
private void getRecommendSearchResult(){ private void getRecommendSearchResult() {
if (recommendModelList.size() > AlphaFineConstants.RECOMMEND_MAX_ITEM_NUM) { if (recommendModelList.size() > AlphaFineConstants.RECOMMEND_MAX_ITEM_NUM) {
if (recommendModelList.size() > AlphaFineConstants.SHOW_SIZE) { if (recommendModelList.size() > AlphaFineConstants.SHOW_SIZE) {
modelList.add(0, new MoreModel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_AlphaFine_Recommend"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_AlphaFine_ShowAll"), true, CellType.RECOMMEND)); modelList.add(0, new MoreModel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_AlphaFine_Recommend"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_AlphaFine_ShowAll"), true, CellType.RECOMMEND));
@ -129,7 +127,7 @@ public class RecommendSearchManager implements AlphaFineSearchProvider {
/** /**
* 将补全接口获取的数据分别放入显示部分显示更多的list * 将补全接口获取的数据分别放入显示部分显示更多的list
*/ */
private void getComplementAdviceSearchResult(){ private void getComplementAdviceSearchResult() {
if (complementAdviceModelList.size() > AlphaFineConstants.SHOW_SIZE) { if (complementAdviceModelList.size() > AlphaFineConstants.SHOW_SIZE) {
modelList.add(0, new MoreModel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_AlphaFine_Recommend"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_AlphaFine_ShowAll"), true, CellType.RECOMMEND)); modelList.add(0, new MoreModel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_AlphaFine_Recommend"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_AlphaFine_ShowAll"), true, CellType.RECOMMEND));
modelList.addAll(complementAdviceModelList.subList(0, AlphaFineConstants.SHOW_SIZE)); modelList.addAll(complementAdviceModelList.subList(0, AlphaFineConstants.SHOW_SIZE));
@ -143,7 +141,7 @@ public class RecommendSearchManager implements AlphaFineSearchProvider {
/** /**
* 将推荐接口和补全接口获取的数据分别放入显示部分显示更多的list * 将推荐接口和补全接口获取的数据分别放入显示部分显示更多的list
*/ */
private void getRecommendAndAdviceSearchResult(){ private void getRecommendAndAdviceSearchResult() {
if (recommendModelList.size() + complementAdviceModelList.size() > AlphaFineConstants.SHOW_SIZE) { if (recommendModelList.size() + complementAdviceModelList.size() > AlphaFineConstants.SHOW_SIZE) {
modelList.add(0, new MoreModel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_AlphaFine_Recommend"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_AlphaFine_ShowAll"), true, CellType.RECOMMEND)); modelList.add(0, new MoreModel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_AlphaFine_Recommend"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_AlphaFine_ShowAll"), true, CellType.RECOMMEND));
if (recommendModelList.size() > AlphaFineConstants.RECOMMEND_MAX_ITEM_NUM) { if (recommendModelList.size() > AlphaFineConstants.RECOMMEND_MAX_ITEM_NUM) {

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

@ -2,7 +2,6 @@ package com.fr.design.mainframe.alphafine.search.manager.impl;
import com.fr.design.mainframe.alphafine.AlphaFineConstants; import com.fr.design.mainframe.alphafine.AlphaFineConstants;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.third.ibm.icu.text.BreakIterator; import com.fr.third.ibm.icu.text.BreakIterator;
import java.util.ArrayList; import java.util.ArrayList;
@ -72,7 +71,8 @@ public class SegmentationManager {
int start = itor.first(); int start = itor.first();
for (int end = itor.next(); end != BreakIterator.DONE; start = end, end = itor.next()) { for (int end = itor.next(); end != BreakIterator.DONE; start = end, end = itor.next()) {
String temp = searchText.substring(start, end); String temp = searchText.substring(start, end);
if (!StringUtils.isEmpty(temp)) { //去掉空和连词
if (StringUtils.isNotEmpty(temp) && !AlphaFineConstants.CONJUNCTION.contains(temp)) {
result.add(temp); result.add(temp);
} }
} }

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

@ -9,14 +9,11 @@ import com.fr.design.mainframe.alphafine.cell.model.RobotModel;
import com.fr.design.mainframe.alphafine.model.SearchResult; import com.fr.design.mainframe.alphafine.model.SearchResult;
import com.fr.design.mainframe.alphafine.search.manager.fun.AlphaFineSearchProvider; import com.fr.design.mainframe.alphafine.search.manager.fun.AlphaFineSearchProvider;
import com.fr.general.http.HttpToolbox; import com.fr.general.http.HttpToolbox;
import com.fr.json.JSONException;
import com.fr.json.JSONObject; import com.fr.json.JSONObject;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.third.org.apache.commons.codec.digest.DigestUtils; import com.fr.third.org.apache.commons.codec.digest.DigestUtils;
import java.io.IOException;
/** /**
* Created by alex.sung on 2018/8/3. * Created by alex.sung on 2018/8/3.
*/ */
@ -27,7 +24,7 @@ public class SimilarSearchManeger implements AlphaFineSearchProvider {
public static SimilarSearchManeger getInstance() { public static SimilarSearchManeger getInstance() {
if (instance == null) { if (instance == null) {
synchronized (SimilarSearchManeger.class){ synchronized (SimilarSearchManeger.class) {
if (instance == null) { if (instance == null) {
instance = new SimilarSearchManeger(); instance = new SimilarSearchManeger();
} }
@ -37,13 +34,15 @@ public class SimilarSearchManeger implements AlphaFineSearchProvider {
} }
@Override @Override
public SearchResult getLessSearchResult(String[][] hotData, String[] searchText) { public SearchResult getLessSearchResult(String[] searchText) {
lessModelList = new SearchResult(); lessModelList = new SearchResult();
if (DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isNeedIntelligentCustomerService()) { if (DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isNeedIntelligentCustomerService()) {
if (ArrayUtils.isEmpty(searchText)) { if (ArrayUtils.isEmpty(searchText)) {
return new SearchResult(); return new SearchResult();
} else if (hotData == null) { }
return AlphaFineHelper.getNoConnectList(instance); SearchResult noConnectList = AlphaFineHelper.getNoConnectList(instance);
if (noConnectList != null) {
return noConnectList;
} }
SearchResult allModelList = new SearchResult(); SearchResult allModelList = new SearchResult();
for (int j = 0; j < searchText.length; j++) { for (int j = 0; j < searchText.length; j++) {
@ -52,11 +51,9 @@ public class SimilarSearchManeger implements AlphaFineSearchProvider {
try { try {
String result = HttpToolbox.get(url); String result = HttpToolbox.get(url);
AlphaFineHelper.checkCancel(); AlphaFineHelper.checkCancel();
allModelList = AlphaFineHelper.getModelListFromJSONArray(result,"title"); allModelList = AlphaFineHelper.getModelListFromJSONArray(result, "title");
} catch (ClassCastException | JSONException e) { } catch (Exception e) {
FineLoggerFactory.getLogger().error("similar search error: " + e.getMessage()); FineLoggerFactory.getLogger().debug("similar search error.search str {}", searchText[j]);
} catch (IOException e) {
FineLoggerFactory.getLogger().error("similar search get result error: " + e.getMessage());
} }
} }
moreModelList.clear(); moreModelList.clear();

2
designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java

@ -38,7 +38,7 @@ public class DesignerSocketIO {
} }
private static Optional<Socket> socketIO = Optional.absent(); private static Optional<Socket> socketIO = Optional.absent();
public static Status status = Status.Disconnected; private static Status status = Status.Disconnected;
private static final Emitter.Listener printLog = new Emitter.Listener() { private static final Emitter.Listener printLog = new Emitter.Listener() {
@Override @Override

5
designer-realize/src/main/java/com/fr/design/report/mobile/ReportMobileAttrPane.java

@ -15,8 +15,6 @@ public class ReportMobileAttrPane extends BasicBeanPane<ElementCaseMobileAttr>{
private ReportMobileTemplateSettingsPane reportMobileTemplateSettingsPane; // 模版设置面板 private ReportMobileTemplateSettingsPane reportMobileTemplateSettingsPane; // 模版设置面板
private AppFitBrowserPane appFitBrowserPane; private AppFitBrowserPane appFitBrowserPane;
//工具栏容器
private MobileToolBarPane mobileToolBarPane;
// 其他 // 其他
private MobileOthersPane mobileOthersPane; private MobileOthersPane mobileOthersPane;
@ -38,7 +36,6 @@ public class ReportMobileAttrPane extends BasicBeanPane<ElementCaseMobileAttr>{
appFitBrowserPane.setAppFitPreviewPane(appFitPreviewPane); appFitBrowserPane.setAppFitPreviewPane(appFitPreviewPane);
jPanel.add(appFitBrowserPane); jPanel.add(appFitBrowserPane);
jPanel.add(mobileToolBarPane = new MobileToolBarPane());
jPanel.add(mobileOthersPane = new MobileOthersPane()); jPanel.add(mobileOthersPane = new MobileOthersPane());
jPanel.add(appFitPreviewPane); jPanel.add(appFitPreviewPane);
@ -52,7 +49,6 @@ public class ReportMobileAttrPane extends BasicBeanPane<ElementCaseMobileAttr>{
ob = new ElementCaseMobileAttr(); ob = new ElementCaseMobileAttr();
} }
appFitBrowserPane.populateBean(ob); appFitBrowserPane.populateBean(ob);
mobileToolBarPane.populateBean(ob);
mobileOthersPane.populateBean(ob); mobileOthersPane.populateBean(ob);
reportMobileTemplateSettingsPane.populateBean(ob); reportMobileTemplateSettingsPane.populateBean(ob);
} }
@ -60,7 +56,6 @@ public class ReportMobileAttrPane extends BasicBeanPane<ElementCaseMobileAttr>{
@Override @Override
public ElementCaseMobileAttr updateBean() { public ElementCaseMobileAttr updateBean() {
ElementCaseMobileAttr caseMobileAttr = appFitBrowserPane.updateBean(); ElementCaseMobileAttr caseMobileAttr = appFitBrowserPane.updateBean();
mobileToolBarPane.updateBean(caseMobileAttr);
mobileOthersPane.updateBean(caseMobileAttr); mobileOthersPane.updateBean(caseMobileAttr);
reportMobileTemplateSettingsPane.updateBean(caseMobileAttr); reportMobileTemplateSettingsPane.updateBean(caseMobileAttr);

6
designer-realize/src/main/java/com/fr/design/webattr/ReportWebWidgetConstants.java

@ -40,7 +40,6 @@ import com.fr.report.web.button.write.StashButton;
import com.fr.report.web.button.write.Submit; import com.fr.report.web.button.write.Submit;
import com.fr.report.web.button.write.SubmitForcibly; import com.fr.report.web.button.write.SubmitForcibly;
import com.fr.report.web.button.write.Verify; import com.fr.report.web.button.write.Verify;
import com.fr.report.web.button.write.WriteOfflineHTML;
public class ReportWebWidgetConstants { public class ReportWebWidgetConstants {
private ReportWebWidgetConstants() { private ReportWebWidgetConstants() {
@ -57,7 +56,7 @@ public class ReportWebWidgetConstants {
public static WidgetOption[] getWriteToolBarInstance() { public static WidgetOption[] getWriteToolBarInstance() {
return new WidgetOption[]{SUBMIT, VERIFY, EMAIL, EXPORT, PDF, EXCELP, EXCELO, EXCELS, WORD, NEW_PRINT, PRINT, FLASHPRINT, APPLETPRINT, PDFPRINT, IMPORTEXCELDATA, SHOWCELLVALUE, return new WidgetOption[]{SUBMIT, VERIFY, EMAIL, EXPORT, PDF, EXCELP, EXCELO, EXCELS, WORD, NEW_PRINT, PRINT, FLASHPRINT, APPLETPRINT, PDFPRINT, IMPORTEXCELDATA, SHOWCELLVALUE,
APPENDCOLUMNROW, DELETECOLUMNROW, SETPRINTEROFFSET, WRITEOFFLINEHTML, CUSTOM_BUTTON, WRITESTASH, WRITESTASHCLEAR, IMPORTEXCELDATA_CUSTOMIZED, APPENDCOLUMNROW, DELETECOLUMNROW, SETPRINTEROFFSET, CUSTOM_BUTTON, WRITESTASH, WRITESTASHCLEAR, IMPORTEXCELDATA_CUSTOMIZED,
IMPORTEXCEL, IMPORTEXCEL_COVER, IMPORTEXCEL_CLEAN, IMPORTEXCEL_APPEND}; IMPORTEXCEL, IMPORTEXCEL_COVER, IMPORTEXCEL_CLEAN, IMPORTEXCEL_APPEND};
} }
@ -151,9 +150,6 @@ public class ReportWebWidgetConstants {
public static final WidgetOption CUSTOM_BUTTON = WidgetOptionFactory public static final WidgetOption CUSTOM_BUTTON = WidgetOptionFactory
.createByWidgetClass(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Custom_Form_Button"), CustomToolBarButton.class); .createByWidgetClass(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Custom_Form_Button"), CustomToolBarButton.class);
// 输出离线html报表
public static final WidgetOption WRITEOFFLINEHTML = WidgetOptionFactory
.createByWidgetClass(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Engine_Export-Offline-Html"), BaseUtils.readIcon("/com/fr/web/images/writeOffline.png"), WriteOfflineHTML.class);
// 数据暂存 // 数据暂存
public static final WidgetOption WRITESTASH = WidgetOptionFactory public static final WidgetOption WRITESTASH = WidgetOptionFactory
.createByWidgetClass(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Engine-Write_Stash"), BaseUtils.readIcon("/com/fr/web/images/edit/stash.png"), StashButton.class); .createByWidgetClass(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Engine-Write_Stash"), BaseUtils.readIcon("/com/fr/web/images/edit/stash.png"), StashButton.class);

2
designer-realize/src/main/java/com/fr/design/webattr/printsettings/NativePrintSettingPane.java

@ -166,7 +166,7 @@ public class NativePrintSettingPane extends JPanel {
printerPane.add(printerComboBox); printerPane.add(printerComboBox);
// 份数 // 份数
copySpinner = new UIBasicSpinner(new SpinnerNumberModel(1, 0, Integer.MAX_VALUE, 1)); copySpinner = new UIBasicSpinner(new SpinnerNumberModel(1, 1, Integer.MAX_VALUE, 1));
GUICoreUtils.setColumnForSpinner(copySpinner, 5); GUICoreUtils.setColumnForSpinner(copySpinner, 5);
JPanel copyPane = FRGUIPaneFactory.createLeftFlowZeroGapBorderPane(); JPanel copyPane = FRGUIPaneFactory.createLeftFlowZeroGapBorderPane();
copyPane.add(copySpinner); copyPane.add(copySpinner);

16
designer-realize/src/main/java/com/fr/start/fx/PrismImageLoader2.java

@ -10,7 +10,7 @@ import com.sun.javafx.iio.gif.GIFImageLoaderFactory;
import com.sun.javafx.tk.PlatformImage; import com.sun.javafx.tk.PlatformImage;
import com.sun.prism.Image; import com.sun.prism.Image;
import com.sun.prism.impl.PrismSettings; import com.sun.prism.impl.PrismSettings;
import sun.util.logging.PlatformLogger;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
@ -22,8 +22,6 @@ import java.io.InputStream;
*/ */
class PrismImageLoader2 implements com.sun.javafx.tk.ImageLoader { class PrismImageLoader2 implements com.sun.javafx.tk.ImageLoader {
private static PlatformLogger imageioLogger = null;
private Image[] images; private Image[] images;
private int[] delayTimes; private int[] delayTimes;
private int width; private int width;
@ -174,21 +172,11 @@ class PrismImageLoader2 implements com.sun.javafx.tk.ImageLoader {
return image; return image;
} }
/**
* Returns the PlatformLogger for logging imageio-related activities.
*/
private static synchronized PlatformLogger getImageioLogger() {
if (imageioLogger == null) {
imageioLogger = PlatformLogger.getLogger("imageio");
}
return imageioLogger;
}
private class PrismLoadListener implements ImageLoadListener { private class PrismLoadListener implements ImageLoadListener {
@Override @Override
public void imageLoadWarning(ImageLoader loader, String message) { public void imageLoadWarning(ImageLoader loader, String message) {
getImageioLogger().warning(message);
} }
@Override @Override

3
designer-realize/src/main/java/com/fr/start/module/DesignerStartup.java

@ -7,6 +7,7 @@ import com.fr.event.Listener;
import com.fr.module.Activator; import com.fr.module.Activator;
import com.fr.record.analyzer.EnableMetrics; import com.fr.record.analyzer.EnableMetrics;
import com.fr.record.analyzer.Metrics; import com.fr.record.analyzer.Metrics;
import com.fr.runtime.FineRuntime;
import com.fr.start.Designer; import com.fr.start.Designer;
import com.fr.start.ServerStarter; import com.fr.start.ServerStarter;
import com.fr.start.SplashContext; import com.fr.start.SplashContext;
@ -63,7 +64,7 @@ public class DesignerStartup extends Activator {
DesignerContext.getDesignerFrame().getProgressDialog().setVisible(true); DesignerContext.getDesignerFrame().getProgressDialog().setVisible(true);
startSub(StartFinishActivator.class); startSub(StartFinishActivator.class);
FineRuntime.startFinish();
} }
private void browserDemo() { private void browserDemo() {

7
designer-realize/src/main/java/com/fr/start/preload/ImagePreLoader.java

@ -19,7 +19,7 @@ public class ImagePreLoader {
int start = 0; int start = 0;
for (int i = 0; i < len; i++) { for (int i = 0; i < len; i++) {
if (i != 0 && i % THRESHOLD == 0) { if (i != 0 && i % THRESHOLD == 0) {
loadImage(start,i, service); loadImage(start, i, service);
start = i; start = i;
} }
if (len - i < THRESHOLD) { if (len - i < THRESHOLD) {
@ -401,6 +401,9 @@ public class ImagePreLoader {
"com/fr/design/images/control/up.png", "com/fr/design/images/control/up.png",
"com/fr/design/images/control/down.png", "com/fr/design/images/control/down.png",
"com/fr/design/images/condition/bracket.png", "com/fr/design/images/condition/bracket.png",
"com/fr/design/images/condition/unBracket.png" "com/fr/design/images/condition/unBracket.png",
"com/fr/design/images/buttonicon/user_search_normal.png",
"com/fr/design/remote/images/icon_Member_normal@1x.png",
"/com/fr/design/images/buttonicon/add.png"
}; };
} }

BIN
designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/back@1x.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 221 B

BIN
designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/back@2x.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 336 B

Loading…
Cancel
Save