Browse Source

Merge branch 'final/10.0' into persist/10.0

persist/10.0
jeo 6 years ago
parent
commit
1f7ef2189f
  1. 15
      designer-base/src/main/java/com/fr/design/DesignerEnvManager.java
  2. 2
      designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java
  3. 9
      designer-base/src/main/java/com/fr/design/actions/community/UpAction.java
  4. 11
      designer-base/src/main/java/com/fr/design/actions/core/ActionFactory.java
  5. 19
      designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java
  6. 16
      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. 17
      designer-base/src/main/java/com/fr/design/actions/help/FeedBackPane.java
  9. 9
      designer-base/src/main/java/com/fr/design/actions/help/ForumAction.java
  10. 8
      designer-base/src/main/java/com/fr/design/actions/help/TutorialAction.java
  11. 12
      designer-base/src/main/java/com/fr/design/condition/ConditionAttributesPane.java
  12. 10
      designer-base/src/main/java/com/fr/design/data/BasicTableDataTreePane.java
  13. 7
      designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java
  14. 18
      designer-base/src/main/java/com/fr/design/data/datapane/ChoosePane.java
  15. 8
      designer-base/src/main/java/com/fr/design/data/datapane/ChoosePaneSupportFormula.java
  16. 14
      designer-base/src/main/java/com/fr/design/data/datapane/TableDataNameObjectCreator.java
  17. 8
      designer-base/src/main/java/com/fr/design/data/datapane/VerticalChoosePane.java
  18. 13
      designer-base/src/main/java/com/fr/design/data/datapane/preview/PreviewTableModel.java
  19. 9
      designer-base/src/main/java/com/fr/design/data/datapane/preview/PreviewTablePane.java
  20. 2
      designer-base/src/main/java/com/fr/design/data/datapane/sqlpane/SQLEditPane.java
  21. 6
      designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java
  22. 7
      designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/DecoratedTableDataPane.java
  23. 31
      designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/EmbeddedTableDataDefinedPane.java
  24. 45
      designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/EmbeddedTableDataPane.java
  25. 40
      designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/FileTableDataPane.java
  26. 11
      designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/StoreProcedureDataWrapper.java
  27. 5
      designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/StoreProcedureNameWrapper.java
  28. 3
      designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/TableDataFactory.java
  29. 2
      designer-base/src/main/java/com/fr/design/designer/IntervalConstants.java
  30. 28
      designer-base/src/main/java/com/fr/design/dialog/UIDialog.java
  31. 10
      designer-base/src/main/java/com/fr/design/editor/editor/DateEditor.java
  32. 8
      designer-base/src/main/java/com/fr/design/extra/PluginConstants.java
  33. 10
      designer-base/src/main/java/com/fr/design/extra/PluginFromStorePane.java
  34. 7
      designer-base/src/main/java/com/fr/design/extra/PluginOperateUtils.java
  35. 4
      designer-base/src/main/java/com/fr/design/extra/PluginWebBridge.java
  36. 2
      designer-base/src/main/java/com/fr/design/extra/PluginsReaderFromStore.java
  37. 18
      designer-base/src/main/java/com/fr/design/extra/QQLoginWebPane.java
  38. 7
      designer-base/src/main/java/com/fr/design/extra/WebViewDlgHelper.java
  39. 22
      designer-base/src/main/java/com/fr/design/formula/FormulaPane.java
  40. 25
      designer-base/src/main/java/com/fr/design/formula/FunctionConstants.java
  41. 14
      designer-base/src/main/java/com/fr/design/formula/JavaEditorPane.java
  42. 4
      designer-base/src/main/java/com/fr/design/gui/controlpane/CommonShortCutHandlers.java
  43. 28
      designer-base/src/main/java/com/fr/design/gui/controlpane/UIControlPane.java
  44. 10
      designer-base/src/main/java/com/fr/design/gui/core/CustomWidgetOption.java
  45. 10
      designer-base/src/main/java/com/fr/design/gui/core/UITextComponent.java
  46. 9
      designer-base/src/main/java/com/fr/design/gui/date/SingleObjectComboBoxModel.java
  47. 17
      designer-base/src/main/java/com/fr/design/gui/date/UIDatePicker.java
  48. 15
      designer-base/src/main/java/com/fr/design/gui/demo/LoadingPaneDemo.java
  49. 10
      designer-base/src/main/java/com/fr/design/gui/frpane/LoadingBasicPaneTest.java
  50. 33
      designer-base/src/main/java/com/fr/design/gui/frpane/UIBubbleFloatPane.java
  51. 44
      designer-base/src/main/java/com/fr/design/gui/ibutton/UIButton.java
  52. 15
      designer-base/src/main/java/com/fr/design/gui/ibutton/UIButtonGroup.java
  53. 20
      designer-base/src/main/java/com/fr/design/gui/ibutton/UIHeadGroup.java
  54. 3
      designer-base/src/main/java/com/fr/design/gui/icheckbox/UICheckBox.java
  55. 7
      designer-base/src/main/java/com/fr/design/gui/icombobox/ExtendedComboBoxTest.java
  56. 19
      designer-base/src/main/java/com/fr/design/gui/icombobox/LazyComboBoxTest.java
  57. 5
      designer-base/src/main/java/com/fr/design/gui/ilable/UILabel.java
  58. 60
      designer-base/src/main/java/com/fr/design/gui/ilist/TableViewList.java
  59. 6
      designer-base/src/main/java/com/fr/design/gui/itableeditorpane/UITableModelAdapter.java
  60. 17
      designer-base/src/main/java/com/fr/design/gui/itooltip/MultiLineToolTipUI.java
  61. 20
      designer-base/src/main/java/com/fr/design/gui/itooltip/UIToolTip.java
  62. 18
      designer-base/src/main/java/com/fr/design/gui/itooltip/UIToolTipUI.java
  63. 37
      designer-base/src/main/java/com/fr/design/gui/itree/filetree/TemplateFileTree.java
  64. 36
      designer-base/src/main/java/com/fr/design/hyperlink/AbstractHyperLinkPane.java
  65. 13
      designer-base/src/main/java/com/fr/design/icon/LockIcon.java
  66. 13
      designer-base/src/main/java/com/fr/design/icon/WarningIcon.java
  67. 24
      designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java
  68. 27
      designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java
  69. 19
      designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java
  70. 19
      designer-base/src/main/java/com/fr/design/mainframe/dnd/ArrayListTransferHandler.java
  71. 6
      designer-base/src/main/java/com/fr/design/mainframe/dnd/ArrayListTransferable.java
  72. 7
      designer-base/src/main/java/com/fr/design/mainframe/loghandler/LogMessageBar.java
  73. 8
      designer-base/src/main/java/com/fr/design/mainframe/templateinfo/TemplateInfoCollector.java
  74. 1
      designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java
  75. 10
      designer-base/src/main/java/com/fr/design/mainframe/widget/renderer/IconCellRenderer.java
  76. 9
      designer-base/src/main/java/com/fr/design/menu/MenuDef.java
  77. 16
      designer-base/src/main/java/com/fr/design/module/DesignModuleFactory.java
  78. 25
      designer-base/src/main/java/com/fr/design/parameter/ParaDefinitePane.java
  79. 4
      designer-base/src/main/java/com/fr/design/style/BorderPane.java
  80. 29
      designer-base/src/main/java/com/fr/design/style/background/gradient/GradientBackgroundPane.java
  81. 3
      designer-base/src/main/java/com/fr/design/utils/BrowseUtils.java
  82. 18
      designer-base/src/main/java/com/fr/design/utils/DesignUtils.java
  83. 51
      designer-base/src/main/java/com/fr/design/utils/gui/GUICoreUtils.java
  84. 91
      designer-base/src/main/java/com/fr/design/utils/gui/UIComponentUtils.java
  85. 2
      designer-base/src/main/java/com/fr/design/web/CustomIconPane.java
  86. 4
      designer-base/src/main/java/com/fr/design/widget/EventCreator.java
  87. 51
      designer-base/src/main/java/com/fr/design/widget/FRWidgetFactory.java
  88. 18
      designer-base/src/main/java/com/fr/design/widget/WidgetBoundsPaneFactory.java
  89. 2
      designer-base/src/main/java/com/fr/env/RemoteEnvPane.java
  90. 93
      designer-base/src/main/java/com/fr/file/AbstractFILE.java
  91. 2
      designer-base/src/main/java/com/fr/file/FileFILE.java
  92. 102
      designer-base/src/main/java/com/fr/file/RenameExportFILE.java
  93. 34
      designer-base/src/main/java/com/fr/file/StashedFILE.java
  94. 8
      designer-base/src/main/java/com/fr/start/Demo.java
  95. 12
      designer-base/src/main/java/com/fr/start/StartDocURL.java
  96. 21
      designer-base/src/main/java/com/fr/start/server/ServerManageFrame.java
  97. 18
      designer-base/src/main/java/com/fr/start/server/ServerTray.java
  98. 2
      designer-base/src/main/resources/com/fr/design/insert/formula/variable/cn/contextPath.txt
  99. 2
      designer-base/src/main/resources/com/fr/design/insert/formula/variable/cn/formletName.txt
  100. 2
      designer-base/src/main/resources/com/fr/design/insert/formula/variable/cn/reportName.txt
  101. Some files were not shown because too many files have changed in this diff Show More

15
designer-base/src/main/java/com/fr/design/DesignerEnvManager.java

@ -4,7 +4,6 @@
package com.fr.design; package com.fr.design;
import com.fr.base.BaseXMLUtils; import com.fr.base.BaseXMLUtils;
import com.fr.base.FRContext;
import com.fr.base.Utils; import com.fr.base.Utils;
import com.fr.design.actions.help.alphafine.AlphaFineConfigManager; import com.fr.design.actions.help.alphafine.AlphaFineConfigManager;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
@ -179,7 +178,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
try { try {
XMLTools.readFileXML(designerEnvManager, designerEnvManager.getDesignerEnvFile()); XMLTools.readFileXML(designerEnvManager, designerEnvManager.getDesignerEnvFile());
} catch (Exception e) { } catch (Exception e) {
FRContext.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
// james:如果没有env定义,要设置一个默认的 // james:如果没有env定义,要设置一个默认的
@ -282,11 +281,11 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
Handler handler = new FileHandler(fileName, true); Handler handler = new FileHandler(fileName, true);
handler.setFormatter(new FRLogFormatter()); handler.setFormatter(new FRLogFormatter());
FRContext.getLogger().addLogHandler(handler); FineLoggerFactory.getLogger().addLogHandler(handler);
} catch (SecurityException e) { } catch (SecurityException e) {
FRContext.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} catch (IOException e) { } catch (IOException e) {
FRContext.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
} }
} }
@ -323,7 +322,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
} }
fileWriter.close(); fileWriter.close();
} catch (IOException e) { } catch (IOException e) {
FRContext.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
} }
@ -345,7 +344,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
try { try {
XMLTools.readFileXML(designerEnvManager, prevEnvFile); XMLTools.readFileXML(designerEnvManager, prevEnvFile);
} catch (Exception e) { } catch (Exception e) {
FRContext.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
// 清空前一个版本中的工作目录和最近打开 // 清空前一个版本中的工作目录和最近打开
nameEnvMap = new ListMap<String, DesignerWorkspaceInfo>(); nameEnvMap = new ListMap<String, DesignerWorkspaceInfo>();
@ -626,7 +625,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
fout.flush(); fout.flush();
fout.close(); fout.close();
} catch (Exception e) { } catch (Exception e) {
FRContext.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
} }

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

@ -97,7 +97,6 @@ public class EnvChangeEntrance {
}); });
return false; return false;
} }
// 如果版本不一致,且确认 不继续 连接,这里返回 false. // 如果版本不一致,且确认 不继续 连接,这里返回 false.
if (!versionCheckAndConfirm(selectedEnv)) { if (!versionCheckAndConfirm(selectedEnv)) {
return false; return false;
@ -225,6 +224,7 @@ public class EnvChangeEntrance {
@Override @Override
public void doCancel() { public void doCancel() {
envListDialog.dispose(); envListDialog.dispose();
// todo 断开了但是没选择新的环境,那么尝试重连旧环境,等接口
} }
}); });
envListDialog.setVisible(true); envListDialog.setVisible(true);

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

@ -1,16 +1,15 @@
package com.fr.design.actions.community; package com.fr.design.actions.community;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.FRContext;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
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;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.*; import javax.swing.JOptionPane;
import java.awt.*; import javax.swing.KeyStroke;
import java.awt.Desktop;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.io.IOException; import java.io.IOException;
import java.net.URI; import java.net.URI;
@ -33,7 +32,7 @@ public class UpAction extends UpdateAction
{ {
String url = CloudCenter.getInstance().acquireUrlByKind("bbs.update"); String url = CloudCenter.getInstance().acquireUrlByKind("bbs.update");
if (StringUtils.isEmpty(url)) { if (StringUtils.isEmpty(url)) {
FRContext.getLogger().info("The URL is empty!"); FineLoggerFactory.getLogger().info("The URL is empty!");
return; return;
} }
try { try {

11
designer-base/src/main/java/com/fr/design/actions/core/ActionFactory.java

@ -1,6 +1,5 @@
package com.fr.design.actions.core; package com.fr.design.actions.core;
import com.fr.base.FRContext;
import com.fr.base.Utils; import com.fr.base.Utils;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.file.HistoryTemplateListPane;
@ -215,7 +214,7 @@ public class ActionFactory {
c.setAccessible(true); c.setAccessible(true);
return c.newInstance(); return c.newInstance();
} catch (Exception e) { } catch (Exception e) {
FRContext.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
return null; return null;
} }
@ -281,7 +280,7 @@ public class ActionFactory {
Constructor<? extends UpdateAction> c = (Constructor<? extends UpdateAction>) clazz.getConstructor(cls); Constructor<? extends UpdateAction> c = (Constructor<? extends UpdateAction>) clazz.getConstructor(cls);
actions.add(c.newInstance(obj)); actions.add(c.newInstance(obj));
} catch (Exception e) { } catch (Exception e) {
FRContext.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
} }
} }
@ -301,7 +300,7 @@ public class ActionFactory {
Constructor<? extends UpdateAction> c = (Constructor<? extends UpdateAction>) clazz.getConstructor(); Constructor<? extends UpdateAction> c = (Constructor<? extends UpdateAction>) clazz.getConstructor();
actionNames.add(c.newInstance().getMenuKeySet()); actionNames.add(c.newInstance().getMenuKeySet());
} catch (Exception e) { } catch (Exception e) {
FRContext.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
} }
} }
@ -336,7 +335,7 @@ public class ActionFactory {
Constructor<? extends UpdateAction> c = (Constructor<? extends UpdateAction>) clazz.getConstructor(cls); Constructor<? extends UpdateAction> c = (Constructor<? extends UpdateAction>) clazz.getConstructor(cls);
actions.add(c.newInstance(obj)); actions.add(c.newInstance(obj));
} catch (Exception e) { } catch (Exception e) {
FRContext.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
} }
return actions.toArray(new UpdateAction[actions.size()]); return actions.toArray(new UpdateAction[actions.size()]);
@ -355,7 +354,7 @@ public class ActionFactory {
constructor.setAccessible(true); constructor.setAccessible(true);
return constructor.newInstance(); return constructor.newInstance();
} catch (Exception e) { } catch (Exception e) {
FRContext.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
return null; return null;
} }

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

@ -23,6 +23,8 @@ import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
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.design.utils.gui.UIComponentUtils;
import com.fr.design.widget.FRWidgetFactory;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.FRFont; import com.fr.general.FRFont;
import com.fr.general.Inter; import com.fr.general.Inter;
@ -32,8 +34,17 @@ import com.fr.third.apache.log4j.Level;
import com.fr.transaction.Configurations; import com.fr.transaction.Configurations;
import com.fr.transaction.Worker; import com.fr.transaction.Worker;
import javax.swing.*; import javax.swing.BorderFactory;
import java.awt.*; import javax.swing.JFileChooser;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.KeyStroke;
import javax.swing.SwingUtilities;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Window;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.awt.event.KeyAdapter; import java.awt.event.KeyAdapter;
@ -61,6 +72,7 @@ public class PreferencePane extends BasicPane {
private static final int CACHING_MAX = 10; private static final int CACHING_MAX = 10;
private static final int CACHING_DEFAULT = 5; private static final int CACHING_DEFAULT = 5;
private static final int CACHING_GAP = 5; private static final int CACHING_GAP = 5;
private static final int MEMORY_TIP_LABEL_MAX_WIDTH = 230;
private static final String TYPE = "pressed"; private static final String TYPE = "pressed";
private static final String DISPLAY_TYPE = "+"; private static final String DISPLAY_TYPE = "+";
@ -471,7 +483,8 @@ public class PreferencePane extends BasicPane {
private JPanel createMemoryPane() { private JPanel createMemoryPane() {
JPanel memoryPane = FRGUIPaneFactory.createTitledBorderPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preference_Caching_Template")); JPanel memoryPane = FRGUIPaneFactory.createTitledBorderPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preference_Caching_Template"));
UILabel memoryLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preference_Max_Caching_Template")); UILabel memoryLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preference_Max_Caching_Template"));
UILabel memoryTipLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preference_Caching_Template_Tip")); UILabel memoryTipLabel = FRWidgetFactory.createLineWrapLabel(
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preference_Caching_Template_Tip"), MEMORY_TIP_LABEL_MAX_WIDTH);
memoryTipLabel.setBorder(BorderFactory.createEmptyBorder(0, CACHING_GAP, 0, 0)); memoryTipLabel.setBorder(BorderFactory.createEmptyBorder(0, CACHING_GAP, 0, 0));
cachingTemplateSpinner = new UISpinner(0, CACHING_MAX, 1, CACHING_DEFAULT); cachingTemplateSpinner = new UISpinner(0, CACHING_MAX, 1, CACHING_DEFAULT);
JPanel memorySpace = new JPanel(FRGUIPaneFactory.createLeftZeroLayout()); JPanel memorySpace = new JPanel(FRGUIPaneFactory.createLeftZeroLayout());

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

