Browse Source

Merge pull request #1447 in DESIGN/design from release/10.0 to feature/10.0

* commit '50de08b80dab6a7cbc6f69fcd228a47e0de869a0': (155 commits)
  无jira任务, 冲突修复
  MOBILE-25614 && MOBILE-25605
  ct
  ct
  ct
  ct
  ct
  ct
  ct
  ct
  ct
  ct
  代码合并冲突
  CHART-12814 悬浮图表去掉clone
  CHART-12814 悬浮图表数据问题
  CHART-12815  天数不增加的问题
  MOBILE-25493 && MOBILE-25540 交互调整
  CHART-12746 埋点接口
  CHART-12746
  CHART-12746
  ...
research/11.0
neil 5 years ago
parent
commit
35d92628db
  1. 13
      designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java
  2. 83
      designer-base/src/main/java/com/fr/design/ExtraDesignClassManager.java
  3. 1
      designer-base/src/main/java/com/fr/design/actions/TableDataSourceAction.java
  4. 3
      designer-base/src/main/java/com/fr/design/actions/community/UpAction.java
  5. 4
      designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java
  6. 2
      designer-base/src/main/java/com/fr/design/actions/file/WebPreviewUtils.java
  7. 15
      designer-base/src/main/java/com/fr/design/actions/file/export/AbstractExportAction.java
  8. 3
      designer-base/src/main/java/com/fr/design/actions/help/ForumAction.java
  9. 3
      designer-base/src/main/java/com/fr/design/actions/help/SupportQQAction.java
  10. 7
      designer-base/src/main/java/com/fr/design/condition/LiteConditionPane.java
  11. 68
      designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java
  12. 7
      designer-base/src/main/java/com/fr/design/data/datapane/ChoosePane.java
  13. 12
      designer-base/src/main/java/com/fr/design/data/datapane/TableDataComboBox.java
  14. 7
      designer-base/src/main/java/com/fr/design/data/datapane/TableDataPaneListPane.java
  15. 85
      designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java
  16. 5
      designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListPane.java
  17. 7
      designer-base/src/main/java/com/fr/design/data/datapane/preview/PreviewTablePane.java
  18. 2
      designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/EmbeddedTableDataDefinedPane.java
  19. 2
      designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/EmbeddedTableDataPane.java
  20. 9
      designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/FileTableDataPane.java
  21. 3
      designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/ProcedureDataPane.java
  22. 1
      designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/AbstractTableDataWrapper.java
  23. 5
      designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/StoreProcedureDataWrapper.java
  24. 7
      designer-base/src/main/java/com/fr/design/designer/creator/CRPropertyDescriptor.java
  25. 290
      designer-base/src/main/java/com/fr/design/dialog/FineJOptionPane.java
  26. 2
      designer-base/src/main/java/com/fr/design/dialog/UIDialog.java
  27. 5
      designer-base/src/main/java/com/fr/design/editor/DoubleDeckValueEditorPane.java
  28. 5
      designer-base/src/main/java/com/fr/design/editor/ValueEditorPane.java
  29. 12
      designer-base/src/main/java/com/fr/design/env/RemoteDesignerWorkspaceInfo.java
  30. 6
      designer-base/src/main/java/com/fr/design/env/RemoteWorkspace.java
  31. 3
      designer-base/src/main/java/com/fr/design/extra/LoginWebPane.java
  32. 7
      designer-base/src/main/java/com/fr/design/extra/PluginFromStorePane.java
  33. 11
      designer-base/src/main/java/com/fr/design/extra/PluginInstalledPane.java
  34. 3
      designer-base/src/main/java/com/fr/design/extra/PluginOperateUtils.java
  35. 5
      designer-base/src/main/java/com/fr/design/extra/PluginUpdatePane.java
  36. 8
      designer-base/src/main/java/com/fr/design/extra/PluginUtils.java
  37. 3
      designer-base/src/main/java/com/fr/design/extra/PluginWebPane.java
  38. 3
      designer-base/src/main/java/com/fr/design/extra/QQLoginWebPane.java
  39. 11
      designer-base/src/main/java/com/fr/design/extra/WebViewDlgHelper.java
  40. 9
      designer-base/src/main/java/com/fr/design/extra/exe/callback/InstallFromDiskCallback.java
  41. 7
      designer-base/src/main/java/com/fr/design/extra/exe/callback/InstallOnlineCallback.java
  42. 5
      designer-base/src/main/java/com/fr/design/extra/exe/callback/ModifyStatusCallback.java
  43. 7
      designer-base/src/main/java/com/fr/design/extra/exe/callback/UninstallPluginCallback.java
  44. 9
      designer-base/src/main/java/com/fr/design/extra/exe/callback/UpdateFromDiskCallback.java
  45. 5
      designer-base/src/main/java/com/fr/design/extra/exe/callback/UpdateOnlineCallback.java
  46. 7
      designer-base/src/main/java/com/fr/design/extra/tradition/callback/UpdateOnlineCallback.java
  47. 13
      designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java
  48. 9
      designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java
  49. 2
      designer-base/src/main/java/com/fr/design/file/SaveSomeTemplatePane.java
  50. 37
      designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java
  51. 57
      designer-base/src/main/java/com/fr/design/formula/FormulaConstants.java
  52. 35
      designer-base/src/main/java/com/fr/design/formula/FormulaPane.java
  53. 7
      designer-base/src/main/java/com/fr/design/formula/JavaEditorPane.java
  54. 34
      designer-base/src/main/java/com/fr/design/fun/MobileBookMarkStyleProvider.java
  55. 3
      designer-base/src/main/java/com/fr/design/fun/PreviewProvider.java
  56. 24
      designer-base/src/main/java/com/fr/design/fun/impl/AbstractMobileBookMarkStyleProvider.java
  57. 10
      designer-base/src/main/java/com/fr/design/fun/impl/AbstractPreviewProvider.java
  58. 3
      designer-base/src/main/java/com/fr/design/gui/controlpane/ListControlPaneHelper.java
  59. 31
      designer-base/src/main/java/com/fr/design/gui/controlpane/UIControlPane.java
  60. 2
      designer-base/src/main/java/com/fr/design/gui/frpane/AbstractAttrNoScrollPane.java
  61. 3
      designer-base/src/main/java/com/fr/design/gui/frpane/CommitTabbedPane.java
  62. 5
      designer-base/src/main/java/com/fr/design/gui/frpane/EditingStringListPane.java
  63. 2
      designer-base/src/main/java/com/fr/design/gui/frpane/HyperlinkGroupPane.java
  64. 3
      designer-base/src/main/java/com/fr/design/gui/frpane/JTreeControlPane.java
  65. 3
      designer-base/src/main/java/com/fr/design/gui/frpane/UITabbedPane.java
  66. 3
      designer-base/src/main/java/com/fr/design/gui/frpane/tree/layer/config/LayerDataControlPane.java
  67. 36
      designer-base/src/main/java/com/fr/design/gui/ibutton/ModeButtonGroup.java
  68. 60
      designer-base/src/main/java/com/fr/design/gui/ibutton/UIColorButton.java
  69. 11
      designer-base/src/main/java/com/fr/design/gui/ibutton/UIRadioButton.java
  70. 12
      designer-base/src/main/java/com/fr/design/gui/icheckbox/UICheckBox.java
  71. 38
      designer-base/src/main/java/com/fr/design/gui/icombocheckbox/UIComboCheckBox.java
  72. 3
      designer-base/src/main/java/com/fr/design/gui/imenutable/UIMenuTableUI.java
  73. 13
      designer-base/src/main/java/com/fr/design/gui/ispinner/UIBasicSpinner.java
  74. 3
      designer-base/src/main/java/com/fr/design/gui/itable/UITableUI.java
  75. 5
      designer-base/src/main/java/com/fr/design/gui/itableeditorpane/UITableModelAdapter.java
  76. 53
      designer-base/src/main/java/com/fr/design/gui/itextfield/TextFieldUI.java
  77. 5
      designer-base/src/main/java/com/fr/design/gui/itree/refreshabletree/RefreshableJTree.java
  78. 5
      designer-base/src/main/java/com/fr/design/gui/style/BackgroundPane.java
  79. 16
      designer-base/src/main/java/com/fr/design/gui/style/BorderPane.java
  80. 3
      designer-base/src/main/java/com/fr/design/hyperlink/ReportletHyperlinkPane.java
  81. 5
      designer-base/src/main/java/com/fr/design/javascript/JavaScriptActionPane.java
  82. 7
      designer-base/src/main/java/com/fr/design/locale/impl/SplashMark.java
  83. 3
      designer-base/src/main/java/com/fr/design/locale/impl/UserInfoMark.java
  84. 6
      designer-base/src/main/java/com/fr/design/locale/impl/VideoMark.java
  85. 18
      designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java
  86. 29
      designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java
  87. 5
      designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java
  88. 45
      designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java
  89. 23
      designer-base/src/main/java/com/fr/design/mainframe/JTemplateFactory.java
  90. 3
      designer-base/src/main/java/com/fr/design/mainframe/UndoStateEdit.java
  91. 26
      designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/BackgroundQuickPane.java
  92. 15
      designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/ColorBackgroundQuickPane.java
  93. 13
      designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/GradientBackgroundQuickPane.java
  94. 7
      designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/ImageBackgroundQuickPane.java
  95. 4
      designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/NullBackgroundQuickPane.java
  96. 19
      designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/PatternBackgroundQuickPane.java
  97. 7
      designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/TextureBackgroundQuickPane.java
  98. 130
      designer-base/src/main/java/com/fr/design/mainframe/burying/point/AbstractPointCollector.java
  99. 55
      designer-base/src/main/java/com/fr/design/mainframe/burying/point/AbstractPointInfo.java
  100. 23
      designer-base/src/main/java/com/fr/design/mainframe/burying/point/BasePointCollector.java
  101. Some files were not shown because too many files have changed in this diff Show More

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

@ -3,6 +3,7 @@ package com.fr.design;
import com.fr.design.data.DesignTableDataManager; import com.fr.design.data.DesignTableDataManager;
import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.env.DesignerWorkspaceGenerator; import com.fr.design.env.DesignerWorkspaceGenerator;
import com.fr.design.env.DesignerWorkspaceInfo; import com.fr.design.env.DesignerWorkspaceInfo;
import com.fr.design.env.DesignerWorkspaceType; import com.fr.design.env.DesignerWorkspaceType;
@ -107,8 +108,8 @@ public class EnvChangeEntrance {
strategy.showTip(new PopTip() { strategy.showTip(new PopTip() {
@Override @Override
public void show() { public void show() {
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Basic_Switch_Workspace_Failed"), FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Basic_Switch_Workspace_Failed"),
UIManager.getString("OptionPane.messageDialogTitle"), ERROR_MESSAGE, UIManager.getIcon("OptionPane.errorIcon")); com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Error"), ERROR_MESSAGE, UIManager.getIcon("OptionPane.errorIcon"));
} }
}); });
return false; return false;
@ -167,8 +168,8 @@ public class EnvChangeEntrance {
strategy.showTip(new PopTip() { strategy.showTip(new PopTip() {
@Override @Override
public void show() { public void show() {
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Basic_Switch_Workspace_Failed"), FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Basic_Switch_Workspace_Failed"),
UIManager.getString("OptionPane.messageDialogTitle"), ERROR_MESSAGE, UIManager.getIcon("OptionPane.errorIcon")); com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Error"), ERROR_MESSAGE, UIManager.getIcon("OptionPane.errorIcon"));
} }
}); });
return false; return false;
@ -177,8 +178,8 @@ public class EnvChangeEntrance {
strategy.showTip(new PopTip() { strategy.showTip(new PopTip() {
@Override @Override
public void show() { public void show() {
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Basic_Switch_Workspace_Failed"), FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Basic_Switch_Workspace_Failed"),
UIManager.getString("OptionPane.messageDialogTitle"), ERROR_MESSAGE, UIManager.getIcon("OptionPane.errorIcon")); com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Error"), ERROR_MESSAGE, UIManager.getIcon("OptionPane.errorIcon"));
} }
}); });

83
designer-base/src/main/java/com/fr/design/ExtraDesignClassManager.java

@ -7,7 +7,14 @@ package com.fr.design;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.common.annotations.Open; import com.fr.common.annotations.Open;
import com.fr.design.data.datapane.TableDataNameObjectCreator; import com.fr.design.data.datapane.TableDataNameObjectCreator;
import com.fr.design.fun.*; import com.fr.design.fun.CellWidgetOptionProvider;
import com.fr.design.fun.FormWidgetOptionProvider;
import com.fr.design.fun.MobileWidgetStyleProvider;
import com.fr.design.fun.ParameterWidgetOptionProvider;
import com.fr.design.fun.PreviewProvider;
import com.fr.design.fun.ServerTableDataDefineProvider;
import com.fr.design.fun.TableDataDefineProvider;
import com.fr.design.fun.ToolbarItemProvider;
import com.fr.design.gui.core.WidgetOption; import com.fr.design.gui.core.WidgetOption;
import com.fr.design.gui.core.WidgetOptionFactory; import com.fr.design.gui.core.WidgetOptionFactory;
import com.fr.design.menu.ShortCut; import com.fr.design.menu.ShortCut;
@ -24,6 +31,7 @@ import com.fr.stable.Filter;
import com.fr.stable.plugin.ExtraDesignClassManagerProvider; import com.fr.stable.plugin.ExtraDesignClassManagerProvider;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections; import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
@ -127,21 +135,25 @@ public class ExtraDesignClassManager extends AbstractExtraClassManager implement
} }
public WidgetOption[] getWebWidgetOptions(Set<ToolbarItemProvider> set, Filter<ToolbarItemProvider> filter) { public WidgetOption[] getWebWidgetOptions(Set<ToolbarItemProvider> set, Filter<ToolbarItemProvider> filter) {
if (set == null || set.isEmpty()) { return new DesignExtraBridge<WidgetOption, ToolbarItemProvider>() {
return new WidgetOption[0];
} @Override
List<WidgetOption> list = new ArrayList<>(); WidgetOption createT(ToolbarItemProvider provider) {
for (ToolbarItemProvider provider : set) { return WidgetOptionFactory.createByWidgetClass(
if (filter != null && filter.accept(provider)) {
WidgetOption option = WidgetOptionFactory.createByWidgetClass(
provider.nameForWidget(), provider.nameForWidget(),
IOUtils.readIcon(provider.iconPathForWidget()), IOUtils.readIcon(provider.iconPathForWidget()),
provider.classForWidget() provider.classForWidget()
); );
list.add(option);
} }
@Override
WidgetOption[] toArray(Collection<?> sCollection) {
if (sCollection == null) {
return new WidgetOption[0];
}
return sCollection.toArray(new WidgetOption[sCollection.size()]);
} }
return list.toArray(new WidgetOption[list.size()]); }.filterSAndTransformT(set, filter);
} }
@ -256,4 +268,55 @@ public class ExtraDesignClassManager extends AbstractExtraClassManager implement
return Collections.unmodifiableSet(shortCuts); return Collections.unmodifiableSet(shortCuts);
} }
public PreviewProvider[] getTemplatePreviews(Filter<PreviewProvider> filter) {
Set<PreviewProvider> set = ExtraDesignClassManager.getInstance().getArray(PreviewProvider.MARK_STRING);
return new DesignExtraBridge<PreviewProvider, PreviewProvider>() {
@Override
PreviewProvider createT(PreviewProvider previewProvider) {
return previewProvider;
}
@Override
PreviewProvider[] toArray(Collection<?> sCollection) {
if (sCollection == null) {
return new PreviewProvider[0];
}
return sCollection.toArray(new PreviewProvider[sCollection.size()]);
}
}.filterSAndTransformT(set, filter);
}
/**
* 抽了一个可能用到的公用逻辑出来通过filter过滤接口实现Set<s>并将对外接口实例转成内部实例S转成T,比如ToolItemProvider转成WidgetOption,当然也可以不转
*
* @param <T> 你想要得到的类型可以跟S相同
* @param <S> 待转换的目标类型
*/
abstract class DesignExtraBridge<T, S> {
T[] filterSAndTransformT(Set<S> set, Filter<S> filter) {
if (set == null || set.isEmpty()) {
return toArray(set);
}
List<T> list = new ArrayList<>();
for (S provider : set) {
if (filter == null || filter.accept(provider)) {
list.add(createT(provider));
}
}
return toArray(list);
}
/**
* S转T
* @param s
* @return
*/
abstract T createT(S s);
abstract T[] toArray(Collection<?> sCollection);
}
} }

1
designer-base/src/main/java/com/fr/design/actions/TableDataSourceAction.java