@ -1,6 +1,5 @@
package com.fr.design.actions.file; package com.fr.design.actions.file;
import com.fr.base.extension.FileExtension;
import com.fr.base.vcs.DesignerMode; import com.fr.base.vcs.DesignerMode;
import com.fr.design.fun.PreviewProvider; import com.fr.design.fun.PreviewProvider;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
@ -9,8 +8,8 @@ import com.fr.design.utils.DesignUtils;
import com.fr.file.FILE; import com.fr.file.FILE;
import com.fr.file.FileNodeFILE; import com.fr.file.FileNodeFILE;
import com.fr.general.GeneralUtils; import com.fr.general.GeneralUtils;
import com.fr.general.web.ParameterConstants;
import com.fr.stable.project.ProjectConstants; import com.fr.stable.project.ProjectConstants;
import com.fr.stable.web.AbstractWebletCreator;
import javax.swing.JOptionPane; import javax.swing.JOptionPane;
import java.util.Collections; import java.util.Collections;
@ -26,7 +25,11 @@ public final class WebPreviewUtils {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public static void preview(JTemplate<?, ?> jt, PreviewProvider provider) { public static void preview(JTemplate<?, ?> jt, PreviewProvider provider) {
String baseRoute = jt.route(); String baseRoute = jt.route();
actionPerformed(jt, baseRoute, provider == null ? Collections.EMPTY_MAP : provider.parametersForPreview(), provider.getActionType()); if (provider == null) {
actionPerformed(jt, baseRoute, Collections.EMPTY_MAP, ParameterConstants.VIEWLET);
} else {
actionPerformed(jt, baseRoute, provider.parametersForPreview(), provider.getActionType());
}
} }
private static void actionPerformed(JTemplate<?, ?> jt, String baseRoute, Map<String, Object> map, String actionType) { private static void actionPerformed(JTemplate<?, ?> jt, String baseRoute, Map<String, Object> map, String actionType) {
@ -85,13 +88,6 @@ public final class WebPreviewUtils {
java.util.List<String> parameterNameList = new java.util.ArrayList<String>(); java.util.List<String> parameterNameList = new java.util.ArrayList<String>();
java.util.List<String> parameterValueList = new java.util.ArrayList<String>(); java.util.List<String> parameterValueList = new java.util.ArrayList<String>();
// 暂时屏蔽cptx直接访问
if (path.endsWith(FileExtension.CPTX.getSuffix())) {
path = path.substring(0, path.length() - 1);
parameterNameList.add(AbstractWebletCreator.FORMAT);
parameterValueList.add(AbstractWebletCreator.X);
}
parameterNameList.add(actionType); parameterNameList.add(actionType);
parameterValueList.add(path); parameterValueList.add(path);
if (map != null) { if (map != null) {

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

@ -1,7 +1,7 @@
package com.fr.design.actions.file.export; package com.fr.design.actions.file.export;
import com.fr.base.vcs.DesignerMode;
import com.fr.design.actions.JTemplateAction; import com.fr.design.actions.JTemplateAction;
import com.fr.design.base.mode.DesignModeContext;
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;
@ -9,6 +9,7 @@ import com.fr.design.mainframe.JTemplate;
import com.fr.exception.RemoteDesignPermissionDeniedException; import com.fr.exception.RemoteDesignPermissionDeniedException;
import com.fr.file.FILE; import com.fr.file.FILE;
import com.fr.file.FILEChooserPane; import com.fr.file.FILEChooserPane;
import com.fr.file.RenameExportFILE;
import com.fr.file.filter.ChooseFileFilter; import com.fr.file.filter.ChooseFileFilter;
import com.fr.io.exporter.DesignExportType; import com.fr.io.exporter.DesignExportType;
import com.fr.io.exporter.ExporterKey; import com.fr.io.exporter.ExporterKey;
@ -92,12 +93,17 @@ public abstract class AbstractExportAction<E extends JTemplate<?, ?>> extends JT
int saveValue = fileChooserPane.showSaveDialog(DesignerContext.getDesignerFrame(), "." + this.getDefaultExtension()); int saveValue = fileChooserPane.showSaveDialog(DesignerContext.getDesignerFrame(), "." + this.getDefaultExtension());
if (saveValue == FILEChooserPane.JOPTIONPANE_OK_OPTION || saveValue == FILEChooserPane.OK_OPTION) { if (saveValue == FILEChooserPane.JOPTIONPANE_OK_OPTION || saveValue == FILEChooserPane.OK_OPTION) {
FILE target = fileChooserPane.getSelectedFILE(); FILE target = fileChooserPane.getSelectedFILE();
//rename 方式导出
target = RenameExportFILE.create(target);
try { try {
target.mkfile(); target.mkfile();
} catch (Exception exp) { } catch (Exception exp) {
FineLoggerFactory.getLogger().error("Error In Make New File", exp); FineLoggerFactory.getLogger().error("Error In Make New File", exp);
} }
FineLoggerFactory.getLogger().info("\"" + target.getName() + "\"" + Toolkit.i18nText("Fine-Design_Report_Prepare_Export") + "!"); FineLoggerFactory.getLogger().info(
"\"" + RenameExportFILE.recoverFileName(target.getName()) + "\"" +
Toolkit.i18nText("Fine-Design_Report_Prepare_Export") + "!"
);
progressbar = new FRProgressBar( progressbar = new FRProgressBar(
createExportWork(getSource(), target, para), createExportWork(getSource(), target, para),
@ -124,7 +130,7 @@ public abstract class AbstractExportAction<E extends JTemplate<?, ?>> extends JT
private boolean processNotSaved() { private boolean processNotSaved() {
//当前编辑的模板 //当前编辑的模板
E e = getEditingComponent(); E e = getEditingComponent();
if (!e.isALLSaved() && !DesignerMode.isVcsMode()) { if (!e.isALLSaved() && !DesignModeContext.isVcsMode()) {
e.stopEditing(); e.stopEditing();
int returnVal = JOptionPane.showConfirmDialog( int returnVal = JOptionPane.showConfirmDialog(
DesignerContext.getDesignerFrame(), DesignerContext.getDesignerFrame(),
@ -149,7 +155,7 @@ public abstract class AbstractExportAction<E extends JTemplate<?, ?>> extends JT
private SwingWorker createExportWork(final FILE source, final FILE target, final Map<String, Object> parameterMap) { private SwingWorker createExportWork(final FILE source, final FILE target, final Map<String, Object> parameterMap) {
final String path = source.getPath(); final String path = source.getPath();
final String name = target.getName(); final String name = RenameExportFILE.recoverFileName(target.getName());
return new SwingWorker<Void, Void>() { return new SwingWorker<Void, Void>() {
@ -162,7 +168,6 @@ public abstract class AbstractExportAction<E extends JTemplate<?, ?>> extends JT
dealExporter(outputStream, path, parameterMap); dealExporter(outputStream, path, parameterMap);
this.setProgress(80); this.setProgress(80);
outputStream.flush(); outputStream.flush();
outputStream.close();
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") + "!");

17
designer-base/src/main/java/com/fr/design/actions/help/FeedBackPane.java

@ -4,7 +4,6 @@
package com.fr.design.actions.help; package com.fr.design.actions.help;
import com.fr.base.FRContext;
import com.fr.base.FeedBackInfo; import com.fr.base.FeedBackInfo;
import com.fr.design.constants.LayoutConstants; import com.fr.design.constants.LayoutConstants;
import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.BasicDialog;
@ -23,7 +22,12 @@ import com.fr.general.ComparatorUtils;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.*; import javax.swing.BorderFactory;
import javax.swing.JDialog;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
import javax.swing.SwingWorker;
import javax.swing.border.Border; import javax.swing.border.Border;
import javax.swing.border.EmptyBorder; import javax.swing.border.EmptyBorder;
import javax.swing.border.MatteBorder; import javax.swing.border.MatteBorder;
@ -31,7 +35,12 @@ import javax.swing.plaf.ColorUIResource;
import javax.swing.text.AttributeSet; import javax.swing.text.AttributeSet;
import javax.swing.text.BadLocationException; import javax.swing.text.BadLocationException;
import javax.swing.text.PlainDocument; import javax.swing.text.PlainDocument;
import java.awt.*; import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Toolkit;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.awt.event.KeyAdapter; import java.awt.event.KeyAdapter;
@ -299,7 +308,7 @@ public class FeedBackPane extends BasicPane {
} catch (Exception e) { } catch (Exception e) {
isSendSuccessful = false; isSendSuccessful = false;
if (!(e instanceof CancellationException)) { if (!(e instanceof CancellationException)) {
FRContext.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
} }
} }

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

@ -5,16 +5,15 @@
package com.fr.design.actions.help; package com.fr.design.actions.help;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.FRContext;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
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;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.*; import javax.swing.JOptionPane;
import java.awt.*; import javax.swing.KeyStroke;
import java.awt.Desktop;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.io.IOException; import java.io.IOException;
import java.net.URI; import java.net.URI;
@ -42,7 +41,7 @@ public class ForumAction extends UpdateAction {
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
String url = CloudCenter.getInstance().acquireUrlByKind("bbs"); String url = CloudCenter.getInstance().acquireUrlByKind("bbs");
if (StringUtils.isEmpty(url)) { if (StringUtils.isEmpty(url)) {
FRContext.getLogger().info("The URL is empty!"); FineLoggerFactory.getLogger().info("The URL is empty!");
return; return;
} }
try { try {

8
designer-base/src/main/java/com/fr/design/actions/help/TutorialAction.java

@ -1,13 +1,13 @@
package com.fr.design.actions.help; package com.fr.design.actions.help;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.FRContext;
import com.fr.base.Utils; import com.fr.base.Utils;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
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.general.GeneralContext; import com.fr.general.GeneralContext;
import com.fr.general.http.HttpToolbox; import com.fr.general.http.HttpToolbox;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.CommonUtils; import com.fr.stable.CommonUtils;
import com.fr.stable.ProductConstants; import com.fr.stable.ProductConstants;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
@ -38,11 +38,11 @@ public class TutorialAction extends UpdateAction {
private void nativeExcuteMacInstallHomePrograms(String appName) { private void nativeExcuteMacInstallHomePrograms(String appName) {
String installHome = StableUtils.getInstallHome(); String installHome = StableUtils.getInstallHome();
if(installHome == null) { if(installHome == null) {
FRContext.getLogger().error("Can not find the install home, please check it."); FineLoggerFactory.getLogger().error("Can not find the install home, please check it.");
} else { } else {
String appPath = StableUtils.pathJoin(new String[]{installHome, "bin", appName}); String appPath = StableUtils.pathJoin(new String[]{installHome, "bin", appName});
if(!(new File(appPath)).exists()) { if(!(new File(appPath)).exists()) {
FRContext.getLogger().error(appPath + " can not be found."); FineLoggerFactory.getLogger().error(appPath + " can not be found.");
} }
String cmd = "open " + appPath; String cmd = "open " + appPath;
@ -51,7 +51,7 @@ public class TutorialAction extends UpdateAction {
try { try {
runtime.exec(cmd); runtime.exec(cmd);
} catch (IOException e) { } catch (IOException e) {
FRContext.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
} }

12
designer-base/src/main/java/com/fr/design/condition/ConditionAttributesPane.java

@ -1,16 +1,18 @@
package com.fr.design.condition; package com.fr.design.condition;
import com.fr.base.FRContext;
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.gui.itoolbar.UIToolbar; import com.fr.design.gui.itoolbar.UIToolbar;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.menu.ToolBarDef; import com.fr.design.menu.ToolBarDef;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.log.FineLoggerFactory;
import javax.swing.BoxLayout;
import javax.swing.*; import javax.swing.JComponent;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import java.awt.Dimension; import java.awt.Dimension;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
@ -88,9 +90,9 @@ public abstract class ConditionAttributesPane<T> extends BasicBeanPane<T> {
try { try {
return clazz.newInstance(); return clazz.newInstance();
} catch (InstantiationException e) { } catch (InstantiationException e) {
FRContext.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} catch (IllegalAccessException e) { } catch (IllegalAccessException e) {
FRContext.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
return null; return null;
} }

10
designer-base/src/main/java/com/fr/design/data/BasicTableDataTreePane.java

@ -1,7 +1,6 @@
package com.fr.design.data; package com.fr.design.data;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.FRContext;
import com.fr.base.TableData; import com.fr.base.TableData;
import com.fr.data.TableDataSource; import com.fr.data.TableDataSource;
import com.fr.data.api.StoreProcedureAssist; import com.fr.data.api.StoreProcedureAssist;
@ -28,14 +27,17 @@ import com.fr.design.menu.LineSeparator;
import com.fr.design.menu.MenuDef; import com.fr.design.menu.MenuDef;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.NameObject; import com.fr.general.NameObject;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
import javax.swing.*; import javax.swing.DefaultCellEditor;
import javax.swing.Icon;
import javax.swing.JTree;
import javax.swing.event.CellEditorListener; import javax.swing.event.CellEditorListener;
import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeEvent;
import javax.swing.tree.TreeCellEditor; import javax.swing.tree.TreeCellEditor;
import java.awt.*; import java.awt.Component;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.FocusAdapter; import java.awt.event.FocusAdapter;
import java.awt.event.FocusEvent; import java.awt.event.FocusEvent;
@ -413,7 +415,7 @@ public abstract class BasicTableDataTreePane extends DockingView implements Resp
} }
} catch (Exception ex) { } catch (Exception ex) {
FRContext.getLogger().error(ex.getMessage(), ex); FineLoggerFactory.getLogger().error(ex.getMessage(), ex);
} }
} }

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

@ -1,9 +1,9 @@
package com.fr.design.data; package com.fr.design.data;
import com.fr.base.FRContext;
import com.fr.base.StoreProcedureParameter; import com.fr.base.StoreProcedureParameter;
import com.fr.base.TableData; import com.fr.base.TableData;
import com.fr.data.TableDataSource; import com.fr.data.TableDataSource;
import com.fr.data.TableDataSourceTailor;
import com.fr.data.core.DataCoreXmlUtils; import com.fr.data.core.DataCoreXmlUtils;
import com.fr.data.impl.EmbeddedTableData; import com.fr.data.impl.EmbeddedTableData;
import com.fr.data.impl.storeproc.ProcedureDataModel; import com.fr.data.impl.storeproc.ProcedureDataModel;
@ -29,6 +29,7 @@ import com.fr.file.TableDataConfig;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.data.DataModel; import com.fr.general.data.DataModel;
import com.fr.general.data.TableDataException; import com.fr.general.data.TableDataException;
import com.fr.log.FineLoggerFactory;
import com.fr.script.Calculator; import com.fr.script.Calculator;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.stable.ParameterProvider; import com.fr.stable.ParameterProvider;
@ -444,7 +445,7 @@ public abstract class DesignTableDataManager {
parameter.setValue(parameterMap.get(parameter.getName())); parameter.setValue(parameterMap.get(parameter.getName()));
} }
} }
return DataOperator.getInstance().previewTableData(tableDataSource, tabledata, parameterMap, rowCount); return DataOperator.getInstance().previewTableData(TableDataSourceTailor.extractTableData(tableDataSource), tabledata, parameterMap, rowCount);
} catch (Exception e) { } catch (Exception e) {
throw new TableDataException(e.getMessage(), e); throw new TableDataException(e.getMessage(), e);
} finally { } finally {
@ -488,7 +489,7 @@ public abstract class DesignTableDataManager {
} }
rs.release(); rs.release();
} catch (Exception e) { } catch (Exception e) {
FRContext.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
} }

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

@ -1,7 +1,6 @@
package com.fr.design.data.datapane; package com.fr.design.data.datapane;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.FRContext;
import com.fr.base.TableData; import com.fr.base.TableData;
import com.fr.data.core.DataCoreUtils; import com.fr.data.core.DataCoreUtils;
import com.fr.data.core.db.DBUtils; import com.fr.data.core.db.DBUtils;
@ -33,12 +32,15 @@ import com.fr.design.mainframe.DesignerFrame;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.file.ConnectionConfig; import com.fr.file.ConnectionConfig;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
import javax.swing.*; import javax.swing.JList;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JTree;
import javax.swing.SwingWorker;
import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener; import javax.swing.event.ChangeListener;
import javax.swing.event.PopupMenuEvent; import javax.swing.event.PopupMenuEvent;
@ -49,7 +51,9 @@ import javax.swing.tree.DefaultTreeModel;
import javax.swing.tree.TreeCellRenderer; import javax.swing.tree.TreeCellRenderer;
import javax.swing.tree.TreeNode; import javax.swing.tree.TreeNode;
import javax.swing.tree.TreePath; import javax.swing.tree.TreePath;
import java.awt.*; import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.event.FocusAdapter; import java.awt.event.FocusAdapter;
import java.awt.event.FocusEvent; import java.awt.event.FocusEvent;
import java.awt.event.ItemEvent; import java.awt.event.ItemEvent;
@ -432,7 +436,7 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha
tree.expandPath(path); tree.expandPath(path);
} }
} catch (Exception e) { } catch (Exception e) {
FRContext.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
} }
@ -473,7 +477,7 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha
DesignerEnvManager.getEnvManager().getMaxNumberOrPreviewRow()); DesignerEnvManager.getEnvManager().getMaxNumberOrPreviewRow());
} catch (Exception e) { } catch (Exception e) {
failedToFindTable(); failedToFindTable();
FRContext.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
} }
@ -530,7 +534,7 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha
// daniel:增加参数 // daniel:增加参数
colNames = DataOperator.getInstance().getColumns(selectedDSName, paras.getSchemaName(), selectedTableObject); colNames = DataOperator.getInstance().getColumns(selectedDSName, paras.getSchemaName(), selectedTableObject);
} catch (Exception e2) { } catch (Exception e2) {
FRContext.getLogger().error(e2.getMessage(), e2); FineLoggerFactory.getLogger().error(e2.getMessage(), e2);
} }
if (colNames == null) { if (colNames == null) {

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

@ -1,7 +1,6 @@
package com.fr.design.data.datapane; package com.fr.design.data.datapane;
import com.fr.base.BaseFormula; import com.fr.base.BaseFormula;
import com.fr.base.FRContext;
import com.fr.base.Parameter; import com.fr.base.Parameter;
import com.fr.base.ParameterHelper; import com.fr.base.ParameterHelper;
import com.fr.base.ParameterMapNameSpace; import com.fr.base.ParameterMapNameSpace;
@ -15,9 +14,10 @@ import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.JTemplate;
import com.fr.design.parameter.ParameterInputPane; import com.fr.design.parameter.ParameterInputPane;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.script.Calculator; import com.fr.script.Calculator;
import javax.swing.*; import javax.swing.JTree;
import javax.swing.tree.DefaultMutableTreeNode; import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.DefaultTreeModel; import javax.swing.tree.DefaultTreeModel;
import java.awt.event.ItemEvent; import java.awt.event.ItemEvent;
@ -113,7 +113,7 @@ public class ChoosePaneSupportFormula extends ChoosePane {
selectedDSName = Utils.objectToString(ca.eval(BaseFormula.createFormulaBuilder().build(item))); selectedDSName = Utils.objectToString(ca.eval(BaseFormula.createFormulaBuilder().build(item)));
// selectedDSName = ParameterHelper.analyzeCurrentContextTableData4Templatee(item, parameters); // selectedDSName = ParameterHelper.analyzeCurrentContextTableData4Templatee(item, parameters);
} catch (Exception e) { } catch (Exception e) {
FRContext.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
} else { } else {
selectedDSName = item; selectedDSName = item;
@ -156,7 +156,7 @@ public class ChoosePaneSupportFormula extends ChoosePane {
dsName = dsItem.startsWith("=") ? Utils.objectToString(ca.eval(BaseFormula.createFormulaBuilder().build(dsItem))) : dsItem; dsName = dsItem.startsWith("=") ? Utils.objectToString(ca.eval(BaseFormula.createFormulaBuilder().build(dsItem))) : dsItem;
tableName = tableItem.startsWith("=") ? Utils.objectToString(ca.eval(BaseFormula.createFormulaBuilder().build(tableItem))) : tableItem; tableName = tableItem.startsWith("=") ? Utils.objectToString(ca.eval(BaseFormula.createFormulaBuilder().build(tableItem))) : tableItem;
} catch (Exception e) { } catch (Exception e) {
FRContext.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
ori_ds_name = dsName; ori_ds_name = dsName;
ori_table_name = tableName; ori_table_name = tableName;

14
designer-base/src/main/java/com/fr/design/data/datapane/TableDataNameObjectCreator.java

@ -1,21 +1,21 @@
package com.fr.design.data.datapane; package com.fr.design.data.datapane;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.FRContext;
import com.fr.data.impl.DBTableData; import com.fr.data.impl.DBTableData;
import com.fr.design.actions.tabledata.TableDataAction; import com.fr.design.actions.tabledata.TableDataAction;
import com.fr.design.beans.BasicBeanPane; import com.fr.design.beans.BasicBeanPane;
import com.fr.design.gui.controlpane.NameObjectCreator; import com.fr.design.gui.controlpane.NameObjectCreator;
import com.fr.design.icon.WarningIcon; import com.fr.design.icon.WarningIcon;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.*; import javax.swing.Icon;
import java.awt.*; import java.awt.Image;
import java.text.Collator; import java.text.Collator;
import java.util.*; import java.util.ArrayList;
import java.util.Arrays;
import java.util.List; import java.util.List;
/** /**
@ -138,10 +138,10 @@ public class TableDataNameObjectCreator extends NameObjectCreator {
try { try {
return clazzOfInitCase.newInstance(); return clazzOfInitCase.newInstance();
} catch (InstantiationException | IllegalAccessException e1) { } catch (InstantiationException | IllegalAccessException e1) {
FRContext.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
} catch (IllegalAccessException e) { } catch (IllegalAccessException e) {
FRContext.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
return null; return null;
} }

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

@ -9,6 +9,8 @@ import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.DesignerBean; import com.fr.design.mainframe.DesignerBean;
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.design.utils.gui.UIComponentUtils;
import com.fr.design.widget.FRWidgetFactory;
import javax.swing.*; import javax.swing.*;
@ -16,6 +18,7 @@ import java.awt.*;
public class VerticalChoosePane extends ChoosePane implements DesignerBean { public class VerticalChoosePane extends ChoosePane implements DesignerBean {
private static final int RIGHTBORDER = 5; private static final int RIGHTBORDER = 5;
private static final int MAX_WIDTH = 60;
public VerticalChoosePane(Previewable previewable) { public VerticalChoosePane(Previewable previewable) {
this(previewable, -1); this(previewable, -1);
@ -40,8 +43,7 @@ public class VerticalChoosePane extends ChoosePane implements DesignerBean {
rs.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, -RIGHTBORDER)); rs.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, -RIGHTBORDER));
UILabel l1 = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Database"), UILabel.LEFT); UILabel l1 = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Database"), UILabel.LEFT);
UILabel l2 = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Model"), UILabel.LEFT); UILabel l2 = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Model"), UILabel.LEFT);
UILabel l3 = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Database_Select_Table"), UILabel.LEFT); UILabel l3 = FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Database_Select_Table"), MAX_WIDTH, UILabel.LEFT);
if (labelSize > 0) { if (labelSize > 0) {
Dimension pSize = new Dimension(labelSize, 20); Dimension pSize = new Dimension(labelSize, 20);
l1.setPreferredSize(pSize); l1.setPreferredSize(pSize);
@ -52,7 +54,7 @@ public class VerticalChoosePane extends ChoosePane implements DesignerBean {
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{l1, dsNameComboBox}, new Component[]{l1, dsNameComboBox},
new Component[]{l2, schemaBox}, new Component[]{l2, schemaBox},
new Component[]{l3, rs} new Component[]{l3, UIComponentUtils.wrapWithBorderLayoutPane(rs)}
}; };
JPanel content = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_HUGER, LayoutConstants.VGAP_LARGE); JPanel content = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_HUGER, LayoutConstants.VGAP_LARGE);

13
designer-base/src/main/java/com/fr/design/data/datapane/preview/PreviewTableModel.java

@ -1,14 +1,13 @@
package com.fr.design.data.datapane.preview; package com.fr.design.data.datapane.preview;
import com.fr.base.FRContext;
import com.fr.cache.list.IntList; import com.fr.cache.list.IntList;
import com.fr.data.AbstractDataModel; import com.fr.data.AbstractDataModel;
import com.fr.data.impl.EmbeddedTableData.EmbeddedTDDataModel; import com.fr.data.impl.EmbeddedTableData.EmbeddedTDDataModel;
import com.fr.data.impl.storeproc.ProcedureDataModel; import com.fr.data.impl.storeproc.ProcedureDataModel;
import com.fr.design.utils.DesignUtils; import com.fr.design.utils.DesignUtils;
import com.fr.general.data.DataModel; import com.fr.general.data.DataModel;
import com.fr.general.data.TableDataException; import com.fr.general.data.TableDataException;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
@ -35,7 +34,7 @@ public class PreviewTableModel extends AbstractTableModel {
this.dataModel = createRowDataModel(rs, maxRowCount); this.dataModel = createRowDataModel(rs, maxRowCount);
} catch (TableDataException e) { } catch (TableDataException e) {
// TODO Auto-generated catch block // TODO Auto-generated catch block
FRContext.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
} else { } else {
this.dataModel = sourceResultSet; this.dataModel = sourceResultSet;
@ -98,7 +97,7 @@ public class PreviewTableModel extends AbstractTableModel {
try { try {
return Integer.toString(column + 1) + ". " + dataModel.getColumnName(column) + checkType(column); return Integer.toString(column + 1) + ". " + dataModel.getColumnName(column) + checkType(column);
} catch (TableDataException e) { } catch (TableDataException e) {
FRContext.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
DesignUtils.errorMessage(e.getMessage()); DesignUtils.errorMessage(e.getMessage());
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Error"); return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Error");
} }
@ -108,7 +107,7 @@ public class PreviewTableModel extends AbstractTableModel {
try { try {
return this.dataModel.getRowCount(); return this.dataModel.getRowCount();
} catch (TableDataException e) { } catch (TableDataException e) {
FRContext.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
return 0; return 0;
} }
} }
@ -120,7 +119,7 @@ public class PreviewTableModel extends AbstractTableModel {
} }
return dataModel.getColumnCount(); return dataModel.getColumnCount();
} catch (TableDataException e) { } catch (TableDataException e) {
FRContext.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
DesignUtils.errorMessage(e.getMessage()); DesignUtils.errorMessage(e.getMessage());
return 0; return 0;
} }
@ -130,7 +129,7 @@ public class PreviewTableModel extends AbstractTableModel {
try { try {
return dataModel.getValueAt(row, column); return dataModel.getValueAt(row, column);
} catch (TableDataException e) { } catch (TableDataException e) {
FRContext.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
DesignUtils.errorMessage(e.getMessage()); DesignUtils.errorMessage(e.getMessage());
return ""; return "";
} }

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

@ -4,7 +4,6 @@
package com.fr.design.data.datapane.preview; package com.fr.design.data.datapane.preview;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.FRContext;
import com.fr.base.TableData; import com.fr.base.TableData;
import com.fr.data.TableDataSource; import com.fr.data.TableDataSource;
import com.fr.data.impl.DBTableData; import com.fr.data.impl.DBTableData;
@ -308,7 +307,7 @@ public class PreviewTablePane extends BasicPane {
int tatalColumn = Integer.parseInt(tatolColumnErrMessage.trim()); int tatalColumn = Integer.parseInt(tatolColumnErrMessage.trim());
columnErrMessage = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tabledata_Preview_Warn_Text", choiceColumn + 1, tatalColumn); columnErrMessage = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tabledata_Preview_Warn_Text", choiceColumn + 1, tatalColumn);
} catch (Exception e) { } catch (Exception e) {
FRContext.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
return; return;
} }
FineLoggerFactory.getLogger().error(exp.getMessage(), exp); FineLoggerFactory.getLogger().error(exp.getMessage(), exp);
@ -402,7 +401,7 @@ public class PreviewTablePane extends BasicPane {
fireLoadedListener(); fireLoadedListener();
} catch (Exception e) { } catch (Exception e) {
if (!(e instanceof CancellationException)) { if (!(e instanceof CancellationException)) {
FRContext.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), e.getMessage(), JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), e.getMessage(),
null, 0, UIManager.getIcon("OptionPane.errorIcon")); null, 0, UIManager.getIcon("OptionPane.errorIcon"));
} }
@ -447,7 +446,7 @@ public class PreviewTablePane extends BasicPane {
} }
} catch (Exception e) { } catch (Exception e) {
FRContext.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
previewTablePane.fireLoadedListener(); previewTablePane.fireLoadedListener();
previewTablePane.showWindow(DesignerContext.getDesignerFrame()).setVisible(true); previewTablePane.showWindow(DesignerContext.getDesignerFrame()).setVisible(true);
@ -468,7 +467,7 @@ public class PreviewTablePane extends BasicPane {
try { try {
previewTablePane.populateStoreDataSQL(); previewTablePane.populateStoreDataSQL();
} catch (Exception e) { } catch (Exception e) {
FRContext.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
tabPreviewpane.addTab(storeProcedureDataModels[i].getName(), previewTablePane); tabPreviewpane.addTab(storeProcedureDataModels[i].getName(), previewTablePane);
} }

2
designer-base/src/main/java/com/fr/design/data/datapane/sqlpane/SQLEditPane.java

File diff suppressed because one or more lines are too long

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

@ -29,6 +29,7 @@ import com.fr.design.gui.itableeditorpane.UITableEditorPane;
import com.fr.design.gui.itoolbar.UIToolbar; import com.fr.design.gui.itoolbar.UIToolbar;
import com.fr.design.gui.syntax.ui.rsyntaxtextarea.SyntaxConstants; import com.fr.design.gui.syntax.ui.rsyntaxtextarea.SyntaxConstants;
import com.fr.design.gui.syntax.ui.rtextarea.RTextScrollPane; import com.fr.design.gui.syntax.ui.rtextarea.RTextScrollPane;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.menu.SeparatorDef; import com.fr.design.menu.SeparatorDef;
import com.fr.design.menu.ToolBarDef; import com.fr.design.menu.ToolBarDef;
@ -211,10 +212,13 @@ public class DBTableDataPane extends AbstractTableDataPane<DBTableData> {
isShareCheckBox.setBackground(Color.WHITE); isShareCheckBox.setBackground(Color.WHITE);
maxPanel = new MaxMemRowCountPanel(); maxPanel = new MaxMemRowCountPanel();
maxPanel.setBorder(null); maxPanel.setBorder(null);
JPanel wrapMaxPanel = FRGUIPaneFactory.createBorderLayout_S_Pane();
wrapMaxPanel.add(maxPanel);
wrapMaxPanel.setPreferredSize(new Dimension(250, 20));
UIToolbar editToolBar = ToolBarDef.createJToolBar(); UIToolbar editToolBar = ToolBarDef.createJToolBar();
toolBarDef.updateToolBar(editToolBar); toolBarDef.updateToolBar(editToolBar);
editToolBar.add(isShareCheckBox); editToolBar.add(isShareCheckBox);
editToolBar.add(maxPanel); editToolBar.add(wrapMaxPanel);
return editToolBar; return editToolBar;
} }

7
designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/DecoratedTableDataPane.java

@ -1,18 +1,17 @@
package com.fr.design.data.tabledata.tabledatapane; package com.fr.design.data.tabledata.tabledatapane;
import com.fr.base.FRContext;
import com.fr.data.impl.DecoratedTableData; import com.fr.data.impl.DecoratedTableData;
import com.fr.design.condition.DSColumnLiteConditionPane; import com.fr.design.condition.DSColumnLiteConditionPane;
import com.fr.design.gui.ilist.CheckBoxList; import com.fr.design.gui.ilist.CheckBoxList;
import com.fr.design.gui.ilist.CheckBoxList.CheckBoxListSelectionChangeListener; import com.fr.design.gui.ilist.CheckBoxList.CheckBoxListSelectionChangeListener;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.file.TableDataConfig; import com.fr.file.TableDataConfig;
import com.fr.general.data.DataModel; import com.fr.general.data.DataModel;
import com.fr.general.data.TableDataException; import com.fr.general.data.TableDataException;
import com.fr.log.FineLoggerFactory;
import com.fr.script.Calculator; import com.fr.script.Calculator;
import java.awt.*; import java.awt.BorderLayout;
public class DecoratedTableDataPane extends AbstractTableDataPane<DecoratedTableData> implements CheckBoxListSelectionChangeListener { public class DecoratedTableDataPane extends AbstractTableDataPane<DecoratedTableData> implements CheckBoxListSelectionChangeListener {
private CheckBoxList availableTableDataNameList; private CheckBoxList availableTableDataNameList;
@ -85,7 +84,7 @@ public class DecoratedTableDataPane extends AbstractTableDataPane<DecoratedTable
columnList.add(model.getColumnName(i)); columnList.add(model.getColumnName(i));
} }
} catch (TableDataException e) { } catch (TableDataException e) {
FRContext.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
return; return;
} }

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

@ -1,11 +1,12 @@
package com.fr.design.data.tabledata.tabledatapane; package com.fr.design.data.tabledata.tabledatapane;
import java.awt.BorderLayout; import com.fr.data.impl.EmbeddedTableData;
import java.awt.Color; import com.fr.design.dialog.BasicPane;
import java.awt.Component; import com.fr.design.gui.ibutton.UIButton;
import java.awt.event.ActionEvent; import com.fr.design.gui.icombobox.UIComboBox;
import java.awt.event.ActionListener; import com.fr.design.layout.FRGUIPaneFactory;
import java.util.Date; import com.fr.general.ComparatorUtils;
import com.fr.log.FineLoggerFactory;
import javax.swing.DefaultCellEditor; import javax.swing.DefaultCellEditor;
import javax.swing.JPanel; import javax.swing.JPanel;
@ -15,14 +16,12 @@ import javax.swing.table.AbstractTableModel;
import javax.swing.table.DefaultTableCellRenderer; import javax.swing.table.DefaultTableCellRenderer;
import javax.swing.table.TableCellEditor; import javax.swing.table.TableCellEditor;
import javax.swing.table.TableColumn; import javax.swing.table.TableColumn;
import java.awt.BorderLayout;
import com.fr.base.FRContext; import java.awt.Color;
import com.fr.data.impl.EmbeddedTableData; import java.awt.Component;
import com.fr.design.gui.ibutton.UIButton; import java.awt.event.ActionEvent;
import com.fr.design.gui.icombobox.UIComboBox; import java.awt.event.ActionListener;
import com.fr.design.layout.FRGUIPaneFactory; import java.util.Date;
import com.fr.design.dialog.BasicPane;
import com.fr.general.ComparatorUtils;
public class EmbeddedTableDataDefinedPane extends BasicPane{ public class EmbeddedTableDataDefinedPane extends BasicPane{
@ -180,7 +179,7 @@ public class EmbeddedTableDataDefinedPane extends BasicPane{
localDefaultModel.fireTableDataChanged(); localDefaultModel.fireTableDataChanged();
checkEnabled(); checkEnabled();
} catch (CloneNotSupportedException e) { } catch (CloneNotSupportedException e) {
FRContext.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
} }
@ -193,7 +192,7 @@ public class EmbeddedTableDataDefinedPane extends BasicPane{
try { try {
tableData = (EmbeddedTableData)(localDefaultModel.getEditableTableData().clone()); tableData = (EmbeddedTableData)(localDefaultModel.getEditableTableData().clone());
} catch (CloneNotSupportedException e) { } catch (CloneNotSupportedException e) {
FRContext.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
return tableData; return tableData;

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

@ -1,5 +1,25 @@
package com.fr.design.data.tabledata.tabledatapane; package com.fr.design.data.tabledata.tabledatapane;
import com.fr.data.impl.EmbeddedTableData;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.gui.date.UIDatePicker;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.DesignerContext;
import com.fr.general.DateUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils;
import javax.swing.BorderFactory;
import javax.swing.DefaultCellEditor;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.table.DefaultTableCellRenderer;
import javax.swing.table.TableCellEditor;
import javax.swing.table.TableColumn;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Color; import java.awt.Color;
import java.awt.Component; import java.awt.Component;
@ -12,29 +32,6 @@ import java.awt.event.MouseEvent;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Date; import java.util.Date;
import javax.swing.BorderFactory;
import javax.swing.DefaultCellEditor;
import com.fr.design.gui.date.UIDatePicker;
import com.fr.design.gui.ilable.UILabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.table.DefaultTableCellRenderer;
import javax.swing.table.TableCellEditor;
import javax.swing.table.TableColumn;
import com.fr.base.FRContext;
import com.fr.data.impl.EmbeddedTableData;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.general.DateUtils;
import com.fr.stable.StringUtils;
public class EmbeddedTableDataPane extends AbstractTableDataPane<EmbeddedTableData> { public class EmbeddedTableDataPane extends AbstractTableDataPane<EmbeddedTableData> {
private JTable dataJTable ; private JTable dataJTable ;
@ -214,7 +211,7 @@ public class EmbeddedTableDataPane extends AbstractTableDataPane<EmbeddedTableDa
try { try {
return (EmbeddedTableData) localDefaultModel.getEditableTableData().clone(); return (EmbeddedTableData) localDefaultModel.getEditableTableData().clone();
} catch (CloneNotSupportedException e) { } catch (CloneNotSupportedException e) {
FRContext.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
return new EmbeddedTableData(); return new EmbeddedTableData();
} }
} }

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

@ -1,7 +1,6 @@
package com.fr.design.data.tabledata.tabledatapane; package com.fr.design.data.tabledata.tabledatapane;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.FRContext;
import com.fr.base.Parameter; import com.fr.base.Parameter;
import com.fr.base.ParameterHelper; import com.fr.base.ParameterHelper;
import com.fr.base.Utils; import com.fr.base.Utils;
@ -32,12 +31,13 @@ import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.menu.ToolBarDef; import com.fr.design.menu.ToolBarDef;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.design.utils.gui.UIComponentUtils;
import com.fr.file.FILE; import com.fr.file.FILE;
import com.fr.file.FILEChooserPane; import com.fr.file.FILEChooserPane;
import com.fr.file.filter.ChooseFileFilter; import com.fr.file.filter.ChooseFileFilter;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.data.DataSource; import com.fr.general.data.DataSource;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.stable.EncodeConstants; import com.fr.stable.EncodeConstants;
import com.fr.stable.ParameterProvider; import com.fr.stable.ParameterProvider;
@ -45,13 +45,24 @@ import com.fr.stable.StringUtils;
import com.fr.stable.xml.XMLReadable; import com.fr.stable.xml.XMLReadable;
import com.fr.stable.xml.XMLableReader; import com.fr.stable.xml.XMLableReader;
import javax.swing.*; import javax.swing.BorderFactory;
import javax.swing.ButtonGroup;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTree;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener; import javax.swing.event.ChangeListener;
import javax.swing.tree.DefaultTreeModel; import javax.swing.tree.DefaultTreeModel;
import javax.swing.tree.TreePath; import javax.swing.tree.TreePath;
import javax.swing.tree.TreeSelectionModel; import javax.swing.tree.TreeSelectionModel;
import java.awt.*; import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.GridLayout;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter; import java.awt.event.MouseAdapter;
@ -99,7 +110,7 @@ public class FileTableDataPane extends AbstractTableDataPane<FileTableData> {
private UIRadioButton commaDismenberRadioButton;// 逗号 private UIRadioButton commaDismenberRadioButton;// 逗号
private UIRadioButton otherDismenberRadioButton;// 其他 private UIRadioButton otherDismenberRadioButton;// 其他
private UITextField otherDismenberTextField;// 其他分隔符编辑 private UITextField otherDismenberTextField;// 其他分隔符编辑
private UICheckBox igoreOneMoreDelimiterCheckBox;// 连续分隔符是否作为单一 private UICheckBox ignoreOneMoreDelimiterCheckBox;// 连续分隔符是否作为单一
private UIComboBox charsetComboBox; private UIComboBox charsetComboBox;
private UILabel encodeLabel; private UILabel encodeLabel;
private UILabel dismenberLabel; private UILabel dismenberLabel;
@ -218,7 +229,7 @@ public class FileTableDataPane extends AbstractTableDataPane<FileTableData> {
try { try {
in = url.getSourceStream(params); in = url.getSourceStream(params);
} catch (Throwable e) { } catch (Throwable e) {
FRContext.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"), JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Database_Connection_Failed"),
@ -374,7 +385,8 @@ public class FileTableDataPane extends AbstractTableDataPane<FileTableData> {
bg2.add(spaceDismenberRadioButton); bg2.add(spaceDismenberRadioButton);
bg2.add(commaDismenberRadioButton); bg2.add(commaDismenberRadioButton);
bg2.add(otherDismenberRadioButton); bg2.add(otherDismenberRadioButton);
igoreOneMoreDelimiterCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Series_Dismenber_As_Single"), true); ignoreOneMoreDelimiterCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Series_Dismenber_As_Single"), true);
UIComponentUtils.setLineWrap(ignoreOneMoreDelimiterCheckBox);
encodeLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Encoding_Type") + ":"); encodeLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Encoding_Type") + ":");
charsetComboBox = new UIComboBox(EncodeConstants.ALL_ENCODING_ARRAY); charsetComboBox = new UIComboBox(EncodeConstants.ALL_ENCODING_ARRAY);
Component[][] comps = { Component[][] comps = {
@ -384,7 +396,7 @@ public class FileTableDataPane extends AbstractTableDataPane<FileTableData> {
{null,spaceDismenberRadioButton,null}, {null,spaceDismenberRadioButton,null},
{null,commaDismenberRadioButton,null}, {null,commaDismenberRadioButton,null},
{null,otherDismenberRadioButton,otherDismenberTextField}, {null,otherDismenberRadioButton,otherDismenberTextField},
{igoreOneMoreDelimiterCheckBox,null,null} {ignoreOneMoreDelimiterCheckBox,null,null}
}; };
northPane.add(TableLayoutHelper.createTableLayoutPane(comps, rowSize, columnSize),BorderLayout.EAST); northPane.add(TableLayoutHelper.createTableLayoutPane(comps, rowSize, columnSize),BorderLayout.EAST);
} }
@ -586,7 +598,7 @@ public class FileTableDataPane extends AbstractTableDataPane<FileTableData> {
} }
editorPane.populate(ttd.getParams()); editorPane.populate(ttd.getParams());
needColumnNameCheckBox.setSelected(ttd.needColumnName()); needColumnNameCheckBox.setSelected(ttd.needColumnName());
igoreOneMoreDelimiterCheckBox.setSelected(ttd.isIgnoreOneMoreDelimiter()); ignoreOneMoreDelimiterCheckBox.setSelected(ttd.isIgnoreOneMoreDelimiter());
charsetComboBox.setSelectedItem(ttd.getCharset()); charsetComboBox.setSelectedItem(ttd.getCharset());
} }
@ -624,7 +636,7 @@ public class FileTableDataPane extends AbstractTableDataPane<FileTableData> {
ttd.setFilePath(filePath); ttd.setFilePath(filePath);
ttd.setParams(this.params); ttd.setParams(this.params);
ttd.setDelimiter(this.showDelimiter()); ttd.setDelimiter(this.showDelimiter());
ttd.setIgnoreOneMoreDelimiter(igoreOneMoreDelimiterCheckBox.isSelected()); ttd.setIgnoreOneMoreDelimiter(ignoreOneMoreDelimiterCheckBox.isSelected());
ttd.setNeedColumnName(needColumnNameCheckBox.isSelected()); ttd.setNeedColumnName(needColumnNameCheckBox.isSelected());
ttd.setCharset((String)charsetComboBox.getSelectedItem()); ttd.setCharset((String)charsetComboBox.getSelectedItem());
fileTableData = ttd; fileTableData = ttd;
@ -895,7 +907,7 @@ public class FileTableDataPane extends AbstractTableDataPane<FileTableData> {
if (localFileRadioButton.isSelected()) { if (localFileRadioButton.isSelected()) {
String localTextString = StringUtils.trimToNull(localText.getText()); String localTextString = StringUtils.trimToNull(localText.getText());
if(StringUtils.isEmpty(localTextString)){ if(StringUtils.isEmpty(localTextString)){
FRContext.getLogger().info("The file path is empty."); FineLoggerFactory.getLogger().info("The file path is empty.");
loadedTreeModel(); loadedTreeModel();
return; return;
} }
@ -903,7 +915,7 @@ public class FileTableDataPane extends AbstractTableDataPane<FileTableData> {
} else { } else {
String urlTextString = StringUtils.trimToNull(urlText.getText()); String urlTextString = StringUtils.trimToNull(urlText.getText());
if (StringUtils.isEmpty(urlTextString)){ if (StringUtils.isEmpty(urlTextString)){
FRContext.getLogger().info("The url path is empty."); FineLoggerFactory.getLogger().info("The url path is empty.");
loadedTreeModel(); loadedTreeModel();
return; return;
} }
@ -920,13 +932,13 @@ public class FileTableDataPane extends AbstractTableDataPane<FileTableData> {
if (xmlReader != null) { if (xmlReader != null) {
xmlReader.readXMLObject(new XMLLayerReader(0)); xmlReader.readXMLObject(new XMLLayerReader(0));
} else { } else {
FRContext.getLogger().info("The file is wrong or bad, can not create the XMLReader."); FineLoggerFactory.getLogger().info("The file is wrong or bad, can not create the XMLReader.");
loadedTreeModel(); loadedTreeModel();
} }
reader.close(); reader.close();
} }
} catch (Throwable e) { } catch (Throwable e) {
FRContext.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
loadedTreeModel(); loadedTreeModel();
} }
if(treeModel.getChildCount(treeModel.getRoot()) == 1){ if(treeModel.getChildCount(treeModel.getRoot()) == 1){

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

@ -1,7 +1,6 @@
package com.fr.design.data.tabledata.wrapper; package com.fr.design.data.tabledata.wrapper;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.FRContext;
import com.fr.base.TableData; import com.fr.base.TableData;
import com.fr.data.impl.storeproc.ProcedureDataModel; import com.fr.data.impl.storeproc.ProcedureDataModel;
import com.fr.data.impl.storeproc.StoreProcedure; import com.fr.data.impl.storeproc.StoreProcedure;
@ -14,9 +13,11 @@ 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;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.log.FineLoggerFactory;
import javax.swing.Icon;
import javax.swing.*; import javax.swing.JOptionPane;
import javax.swing.SwingWorker;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
@ -146,7 +147,7 @@ public final class StoreProcedureDataWrapper implements TableDataWrapper {
} }
return true; return true;
} catch (Exception e) { } catch (Exception e) {
FRContext.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
return false; return false;
} }
@ -217,7 +218,7 @@ public final class StoreProcedureDataWrapper implements TableDataWrapper {
} }
} catch (Exception e) { } catch (Exception e) {
if (!(e instanceof CancellationException)) { if (!(e instanceof CancellationException)) {
FRContext.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), e.getMessage()); JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), e.getMessage());
} }
loadingBar.close(); loadingBar.close();

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

@ -1,7 +1,6 @@
package com.fr.design.data.tabledata.wrapper; package com.fr.design.data.tabledata.wrapper;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.FRContext;
import com.fr.base.TableData; import com.fr.base.TableData;
import com.fr.data.impl.storeproc.ProcedureDataModel; import com.fr.data.impl.storeproc.ProcedureDataModel;
import com.fr.data.impl.storeproc.StoreProcedure; import com.fr.data.impl.storeproc.StoreProcedure;
@ -11,7 +10,7 @@ import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
import javax.swing.*; import javax.swing.Icon;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
@ -77,7 +76,7 @@ public final class StoreProcedureNameWrapper implements TableDataWrapper {
try { try {
procedureDataModel = DesignTableDataManager.createLazyDataModel(storeProcedure, needLoadingBar)[0]; procedureDataModel = DesignTableDataManager.createLazyDataModel(storeProcedure, needLoadingBar)[0];
} catch (Exception e) { } catch (Exception e) {
FRContext.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
} }

3
designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/TableDataFactory.java

@ -1,6 +1,5 @@
package com.fr.design.data.tabledata.wrapper; package com.fr.design.data.tabledata.wrapper;
import com.fr.base.FRContext;
import com.fr.base.TableData; import com.fr.base.TableData;
import com.fr.data.TableDataSource; import com.fr.data.TableDataSource;
import com.fr.data.impl.ClassTableData; import com.fr.data.impl.ClassTableData;
@ -123,7 +122,7 @@ public abstract class TableDataFactory {
} }
datapane.populateBean(tabledata); // August:不管tabledata是刚刚新建的还是原来的,一律populate进去,如果出错就是代码写的不好 datapane.populateBean(tabledata); // August:不管tabledata是刚刚新建的还是原来的,一律populate进去,如果出错就是代码写的不好
} catch (Exception e) { } catch (Exception e) {
FRContext.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
} }
return datapane; return datapane;

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

@ -29,4 +29,6 @@ public class IntervalConstants {
public static final int INTERVAL_W4 = 22; public static final int INTERVAL_W4 = 22;
public static final int INTERVAL_W5 = 10;
} }

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

@ -1,14 +1,28 @@
package com.fr.design.dialog; package com.fr.design.dialog;
import com.fr.base.FRContext;
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;
import com.fr.log.FineLoggerFactory;
import javax.swing.*; import javax.swing.AbstractAction;
import java.awt.*; import javax.swing.ActionMap;
import java.awt.event.*; import javax.swing.BorderFactory;
import javax.swing.InputMap;
import javax.swing.JComponent;
import javax.swing.JDialog;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.KeyStroke;
import java.awt.BorderLayout;
import java.awt.Dialog;
import java.awt.FlowLayout;
import java.awt.Frame;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.util.ArrayList; import java.util.ArrayList;
/** /**
@ -173,7 +187,7 @@ public abstract class UIDialog extends JDialog {
l.doOk(); l.doOk();
} catch (RuntimeException e) { } catch (RuntimeException e) {
isDoOKSucceed = false; isDoOKSucceed = false;
FRContext.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
} }
if (isDoOKSucceed) { if (isDoOKSucceed) {

10
designer-base/src/main/java/com/fr/design/editor/editor/DateEditor.java

@ -3,13 +3,13 @@
*/ */
package com.fr.design.editor.editor; package com.fr.design.editor.editor;
import com.fr.base.FRContext;
import com.fr.design.gui.date.UIDatePicker; import com.fr.design.gui.date.UIDatePicker;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.general.GeneralContext; import com.fr.general.GeneralContext;
import com.fr.log.FineLoggerFactory;
import javax.swing.*; import javax.swing.JComponent;
import java.awt.*; import java.awt.BorderLayout;
import java.awt.event.ItemEvent; import java.awt.event.ItemEvent;
import java.awt.event.ItemListener; import java.awt.event.ItemListener;
import java.text.ParseException; import java.text.ParseException;
@ -113,7 +113,7 @@ public class DateEditor extends Editor<Date> {
try { try {
return this.uiDatePicker.getSelectedDate(); return this.uiDatePicker.getSelectedDate();
} catch (ParseException parseException) { } catch (ParseException parseException) {
FRContext.getLogger().error(parseException.getMessage(), parseException); FineLoggerFactory.getLogger().error(parseException.getMessage(), parseException);
return new Date(); return new Date();
} }
} }
@ -132,7 +132,7 @@ public class DateEditor extends Editor<Date> {
try { try {
this.uiDatePicker.setSelectedDate(value); this.uiDatePicker.setSelectedDate(value);
} catch (ParseException parseException) { } catch (ParseException parseException) {
FRContext.getLogger().error(parseException.getMessage(), parseException); FineLoggerFactory.getLogger().error(parseException.getMessage(), parseException);
} }
} }

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

@ -1,14 +1,14 @@
package com.fr.design.extra; package com.fr.design.extra;
import com.fr.stable.StableUtils;
import com.fr.workspace.WorkContext;
/** /**
* Created by ibm on 2017/5/25. * Created by ibm on 2017/5/25.
*/ */
public class PluginConstants { public class PluginConstants {
public static final int BYTES_NUM = 1024; public static final int BYTES_NUM = 1024;
private static final String TEMP_PATH = System.getProperty("user.dir") + "/tmp"; public static final String DOWNLOAD_PATH = StableUtils.pathJoin(WorkContext.getCurrent().getPath() + "/cache");
public static final String DOWNLOAD_PATH = System.getProperty("user.dir") + "/download";
//插件依赖的下载位置
public static final String DEPENDENCE_DOWNLOAD_PATH = System.getProperty("user.dir") + "/download/dependence";
public static final String TEMP_FILE = "temp.zip"; public static final String TEMP_FILE = "temp.zip";
public static final String CONNECTION_404 = "404"; public static final String CONNECTION_404 = "404";

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

@ -1,11 +1,9 @@
package com.fr.design.extra; package com.fr.design.extra;
import com.fr.base.FRContext;
import com.fr.config.MarketConfig; import com.fr.config.MarketConfig;
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;
import com.fr.json.JSONObject; import com.fr.json.JSONObject;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.plugin.context.PluginMarker; import com.fr.plugin.context.PluginMarker;
@ -15,7 +13,11 @@ import com.fr.plugin.manage.control.ProgressCallback;
import com.fr.plugin.view.PluginView; import com.fr.plugin.view.PluginView;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.*; import javax.swing.JComponent;
import javax.swing.JFileChooser;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
import javax.swing.filechooser.FileNameExtensionFilter; import javax.swing.filechooser.FileNameExtensionFilter;
import java.io.File; import java.io.File;
import java.util.List; import java.util.List;
@ -206,7 +208,7 @@ public class PluginFromStorePane extends PluginAbstractLoadingViewPane<List<Plug
PluginMarker toPluginMarker = PluginMarker.create(id, latestPluginVersion); PluginMarker toPluginMarker = PluginMarker.create(id, latestPluginVersion);
PluginManager.getController().download(pluginMarker, new UpdateOnlineCallback(pluginMarker, toPluginMarker, pane)); PluginManager.getController().download(pluginMarker, new UpdateOnlineCallback(pluginMarker, toPluginMarker, pane));
} catch (Exception e) { } catch (Exception e) {
FRContext.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
} }

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

@ -1,6 +1,5 @@
package com.fr.design.extra; package com.fr.design.extra;
import com.fr.base.FRContext;
import com.fr.config.MarketConfig; import com.fr.config.MarketConfig;
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;
@ -10,7 +9,6 @@ import com.fr.design.extra.exe.callback.UninstallPluginCallback;
import com.fr.design.extra.exe.callback.UpdateFromDiskCallback; import com.fr.design.extra.exe.callback.UpdateFromDiskCallback;
import com.fr.design.extra.exe.callback.UpdateOnlineCallback; import com.fr.design.extra.exe.callback.UpdateOnlineCallback;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
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;
@ -26,7 +24,8 @@ import com.fr.plugin.manage.control.PluginTaskResult;
import com.fr.plugin.view.PluginView; import com.fr.plugin.view.PluginView;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.*; import javax.swing.JOptionPane;
import javax.swing.SwingUtilities;
import java.io.File; import java.io.File;
import java.util.List; import java.util.List;
@ -63,7 +62,7 @@ public class PluginOperateUtils {
PluginTask pluginTask = PluginTask.updateTask(currentMarker, toPluginMarker); PluginTask pluginTask = PluginTask.updateTask(currentMarker, toPluginMarker);
PluginControllerHelper.updateOnline(currentMarker, toPluginMarker, new UpdateOnlineCallback(pluginTask, jsCallback)); PluginControllerHelper.updateOnline(currentMarker, toPluginMarker, new UpdateOnlineCallback(pluginTask, jsCallback));
} catch (Exception e) { } catch (Exception e) {
FRContext.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
} }

4
designer-base/src/main/java/com/fr/design/extra/PluginWebBridge.java

@ -104,7 +104,7 @@ public class PluginWebBridge {
for (String key : keySet) { for (String key : keySet) {
jsonObject.put(key, config.get(key).toString()); jsonObject.put(key, config.get(key).toString());
} }
} catch (JSONException e) { } catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
return jsonObject.toString(); return jsonObject.toString();
@ -349,7 +349,7 @@ public class PluginWebBridge {
try { try {
Task<Void> task = new PluginTask<>(webEngine, callback, new GetPluginFromStoreExecutor(new JSONObject(info))); Task<Void> task = new PluginTask<>(webEngine, callback, new GetPluginFromStoreExecutor(new JSONObject(info)));
threadPoolExecutor.submit(task); threadPoolExecutor.submit(task);
} catch (JSONException e) { } catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
} }

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

@ -74,7 +74,7 @@ public class PluginsReaderFromStore {
plugins.add(pluginView); plugins.add(pluginView);
} }
} }
} catch (JSONException e) { } catch (Exception e) {
throw new Exception(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Read_Plugin_List_Error")); throw new Exception(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Read_Plugin_List_Error"));
} }
} }

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