@ -64,6 +64,7 @@ public class TableDataSourceAction extends TemplateComponentAction<JTemplate<?,
* 撤销 * 撤销
*/ */
public void prepare4Undo() { public void prepare4Undo() {
//do nothing
} }
/** /**

3
designer-base/src/main/java/com/fr/design/actions/community/UpAction.java

@ -2,6 +2,7 @@ package com.fr.design.actions.community;
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.dialog.FineJOptionPane;
import com.fr.design.menu.MenuKeySet; import com.fr.design.menu.MenuKeySet;
import com.fr.general.CloudCenter; import com.fr.general.CloudCenter;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
@ -38,7 +39,7 @@ public class UpAction extends UpdateAction
try { try {
Desktop.getDesktop().browse(new URI(url)); Desktop.getDesktop().browse(new URI(url));
} catch (IOException exp) { } catch (IOException exp) {
JOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Set_Default_Browser")); FineJOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Set_Default_Browser"));
FineLoggerFactory.getLogger().error(exp.getMessage(), exp); FineLoggerFactory.getLogger().error(exp.getMessage(), exp);
} catch (URISyntaxException exp) { } catch (URISyntaxException exp) {
FineLoggerFactory.getLogger().error(exp.getMessage(), exp); FineLoggerFactory.getLogger().error(exp.getMessage(), exp);

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

@ -1,7 +1,5 @@
package com.fr.design.actions.file; package com.fr.design.actions.file;
import com.fr.cluster.ClusterBridge;
import com.fr.cluster.engine.base.FineClusterConfig;
import com.fr.config.Configuration; import com.fr.config.Configuration;
import com.fr.config.ServerPreferenceConfig; import com.fr.config.ServerPreferenceConfig;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
@ -673,7 +671,7 @@ public class PreferencePane extends BasicPane {
defaultStringToFormulaBox.setSelected(false); defaultStringToFormulaBox.setSelected(false);
} }
VcsConfigManager vcsConfigManager = designerEnvManager.getVcsConfigManager(); VcsConfigManager vcsConfigManager = designerEnvManager.getVcsConfigManager();
if (ClusterBridge.isClusterMode()) { if (WorkContext.getCurrent().isCluster()){
vcsEnableCheckBox.setEnabled(false); vcsEnableCheckBox.setEnabled(false);
gcEnableCheckBox.setEnabled(false); gcEnableCheckBox.setEnabled(false);
} }

2
designer-base/src/main/java/com/fr/design/actions/file/WebPreviewUtils.java

@ -21,7 +21,7 @@ import java.util.Map;
import static javax.swing.JOptionPane.OK_CANCEL_OPTION; import static javax.swing.JOptionPane.OK_CANCEL_OPTION;
import static javax.swing.JOptionPane.OK_OPTION; import static javax.swing.JOptionPane.OK_OPTION;
import static javax.swing.JOptionPane.WARNING_MESSAGE; import static javax.swing.JOptionPane.WARNING_MESSAGE;
import static javax.swing.JOptionPane.showConfirmDialog; import static com.fr.design.dialog.FineJOptionPane.showConfirmDialog;
public final class WebPreviewUtils { public final class WebPreviewUtils {

15
designer-base/src/main/java/com/fr/design/actions/file/export/AbstractExportAction.java

@ -2,6 +2,7 @@ package com.fr.design.actions.file.export;
import com.fr.design.actions.JTemplateAction; import com.fr.design.actions.JTemplateAction;
import com.fr.design.base.mode.DesignModeContext; import com.fr.design.base.mode.DesignModeContext;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.gui.iprogressbar.FRProgressBar; import com.fr.design.gui.iprogressbar.FRProgressBar;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
@ -132,10 +133,10 @@ public abstract class AbstractExportAction<E extends JTemplate<?, ?>> extends JT
E e = getEditingComponent(); E e = getEditingComponent();
if (!e.isALLSaved() && !DesignModeContext.isVcsMode()) { if (!e.isALLSaved() && !DesignModeContext.isVcsMode()) {
e.stopEditing(); e.stopEditing();
int returnVal = JOptionPane.showConfirmDialog( int returnVal = FineJOptionPane.showConfirmDialog(
DesignerContext.getDesignerFrame(), DesignerContext.getDesignerFrame(),
Toolkit.i18nText("Fine-Design_Basic_Utils_Would_You_Like_To_Save") + " \"" + e.getEditingFILE() + "\" ?", Toolkit.i18nText("Fine-Design_Basic_Utils_Would_You_Like_To_Save") + " \"" + e.getEditingFILE() + "\" ?",
ProductConstants.PRODUCT_NAME, Toolkit.i18nText("Fine-Design_Basic_Confirm"),
JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.YES_NO_CANCEL_OPTION,
JOptionPane.QUESTION_MESSAGE JOptionPane.QUESTION_MESSAGE
); );
@ -171,7 +172,7 @@ public abstract class AbstractExportAction<E extends JTemplate<?, ?>> extends JT
this.setProgress(100); this.setProgress(100);
FineLoggerFactory.getLogger().info("\"" + name + "\"" + Toolkit.i18nText("Fine-Design_Report_Finish_Export") + "!"); FineLoggerFactory.getLogger().info("\"" + name + "\"" + Toolkit.i18nText("Fine-Design_Report_Finish_Export") + "!");
JOptionPane.showMessageDialog( FineJOptionPane.showMessageDialog(
DesignerContext.getDesignerFrame(), DesignerContext.getDesignerFrame(),
Toolkit.i18nText("Fine-Design_Report_Exported_Successfully") + "\n" + name); Toolkit.i18nText("Fine-Design_Report_Exported_Successfully") + "\n" + name);
@ -180,10 +181,10 @@ public abstract class AbstractExportAction<E extends JTemplate<?, ?>> extends JT
this.setProgress(100); this.setProgress(100);
target.closeTemplate(); target.closeTemplate();
FineLoggerFactory.getLogger().error(exp.getMessage(), exp); FineLoggerFactory.getLogger().error(exp.getMessage(), exp);
JOptionPane.showMessageDialog( FineJOptionPane.showMessageDialog(
DesignerContext.getDesignerFrame(), DesignerContext.getDesignerFrame(),
Toolkit.i18nText("Fine-Engine_Remote_Design_Permission_Denied"), Toolkit.i18nText("Fine-Engine_Remote_Design_Permission_Denied"),
UIManager.getString("OptionPane.messageDialogTitle"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Error"),
JOptionPane.ERROR_MESSAGE, JOptionPane.ERROR_MESSAGE,
UIManager.getIcon("OptionPane.errorIcon") UIManager.getIcon("OptionPane.errorIcon")
); );
@ -191,10 +192,10 @@ public abstract class AbstractExportAction<E extends JTemplate<?, ?>> extends JT
this.setProgress(100); this.setProgress(100);
target.closeTemplate(); target.closeTemplate();
FineLoggerFactory.getLogger().error(exp.getMessage(), exp); FineLoggerFactory.getLogger().error(exp.getMessage(), exp);
JOptionPane.showMessageDialog( FineJOptionPane.showMessageDialog(
DesignerContext.getDesignerFrame(), DesignerContext.getDesignerFrame(),
Toolkit.i18nText("Fine-Design_Report_Export_Failed") + "\n" + path, Toolkit.i18nText("Fine-Design_Report_Export_Failed") + "\n" + path,
UIManager.getString("OptionPane.messageDialogTitle"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Error"),
JOptionPane.ERROR_MESSAGE, JOptionPane.ERROR_MESSAGE,
UIManager.getIcon("OptionPane.errorIcon") UIManager.getIcon("OptionPane.errorIcon")
); );

3
designer-base/src/main/java/com/fr/design/actions/help/ForumAction.java

@ -6,6 +6,7 @@ package com.fr.design.actions.help;
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.dialog.FineJOptionPane;
import com.fr.design.menu.MenuKeySet; import com.fr.design.menu.MenuKeySet;
import com.fr.general.CloudCenter; import com.fr.general.CloudCenter;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
@ -47,7 +48,7 @@ public class ForumAction extends UpdateAction {
try { try {
Desktop.getDesktop().browse(new URI(url)); Desktop.getDesktop().browse(new URI(url));
} catch (IOException exp) { } catch (IOException exp) {
JOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Set_Default_Browser")); FineJOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Set_Default_Browser"));
FineLoggerFactory.getLogger().error(exp.getMessage(), exp); FineLoggerFactory.getLogger().error(exp.getMessage(), exp);
} catch (URISyntaxException exp) { } catch (URISyntaxException exp) {
FineLoggerFactory.getLogger().error(exp.getMessage(), exp); FineLoggerFactory.getLogger().error(exp.getMessage(), exp);

3
designer-base/src/main/java/com/fr/design/actions/help/SupportQQAction.java

@ -6,6 +6,7 @@ package com.fr.design.actions.help;
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.dialog.FineJOptionPane;
import com.fr.design.menu.MenuKeySet; import com.fr.design.menu.MenuKeySet;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
@ -37,7 +38,7 @@ public class SupportQQAction extends UpdateAction {
try { try {
Desktop.getDesktop().browse(new URI(ProductConstants.SUPPORT_QQ)); Desktop.getDesktop().browse(new URI(ProductConstants.SUPPORT_QQ));
} catch (IOException exp) { } catch (IOException exp) {
JOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Set_Default_Browser")); FineJOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Set_Default_Browser"));
FineLoggerFactory.getLogger().error(exp.getMessage(), exp); FineLoggerFactory.getLogger().error(exp.getMessage(), exp);
} catch (URISyntaxException exp) { } catch (URISyntaxException exp) {
FineLoggerFactory.getLogger().error(exp.getMessage(), exp); FineLoggerFactory.getLogger().error(exp.getMessage(), exp);

7
designer-base/src/main/java/com/fr/design/condition/LiteConditionPane.java

@ -10,6 +10,7 @@ import com.fr.data.condition.ListCondition;
import com.fr.data.condition.ObjectCondition; import com.fr.data.condition.ObjectCondition;
import com.fr.design.beans.BasicBeanPane; import com.fr.design.beans.BasicBeanPane;
import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.formula.FormulaFactory; import com.fr.design.formula.FormulaFactory;
import com.fr.design.formula.UIFormula; import com.fr.design.formula.UIFormula;
import com.fr.design.formula.VariableResolver; import com.fr.design.formula.VariableResolver;
@ -123,7 +124,7 @@ public abstract class LiteConditionPane<T extends Condition> extends BasicBeanPa
ExpandMutableTreeNode parentTreeNode = getParentTreeNode(); ExpandMutableTreeNode parentTreeNode = getParentTreeNode();
boolean result = isExistedInParentTreeNode(parentTreeNode, liteCondition, false); boolean result = isExistedInParentTreeNode(parentTreeNode, liteCondition, false);
if (result) { if (result) {
JOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(LiteConditionPane.this), FineJOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(LiteConditionPane.this),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_BindColumn_This_Condition_Has_Been_Existed")); com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_BindColumn_This_Condition_Has_Been_Existed"));
return; return;
} }
@ -222,7 +223,7 @@ public abstract class LiteConditionPane<T extends Condition> extends BasicBeanPa
return; return;
} }
int returnVal = JOptionPane.showConfirmDialog(SwingUtilities.getWindowAncestor(LiteConditionPane.this), int returnVal = FineJOptionPane.showConfirmDialog(SwingUtilities.getWindowAncestor(LiteConditionPane.this),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Utils_Are_You_Sure_To_Remove_The_Selected_Item") + "?", com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Remove"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Utils_Are_You_Sure_To_Remove_The_Selected_Item") + "?", com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Remove"),
JOptionPane.OK_CANCEL_OPTION); JOptionPane.OK_CANCEL_OPTION);
if (returnVal == JOptionPane.OK_OPTION) { if (returnVal == JOptionPane.OK_OPTION) {
@ -610,7 +611,7 @@ public abstract class LiteConditionPane<T extends Condition> extends BasicBeanPa
//修改的时候加入判断条件重复 REPORT-13441 //修改的时候加入判断条件重复 REPORT-13441
boolean result = isExistedInParentTreeNode(parentTreeNode, liteCondition, true); boolean result = isExistedInParentTreeNode(parentTreeNode, liteCondition, true);
if (result) { if (result) {
JOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(LiteConditionPane.this), FineJOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(LiteConditionPane.this),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_BindColumn_This_Condition_Has_Been_Existed")); com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_BindColumn_This_Condition_Has_Been_Existed"));
return; return;
} }

68
designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java

@ -20,7 +20,7 @@ import com.fr.design.data.tabledata.wrapper.TableDataFactory;
import com.fr.design.data.tabledata.wrapper.TableDataWrapper; import com.fr.design.data.tabledata.wrapper.TableDataWrapper;
import com.fr.design.data.tabledata.wrapper.TemplateTableDataWrapper; import com.fr.design.data.tabledata.wrapper.TemplateTableDataWrapper;
import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.gui.iprogressbar.AutoProgressBar; import com.fr.design.gui.iprogressbar.AutoProgressBar;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.JTemplate;
@ -73,7 +73,7 @@ public abstract class DesignTableDataManager {
*/ */
private static java.util.Map<String, TableDataWrapper> globalDsCache = new java.util.HashMap<String, TableDataWrapper>(); private static java.util.Map<String, TableDataWrapper> globalDsCache = new java.util.HashMap<String, TableDataWrapper>();
private static java.util.Map<String, String> dsNameChangedMap = new HashMap<String, String>(); private static java.util.Map<String, String> dsNameChangedMap = new HashMap<String, String>();
// private static List<ChangeListener> dsListeners = new ArrayList<ChangeListener>(); private static List<ChangeListener> globalDsListeners = new ArrayList<>();
private static Map<String, List<ChangeListener>> dsListenersMap = new HashMap<String, List<ChangeListener>>(); private static Map<String, List<ChangeListener>> dsListenersMap = new HashMap<String, List<ChangeListener>>();
@ -83,6 +83,7 @@ public abstract class DesignTableDataManager {
//用于记录是否要弹出参数框 //用于记录是否要弹出参数框
private static ThreadLocal<String> threadLocal = new ThreadLocal<String>(); private static ThreadLocal<String> threadLocal = new ThreadLocal<String>();
private static Map<TableDataSource, Map<String, String[]>> columnCache = new HashMap<>();
/** /**
* 清除全局 数据集缓存. * 清除全局 数据集缓存.
@ -95,25 +96,31 @@ public abstract class DesignTableDataManager {
* 响应数据集改变. * 响应数据集改变.
*/ */
private static void fireDsChanged() { private static void fireDsChanged() {
fireDsChanged(globalDsListeners);
for (Entry<String, List<ChangeListener>> listenerEntry : dsListenersMap.entrySet()) { for (Entry<String, List<ChangeListener>> listenerEntry : dsListenersMap.entrySet()) {
List<ChangeListener> dsListeners = listenerEntry.getValue(); List<ChangeListener> dsListeners = listenerEntry.getValue();
fireDsChanged(dsListeners);
}
}
private static void fireDsChanged(List<ChangeListener> dsListeners) {
for (int i = 0; i < dsListeners.size(); i++) { for (int i = 0; i < dsListeners.size(); i++) {
//增强for循环用的iterator实现的, 如果中间哪个listener修改或删除了(如ChartEditPane.dsChangeListener), //增强for循环用的iterator实现的, 如果中间哪个listener修改或删除了(如ChartEditPane.dsChangeListener),
// 由于dsListeners是arraylist, 此时会ConcurrentModifyException // 由于dsListeners是arraylist, 此时会ConcurrentModifyException
// for (ChangeListener l : dsListeners) {
ChangeEvent e = null; ChangeEvent e = null;
dsListeners.get(i).stateChanged(e); dsListeners.get(i).stateChanged(e);
} }
} }
}
public static void closeTemplate(JTemplate<?, ?> template) { public static void closeTemplate(JTemplate<?, ?> template) {
if (template != null) { if (template != null) {
columnCache.remove(getEditingTableDataSource());
dsListenersMap.remove(template.getPath()); dsListenersMap.remove(template.getPath());
} }
} }
public static void envChange() { public static void envChange() {
columnCache.clear();
dsListenersMap.clear(); dsListenersMap.clear();
dsNameChangedMap.clear(); dsNameChangedMap.clear();
clearGlobalDs(); clearGlobalDs();
@ -160,13 +167,17 @@ public abstract class DesignTableDataManager {
} }
} }
public static void addGlobalDsChangeListener(ChangeListener l) {
globalDsListeners.add(l);
}
/** /**
* 添加模板数据集改变 监听事件. * 添加模板数据集改变 监听事件.
* *
* @param l ChangeListener监听器 * @param l ChangeListener监听器
*/ */
public static void addDsChangeListener(ChangeListener l) { public static void addDsChangeListener(ChangeListener l) {
JTemplate<?, ?> template = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); JTemplate<?, ?> template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
String key = StringUtils.EMPTY; String key = StringUtils.EMPTY;
if (template != null) { if (template != null) {
key = template.getPath(); key = template.getPath();
@ -178,7 +189,6 @@ public abstract class DesignTableDataManager {
} }
dsListeners.add(l); dsListeners.add(l);
} }
/** /**
* 获取数据源source中dsName的所有字段 * 获取数据源source中dsName的所有字段
* *
@ -190,7 +200,51 @@ public abstract class DesignTableDataManager {
java.util.Map<String, TableDataWrapper> resMap = getAllEditingDataSet(source); java.util.Map<String, TableDataWrapper> resMap = getAllEditingDataSet(source);
java.util.Map<String, TableDataWrapper> dsMap = getAllDataSetIncludingProcedure(resMap); java.util.Map<String, TableDataWrapper> dsMap = getAllDataSetIncludingProcedure(resMap);
TableDataWrapper tabledataWrapper = dsMap.get(dsName); TableDataWrapper tabledataWrapper = dsMap.get(dsName);
return tabledataWrapper == null ? new String[0] : tabledataWrapper.calculateColumnNameList().toArray(new String[0]); if (tabledataWrapper == null) {
return new String[0];
} else {
return getSelectedColumnNamesFromCache(source, dsName, tabledataWrapper);
}
}
private static String[] getSelectedColumnNamesFromCache(TableDataSource dataSource, String dsName, TableDataWrapper tableDataWrapper) {
Map<String, String[]> map = columnCache.get(dataSource);
if (map == null) {
map = new HashMap<>();
String[] columnNames = tableDataWrapper.calculateColumnNameList().toArray(new String[0]);
map.put(dsName, columnNames);
columnCache.put(dataSource, map);
return columnNames;
} else {
String[] columnNames = map.get(dsName);
if (columnNames == null) {
columnNames = tableDataWrapper.calculateColumnNameList().toArray(new String[0]);
map.put(dsName, columnNames);
return columnNames;
} else {
return columnNames;
}
}
}
public static void removeSelectedColumnNames(String dsName) {
Map<String, String[]> map = columnCache.get(getEditingTableDataSource());
if (map == null) {
return;
}
map.remove(dsName);
}
public static void addDsColumnNames(String dsName, String[] columnNames) {
TableDataSource dataSource = getEditingTableDataSource();
Map<String, String[]> map = columnCache.get(dataSource);
if (map == null) {
map = new HashMap<>();
map.put(dsName, columnNames);
columnCache.put(dataSource, map);
} else {
map.put(dsName, columnNames);
}
} }
/** /**

7
designer-base/src/main/java/com/fr/design/data/datapane/ChoosePane.java

@ -17,6 +17,7 @@ import com.fr.design.data.datapane.preview.PreviewLabel;
import com.fr.design.data.datapane.preview.PreviewLabel.Previewable; import com.fr.design.data.datapane.preview.PreviewLabel.Previewable;
import com.fr.design.data.datapane.preview.PreviewTablePane; import com.fr.design.data.datapane.preview.PreviewTablePane;
import com.fr.design.data.tabledata.Prepare4DataSourceChange; import com.fr.design.data.tabledata.Prepare4DataSourceChange;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.gui.icombobox.FRTreeComboBox; import com.fr.design.gui.icombobox.FRTreeComboBox;
import com.fr.design.gui.icombobox.FilterableComboBoxModel; import com.fr.design.gui.icombobox.FilterableComboBoxModel;
import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.icombobox.UIComboBox;
@ -337,7 +338,7 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha
DBUtils.refreshDatabase(); DBUtils.refreshDatabase();
String schema = StringUtils.isEmpty(schemaBox.getSelectedItem()) ? null : schemaBox.getSelectedItem(); String schema = StringUtils.isEmpty(schemaBox.getSelectedItem()) ? null : schemaBox.getSelectedItem();
DataCoreUtils.refreshTables(getConnection(), TableProcedure.TABLE, schema); DataCoreUtils.refreshTables(getConnection(), TableProcedure.TABLE, schema);
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Refresh_Successfully") + "!", com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Refresh_Database"), FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Refresh_Successfully") + "!", com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Refresh_Database"),
JOptionPane.INFORMATION_MESSAGE); JOptionPane.INFORMATION_MESSAGE);
} }
@ -443,7 +444,7 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha
} }
} catch (Exception e) { } catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Database_Connection_Failed"), FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Database_Connection_Failed"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Failed"), JOptionPane.ERROR_MESSAGE); com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Failed"), JOptionPane.ERROR_MESSAGE);
} }
} }
@ -467,7 +468,7 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha
} }
if (!connect) { if (!connect) {
DesignerFrame designerFrame = DesignerContext.getDesignerFrame(); DesignerFrame designerFrame = DesignerContext.getDesignerFrame();
JOptionPane.showMessageDialog(designerFrame, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Database_Connection_Failed"), FineJOptionPane.showMessageDialog(designerFrame, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Database_Connection_Failed"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Failed"), JOptionPane.ERROR_MESSAGE); com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Failed"), JOptionPane.ERROR_MESSAGE);
failedToFindTable(); failedToFindTable();
return null; return null;

12
designer-base/src/main/java/com/fr/design/data/datapane/TableDataComboBox.java

@ -34,6 +34,7 @@ public class TableDataComboBox extends UIComboBox implements Prepare4DataSourceC
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private boolean refresModel = false; private boolean refresModel = false;
private String treeName; //树数据集本身的名字 private String treeName; //树数据集本身的名字
private ChangeListener changeListener;
public TableDataComboBox(TableDataSource source){ public TableDataComboBox(TableDataSource source){
this(source,StringUtils.EMPTY); this(source,StringUtils.EMPTY);
@ -139,12 +140,19 @@ public class TableDataComboBox extends UIComboBox implements Prepare4DataSourceC
/** /**
*注册listener,相应数据集改变 *注册listener,相应数据集改变
*/ */
@Override
public void registerDSChangeListener() { public void registerDSChangeListener() {
DesignTableDataManager.addDsChangeListener(new ChangeListener() { changeListener = new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) { public void stateChanged(ChangeEvent e) {
TableDataComboBox.this.refresh(DesignTableDataManager.getEditingTableDataSource()); TableDataComboBox.this.refresh(DesignTableDataManager.getEditingTableDataSource());
} }
}); };
DesignTableDataManager.addDsChangeListener(changeListener);
}
public void registerGlobalDSChangeListener() {
DesignTableDataManager.addGlobalDsChangeListener(changeListener);
} }
} }

7
designer-base/src/main/java/com/fr/design/data/datapane/TableDataPaneListPane.java

@ -5,6 +5,7 @@ import com.fr.data.TableDataSource;
import com.fr.data.api.StoreProcedureAssist; import com.fr.data.api.StoreProcedureAssist;
import com.fr.data.impl.storeproc.StoreProcedure; import com.fr.data.impl.storeproc.StoreProcedure;
import com.fr.design.data.DesignTableDataManager; import com.fr.design.data.DesignTableDataManager;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.gui.controlpane.JListControlPane; import com.fr.design.gui.controlpane.JListControlPane;
import com.fr.design.gui.controlpane.NameableCreator; import com.fr.design.gui.controlpane.NameableCreator;
import com.fr.design.gui.ilist.ListModelElement; import com.fr.design.gui.ilist.ListModelElement;
@ -49,7 +50,7 @@ public class TableDataPaneListPane extends JListControlPane implements TableData
if (StringUtils.isEmpty(tempName)) { if (StringUtils.isEmpty(tempName)) {
isNamePermitted = false; isNamePermitted = false;
nameableList.stopEditing(); nameableList.stopEditing();
JOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(TableDataPaneListPane.this), Toolkit.i18nText("Fine-Design_Basic_Table_Data_Empty_Name_Tips")); FineJOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(TableDataPaneListPane.this), Toolkit.i18nText("Fine-Design_Basic_Table_Data_Empty_Name_Tips"));
setIllegalIndex(editingIndex); setIllegalIndex(editingIndex);
return; return;
} }
@ -58,12 +59,12 @@ public class TableDataPaneListPane extends JListControlPane implements TableData
&& isNameRepeated(new List[]{Arrays.asList(allDSNames), Arrays.asList(allListNames)}, tempName)) { && isNameRepeated(new List[]{Arrays.asList(allDSNames), Arrays.asList(allListNames)}, tempName)) {
isNamePermitted = false; isNamePermitted = false;
nameableList.stopEditing(); nameableList.stopEditing();
JOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(TableDataPaneListPane.this), Toolkit.i18nText("Fine-Design_Basic_Table_Data_Duplicate_Name_Tips", tempName)); FineJOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(TableDataPaneListPane.this), Toolkit.i18nText("Fine-Design_Basic_Table_Data_Duplicate_Name_Tips", tempName));
setIllegalIndex(editingIndex); setIllegalIndex(editingIndex);
} else if (editingType instanceof StoreProcedure && isIncludeUnderline(tempName)) { } else if (editingType instanceof StoreProcedure && isIncludeUnderline(tempName)) {
isNamePermitted = false; isNamePermitted = false;
nameableList.stopEditing(); nameableList.stopEditing();
JOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(TableDataPaneListPane.this), Toolkit.i18nText("Fine-Design_Basic_Stored_Procedure_Name_Tips")); FineJOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(TableDataPaneListPane.this), Toolkit.i18nText("Fine-Design_Basic_Stored_Procedure_Name_Tips"));
setIllegalIndex(editingIndex); setIllegalIndex(editingIndex);
} }
if (nameableList.getSelectedValue() instanceof ListModelElement) { if (nameableList.getSelectedValue() instanceof ListModelElement) {

85
designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java

@ -16,6 +16,9 @@ import com.fr.design.data.tabledata.wrapper.AbstractTableDataWrapper;
import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.fun.TableDataDefineProvider;
import com.fr.design.fun.TableDataPaneProcessor; import com.fr.design.fun.TableDataPaneProcessor;
import com.fr.design.gui.ibutton.UIHeadGroup; import com.fr.design.gui.ibutton.UIHeadGroup;
import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.icontainer.UIScrollPane;
@ -24,12 +27,12 @@ import com.fr.design.gui.itoolbar.UIToolbar;
import com.fr.design.icon.IconPathConstants; import com.fr.design.icon.IconPathConstants;
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.menu.MenuDef; import com.fr.design.menu.MenuDef;
import com.fr.design.menu.SeparatorDef; import com.fr.design.menu.SeparatorDef;
import com.fr.design.menu.ToolBarDef; import com.fr.design.menu.ToolBarDef;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.GeneralContext; import com.fr.general.GeneralContext;
import com.fr.general.NameObject; import com.fr.general.NameObject;
import com.fr.plugin.context.PluginContext; import com.fr.plugin.context.PluginContext;
import com.fr.plugin.injectable.PluginModule; import com.fr.plugin.injectable.PluginModule;
@ -38,8 +41,13 @@ import com.fr.plugin.observer.PluginEvent;
import com.fr.plugin.observer.PluginEventListener; import com.fr.plugin.observer.PluginEventListener;
import com.fr.stable.core.PropertyChangeAdapter; import com.fr.stable.core.PropertyChangeAdapter;
import javax.swing.*; import javax.swing.BorderFactory;
import java.awt.*; import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;
import javax.swing.ToolTipManager;
import java.awt.BorderLayout;
import java.awt.GridLayout;
import java.awt.dnd.DnDConstants; import java.awt.dnd.DnDConstants;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.MouseAdapter; import java.awt.event.MouseAdapter;
@ -89,22 +97,8 @@ public class TableDataTreePane extends BasicTableDataTreePane {
createAddMenuDef(); createAddMenuDef();
GeneralContext.listenPluginRunningChanged(new PluginEventListener(PLUGIN_LISTENER_PRIORITY) { // 创建插件监听
createPluginListener();
@Override
public void on(PluginEvent event) {
addMenuDef.clearShortCuts();
createAddMenuDef();
}
}, new PluginFilter() {
@Override
public boolean accept(PluginContext context) {
return context.contain(PluginModule.ExtraDesign);
}
});
editAction = new EditAction(); editAction = new EditAction();
removeAction = new RemoveAction(); removeAction = new RemoveAction();
@ -146,6 +140,55 @@ public class TableDataTreePane extends BasicTableDataTreePane {
checkButtonEnabled(); checkButtonEnabled();
} }
private void createPluginListener() {
//菜单栏监听
GeneralContext.listenPluginRunningChanged(new PluginEventListener(PLUGIN_LISTENER_PRIORITY) {
@Override
public void on(PluginEvent event) {
addMenuDef.clearShortCuts();
createAddMenuDef();
}
}, new PluginFilter() {
@Override
public boolean accept(PluginContext context) {
return context.contain(PluginModule.ExtraDesign);
}
});
//监听数据集插件
GeneralContext.listenPluginRunningChanged(new PluginEventListener() {
@Override
public void on(PluginEvent event) {
//REPORT-25577
//如果数据集插件禁用或启用。需要清空当前模板中的缓存
reloadCurrTemplate();
}
private void reloadCurrTemplate() {
JTemplate<?, ?> jt = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
if (accept(jt)) {
jt.refreshResource();
}
}
private boolean accept(JTemplate<?, ?> jt) {
return jt != null && jt.getEditingFILE() != null && jt.getEditingFILE().exists();
}
}, new PluginFilter() {
@Override
public boolean accept(PluginContext pluginContext) {
return pluginContext.contain(TableDataDefineProvider.XML_TAG);
}
});
}
protected void checkButtonEnabled() { protected void checkButtonEnabled() {
super.checkButtonEnabled(editAction, previewTableDataAction, removeAction, op, dataTree); super.checkButtonEnabled(editAction, previewTableDataAction, removeAction, op, dataTree);
@ -243,6 +286,7 @@ public class TableDataTreePane extends BasicTableDataTreePane {
if (selectedNO == null) { if (selectedNO == null) {
return; return;
} }
DesignTableDataManager.removeSelectedColumnNames(selectedNO.getName());
dgEdit(((AbstractTableDataWrapper) selectedNO.getObject()).creatTableDataPane(), selectedNO.getName(), false); dgEdit(((AbstractTableDataWrapper) selectedNO.getObject()).creatTableDataPane(), selectedNO.getName(), false);
} }
} }
@ -263,7 +307,7 @@ public class TableDataTreePane extends BasicTableDataTreePane {
return; return;
} }
int returnVal = JOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Utils_Are_You_Sure_To_Remove_The_Selected_Item") + ":" + selectedNO.getName() + "?", int returnVal = FineJOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Utils_Are_You_Sure_To_Remove_The_Selected_Item") + ":" + selectedNO.getName() + "?",
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Remove"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE); com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Remove"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE);
if (returnVal == JOptionPane.OK_OPTION) { if (returnVal == JOptionPane.OK_OPTION) {
// richer:这个地方为什么要在DataSourceTree里面去remove呢?多此一举吧 // richer:这个地方为什么要在DataSourceTree里面去remove呢?多此一举吧
@ -274,6 +318,7 @@ public class TableDataTreePane extends BasicTableDataTreePane {
dataTree.setSelectionRow(dataTree.getRowCount() - 1); dataTree.setSelectionRow(dataTree.getRowCount() - 1);
fireDSChanged(); fireDSChanged();
checkButtonEnabled(); checkButtonEnabled();
DesignTableDataManager.removeSelectedColumnNames(selectedNO.getName());
} }
} }
} }

5
designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListPane.java

@ -4,6 +4,7 @@ import com.fr.data.impl.Connection;
import com.fr.data.impl.JDBCDatabaseConnection; import com.fr.data.impl.JDBCDatabaseConnection;
import com.fr.data.impl.JNDIDatabaseConnection; import com.fr.data.impl.JNDIDatabaseConnection;
import com.fr.design.ExtraDesignClassManager; import com.fr.design.ExtraDesignClassManager;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.fun.ConnectionProvider; import com.fr.design.fun.ConnectionProvider;
import com.fr.design.gui.controlpane.JListControlPane; import com.fr.design.gui.controlpane.JListControlPane;
import com.fr.design.gui.controlpane.NameObjectCreator; import com.fr.design.gui.controlpane.NameObjectCreator;
@ -43,7 +44,7 @@ public class ConnectionListPane extends JListControlPane implements ConnectionSh
String tempName = getEditingName(); String tempName = getEditingName();
if (StringUtils.isEmpty(tempName)) { if (StringUtils.isEmpty(tempName)) {
nameableList.stopEditing(); nameableList.stopEditing();
JOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(ConnectionListPane.this), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Connection_Empty_Name")); FineJOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(ConnectionListPane.this), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Connection_Empty_Name"));
setIllegalIndex(editingIndex); setIllegalIndex(editingIndex);
isNamePermitted = false; isNamePermitted = false;
return; return;
@ -53,7 +54,7 @@ public class ConnectionListPane extends JListControlPane implements ConnectionSh
isNamePermitted = false; isNamePermitted = false;
nameableList.stopEditing(); nameableList.stopEditing();
String message = Toolkit.i18nText("Fine-Design_Basic_Connection_Duplicate_Name", tempName); String message = Toolkit.i18nText("Fine-Design_Basic_Connection_Duplicate_Name", tempName);
JOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(ConnectionListPane.this), message); FineJOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(ConnectionListPane.this), message);
setIllegalIndex(editingIndex); setIllegalIndex(editingIndex);
} }
if (isNamePermitted && !ComparatorUtils.equals(tempName, selectedName)) { if (isNamePermitted && !ComparatorUtils.equals(tempName, selectedName)) {

7
designer-base/src/main/java/com/fr/design/data/datapane/preview/PreviewTablePane.java

@ -14,6 +14,7 @@ import com.fr.design.DesignerEnvManager;
import com.fr.design.data.DesignTableDataManager; import com.fr.design.data.DesignTableDataManager;
import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.gui.frpane.UITabbedPane; import com.fr.design.gui.frpane.UITabbedPane;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
@ -303,7 +304,7 @@ public class PreviewTablePane extends BasicPane {
return; return;
} }
FineLoggerFactory.getLogger().error(exp.getMessage(), exp); FineLoggerFactory.getLogger().error(exp.getMessage(), exp);
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), columnErrMessage, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Error"), JOptionPane.ERROR_MESSAGE); FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), columnErrMessage, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Error"), JOptionPane.ERROR_MESSAGE);
} }
private void populate(TableData tableData) throws Exception { private void populate(TableData tableData) throws Exception {
@ -394,8 +395,8 @@ public class PreviewTablePane extends BasicPane {
} catch (Exception e) { } catch (Exception e) {
if (!(e instanceof CancellationException)) { if (!(e instanceof CancellationException)) {
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), e.getMessage(), FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), e.getMessage(),
null, 0, UIManager.getIcon("OptionPane.errorIcon")); com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Error"), JOptionPane.ERROR_MESSAGE, UIManager.getIcon("OptionPane.errorIcon"));
} }
dialog.setVisible(false); dialog.setVisible(false);
} finally { } finally {

2
designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/EmbeddedTableDataDefinedPane.java

@ -64,7 +64,7 @@ public class EmbeddedTableDataDefinedPane extends BasicPane{
// 行号显示 // 行号显示
TableColumn tableColumn = dataJTable.getColumnModel().getColumn(0); TableColumn tableColumn = dataJTable.getColumnModel().getColumn(0);
tableColumn.setCellRenderer(new CellRenderer()); tableColumn.setCellRenderer(new CellRenderer());
tableColumn.setMaxWidth(30); tableColumn.setMaxWidth(dataJTable.getColumnCount());
// 控制按钮 // 控制按钮
add = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Add")); add = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Add"));

2
designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/EmbeddedTableDataPane.java

@ -220,7 +220,7 @@ public class EmbeddedTableDataPane extends AbstractTableDataPane<EmbeddedTableDa
// 行号显示,每次dateJTable的表结构发生变化时都要调用 // 行号显示,每次dateJTable的表结构发生变化时都要调用
TableColumn tableColumn = dataJTable.getColumnModel().getColumn(0); TableColumn tableColumn = dataJTable.getColumnModel().getColumn(0);
tableColumn.setCellRenderer(new CellRenderer()); tableColumn.setCellRenderer(new CellRenderer());
tableColumn.setMaxWidth(30); tableColumn.setMaxWidth(dataJTable.getColumnCount());
} }
private class DoubleRenderer extends DefaultTableCellRenderer { private class DoubleRenderer extends DefaultTableCellRenderer {

9
designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/FileTableDataPane.java

@ -14,6 +14,7 @@ import com.fr.data.impl.XMLTableData;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.design.data.datapane.preview.PreviewTablePane; import com.fr.design.data.datapane.preview.PreviewTablePane;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ibutton.UIRadioButton; import com.fr.design.gui.ibutton.UIRadioButton;
import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icheckbox.UICheckBox;
@ -222,7 +223,7 @@ public class FileTableDataPane extends AbstractTableDataPane<FileTableData> {
public void actionPerformed(ActionEvent arg0) { public void actionPerformed(ActionEvent arg0) {
String uri = ParameterHelper.analyze4Templatee(urlText.getText(), params); String uri = ParameterHelper.analyze4Templatee(urlText.getText(), params);
if (!checkURL(uri)) { if (!checkURL(uri)) {
JOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(FileTableDataPane.this), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Add_JS_warning")); FineJOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(FileTableDataPane.this), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Add_JS_warning"));
return; return;
} }
params = getEditorPaneParameter(); params = getEditorPaneParameter();
@ -234,10 +235,10 @@ public class FileTableDataPane extends AbstractTableDataPane<FileTableData> {
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
if (in == null) { if (in == null) {
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Database_Connection_Failed"), FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Database_Connection_Failed"),
null, 0, UIManager.getIcon("OptionPane.errorIcon")); com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Error"), JOptionPane.ERROR_MESSAGE, UIManager.getIcon("OptionPane.errorIcon"));
} else { } else {
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Datasource_Connection_Successfully")); FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Datasource_Connection_Successfully"));
try { try {
in.close(); in.close();
} catch (IOException e) { } catch (IOException e) {

3
designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/ProcedureDataPane.java

@ -17,6 +17,7 @@ import com.fr.design.data.datapane.sqlpane.SQLEditPane;
import com.fr.design.data.tabledata.ResponseDataSourceChange; import com.fr.design.data.tabledata.ResponseDataSourceChange;
import com.fr.design.data.tabledata.StoreProcedureWorkerListener; import com.fr.design.data.tabledata.StoreProcedureWorkerListener;
import com.fr.design.data.tabledata.wrapper.StoreProcedureDataWrapper; import com.fr.design.data.tabledata.wrapper.StoreProcedureDataWrapper;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
@ -243,7 +244,7 @@ public class ProcedureDataPane extends AbstractTableDataPane<StoreProcedure> imp
try { try {
throw new Exception(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Connect_SQL_Cannot_Null") + "."); throw new Exception(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Connect_SQL_Cannot_Null") + ".");
} catch (Exception e) { } catch (Exception e) {
JOptionPane.showMessageDialog(ProcedureDataPane.this, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Connect_SQL_Cannot_Null") + "."); FineJOptionPane.showMessageDialog(ProcedureDataPane.this, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Connect_SQL_Cannot_Null") + ".");
} }
} }

1
designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/AbstractTableDataWrapper.java

@ -65,6 +65,7 @@ public abstract class AbstractTableDataWrapper implements TableDataWrapper {
} }
} }
columnNameList = DesignTableDataManager.getColumnNamesByTableData(embeddedTableData); columnNameList = DesignTableDataManager.getColumnNamesByTableData(embeddedTableData);
DesignTableDataManager.addDsColumnNames(name, columnNameList.toArray(new String[0]));
return columnNameList; return columnNameList;
} }

5
designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/StoreProcedureDataWrapper.java

@ -9,6 +9,7 @@ import com.fr.design.data.DesignTableDataManager;
import com.fr.design.data.datapane.preview.PreviewTablePane; import com.fr.design.data.datapane.preview.PreviewTablePane;
import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.gui.iprogressbar.AutoProgressBar; import com.fr.design.gui.iprogressbar.AutoProgressBar;
import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode; import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
@ -102,7 +103,7 @@ public final class StoreProcedureDataWrapper implements TableDataWrapper {
return columnNameList; return columnNameList;
} }
if (!createStore(false)) { if (!createStore(false)) {
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Engine_No_TableData")); FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Engine_No_TableData"));
return new ArrayList<String>(); return new ArrayList<String>();
} }
columnNameList = Arrays.asList(procedureDataModel.getColumnName()); columnNameList = Arrays.asList(procedureDataModel.getColumnName());
@ -219,7 +220,7 @@ public final class StoreProcedureDataWrapper implements TableDataWrapper {
} catch (Exception e) { } catch (Exception e) {
if (!(e instanceof CancellationException)) { if (!(e instanceof CancellationException)) {
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), e.getMessage()); FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), e.getMessage());
} }
loadingBar.close(); loadingBar.close();
} }

7
designer-base/src/main/java/com/fr/design/designer/creator/CRPropertyDescriptor.java

@ -4,6 +4,7 @@
package com.fr.design.designer.creator; package com.fr.design.designer.creator;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.stable.core.PropertyChangeAdapter;
import com.fr.stable.core.PropertyChangeListener; import com.fr.stable.core.PropertyChangeListener;
import java.beans.IntrospectionException; import java.beans.IntrospectionException;
@ -40,6 +41,12 @@ public final class CRPropertyDescriptor extends PropertyDescriptor {
return this; return this;
} }
@Deprecated
public CRPropertyDescriptor setPropertyChangeListener(PropertyChangeAdapter l) {
this.l = l;
return this;
}
public void firePropertyChanged() { public void firePropertyChanged() {
if (l != null) { if (l != null) {
l.propertyChange(); l.propertyChange();

290
designer-base/src/main/java/com/fr/design/dialog/FineJOptionPane.java

@ -0,0 +1,290 @@
package com.fr.design.dialog;
import com.fr.invoke.Reflect;
import javax.swing.Icon;
import javax.swing.JDialog;
import javax.swing.JOptionPane;
import java.awt.Component;
import java.awt.HeadlessException;
import java.util.HashMap;
import java.util.Map;
/**
* @author Joe
* @version 10.0
* Created by Joe on 12/5/2019
*/
public class FineJOptionPane extends JOptionPane {
public final static String[] OPTION_DEFAULT = { com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Button_OK") };
public final static String[] OPTION_YES_NO = { com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Yes"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_No") };
public final static String[] OPTION_YES_NO_CANCEL = { com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Yes"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_No"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Button_Cancel") };
public final static String[] OPTION_OK_CANCEL = { com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Button_OK"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Button_Cancel") };
//选项类型optionType 和 选项字符串数组 一一对应
private final static Map<Integer, String[]> OPTION_MAP = new HashMap<>();
static {
OPTION_MAP.put(DEFAULT_OPTION, OPTION_DEFAULT);
OPTION_MAP.put(YES_NO_OPTION, OPTION_YES_NO);
OPTION_MAP.put(YES_NO_CANCEL_OPTION, OPTION_YES_NO_CANCEL);
OPTION_MAP.put(OK_CANCEL_OPTION, OPTION_OK_CANCEL);
}
private final static String MESSAGE_DIALOG_TITLE = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Message");
private final static String CONFIRM_DIALOG_TITLE = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Confirm");
private final static String INPUT_DIALOG_TITLE = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tool_Tips");
/**
* 使用默认 标题 消息类型 的消息提示弹出框
* @param parentComponent 父容器
* @param message 具体的提示消息
* @throws HeadlessException
*/
public static void showMessageDialog(Component parentComponent, Object message)
throws HeadlessException {
showMessageDialog(parentComponent, message, MESSAGE_DIALOG_TITLE,
INFORMATION_MESSAGE);
}
/**
* 使用默认 Icon 的消息提示弹出框
* @param parentComponent 父容器
* @param message 具体的提示消息
* @param title 标题
* @param messageType 消息类型
* @throws HeadlessException
*/
public static void showMessageDialog(Component parentComponent, Object message,
String title, int messageType)
throws HeadlessException {
showMessageDialog(parentComponent, message, title, messageType, null);
}
/**
* 使用默认 选项类型选项 初始选项 的消息提示弹出框
* @param parentComponent 父容器
* @param message 具体的提示消息
* @param title 标题
* @param messageType 消息类型
* @param icon 图标
* @throws HeadlessException
*/
public static void showMessageDialog(Component parentComponent, Object message,
String title, int messageType, Icon icon)
throws HeadlessException {
showMessageDialog(parentComponent, message, title, DEFAULT_OPTION,
messageType, icon, OPTION_DEFAULT, null);
}
/**
* 自定义的消息提示弹出框
* @param parentComponent 父容器
* @param message 具体的提示消息
* @param title 标题
* @param optionType 选项类型
* @param messageType 消息类型
* @param icon 图标
* @param options 选项
* @param initialValue 初始选项
* @throws HeadlessException
*/
public static void showMessageDialog(Component parentComponent, Object message,
String title, int optionType, int messageType,
Icon icon, Object[] options, Object initialValue)
throws HeadlessException {
showOptionDialog(parentComponent, message, title, optionType,
messageType, icon, options, initialValue);
}
/**
* 使用默认 标题 选项类型 的确认弹出框
* @param parentComponent 父容器
* @param message 具体的提示消息
* @throws HeadlessException
*/
public static int showConfirmDialog(Component parentComponent, Object message)
throws HeadlessException {
return showConfirmDialog(parentComponent, message,
CONFIRM_DIALOG_TITLE,
YES_NO_CANCEL_OPTION);
}
/**
* 使用默认 消息类型 的确认弹出框
* @param parentComponent 父容器
* @param message 具体的提示消息
* @param title 标题
* @param optionType 选项类型
* @throws HeadlessException
*/
public static int showConfirmDialog(Component parentComponent, Object message,
String title, int optionType) throws HeadlessException {
return showConfirmDialog(parentComponent, message, title, optionType,
QUESTION_MESSAGE);
}
/**
* 使用默认 Icon 的确认弹出框
* @param parentComponent 父容器
* @param message 具体的提示消息
* @param title 标题
* @param optionType 选项类型
* @param messageType 消息类型
* @throws HeadlessException
*/
public static int showConfirmDialog(Component parentComponent, Object message,
String title, int optionType, int messageType)
throws HeadlessException {
return showConfirmDialog(parentComponent, message, title, optionType,
messageType, null);
}
/**
* 根据 选项类型 获取对应 选项 且使用默认 初始选项 的确认弹出框
* @param parentComponent 父容器
* @param message 具体的提示消息
* @param title 标题
* @param optionType 选项类型
* @param messageType 消息类型
* @param icon 图标
* @throws HeadlessException
*/
public static int showConfirmDialog(Component parentComponent, Object message,
String title, int optionType, int messageType, Icon icon)
throws HeadlessException {
String[] options = OPTION_MAP.get(optionType);
return showConfirmDialog(parentComponent, message, title, optionType,
messageType, icon, options, options[0]);
}
/**
* 自定义的确认弹出框
* @param parentComponent 父容器
* @param message 具体的提示消息
* @param title 标题
* @param optionType 选项类型
* @param messageType 消息类型
* @param icon 图标
* @param options 选项
* @param initialValue 初始选项
* @throws HeadlessException
*/
public static int showConfirmDialog(Component parentComponent, Object message,
String title, int optionType, int messageType, Icon icon,
Object[] options, Object initialValue)
throws HeadlessException {
return showOptionDialog(parentComponent, message, title, optionType,
messageType, icon, options, initialValue);
}
/**
* 指定消息内容的输入弹出框
* @param message 消息内容
* @return
* @throws HeadlessException
*/
public static String showInputDialog(Object message)
throws HeadlessException {
return showInputDialog(null, message);
}
/**
* 使用默认 标题 消息类型 的输入弹出框
* @param parentComponent 父容器
* @param message 消息内容
* @return
* @throws HeadlessException
*/
public static String showInputDialog(Component parentComponent,
Object message) throws HeadlessException {
return showInputDialog(parentComponent, message, INPUT_DIALOG_TITLE, QUESTION_MESSAGE);
}
/**
* 使用默认 标题消息类型Icon 选项 的输入弹出框
* @param parentComponent 父容器
* @param message 消息类型
* @param initialSelectionValue 初始选项
* @return
*/
public static String showInputDialog(Component parentComponent, Object message,
Object initialSelectionValue) {
return (String)showInputDialog(parentComponent, message,
INPUT_DIALOG_TITLE, QUESTION_MESSAGE, null, null,
initialSelectionValue);
}
/**
* 使用默认 父容器消息内容 初始选项 的输入弹出框
* @param message 消息内容
* @param initialSelectionValue 初始选项
* @return
*/
public static String showInputDialog(Object message, Object initialSelectionValue) {
return showInputDialog(null, message, initialSelectionValue);
}
/**
* 使用默认 Icon选项 初始选项 的输入弹出框
* @param parentComponent 父容器
* @param message 消息内容
* @param title 标题
* @param messageType 消息类型
* @return
* @throws HeadlessException
*/
public static String showInputDialog(Component parentComponent,
Object message, String title, int messageType)
throws HeadlessException {
return (String)showInputDialog(parentComponent, message, title,
messageType, null, null, null);
}
/**
* 自定义的输入弹出框
* @param parentComponent 父容器
* @param message 消息内容
* @param title 标题
* @param messageType 消息类型
* @param icon 图标
* @param selectionValues 选项
* @param initialSelectionValue 初始选项
* @return
* @throws HeadlessException
*/
public static Object showInputDialog(Component parentComponent,
Object message, String title, int messageType, Icon icon,
Object[] selectionValues, Object initialSelectionValue)
throws HeadlessException {
JOptionPane pane = new JOptionPane(message, messageType,
OK_CANCEL_OPTION, icon,
OPTION_OK_CANCEL, null);
pane.setWantsInput(true);
pane.setSelectionValues(selectionValues);
pane.setInitialSelectionValue(initialSelectionValue);
pane.setComponentOrientation(((parentComponent == null) ?
getRootFrame() : parentComponent).getComponentOrientation());
int style = Reflect.on(JOptionPane.class).call("styleFromMessageType", messageType).get();
JDialog dialog = Reflect.on(pane).call("createDialog", parentComponent, title, style).get();
pane.selectInitialValue();
dialog.show();
dialog.dispose();
Object value = pane.getInputValue();
if (value == UNINITIALIZED_VALUE) {
return null;
}
return value;
}
}

2
designer-base/src/main/java/com/fr/design/dialog/UIDialog.java

@ -167,7 +167,7 @@ public abstract class UIDialog extends JDialog {
try { try {
checkValid(); checkValid();
} catch (Exception exp) { } catch (Exception exp) {
JOptionPane.showMessageDialog(this, exp.getMessage()); FineJOptionPane.showMessageDialog(this, exp.getMessage());
return; return;
} }

5
designer-base/src/main/java/com/fr/design/editor/DoubleDeckValueEditorPane.java

@ -3,6 +3,7 @@ package com.fr.design.editor;
import com.fr.base.BaseFormula; import com.fr.base.BaseFormula;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.editor.editor.ColumnIndexEditor; import com.fr.design.editor.editor.ColumnIndexEditor;
import com.fr.design.editor.editor.ColumnNameEditor; import com.fr.design.editor.editor.ColumnNameEditor;
import com.fr.design.editor.editor.Editor; import com.fr.design.editor.editor.Editor;
@ -302,8 +303,8 @@ public class DoubleDeckValueEditorPane extends BasicPane implements UIObserver,
DesignerEnvManager designerEnvManager = DesignerEnvManager.getEnvManager(); DesignerEnvManager designerEnvManager = DesignerEnvManager.getEnvManager();
if (designerEnvManager.isSupportStringToFormula()) { if (designerEnvManager.isSupportStringToFormula()) {
if (!designerEnvManager.isDefaultStringToFormula()) { if (!designerEnvManager.isDefaultStringToFormula()) {
int returnValue = JOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Edit_String_To_Formula") int returnValue = FineJOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Edit_String_To_Formula")
+ "?", com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"), JOptionPane.YES_NO_OPTION); + "?", com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Confirm"), JOptionPane.YES_NO_OPTION);
if (returnValue == JOptionPane.OK_OPTION) { if (returnValue == JOptionPane.OK_OPTION) {
setCurrentEditor(j); setCurrentEditor(j);

5
designer-base/src/main/java/com/fr/design/editor/ValueEditorPane.java

@ -3,6 +3,7 @@ package com.fr.design.editor;
import com.fr.base.BaseFormula; import com.fr.base.BaseFormula;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.editor.editor.ColumnNameEditor; import com.fr.design.editor.editor.ColumnNameEditor;
import com.fr.design.editor.editor.Editor; import com.fr.design.editor.editor.Editor;
import com.fr.design.editor.editor.FormulaEditor; import com.fr.design.editor.editor.FormulaEditor;
@ -283,8 +284,8 @@ public class ValueEditorPane extends BasicPane implements UIObserver, GlobalName
DesignerEnvManager designerEnvManager = DesignerEnvManager.getEnvManager(); DesignerEnvManager designerEnvManager = DesignerEnvManager.getEnvManager();
if (designerEnvManager.isSupportStringToFormula()) { if (designerEnvManager.isSupportStringToFormula()) {
if (!designerEnvManager.isDefaultStringToFormula()) { if (!designerEnvManager.isDefaultStringToFormula()) {
int returnValue = JOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Edit_String_To_Formula") int returnValue = FineJOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Edit_String_To_Formula")
+ "?", com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"), JOptionPane.YES_NO_OPTION); + "?", com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Confirm"), JOptionPane.YES_NO_OPTION);
if (returnValue == JOptionPane.OK_OPTION) { if (returnValue == JOptionPane.OK_OPTION) {
setCurrentEditor(j); setCurrentEditor(j);

12
designer-base/src/main/java/com/fr/design/env/RemoteDesignerWorkspaceInfo.java vendored

@ -1,10 +1,12 @@
package com.fr.design.env; package com.fr.design.env;
import com.fr.log.FineLoggerFactory;
import com.fr.security.SecurityToolbox; import com.fr.security.SecurityToolbox;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.stable.xml.XMLPrintWriter; import com.fr.stable.xml.XMLPrintWriter;
import com.fr.stable.xml.XMLableReader; import com.fr.stable.xml.XMLableReader;
import com.fr.workspace.WorkContext;
import com.fr.workspace.connect.WorkspaceConnectionInfo; import com.fr.workspace.connect.WorkspaceConnectionInfo;
public class RemoteDesignerWorkspaceInfo implements DesignerWorkspaceInfo { public class RemoteDesignerWorkspaceInfo implements DesignerWorkspaceInfo {
@ -91,7 +93,13 @@ public class RemoteDesignerWorkspaceInfo implements DesignerWorkspaceInfo {
@Override @Override
public boolean checkValid() { public boolean checkValid() {
boolean result = false;
return true; try {
result = WorkContext.getConnector().testConnection(connection);
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
return result;
}
return result;
} }
} }

6
designer-base/src/main/java/com/fr/design/env/RemoteWorkspace.java vendored

@ -1,5 +1,6 @@
package com.fr.design.env; package com.fr.design.env;
import com.fr.cluster.engine.base.FineClusterConfig;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.rpc.ExceptionHandler; import com.fr.rpc.ExceptionHandler;
import com.fr.stable.AssistUtils; import com.fr.stable.AssistUtils;
@ -70,6 +71,11 @@ public class RemoteWorkspace implements Workspace {
return isRoot; return isRoot;
} }
@Override
public boolean isCluster() {
return FineClusterConfig.getInstance().isCluster();
}
@Override @Override
public WorkspaceConnection getConnection() { public WorkspaceConnection getConnection() {

3
designer-base/src/main/java/com/fr/design/extra/LoginWebPane.java

@ -1,5 +1,6 @@
package com.fr.design.extra; package com.fr.design.extra;
import com.fr.design.dialog.FineJOptionPane;
import javafx.application.Platform; import javafx.application.Platform;
import javafx.embed.swing.JFXPanel; import javafx.embed.swing.JFXPanel;
import javafx.event.EventHandler; import javafx.event.EventHandler;
@ -46,7 +47,7 @@ public class LoginWebPane extends JFXPanel {
SwingUtilities.invokeLater(new Runnable() { SwingUtilities.invokeLater(new Runnable() {
@Override @Override
public void run() { public void run() {
JOptionPane.showMessageDialog(LoginWebPane.this, message); FineJOptionPane.showMessageDialog(LoginWebPane.this, message);
} }
}); });
} }

7
designer-base/src/main/java/com/fr/design/extra/PluginFromStorePane.java

@ -1,6 +1,7 @@
package com.fr.design.extra; package com.fr.design.extra;
import com.fr.config.MarketConfig; import com.fr.config.MarketConfig;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.extra.tradition.callback.UpdateOnlineCallback; import com.fr.design.extra.tradition.callback.UpdateOnlineCallback;
import com.fr.design.gui.frpane.UITabbedPane; import com.fr.design.gui.frpane.UITabbedPane;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
@ -177,14 +178,14 @@ public class PluginFromStorePane extends PluginAbstractLoadingViewPane<List<Plug
public void done(PluginTaskResult result) { public void done(PluginTaskResult result) {
if (result.isSuccess()) { if (result.isSuccess()) {
FineLoggerFactory.getLogger().info(com.fr.design.i18n.Toolkit.i18nText("FR-Designer-Plugin_Install_Success")); FineLoggerFactory.getLogger().info(com.fr.design.i18n.Toolkit.i18nText("FR-Designer-Plugin_Install_Success"));
JOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Install_Successful")); FineJOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Install_Successful"));
} else { } else {
JOptionPane.showMessageDialog(null, PluginUtils.getMessageByErrorCode(result.errorCode()), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), JOptionPane.ERROR_MESSAGE); FineJOptionPane.showMessageDialog(null, PluginUtils.getMessageByErrorCode(result.errorCode()), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), JOptionPane.ERROR_MESSAGE);
} }
} }
}); });
} catch (Exception e1) { } catch (Exception e1) {
JOptionPane.showMessageDialog(PluginFromStorePane.this, e1.getMessage(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), JOptionPane.ERROR_MESSAGE); FineJOptionPane.showMessageDialog(PluginFromStorePane.this, e1.getMessage(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), JOptionPane.ERROR_MESSAGE);
} }
} }