@ -1,7 +1,8 @@
package com.fr.design.extra; package com.fr.design.extra;
import com.fr.base.FRContext; import com.fr.general.CloudCenter;
import com.fr.general.*; import com.fr.general.ComparatorUtils;
import com.fr.general.IOUtils;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import javafx.application.Platform; import javafx.application.Platform;
import javafx.beans.property.BooleanProperty; import javafx.beans.property.BooleanProperty;
@ -25,12 +26,17 @@ import javafx.scene.paint.Color;
import javafx.scene.web.WebEngine; import javafx.scene.web.WebEngine;
import javafx.scene.web.WebEvent; import javafx.scene.web.WebEvent;
import javafx.scene.web.WebView; import javafx.scene.web.WebView;
import javafx.stage.*; import javafx.stage.Modality;
import javafx.stage.Screen;
import javafx.stage.Stage;
import javafx.stage.StageStyle;
import javafx.stage.WindowEvent;
import javafx.util.Callback; import javafx.util.Callback;
import netscape.javascript.JSObject; import netscape.javascript.JSObject;
import javax.swing.*; import javax.swing.JOptionPane;
import java.awt.*; import javax.swing.SwingUtilities;
import java.awt.Toolkit;
/** /**
* Created by zhaohehe on 16/7/28. * Created by zhaohehe on 16/7/28.
@ -79,7 +85,7 @@ public class QQLoginWebPane extends JFXPanel {
primaryStage.setY(Screen.getPrimary().getBounds().getHeight() + DEFAULT_PRIMARYSTAGE_HEIGHT); primaryStage.setY(Screen.getPrimary().getBounds().getHeight() + DEFAULT_PRIMARYSTAGE_HEIGHT);
primaryStage.show(); primaryStage.show();
} catch (Exception e) { } catch (Exception e) {
FRContext.getLogger().info(e.getMessage()); FineLoggerFactory.getLogger().info(e.getMessage());
} }
webEngine.setConfirmHandler(new Callback<String, Boolean>() { webEngine.setConfirmHandler(new Callback<String, Boolean>() {
@Override @Override

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

@ -16,6 +16,7 @@ import com.fr.json.JSONObject;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.plugin.PluginStoreConstants; import com.fr.plugin.PluginStoreConstants;
import com.fr.plugin.PluginVerifyException; import com.fr.plugin.PluginVerifyException;
import com.fr.stable.CommonUtils;
import com.fr.stable.EnvChangedListener; import com.fr.stable.EnvChangedListener;
import com.fr.stable.ProductConstants; import com.fr.stable.ProductConstants;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
@ -280,7 +281,11 @@ public class WebViewDlgHelper {
try { try {
if (get()) { if (get()) {
IOUtils.unzip(new File(StableUtils.pathJoin(PluginConstants.DOWNLOAD_PATH, PluginConstants.TEMP_FILE)), installHome); File scriptZip = new File(StableUtils.pathJoin(PluginConstants.DOWNLOAD_PATH, PluginConstants.TEMP_FILE));
if(scriptZip.exists()){
IOUtils.unzip(scriptZip, installHome);
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); 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);
} }

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

@ -19,7 +19,6 @@ 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.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;
@ -28,7 +27,17 @@ import com.fr.stable.ProductConstants;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.stable.script.Expression; import com.fr.stable.script.Expression;
import javax.swing.*; import javax.swing.BorderFactory;
import javax.swing.DefaultListCellRenderer;
import javax.swing.DefaultListModel;
import javax.swing.Icon;
import javax.swing.JComponent;
import javax.swing.JList;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JPopupMenu;
import javax.swing.JTree;
import javax.swing.SwingUtilities;
import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener; import javax.swing.event.ListSelectionListener;
import javax.swing.event.TreeSelectionEvent; import javax.swing.event.TreeSelectionEvent;
@ -38,7 +47,10 @@ import javax.swing.tree.DefaultTreeCellRenderer;
import javax.swing.tree.DefaultTreeModel; import javax.swing.tree.DefaultTreeModel;
import javax.swing.tree.MutableTreeNode; import javax.swing.tree.MutableTreeNode;
import javax.swing.tree.TreePath; import javax.swing.tree.TreePath;
import java.awt.*; import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.awt.event.KeyAdapter; import java.awt.event.KeyAdapter;
@ -566,7 +578,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula {
try { try {
expression = parser.parse(); expression = parser.parse();
} catch (Exception e) { } catch (Exception e) {
FRContext.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
// alex:继续往下面走,expression为null时告知不合法公式 // alex:继续往下面走,expression为null时告知不合法公式
} }
@ -1035,6 +1047,6 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula {
buffer.append("|"); buffer.append("|");
buffer.append("\n"); buffer.append("\n");
} }
FRContext.getLogger().debug(buffer.toString()); FineLoggerFactory.getLogger().debug(buffer.toString());
} }
} }

25
designer-base/src/main/java/com/fr/design/formula/FunctionConstants.java

@ -1,6 +1,5 @@
package com.fr.design.formula; package com.fr.design.formula;
import com.fr.base.FRContext;
import com.fr.file.FunctionConfig; import com.fr.file.FunctionConfig;
import com.fr.function.AVERAGE; import com.fr.function.AVERAGE;
import com.fr.function.CHAR; import com.fr.function.CHAR;
@ -12,7 +11,6 @@ import com.fr.function.RANGE;
import com.fr.function.SUM; import com.fr.function.SUM;
import com.fr.function.TIME; import com.fr.function.TIME;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.GeneralUtils; import com.fr.general.GeneralUtils;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.plugin.ExtraClassManager; import com.fr.plugin.ExtraClassManager;
@ -25,23 +23,28 @@ import com.fr.stable.fun.mark.Mutable;
import com.fr.stable.script.Function; import com.fr.stable.script.Function;
import com.fr.stable.script.FunctionDef; import com.fr.stable.script.FunctionDef;
import javax.swing.DefaultListModel;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.net.URL; import java.net.URL;
import java.net.URLDecoder; import java.net.URLDecoder;
import java.util.*; import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.Enumeration;
import java.util.List;
import java.util.Set;
import java.util.zip.ZipEntry; import java.util.zip.ZipEntry;
import java.util.zip.ZipFile; import java.util.zip.ZipFile;
import javax.swing.DefaultListModel;
public final class FunctionConstants { public final class FunctionConstants {
public static FunctionGroup PLUGIN = getPluginFunctionGroup(); public static FunctionGroup PLUGIN = getPluginFunctionGroup();
public static FunctionGroup CUSTOM = getCustomFunctionGroup(); public static FunctionGroup CUSTOM = getCustomFunctionGroup();
static NameAndFunctionList COMMON = getCommonFunctionList(); public static NameAndFunctionList COMMON = getCommonFunctionList();
static NameAndTypeAndFunctionList[] EMBFUNCTIONS = getEmbededFunctionListArray(); public static NameAndTypeAndFunctionList[] EMBFUNCTIONS = getEmbededFunctionListArray();
public static FunctionGroup ALL = getAllFunctionGroup(); public static FunctionGroup ALL = getAllFunctionGroup();
static { static {
@ -74,9 +77,9 @@ public final class FunctionConstants {
try { try {
classFilePath = URLDecoder.decode(classFilePath, EncodeConstants.ENCODING_UTF_8); classFilePath = URLDecoder.decode(classFilePath, EncodeConstants.ENCODING_UTF_8);
} catch (UnsupportedEncodingException e1) { } catch (UnsupportedEncodingException e1) {
FRContext.getLogger().error(e1.getMessage(), e1); FineLoggerFactory.getLogger().error(e1.getMessage(), e1);
} }
FRContext.getLogger().info("ClassFilePath:" + classFilePath); FineLoggerFactory.getLogger().info("ClassFilePath:" + classFilePath);
if (isCustomFormulaPath(classFilePath)) { if (isCustomFormulaPath(classFilePath)) {
continue; continue;
} }
@ -117,7 +120,7 @@ public final class FunctionConstants {
* 将函数分组插件中的函数添加到对应的列表中 * 将函数分组插件中的函数添加到对应的列表中
* @param listModel * @param listModel
*/ */
static void addFunctionGroupFromPlugins(DefaultListModel listModel){ public static void addFunctionGroupFromPlugins(DefaultListModel listModel){
//hugh:自定义函数分组 //hugh:自定义函数分组
Set<Mutable> containers = ExtraClassManager.getInstance().getArray(FunctionDefContainer.MARK_STRING); Set<Mutable> containers = ExtraClassManager.getInstance().getArray(FunctionDefContainer.MARK_STRING);
if(!containers.isEmpty()){ if(!containers.isEmpty()){
@ -189,7 +192,7 @@ public final class FunctionConstants {
classNameList.add(entryName.substring(classPath.length() + 1)); classNameList.add(entryName.substring(classPath.length() + 1));
} }
} catch (IOException e) { } catch (IOException e) {
FRContext.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
} else { } else {
File dir = new File(filePath); File dir = new File(filePath);

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

@ -8,7 +8,6 @@ import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.syntax.ui.rsyntaxtextarea.RSyntaxTextArea; import com.fr.design.gui.syntax.ui.rsyntaxtextarea.RSyntaxTextArea;
import com.fr.design.gui.syntax.ui.rsyntaxtextarea.SyntaxConstants; import com.fr.design.gui.syntax.ui.rsyntaxtextarea.SyntaxConstants;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.stable.EncodeConstants; import com.fr.stable.EncodeConstants;
import com.fr.stable.JavaCompileInfo; import com.fr.stable.JavaCompileInfo;
@ -17,8 +16,13 @@ import com.fr.stable.StringUtils;
import com.fr.stable.project.ProjectConstants; import com.fr.stable.project.ProjectConstants;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
import javax.swing.*; import javax.swing.AbstractAction;
import java.awt.*; import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.SwingWorker;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.io.ByteArrayInputStream; import java.io.ByteArrayInputStream;
@ -51,7 +55,7 @@ public class JavaEditorPane extends BasicPane {
try { try {
return StableUtils.inputStream2String(in, EncodeConstants.ENCODING_UTF_8); return StableUtils.inputStream2String(in, EncodeConstants.ENCODING_UTF_8);
} catch (IOException e) { } catch (IOException e) {
FRContext.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
} }
return null; return null;
@ -115,7 +119,7 @@ public class JavaEditorPane extends BasicPane {
try { try {
return new ByteArrayInputStream(WorkContext.getWorkResource().readFully(StableUtils.pathJoin(ProjectConstants.CLASSES_NAME, javaPath))); return new ByteArrayInputStream(WorkContext.getWorkResource().readFully(StableUtils.pathJoin(ProjectConstants.CLASSES_NAME, javaPath)));
} catch (Exception e) { } catch (Exception e) {
FRContext.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
return null; return null;
} }

4
designer-base/src/main/java/com/fr/design/gui/controlpane/CommonShortCutHandlers.java

@ -1,11 +1,11 @@
package com.fr.design.gui.controlpane; package com.fr.design.gui.controlpane;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.FRContext;
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.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.stable.Nameable; import com.fr.stable.Nameable;
@ -71,7 +71,7 @@ public class CommonShortCutHandlers {
listControlPane.addNameable(newNameable, listControlPane.getSelectedIndex() + 1); listControlPane.addNameable(newNameable, listControlPane.getSelectedIndex() + 1);
} catch (Exception e) { } catch (Exception e) {
FRContext.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
} }

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

@ -6,11 +6,11 @@ import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itoolbar.UIToolBarUI; import com.fr.design.gui.itoolbar.UIToolBarUI;
import com.fr.design.gui.itoolbar.UIToolbar; import com.fr.design.gui.itoolbar.UIToolbar;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
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.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
@ -23,7 +23,6 @@ import javax.swing.JSplitPane;
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;
import java.awt.Component;
import java.awt.Cursor; import java.awt.Cursor;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.FlowLayout; import java.awt.FlowLayout;
@ -159,14 +158,21 @@ abstract class UIControlPane extends JControlPane {
} }
protected JPanel getLeftTopPane(UIToolbar topToolBar) { protected JPanel getLeftTopPane(UIToolbar topToolBar) {
double p = TableLayout.PREFERRED; UILabel addItemLabel = FRWidgetFactory.createLineWrapLabel(getAddItemText());
double f = TableLayout.FILL;
double[] columnSize = {p, f, isNewStyle() ? TOP_TOOLBAR_WIDTH : TOP_TOOLBAR_WIDTH_SHORT}; topToolBar.setPreferredSize(
double[] rowSize = {TOP_TOOLBAR_HEIGHT}; new Dimension(
Component[][] components = new Component[][]{ isNewStyle() ? TOP_TOOLBAR_WIDTH : TOP_TOOLBAR_WIDTH_SHORT,
new Component[]{new UILabel(getAddItemText()), new JPanel(), topToolBar}, TOP_TOOLBAR_HEIGHT
}; ));
return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); JPanel toolBarPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
toolBarPane.add(topToolBar, BorderLayout.NORTH);
JPanel leftTopPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
leftTopPane.add(toolBarPane, BorderLayout.EAST);
leftTopPane.add(addItemLabel, BorderLayout.CENTER);
return leftTopPane;
} }
/** /**

10
designer-base/src/main/java/com/fr/design/gui/core/CustomWidgetOption.java

@ -1,9 +1,9 @@
package com.fr.design.gui.core; package com.fr.design.gui.core;
import javax.swing.Icon;
import com.fr.base.FRContext;
import com.fr.form.ui.Widget; import com.fr.form.ui.Widget;
import com.fr.log.FineLoggerFactory;
import javax.swing.Icon;
public class CustomWidgetOption extends WidgetOption { public class CustomWidgetOption extends WidgetOption {
private static final long serialVersionUID = -8144214820100962842L; private static final long serialVersionUID = -8144214820100962842L;
@ -23,9 +23,9 @@ public class CustomWidgetOption extends WidgetOption {
Widget ins = cls.newInstance(); Widget ins = cls.newInstance();
return ins ; return ins ;
} catch (InstantiationException e) { } catch (InstantiationException e) {
FRContext.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} catch (IllegalAccessException e) { } catch (IllegalAccessException e) {
FRContext.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
return null; return null;

10
designer-base/src/main/java/com/fr/design/gui/core/UITextComponent.java

@ -0,0 +1,10 @@
package com.fr.design.gui.core;
/**
* 这个接口说明一个基本组件可以设置文本
* Created by plough on 2019/1/11.
*/
public interface UITextComponent {
String getText();
void setText(String text);
}

9
designer-base/src/main/java/com/fr/design/gui/date/SingleObjectComboBoxModel.java

@ -1,12 +1,11 @@
package com.fr.design.gui.date; package com.fr.design.gui.date;
import java.text.SimpleDateFormat; import com.fr.log.FineLoggerFactory;
import java.util.Date;
import javax.swing.AbstractListModel; import javax.swing.AbstractListModel;
import javax.swing.ComboBoxModel; import javax.swing.ComboBoxModel;
import java.text.SimpleDateFormat;
import com.fr.base.FRContext; import java.util.Date;
public class SingleObjectComboBoxModel extends AbstractListModel implements ComboBoxModel { public class SingleObjectComboBoxModel extends AbstractListModel implements ComboBoxModel {
private SimpleDateFormat dateFormat; private SimpleDateFormat dateFormat;
@ -35,7 +34,7 @@ public class SingleObjectComboBoxModel extends AbstractListModel implements Comb
try { try {
selectedDate = this.dateFormat.format((Date) anItem); selectedDate = this.dateFormat.format((Date) anItem);
} catch (Exception e) { } catch (Exception e) {
FRContext.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
} else { } else {
try { try {

17
designer-base/src/main/java/com/fr/design/gui/date/UIDatePicker.java

@ -1,19 +1,26 @@
package com.fr.design.gui.date; package com.fr.design.gui.date;
import com.fr.base.FRContext;
import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.icombobox.UIComboBoxUI; import com.fr.design.gui.icombobox.UIComboBoxUI;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.general.ComparatorUtils;
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 javax.swing.*; import javax.swing.BorderFactory;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.SwingConstants;
import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener; import javax.swing.event.ChangeListener;
import javax.swing.plaf.ComboBoxUI; import javax.swing.plaf.ComboBoxUI;
import javax.swing.plaf.basic.BasicComboPopup; import javax.swing.plaf.basic.BasicComboPopup;
import javax.swing.plaf.basic.ComboPopup; import javax.swing.plaf.basic.ComboPopup;
import java.awt.*; import java.awt.BorderLayout;
import java.awt.Cursor;
import java.awt.LayoutManager;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.io.Serializable; import java.io.Serializable;
import java.text.ParseException; import java.text.ParseException;
@ -213,7 +220,7 @@ public class UIDatePicker extends UIComboBox implements Serializable {
calendarPanel.updateHMS(); calendarPanel.updateHMS();
} }
} catch (Exception e) { } catch (Exception e) {
FRContext.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
} else if (ComparatorUtils.equals(oldValue, Boolean.TRUE) } else if (ComparatorUtils.equals(oldValue, Boolean.TRUE)
&& ComparatorUtils.equals(newValue, Boolean.FALSE)) { //HIDE && ComparatorUtils.equals(newValue, Boolean.FALSE)) { //HIDE

15
designer-base/src/main/java/com/fr/design/gui/demo/LoadingPaneDemo.java

@ -3,16 +3,15 @@
*/ */
package com.fr.design.gui.demo; package com.fr.design.gui.demo;
import java.awt.event.ActionEvent; import com.fr.design.dialog.BasicDialog;
import java.awt.event.ActionListener;
import javax.swing.JPanel;
import com.fr.base.FRContext;
import com.fr.design.gui.frpane.LoadingBasicPane; import com.fr.design.gui.frpane.LoadingBasicPane;
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.dialog.BasicDialog; import com.fr.log.FineLoggerFactory;
import javax.swing.JPanel;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
/** /**
* Created by IntelliJ IDEA. * Created by IntelliJ IDEA.
@ -35,7 +34,7 @@ public class LoadingPaneDemo extends JPanel {
try { try {
Thread.sleep(500); Thread.sleep(500);
} catch (InterruptedException e) { } catch (InterruptedException e) {
FRContext.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
container.add(new UIButton(i + "adfadwdadawdwad")); container.add(new UIButton(i + "adfadwdadawdwad"));
} }

10
designer-base/src/main/java/com/fr/design/gui/frpane/LoadingBasicPaneTest.java

@ -3,11 +3,11 @@
*/ */
package com.fr.design.gui.frpane; package com.fr.design.gui.frpane;
import javax.swing.JPanel;
import com.fr.base.FRContext;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.BasicDialog;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.log.FineLoggerFactory;
import javax.swing.JPanel;
/** /**
@ -23,7 +23,7 @@ public class LoadingBasicPaneTest {
try { try {
Thread.sleep(500); Thread.sleep(500);
} catch (InterruptedException e) { } catch (InterruptedException e) {
FRContext.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
container.add(new UIButton(i + "adfadwdadawdwad")); container.add(new UIButton(i + "adfadwdadawdwad"));
} }

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

@ -1,19 +1,32 @@
package com.fr.design.gui.frpane; package com.fr.design.gui.frpane;
import java.awt.*;
import java.awt.event.AWTEventListener;
import java.awt.event.MouseEvent;
import javax.swing.JComponent;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;
import com.fr.base.FRContext;
import com.fr.design.beans.BasicBeanPane; import com.fr.design.beans.BasicBeanPane;
import com.fr.design.dialog.UIDialog; import com.fr.design.dialog.UIDialog;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import com.sun.awt.AWTUtilities; import com.sun.awt.AWTUtilities;
import javax.swing.JComponent;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;
import java.awt.AWTEvent;
import java.awt.BasicStroke;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dialog;
import java.awt.Frame;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Point;
import java.awt.Polygon;
import java.awt.Rectangle;
import java.awt.Shape;
import java.awt.Stroke;
import java.awt.Toolkit;
import java.awt.Window;
import java.awt.event.AWTEventListener;
import java.awt.event.MouseEvent;
/** /**
* @author Jerry * @author Jerry
* 非模态悬浮对话框气泡形状 * 非模态悬浮对话框气泡形状
@ -300,7 +313,7 @@ public abstract class UIBubbleFloatPane<T> extends BasicBeanPane<T> {
try { try {
AWTUtilities.setWindowShape(CustomShapedDialog.this, this.getCustomShap()); AWTUtilities.setWindowShape(CustomShapedDialog.this, this.getCustomShap());
} catch (UnsupportedOperationException e) { } catch (UnsupportedOperationException e) {
FRContext.getLogger().info("Not support"); FineLoggerFactory.getLogger().info("Not support");
} }
final JPanel contentPane = (JPanel) this.getContentPane(); final JPanel contentPane = (JPanel) this.getContentPane();
this.setLayout(null); this.setLayout(null);

44
designer-base/src/main/java/com/fr/design/gui/ibutton/UIButton.java

@ -6,22 +6,36 @@ import com.fr.base.GraphHelper;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
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.core.UITextComponent;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.design.utils.gui.GUICoreUtils;
import javax.swing.*; import javax.swing.Action;
import javax.swing.Icon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.ToolTipManager;
import javax.swing.plaf.ButtonUI; import javax.swing.plaf.ButtonUI;
import java.awt.*; import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Insets;
import java.awt.Shape;
import java.awt.Stroke;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.awt.geom.RoundRectangle2D; import java.awt.geom.RoundRectangle2D;
public class UIButton extends JButton implements UIObserver { public class UIButton extends JButton implements UIObserver, UITextComponent {
private static final int TOOLTIP_INIT_DELAY = 300; // 延迟 0.3s 显示提示文字
public static final int OTHER_BORDER = 1; public static final int OTHER_BORDER = 1;
public static final int NORMAL_BORDER = 2; public static final int NORMAL_BORDER = 2;
private static final int HEIGH = 20; private static final int HEIGHT = 20;
private boolean isExtraPainted = true; private boolean isExtraPainted = true;
private boolean isRoundBorder = true; private boolean isRoundBorder = true;
private int rectDirection = Constants.NULL; private int rectDirection = Constants.NULL;
@ -36,7 +50,6 @@ public class UIButton extends JButton implements UIObserver {
private CellBorderStyle border = null; private CellBorderStyle border = null;
protected UIObserverListener uiObserverListener; protected UIObserverListener uiObserverListener;
private static final int TOOLTIP_INIT_DELAY = 300; // 延迟 0.3s 显示提示文字
public UIButton() { public UIButton() {
this(StringUtils.EMPTY); this(StringUtils.EMPTY);
@ -112,7 +125,7 @@ public class UIButton extends JButton implements UIObserver {
public void set4ToolbarButton() { public void set4ToolbarButton() {
setNormalPainted(false); setNormalPainted(false);
Dimension dim = getPreferredSize(); Dimension dim = getPreferredSize();
dim.height = HEIGH; dim.height = HEIGHT;
setBackground(null); setBackground(null);
setOpaque(false); setOpaque(false);
setSize(dim); setSize(dim);
@ -170,7 +183,11 @@ public class UIButton extends JButton implements UIObserver {
//@Override //@Override
public Dimension getPreferredSize() { public Dimension getPreferredSize() {
return new Dimension(super.getPreferredSize().width, 20); Dimension dim = super.getPreferredSize();
if (isFixedHeight() || dim.height < HEIGHT) {
dim.height = HEIGHT;
}
return dim;
} }
@ -323,7 +340,16 @@ public class UIButton extends JButton implements UIObserver {
this.isBorderPaintedOnlyWhenPressed = value; this.isBorderPaintedOnlyWhenPressed = value;
} }
/** private boolean isFixedHeight() {
String text = this.getText();
if (StringUtils.isEmpty(text)) {
return true;
}
// 如果允许换行,需要放开按钮高度的限制
return !text.startsWith("<html>");
}
/**
* 主函数 * 主函数
* @param args 入口参数 * @param args 入口参数
*/ */

15
designer-base/src/main/java/com/fr/design/gui/ibutton/UIButtonGroup.java

@ -3,6 +3,7 @@ package com.fr.design.gui.ibutton;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.event.GlobalNameListener; import com.fr.design.event.GlobalNameListener;
import com.fr.design.event.GlobalNameObserver; import com.fr.design.event.GlobalNameObserver;
import com.fr.design.utils.gui.UIComponentUtils;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import sun.swing.SwingUtilities2; import sun.swing.SwingUtilities2;
@ -25,6 +26,9 @@ import java.util.List;
public class UIButtonGroup<T> extends JPanel implements GlobalNameObserver { public class UIButtonGroup<T> extends JPanel implements GlobalNameObserver {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private static final int TEXT_LENGTH = 3;
private static final int BUTTON_SIZE = 2;
private int currentButtonSize = 0;
protected List<UIToggleButton> labelButtonList; protected List<UIToggleButton> labelButtonList;
protected int selectedIndex = -1; protected int selectedIndex = -1;
private List<T> objectList;// 起到一个render的作用 private List<T> objectList;// 起到一个render的作用
@ -153,6 +157,7 @@ public class UIButtonGroup<T> extends JPanel implements GlobalNameObserver {
if (!ArrayUtils.isEmpty(objects) && textArray.length == objects.length) { if (!ArrayUtils.isEmpty(objects) && textArray.length == objects.length) {
this.objectList = Arrays.asList(objects); this.objectList = Arrays.asList(objects);
} }
currentButtonSize = textArray.length;
labelButtonList = new ArrayList<UIToggleButton>(textArray.length); labelButtonList = new ArrayList<UIToggleButton>(textArray.length);
this.setLayout(getGridLayout(textArray.length)); this.setLayout(getGridLayout(textArray.length));
this.setBorder(getGroupBorder()); this.setBorder(getGroupBorder());
@ -213,10 +218,20 @@ public class UIButtonGroup<T> extends JPanel implements GlobalNameObserver {
protected void initButton(UIToggleButton labelButton) { protected void initButton(UIToggleButton labelButton) {
labelButton.setBorderPainted(false); labelButton.setBorderPainted(false);
adjustButton(labelButton);
UIComponentUtils.setLineWrap(labelButton);
labelButtonList.add(labelButton); labelButtonList.add(labelButton);
this.add(labelButton); this.add(labelButton);
} }
private void adjustButton(UIToggleButton labelButton) {
if (labelButton.getText().length() > TEXT_LENGTH && currentButtonSize > BUTTON_SIZE) {
Dimension dimension = labelButton.getPreferredSize();
dimension.height <<= 1;
labelButton.setPreferredSize(dimension);
}
}
protected Border getGroupBorder() { protected Border getGroupBorder() {
return BorderFactory.createEmptyBorder(1, 1, 1, 1); return BorderFactory.createEmptyBorder(1, 1, 1, 1);
} }

20
designer-base/src/main/java/com/fr/design/gui/ibutton/UIHeadGroup.java

@ -3,9 +3,15 @@ package com.fr.design.gui.ibutton;
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.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.design.utils.gui.UIComponentUtils;
import javax.swing.*;
import java.awt.*; import javax.swing.Icon;
import javax.swing.JFrame;
import javax.swing.JPanel;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.GridLayout;
import java.awt.event.MouseAdapter; import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.awt.event.MouseListener; import java.awt.event.MouseListener;
@ -13,6 +19,7 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
public class UIHeadGroup extends JPanel { public class UIHeadGroup extends JPanel {
private static final int MIN_HEIGHT = 25;
protected List<UIToggleButton> labelButtonList; protected List<UIToggleButton> labelButtonList;
private boolean isNeedLeftRightOutLine = true; private boolean isNeedLeftRightOutLine = true;
protected int selectedIndex = -1; protected int selectedIndex = -1;
@ -25,7 +32,6 @@ public class UIHeadGroup extends JPanel {
labelButtonList = new ArrayList<UIToggleButton>(textArray.length); labelButtonList = new ArrayList<UIToggleButton>(textArray.length);
this.setBackground(UIConstants.TREE_BACKGROUND); this.setBackground(UIConstants.TREE_BACKGROUND);
this.setLayout(new GridLayout(0, textArray.length, 0, 0)); this.setLayout(new GridLayout(0, textArray.length, 0, 0));
// this.setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1));
for (int i = 0; i < textArray.length; i++) { for (int i = 0; i < textArray.length; i++) {
final int index = i; final int index = i;
String text = textArray[i]; String text = textArray[i];
@ -50,7 +56,6 @@ public class UIHeadGroup extends JPanel {
labelButtonList = new ArrayList<UIToggleButton>(iconArray.length); labelButtonList = new ArrayList<UIToggleButton>(iconArray.length);
this.setBackground(UIConstants.NORMAL_BACKGROUND); this.setBackground(UIConstants.NORMAL_BACKGROUND);
this.setLayout(new GridLayout(0, iconArray.length, 1, 0)); this.setLayout(new GridLayout(0, iconArray.length, 1, 0));
// this.setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1));
for (int i = 0; i < iconArray.length; i++) { for (int i = 0; i < iconArray.length; i++) {
final int index = i; final int index = i;
Icon icon = iconArray[i]; Icon icon = iconArray[i];
@ -99,7 +104,9 @@ public class UIHeadGroup extends JPanel {
@Override @Override
public Dimension getPreferredSize() { public Dimension getPreferredSize() {
Dimension dim = super.getPreferredSize(); Dimension dim = super.getPreferredSize();
dim.height = 25; if (dim.height < MIN_HEIGHT) {
dim.height = MIN_HEIGHT;
}
return dim; return dim;
} }
@ -133,6 +140,7 @@ public class UIHeadGroup extends JPanel {
labelButton.setRoundBorder(false); labelButton.setRoundBorder(false);
labelButton.setBorderPainted(false); labelButton.setBorderPainted(false);
labelButton.setPressedPainted(false); labelButton.setPressedPainted(false);
UIComponentUtils.setLineWrap(labelButton);
labelButtonList.add(labelButton); labelButtonList.add(labelButton);
this.add(labelButton); this.add(labelButton);
} }

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

@ -5,6 +5,7 @@ import com.fr.design.event.GlobalNameListener;
import com.fr.design.event.GlobalNameObserver; 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.core.UITextComponent;
import com.fr.design.utils.gui.GUIPaintUtils; import com.fr.design.utils.gui.GUIPaintUtils;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import sun.swing.SwingUtilities2; import sun.swing.SwingUtilities2;
@ -29,7 +30,7 @@ import java.awt.RenderingHints;
import java.awt.event.ItemEvent; import java.awt.event.ItemEvent;
import java.awt.event.ItemListener; import java.awt.event.ItemListener;
public class UICheckBox extends JCheckBox implements UIObserver, GlobalNameObserver { public class UICheckBox extends JCheckBox implements UIObserver, GlobalNameObserver, UITextComponent {
private UIObserverListener uiObserverListener; private UIObserverListener uiObserverListener;
private GlobalNameListener globalNameListener = null; private GlobalNameListener globalNameListener = null;
private String checkboxName = ""; private String checkboxName = "";

7
designer-base/src/main/java/com/fr/design/gui/icombobox/ExtendedComboBoxTest.java

@ -1,18 +1,17 @@
package com.fr.design.gui.icombobox; package com.fr.design.gui.icombobox;
import java.awt.BorderLayout; import com.fr.log.FineLoggerFactory;
import javax.swing.JFrame; import javax.swing.JFrame;
import javax.swing.UIManager; import javax.swing.UIManager;
import java.awt.BorderLayout;
import com.fr.base.FRContext;
public class ExtendedComboBoxTest { public class ExtendedComboBoxTest {
public static void main(String[] args) { public static void main(String[] args) {
try { try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (Exception e) { } catch (Exception e) {
FRContext.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
final ExtendedComboBox cb = new ExtendedComboBox( final ExtendedComboBox cb = new ExtendedComboBox(

19
designer-base/src/main/java/com/fr/design/gui/icombobox/LazyComboBoxTest.java

@ -3,19 +3,18 @@
*/ */
package com.fr.design.gui.icombobox; package com.fr.design.gui.icombobox;
import java.awt.BorderLayout; import com.fr.design.gui.itextfield.UITextField;
import java.awt.event.ItemEvent; import com.fr.design.layout.FRGUIPaneFactory;
import java.awt.event.ItemListener; import com.fr.log.FineLoggerFactory;
import com.sun.java.swing.plaf.windows.WindowsLookAndFeel;
import javax.swing.JFrame; import javax.swing.JFrame;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.UIManager; import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException; import javax.swing.UnsupportedLookAndFeelException;
import java.awt.BorderLayout;
import com.fr.base.FRContext; import java.awt.event.ItemEvent;
import com.fr.design.gui.itextfield.UITextField; import java.awt.event.ItemListener;
import com.fr.design.layout.FRGUIPaneFactory;
import com.sun.java.swing.plaf.windows.WindowsLookAndFeel;
/** /**
* @author richer * @author richer
@ -26,7 +25,7 @@ public class LazyComboBoxTest {
try { try {
UIManager.setLookAndFeel(new WindowsLookAndFeel()); UIManager.setLookAndFeel(new WindowsLookAndFeel());
} catch (UnsupportedLookAndFeelException e1) { } catch (UnsupportedLookAndFeelException e1) {
FRContext.getLogger().error(e1.getMessage(), e1); FineLoggerFactory.getLogger().error(e1.getMessage(), e1);
} }
JFrame f = new JFrame(); JFrame f = new JFrame();
JPanel p = (JPanel) f.getContentPane(); JPanel p = (JPanel) f.getContentPane();
@ -40,7 +39,7 @@ public class LazyComboBoxTest {
try { try {
Thread.sleep(3000); Thread.sleep(3000);
} catch (InterruptedException e) { } catch (InterruptedException e) {
FRContext.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
return m; return m;
} }

5
designer-base/src/main/java/com/fr/design/gui/ilable/UILabel.java

@ -1,9 +1,9 @@
package com.fr.design.gui.ilable; package com.fr.design.gui.ilable;
import com.fr.design.gui.core.UITextComponent;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.stable.StringUtils;
import javax.swing.Icon; import javax.swing.Icon;
import javax.swing.JFrame; import javax.swing.JFrame;
import javax.swing.JLabel; import javax.swing.JLabel;
@ -19,7 +19,7 @@ import java.awt.Dimension;
* Date: 13-1-23 * Date: 13-1-23
* Time: 下午3:15 * Time: 下午3:15
*/ */
public class UILabel extends JLabel { public class UILabel extends JLabel implements UITextComponent {
private static final int HTML_SHIFT_HEIGHT = 3; private static final int HTML_SHIFT_HEIGHT = 3;
public UILabel(String text, Icon image, int horizontalAlignment) { public UILabel(String text, Icon image, int horizontalAlignment) {
@ -64,7 +64,6 @@ public class UILabel extends JLabel {
return preferredSize; return preferredSize;
} }
public static void main(String[] args) { public static void main(String[] args) {
// UILabel label = new UILabel("shishi",SwingConstants.LEFT); // UILabel label = new UILabel("shishi",SwingConstants.LEFT);
JFrame frame = new JFrame("Test"); JFrame frame = new JFrame("Test");

60
designer-base/src/main/java/com/fr/design/gui/ilist/TableViewList.java

@ -1,11 +1,10 @@
package com.fr.design.gui.ilist; package com.fr.design.gui.ilist;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.FRContext;
import com.fr.data.core.DataCoreUtils; import com.fr.data.core.DataCoreUtils;
import com.fr.data.core.db.TableProcedure; import com.fr.data.core.db.TableProcedure;
import com.fr.data.core.db.dialect.DialectFactory; import com.fr.data.core.db.dialect.base.key.check.DataBaseDetail;
import com.fr.data.core.db.dialect.OracleDialect; import com.fr.data.core.db.dialect.base.key.check.DataBaseType;
import com.fr.data.impl.Connection; import com.fr.data.impl.Connection;
import com.fr.data.operator.DataOperator; import com.fr.data.operator.DataOperator;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
@ -13,11 +12,17 @@ import com.fr.design.constants.UIConstants;
import com.fr.design.mainframe.dnd.SerializableTransferable; import com.fr.design.mainframe.dnd.SerializableTransferable;
import com.fr.file.ConnectionConfig; import com.fr.file.ConnectionConfig;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.ArrayUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.*; import javax.swing.DefaultListCellRenderer;
import java.awt.*; import javax.swing.DefaultListModel;
import javax.swing.Icon;
import javax.swing.JList;
import javax.swing.ListSelectionModel;
import javax.swing.SwingWorker;
import java.awt.Component;
import java.awt.dnd.DnDConstants; import java.awt.dnd.DnDConstants;
import java.awt.dnd.DragGestureEvent; import java.awt.dnd.DragGestureEvent;
import java.awt.dnd.DragGestureListener; import java.awt.dnd.DragGestureListener;
@ -111,7 +116,7 @@ public class TableViewList extends UIList {
} catch (Exception e) { } catch (Exception e) {
if (!(e instanceof InterruptedException) && !(e instanceof CancellationException)) { if (!(e instanceof InterruptedException) && !(e instanceof CancellationException)) {
TableViewList.this.setModel(failed); TableViewList.this.setModel(failed);
FRContext.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
} }
} }
@ -138,21 +143,16 @@ public class TableViewList extends UIList {
String[] schemas = DataCoreUtils.getDatabaseSchema(datasource); String[] schemas = DataCoreUtils.getDatabaseSchema(datasource);
searchFilter = searchFilter.toLowerCase(); searchFilter = searchFilter.toLowerCase();
boolean isOracle = DataOperator.getInstance().isOracle(datasource);
boolean isOracleSystemSpace = DesignerEnvManager.getEnvManager().isOracleSystemSpace(); boolean isOracleSystemSpace = DesignerEnvManager.getEnvManager().isOracleSystemSpace();
// oracleb不勾选显示所有表,则只显示用户下的(包括存储过程和table表) // oracle不勾选显示所有表,则只显示用户下的(包括存储过程和table表)
if (isOracle && !isOracleSystemSpace) { DataBaseDetail detail = DataOperator.getInstance().getDataBaseDetail(datasource, isOracleSystemSpace);
java.sql.Connection connection = datasource.createConnection(); if (ArrayUtils.isNotEmpty(detail.getSchemas())) {
OracleDialect orcDialect = (OracleDialect)DialectFactory.generateDialect(connection); schemas = detail.getSchemas();
schemas = new String[]{orcDialect.getOracleCurrentUserSchema(connection)};
} }
if (typesFilter.length == 1 && ComparatorUtils.equals(typesFilter[0], TableProcedure.PROCEDURE)) { if (typesFilter.length == 1 && ComparatorUtils.equals(typesFilter[0], TableProcedure.PROCEDURE)) {
return processStoreProcedure(defaultListModel, schemas, datasource, isOracle, searchFilter); return processStoreProcedure(defaultListModel, schemas, datasource, DataBaseType.ORACLE.equals(detail.getType()), searchFilter);
} else { } else {
return processTableAndView(defaultListModel, schemas, datasource, searchFilter, isOracle, typesFilter); return processTableAndView(defaultListModel, schemas, datasource, searchFilter, DataBaseType.ORACLE.equals(detail.getType()), typesFilter);
} }
} }
@ -182,7 +182,7 @@ public class TableViewList extends UIList {
if (!isOracle) { if (!isOracle) {
String schema = null; String schema = null;
for (String type : typesFilter) { for (String type : typesFilter) {
//非oracle数据库,默认都是显示所有表的,参数为true //非oracle数据库,默认都是显示所有表的,参数为true
TableProcedure[] sqlTables = DataCoreUtils.getTables(datasource, type, schema, true); TableProcedure[] sqlTables = DataCoreUtils.getTables(datasource, type, schema, true);
for (int i = 0; i < sqlTables.length; i++) { for (int i = 0; i < sqlTables.length; i++) {
if (isBlank || sqlTables[i].getName().toLowerCase().indexOf(searchFilter) != -1) { if (isBlank || sqlTables[i].getName().toLowerCase().indexOf(searchFilter) != -1) {
@ -192,17 +192,17 @@ public class TableViewList extends UIList {
} }
} else { } else {
for (String type : typesFilter) { for (String type : typesFilter) {
for (String schema : schemas) { for (String schema : schemas) {
TableProcedure[] sqlTables = DataCoreUtils.getTables(datasource, type, schema, isOracleSystemSpace); TableProcedure[] sqlTables = DataCoreUtils.getTables(datasource, type, schema, isOracleSystemSpace);
// oracle的表名加上模式 // oracle的表名加上模式
for (int i = 0; i < sqlTables.length; i++) { for (int i = 0; i < sqlTables.length; i++) {
TableProcedure ta = sqlTables[i]; TableProcedure ta = sqlTables[i];
String name = ta.getSchema() + '.' + ta.getName(); String name = ta.getSchema() + '.' + ta.getName();
if (isBlank || name.toLowerCase().indexOf(searchFilter) != -1) { if (isBlank || name.toLowerCase().indexOf(searchFilter) != -1) {
defaultListModel.addElement(sqlTables[i]); defaultListModel.addElement(sqlTables[i]);
} }
} }
} }
} }
} }
return defaultListModel; return defaultListModel;

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

@ -1,8 +1,8 @@
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.base.FRContext;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.log.FineLoggerFactory;
import javax.swing.JOptionPane; import javax.swing.JOptionPane;
import javax.swing.JTable; import javax.swing.JTable;
@ -166,7 +166,7 @@ public abstract class UITableModelAdapter<T extends Object> extends AbstractTabl
try { try {
table.getCellEditor().stopCellEditing(); table.getCellEditor().stopCellEditing();
} catch (Exception ee) { } catch (Exception ee) {
FRContext.getLogger().error(ee.getMessage(), ee); FineLoggerFactory.getLogger().error(ee.getMessage(), ee);
} }
} }
} }
@ -241,7 +241,7 @@ public abstract class UITableModelAdapter<T extends Object> extends AbstractTabl
try { try {
table.getCellEditor().stopCellEditing(); table.getCellEditor().stopCellEditing();
} catch (Exception ee) { } catch (Exception ee) {
FRContext.getLogger().error(ee.getMessage(), ee); FineLoggerFactory.getLogger().error(ee.getMessage(), ee);
} }
} }
if (getRowCount() < 1 || selectedRow.length < 0) { if (getRowCount() < 1 || selectedRow.length < 0) {

17
designer-base/src/main/java/com/fr/design/gui/itooltip/MultiLineToolTipUI.java

@ -1,5 +1,12 @@
package com.fr.design.gui.itooltip; package com.fr.design.gui.itooltip;
import com.fr.base.GraphHelper;
import com.fr.log.FineLoggerFactory;
import javax.swing.JComponent;
import javax.swing.JToolTip;
import javax.swing.SwingUtilities;
import javax.swing.plaf.ToolTipUI;
import java.awt.Color; import java.awt.Color;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.FontMetrics; import java.awt.FontMetrics;
@ -13,14 +20,6 @@ import java.io.StringReader;
import java.util.Enumeration; import java.util.Enumeration;
import java.util.Vector; import java.util.Vector;
import javax.swing.JComponent;
import javax.swing.JToolTip;
import javax.swing.SwingUtilities;
import javax.swing.plaf.ToolTipUI;
import com.fr.base.FRContext;
import com.fr.base.GraphHelper;
public class MultiLineToolTipUI extends ToolTipUI { public class MultiLineToolTipUI extends ToolTipUI {
private String[] strs; private String[] strs;
@ -65,7 +64,7 @@ public class MultiLineToolTipUI extends ToolTipUI {
v.addElement(line); v.addElement(line);
} }
} catch (IOException ex) { } catch (IOException ex) {
FRContext.getLogger().error(ex.getMessage(), ex); FineLoggerFactory.getLogger().error(ex.getMessage(), ex);
} }
int lines = v.size(); int lines = v.size();
if (lines < 1) { if (lines < 1) {

20
designer-base/src/main/java/com/fr/design/gui/itooltip/UIToolTip.java

@ -1,12 +1,22 @@
package com.fr.design.gui.itooltip; package com.fr.design.gui.itooltip;
import com.fr.base.FRContext;
import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.log.FineLoggerFactory;
import javax.swing.*; import javax.swing.Icon;
import java.awt.*; import javax.swing.ImageIcon;
import java.awt.event.*; import javax.swing.JToolTip;
import javax.swing.ToolTipManager;
import java.awt.AWTException;
import java.awt.Container;
import java.awt.Point;
import java.awt.Robot;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseMotionAdapter;
import java.awt.event.MouseWheelEvent;
import java.awt.event.MouseWheelListener;
/** /**
* Created with IntelliJ IDEA. * Created with IntelliJ IDEA.
@ -39,7 +49,7 @@ public class UIToolTip extends JToolTip{
} }
}); });
} catch (AWTException e) { } catch (AWTException e) {
FRContext.getLogger().error(e.getMessage(),e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
this.addMouseWheelListener(new MouseWheelListener() { this.addMouseWheelListener(new MouseWheelListener() {

18
designer-base/src/main/java/com/fr/design/gui/itooltip/UIToolTipUI.java

@ -1,11 +1,21 @@
package com.fr.design.gui.itooltip; package com.fr.design.gui.itooltip;
import com.fr.base.FRContext;
import com.fr.base.GraphHelper; import com.fr.base.GraphHelper;
import com.fr.log.FineLoggerFactory;
import javax.swing.*; import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JComponent;
import javax.swing.JToolTip;
import javax.swing.SwingUtilities;
import javax.swing.plaf.ToolTipUI; import javax.swing.plaf.ToolTipUI;
import java.awt.*; import java.awt.Color;
import java.awt.Dimension;
import java.awt.FontMetrics;
import java.awt.GradientPaint;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.RenderingHints;
import java.awt.geom.GeneralPath; import java.awt.geom.GeneralPath;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.IOException; import java.io.IOException;
@ -98,7 +108,7 @@ public class UIToolTipUI extends ToolTipUI {
v.addElement(line); v.addElement(line);
} }
} catch (IOException ex) { } catch (IOException ex) {
FRContext.getLogger().error(ex.getMessage(), ex); FineLoggerFactory.getLogger().error(ex.getMessage(), ex);
} }
int lines = v.size(); int lines = v.size();
if (lines < 1) { if (lines < 1) {

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

@ -2,8 +2,10 @@ package com.fr.design.gui.itree.filetree;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.base.extension.FileExtension; import com.fr.base.extension.FileExtension;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.file.NodeAuthProcessor; import com.fr.design.file.NodeAuthProcessor;
import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode; import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode;
import com.fr.design.mainframe.App;
import com.fr.file.filetree.FileNode; import com.fr.file.filetree.FileNode;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
@ -15,7 +17,9 @@ import javax.swing.tree.DefaultTreeModel;
import javax.swing.tree.TreePath; import javax.swing.tree.TreePath;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Set;
/* /*
* 显示Env下的reportlets目录下面的所有cpt文件 * 显示Env下的reportlets目录下面的所有cpt文件
@ -124,9 +128,28 @@ public class TemplateFileTree extends EnvFileTree {
} }
public FileNode[] listFile(String path) { public FileNode[] listFile(String path) {
// 支持插件扩展, 先从env的filter拿, 再从插件拿
Set<FileExtension> supportTypes = createFileExtensionFilter();
return FRContext.getFileNodes().list( return FRContext.getFileNodes().list(
path, path,
new FileExtension[]{FileExtension.CPT, FileExtension.FRM, FileExtension.CHT, FileExtension.XLS, FileExtension.XLSX}); supportTypes.toArray(new FileExtension[supportTypes.size()])
);
}
private Set<FileExtension> createFileExtensionFilter() {
Set<FileExtension> supportTypes = new HashSet<FileExtension>();
if (filter != null) {
for (String temp : filter.getSupportedTypes()) {
supportTypes.add(FileExtension.parse(temp));
}
}
Set<App> apps = ExtraDesignClassManager.getInstance().getArray(App.MARK_STRING);
for (App temp : apps) {
for (String extendsion : temp.defaultExtensions()) {
supportTypes.add(FileExtension.parse(extendsion));
}
}
return supportTypes;
} }
/* /*
@ -205,18 +228,6 @@ public class TemplateFileTree extends EnvFileTree {
if (fileNodes == null) { if (fileNodes == null) {
fileNodes = new FileNode[0]; fileNodes = new FileNode[0];
} }
// 用FileNodeFilter过滤一下
if (filter != null) {
List<FileNode> list = new ArrayList<FileNode>();
for (FileNode fileNode : fileNodes) {
if (filter.accept(fileNode)) {
list.add(fileNode);
}
}
fileNodes = list.toArray(new FileNode[list.size()]);
}
Arrays.sort(fileNodes, new FileNodeComparator(FRContext.getFileNodes().getSupportedTypes())); Arrays.sort(fileNodes, new FileNodeComparator(FRContext.getFileNodes().getSupportedTypes()));
return fileNodes; return fileNodes;

36
designer-base/src/main/java/com/fr/design/hyperlink/AbstractHyperLinkPane.java

@ -4,9 +4,16 @@ import com.fr.design.beans.FurtherBasicBeanPane;
import com.fr.design.editor.ValueEditorPane; import com.fr.design.editor.ValueEditorPane;
import com.fr.design.editor.ValueEditorPaneFactory; import com.fr.design.editor.ValueEditorPaneFactory;
import com.fr.design.gui.frpane.ReportletParameterViewPane; import com.fr.design.gui.frpane.ReportletParameterViewPane;
import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itableeditorpane.ParameterTableModel; import com.fr.design.gui.itableeditorpane.ParameterTableModel;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.js.JavaScript; import com.fr.js.JavaScript;
import com.fr.js.LinkAnimateType;
import javax.swing.JPanel;
import java.awt.Dimension;
import java.util.HashMap; import java.util.HashMap;
/** /**
@ -16,6 +23,7 @@ public abstract class AbstractHyperLinkPane<T> extends FurtherBasicBeanPane<T> {
private HashMap hyperLinkEditorMap; private HashMap hyperLinkEditorMap;
private boolean needRenamePane = false; private boolean needRenamePane = false;
protected ReportletParameterViewPane parameterViewPane; protected ReportletParameterViewPane parameterViewPane;
private UIButtonGroup<LinkAnimateType> animateTypeUIButtonGroup;
public AbstractHyperLinkPane(HashMap hyperLinkEditorMap, boolean needRenamePane) { public AbstractHyperLinkPane(HashMap hyperLinkEditorMap, boolean needRenamePane) {
@ -41,6 +49,34 @@ public abstract class AbstractHyperLinkPane<T> extends FurtherBasicBeanPane<T> {
public void reset() { public void reset() {
} }
protected JPanel createAnimateTypeUIButtonGroup() {
animateTypeUIButtonGroup = new UIButtonGroup<LinkAnimateType>(
new String[]{LinkAnimateType.RELOAD.toLocaleString(), LinkAnimateType.INCREMENT.toLocaleString()},
new LinkAnimateType[]{LinkAnimateType.RELOAD, LinkAnimateType.INCREMENT});
animateTypeUIButtonGroup.setPreferredSize(new Dimension(120,20));
animateTypeUIButtonGroup.setSelectedIndex(1);
JPanel jp = FRGUIPaneFactory.createBoxFlowInnerContainer_S_Pane();
jp.add(new UILabel(Toolkit.i18nText("Fine-Design_Chart_Link_Animate_Type")));
jp.add(animateTypeUIButtonGroup);
return jp;
}
protected void populateAnimateType(LinkAnimateType animateType) {
if (animateTypeUIButtonGroup != null && animateType != LinkAnimateType.NONE) {
animateTypeUIButtonGroup.setSelectedItem(animateType);
}
}
protected LinkAnimateType updateAnimateType() {
if (animateTypeUIButtonGroup != null) {
return animateTypeUIButtonGroup.getSelectedItem();
}
return LinkAnimateType.NONE;
}
protected int getChartParaType() { protected int getChartParaType() {
return hyperLinkEditorMap != null ? ParameterTableModel.CHART_NORMAL_USE : ParameterTableModel.NO_CHART_USE; return hyperLinkEditorMap != null ? ParameterTableModel.CHART_NORMAL_USE : ParameterTableModel.NO_CHART_USE;
} }

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

@ -1,17 +1,16 @@
package com.fr.design.icon; package com.fr.design.icon;
import com.fr.base.BaseUtils;
import com.fr.log.FineLoggerFactory;
import javax.swing.GrayFilter;
import javax.swing.ImageIcon;
import java.awt.Component; import java.awt.Component;
import java.awt.Graphics; import java.awt.Graphics;
import java.awt.Image; import java.awt.Image;
import java.awt.MediaTracker; import java.awt.MediaTracker;
import java.awt.image.ImageObserver; import java.awt.image.ImageObserver;
import javax.swing.GrayFilter;
import javax.swing.ImageIcon;
import com.fr.base.BaseUtils;
import com.fr.base.FRContext;
public class LockIcon extends ImageIcon { public class LockIcon extends ImageIcon {
private final static Image lockImage = BaseUtils.readImage("/com/fr/design/images/gui/locked.gif"); private final static Image lockImage = BaseUtils.readImage("/com/fr/design/images/gui/locked.gif");
@ -55,7 +54,7 @@ public class LockIcon extends ImageIcon {
try { try {
tracker.waitForID(0, 0); tracker.waitForID(0, 0);
} catch (InterruptedException e) { } catch (InterruptedException e) {
FRContext.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
loadStatus = tracker.statusID(0, false); loadStatus = tracker.statusID(0, false);

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

@ -1,17 +1,16 @@
package com.fr.design.icon; package com.fr.design.icon;
import com.fr.base.BaseUtils;
import com.fr.log.FineLoggerFactory;
import javax.swing.GrayFilter;
import javax.swing.ImageIcon;
import java.awt.Component; import java.awt.Component;
import java.awt.Graphics; import java.awt.Graphics;
import java.awt.Image; import java.awt.Image;
import java.awt.MediaTracker; import java.awt.MediaTracker;
import java.awt.image.ImageObserver; import java.awt.image.ImageObserver;
import javax.swing.GrayFilter;
import javax.swing.ImageIcon;
import com.fr.base.BaseUtils;
import com.fr.base.FRContext;
/** /**
* 警告图片 * 警告图片
* *
@ -59,7 +58,7 @@ public class WarningIcon extends ImageIcon {
try { try {
tracker.waitForID(0, 0); tracker.waitForID(0, 0);
} catch (InterruptedException e) { } catch (InterruptedException e) {
FRContext.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
tracker.statusID(0, false); tracker.statusID(0, false);

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

@ -38,7 +38,6 @@ import com.fr.design.mainframe.toolbar.ToolBarMenuDock;
import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus; import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus;
import com.fr.design.menu.MenuManager; import com.fr.design.menu.MenuManager;
import com.fr.design.menu.ShortCut; import com.fr.design.menu.ShortCut;
import com.fr.design.utils.DesignUtils;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.exception.DecryptTemplateException; import com.fr.exception.DecryptTemplateException;
import com.fr.file.FILE; import com.fr.file.FILE;
@ -68,6 +67,7 @@ import javax.swing.JLayeredPane;
import javax.swing.JMenuBar; import javax.swing.JMenuBar;
import javax.swing.JOptionPane; import javax.swing.JOptionPane;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.SwingUtilities;
import javax.swing.UIManager; import javax.swing.UIManager;
import javax.swing.WindowConstants; import javax.swing.WindowConstants;
import javax.swing.border.MatteBorder; import javax.swing.border.MatteBorder;
@ -413,7 +413,16 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
public void on(PluginEvent event) { public void on(PluginEvent event) {
refreshNorthEastPane(northEastPane, ad); refreshNorthEastPane(northEastPane, ad);
DesignUtils.refreshDesignerFrame(); SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
if (DesignerContext.getDesignerFrame() == null) {
return;
}
DesignerContext.getDesignerFrame().refresh();
DesignerContext.getDesignerFrame().repaint();
}
});
} }
}, new PluginFilter() { }, new PluginFilter() {
@ -815,14 +824,19 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
* 报表运行环境改变时,需要刷新某些面板 * 报表运行环境改变时,需要刷新某些面板
*/ */
public void refreshEnv() { public void refreshEnv() {
refresh();
DesignerFrameFileDealerPane.getInstance().refreshDockingView();
TemplateTreePane.getInstance().refreshDockingView();
}
/**
* 安装设计器相关插件时的刷新
*/
public void refresh() {
this.setTitle(); this.setTitle();
DesignerFrameFileDealerPane.getInstance().refreshDockingView();
TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter()); TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter());
TemplateTreePane.getInstance().refreshDockingView();
DesignTableDataManager.clearGlobalDs(); DesignTableDataManager.clearGlobalDs();
EastRegionContainerPane.getInstance().refreshDownPane(); EastRegionContainerPane.getInstance().refreshDownPane();
JTemplate template = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); JTemplate template = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
if (template != null) { if (template != null) {
template.refreshToolArea(); template.refreshToolArea();

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

@ -30,11 +30,18 @@ import com.fr.design.menu.KeySetUtils;
import com.fr.design.menu.ShortCut; import com.fr.design.menu.ShortCut;
import com.fr.design.menu.ToolBarDef; import com.fr.design.menu.ToolBarDef;
import com.fr.design.roleAuthority.RolesAlreadyEditedPane; import com.fr.design.roleAuthority.RolesAlreadyEditedPane;
import com.fr.design.utils.DesignUtils;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.file.FileNodeFILE; import com.fr.file.FileNodeFILE;
import com.fr.file.filetree.FileNode; import com.fr.file.filetree.FileNode;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.GeneralContext;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.plugin.context.PluginContext;
import com.fr.plugin.injectable.PluginModule;
import com.fr.plugin.manage.PluginFilter;
import com.fr.plugin.observer.PluginEvent;
import com.fr.plugin.observer.PluginEventListener;
import com.fr.stable.CoreConstants; import com.fr.stable.CoreConstants;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.third.org.apache.commons.io.FilenameUtils; import com.fr.third.org.apache.commons.io.FilenameUtils;
@ -68,6 +75,22 @@ import static javax.swing.JOptionPane.WARNING_MESSAGE;
public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarStateChangeListener, ResponseDataSourceChange { public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarStateChangeListener, ResponseDataSourceChange {
static {
GeneralContext.listenPluginRunningChanged(new PluginEventListener() {
@Override
public void on(PluginEvent event) {
DesignUtils.refreshDesignerFrame();
}
}, new PluginFilter() {
@Override
public boolean accept(PluginContext context) {
return context.contain(PluginModule.ExtraDesign, ShortCut.TEMPLATE_TREE);
}
});
}
private static final String FILE = "file"; private static final String FILE = "file";
private static volatile DesignerFrameFileDealerPane THIS; private static volatile DesignerFrameFileDealerPane THIS;
@ -163,7 +186,6 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
* 刷新菜单 * 刷新菜单
*/ */
public void refreshDockingView() { public void refreshDockingView() {
ToolBarDef toolbarDef = new ToolBarDef(); ToolBarDef toolbarDef = new ToolBarDef();
toolbarDef.addShortCut(newFolderAction, refreshTreeAction); toolbarDef.addShortCut(newFolderAction, refreshTreeAction);
if (WorkContext.getCurrent().isLocal()) { if (WorkContext.getCurrent().isLocal()) {
@ -406,8 +428,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
String oldName = fnf.getName(); String oldName = fnf.getName();
String suffix = fnf.isDirectory() ? StringUtils.EMPTY : oldName.substring(oldName.lastIndexOf(CoreConstants.DOT), oldName.length()); String suffix = fnf.isDirectory() ? StringUtils.EMPTY : oldName.substring(oldName.lastIndexOf(CoreConstants.DOT), oldName.length());
oldName = oldName.replaceAll(suffix, StringUtils.EMPTY); oldName = oldName.replace(suffix, StringUtils.EMPTY);
this.setLayout(new BorderLayout()); this.setLayout(new BorderLayout());
this.setModal(true); this.setModal(true);

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

@ -522,19 +522,6 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
if (editingFILE == null) { if (editingFILE == null) {
return false; return false;
} }
// //检查一下连接是否成功
// try {
// if (FRContext.getCommonOperator() != null && !FRContext.getCommonOperator().testServerConnectionWithOutShowMessagePane()) {
// //连接不成功,提示
// JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(),
// com.fr.design.i18n.Toolkit.i18nText(new String[]{"server_disconnected", "template_unsaved"}, new String[]{",", "!"})
// , com.fr.design.i18n.Toolkit.i18nText("FR-Designer_Error"), JOptionPane.ERROR_MESSAGE);
// return false;
// }
// } catch (Exception e) {
// FineLoggerFactory.getLogger().error(e.getMessage(), e);
// }
// 检查一下editingFILE是不是已存在的文件,如果不存在则用saveAs // 检查一下editingFILE是不是已存在的文件,如果不存在则用saveAs
if (!editingFILE.exists()) { if (!editingFILE.exists()) {
@ -623,7 +610,7 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
} else { } else {
JOptionPane.showMessageDialog( JOptionPane.showMessageDialog(
DesignerContext.getDesignerFrame(), DesignerContext.getDesignerFrame(),
Toolkit.i18nText("Fine-Design_Basic_Template_Status_Locked"), 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_Message"),
JOptionPane.WARNING_MESSAGE); JOptionPane.WARNING_MESSAGE);
return false; return false;
@ -649,7 +636,7 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
try { try {
file.mkfile(); file.mkfile();
} catch (Exception e) { } catch (Exception e) {
FRContext.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
} }
@ -679,7 +666,7 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
try { try {
this.getTarget().export(editingFILE.asOutputStream()); this.getTarget().export(editingFILE.asOutputStream());
} catch (Exception e) { } catch (Exception e) {
FRContext.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), e.getMessage(), "Save Error", JOptionPane.ERROR_MESSAGE); JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), e.getMessage(), "Save Error", JOptionPane.ERROR_MESSAGE);
return false; return false;
} }

19
designer-base/src/main/java/com/fr/design/mainframe/dnd/ArrayListTransferHandler.java

@ -3,18 +3,17 @@
*/ */
package com.fr.design.mainframe.dnd; package com.fr.design.mainframe.dnd;
import java.awt.datatransfer.DataFlavor; import com.fr.log.FineLoggerFactory;
import java.awt.datatransfer.Transferable;
import java.awt.datatransfer.UnsupportedFlavorException;
import java.io.IOException;
import java.util.ArrayList;
import javax.swing.DefaultListModel; import javax.swing.DefaultListModel;
import javax.swing.JComponent; import javax.swing.JComponent;
import javax.swing.JList; import javax.swing.JList;
import javax.swing.TransferHandler; import javax.swing.TransferHandler;
import java.awt.datatransfer.DataFlavor;
import com.fr.base.FRContext; import java.awt.datatransfer.Transferable;
import java.awt.datatransfer.UnsupportedFlavorException;
import java.io.IOException;
import java.util.ArrayList;
/** /**
* Used for JList. * Used for JList.
@ -33,7 +32,7 @@ public class ArrayListTransferHandler extends TransferHandler {
try { try {
localArrayListFlavor = new DataFlavor(localArrayListType); localArrayListFlavor = new DataFlavor(localArrayListType);
} catch (ClassNotFoundException e) { } catch (ClassNotFoundException e) {
FRContext.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
serialArrayListFlavor = new DataFlavor(ArrayList.class, "ArrayList"); serialArrayListFlavor = new DataFlavor(ArrayList.class, "ArrayList");
@ -55,10 +54,10 @@ public class ArrayListTransferHandler extends TransferHandler {
return false; return false;
} }
} catch (UnsupportedFlavorException ufe) { } catch (UnsupportedFlavorException ufe) {
FRContext.getLogger().error(ufe.getMessage(), ufe); FineLoggerFactory.getLogger().error(ufe.getMessage(), ufe);
return false; return false;
} catch (IOException ioe) { } catch (IOException ioe) {
FRContext.getLogger().error(ioe.getMessage(), ioe); FineLoggerFactory.getLogger().error(ioe.getMessage(), ioe);
return false; return false;
} }

6
designer-base/src/main/java/com/fr/design/mainframe/dnd/ArrayListTransferable.java

@ -1,13 +1,13 @@
package com.fr.design.mainframe.dnd; package com.fr.design.mainframe.dnd;
import com.fr.log.FineLoggerFactory;
import java.awt.datatransfer.DataFlavor; import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.Transferable; import java.awt.datatransfer.Transferable;
import java.awt.datatransfer.UnsupportedFlavorException; import java.awt.datatransfer.UnsupportedFlavorException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import com.fr.base.FRContext;
public class ArrayListTransferable implements Transferable { public class ArrayListTransferable implements Transferable {
private DataFlavor localArrayListFlavor; private DataFlavor localArrayListFlavor;
private DataFlavor serialArrayListFlavor; private DataFlavor serialArrayListFlavor;
@ -21,7 +21,7 @@ public class ArrayListTransferable implements Transferable {
try { try {
localArrayListFlavor = new DataFlavor(localArrayListType); localArrayListFlavor = new DataFlavor(localArrayListType);
} catch (ClassNotFoundException e) { } catch (ClassNotFoundException e) {
FRContext.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
serialArrayListFlavor = new DataFlavor(ArrayList.class, "ArrayList"); serialArrayListFlavor = new DataFlavor(ArrayList.class, "ArrayList");

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

@ -14,7 +14,7 @@ import java.awt.event.MouseEvent;
public class LogMessageBar extends JPanel { public class LogMessageBar extends JPanel {
private UILabel messageLabel; private UILabel messageLabel;
private int width = 600; private int width = 600;
public static volatile LogMessageBar THIS; private static volatile LogMessageBar THIS;
private JFrame dlg = new LogDetailPane().showDialog(); private JFrame dlg = new LogDetailPane().showDialog();
public static LogMessageBar getInstance() { public static LogMessageBar getInstance() {
@ -69,8 +69,11 @@ public class LogMessageBar extends JPanel {
return new Dimension(width, 24); return new Dimension(width, 24);
} }
/**
* 销毁内置的日志面板,外部插件会用到
*/
public void disposeLogDialog() { public void disposeLogDialog() {
if (dlg != null) { if (dlg != null && dlg.isShowing()) {
dlg.dispose(); dlg.dispose();
} }
THIS = null; THIS = null;

8
designer-base/src/main/java/com/fr/design/mainframe/templateinfo/TemplateInfoCollector.java

@ -7,10 +7,10 @@ import com.fr.design.DesignerEnvManager;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.JTemplate;
import com.fr.design.mainframe.SiteCenterToken; import com.fr.design.mainframe.SiteCenterToken;
import com.fr.general.CloudCenter;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.GeneralUtils; import com.fr.general.GeneralUtils;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
import com.fr.general.CloudCenter;
import com.fr.general.http.HttpClient; import com.fr.general.http.HttpClient;
import com.fr.json.JSONObject; import com.fr.json.JSONObject;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
@ -132,11 +132,11 @@ public class TemplateInfoCollector<T extends BaseBook> implements Serializable,
} }
xmlInputStream.close(); xmlInputStream.close();
} catch (FileNotFoundException e) { } catch (FileNotFoundException e) {
FRContext.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} catch (IOException e) { } catch (IOException e) {
FRContext.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} catch (XMLStreamException e) { } catch (XMLStreamException e) {
FRContext.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
} }

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

@ -496,7 +496,6 @@ public abstract class ToolBarMenuDock {
if (WorkContext.getCurrent().isLocal()) { if (WorkContext.getCurrent().isLocal()) {
shortCuts.add(new SoftwareUpdateAction()); shortCuts.add(new SoftwareUpdateAction());
} }
if (AlphaFineConfigManager.isALPHALicAvailable()) { if (AlphaFineConfigManager.isALPHALicAvailable()) {
shortCuts.add(new AlphaFineAction()); shortCuts.add(new AlphaFineAction());
} }

10
designer-base/src/main/java/com/fr/design/mainframe/widget/renderer/IconCellRenderer.java

@ -1,11 +1,13 @@
package com.fr.design.mainframe.widget.renderer; package com.fr.design.mainframe.widget.renderer;
import java.awt.*;
import com.fr.base.FRContext;
import com.fr.base.Icon; import com.fr.base.Icon;
import com.fr.base.IconManager; import com.fr.base.IconManager;
import com.fr.form.ui.WidgetInfoConfig; import com.fr.form.ui.WidgetInfoConfig;
import com.fr.log.FineLoggerFactory;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Image;
public class IconCellRenderer extends GenericCellRenderer { public class IconCellRenderer extends GenericCellRenderer {
private Image img; private Image img;
@ -22,7 +24,7 @@ public class IconCellRenderer extends GenericCellRenderer {
this.setImage(icon == null ? null : icon.getImage()); this.setImage(icon == null ? null : icon.getImage());
} catch (CloneNotSupportedException e) { } catch (CloneNotSupportedException e) {
this.setImage(null); this.setImage(null);
FRContext.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
} }

9
designer-base/src/main/java/com/fr/design/menu/MenuDef.java

@ -24,6 +24,7 @@ import java.util.List;
public class MenuDef extends ShortCut { public class MenuDef extends ShortCut {
private static final int MENU_DEFAULTWDITH = 156; private static final int MENU_DEFAULTWDITH = 156;
private static final int BLANK_WIDTH = 30;
protected String name; protected String name;
//右侧属性表弹出框重绘 //右侧属性表弹出框重绘
protected Boolean isEastAttr = false; protected Boolean isEastAttr = false;
@ -410,7 +411,7 @@ public class MenuDef extends ShortCut {
popupMenu = new UIPopupEastAttrMenu(); popupMenu = new UIPopupEastAttrMenu();
popupMenu.setInvoker(button); popupMenu.setInvoker(button);
MenuDef.this.updateEastPopupMenu(popupMenu); MenuDef.this.updateEastPopupMenu(popupMenu);
popupMenu.setPopupSize(new Dimension(MENU_DEFAULTWDITH, popupMenu.getPreferredSize().height)); updatePopupMenuSize();
GUICoreUtils.showPopupMenu(popupMenu, button, 0, button.getSize().height); GUICoreUtils.showPopupMenu(popupMenu, button, 0, button.getSize().height);
} else { } else {
popupMenu = new UIPopupMenu(); popupMenu = new UIPopupMenu();
@ -421,6 +422,12 @@ public class MenuDef extends ShortCut {
} }
}; };
private void updatePopupMenuSize() {
int preferredWidth = popupMenu.getPreferredSize().width - BLANK_WIDTH; // 减少行尾的空白部分
int popupMenuWidth = preferredWidth > MENU_DEFAULTWDITH ? preferredWidth : MENU_DEFAULTWDITH;
popupMenu.setPopupSize(new Dimension(popupMenuWidth, popupMenu.getPreferredSize().height));
}
//ben: for ui test //ben: for ui test
public JPopupMenu getPopupMenu() { public JPopupMenu getPopupMenu() {

16
designer-base/src/main/java/com/fr/design/module/DesignModuleFactory.java

@ -1,6 +1,5 @@
package com.fr.design.module; package com.fr.design.module;
import com.fr.base.FRContext;
import com.fr.base.chart.BaseChartCollection; import com.fr.base.chart.BaseChartCollection;
import com.fr.design.gui.chart.BaseChartPropertyPane; import com.fr.design.gui.chart.BaseChartPropertyPane;
import com.fr.design.gui.chart.MiddleChartComponent; import com.fr.design.gui.chart.MiddleChartComponent;
@ -15,9 +14,12 @@ import com.fr.design.parameter.HierarchyTreePane;
import com.fr.design.parameter.ParameterDesignerProvider; import com.fr.design.parameter.ParameterDesignerProvider;
import com.fr.design.parameter.ParameterReader; import com.fr.design.parameter.ParameterReader;
import com.fr.form.ui.Widget; import com.fr.form.ui.Widget;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
import java.awt.*; import java.awt.Dialog;
import java.awt.Frame;
import java.awt.Window;
import java.lang.reflect.Constructor; import java.lang.reflect.Constructor;
import java.util.ArrayList; import java.util.ArrayList;
@ -122,7 +124,7 @@ public class DesignModuleFactory {
try { try {
return instance.paraPropertyPane.newInstance(); return instance.paraPropertyPane.newInstance();
} catch (Exception e) { } catch (Exception e) {
FRContext.getLogger().error("Error in Para PropertyPane"); FineLoggerFactory.getLogger().error("Error in Para PropertyPane");
} }
} }
return null; return null;
@ -137,7 +139,7 @@ public class DesignModuleFactory {
try { try {
return (ParameterDesignerProvider) instance.formParaDesigner.newInstance(); return (ParameterDesignerProvider) instance.formParaDesigner.newInstance();
} catch (Exception e) { } catch (Exception e) {
FRContext.getLogger().error("error in form para designer"); FineLoggerFactory.getLogger().error("error in form para designer");
} }
} }
return null; return null;
@ -172,9 +174,9 @@ public class DesignModuleFactory {
bcc = instance.chartComponentClass.newInstance(); bcc = instance.chartComponentClass.newInstance();
bcc.populate(collection); bcc.populate(collection);
} catch (InstantiationException e) { } catch (InstantiationException e) {
FRContext.getLogger().error("Error in ChartComponent instant", e); FineLoggerFactory.getLogger().error("Error in ChartComponent instant", e);
} catch (IllegalAccessException e) { } catch (IllegalAccessException e) {
FRContext.getLogger().error("Error in Access", e); FineLoggerFactory.getLogger().error("Error in Access", e);
} }
} }
return bcc; return bcc;
@ -195,7 +197,7 @@ public class DesignModuleFactory {
} }
return c.newInstance(window); return c.newInstance(window);
} catch (Exception e) { } catch (Exception e) {
FRContext.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
return null; return null;
} }

25
designer-base/src/main/java/com/fr/design/parameter/ParaDefinitePane.java

@ -1 +1,24 @@
package com.fr.design.parameter; import com.fr.base.Parameter; public interface ParaDefinitePane { public Parameter[] getNoRepeatParas(Parameter[] paras); public void setParameterArray(Parameter[] ps); public Parameter[] getParameterArray(); public void refreshParameter(); public boolean isWithQueryButton(); public void addingParameter2Editor(Parameter p); public void addingParameter2EditorWithQueryButton(Parameter p); public void addingAllParameter2Editor(); } package com.fr.design.parameter;
import com.fr.base.Parameter;
public interface ParaDefinitePane {
Parameter[] getNoRepeatParas(Parameter[] paras);
void setParameterArray(Parameter[] ps);
Parameter[] getParameterArray();
void refreshParameter();
boolean isWithQueryButton();
void addingParameter2Editor(Parameter p);
void addingParameter2EditorWithQueryButton(Parameter p);
void addingAllParameter2Editor();
}

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

@ -5,7 +5,6 @@ package com.fr.design.style;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.CellBorderStyle; import com.fr.base.CellBorderStyle;
import com.fr.base.FRContext;
import com.fr.base.GraphHelper; import com.fr.base.GraphHelper;
import com.fr.base.Style; import com.fr.base.Style;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
@ -16,6 +15,7 @@ import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.VerticalFlowLayout; import com.fr.design.layout.VerticalFlowLayout;
import com.fr.design.style.color.ColorSelectBox; import com.fr.design.style.color.ColorSelectBox;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import com.fr.stable.CoreConstants; import com.fr.stable.CoreConstants;
@ -243,7 +243,7 @@ public class BorderPane extends BasicPane {
this.cellBorderStyle = (CellBorderStyle)cellBorderStyle.clone(); this.cellBorderStyle = (CellBorderStyle)cellBorderStyle.clone();
} }
} catch (CloneNotSupportedException e) { } catch (CloneNotSupportedException e) {
FRContext.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
this.insideMode = insideMode; this.insideMode = insideMode;
// ben 这里也有问题,CellBorderStyle的 linestyle和color很可能不止一种 // ben 这里也有问题,CellBorderStyle的 linestyle和color很可能不止一种

29
designer-base/src/main/java/com/fr/design/style/background/gradient/GradientBackgroundPane.java

@ -1,24 +1,24 @@
package com.fr.design.style.background.gradient; package com.fr.design.style.background.gradient;
import java.awt.BorderLayout; import com.fr.base.background.GradientBackground;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.ButtonGroup;
import com.fr.design.gui.ibutton.UIRadioButton; import com.fr.design.gui.ibutton.UIRadioButton;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.style.background.BackgroundDetailPane;
import com.fr.design.utils.gui.UIComponentUtils;
import com.fr.design.widget.FRWidgetFactory;
import com.fr.general.Background;
import javax.swing.BorderFactory;
import javax.swing.ButtonGroup;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.SwingConstants; import javax.swing.SwingConstants;
import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener; import javax.swing.event.ChangeListener;
import java.awt.BorderLayout;
import com.fr.base.background.GradientBackground; import java.awt.Dimension;
import com.fr.design.layout.FRGUIPaneFactory; import java.awt.event.ActionEvent;
import com.fr.general.Background; import java.awt.event.ActionListener;
import com.fr.design.style.background.BackgroundDetailPane;
/** /**
* 渐变色的面板不是很pp面板应用显得繁琐有写可以写成控件类型比如色彩选择的可以做得花哨点 * 渐变色的面板不是很pp面板应用显得繁琐有写可以写成控件类型比如色彩选择的可以做得花哨点
@ -43,7 +43,8 @@ public class GradientBackgroundPane extends BackgroundDetailPane {
JPanel blankJp = new JPanel(); JPanel blankJp = new JPanel();
gradientBar = new GradientBar(4, 254); gradientBar = new GradientBar(4, 254);
blankJp.add(gradientBar); blankJp.add(gradientBar);
UILabel jl = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Drag_To_Select_Gradient")); UILabel jl = FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Drag_To_Select_Gradient"));
jl.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 20));
jl.setHorizontalAlignment(SwingConstants.CENTER); jl.setHorizontalAlignment(SwingConstants.CENTER);
gradientPanel.add(jl, BorderLayout.NORTH); gradientPanel.add(jl, BorderLayout.NORTH);
gradientPanel.add(blankJp, BorderLayout.SOUTH); gradientPanel.add(blankJp, BorderLayout.SOUTH);

3
designer-base/src/main/java/com/fr/design/utils/BrowseUtils.java

@ -1,6 +1,5 @@
package com.fr.design.utils; package com.fr.design.utils;
import com.fr.base.FRContext;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.stable.OperatingSystem; import com.fr.stable.OperatingSystem;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
@ -43,7 +42,7 @@ public class BrowseUtils {
public static void browser(String url) { public static void browser(String url) {
if (StringUtils.isEmpty(url)) { if (StringUtils.isEmpty(url)) {
FRContext.getLogger().info("The URL is empty!"); FineLoggerFactory.getLogger().info("The URL is empty!");
return; return;
} }
try { try {

18
designer-base/src/main/java/com/fr/design/utils/DesignUtils.java

@ -1,7 +1,6 @@
package com.fr.design.utils; package com.fr.design.utils;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.FRContext;
import com.fr.base.FeedBackInfo; import com.fr.base.FeedBackInfo;
import com.fr.base.ServerConfig; import com.fr.base.ServerConfig;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
@ -22,8 +21,11 @@ import com.fr.stable.StringUtils;
import com.fr.start.ServerStarter; import com.fr.start.ServerStarter;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
import javax.swing.*; import javax.swing.JOptionPane;
import java.awt.*; import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import java.awt.Desktop;
import java.awt.Font;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.BufferedWriter; import java.io.BufferedWriter;
import java.io.File; import java.io.File;
@ -95,13 +97,13 @@ public class DesignUtils {
writer.flush(); writer.flush();
} catch (Exception e) { } catch (Exception e) {
FRContext.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} finally { } finally {
try { try {
writer.close(); writer.close();
socket.close(); socket.close();
} catch (IOException e) { } catch (IOException e) {
FRContext.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
} }
} }
@ -237,7 +239,7 @@ public class DesignUtils {
//比如想在中文或英文系统里用韩文设计器 //比如想在中文或英文系统里用韩文设计器
guiFRFont = getNamedFont("Dialog"); guiFRFont = getNamedFont("Dialog");
if (!guiFRFont.canDisplay(displayChar)) { if (!guiFRFont.canDisplay(displayChar)) {
FRContext.getLogger().error(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Base_SimSun_Not_Found")); FineLoggerFactory.getLogger().error(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Base_SimSun_Not_Found"));
} }
} }
} }
@ -284,7 +286,7 @@ public class DesignUtils {
String value = values[i].replaceAll("\\\\", "/"); String value = values[i].replaceAll("\\\\", "/");
segs[i] = URLEncoder.encode(CodeUtils.cjkEncode(names[i]), EncodeConstants.ENCODING_UTF_8) + "=" + URLEncoder.encode(CodeUtils.cjkEncode(value), "UTF-8"); segs[i] = URLEncoder.encode(CodeUtils.cjkEncode(names[i]), EncodeConstants.ENCODING_UTF_8) + "=" + URLEncoder.encode(CodeUtils.cjkEncode(value), "UTF-8");
} catch (UnsupportedEncodingException e) { } catch (UnsupportedEncodingException e) {
FRContext.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
} }
String postfixOfUri = (segs.length > 0 ? "?" + StableUtils.join(segs, "&") : StringUtils.EMPTY); String postfixOfUri = (segs.length > 0 ? "?" + StableUtils.join(segs, "&") : StringUtils.EMPTY);
@ -294,7 +296,7 @@ public class DesignUtils {
String urlPath = getWebBrowserPath(); String urlPath = getWebBrowserPath();
Desktop.getDesktop().browse(new URI(urlPath + baseRoute + postfixOfUri)); Desktop.getDesktop().browse(new URI(urlPath + baseRoute + postfixOfUri));
} catch (Exception e) { } catch (Exception e) {
FRContext.getLogger().error("cannot open the url Successful", e); FineLoggerFactory.getLogger().error("cannot open the url Successful", e);
} }
} else { } else {
try { try {

51
designer-base/src/main/java/com/fr/design/utils/gui/GUICoreUtils.java

@ -6,7 +6,13 @@ package com.fr.design.utils.gui;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.Style; import com.fr.base.Style;
import com.fr.base.background.ColorBackground; import com.fr.base.background.ColorBackground;
import com.fr.data.util.function.*; import com.fr.data.util.function.AverageFunction;
import com.fr.data.util.function.CountFunction;
import com.fr.data.util.function.DataFunction;
import com.fr.data.util.function.MaxFunction;
import com.fr.data.util.function.MinFunction;
import com.fr.data.util.function.NoneFunction;
import com.fr.data.util.function.SumFunction;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.design.actions.core.ActionFactory; import com.fr.design.actions.core.ActionFactory;
import com.fr.design.border.UITitledBorder; import com.fr.design.border.UITitledBorder;
@ -25,20 +31,48 @@ import com.fr.design.style.color.ColorFactory;
import com.fr.design.style.color.ColorSelectBox; import com.fr.design.style.color.ColorSelectBox;
import com.fr.design.style.color.ColorSelectable; import com.fr.design.style.color.ColorSelectable;
import com.fr.general.FRFont; import com.fr.general.FRFont;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import com.fr.stable.OperatingSystem; import com.fr.stable.OperatingSystem;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.*; import javax.swing.AbstractButton;
import javax.swing.Action;
import javax.swing.BorderFactory;
import javax.swing.Box;
import javax.swing.DefaultListModel;
import javax.swing.Icon;
import javax.swing.JComponent;
import javax.swing.JFormattedTextField;
import javax.swing.JList;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JPopupMenu;
import javax.swing.JSeparator;
import javax.swing.JSlider;
import javax.swing.JSpinner;
import javax.swing.JTree;
import javax.swing.SwingConstants;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import javax.swing.border.Border; import javax.swing.border.Border;
import javax.swing.border.LineBorder; import javax.swing.border.LineBorder;
import javax.swing.border.TitledBorder; import javax.swing.border.TitledBorder;
import javax.swing.event.ChangeListener; import javax.swing.event.ChangeListener;
import javax.swing.tree.TreeNode; import javax.swing.tree.TreeNode;
import javax.swing.tree.TreePath; import javax.swing.tree.TreePath;
import java.awt.BorderLayout;
import java.awt.*; import java.awt.Color;
import java.awt.Component;
import java.awt.Cursor;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.GridLayout;
import java.awt.Image;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.Toolkit;
import java.awt.Window;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.awt.event.ItemEvent; import java.awt.event.ItemEvent;
import java.awt.event.ItemListener; import java.awt.event.ItemListener;
@ -48,16 +82,17 @@ import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
public abstract class GUICoreUtils{ // Noninstantiable utility class
public final class GUICoreUtils {
private static final int WINDOW_GAP = 20; private static final int WINDOW_GAP = 20;
private static final int HEIGHT_GAP = 28; private static final int HEIGHT_GAP = 28;
private static final int WIN_LOCATION_Y=23; private static final int WIN_LOCATION_Y=23;
private static final int CASE_FOUR = 4; private static final int CASE_FOUR = 4;
// 覆盖缺省构造器,不可实例化
private GUICoreUtils() { private GUICoreUtils() {
throw new AssertionError();
} }
/** /**

91
designer-base/src/main/java/com/fr/design/utils/gui/UIComponentUtils.java

@ -0,0 +1,91 @@
package com.fr.design.utils.gui;
import com.fr.design.gui.core.UITextComponent;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.general.ComparatorUtils;
import com.fr.general.GeneralContext;
import com.fr.stable.StringUtils;
import javax.swing.JComponent;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dimension;
import java.util.Locale;
/**
* 包含 UI 组件相关的工具方法
* Created by plough on 2019/1/11.
*/
// Noninstantiable utility class
public class UIComponentUtils {
private static final String HTML_TAG_TPL = "<html><body style='width: %dpx'>";
private static final String HTML_BODY_TAG = "<html><body>";
private static final String HTML_TAG = "<html>";
private static final int MIN_WIDTH = 10;
// 覆盖缺省构造器,不可实例化
private UIComponentUtils() {
throw new AssertionError();
}
/**
* 到达指定宽度后换行
*/
public static void setLineWrap(UITextComponent comp, int width) {
if (width < MIN_WIDTH) {
width = MIN_WIDTH;
}
insertPrefixToText(comp, String.format(HTML_TAG_TPL, width));
}
/**
* 自动换行
*/
public static void setLineWrap(UITextComponent comp) {
insertPrefixToText(comp, HTML_BODY_TAG);
}
private static void insertPrefixToText(UITextComponent comp, String prefix) {
if (comp == null || ComparatorUtils.equals(Locale.CHINA, GeneralContext.getLocale())) {
// 最初是为了解决日文国际化显示不全,而增加的换行功能。中文不需要换行。
// windows 下,字体为宋体时,对于 JLabel、JCheckBox、JButton 等控件,使用<html>换行后,文字会下移,可能导致文字下半部分被截断。
// 因此中文直接返回,不加换行逻辑。
return;
}
String text = comp.getText();
if (StringUtils.isEmpty(text) || text.startsWith(HTML_TAG)) {
return;
}
comp.setText(prefix + text);
}
/**
* 将一个组件包装到 BorderLayout 布局的面板中
* @param comp待包装的组件
* @param layoutConstraint添加的方向 BorderLayout.NORTH
* @return 包装好的 JPanel
*/
public static JPanel wrapWithBorderLayoutPane(Component comp, String layoutConstraint) {
JPanel panel = FRGUIPaneFactory.createBorderLayout_S_Pane();
panel.add(comp, layoutConstraint);
return panel;
}
/**
* 将一个组件包装到 BorderLayout 布局的面板中
* @param comp待包装的组件
* @return 包装好的 JPanel布局方向为 BorderLayout.NORTH
*/
public static JPanel wrapWithBorderLayoutPane(Component comp) {
return wrapWithBorderLayoutPane(comp, BorderLayout.NORTH);
}
public static void setPreferedWidth(JComponent comp, int width) {
Dimension dim = comp.getPreferredSize();
dim.setSize(width, dim.getHeight());
comp.setPreferredSize(dim);
}
}

2
designer-base/src/main/java/com/fr/design/web/CustomIconPane.java

@ -291,7 +291,7 @@ public class CustomIconPane extends BasicPane {
Configurations.update(new WorkerFacade(WidgetInfoConfig.class) { Configurations.update(new WorkerFacade(WidgetInfoConfig.class) {
@Override @Override
public void run() { public void run() {
WidgetInfoConfig.getInstance().setIconManager(IconManager.getIconManager()); WidgetInfoConfig.getInstance().setIconManager(iconManager);
} }
}); });

4
designer-base/src/main/java/com/fr/design/widget/EventCreator.java

@ -1,12 +1,12 @@
package com.fr.design.widget; package com.fr.design.widget;
import com.fr.base.FRContext;
import com.fr.design.beans.BasicBeanPane; import com.fr.design.beans.BasicBeanPane;
import com.fr.design.gui.controlpane.NameableSelfCreator; import com.fr.design.gui.controlpane.NameableSelfCreator;
import com.fr.design.gui.controlpane.UnrepeatedNameHelper; import com.fr.design.gui.controlpane.UnrepeatedNameHelper;
import com.fr.design.gui.ilist.ListModelElement; import com.fr.design.gui.ilist.ListModelElement;
import com.fr.form.event.Listener; import com.fr.form.event.Listener;
import com.fr.general.NameObject; import com.fr.general.NameObject;
import com.fr.log.FineLoggerFactory;
import com.fr.report.web.util.ReportEngineEventMapping; import com.fr.report.web.util.ReportEngineEventMapping;
import com.fr.stable.Nameable; import com.fr.stable.Nameable;
@ -43,7 +43,7 @@ public class EventCreator extends NameableSelfCreator {
String localeKey = ReportEngineEventMapping.getLocaleName(eventName); String localeKey = ReportEngineEventMapping.getLocaleName(eventName);
return com.fr.design.i18n.Toolkit.i18nText(localeKey); return com.fr.design.i18n.Toolkit.i18nText(localeKey);
} catch (Exception e) { } catch (Exception e) {
FRContext.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
return eventName; return eventName;
} }
} }

51
designer-base/src/main/java/com/fr/design/widget/FRWidgetFactory.java

@ -0,0 +1,51 @@
package com.fr.design.widget;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.utils.gui.UIComponentUtils;
/**
* 创建 widget 的静态工厂
* Created by plough on 2019/1/15.
*/
public class FRWidgetFactory {
// 不可实例化
private FRWidgetFactory() {
throw new AssertionError();
}
/**
* 创建一个可换行的 UILabel
* @param text 标签文字
* @return com.fr.design.gui.ilable.UILabel
*/
public static UILabel createLineWrapLabel(String text) {
UILabel label = new UILabel(text);
UIComponentUtils.setLineWrap(label);
return label;
}
/**
* 创建一个可换行的 UILabel
* @param text 标签文字
* @param lineWidth 最大行宽
* @return com.fr.design.gui.ilable.UILabel
*/
public static UILabel createLineWrapLabel(String text, int lineWidth) {
UILabel label = new UILabel(text);
UIComponentUtils.setLineWrap(label, lineWidth);
return label;
}
/**
* 创建一个可换行可调整水平对齐的 UILabel
* @param text
* @param lineWidth
* @param horizontalAlignment
* @return com.fr.design.gui.ilable.UILabel
*/
public static UILabel createLineWrapLabel(String text, int lineWidth, int horizontalAlignment) {
UILabel label = createLineWrapLabel(text, lineWidth);
label.setHorizontalAlignment(horizontalAlignment);
return label;
}
}

18
designer-base/src/main/java/com/fr/design/widget/WidgetBoundsPaneFactory.java

@ -8,7 +8,6 @@ import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.SwingConstants; import javax.swing.SwingConstants;
@ -19,19 +18,20 @@ import java.awt.Component;
* Created by plough on 2017/8/7. * Created by plough on 2017/8/7.
*/ */
public class WidgetBoundsPaneFactory { public class WidgetBoundsPaneFactory {
private static final int RIGHT_PANE_WIDTH = 145;
public static UIExpandablePane createBoundsPane(UISpinner width, UISpinner height) { public static UIExpandablePane createBoundsPane(UISpinner width, UISpinner height) {
JPanel boundsPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel boundsPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
double f = TableLayout.FILL; double f = TableLayout.FILL;
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Size")), createRightPane(width, height)}, new Component[]{FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Size")), createRightPane(width, height)},
new Component[]{null, createRightPane(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tree_Width"), SwingConstants.CENTER), new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tree_Height"), SwingConstants.CENTER))}, new Component[]{null, createRightPane(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tree_Width"), SwingConstants.CENTER), new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tree_Height"), SwingConstants.CENTER))},
}; };
double[] rowSize = {p, p}; double[] rowSize = {p, p};
double[] columnSize = {p, f}; double[] columnSize = {f, RIGHT_PANE_WIDTH};
int[][] rowCount = {{1, 1}, {1, 1}}; int[][] rowCount = {{1, 1}, {1, 1}};
final JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W1, IntervalConstants.INTERVAL_L6); final JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W5, IntervalConstants.INTERVAL_L6);
panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0)); panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0));
boundsPane.add(panel); boundsPane.add(panel);
return new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Coords_And_Size"), 280, 24, boundsPane); return new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Coords_And_Size"), 280, 24, boundsPane);
@ -53,18 +53,18 @@ public class WidgetBoundsPaneFactory {
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
Component[][] northComponents = new Component[][]{ Component[][] northComponents = new Component[][]{
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Position")), createRightPane(x, y)}, new Component[]{FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Position")), createRightPane(x, y)},
new Component[]{null, createRightPane(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_X_Coordinate"), SwingConstants.CENTER), new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Y_Coordinate"), SwingConstants.CENTER))}, new Component[]{null, createRightPane(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_X_Coordinate"), SwingConstants.CENTER), new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Y_Coordinate"), SwingConstants.CENTER))},
}; };
Component[][] centerComponents = new Component[][]{ Component[][] centerComponents = new Component[][]{
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Size")), createRightPane(width, height)}, new Component[]{FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Size")), createRightPane(width, height)},
new Component[]{null, createRightPane(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tree_Width"), SwingConstants.CENTER), new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tree_Height"), SwingConstants.CENTER))}, new Component[]{null, createRightPane(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tree_Width"), SwingConstants.CENTER), new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tree_Height"), SwingConstants.CENTER))},
}; };
double[] rowSize = {p, p}; double[] rowSize = {p, p};
double[] columnSize = {p, f}; double[] columnSize = {f, RIGHT_PANE_WIDTH};
int[][] rowCount = {{1, 1}, {1, 1}}; int[][] rowCount = {{1, 1}, {1, 1}};
final JPanel northPanel = TableLayoutHelper.createGapTableLayoutPane(northComponents, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W1, IntervalConstants.INTERVAL_L6); final JPanel northPanel = TableLayoutHelper.createGapTableLayoutPane(northComponents, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W5, IntervalConstants.INTERVAL_L6);
final JPanel centerPanel = TableLayoutHelper.createGapTableLayoutPane(centerComponents, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W1, IntervalConstants.INTERVAL_L6); final JPanel centerPanel = TableLayoutHelper.createGapTableLayoutPane(centerComponents, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W5, IntervalConstants.INTERVAL_L6);
JPanel boundsPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel boundsPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
northPanel.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0)); northPanel.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0));
centerPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 0)); centerPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 0));