11
designer-base/src/main/java/com/fr/design/extra/PluginInstalledPane.java

@ -1,6 +1,7 @@
package com.fr.design.extra; package com.fr.design.extra;
import com.fr.design.RestartHelper; import com.fr.design.RestartHelper;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.plugin.context.PluginContext; import com.fr.plugin.context.PluginContext;
@ -67,9 +68,9 @@ public class PluginInstalledPane extends PluginAbstractViewPane {
@Override @Override
public void done(PluginTaskResult result) { public void done(PluginTaskResult result) {
if (result.isSuccess()) { if (result.isSuccess()) {
JOptionPane.showMessageDialog(null, modifyMessage); FineJOptionPane.showMessageDialog(null, modifyMessage);
} else { } else {
JOptionPane.showMessageDialog(null, PluginUtils.getMessageByErrorCode(result.errorCode()), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), JOptionPane.ERROR_MESSAGE); FineJOptionPane.showMessageDialog(null, PluginUtils.getMessageByErrorCode(result.errorCode()), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), JOptionPane.ERROR_MESSAGE);
} }
} }
}); });
@ -78,9 +79,9 @@ public class PluginInstalledPane extends PluginAbstractViewPane {
@Override @Override
public void done(PluginTaskResult result) { public void done(PluginTaskResult result) {
if (result.isSuccess()) { if (result.isSuccess()) {
JOptionPane.showMessageDialog(null, modifyMessage); FineJOptionPane.showMessageDialog(null, modifyMessage);
} else { } else {
JOptionPane.showMessageDialog(null,PluginUtils.getMessageByErrorCode(result.errorCode()), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), JOptionPane.ERROR_MESSAGE); FineJOptionPane.showMessageDialog(null,PluginUtils.getMessageByErrorCode(result.errorCode()), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), JOptionPane.ERROR_MESSAGE);
} }
} }
}); });
@ -135,7 +136,7 @@ public class PluginInstalledPane extends PluginAbstractViewPane {
try { try {
controlPane.deletePlugin(plugin); controlPane.deletePlugin(plugin);
} catch (Exception e) { } catch (Exception e) {
JOptionPane.showMessageDialog(PluginInstalledPane.this, e.getMessage(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), JOptionPane.ERROR_MESSAGE); FineJOptionPane.showMessageDialog(PluginInstalledPane.this, e.getMessage(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), JOptionPane.ERROR_MESSAGE);
} }
if (rv == JOptionPane.OK_OPTION) { if (rv == JOptionPane.OK_OPTION) {

3
designer-base/src/main/java/com/fr/design/extra/PluginOperateUtils.java

@ -1,6 +1,7 @@
package com.fr.design.extra; package com.fr.design.extra;
import com.fr.config.MarketConfig; import com.fr.config.MarketConfig;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.extra.exe.callback.InstallFromDiskCallback; import com.fr.design.extra.exe.callback.InstallFromDiskCallback;
import com.fr.design.extra.exe.callback.InstallOnlineCallback; import com.fr.design.extra.exe.callback.InstallOnlineCallback;
import com.fr.design.bridge.exec.JSCallback; import com.fr.design.bridge.exec.JSCallback;
@ -91,7 +92,7 @@ public class PluginOperateUtils {
@Override @Override
public void run() { public void run() {
int rv = JOptionPane.showConfirmDialog( int rv = FineJOptionPane.showConfirmDialog(
null, null,
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Delete_Confirmed"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Delete_Confirmed"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"),

5
designer-base/src/main/java/com/fr/design/extra/PluginUpdatePane.java

@ -1,6 +1,7 @@
package com.fr.design.extra; package com.fr.design.extra;
import com.fr.config.MarketConfig; import com.fr.config.MarketConfig;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.extra.tradition.callback.UpdateOnlineCallback; import com.fr.design.extra.tradition.callback.UpdateOnlineCallback;
import com.fr.design.gui.frpane.UITabbedPane; import com.fr.design.gui.frpane.UITabbedPane;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
@ -198,9 +199,9 @@ public class PluginUpdatePane extends PluginAbstractLoadingViewPane<List<PluginV
public void done(PluginTaskResult result) { public void done(PluginTaskResult result) {
if (result.isSuccess()) { if (result.isSuccess()) {
FineLoggerFactory.getLogger().info(com.fr.design.i18n.Toolkit.i18nText("FR-Designer-Plugin_Update_Success")); FineLoggerFactory.getLogger().info(com.fr.design.i18n.Toolkit.i18nText("FR-Designer-Plugin_Update_Success"));
JOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Install_Successful")); FineJOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Install_Successful"));
} else { } else {
JOptionPane.showMessageDialog(null, PluginUtils.getMessageByErrorCode(result.errorCode()), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), JOptionPane.ERROR_MESSAGE); FineJOptionPane.showMessageDialog(null, PluginUtils.getMessageByErrorCode(result.errorCode()), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), JOptionPane.ERROR_MESSAGE);
} }
} }
}); });

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

@ -1,6 +1,7 @@
package com.fr.design.extra; package com.fr.design.extra;
import com.fr.base.TemplateUtils; import com.fr.base.TemplateUtils;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.general.CloudCenter; import com.fr.general.CloudCenter;
import com.fr.general.http.HttpClient; import com.fr.general.http.HttpClient;
import com.fr.json.JSONArray; import com.fr.json.JSONArray;
@ -12,6 +13,7 @@ import com.fr.plugin.basic.version.VersionIntervalFactory;
import com.fr.plugin.context.PluginContext; import com.fr.plugin.context.PluginContext;
import com.fr.plugin.context.PluginMarker; import com.fr.plugin.context.PluginMarker;
import com.fr.plugin.error.PluginErrorCode; import com.fr.plugin.error.PluginErrorCode;
import com.fr.plugin.error.PluginBaseErrorCode;
import com.fr.plugin.manage.PluginManager; import com.fr.plugin.manage.PluginManager;
import com.fr.plugin.view.PluginView; import com.fr.plugin.view.PluginView;
import com.fr.stable.EncodeConstants; import com.fr.stable.EncodeConstants;
@ -109,7 +111,7 @@ public class PluginUtils {
throw new com.fr.plugin.PluginVerifyException(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Connect_Server_Error")); throw new com.fr.plugin.PluginVerifyException(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Connect_Server_Error"));
} }
} catch (PluginVerifyException e) { } catch (PluginVerifyException e) {
JOptionPane.showMessageDialog(null, e.getMessage(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), JOptionPane.ERROR_MESSAGE); FineJOptionPane.showMessageDialog(null, e.getMessage(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), JOptionPane.ERROR_MESSAGE);
return false; return false;
} catch (Exception e) { } catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
@ -193,7 +195,7 @@ public class PluginUtils {
} }
} }
public static String getMessageByErrorCode(PluginErrorCode errorCode) { public static String getMessageByErrorCode(PluginBaseErrorCode errorCode) {
if(errorCode == PluginErrorCode.None){ if(errorCode == PluginErrorCode.None){
return ""; return "";
} }
@ -201,7 +203,7 @@ public class PluginUtils {
return com.fr.design.i18n.Toolkit.i18nCompatibleServerText(getInterKeyByErrorCode(errorCode)); return com.fr.design.i18n.Toolkit.i18nCompatibleServerText(getInterKeyByErrorCode(errorCode));
} }
private static String getInterKeyByErrorCode(PluginErrorCode errorCode) { private static String getInterKeyByErrorCode(PluginBaseErrorCode errorCode) {
return errorCode.getDescription(); return errorCode.getDescription();
} }

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

@ -1,6 +1,7 @@
package com.fr.design.extra; package com.fr.design.extra;
import com.fr.base.TemplateUtils; import com.fr.base.TemplateUtils;
import com.fr.design.dialog.FineJOptionPane;
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;
@ -104,7 +105,7 @@ public class PluginWebPane extends JFXPanel {
SwingUtilities.invokeLater(new Runnable() { SwingUtilities.invokeLater(new Runnable() {
@Override @Override
public void run() { public void run() {
JOptionPane.showMessageDialog(PluginWebPane.this, message); FineJOptionPane.showMessageDialog(PluginWebPane.this, message);
} }
}); });
} }

3
designer-base/src/main/java/com/fr/design/extra/QQLoginWebPane.java

@ -1,5 +1,6 @@
package com.fr.design.extra; package com.fr.design.extra;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.general.CloudCenter; import com.fr.general.CloudCenter;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
@ -138,7 +139,7 @@ public class QQLoginWebPane extends JFXPanel {
SwingUtilities.invokeLater(new Runnable() { SwingUtilities.invokeLater(new Runnable() {
@Override @Override
public void run() { public void run() {
JOptionPane.showMessageDialog(QQLoginWebPane.this, message); FineJOptionPane.showMessageDialog(QQLoginWebPane.this, message);
} }
}); });
} }

11
designer-base/src/main/java/com/fr/design/extra/WebViewDlgHelper.java

@ -2,6 +2,7 @@ package com.fr.design.extra;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.dialog.UIDialog; import com.fr.design.dialog.UIDialog;
import com.fr.design.gui.frpane.UITabbedPane; import com.fr.design.gui.frpane.UITabbedPane;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
@ -62,7 +63,7 @@ public class WebViewDlgHelper {
String mainJsPath = StableUtils.pathJoin(installHome, MAIN_JS_PATH); String mainJsPath = StableUtils.pathJoin(installHome, MAIN_JS_PATH);
File file = new File(mainJsPath); File file = new File(mainJsPath);
if (!file.exists()) { if (!file.exists()) {
int rv = JOptionPane.showConfirmDialog( int rv = FineJOptionPane.showConfirmDialog(
null, null,
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Shop_Need_Install"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Shop_Need_Install"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"),
@ -79,7 +80,7 @@ public class WebViewDlgHelper {
updateShopScripts(SHOP_SCRIPTS); updateShopScripts(SHOP_SCRIPTS);
showPluginDlg(); showPluginDlg();
} else { } else {
int rv = JOptionPane.showConfirmDialog( int rv = FineJOptionPane.showConfirmDialog(
null, null,
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Shop_Need_Install_Version"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Shop_Need_Install_Version"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"),
@ -199,7 +200,7 @@ public class WebViewDlgHelper {
private static void confirmDownLoadShopJS() { private static void confirmDownLoadShopJS() {
int rv = JOptionPane.showConfirmDialog( int rv = FineJOptionPane.showConfirmDialog(
null, null,
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Shop_Need_Install"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Shop_Need_Install"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"),
@ -277,7 +278,7 @@ public class WebViewDlgHelper {
CommonUtils.deleteFile(scriptZip); CommonUtils.deleteFile(scriptZip);
} }
PluginStoreConstants.refreshProps(); // 下载完刷新一下版本号等 PluginStoreConstants.refreshProps(); // 下载完刷新一下版本号等
JOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Shop_Installed"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"), JOptionPane.INFORMATION_MESSAGE); FineJOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Shop_Installed"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"), JOptionPane.INFORMATION_MESSAGE);
} }
} catch (InterruptedException e) { } catch (InterruptedException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
@ -300,7 +301,7 @@ public class WebViewDlgHelper {
JSONObject resultJSONObject = new JSONObject(text); JSONObject resultJSONObject = new JSONObject(text);
String isLatest = resultJSONObject.optString("result"); String isLatest = resultJSONObject.optString("result");
if (!ComparatorUtils.equals(isLatest, LATEST)) { if (!ComparatorUtils.equals(isLatest, LATEST)) {
int rv = JOptionPane.showConfirmDialog( int rv = FineJOptionPane.showConfirmDialog(
null, null,
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Shop_Need_Update"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Shop_Need_Update"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"),

9
designer-base/src/main/java/com/fr/design/extra/exe/callback/InstallFromDiskCallback.java

@ -1,6 +1,7 @@
package com.fr.design.extra.exe.callback; package com.fr.design.extra.exe.callback;
import com.fr.design.bridge.exec.JSCallback; import com.fr.design.bridge.exec.JSCallback;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.extra.PluginOperateUtils; import com.fr.design.extra.PluginOperateUtils;
import com.fr.design.extra.PluginUtils; import com.fr.design.extra.PluginUtils;
@ -41,7 +42,7 @@ public class InstallFromDiskCallback extends AbstractPluginTaskCallback {
String switchedInfo = PluginOperateUtils.getSwitchedInfo(result); String switchedInfo = PluginOperateUtils.getSwitchedInfo(result);
jsCallback.execute("success"); jsCallback.execute("success");
FineLoggerFactory.getLogger().info(pluginInfo + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Install_Success") + switchedInfo); FineLoggerFactory.getLogger().info(pluginInfo + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Install_Success") + switchedInfo);
JOptionPane.showMessageDialog(null, pluginInfo + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Install_Success") + switchedInfo); FineJOptionPane.showMessageDialog(null, pluginInfo + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Install_Success") + switchedInfo);
} else if (result.errorCode() == PluginErrorCode.NeedDealWithPluginDependency) { } else if (result.errorCode() == PluginErrorCode.NeedDealWithPluginDependency) {
int rv = JOptionPane.showOptionDialog( int rv = JOptionPane.showOptionDialog(
null, null,
@ -50,7 +51,7 @@ public class InstallFromDiskCallback extends AbstractPluginTaskCallback {
JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.YES_NO_CANCEL_OPTION,
JOptionPane.INFORMATION_MESSAGE, JOptionPane.INFORMATION_MESSAGE,
null, null,
null, FineJOptionPane.OPTION_YES_NO_CANCEL,
null null
); );
if (rv == JOptionPane.NO_OPTION || rv == JOptionPane.CANCEL_OPTION || rv == JOptionPane.CLOSED_OPTION) { if (rv == JOptionPane.NO_OPTION || rv == JOptionPane.CANCEL_OPTION || rv == JOptionPane.CLOSED_OPTION) {
@ -70,7 +71,7 @@ public class InstallFromDiskCallback extends AbstractPluginTaskCallback {
JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.YES_NO_CANCEL_OPTION,
JOptionPane.INFORMATION_MESSAGE, JOptionPane.INFORMATION_MESSAGE,
null, null,
null, FineJOptionPane.OPTION_YES_NO_CANCEL,
null null
); );
if (rv == JOptionPane.NO_OPTION || rv == JOptionPane.CANCEL_OPTION || rv == JOptionPane.CLOSED_OPTION) { if (rv == JOptionPane.NO_OPTION || rv == JOptionPane.CANCEL_OPTION || rv == JOptionPane.CLOSED_OPTION) {
@ -80,7 +81,7 @@ public class InstallFromDiskCallback extends AbstractPluginTaskCallback {
}else { }else {
jsCallback.execute("failed"); jsCallback.execute("failed");
FineLoggerFactory.getLogger().info(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Install_Failed")); FineLoggerFactory.getLogger().info(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Install_Failed"));
JOptionPane.showMessageDialog(null, PluginUtils.getMessageByErrorCode(result.errorCode()), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Install_Failed"), JOptionPane.ERROR_MESSAGE); FineJOptionPane.showMessageDialog(null, PluginUtils.getMessageByErrorCode(result.errorCode()), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Install_Failed"), JOptionPane.ERROR_MESSAGE);
} }
} }
} }

7
designer-base/src/main/java/com/fr/design/extra/exe/callback/InstallOnlineCallback.java

@ -1,6 +1,7 @@
package com.fr.design.extra.exe.callback; package com.fr.design.extra.exe.callback;
import com.fr.design.bridge.exec.JSCallback; import com.fr.design.bridge.exec.JSCallback;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.extra.PluginOperateUtils; import com.fr.design.extra.PluginOperateUtils;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
@ -38,7 +39,7 @@ public class InstallOnlineCallback extends AbstractDealPreTaskCallback {
String switchedInfo = PluginOperateUtils.getSwitchedInfo(result); String switchedInfo = PluginOperateUtils.getSwitchedInfo(result);
jsCallback.execute("success"); jsCallback.execute("success");
FineLoggerFactory.getLogger().info(pluginInfo + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Install_Success") + switchedInfo); FineLoggerFactory.getLogger().info(pluginInfo + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Install_Success") + switchedInfo);
JOptionPane.showMessageDialog(null, pluginInfo + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Install_Success") + switchedInfo); FineJOptionPane.showMessageDialog(null, pluginInfo + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Install_Success") + switchedInfo);
} else if(result.errorCode() == PluginErrorCode.HasLowerPluginWhenInstall){ } else if(result.errorCode() == PluginErrorCode.HasLowerPluginWhenInstall){
int rv = JOptionPane.showOptionDialog( int rv = JOptionPane.showOptionDialog(
null, null,
@ -47,7 +48,7 @@ public class InstallOnlineCallback extends AbstractDealPreTaskCallback {
JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.YES_NO_CANCEL_OPTION,
JOptionPane.INFORMATION_MESSAGE, JOptionPane.INFORMATION_MESSAGE,
null, null,
null, FineJOptionPane.OPTION_YES_NO_CANCEL,
null null
); );
if (rv == JOptionPane.CANCEL_OPTION || rv == JOptionPane.CLOSED_OPTION) { if (rv == JOptionPane.CANCEL_OPTION || rv == JOptionPane.CLOSED_OPTION) {
@ -58,7 +59,7 @@ public class InstallOnlineCallback extends AbstractDealPreTaskCallback {
}else { }else {
jsCallback.execute("failed"); jsCallback.execute("failed");
FineLoggerFactory.getLogger().info(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Install_Failed")); FineLoggerFactory.getLogger().info(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Install_Failed"));
JOptionPane.showMessageDialog(null, pluginInfo, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), JOptionPane.ERROR_MESSAGE); FineJOptionPane.showMessageDialog(null, pluginInfo, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), JOptionPane.ERROR_MESSAGE);
} }
} }

5
designer-base/src/main/java/com/fr/design/extra/exe/callback/ModifyStatusCallback.java

@ -1,6 +1,7 @@
package com.fr.design.extra.exe.callback; package com.fr.design.extra.exe.callback;
import com.fr.design.bridge.exec.JSCallback; import com.fr.design.bridge.exec.JSCallback;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.extra.PluginUtils; import com.fr.design.extra.PluginUtils;
import com.fr.plugin.manage.control.PluginTaskCallback; import com.fr.plugin.manage.control.PluginTaskCallback;
@ -24,9 +25,9 @@ public class ModifyStatusCallback implements PluginTaskCallback{
if (result.isSuccess()) { if (result.isSuccess()) {
jsCallback.execute("success"); jsCallback.execute("success");
String modifyMessage = isActive ? com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Has_Been_Disabled_Duplicate") : com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Plugin_Has_Been_Actived_Duplicate"); String modifyMessage = isActive ? com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Has_Been_Disabled_Duplicate") : com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Plugin_Has_Been_Actived_Duplicate");
JOptionPane.showMessageDialog(null, modifyMessage); FineJOptionPane.showMessageDialog(null, modifyMessage);
} else { } else {
JOptionPane.showMessageDialog(null, PluginUtils.getMessageByErrorCode(result.errorCode()), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), JOptionPane.ERROR_MESSAGE); FineJOptionPane.showMessageDialog(null, PluginUtils.getMessageByErrorCode(result.errorCode()), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), JOptionPane.ERROR_MESSAGE);
} }
} }

7
designer-base/src/main/java/com/fr/design/extra/exe/callback/UninstallPluginCallback.java

@ -1,6 +1,7 @@
package com.fr.design.extra.exe.callback; package com.fr.design.extra.exe.callback;
import com.fr.design.bridge.exec.JSCallback; import com.fr.design.bridge.exec.JSCallback;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.extra.PluginUtils; import com.fr.design.extra.PluginUtils;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
@ -27,7 +28,7 @@ public class UninstallPluginCallback extends AbstractPluginTaskCallback {
if (result.isSuccess()) { if (result.isSuccess()) {
jsCallback.execute("success"); jsCallback.execute("success");
FineLoggerFactory.getLogger().info(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Delete_Success")); FineLoggerFactory.getLogger().info(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Delete_Success"));
JOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Delete_Success")); FineJOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Delete_Success"));
}else if (result.errorCode() == PluginErrorCode.NeedUninstallDependingPluginFirst) { }else if (result.errorCode() == PluginErrorCode.NeedUninstallDependingPluginFirst) {
int rv = JOptionPane.showOptionDialog( int rv = JOptionPane.showOptionDialog(
null, null,
@ -36,7 +37,7 @@ public class UninstallPluginCallback extends AbstractPluginTaskCallback {
JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.YES_NO_CANCEL_OPTION,
JOptionPane.INFORMATION_MESSAGE, JOptionPane.INFORMATION_MESSAGE,
null, null,
null, FineJOptionPane.OPTION_YES_NO_CANCEL,
null null
); );
if (rv == JOptionPane.CANCEL_OPTION || rv == JOptionPane.CLOSED_OPTION) { if (rv == JOptionPane.CANCEL_OPTION || rv == JOptionPane.CLOSED_OPTION) {
@ -46,7 +47,7 @@ public class UninstallPluginCallback extends AbstractPluginTaskCallback {
} else { } else {
jsCallback.execute("failed"); jsCallback.execute("failed");
FineLoggerFactory.getLogger().info(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Delete_Failed")); FineLoggerFactory.getLogger().info(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Delete_Failed"));
JOptionPane.showMessageDialog(null, PluginUtils.getMessageByErrorCode(result.errorCode()), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), JOptionPane.ERROR_MESSAGE); FineJOptionPane.showMessageDialog(null, PluginUtils.getMessageByErrorCode(result.errorCode()), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), JOptionPane.ERROR_MESSAGE);
} }
} }
} }

9
designer-base/src/main/java/com/fr/design/extra/exe/callback/UpdateFromDiskCallback.java

@ -1,6 +1,7 @@
package com.fr.design.extra.exe.callback; package com.fr.design.extra.exe.callback;
import com.fr.design.bridge.exec.JSCallback; import com.fr.design.bridge.exec.JSCallback;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.extra.PluginOperateUtils; import com.fr.design.extra.PluginOperateUtils;
import com.fr.design.extra.PluginUtils; import com.fr.design.extra.PluginUtils;
@ -39,7 +40,7 @@ public class UpdateFromDiskCallback extends AbstractPluginTaskCallback {
if (result.isSuccess()) { if (result.isSuccess()) {
jsCallback.execute("success"); jsCallback.execute("success");
FineLoggerFactory.getLogger().info(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Update_Success")); FineLoggerFactory.getLogger().info(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Update_Success"));
JOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Update_Success")); FineJOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Update_Success"));
} else if (result.errorCode() == PluginErrorCode.NeedDealWithPluginDependency) { } else if (result.errorCode() == PluginErrorCode.NeedDealWithPluginDependency) {
int rv = JOptionPane.showOptionDialog( int rv = JOptionPane.showOptionDialog(
null, null,
@ -48,7 +49,7 @@ public class UpdateFromDiskCallback extends AbstractPluginTaskCallback {
JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.YES_NO_CANCEL_OPTION,
JOptionPane.INFORMATION_MESSAGE, JOptionPane.INFORMATION_MESSAGE,
null, null,
null, FineJOptionPane.OPTION_YES_NO_CANCEL,
null null
); );
if (rv == JOptionPane.NO_OPTION || rv == JOptionPane.CANCEL_OPTION || rv == JOptionPane.CLOSED_OPTION) { if (rv == JOptionPane.NO_OPTION || rv == JOptionPane.CANCEL_OPTION || rv == JOptionPane.CLOSED_OPTION) {
@ -68,7 +69,7 @@ public class UpdateFromDiskCallback extends AbstractPluginTaskCallback {
JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.YES_NO_CANCEL_OPTION,
JOptionPane.INFORMATION_MESSAGE, JOptionPane.INFORMATION_MESSAGE,
null, null,
null, FineJOptionPane.OPTION_YES_NO_CANCEL,
null null
); );
if (rv == JOptionPane.NO_OPTION || rv == JOptionPane.CANCEL_OPTION || rv == JOptionPane.CLOSED_OPTION) { if (rv == JOptionPane.NO_OPTION || rv == JOptionPane.CANCEL_OPTION || rv == JOptionPane.CLOSED_OPTION) {
@ -78,7 +79,7 @@ public class UpdateFromDiskCallback extends AbstractPluginTaskCallback {
}else { }else {
jsCallback.execute("failed"); jsCallback.execute("failed");
FineLoggerFactory.getLogger().info(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Update_Failed")); FineLoggerFactory.getLogger().info(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Update_Failed"));
JOptionPane.showMessageDialog(null, PluginUtils.getMessageByErrorCode(result.errorCode()), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), JOptionPane.ERROR_MESSAGE); FineJOptionPane.showMessageDialog(null, PluginUtils.getMessageByErrorCode(result.errorCode()), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), JOptionPane.ERROR_MESSAGE);
} }
} }
} }

5
designer-base/src/main/java/com/fr/design/extra/exe/callback/UpdateOnlineCallback.java

@ -1,6 +1,7 @@
package com.fr.design.extra.exe.callback; package com.fr.design.extra.exe.callback;
import com.fr.design.bridge.exec.JSCallback; import com.fr.design.bridge.exec.JSCallback;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.extra.PluginOperateUtils; import com.fr.design.extra.PluginOperateUtils;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
@ -33,11 +34,11 @@ public class UpdateOnlineCallback extends AbstractDealPreTaskCallback {
if (result.isSuccess()) { if (result.isSuccess()) {
jsCallback.execute("success"); jsCallback.execute("success");
FineLoggerFactory.getLogger().info(pluginInfo + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Update_Success")); FineLoggerFactory.getLogger().info(pluginInfo + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Update_Success"));
JOptionPane.showMessageDialog(null,pluginInfo + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Update_Success")); FineJOptionPane.showMessageDialog(null,pluginInfo + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Update_Success"));
} else { } else {
jsCallback.execute("failed"); jsCallback.execute("failed");
FineLoggerFactory.getLogger().info(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Update_Failed")); FineLoggerFactory.getLogger().info(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Update_Failed"));
JOptionPane.showMessageDialog(null, pluginInfo, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), JOptionPane.ERROR_MESSAGE); FineJOptionPane.showMessageDialog(null, pluginInfo, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), JOptionPane.ERROR_MESSAGE);
} }
} }
} }

7
designer-base/src/main/java/com/fr/design/extra/tradition/callback/UpdateOnlineCallback.java

@ -1,5 +1,6 @@
package com.fr.design.extra.tradition.callback; package com.fr.design.extra.tradition.callback;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.extra.PluginStatusCheckCompletePane; import com.fr.design.extra.PluginStatusCheckCompletePane;
import com.fr.design.extra.PluginUtils; import com.fr.design.extra.PluginUtils;
@ -32,7 +33,7 @@ public class UpdateOnlineCallback implements ProgressCallback {
public void done(PluginTaskResult result){ public void done(PluginTaskResult result){
if (result.isSuccess()) { if (result.isSuccess()) {
FineLoggerFactory.getLogger().info(com.fr.design.i18n.Toolkit.i18nText("FR-Designer-Plugin_Update_Success")); FineLoggerFactory.getLogger().info(com.fr.design.i18n.Toolkit.i18nText("FR-Designer-Plugin_Update_Success"));
JOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Install_Successful")); FineJOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Install_Successful"));
} else if (result.errorCode() == PluginErrorCode.OperationNotSupport) { } else if (result.errorCode() == PluginErrorCode.OperationNotSupport) {
int rv = JOptionPane.showOptionDialog( int rv = JOptionPane.showOptionDialog(
null, null,
@ -41,7 +42,7 @@ public class UpdateOnlineCallback implements ProgressCallback {
JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.YES_NO_CANCEL_OPTION,
JOptionPane.INFORMATION_MESSAGE, JOptionPane.INFORMATION_MESSAGE,
null, null,
null, FineJOptionPane.OPTION_YES_NO_CANCEL,
null null
); );
if (rv == JOptionPane.CANCEL_OPTION || rv == JOptionPane.CLOSED_OPTION) { if (rv == JOptionPane.CANCEL_OPTION || rv == JOptionPane.CLOSED_OPTION) {
@ -50,7 +51,7 @@ public class UpdateOnlineCallback implements ProgressCallback {
PluginManager.getController().update(pluginMarker, toPluginMarker, new UpdateOnlineCallback(pluginMarker, toPluginMarker, pane)); PluginManager.getController().update(pluginMarker, toPluginMarker, new UpdateOnlineCallback(pluginMarker, toPluginMarker, pane));
} else { } else {
FineLoggerFactory.getLogger().info(com.fr.design.i18n.Toolkit.i18nText("FR-Designer-Plugin_Delete_Failed")); FineLoggerFactory.getLogger().info(com.fr.design.i18n.Toolkit.i18nText("FR-Designer-Plugin_Delete_Failed"));
JOptionPane.showMessageDialog(null, PluginUtils.getMessageByErrorCode(result.errorCode()), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), JOptionPane.ERROR_MESSAGE); FineJOptionPane.showMessageDialog(null, PluginUtils.getMessageByErrorCode(result.errorCode()), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), JOptionPane.ERROR_MESSAGE);
} }
} }
} }

13
designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java

@ -386,4 +386,17 @@ public class HistoryTemplateListCache implements CallbackEvent {
} }
FineLoggerFactory.getLogger().info("Env Change Template Loaded."); FineLoggerFactory.getLogger().info("Env Change Template Loaded.");
} }
/**
* 重新载入当前模板刷新数据/对象
*/
public void reloadCurrentTemplate() {
JTemplate<?, ?> jt = getCurrentEditingTemplate();
boolean access = jt != null && jt.getEditingFILE() != null && jt.getEditingFILE().exists();
if (access) {
closeSelectedReport(jt);
DesignerContext.getDesignerFrame().openTemplate(jt.getEditingFILE());
}
}
} }

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

@ -5,6 +5,7 @@ import com.fr.base.BaseUtils;
import com.fr.base.GraphHelper; import com.fr.base.GraphHelper;
import com.fr.base.vcs.DesignerMode; import com.fr.base.vcs.DesignerMode;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.gui.imenu.UIMenuItem; import com.fr.design.gui.imenu.UIMenuItem;
import com.fr.design.gui.imenu.UIScrollPopUpMenu; import com.fr.design.gui.imenu.UIScrollPopUpMenu;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
@ -240,7 +241,7 @@ public class MutilTempalteTabPane extends JComponent {
private String tempalteShowName(JTemplate<?, ?> template) { private String tempalteShowName(JTemplate<?, ?> template) {
String name = template.getEditingFILE().getName(); String name = template.getTemplateName();
if (!template.isSaved() && !name.endsWith(" *")) { if (!template.isSaved() && !name.endsWith(" *")) {
name += " *"; name += " *";
} }
@ -661,8 +662,8 @@ public class MutilTempalteTabPane extends JComponent {
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 = FineJOptionPane.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); Toolkit.i18nText("Fine-Design_Basic_Confirm"), JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE);
if (returnVal == JOptionPane.YES_OPTION) { if (returnVal == JOptionPane.YES_OPTION) {
specifiedTemplate.saveTemplate(); specifiedTemplate.saveTemplate();
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()));
@ -916,7 +917,7 @@ public class MutilTempalteTabPane extends JComponent {
//如果在权限编辑情况下,不允许切换到表单类型的工作簿 //如果在权限编辑情况下,不允许切换到表单类型的工作簿
if (DesignerMode.isAuthorityEditing() && !openedTemplate.get(selectedIndex).isJWorkBook()) { if (DesignerMode.isAuthorityEditing() && !openedTemplate.get(selectedIndex).isJWorkBook()) {
DesignerContext.getDesignerFrame().addAndActivateJTemplate(openedTemplate.get(tempSelectedIndex)); DesignerContext.getDesignerFrame().addAndActivateJTemplate(openedTemplate.get(tempSelectedIndex));
JOptionPane.showMessageDialog(MutilTempalteTabPane.this, Toolkit.i18nText("Fine-Design_Basic_Form_Authority_Edited_Cannot_Be_Supported") FineJOptionPane.showMessageDialog(MutilTempalteTabPane.this, Toolkit.i18nText("Fine-Design_Basic_Form_Authority_Edited_Cannot_Be_Supported")
+ "!", Toolkit.i18nText("Fine-Design_Basic_Alert"), JOptionPane.WARNING_MESSAGE); + "!", Toolkit.i18nText("Fine-Design_Basic_Alert"), JOptionPane.WARNING_MESSAGE);
MutilTempalteTabPane.this.repaint(); MutilTempalteTabPane.this.repaint();
return; return;

2
designer-base/src/main/java/com/fr/design/file/SaveSomeTemplatePane.java

File diff suppressed because one or more lines are too long

37
designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java

@ -4,6 +4,7 @@
package com.fr.design.file; package com.fr.design.file;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.itree.filetree.TemplateFileTree; import com.fr.design.gui.itree.filetree.TemplateFileTree;
import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode; import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode;
@ -44,6 +45,7 @@ import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
import java.util.Enumeration; import java.util.Enumeration;
import java.util.Objects;
import static javax.swing.JOptionPane.WARNING_MESSAGE; import static javax.swing.JOptionPane.WARNING_MESSAGE;
import static javax.swing.JOptionPane.YES_NO_OPTION; import static javax.swing.JOptionPane.YES_NO_OPTION;
@ -253,16 +255,16 @@ public class TemplateTreePane extends JPanel implements FileOperations {
? Toolkit.i18nText("Fine-Design_Basic_Confirm_Delete_Folder") ? Toolkit.i18nText("Fine-Design_Basic_Confirm_Delete_Folder")
: Toolkit.i18nText("Fine-Design_Basic_Confirm_Delete_File"); : Toolkit.i18nText("Fine-Design_Basic_Confirm_Delete_File");
if (JOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), if (FineJOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(),
tipContent, tipContent,
UIManager.getString("OptionPane.messageDialogTitle"), Toolkit.i18nText("Fine-Design_Basic_Confirm"),
YES_NO_OPTION) YES_NO_OPTION)
== JOptionPane.YES_OPTION) { == JOptionPane.YES_OPTION) {
// 删除所有选中的即可 // 删除所有选中的即可
if (!deleteNodes(Arrays.asList(treeNodes))) { if (!deleteNodes(Arrays.asList(treeNodes))) {
JOptionPane.showConfirmDialog(null, FineJOptionPane.showConfirmDialog(null,
Toolkit.i18nText("Fine-Design_Basic_Delete_Failure"), Toolkit.i18nText("Fine-Design_Basic_Delete_Failure"),
UIManager.getString("OptionPane.messageDialogTitle"), Toolkit.i18nText("Fine-Design_Basic_Error"),
JOptionPane.DEFAULT_OPTION, JOptionPane.DEFAULT_OPTION,
JOptionPane.ERROR_MESSAGE); JOptionPane.ERROR_MESSAGE);
} }
@ -276,30 +278,41 @@ public class TemplateTreePane extends JPanel implements FileOperations {
if (deletableNodes.isEmpty()) { if (deletableNodes.isEmpty()) {
// 提醒被锁定模板无法删除 // 提醒被锁定模板无法删除
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(),
Toolkit.i18nText("Fine-Design_Basic_Unable_Delete_Locked_File"), Toolkit.i18nText("Fine-Design_Basic_Unable_Delete_Locked_File"),
Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"), Toolkit.i18nText("Fine-Design_Basic_Alert"),
WARNING_MESSAGE); WARNING_MESSAGE);
return; return;
} }
if (JOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), if (FineJOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(),
tipContent, tipContent,
UIManager.getString("OptionPane.messageDialogTitle"), Toolkit.i18nText("Fine-Design_Basic_Confirm"),
YES_NO_OPTION) YES_NO_OPTION)
== JOptionPane.YES_OPTION) { == JOptionPane.YES_OPTION) {
// 删除其他 // 删除其他
if (!deleteNodes(deletableNodes)) { if (!deleteNodes(deletableNodes)) {
JOptionPane.showConfirmDialog(null, FineJOptionPane.showConfirmDialog(null,
Toolkit.i18nText("Fine-Design_Basic_Delete_Failure"), Toolkit.i18nText("Fine-Design_Basic_Delete_Failure"),
UIManager.getString("OptionPane.messageDialogTitle"), Toolkit.i18nText("Fine-Design_Basic_Error"),
JOptionPane.DEFAULT_OPTION, JOptionPane.DEFAULT_OPTION,
JOptionPane.ERROR_MESSAGE); JOptionPane.ERROR_MESSAGE);
} }
} }
} }
refreshAfterDelete();
}
private void refreshAfterDelete() {
TreePath[] paths = reportletsTree.getSelectionPaths();
if (paths == null) {
reportletsTree.refresh(); reportletsTree.refresh();
} else {
for (TreePath path : Objects.requireNonNull(reportletsTree.getSelectionPaths())) {
reportletsTree.refreshParent(path);
}
}
} }
private boolean deleteNodes(Collection<ExpandMutableTreeNode> nodes) { private boolean deleteNodes(Collection<ExpandMutableTreeNode> nodes) {
@ -403,9 +416,9 @@ public class TemplateTreePane extends JPanel implements FileOperations {
} }
if (!lockedNodes.isEmpty()) { if (!lockedNodes.isEmpty()) {
JOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), FineJOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(),
Toolkit.i18nText("Fine-Design_Basic_Warn_Rename_Lock_File"), Toolkit.i18nText("Fine-Design_Basic_Warn_Rename_Lock_File"),
UIManager.getString("OptionPane.messageDialogTitle"), Toolkit.i18nText("Fine-Design_Basic_Alert"),
JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE); JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE);
return true; return true;
} }

57
designer-base/src/main/java/com/fr/design/formula/FormulaConstants.java

@ -0,0 +1,57 @@
package com.fr.design.formula;
import com.fr.stable.StringUtils;
/**
* @author Joe
* @version 10.0
* Created by Joe on 10/30/2019
*/
public enum FormulaConstants {
PAGE_NUMBER("$$page_number", "Page_Number"),
TOTAL_PAGE_NUMBER("$$totalPage_number", "Total_Page_Number"),
FINE_USERNAME("$fine_username", "Fine_Username"),
FINE_ROLE("$fine_role", "Fine_Role"),
FINE_POSITION("$fine_position", "Fine_Position"),
NULL("NULL", "Null"),
NOFILTER("NOFILTER", "No_Filter"),
REPORT_NAME("reportName", "Report_Name"),
FORMLET_NAME("formletName", "Formlet_Name"),
SERVLET_URL("servletURL", "Servlet_URL"),
SERVER_SCHEMA("serverSchema", "Server_Schema"),
SERVER_NAME("serverName", "Server_Name"),
SERVER_PORT("serverPort", "Server_Port"),
SERVER_URL("serverURL", "Server_URL"),
CONTEXT_PATH("contextPath", "Context_Path"),
SESSION_ID("sessionID", "SessionID");
private String key;
private String value;
private static final String KEY_PREFIX = "Fine-Design_CurReport_Variable_";
private FormulaConstants(String key, String value) {
this.key = key;
this.value = KEY_PREFIX + value;
}
public String getKey() {
return key;
}
public String getValue() {
return value;
}
public static String getValueByKey(String key) {
for (FormulaConstants formulaConstant : values()) {
if (formulaConstant.getKey().equals(key)) {
return formulaConstant.getValue();
}
}
return StringUtils.EMPTY;
}
}

35
designer-base/src/main/java/com/fr/design/formula/FormulaPane.java