2
designer-base/src/main/java/com/fr/env/RemoteEnvPane.java vendored

@ -597,7 +597,7 @@ public class RemoteEnvPane extends BasicBeanPane<RemoteDesignerWorkspaceInfo> {
dialog = new JDialog((Dialog) SwingUtilities.getWindowAncestor(RemoteEnvPane.this), UIManager.getString("OptionPane.messageDialogTitle"), true); dialog = new JDialog((Dialog) SwingUtilities.getWindowAncestor(RemoteEnvPane.this), UIManager.getString("OptionPane.messageDialogTitle"), true);
dialog.setSize(new Dimension(268, 118)); dialog.setSize(new Dimension(308, 132));
okButton.setEnabled(false); okButton.setEnabled(false);
JPanel jp = new JPanel(); JPanel jp = new JPanel();
JPanel upPane = new JPanel(); JPanel upPane = new JPanel();

93
designer-base/src/main/java/com/fr/file/AbstractFILE.java

@ -0,0 +1,93 @@
package com.fr.file;
import javax.swing.Icon;
import java.io.InputStream;
import java.io.OutputStream;
public abstract class AbstractFILE implements FILE {
@Override
public String prefix() {
throw new UnsupportedOperationException();
}
@Override
public boolean isDirectory() {
throw new UnsupportedOperationException();
}
@Override
public String getName() {
throw new UnsupportedOperationException();
}
@Override
public Icon getIcon() {
throw new UnsupportedOperationException();
}
@Override
public String getPath() {
throw new UnsupportedOperationException();
}
@Override
public void setPath(String path) {
throw new UnsupportedOperationException();
}
@Override
public FILE getParent() {
throw new UnsupportedOperationException();
}
@Override
public FILE[] listFiles() {
throw new UnsupportedOperationException();
}
@Override
public boolean createFolder(String name) {
throw new UnsupportedOperationException();
}
@Override
public boolean mkfile() throws Exception {
throw new UnsupportedOperationException();
}
@Override
public boolean exists() {
throw new UnsupportedOperationException();
}
@Override
public void closeTemplate() throws Exception {
throw new UnsupportedOperationException();
}
@Override
public InputStream asInputStream() throws Exception {
throw new UnsupportedOperationException();
}
@Override
public OutputStream asOutputStream() throws Exception {
throw new UnsupportedOperationException();
}
@Override
public String getEnvFullName() {
throw new UnsupportedOperationException();
}
@Override
public boolean isMemFile() {
throw new UnsupportedOperationException();
}
@Override
public boolean isEnvFile() {
throw new UnsupportedOperationException();
}
}

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

@ -201,7 +201,7 @@ public class FileFILE implements FILE {
OutputStream out; OutputStream out;
try { try {
StableUtils.makesureFileExist(file); StableUtils.makesureFileExist(file);
out = new FileOutputStream(file); out = new FileOutputStream(file, false);
} catch (Exception e) { } catch (Exception e) {
throw SessionLocalManager.createLogPackedException(e); throw SessionLocalManager.createLogPackedException(e);
} }

102
designer-base/src/main/java/com/fr/file/RenameExportFILE.java

@ -0,0 +1,102 @@
package com.fr.file;
import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils;
import com.fr.third.org.apache.commons.io.FileUtils;
import com.fr.web.session.SessionLocalManager;
import javax.swing.Icon;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
public class RenameExportFILE extends AbstractFILE {
private static final String EXPORT_SUFFIX = ".FRExportTmp";
private FILE file;
private RenameExportFILE(FILE file) {
this.file = new FileFILE(new File(file.getPath() + EXPORT_SUFFIX));
}
public static RenameExportFILE create(FILE file) {
return new RenameExportFILE(file);
}
public static String recoverFileName(String fileName) {
if (StringUtils.isEmpty(fileName) || !fileName.endsWith(EXPORT_SUFFIX)) {
return fileName;
}
return fileName.substring(0, fileName.lastIndexOf(EXPORT_SUFFIX));
}
@Override
public String prefix() {
return file.prefix();
}
@Override
public boolean isDirectory() {
return false;
}
@Override
public String getName() {
return file.getName();
}
@Override
public Icon getIcon() {
return null;
}
@Override
public String getPath() {
return file.getPath();
}
@Override
public FILE getParent() {
return file.getParent();
}
@Override
public boolean mkfile() throws Exception {
return file.mkfile();
}
@Override
public boolean exists() {
return file.exists();
}
@Override
public OutputStream asOutputStream() throws Exception {
final File localeFile = new File(file.getPath());
OutputStream out;
try {
StableUtils.makesureFileExist(localeFile);
out = new FileOutputStream(localeFile, false) {
@Override
public void close() throws IOException {
super.close();
String path = file.getPath();
if (localeFile.exists()) {
FileUtils.copyFile(localeFile, new File(recoverFileName(path)));
if (localeFile.getPath().endsWith(EXPORT_SUFFIX)) {
FileUtils.forceDelete(localeFile);
}
}
}
};
} catch (Exception e) {
throw SessionLocalManager.createLogPackedException(e);
}
return out;
}
}

34
designer-base/src/main/java/com/fr/file/StashedFILE.java

@ -1,15 +1,13 @@
package com.fr.file; package com.fr.file;
import javax.swing.Icon; import javax.swing.Icon;
import javax.transaction.NotSupportedException;
import java.io.ByteArrayInputStream; import java.io.ByteArrayInputStream;
import java.io.InputStream; import java.io.InputStream;
import java.io.OutputStream;
/** /**
* 切换环境用于暂存的文件类型 * 切换环境用于暂存的文件类型
*/ */
public class StashedFILE implements FILE { public class StashedFILE extends AbstractFILE {
private FILE file; private FILE file;
private byte[] content; private byte[] content;
@ -44,31 +42,6 @@ public class StashedFILE implements FILE {
return file.getPath(); return file.getPath();
} }
@Override
public void setPath(String path) {
throw new UnsupportedOperationException();
}
@Override
public FILE getParent() {
throw new UnsupportedOperationException();
}
@Override
public FILE[] listFiles() {
throw new UnsupportedOperationException();
}
@Override
public boolean createFolder(String name) {
throw new UnsupportedOperationException();
}
@Override
public boolean mkfile() throws Exception {
throw new UnsupportedOperationException();
}
@Override @Override
public boolean exists() { public boolean exists() {
return false; return false;
@ -84,11 +57,6 @@ public class StashedFILE implements FILE {
return new ByteArrayInputStream(content); return new ByteArrayInputStream(content);
} }
@Override
public OutputStream asOutputStream() throws Exception {
throw new NotSupportedException();
}
@Override @Override
public String getEnvFullName() { public String getEnvFullName() {
return file.getEnvFullName(); return file.getEnvFullName();

8
designer-base/src/main/java/com/fr/start/Demo.java

@ -1,7 +1,7 @@
package com.fr.start; package com.fr.start;
import com.fr.base.FRContext; import com.fr.log.FineLoggerFactory;
import com.fr.stable.OperatingSystem; import com.fr.stable.OperatingSystem;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
@ -11,7 +11,7 @@ public class Demo {
public static void main(String[] args) { public static void main(String[] args) {
String installHome = StableUtils.getInstallHome(); String installHome = StableUtils.getInstallHome();
if (installHome == null) { if (installHome == null) {
FRContext.getLogger().error("Can not find the install home, please check it."); FineLoggerFactory.getLogger().error("Can not find the install home, please check it.");
return; return;
} }
@ -29,7 +29,7 @@ public class Demo {
try { try {
builder.start(); builder.start();
} catch (IOException e) { } catch (IOException e) {
FRContext.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
} else { } else {
// ProcessBuilder这种方式在window下报错:系统找不到指定文件 // ProcessBuilder这种方式在window下报错:系统找不到指定文件
@ -37,7 +37,7 @@ public class Demo {
try { try {
rt.exec(executorPath); rt.exec(executorPath);
} catch (IOException e) { } catch (IOException e) {
FRContext.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
} }

12
designer-base/src/main/java/com/fr/start/StartDocURL.java

@ -1,11 +1,11 @@
package com.fr.start; package com.fr.start;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.StableUtils;
import java.awt.Desktop; import java.awt.Desktop;
import java.net.URI; import java.net.URI;
import com.fr.base.FRContext;
import com.fr.stable.StableUtils;
/** /**
* 从windows开始菜单点击exe文件启动html格式的帮助文档, * 从windows开始菜单点击exe文件启动html格式的帮助文档,
@ -20,7 +20,7 @@ public class StartDocURL {
public static void main(String[] args) { public static void main(String[] args) {
//p:必须有路径的URL存在 //p:必须有路径的URL存在
if(args == null || args.length < 1) { if(args == null || args.length < 1) {
FRContext.getLogger().error( FineLoggerFactory.getLogger().error(
"Can not find the install home, please check it."); "Can not find the install home, please check it.");
return; return;
} }
@ -33,7 +33,7 @@ public class StartDocURL {
} else { } else {
String iHome = StableUtils.getInstallHome(); String iHome = StableUtils.getInstallHome();
if (iHome == null) { if (iHome == null) {
FRContext.getLogger().error( FineLoggerFactory.getLogger().error(
"Can not find the install home, please check it."); "Can not find the install home, please check it.");
return; return;
} }
@ -42,7 +42,7 @@ public class StartDocURL {
Desktop.getDesktop().open(new java.io.File(iHome + args[0])); Desktop.getDesktop().open(new java.io.File(iHome + args[0]));
} }
} catch (Exception e) { } catch (Exception e) {
FRContext.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
} }
} }

21
designer-base/src/main/java/com/fr/start/server/ServerManageFrame.java

@ -1,17 +1,20 @@
package com.fr.start.server; package com.fr.start.server;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.FRContext;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.utils.DesignUtils; import com.fr.design.utils.DesignUtils;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.log.FineLoggerFactory;
import javax.swing.*; import javax.swing.BorderFactory;
import java.awt.*; import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
@ -32,7 +35,7 @@ public class ServerManageFrame extends JFrame {
try { try {
serverManageFrame.checkButtonEnabled(); serverManageFrame.checkButtonEnabled();
} catch(Exception exp) { } catch(Exception exp) {
FRContext.getLogger().error(exp.getMessage()); FineLoggerFactory.getLogger().error(exp.getMessage());
} }
return serverManageFrame; return serverManageFrame;
@ -77,7 +80,7 @@ public class ServerManageFrame extends JFrame {
FineEmbedServer.start(); FineEmbedServer.start();
checkButtonEnabled(); checkButtonEnabled();
} catch(Exception exp) { } catch(Exception exp) {
FRContext.getLogger().error(exp.getMessage()); FineLoggerFactory.getLogger().error(exp.getMessage());
} }
} }
}); });
@ -94,7 +97,7 @@ public class ServerManageFrame extends JFrame {
FineEmbedServer.stop(); FineEmbedServer.stop();
checkButtonEnabled(); checkButtonEnabled();
} catch(Exception exp) { } catch(Exception exp) {
FRContext.getLogger().error(exp.getMessage()); FineLoggerFactory.getLogger().error(exp.getMessage());
} }
} }
}); });
@ -120,7 +123,7 @@ public class ServerManageFrame extends JFrame {
// try { // try {
// desktop.open(); // desktop.open();
// } catch(Exception exp) { // } catch(Exception exp) {
// FRContext.getLogger().error(exp.getMessage()); // FineLoggerFactory.getLogger().error(exp.getMessage());
// } // }
// } // }
// }); // });

18
designer-base/src/main/java/com/fr/start/server/ServerTray.java

@ -1,13 +1,17 @@
package com.fr.start.server; package com.fr.start.server;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.FRContext;
import com.fr.event.Event; import com.fr.event.Event;
import com.fr.event.EventDispatcher; import com.fr.event.EventDispatcher;
import com.fr.event.ListenerAdaptor; import com.fr.event.ListenerAdaptor;
import com.fr.log.FineLoggerFactory;
import java.awt.*; import java.awt.AWTException;
import java.awt.Image;
import java.awt.MenuItem;
import java.awt.PopupMenu;
import java.awt.SystemTray;
import java.awt.TrayIcon;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter; import java.awt.event.MouseAdapter;
@ -61,7 +65,7 @@ public class ServerTray {
try { try {
FineEmbedServer.start(); FineEmbedServer.start();
} catch (Exception exp) { } catch (Exception exp) {
FRContext.getLogger().error(exp.getMessage(), exp); FineLoggerFactory.getLogger().error(exp.getMessage(), exp);
} }
} }
}; };
@ -72,7 +76,7 @@ public class ServerTray {
try { try {
FineEmbedServer.stop(); FineEmbedServer.stop();
} catch (Throwable exp) { } catch (Throwable exp) {
FRContext.getLogger().error(exp.getMessage(), exp); FineLoggerFactory.getLogger().error(exp.getMessage(), exp);
} }
} }
}; };
@ -168,7 +172,7 @@ public class ServerTray {
serverManageFrame.repaint(); serverManageFrame.repaint();
} }
} catch (Exception exp) { } catch (Exception exp) {
FRContext.getLogger().error(exp.getMessage(), exp); FineLoggerFactory.getLogger().error(exp.getMessage(), exp);
} }
} }

2
designer-base/src/main/resources/com/fr/design/insert/formula/variable/cn/contextPath.txt

@ -1 +1 @@
contextPath是指绝对路径的服务器别名,即虚拟目录.假如访问:http://localhost:8080/WebReport/ReportServer?reportlet=WorkBook1.cpt,contextPath是/WebReport contextPath是指绝对路径的服务器别名,即虚拟目录.假如访问:http://localhost:8075/webroot/decision/view/report?viewlet=workbook1.cpt,contextPath是/webroot/decision/view

2
designer-base/src/main/resources/com/fr/design/insert/formula/variable/cn/formletName.txt

@ -1 +1 @@
表单名字假如访问:http://localhost:8080/WebReport/ReportServer?formlet=Form1.frm,formName就是Form1.frm 表单名字假如访问:http://localhost:8075/webroot/decision/view/form?viewlet=Form1.frm,formName就是Form1.frm

2
designer-base/src/main/resources/com/fr/design/insert/formula/variable/cn/reportName.txt

@ -1 +1 @@
报表名字假如访问:http://localhost:8080/WebReport/ReportServer?reportlet=WorkBook1.cpt,reportName就是WorkBook1.cpt 报表名字假如访问:http://localhost:8075/webroot/decision/view/report?viewlet=workbook1.cpt,reportName就是WorkBook1.cpt

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

Loading…
Cancel
Save