@ -8,6 +8,7 @@ import com.fr.design.border.UIRoundedBorder;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
@ -19,6 +20,7 @@ import com.fr.design.gui.syntax.ui.rsyntaxtextarea.SyntaxConstants;
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.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.ComparatorUtils;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.parser.FRLexer; import com.fr.parser.FRLexer;
import com.fr.parser.FRParser; import com.fr.parser.FRParser;
@ -572,14 +574,15 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula {
// alex:继续往下面走,expression为null时告知不合法公式 // alex:继续往下面走,expression为null时告知不合法公式
} }
JOptionPane.showMessageDialog( FineJOptionPane.showMessageDialog(
FormulaPane.this, FormulaPane.this,
/* /*
* alex:仅仅只需要根据expression是否为null作合法性判断 * alex:仅仅只需要根据expression是否为null作合法性判断
* 不需要eval * 不需要eval
* TODO 但有个问题,有些函数的参数个数是有规定的,何以判别之 * TODO 但有个问题,有些函数的参数个数是有规定的,何以判别之
*/ */
(expression != null ? com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Valid_Formula") : com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Invalid_Formula")) + ".", ProductConstants.PRODUCT_NAME, (expression != null ? com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Valid_Formula") : com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Invalid_Formula")) + ".",
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"),
JOptionPane.INFORMATION_MESSAGE); JOptionPane.INFORMATION_MESSAGE);
} }
} }
@ -769,31 +772,31 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula {
private void initVariablesTreeSelectionListener() { private void initVariablesTreeSelectionListener() {
variablesTree.addTreeSelectionListener(new TreeSelectionListener() { variablesTree.addTreeSelectionListener(new TreeSelectionListener() {
public void valueChanged(TreeSelectionEvent e) { public void valueChanged(TreeSelectionEvent e) {
Object selectedValue = ((DefaultMutableTreeNode) variablesTree.getLastSelectedPathComponent()).getUserObject(); DefaultMutableTreeNode selectedTreeNode = (DefaultMutableTreeNode) variablesTree.getLastSelectedPathComponent();
Object selectedValue = selectedTreeNode.getUserObject();
Object selectedParentValue = ((DefaultMutableTreeNode)selectedTreeNode.getParent()).getUserObject();
if (selectedValue == null) { if (selectedValue == null) {
return; return;
} }
StringBuilder desBuf = new StringBuilder();
try {
String path;
Locale locale = FRContext.getLocale();
if (locale.equals(Locale.CHINA)) {
path = "/com/fr/design/insert/formula/variable/cn/";
} else {
path = "/com/fr/design/insert/formula/variable/en/";
}
if (selectedValue instanceof TextUserObject) { if (selectedValue instanceof TextUserObject) {
desBuf = getText((TextUserObject) selectedValue, path); //有公式说明的条件:1.属于TextUserObject 2.parent是系统参数
if (ComparatorUtils.equals(((TextFolderUserObject) selectedParentValue).getText(),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaPane_Variables"))) {
descriptionTextArea.setText(com.fr.design.i18n.Toolkit.i18nText(FormulaConstants.getValueByKey(((TextUserObject) selectedValue).getText())));
} else {
descriptionTextArea.setText(StringUtils.EMPTY);
} }
} catch (IOException exp) { } else if (selectedValue instanceof TextFolderUserObject) {
FineLoggerFactory.getLogger().error(exp.getMessage(), exp); descriptionTextArea.setText(StringUtils.EMPTY);
} }
descriptionTextArea.setText(desBuf.toString());
descriptionTextArea.moveCaretPosition(0); descriptionTextArea.moveCaretPosition(0);
} }
}); });
} }
private void initVariablesTree() { private void initVariablesTree() {
// vairable. // vairable.
variablesTree = new JTree(); variablesTree = new JTree();

7
designer-base/src/main/java/com/fr/design/formula/JavaEditorPane.java

@ -2,6 +2,7 @@ package com.fr.design.formula;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
@ -161,11 +162,11 @@ public class JavaEditorPane extends BasicPane {
} }
try { try {
WorkContext.getWorkResource().write(StableUtils.pathJoin(ProjectConstants.CLASSES_NAME, getJavaPath()), text.getBytes(EncodeConstants.ENCODING_UTF_8)); WorkContext.getWorkResource().write(StableUtils.pathJoin(ProjectConstants.CLASSES_NAME, getJavaPath()), text.getBytes(EncodeConstants.ENCODING_UTF_8));
JOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Common_Save_Successfully") + "!"); FineJOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Common_Save_Successfully") + "!");
fireSaveActionListener(); fireSaveActionListener();
} catch (Exception e) { } catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
JOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Common_Save_Failed") + "!"); FineJOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Common_Save_Failed") + "!");
} }
} }
@ -191,7 +192,7 @@ public class JavaEditorPane extends BasicPane {
if (StringUtils.isEmpty(message)) { if (StringUtils.isEmpty(message)) {
message = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Compile_Success") + "!"; message = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Compile_Success") + "!";
} }
JOptionPane.showMessageDialog(null, message); FineJOptionPane.showMessageDialog(null, message);
} catch (InterruptedException e1) { } catch (InterruptedException e1) {
FineLoggerFactory.getLogger().error(e1.getMessage(), e1); FineLoggerFactory.getLogger().error(e1.getMessage(), e1);
Thread.currentThread().interrupt(); Thread.currentThread().interrupt();

34
designer-base/src/main/java/com/fr/design/fun/MobileBookMarkStyleProvider.java

@ -0,0 +1,34 @@
package com.fr.design.fun;
import com.fr.design.beans.BasicBeanPane;
import com.fr.form.ui.mobile.MobileBookMarkStyle;
import com.fr.stable.fun.mark.Mutable;
/**
* 移动端书签样式扩展接口
*
* @author hades
* @version 10.0
* Created by hades on 2019/12/23
*/
public interface MobileBookMarkStyleProvider extends Mutable {
String XML_TAG = "MobileBookMarkStyleProvider";
int CURRENT_LEVEL = 1;
/**
* 书签样式
* @return
*/
Class<? extends MobileBookMarkStyle> classForMobileBookMarkStyle();
/**
* 书签样式面板
* @return
*/
Class<? extends BasicBeanPane<MobileBookMarkStyle>> classForMobileBookMarkStyleAppearance();
String displayName();
}

3
designer-base/src/main/java/com/fr/design/fun/PreviewProvider.java

@ -1,6 +1,7 @@
package com.fr.design.fun; package com.fr.design.fun;
import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.JTemplate;
import com.fr.stable.Filter;
import com.fr.stable.fun.mark.Mutable; import com.fr.stable.fun.mark.Mutable;
import java.util.Map; import java.util.Map;
@ -11,7 +12,7 @@ import java.util.Map;
* @since 8.0 * @since 8.0
* 自定义预览方式接口 * 自定义预览方式接口
*/ */
public interface PreviewProvider extends Mutable { public interface PreviewProvider extends Mutable, Filter<JTemplate> {
String MARK_STRING = "PreviewProvider"; String MARK_STRING = "PreviewProvider";

24
designer-base/src/main/java/com/fr/design/fun/impl/AbstractMobileBookMarkStyleProvider.java

@ -0,0 +1,24 @@
package com.fr.design.fun.impl;
import com.fr.design.fun.MobileBookMarkStyleProvider;
import com.fr.stable.fun.impl.AbstractProvider;
import com.fr.stable.fun.mark.API;
/**
* @author hades
* @version 10.0
* Created by hades on 2019/12/24
*/
@API(level = MobileBookMarkStyleProvider.CURRENT_LEVEL)
public abstract class AbstractMobileBookMarkStyleProvider extends AbstractProvider implements MobileBookMarkStyleProvider {
@Override
public int currentAPILevel() {
return CURRENT_LEVEL;
}
@Override
public String mark4Provider() {
return getClass().getName();
}
}

10
designer-base/src/main/java/com/fr/design/fun/impl/AbstractPreviewProvider.java

@ -1,7 +1,9 @@
package com.fr.design.fun.impl; package com.fr.design.fun.impl;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.fun.PreviewProvider; import com.fr.design.fun.PreviewProvider;
import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.JTemplate;
import com.fr.design.mainframe.JVirtualTemplate;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.web.ParameterConstants; import com.fr.general.web.ParameterConstants;
import com.fr.stable.fun.impl.AbstractProvider; import com.fr.stable.fun.impl.AbstractProvider;
@ -52,4 +54,12 @@ public abstract class AbstractPreviewProvider extends AbstractProvider implement
public String getActionType() { public String getActionType() {
return ParameterConstants.VIEWLET; return ParameterConstants.VIEWLET;
} }
@Override
public boolean accept(JTemplate jTemplate) {
if (jTemplate == null) {
jTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
}
return jTemplate == null || jTemplate.isJWorkBook() || jTemplate instanceof JVirtualTemplate;
}
} }

3
designer-base/src/main/java/com/fr/design/gui/controlpane/ListControlPaneHelper.java

@ -1,6 +1,7 @@
package com.fr.design.gui.controlpane; package com.fr.design.gui.controlpane;
import com.fr.design.beans.BasicBeanPane; import com.fr.design.beans.BasicBeanPane;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.gui.ilist.JNameEdList; import com.fr.design.gui.ilist.JNameEdList;
import com.fr.design.gui.ilist.ListModelElement; import com.fr.design.gui.ilist.ListModelElement;
import com.fr.stable.Nameable; import com.fr.stable.Nameable;
@ -32,7 +33,7 @@ class ListControlPaneHelper {
try { try {
listControlPane.checkValid(); listControlPane.checkValid();
} catch (Exception exp) { } catch (Exception exp) {
JOptionPane.showMessageDialog((Component) listControlPane, exp.getMessage()); FineJOptionPane.showMessageDialog((Component) listControlPane, exp.getMessage());
listControlPane.setSelectedIndex(idx); listControlPane.setSelectedIndex(idx);
return true; return true;
} }

31
designer-base/src/main/java/com/fr/design/gui/controlpane/UIControlPane.java

@ -1,6 +1,7 @@
package com.fr.design.gui.controlpane; package com.fr.design.gui.controlpane;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.gui.controlpane.shortcutfactory.ShortCutFactory; import com.fr.design.gui.controlpane.shortcutfactory.ShortCutFactory;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itoolbar.UIToolBarUI; import com.fr.design.gui.itoolbar.UIToolBarUI;
@ -9,17 +10,18 @@ import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.menu.ShortCut; import com.fr.design.menu.ShortCut;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.design.utils.gui.UIComponentUtils;
import com.fr.design.widget.FRWidgetFactory; import com.fr.design.widget.FRWidgetFactory;
import com.fr.invoke.Reflect;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.stable.os.OperatingSystem;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.JComponent; import javax.swing.JComponent;
import javax.swing.JDialog; import javax.swing.JDialog;
import javax.swing.JOptionPane;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.JSplitPane; import javax.swing.JSplitPane;
import javax.swing.SwingUtilities;
import javax.swing.border.EmptyBorder; import javax.swing.border.EmptyBorder;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Color; import java.awt.Color;
@ -27,6 +29,7 @@ import java.awt.Cursor;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.FlowLayout; import java.awt.FlowLayout;
import java.awt.Font; import java.awt.Font;
import java.awt.Frame;
import java.awt.Graphics; import java.awt.Graphics;
import java.awt.Graphics2D; import java.awt.Graphics2D;
import java.awt.GraphicsEnvironment; import java.awt.GraphicsEnvironment;
@ -72,7 +75,6 @@ abstract class UIControlPane extends JControlPane {
this.creators = this.createNameableCreators(); this.creators = this.createNameableCreators();
initCardPane(); initCardPane();
if (isNewStyle()) { if (isNewStyle()) {
getPopupEditDialog(cardPane); getPopupEditDialog(cardPane);
this.add(getLeftPane(), BorderLayout.CENTER); this.add(getLeftPane(), BorderLayout.CENTER);
@ -148,9 +150,7 @@ abstract class UIControlPane extends JControlPane {
topToolBar.setLayout(new BorderLayout()); topToolBar.setLayout(new BorderLayout());
ShortCut addItem = shortCutFactory.addItemShortCut().getShortCut(); ShortCut addItem = shortCutFactory.addItemShortCut().getShortCut();
addItem.intoJToolBar(topToolBar); addItem.intoJToolBar(topToolBar);
JPanel leftTopPane = getLeftTopPane(topToolBar); JPanel leftTopPane = getLeftTopPane(topToolBar);
leftTopPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 6, 0)); leftTopPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 6, 0));
leftPane.add(leftTopPane, BorderLayout.NORTH); leftPane.add(leftTopPane, BorderLayout.NORTH);
@ -171,7 +171,6 @@ abstract class UIControlPane extends JControlPane {
JPanel leftTopPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel leftTopPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
leftTopPane.add(toolBarPane, BorderLayout.EAST); leftTopPane.add(toolBarPane, BorderLayout.EAST);
leftTopPane.add(addItemLabel, BorderLayout.CENTER); leftTopPane.add(addItemLabel, BorderLayout.CENTER);
return leftTopPane; return leftTopPane;
} }
@ -202,7 +201,6 @@ abstract class UIControlPane extends JControlPane {
topToolBar.validate(); topToolBar.validate();
this.controlUpdatePane = createControlUpdatePane();//REPORT-4841 刷新一下编辑面板 this.controlUpdatePane = createControlUpdatePane();//REPORT-4841 刷新一下编辑面板
cardPane.add(controlUpdatePane, "EDIT"); cardPane.add(controlUpdatePane, "EDIT");
this.repaint(); this.repaint();
} }
@ -249,6 +247,19 @@ abstract class UIControlPane extends JControlPane {
} }
} }
try {
//没有指定owner的弹出框用的是SwingUtilities.getSharedOwnerFrame()
Frame sharedOwnerFrame = Reflect.on(SwingUtilities.class).call("getSharedOwnerFrame").get();
for (Window window : sharedOwnerFrame.getOwnedWindows()) {
if (window instanceof JDialog && window.isVisible() && ((JDialog) window).isModal()) {
// 如果有可见模态对话框,则不隐藏
return;
}
}
} catch (Exception ignore) {
//do nothing
}
// 要隐藏 先检查有没有非法输入 // 要隐藏 先检查有没有非法输入
// 非法输入检查放在最后,因为可能出现面板弹出新弹框而失去焦点的情况,比如 输入公式时,弹出公式编辑对话框 // 非法输入检查放在最后,因为可能出现面板弹出新弹框而失去焦点的情况,比如 输入公式时,弹出公式编辑对话框
try { try {
@ -256,7 +267,7 @@ abstract class UIControlPane extends JControlPane {
} catch (Exception exp) { } catch (Exception exp) {
// 存在非法输入 拒绝隐藏 // 存在非法输入 拒绝隐藏
this.setAlwaysOnTop(true); this.setAlwaysOnTop(true);
JOptionPane.showMessageDialog(this, exp.getMessage()); FineJOptionPane.showMessageDialog(this, exp.getMessage());
this.requestFocus(); this.requestFocus();
return; return;
} }
@ -268,6 +279,10 @@ abstract class UIControlPane extends JControlPane {
addWindowFocusListener(new WindowAdapter() { addWindowFocusListener(new WindowAdapter() {
@Override @Override
public void windowLostFocus(WindowEvent e) { public void windowLostFocus(WindowEvent e) {
//在Linux上拉回焦点,不然导致一些面板关不掉
if(OperatingSystem.isLinux()) {
requestFocus();
}
hideDialog(); hideDialog();
} }
}); });

2
designer-base/src/main/java/com/fr/design/gui/frpane/AbstractAttrNoScrollPane.java

@ -65,7 +65,7 @@ public abstract class AbstractAttrNoScrollPane extends BasicPane {
} }
protected void initListener(Container parentComponent) { public void initListener(Container parentComponent) {
for (int i = 0; i < parentComponent.getComponentCount(); i++) { for (int i = 0; i < parentComponent.getComponentCount(); i++) {
Component tmpComp = parentComponent.getComponent(i); Component tmpComp = parentComponent.getComponent(i);

3
designer-base/src/main/java/com/fr/design/gui/frpane/CommitTabbedPane.java

@ -3,6 +3,7 @@ package com.fr.design.gui.frpane;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.write.submit.DBManipulationPane; import com.fr.design.write.submit.DBManipulationPane;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.javascript.Commit2DBJavaScriptPane; import com.fr.design.javascript.Commit2DBJavaScriptPane;
@ -408,7 +409,7 @@ public class CommitTabbedPane extends JComponent implements MouseListener, Mous
selectedIndex = dbManipulationPaneList.size()-1; selectedIndex = dbManipulationPaneList.size()-1;
commit2DBJavaScriptPane.updateCardPane(); commit2DBJavaScriptPane.updateCardPane();
} else if (isOverCloseIcon(x)){ } else if (isOverCloseIcon(x)){
int re = JOptionPane.showConfirmDialog(SwingUtilities.getWindowAncestor(this), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_CommitTab_Sure_To_Delete")+ "?", com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_CommitTab_Remove") int re = FineJOptionPane.showConfirmDialog(SwingUtilities.getWindowAncestor(this), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_CommitTab_Sure_To_Delete")+ "?", com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_CommitTab_Remove")
, JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); , JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
if (re == JOptionPane.OK_OPTION) { if (re == JOptionPane.OK_OPTION) {
dbManipulationPaneList.remove(getTabIndex(x)); dbManipulationPaneList.remove(getTabIndex(x));

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

@ -1,6 +1,7 @@
package com.fr.design.gui.frpane; package com.fr.design.gui.frpane;
import com.fr.design.beans.BasicBeanPane; import com.fr.design.beans.BasicBeanPane;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
@ -127,7 +128,7 @@ public abstract class EditingStringListPane extends BasicBeanPane<List<String>>
setAddEnabled(false); setAddEnabled(false);
} }
} else { } else {
JOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(EditingStringListPane.this), newvalue + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Already_Exists_Not_Add_Repeat")+"!"); FineJOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(EditingStringListPane.this), newvalue + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Already_Exists_Not_Add_Repeat")+"!");
} }
} }
}); });
@ -149,7 +150,7 @@ public abstract class EditingStringListPane extends BasicBeanPane<List<String>>
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
Object selected = jlist.getSelectedValue(); Object selected = jlist.getSelectedValue();
if (selected != null) { if (selected != null) {
int re = JOptionPane.showConfirmDialog(SwingUtilities.getWindowAncestor(EditingStringListPane.this), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Sure_To_Delete") + selected.toString() + "?"); int re = FineJOptionPane.showConfirmDialog(SwingUtilities.getWindowAncestor(EditingStringListPane.this), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Sure_To_Delete") + selected.toString() + "?");
if (re == JOptionPane.OK_OPTION) { if (re == JOptionPane.OK_OPTION) {
JListUtils.removeSelectedListItems(jlist); JListUtils.removeSelectedListItems(jlist);
} }

2
designer-base/src/main/java/com/fr/design/gui/frpane/HyperlinkGroupPane.java

@ -2,6 +2,7 @@ package com.fr.design.gui.frpane;
import com.fr.design.ExtraDesignClassManager; import com.fr.design.ExtraDesignClassManager;
import com.fr.design.designer.TargetComponent; import com.fr.design.designer.TargetComponent;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.fun.HyperlinkProvider; import com.fr.design.fun.HyperlinkProvider;
import com.fr.design.gui.controlpane.NameableCreator; import com.fr.design.gui.controlpane.NameableCreator;
import com.fr.design.gui.controlpane.UIListControlPane; import com.fr.design.gui.controlpane.UIListControlPane;
@ -45,6 +46,7 @@ public abstract class HyperlinkGroupPane extends UIListControlPane {
@Override @Override
public void on(PluginEvent event) { public void on(PluginEvent event) {
refreshNameableCreator(createNameableCreators()); refreshNameableCreator(createNameableCreators());
HistoryTemplateListCache.getInstance().reloadCurrentTemplate();
} }
}, new PluginFilter() { }, new PluginFilter() {

3
designer-base/src/main/java/com/fr/design/gui/frpane/JTreeControlPane.java

@ -5,6 +5,7 @@ import com.fr.data.impl.TreeNodeAttr;
import com.fr.data.impl.TreeNodeWrapper; import com.fr.data.impl.TreeNodeWrapper;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.design.beans.BasicBeanPane; import com.fr.design.beans.BasicBeanPane;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.gui.controlpane.ControlPane; import com.fr.design.gui.controlpane.ControlPane;
import com.fr.design.gui.controlpane.NameableCreator; import com.fr.design.gui.controlpane.NameableCreator;
import com.fr.design.gui.controlpane.UnrepeatedNameHelper; import com.fr.design.gui.controlpane.UnrepeatedNameHelper;
@ -231,7 +232,7 @@ public class JTreeControlPane extends ControlPane {
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
// TODO remove tree node // TODO remove tree node
int val = JOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Utils_Are_You_Sure_To_Remove_The_Selected_Item") + "?", int val = FineJOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Utils_Are_You_Sure_To_Remove_The_Selected_Item") + "?",
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Remove"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE); com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Remove"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE);
if (val != JOptionPane.OK_OPTION) { if (val != JOptionPane.OK_OPTION) {
return; return;

3
designer-base/src/main/java/com/fr/design/gui/frpane/UITabbedPane.java

@ -1,5 +1,6 @@
package com.fr.design.gui.frpane; package com.fr.design.gui.frpane;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
@ -113,7 +114,7 @@ public class UITabbedPane extends JTabbedPane{
* @param i tab索引 * @param i tab索引
*/ */
public void doRemoveTab(int i){ public void doRemoveTab(int i){
int re = JOptionPane.showConfirmDialog(SwingUtilities.getWindowAncestor(UITabbedPane.this), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Sure_To_Delete")+ "?", com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Remove") int re = FineJOptionPane.showConfirmDialog(SwingUtilities.getWindowAncestor(UITabbedPane.this), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Sure_To_Delete")+ "?", com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Remove")
, JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); , JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
if (re == JOptionPane.OK_OPTION) { if (re == JOptionPane.OK_OPTION) {
super.removeTabAt(i); super.removeTabAt(i);

3
designer-base/src/main/java/com/fr/design/gui/frpane/tree/layer/config/LayerDataControlPane.java

@ -2,6 +2,7 @@ package com.fr.design.gui.frpane.tree.layer.config;
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.dialog.FineJOptionPane;
import com.fr.design.gui.controlpane.ControlPane; import com.fr.design.gui.controlpane.ControlPane;
import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.itoolbar.UIToolbar; import com.fr.design.gui.itoolbar.UIToolbar;
@ -177,7 +178,7 @@ public class LayerDataControlPane extends ControlPane {
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
// TODO remove tree node // TODO remove tree node
int val = JOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Utils_Are_You_Sure_To_Remove_The_Selected_Item") + "?", int val = FineJOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Utils_Are_You_Sure_To_Remove_The_Selected_Item") + "?",
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Remove"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE); com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Remove"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE);
if (val != JOptionPane.OK_OPTION) { if (val != JOptionPane.OK_OPTION) {
return; return;

36
designer-base/src/main/java/com/fr/design/gui/ibutton/ModeButtonGroup.java

@ -0,0 +1,36 @@
package com.fr.design.gui.ibutton;
import javax.swing.*;
import java.util.LinkedHashMap;
import java.util.Map;
/**
* 互斥的按钮
* @author hades
* @version 10.0
* Created by hades on 2019/11/12
*/
public class ModeButtonGroup<T> extends ButtonGroup {
private Map<T, AbstractButton> buttonMap = new LinkedHashMap<>();
public void put(T t, AbstractButton button) {
add(button);
buttonMap.put(t, button);
}
public void setSelectButton(T t) {
buttonMap.get(t).setSelected(true);
}
public T getCurrentSelected() {
for (Map.Entry<T, AbstractButton> entry : buttonMap.entrySet()) {
if (entry.getValue().isSelected()) {
return entry.getKey();
}
}
return buttonMap.entrySet().iterator().next().getKey();
}
}

60
designer-base/src/main/java/com/fr/design/gui/ibutton/UIColorButton.java

@ -1,19 +1,5 @@
package com.fr.design.gui.ibutton; package com.fr.design.gui.ibutton;
import java.awt.*;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import javax.swing.AbstractButton;
import javax.swing.ButtonModel;
import javax.swing.Icon;
import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.swing.event.EventListenerList;
import com.fr.base.Utils; import com.fr.base.Utils;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.event.GlobalNameListener; import com.fr.design.event.GlobalNameListener;
@ -21,9 +7,21 @@ import com.fr.design.event.GlobalNameObserver;
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.ipoppane.PopupHider; import com.fr.design.gui.ipoppane.PopupHider;
import com.fr.general.ComparatorUtils;
import com.fr.design.style.color.ColorControlWindow; import com.fr.design.style.color.ColorControlWindow;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.ComparatorUtils;
import javax.swing.AbstractButton;
import javax.swing.ButtonModel;
import javax.swing.Icon;
import javax.swing.JComponent;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.swing.event.EventListenerList;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
public class UIColorButton extends UIButton implements PopupHider, UIObserver, GlobalNameObserver { public class UIColorButton extends UIButton implements PopupHider, UIObserver, GlobalNameObserver {
private static final int SIZE = 16; private static final int SIZE = 16;
@ -36,7 +34,7 @@ public class UIColorButton extends UIButton implements PopupHider, UIObserver, G
private EventListenerList colorChangeListenerList = new EventListenerList(); private EventListenerList colorChangeListenerList = new EventListenerList();
private boolean isEventBanned = false; private boolean isEventBanned = false;
private String colorButtonName = ""; private String colorButtonName = "";
private UIObserverListener uiColorObserverListener; private UIObserverListener uiObserverListener;
private GlobalNameListener globalNameListener = null; private GlobalNameListener globalNameListener = null;
public UIColorButton() { public UIColorButton() {
@ -60,13 +58,13 @@ public class UIColorButton extends UIButton implements PopupHider, UIObserver, G
this.addColorChangeListener(new ChangeListener() { this.addColorChangeListener(new ChangeListener() {
@Override @Override
public void stateChanged(ChangeEvent e) { public void stateChanged(ChangeEvent e) {
if (uiColorObserverListener == null) { if (uiObserverListener == null) {
return; return;
} }
if (globalNameListener != null && shouldResponseNameListener()) { if (globalNameListener != null && shouldResponseNameListener()) {
globalNameListener.setGlobalName(colorButtonName); globalNameListener.setGlobalName(colorButtonName);
} }
uiColorObserverListener.doChange(); uiObserverListener.doChange();
} }
}); });
} }
@ -136,10 +134,9 @@ public class UIColorButton extends UIButton implements PopupHider, UIObserver, G
public void hidePopupMenu() { public void hidePopupMenu() {
if (popupWin != null) { if (popupWin != null) {
popupWin.setVisible(false); popupWin.setVisible(false);
repaint();
} }
popupWin = null; popupWin = null;
repaint();
} }
private ColorControlWindow getColorControlWindow() { private ColorControlWindow getColorControlWindow() {
@ -169,6 +166,7 @@ public class UIColorButton extends UIButton implements PopupHider, UIObserver, G
/** /**
* 移除监听 * 移除监听
* Removes an old ColorChangeListener. * Removes an old ColorChangeListener.
*
* @param changeListener 监听列表 * @param changeListener 监听列表
*/ */
public void removeColorChangeListener(ChangeListener changeListener) { public void removeColorChangeListener(ChangeListener changeListener) {
@ -199,7 +197,7 @@ public class UIColorButton extends UIButton implements PopupHider, UIObserver, G
* @param listener 观察者监听事件 * @param listener 观察者监听事件
*/ */
public void registerChangeListener(UIObserverListener listener) { public void registerChangeListener(UIObserverListener listener) {
uiColorObserverListener = listener; uiObserverListener = listener;
} }
/** /**
@ -228,24 +226,4 @@ public class UIColorButton extends UIButton implements PopupHider, UIObserver, G
public boolean shouldResponseNameListener() { public boolean shouldResponseNameListener() {
return true; return true;
} }
/**
* 主函数
*
* @param args 参数
*/
public static void main(String... args) {
LayoutManager layoutManager = null;
JFrame jf = new JFrame("test");
jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JPanel content = (JPanel) jf.getContentPane();
content.setLayout(layoutManager);
UIColorButton bb = new UIColorButton(UIConstants.FONT_ICON);
bb.setBounds(20, 20, bb.getPreferredSize().width, bb.getPreferredSize().height);
content.add(bb);
GUICoreUtils.centerWindow(jf);
jf.setSize(400, 400);
jf.setVisible(true);
}
} }

11
designer-base/src/main/java/com/fr/design/gui/ibutton/UIRadioButton.java

@ -25,36 +25,43 @@ public class UIRadioButton extends JRadioButton implements UIObserver, GlobalNam
public UIRadioButton() { public UIRadioButton() {
super(); super();
initListener(); initListener();
initComponent();
} }
public UIRadioButton(Icon icon) { public UIRadioButton(Icon icon) {
super(icon); super(icon);
initListener(); initListener();
initComponent();
} }
public UIRadioButton(Action a) { public UIRadioButton(Action a) {
super(a); super(a);
initListener(); initListener();
initComponent();
} }
public UIRadioButton(Icon icon, boolean selected) { public UIRadioButton(Icon icon, boolean selected) {
super(icon, selected); super(icon, selected);
initListener(); initListener();
initComponent();
} }
public UIRadioButton(String text) { public UIRadioButton(String text) {
super(text); super(text);
initListener(); initListener();
initComponent();
} }
public UIRadioButton(String text, boolean selected) { public UIRadioButton(String text, boolean selected) {
super(text, selected); super(text, selected);
initListener(); initListener();
initComponent();
} }
public UIRadioButton(String text, Icon icon) { public UIRadioButton(String text, Icon icon) {
super(text, icon); super(text, icon);
initListener(); initListener();
initComponent();
} }
@ -81,6 +88,10 @@ public class UIRadioButton extends JRadioButton implements UIObserver, GlobalNam
} }
} }
private void initComponent() {
this.setFocusPainted(false);
}
/** /**
* 给组件登记一个观察者监听事件 * 给组件登记一个观察者监听事件
* *

12
designer-base/src/main/java/com/fr/design/gui/icheckbox/UICheckBox.java

@ -59,12 +59,19 @@ public class UICheckBox extends JCheckBox implements UIObserver, GlobalNameObser
initListener(); initListener();
} }
private void initListener() { protected void initListener() {
if (shouldResponseChangeListener()) { if (shouldResponseChangeListener()) {
this.addItemListener(new ItemListener() { this.addItemListener(new ItemListener() {
@Override @Override
public void itemStateChanged(ItemEvent e) { public void itemStateChanged(ItemEvent e) {
attributeChange();
}
});
}
}
protected void attributeChange() {
if (uiObserverListener == null) { if (uiObserverListener == null) {
return; return;
} }
@ -73,9 +80,6 @@ public class UICheckBox extends JCheckBox implements UIObserver, GlobalNameObser
} }
uiObserverListener.doChange(); uiObserverListener.doChange();
} }
});
}
}
/** /**
* 给组件登记一个观察者监听事件 * 给组件登记一个观察者监听事件

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

@ -15,6 +15,8 @@ import javax.swing.Icon;
import javax.swing.JComponent; import javax.swing.JComponent;
import javax.swing.JFrame; import javax.swing.JFrame;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.event.PopupMenuEvent;
import javax.swing.event.PopupMenuListener;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Color; import java.awt.Color;
import java.awt.Component; import java.awt.Component;
@ -23,6 +25,8 @@ import java.awt.FlowLayout;
import java.awt.FontMetrics; import java.awt.FontMetrics;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.awt.event.FocusAdapter;
import java.awt.event.FocusEvent;
import java.awt.event.MouseAdapter; import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.util.ArrayList; import java.util.ArrayList;
@ -132,7 +136,39 @@ public class UIComboCheckBox extends JComponent implements UIObserver, GlobalNam
} }
private UITextField createEditor() { private UITextField createEditor() {
UITextField editor = new UITextField(); UITextField editor = new UITextField() {
@Override
protected void initListener() {
this.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
attributeChange();
}
});
this.addFocusListener(new FocusAdapter() {
@Override
public void focusLost(FocusEvent e) {
attributeChange();
}
});
UIComboCheckBox.this.popup.addPopupMenuListener(new PopupMenuListener() {
@Override
public void popupMenuWillBecomeVisible(PopupMenuEvent e) {
// do nothing
}
@Override
public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {
attributeChange();
}
@Override
public void popupMenuCanceled(PopupMenuEvent e) {
// do nothing
}
});
}
};
editor.setEditable(false); editor.setEditable(false);
editor.setPreferredSize(new Dimension(110, 20)); editor.setPreferredSize(new Dimension(110, 20));
addPopupListener(editor); addPopupListener(editor);

3
designer-base/src/main/java/com/fr/design/gui/imenutable/UIMenuTableUI.java

@ -10,6 +10,7 @@ import javax.swing.event.MouseInputListener;
import com.fr.base.GraphHelper; import com.fr.base.GraphHelper;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.gui.itable.UITableUI; import com.fr.design.gui.itable.UITableUI;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
@ -74,7 +75,7 @@ public class UIMenuTableUI extends UITableUI{
@Override @Override
public void mousePressed(MouseEvent e) { public void mousePressed(MouseEvent e) {
if (e.getX() >= table.getWidth() - 20) { if (e.getX() >= table.getWidth() - 20) {
int val = JOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Utils_Are_You_Sure_To_Remove_The_Selected_Item") + "?", int val = FineJOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Utils_Are_You_Sure_To_Remove_The_Selected_Item") + "?",
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Remove"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE); com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Remove"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE);
if (val == JOptionPane.OK_OPTION) { if (val == JOptionPane.OK_OPTION) {
uiTable.removeLine(table.rowAtPoint(e.getPoint())); uiTable.removeLine(table.rowAtPoint(e.getPoint()));

13
designer-base/src/main/java/com/fr/design/gui/ispinner/UIBasicSpinner.java

@ -7,6 +7,9 @@ import javax.swing.*;
import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener; import javax.swing.event.DocumentListener;
import java.awt.*; import java.awt.*;
import java.awt.event.FocusAdapter;
import java.awt.event.FocusEvent;
import java.text.ParseException;
/** /**
* Created by IntelliJ IDEA. * Created by IntelliJ IDEA.
@ -56,8 +59,18 @@ public class UIBasicSpinner extends JSpinner implements UIObserver {
} }
}); });
} }
final JFormattedTextField textField = ((JSpinner.DefaultEditor) this.getEditor()).getTextField();
textField.addFocusListener(new FocusAdapter() {
@Override
public void focusLost(FocusEvent e) {
try {
textField.commitEdit();
} catch (ParseException ignore) {
} }
}
});
}
private void attributeChanged() { private void attributeChanged() {

3
designer-base/src/main/java/com/fr/design/gui/itable/UITableUI.java

@ -19,6 +19,7 @@ import javax.swing.table.TableModel;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.stable.Constants; import com.fr.stable.Constants;
@ -132,7 +133,7 @@ public class UITableUI extends BasicTableUI {
return; return;
} }
if (!table.isEditing()) { if (!table.isEditing()) {
int val = JOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Utils_Are_You_Sure_To_Remove_The_Selected_Item") + "?", int val = FineJOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Utils_Are_You_Sure_To_Remove_The_Selected_Item") + "?",
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Remove"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE); com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Remove"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE);
if (val == JOptionPane.OK_OPTION) { if (val == JOptionPane.OK_OPTION) {
((UITable) table).removeLine(table.rowAtPoint(e.getPoint())); ((UITable) table).removeLine(table.rowAtPoint(e.getPoint()));

5
designer-base/src/main/java/com/fr/design/gui/itableeditorpane/UITableModelAdapter.java

@ -1,6 +1,7 @@
package com.fr.design.gui.itableeditorpane; package com.fr.design.gui.itableeditorpane;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
@ -207,7 +208,7 @@ public abstract class UITableModelAdapter<T extends Object> extends AbstractTabl
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
final int selectedRow = table.getSelectedRow(); final int selectedRow = table.getSelectedRow();
if (selectedRow > table.getRowCount() - 1 || selectedRow < 0) { if (selectedRow > table.getRowCount() - 1 || selectedRow < 0) {
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_No-Alternatives")); FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_No-Alternatives"));
return; return;
} }
stopCellEditing(); stopCellEditing();
@ -251,7 +252,7 @@ public abstract class UITableModelAdapter<T extends Object> extends AbstractTabl
if(component == null){ if(component == null){
component = DesignerContext.getDesignerFrame(); component = DesignerContext.getDesignerFrame();
} }
int val = JOptionPane.showConfirmDialog(component, int val = FineJOptionPane.showConfirmDialog(component,
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Utils_Are_You_Sure_To_Remove_The_Selected_Item") + "?", com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Remove"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Utils_Are_You_Sure_To_Remove_The_Selected_Item") + "?", com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Remove"),
JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE); JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE);
if (val != JOptionPane.OK_OPTION) { if (val != JOptionPane.OK_OPTION) {

53
designer-base/src/main/java/com/fr/design/gui/itextfield/TextFieldUI.java

@ -1,53 +0,0 @@
package com.fr.design.gui.itextfield;
import java.awt.Graphics;
import javax.swing.plaf.metal.MetalTextFieldUI;
import javax.swing.text.JTextComponent;
import de.muntjak.tinylookandfeel.Theme;
public class TextFieldUI extends MetalTextFieldUI {
protected void paintBackground(Graphics g) {
JTextComponent editor = getComponent();
// We will only be here if editor is opaque, so we don't have to test
if(editor.isEnabled()) {
if(editor.isEditable()) {
g.setColor(editor.getBackground());
}
else {
// not editable
if(editor.getBackground().equals(Theme.textBgColor[Theme.style].getColor())) {
// set default panel background
g.setColor(Theme.backColor[Theme.style].getColor());
}
else {
// color changed by user - set textfield background
g.setColor(editor.getBackground());
}
}
g.fillRect(0, 0, editor.getWidth(), editor.getHeight());
}
else {
if(editor.getBackground().equals(Theme.textBgColor[Theme.style].getColor())) {
g.setColor(Theme.textDisabledBgColor[Theme.style].getColor());
}
else {
// color changed by user - set textfield background
g.setColor(editor.getBackground());
}
g.fillRect(0, 0, editor.getWidth(), editor.getHeight());
if(Theme.style != Theme.YQ_STYLE) return;
g.setColor(Theme.backColor[Theme.style].getColor());
g.drawRect(1, 1, editor.getWidth() - 3, editor.getHeight() - 3);
g.drawRect(2, 2, editor.getWidth() - 5, editor.getHeight() - 5);
}
}
}

5
designer-base/src/main/java/com/fr/design/gui/itree/refreshabletree/RefreshableJTree.java

@ -145,6 +145,11 @@ public abstract class RefreshableJTree extends CheckBoxTree {
refresh((ExpandMutableTreeNode) this.getModel().getRoot(), StringUtils.EMPTY); refresh((ExpandMutableTreeNode) this.getModel().getRoot(), StringUtils.EMPTY);
} }
//REPORT-24085,只刷新父节点
public void refreshParent(TreePath path) {
refresh((ExpandMutableTreeNode) path.getParentPath().getLastPathComponent(), StringUtils.EMPTY);
}
public void refreshChildByName(String childName) { public void refreshChildByName(String childName) {
refresh((ExpandMutableTreeNode) this.getModel().getRoot(), childName); refresh((ExpandMutableTreeNode) this.getModel().getRoot(), childName);
} }

5
designer-base/src/main/java/com/fr/design/gui/style/BackgroundPane.java

@ -32,7 +32,7 @@ public class BackgroundPane extends AbstractBasicStylePane {
protected BackgroundQuickPane[] paneList; protected BackgroundQuickPane[] paneList;
//获取当前面板 //获取当前面板
protected JPanel currentPane = null; protected BackgroundQuickPane currentPane = null;
public BackgroundPane() { public BackgroundPane() {
@ -43,7 +43,6 @@ public class BackgroundPane extends AbstractBasicStylePane {
this.setLayout(new BorderLayout(0, 6)); this.setLayout(new BorderLayout(0, 6));
typeComboBox = new UIComboBox(); typeComboBox = new UIComboBox();
final CardLayout cardlayout = new CardLayout(); final CardLayout cardlayout = new CardLayout();
// this.add(typeComboBox, BorderLayout.NORTH);
paneList = supportKindsOfBackgroundUI(); paneList = supportKindsOfBackgroundUI();
@ -58,12 +57,12 @@ public class BackgroundPane extends AbstractBasicStylePane {
typeComboBox.addItem(pane.title4PopupWindow()); typeComboBox.addItem(pane.title4PopupWindow());
centerPane.add(pane, pane.title4PopupWindow()); centerPane.add(pane, pane.title4PopupWindow());
} }
// this.add(centerPane, BorderLayout.CENTER);
typeComboBox.addItemListener(new ItemListener() { typeComboBox.addItemListener(new ItemListener() {
@Override @Override
public void itemStateChanged(ItemEvent e) { public void itemStateChanged(ItemEvent e) {
cardlayout.show(centerPane, (String) typeComboBox.getSelectedItem()); cardlayout.show(centerPane, (String) typeComboBox.getSelectedItem());
currentPane = paneList[typeComboBox.getSelectedIndex()];
fireStateChanged(); fireStateChanged();
} }
}); });

16
designer-base/src/main/java/com/fr/design/gui/style/BorderPane.java

@ -16,7 +16,6 @@ import com.fr.design.gui.icombobox.LineComboBox;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.backgroundpane.ColorBackgroundQuickPane;
import com.fr.design.style.color.NewColorSelectBox; import com.fr.design.style.color.NewColorSelectBox;
import com.fr.stable.Constants; import com.fr.stable.Constants;
@ -28,6 +27,7 @@ import javax.swing.event.ChangeListener;
import java.awt.*; import java.awt.*;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashSet; import java.util.HashSet;
import java.util.Set;
/** /**
* @author zhou * @author zhou
@ -37,6 +37,7 @@ public class BorderPane extends AbstractBasicStylePane implements GlobalNameObse
private static final String[] BORDERARRAY = {"currentLineCombo", "currentLineColorPane", "outerToggleButton", "topToggleButton", private static final String[] BORDERARRAY = {"currentLineCombo", "currentLineColorPane", "outerToggleButton", "topToggleButton",
"leftToggleButton", "bottomToggleButton", "rightToggleButton", "innerToggleButton", "horizontalToggleButton", "verticalToggleButton"}; "leftToggleButton", "bottomToggleButton", "rightToggleButton", "innerToggleButton", "horizontalToggleButton", "verticalToggleButton"};
private static final Set<String> BORDER_SET = new HashSet<>(Arrays.asList(BORDERARRAY));
private boolean insideMode = false; private boolean insideMode = false;
private UIToggleButton topToggleButton; private UIToggleButton topToggleButton;
@ -193,26 +194,21 @@ public class BorderPane extends AbstractBasicStylePane implements GlobalNameObse
this.verticalToggleButton.setEnabled(this.insideMode); this.verticalToggleButton.setEnabled(this.insideMode);
} }
@Override
public Style update(Style style) { public Style update(Style style) {
if (style == null) { if (style == null) {
style = Style.DEFAULT_STYLE; style = Style.DEFAULT_STYLE;
} }
CellBorderStyle cellBorderStyle = this.update(); if (backgroundPane.currentPane.isBackgroundChange()) {
HashSet<String> borderSet = new HashSet<String>(Arrays.asList(BORDERARRAY));
style = style.deriveBackground(backgroundPane.update()); style = style.deriveBackground(backgroundPane.update());
if (backgroundPane.currentPane != backgroundPane.paneList[1]){
if (borderSet.contains(globalNameListener.getGlobalName())) {
style = style.deriveBorder(cellBorderStyle.getTopStyle(), cellBorderStyle.getTopColor(), cellBorderStyle.getBottomStyle(), cellBorderStyle.getBottomColor(),
cellBorderStyle.getLeftStyle(), cellBorderStyle.getLeftColor(), cellBorderStyle.getRightStyle(), cellBorderStyle.getRightColor());
} }
}else { if (BORDER_SET.contains(globalNameListener.getGlobalName())) {
if (borderSet.contains(globalNameListener.getGlobalName()) && !((ColorBackgroundQuickPane) backgroundPane.currentPane).isBackGroundColor()){ CellBorderStyle cellBorderStyle = this.update();
style = style.deriveBorder(cellBorderStyle.getTopStyle(), cellBorderStyle.getTopColor(), cellBorderStyle.getBottomStyle(), cellBorderStyle.getBottomColor(), style = style.deriveBorder(cellBorderStyle.getTopStyle(), cellBorderStyle.getTopColor(), cellBorderStyle.getBottomStyle(), cellBorderStyle.getBottomColor(),
cellBorderStyle.getLeftStyle(), cellBorderStyle.getLeftColor(), cellBorderStyle.getRightStyle(), cellBorderStyle.getRightColor()); cellBorderStyle.getLeftStyle(), cellBorderStyle.getLeftColor(), cellBorderStyle.getRightStyle(), cellBorderStyle.getRightColor());
} }
}
return style; return style;
} }

3
designer-base/src/main/java/com/fr/design/hyperlink/ReportletHyperlinkPane.java

@ -2,6 +2,7 @@ package com.fr.design.hyperlink;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.Parameter; import com.fr.base.Parameter;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.gui.frpane.ReportletParameterViewPane; import com.fr.design.gui.frpane.ReportletParameterViewPane;
import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.itableeditorpane.ParameterTableModel; import com.fr.design.gui.itableeditorpane.ParameterTableModel;
@ -122,7 +123,7 @@ public class ReportletHyperlinkPane extends AbstractHyperLinkPane<ReportletHyper
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
String tpl = northPane.getReportletName(); String tpl = northPane.getReportletName();
if (StringUtils.isBlank(tpl)) { if (StringUtils.isBlank(tpl)) {
JOptionPane.showMessageDialog(ReportletHyperlinkPane.this, Toolkit.i18nText("Fine-Design_Basic_Hyperlink_Please_Select_Reportlet") + ".", Toolkit.i18nText("Fine-Design_Basic_Message"), JOptionPane.WARNING_MESSAGE); FineJOptionPane.showMessageDialog(ReportletHyperlinkPane.this, Toolkit.i18nText("Fine-Design_Basic_Hyperlink_Please_Select_Reportlet") + ".", Toolkit.i18nText("Fine-Design_Basic_Alert"), JOptionPane.WARNING_MESSAGE);
northPane.requestButtonFocus(); northPane.requestButtonFocus();
return; return;
} }

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

@ -144,7 +144,8 @@ public abstract class JavaScriptActionPane extends UIComboBoxPane<JavaScript> {
return contentDBManiPane; return contentDBManiPane;
} }
public static JavaScriptActionPane defaultJavaScriptActionPane = new JavaScriptActionPane() { public static JavaScriptActionPane createDefaultJavaScriptActionPane() {
return new JavaScriptActionPane() {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@ -164,10 +165,12 @@ public abstract class JavaScriptActionPane extends UIComboBoxPane<JavaScript> {
return false; return false;
} }
@Override
public String[] getDefaultArgs() { public String[] getDefaultArgs() {
return new String[0]; return new String[0];
} }
}; };
}
/** /**
* 生成界面默认的组建 * 生成界面默认的组建

7
designer-base/src/main/java/com/fr/design/locale/impl/SplashMark.java

@ -15,14 +15,13 @@ import java.util.Map;
public class SplashMark implements LocaleMark<String> { public class SplashMark implements LocaleMark<String> {
private Map<Locale, String> map = new HashMap<Locale, String>(); private Map<Locale, String> map = new HashMap<Locale, String>();
private static final String SPLASH_PATH = "/com/fr/design/images/splash_10.gif"; private static final String SPLASH_PATH = "/com/fr/design/images/splash_10.png";
private static final String SPLASH_EN_PATH = "/com/fr/design/images/splash_10_en.gif"; private static final String SPLASH_EN_PATH = "/com/fr/design/images/splash_10_en.png";
private static final String SPLASH_JP_PATH = "/com/fr/design/images/splash_10_jp.gif";
public SplashMark() { public SplashMark() {
map.put(Locale.CHINA, SPLASH_PATH); map.put(Locale.CHINA, SPLASH_PATH);
map.put(Locale.KOREA, SPLASH_EN_PATH); map.put(Locale.KOREA, SPLASH_EN_PATH);
map.put(Locale.JAPAN, SPLASH_JP_PATH); map.put(Locale.JAPAN, SPLASH_EN_PATH);
map.put(Locale.US, SPLASH_EN_PATH); map.put(Locale.US, SPLASH_EN_PATH);
map.put(Locale.TAIWAN, SPLASH_EN_PATH); map.put(Locale.TAIWAN, SPLASH_EN_PATH);
} }

3
designer-base/src/main/java/com/fr/design/locale/impl/UserInfoMark.java

@ -19,10 +19,11 @@ public class UserInfoMark implements LocaleMark<String> {
private static final String EN_LOGIN_HTML = CloudCenter.getInstance().acquireUrlByKind("frlogin.en"); private static final String EN_LOGIN_HTML = CloudCenter.getInstance().acquireUrlByKind("frlogin.en");
private static final String TW_LOGIN_HTML = CloudCenter.getInstance().acquireUrlByKind("frlogin.tw"); private static final String TW_LOGIN_HTML = CloudCenter.getInstance().acquireUrlByKind("frlogin.tw");
private static final String JP_LOGIN_HTML = CloudCenter.getInstance().acquireUrlByKind("frlogin.jp"); private static final String JP_LOGIN_HTML = CloudCenter.getInstance().acquireUrlByKind("frlogin.jp");
private static final String KR_LOGIN_HTML = CloudCenter.getInstance().acquireUrlByKind("frlogin.kr");
public UserInfoMark() { public UserInfoMark() {
map.put(Locale.CHINA, CN_LOGIN_HTML); map.put(Locale.CHINA, CN_LOGIN_HTML);
map.put(Locale.KOREA, EN_LOGIN_HTML); map.put(Locale.KOREA, KR_LOGIN_HTML);
map.put(Locale.JAPAN, JP_LOGIN_HTML); map.put(Locale.JAPAN, JP_LOGIN_HTML);
map.put(Locale.US, EN_LOGIN_HTML); map.put(Locale.US, EN_LOGIN_HTML);
map.put(Locale.TAIWAN, TW_LOGIN_HTML); map.put(Locale.TAIWAN, TW_LOGIN_HTML);

6
designer-base/src/main/java/com/fr/design/locale/impl/VideoMark.java

@ -15,9 +15,9 @@ import java.util.Map;
public class VideoMark implements LocaleMark<String> { public class VideoMark implements LocaleMark<String> {
private Map<Locale, String> map = new HashMap<>(); private Map<Locale, String> map = new HashMap<>();
private static final String VIDEO_EN = CloudCenter.getInstance().acquireUrlByKind("bbs.video.en"); private static final String VIDEO_EN = CloudCenter.getInstance().acquireUrlByKind("bbs.video.en_US");
private static final String VIDEO_CN = CloudCenter.getInstance().acquireUrlByKind("bbs.video"); private static final String VIDEO_CN = CloudCenter.getInstance().acquireUrlByKind("bbs.video.zh_CN");
private static final String VIDEO_TW = CloudCenter.getInstance().acquireUrlByKind("bbs.video.tw"); private static final String VIDEO_TW = CloudCenter.getInstance().acquireUrlByKind("bbs.video.zh_TW");
public VideoMark() { public VideoMark() {
map.put(Locale.CHINA, VIDEO_CN); map.put(Locale.CHINA, VIDEO_CN);

18
designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java

@ -13,6 +13,7 @@ import com.fr.design.base.mode.DesignModeContext;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.data.DesignTableDataManager; import com.fr.design.data.DesignTableDataManager;
import com.fr.design.data.datapane.TableDataTreePane; import com.fr.design.data.datapane.TableDataTreePane;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.env.DesignerWorkspaceInfo; import com.fr.design.env.DesignerWorkspaceInfo;
import com.fr.design.event.DesignerOpenedListener; import com.fr.design.event.DesignerOpenedListener;
import com.fr.design.event.TargetModifiedEvent; import com.fr.design.event.TargetModifiedEvent;
@ -181,7 +182,8 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
@Override @Override
public void windowClosing(WindowEvent e) { public void windowClosing(WindowEvent e) {
//关闭前当前模板 停止编辑
HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().stopEditing();
SaveSomeTemplatePane saveSomeTempaltePane = new SaveSomeTemplatePane(true); SaveSomeTemplatePane saveSomeTempaltePane = new SaveSomeTemplatePane(true);
// 只有一个文件未保存时 // 只有一个文件未保存时
if (HistoryTemplateListCache.getInstance().getHistoryCount() == 1) { if (HistoryTemplateListCache.getInstance().getHistoryCount() == 1) {
@ -829,7 +831,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
} }
defaultTitleSB.append(username).append("@").append(envName).append("[").append(workspace.getDescription()).append("]"); defaultTitleSB.append(username).append("@").append(envName).append("[").append(workspace.getDescription()).append("]");
if (editingTemplate != null) { if (editingTemplate != null) {
String path = editingTemplate.getEditingFILE().getPath(); String path = editingTemplate.getPath();
if (!editingTemplate.getEditingFILE().exists()) { if (!editingTemplate.getEditingFILE().exists()) {
path = FILEFactory.MEM_PREFIX + path; path = FILEFactory.MEM_PREFIX + path;
} else if (path.startsWith(ProjectConstants.REPORTLETS_NAME)) { } else if (path.startsWith(ProjectConstants.REPORTLETS_NAME)) {
@ -920,9 +922,9 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
} else { } else {
editingTemplate.stopEditing(); editingTemplate.stopEditing();
if (!editingTemplate.getEditingFILE().exists()) { if (!editingTemplate.getEditingFILE().exists()) {
int returnVal = JOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), int returnVal = FineJOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(),
Toolkit.i18nText("Fine-Design_Basic_Utils_Would_You_Like_To_Save") + " \"" + editingTemplate.getEditingFILE() Toolkit.i18nText("Fine-Design_Basic_Utils_Would_You_Like_To_Save") + " \"" + editingTemplate.getEditingFILE()
+ "\" ?", ProductConstants.PRODUCT_NAME, JOptionPane.YES_NO_OPTION, + "\" ?", Toolkit.i18nText("Fine-Design_Basic_Confirm"), JOptionPane.YES_NO_OPTION,
JOptionPane.QUESTION_MESSAGE); JOptionPane.QUESTION_MESSAGE);
if (returnVal == JOptionPane.YES_OPTION && editingTemplate.saveTemplate()) { if (returnVal == JOptionPane.YES_OPTION && editingTemplate.saveTemplate()) {
editingTemplate.saveTemplate(); editingTemplate.saveTemplate();
@ -1034,10 +1036,10 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
// p:判断一下,如何文件为空或者文件不存在,直接返回. // p:判断一下,如何文件为空或者文件不存在,直接返回.
if (tplFile == null || !tplFile.exists()) { if (tplFile == null || !tplFile.exists()) {
JOptionPane.showMessageDialog( FineJOptionPane.showMessageDialog(
this, this,
Toolkit.i18nText("Fine-Design_Basic_Warning_Template_Do_Not_Exsit"), Toolkit.i18nText("Fine-Design_Basic_Warning_Template_Do_Not_Exsit"),
ProductConstants.PRODUCT_NAME, Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"),
JOptionPane.INFORMATION_MESSAGE JOptionPane.INFORMATION_MESSAGE
); );
DesignerFrameFileDealerPane.getInstance().refresh(); DesignerFrameFileDealerPane.getInstance().refresh();
@ -1047,10 +1049,10 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
try { try {
openFile(tplFile); openFile(tplFile);
} catch (DecryptTemplateException e) { } catch (DecryptTemplateException e) {
JOptionPane.showMessageDialog( FineJOptionPane.showMessageDialog(
this, this,
Toolkit.i18nText("Fine-Design_Encrypt_Decrypt_Exception"), Toolkit.i18nText("Fine-Design_Encrypt_Decrypt_Exception"),
UIManager.getString("OptionPane.messageDialogTitle"), Toolkit.i18nText("Fine-Design_Basic_Alert"),
JOptionPane.WARNING_MESSAGE, JOptionPane.WARNING_MESSAGE,
UIManager.getIcon("OptionPane.errorIcon") UIManager.getIcon("OptionPane.errorIcon")
); );

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

@ -3,8 +3,6 @@ package com.fr.design.mainframe;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.extension.FileExtension; import com.fr.base.extension.FileExtension;
import com.fr.base.vcs.DesignerMode; import com.fr.base.vcs.DesignerMode;
import com.fr.cluster.ClusterBridge;
import com.fr.cluster.engine.base.FineClusterConfig;
import com.fr.design.DesignModelAdapter; import com.fr.design.DesignModelAdapter;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.ExtraDesignClassManager; import com.fr.design.ExtraDesignClassManager;
@ -13,6 +11,7 @@ import com.fr.design.constants.UIConstants;
import com.fr.design.data.DesignTableDataManager; import com.fr.design.data.DesignTableDataManager;
import com.fr.design.data.datapane.TableDataTreePane; import com.fr.design.data.datapane.TableDataTreePane;
import com.fr.design.data.tabledata.ResponseDataSourceChange; import com.fr.design.data.tabledata.ResponseDataSourceChange;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.file.FileOperations; import com.fr.design.file.FileOperations;
import com.fr.design.file.FileToolbarStateChangeListener; import com.fr.design.file.FileToolbarStateChangeListener;
import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.file.HistoryTemplateListCache;
@ -326,9 +325,9 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
public void actionPerformed(ActionEvent evt) { public void actionPerformed(ActionEvent evt) {
if (!selectedOperation.access()) { if (!selectedOperation.access()) {
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(),
Toolkit.i18nText("Fine-Design_Basic_Template_Permission_Denied"), Toolkit.i18nText("Fine-Design_Basic_Template_Permission_Denied"),
Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"), Toolkit.i18nText("Fine-Design_Basic_Alert"),
WARNING_MESSAGE); WARNING_MESSAGE);
return; return;
} }
@ -369,7 +368,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
private void fireVcsActionChange() { private void fireVcsActionChange() {
if (!DesignerEnvManager.getEnvManager().getVcsConfigManager().isVcsEnable() if (!DesignerEnvManager.getEnvManager().getVcsConfigManager().isVcsEnable()
|| VcsHelper.getInstance().isUnSelectedTemplate() || VcsHelper.getInstance().isUnSelectedTemplate()
|| FineClusterConfig.getInstance().isCluster()) { || WorkContext.getCurrent().isCluster()) {
setEnabled(false); setEnabled(false);
return; return;
} }
@ -468,9 +467,9 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
@Override @Override
public void actionPerformed(ActionEvent evt) { public void actionPerformed(ActionEvent evt) {
if (!selectedOperation.access()) { if (!selectedOperation.access()) {
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(),
Toolkit.i18nText("Fine-Design_Basic_Template_Permission_Denied"), Toolkit.i18nText("Fine-Design_Basic_Template_Permission_Denied"),
Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"), Toolkit.i18nText("Fine-Design_Basic_Alert"),
WARNING_MESSAGE); WARNING_MESSAGE);
return; return;
} }
@ -479,9 +478,9 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
String lock = node.getLock(); String lock = node.getLock();
if (lock != null && !lock.equals(node.getUserID())) { if (lock != null && !lock.equals(node.getUserID())) {
// 提醒被锁定模板无法重命名 // 提醒被锁定模板无法重命名
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(),
Toolkit.i18nText("Fine-Design_Basic_Unable_Rename_Locked_File"), Toolkit.i18nText("Fine-Design_Basic_Unable_Rename_Locked_File"),
Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"), Toolkit.i18nText("Fine-Design_Basic_Alert"),
WARNING_MESSAGE); WARNING_MESSAGE);
return; return;
} }
@ -508,9 +507,9 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
public void actionPerformed(ActionEvent evt) { public void actionPerformed(ActionEvent evt) {
if (!selectedOperation.access()) { if (!selectedOperation.access()) {
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(),
Toolkit.i18nText("Fine-Design_Basic_Template_Permission_Denied"), Toolkit.i18nText("Fine-Design_Basic_Template_Permission_Denied"),
Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"), Toolkit.i18nText("Fine-Design_Basic_Alert"),
WARNING_MESSAGE); WARNING_MESSAGE);
return; return;
} }
@ -707,9 +706,9 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
selectedOperation.refresh(); selectedOperation.refresh();
DesignerContext.getDesignerFrame().setTitle(); DesignerContext.getDesignerFrame().setTitle();
} else { } else {
JOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), FineJOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(),
Toolkit.i18nText("Fine-Design_Basic_Rename_Failure"), Toolkit.i18nText("Fine-Design_Basic_Rename_Failure"),
UIManager.getString("OptionPane.messageDialogTitle"), Toolkit.i18nText("Fine-Design_Basic_Error"),
JOptionPane.DEFAULT_OPTION, JOptionPane.DEFAULT_OPTION,
JOptionPane.ERROR_MESSAGE); JOptionPane.ERROR_MESSAGE);
} }
@ -898,9 +897,9 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
selectedOperation.refresh(); selectedOperation.refresh();
this.dispose(); this.dispose();
if (!success) { if (!success) {
JOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), FineJOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(),
Toolkit.i18nText("Fine-Design_Basic_Make_Failure"), Toolkit.i18nText("Fine-Design_Basic_Make_Failure"),
UIManager.getString("OptionPane.messageDialogTitle"), Toolkit.i18nText("Fine-Design_Basic_Error"),
JOptionPane.DEFAULT_OPTION, JOptionPane.DEFAULT_OPTION,
JOptionPane.ERROR_MESSAGE); JOptionPane.ERROR_MESSAGE);
} }

5
designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java

@ -458,10 +458,15 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
} }
private void refreshContainer() { private void refreshContainer() {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
validate(); validate();
repaint(); repaint();
revalidate(); revalidate();
} }
});
}
public int getToolPaneY() { public int getToolPaneY() {
return 0; return 0;

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

@ -4,7 +4,6 @@ import com.fr.base.BaseUtils;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.base.Parameter; import com.fr.base.Parameter;
import com.fr.base.ScreenResolution; import com.fr.base.ScreenResolution;
import com.fr.base.extension.FileExtension;
import com.fr.base.io.BaseBook; import com.fr.base.io.BaseBook;
import com.fr.base.iofile.attr.DesignBanCopyAttrMark; import com.fr.base.iofile.attr.DesignBanCopyAttrMark;
import com.fr.base.iofile.attr.TemplateIdAttrMark; import com.fr.base.iofile.attr.TemplateIdAttrMark;
@ -22,13 +21,14 @@ import com.fr.design.actions.file.WebPreviewUtils;
import com.fr.design.base.mode.DesignModeContext; import com.fr.design.base.mode.DesignModeContext;
import com.fr.design.designer.DesignerProxy; import com.fr.design.designer.DesignerProxy;
import com.fr.design.designer.TargetComponent; import com.fr.design.designer.TargetComponent;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.dialog.InformationWarnPane; import com.fr.design.dialog.InformationWarnPane;
import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.file.TemplateTreePane; import com.fr.design.file.TemplateTreePane;
import com.fr.design.fun.DesignerFrameUpButtonProvider; import com.fr.design.fun.DesignerFrameUpButtonProvider;
import com.fr.design.fun.MenuHandler; import com.fr.design.fun.MenuHandler;
import com.fr.design.fun.ReportSupportedFileUIProvider;
import com.fr.design.fun.PreviewProvider; import com.fr.design.fun.PreviewProvider;
import com.fr.design.fun.ReportSupportedFileUIProvider;
import com.fr.design.gui.frpane.HyperlinkGroupPane; import com.fr.design.gui.frpane.HyperlinkGroupPane;
import com.fr.design.gui.frpane.HyperlinkGroupPaneActionProvider; import com.fr.design.gui.frpane.HyperlinkGroupPaneActionProvider;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
@ -36,6 +36,7 @@ import com.fr.design.gui.imenu.UIMenuItem;
import com.fr.design.gui.itree.filetree.TemplateFileTree; import com.fr.design.gui.itree.filetree.TemplateFileTree;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.chart.info.ChartInfoCollector;
import com.fr.design.mainframe.template.info.TemplateInfoCollector; import com.fr.design.mainframe.template.info.TemplateInfoCollector;
import com.fr.design.mainframe.template.info.TemplateProcessInfo; import com.fr.design.mainframe.template.info.TemplateProcessInfo;
import com.fr.design.mainframe.template.info.TimeConsumeTimer; import com.fr.design.mainframe.template.info.TimeConsumeTimer;
@ -50,7 +51,6 @@ import com.fr.design.write.submit.DBManipulationPane;
import com.fr.file.FILE; import com.fr.file.FILE;
import com.fr.file.FILEChooserPane; import com.fr.file.FILEChooserPane;
import com.fr.file.MemFILE; import com.fr.file.MemFILE;
import com.fr.file.filter.ChooseFileFilter;
import com.fr.form.ui.NoneWidget; import com.fr.form.ui.NoneWidget;
import com.fr.form.ui.Widget; import com.fr.form.ui.Widget;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
@ -58,6 +58,7 @@ import com.fr.log.FineLoggerFactory;
import com.fr.report.cell.Elem; import com.fr.report.cell.Elem;
import com.fr.report.cell.cellattr.CellImage; import com.fr.report.cell.cellattr.CellImage;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.stable.Filter;
import com.fr.stable.ProductConstants; import com.fr.stable.ProductConstants;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.stable.core.UUID; import com.fr.stable.core.UUID;
@ -70,11 +71,11 @@ import javax.swing.JComponent;
import javax.swing.JOptionPane; import javax.swing.JOptionPane;
import javax.swing.tree.DefaultMutableTreeNode; import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.undo.UndoManager; import javax.swing.undo.UndoManager;
import java.awt.BorderLayout;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Set; import java.util.Set;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import java.awt.BorderLayout;
/** /**
* 报表设计和表单设计的编辑区域(设计器编辑的IO文件) * 报表设计和表单设计的编辑区域(设计器编辑的IO文件)
@ -164,6 +165,7 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
} }
private void collectInfo(String originID) { // 执行收集操作 private void collectInfo(String originID) { // 执行收集操作
ChartInfoCollector.getInstance().collectInfo(template.getTemplateID(), originID, getProcessInfo(), 0);
if (!consumeTimer.isEnabled()) { if (!consumeTimer.isEnabled()) {
return; return;
} }
@ -244,6 +246,19 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
} }
/**
* 刷新内部资源
*/
public void refreshResource() {
try {
this.template = JTemplateFactory.asIOFile(this.editingFILE);
setTarget(this.template);
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
}
/** /**
* 刷新容器 * 刷新容器
*/ */
@ -541,7 +556,7 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
if (!access) { if (!access) {
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Template_Permission_Denied") + "!", com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Message"), JOptionPane.WARNING_MESSAGE); FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Template_Permission_Denied") + "!", com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Alert"), JOptionPane.WARNING_MESSAGE);
return false; return false;
} }
collectInfo(); collectInfo();
@ -595,10 +610,10 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
if (!access) { if (!access) {
JOptionPane.showMessageDialog( FineJOptionPane.showMessageDialog(
DesignerContext.getDesignerFrame(), DesignerContext.getDesignerFrame(),
Toolkit.i18nText("Fine-Design_Basic_Template_Permission_Denied") + "!", Toolkit.i18nText("Fine-Design_Basic_Template_Permission_Denied") + "!",
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Message"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Alert"),
JOptionPane.WARNING_MESSAGE); JOptionPane.WARNING_MESSAGE);
return false; return false;
} }
@ -619,10 +634,10 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
} }
return saved; return saved;
} else { } else {
JOptionPane.showMessageDialog( FineJOptionPane.showMessageDialog(
DesignerContext.getDesignerFrame(), DesignerContext.getDesignerFrame(),
Toolkit.i18nText("Fine-Design-Basic_Save_Failure"), Toolkit.i18nText("Fine-Design-Basic_Save_Failure"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Message"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Alert"),
JOptionPane.WARNING_MESSAGE); JOptionPane.WARNING_MESSAGE);
return false; return false;
} }
@ -1154,7 +1169,12 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
* @return 预览模式 * @return 预览模式
*/ */
public PreviewProvider[] supportPreview() { public PreviewProvider[] supportPreview() {
return new PreviewProvider[0]; return ExtraDesignClassManager.getInstance().getTemplatePreviews(new Filter<PreviewProvider>() {
@Override
public boolean accept(PreviewProvider previewProvider) {
return previewProvider.accept(JTemplate.this);
}
});
} }
/** /**
@ -1214,4 +1234,9 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
} }
public abstract String route(); public abstract String route();
public String getTemplateName() {
return getEditingFILE().getName();
}
} }

23
designer-base/src/main/java/com/fr/design/mainframe/JTemplateFactory.java

@ -1,5 +1,6 @@
package com.fr.design.mainframe; package com.fr.design.mainframe;
import com.fr.base.io.BaseBook;
import com.fr.file.FILE; import com.fr.file.FILE;
import com.fr.stable.CoreConstants; import com.fr.stable.CoreConstants;
import com.fr.third.javax.annotation.Nonnull; import com.fr.third.javax.annotation.Nonnull;
@ -43,6 +44,28 @@ public final class JTemplateFactory {
return null; return null;
} }
public static <T extends BaseBook> T asIOFile(@Nonnull FILE file) {
String fileName = file.getName();
int indexOfLastDot = fileName.lastIndexOf(CoreConstants.DOT);
if (indexOfLastDot < 0) {
return null;
}
String fileExtension = fileName.substring(indexOfLastDot + 1);
for (App<?> app : ALL_APP) {
String[] defaultAppExtensions = app.defaultExtensions();
for (String defaultAppExtension : defaultAppExtensions) {
if (defaultAppExtension.equalsIgnoreCase(fileExtension)) {
BaseBook bb = app.asIOFile(file);
if (bb != null) {
return (T) bb;
}
}
}
}
return null;
}
/** /**
* 注册app. * 注册app.

3
designer-base/src/main/java/com/fr/design/mainframe/UndoStateEdit.java

@ -2,6 +2,7 @@ package com.fr.design.mainframe;
import com.fr.base.vcs.DesignerMode; import com.fr.base.vcs.DesignerMode;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.roleAuthority.RolesAlreadyEditedPane; import com.fr.design.roleAuthority.RolesAlreadyEditedPane;
@ -43,7 +44,7 @@ public class UndoStateEdit extends AbstractUndoableEdit {
public void undo() throws CannotUndoException { public void undo() throws CannotUndoException {
super.undo(); super.undo();
if (cur.getAuthorityType() == BaseUndoState.AUTHORITY_STATE) { if (cur.getAuthorityType() == BaseUndoState.AUTHORITY_STATE) {
int returnVal = JOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Undo_All_Authority_Operations") + "?", int returnVal = FineJOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Undo_All_Authority_Operations") + "?",
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Undo"), JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Undo"), JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
if (returnVal == JOptionPane.NO_OPTION) { if (returnVal == JOptionPane.NO_OPTION) {
return; return;

26
designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/BackgroundQuickPane.java

@ -2,14 +2,20 @@ package com.fr.design.mainframe.backgroundpane;
import com.fr.design.beans.BasicBeanPane; import com.fr.design.beans.BasicBeanPane;
import com.fr.design.event.UIObserver; import com.fr.design.event.UIObserver;
import com.fr.design.event.UIObserverListener;
import com.fr.general.Background; import com.fr.general.Background;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
/** /**
* @author zhou * @author zhou
* @since 2012-5-29下午1:12:28 * @since 2012-5-29下午1:12:28
*/ */
public abstract class BackgroundQuickPane extends BasicBeanPane<Background> implements UIObserver { public abstract class BackgroundQuickPane extends BasicBeanPane<Background> implements UIObserver {
private boolean backgroundChange;
public abstract boolean accept(Background background); public abstract boolean accept(Background background);
@Override @Override
@ -23,6 +29,10 @@ public abstract class BackgroundQuickPane extends BasicBeanPane<Background> impl
public abstract void reset(); public abstract void reset();
public boolean isBackgroundChange() {
return backgroundChange;
}
/** /**
* 组件是否需要响应添加的观察者事件 * 组件是否需要响应添加的观察者事件
* *
@ -32,4 +42,20 @@ public abstract class BackgroundQuickPane extends BasicBeanPane<Background> impl
return true; return true;
} }
class ChangeListenerImpl implements ChangeListener {
private UIObserverListener listener;
public ChangeListenerImpl(UIObserverListener listener) {
this.listener = listener;
}
@Override
public void stateChanged(ChangeEvent e) {
backgroundChange = true;
this.listener.doChange();
backgroundChange = false;
}
}
} }

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

@ -19,7 +19,6 @@ import java.awt.Color;
public class ColorBackgroundQuickPane extends BackgroundQuickPane { public class ColorBackgroundQuickPane extends BackgroundQuickPane {
private NewColorSelectPane detailColorSelectPane; private NewColorSelectPane detailColorSelectPane;
private boolean isBackGroundColor;
public ColorBackgroundQuickPane() { public ColorBackgroundQuickPane() {
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
@ -39,7 +38,6 @@ public class ColorBackgroundQuickPane extends BackgroundQuickPane {
public void populateColor(Color color) { public void populateColor(Color color) {
this.detailColorSelectPane.setColor(color); this.detailColorSelectPane.setColor(color);
isBackGroundColor = false;
} }
public Color updateColor() { public Color updateColor() {
@ -47,23 +45,14 @@ public class ColorBackgroundQuickPane extends BackgroundQuickPane {
return this.detailColorSelectPane.getNotNoneColor(); return this.detailColorSelectPane.getNotNoneColor();
} }
public boolean isBackGroundColor() {
return isBackGroundColor;
}
/** /**
* 给组件登记一个观察者监听事件 * 给组件登记一个观察者监听事件
* *
* @param listener 观察者监听事件 * @param listener 观察者监听事件
*/ */
@Override
public void registerChangeListener(final UIObserverListener listener) { public void registerChangeListener(final UIObserverListener listener) {
detailColorSelectPane.addChangeListener(new ChangeListener() { detailColorSelectPane.addChangeListener(new ChangeListenerImpl(listener));
public void stateChanged(ChangeEvent e) {
isBackGroundColor = true;
listener.doChange();
isBackGroundColor = false;
}
});
} }
@Override @Override

13
designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/GradientBackgroundQuickPane.java

@ -96,17 +96,10 @@ public class GradientBackgroundQuickPane extends BackgroundQuickPane {
* *
* @param listener 观察者监听事件 * @param listener 观察者监听事件
*/ */
@Override
public void registerChangeListener(final UIObserverListener listener) { public void registerChangeListener(final UIObserverListener listener) {
gradientBar.addChangeListener(new ChangeListener() { gradientBar.addChangeListener(new ChangeListenerImpl(listener));
public void stateChanged(ChangeEvent e) { directionPane.addChangeListener(new ChangeListenerImpl(listener));
listener.doChange();
}
});
directionPane.addChangeListener(new ChangeListener() {
public void stateChanged(ChangeEvent e) {
listener.doChange();
}
});
} }
@Override @Override

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

@ -127,12 +127,7 @@ public class ImageBackgroundQuickPane extends BackgroundQuickPane {
*/ */
@Override @Override
public void registerChangeListener(final UIObserverListener listener) { public void registerChangeListener(final UIObserverListener listener) {
changeListener = new ChangeListener() { changeListener = new ChangeListenerImpl(listener);
@Override
public void stateChanged(ChangeEvent e) {
listener.doChange();
}
};
imageLayoutPane.addChangeListener(changeListener); imageLayoutPane.addChangeListener(changeListener);
} }

4
designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/NullBackgroundQuickPane.java

@ -33,6 +33,10 @@ public class NullBackgroundQuickPane extends BackgroundQuickPane {
} }
@Override
public boolean isBackgroundChange() {
return true;
}
/** /**
* 是否接受 * 是否接受

19
designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/PatternBackgroundQuickPane.java

@ -112,23 +112,12 @@ public class PatternBackgroundQuickPane extends BackgroundQuickPane {
* *
* @param listener 观察者监听事件 * @param listener 观察者监听事件
*/ */
@Override
public void registerChangeListener(final UIObserverListener listener) { public void registerChangeListener(final UIObserverListener listener) {
foregroundColorPane.addSelectChangeListener(new ChangeListener() { foregroundColorPane.addSelectChangeListener(new ChangeListenerImpl(listener));
public void stateChanged(ChangeEvent e) { backgroundColorPane.addSelectChangeListener(new ChangeListenerImpl(listener));
listener.doChange();
}
});
backgroundColorPane.addSelectChangeListener(new ChangeListener() {
public void stateChanged(ChangeEvent e) {
listener.doChange();
}
});
for (int i = 0, count = patternButtonArray.length; i < count; i++) { for (int i = 0, count = patternButtonArray.length; i < count; i++) {
patternButtonArray[i].addChangeListener(new ChangeListener() { patternButtonArray[i].addChangeListener(new ChangeListenerImpl(listener));
public void stateChanged(ChangeEvent e) {
listener.doChange();
}
});
} }
} }

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

@ -68,13 +68,10 @@ public class TextureBackgroundQuickPane extends BackgroundQuickPane {
* *
* @param listener 观察者监听事件 * @param listener 观察者监听事件
*/ */
@Override
public void registerChangeListener(final UIObserverListener listener) { public void registerChangeListener(final UIObserverListener listener) {
for (int i = 0, count = textureButtonArray.length; i < count; i++) { for (int i = 0, count = textureButtonArray.length; i < count; i++) {
textureButtonArray[i].addChangeListener(new ChangeListener() { textureButtonArray[i].addChangeListener(new ChangeListenerImpl(listener));
public void stateChanged(ChangeEvent e) {
listener.doChange();
}
});
} }
} }

130
designer-base/src/main/java/com/fr/design/mainframe/burying/point/AbstractPointCollector.java

@ -0,0 +1,130 @@
package com.fr.design.mainframe.burying.point;
import com.fr.base.FRContext;
import com.fr.base.io.XMLReadHelper;
import com.fr.design.DesignerEnvManager;
import com.fr.design.mainframe.template.info.SendHelper;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.xml.XMLPrintWriter;
import com.fr.stable.xml.XMLTools;
import com.fr.stable.xml.XMLableReader;
import com.fr.third.javax.xml.stream.XMLStreamException;
import com.fr.third.org.apache.commons.io.FileUtils;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
/**
* @author Bjorn
* @version 10.0
* Created by Bjorn on 2020-02-21
*/
public abstract class AbstractPointCollector<T extends AbstractPointInfo> implements BasePointCollector {
protected Map<String, T> pointInfoMap;
private static final int MAX_SIZE = 512 * 1024 * 1024;
public AbstractPointCollector() {
pointInfoMap = new ConcurrentHashMap<>();
loadFromFile();
}
/**
* 获取是否满足触发埋点的要求
*/
protected boolean shouldCollectInfo() {
return FileUtils.sizeOf(getInfoFile()) <= MAX_SIZE && DesignerEnvManager.getEnvManager().isJoinProductImprove() && FRContext.isChineseEnv();
}
@Override
public void sendPointInfo() {
addIdleDayCount();
List<String> removeList = new ArrayList<>();
List<String> sendList = new ArrayList<>();
for (String key : pointInfoMap.keySet()) {
AbstractPointInfo pointInfo = pointInfoMap.get(key);
pointInfo.selectPoint(removeList, sendList);
}
// 发送记录
for (String key : sendList) {
if(SendHelper.sendPointInfo(pointInfoMap.get(key))){
removeList.add(key);
}
}
// 清空记录
for (String key : removeList) {
pointInfoMap.remove(key);
}
saveInfo();
}
/**
* 从文件中读取埋点信息
*/
protected void loadFromFile() {
if (!getInfoFile().exists()) {
return;
}
XMLableReader reader = null;
try (InputStream in = new FileInputStream(getInfoFile())) {
// XMLableReader 还是应该考虑实现 Closable 接口的,这样就能使用 try-with 语句了
reader = XMLReadHelper.createXMLableReader(in, XMLPrintWriter.XML_ENCODER);
if (reader == null) {
return;
}
reader.readXMLObject(this);
} catch (FileNotFoundException e) {
// do nothing
} catch (XMLStreamException | IOException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
} finally {
try {
if (reader != null) {
reader.close();
}
} catch (XMLStreamException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
}
}
/**
* 保存埋点信息到文件中
*/
protected void saveInfo() {
try {
ByteArrayOutputStream out = new ByteArrayOutputStream();
XMLTools.writeOutputStreamXML(this, out);
out.flush();
out.close();
String fileContent = new String(out.toByteArray(), StandardCharsets.UTF_8);
FileUtils.writeStringToFile(getInfoFile(), fileContent, StandardCharsets.UTF_8);
} catch (Exception ex) {
FineLoggerFactory.getLogger().error(ex.getMessage());
}
}
/**
* 获取缓存文件存放路径
*/
protected abstract File getInfoFile();
protected abstract void addIdleDayCount();
}

55
designer-base/src/main/java/com/fr/design/mainframe/burying/point/AbstractPointInfo.java

@ -0,0 +1,55 @@
package com.fr.design.mainframe.burying.point;
import java.util.List;
/**
* @author Bjorn
* @version 10.0
* Created by Bjorn on 2020-02-21
*/
public abstract class AbstractPointInfo implements BasePointInfo {
protected int idleDayCount; // 到现在为止,埋点闲置的天数
@Override
public void resetIdleDayCount() {
this.idleDayCount = 0;
}
@Override
public void addIdleDayCountByOne() {
this.idleDayCount += 1;
}
/**
* 上传前判断该埋点是否需要被上传或者删除或者什么都不做
*/
@Override
public void selectPoint(List<String> removeList, List<String> sendList) {
//埋点还未完成,直接返回
if (!isComplete()) {
return;
}
//属于测试模板,直接删除,否则发送信息
if (isTestTemplate()) {
removeList.add(key());
} else {
sendList.add(key());
}
}
/**
* 是否为测试模板
*/
protected abstract boolean isTestTemplate();
/**
* 是否已经制作完成
*/
protected abstract boolean isComplete();
/**
* 埋点记录的主键
*/
protected abstract String key();
}

23
designer-base/src/main/java/com/fr/design/mainframe/burying/point/BasePointCollector.java

@ -0,0 +1,23 @@
package com.fr.design.mainframe.burying.point;
import com.fr.design.mainframe.template.info.TemplateProcessInfo;
import com.fr.stable.xml.XMLReadable;
import com.fr.stable.xml.XMLWriter;
/**
* @author Bjorn
* @version 10.0
* Created by Bjorn on 2020-02-21
*/
public interface BasePointCollector extends XMLReadable, XMLWriter {
/**
* 发送埋点信息到服务器
*/
public void sendPointInfo();
/**
* 保存埋点的信息到本地
*/
public void collectInfo(String templateID, String originID, TemplateProcessInfo processInfo, int timeConsume);
}

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save