Browse Source

Merge branch 'bugfix/10.0' of https://code.fineres.com/scm/~hades/design into bugfix/10.0

bugfix/10.0
hades 3 years ago
parent
commit
c0d6f5f36a
  1. 38
      designer-base/src/main/java/com/fr/base/svg/IconUtils.java
  2. 6
      designer-base/src/main/java/com/fr/design/DesignModelAdapter.java
  3. 26
      designer-base/src/main/java/com/fr/design/actions/community/WorkOrderCenterAction.java
  4. 16
      designer-base/src/main/java/com/fr/design/actions/core/ActionFactory.java
  5. 18
      designer-base/src/main/java/com/fr/design/actions/file/WebPreviewUtils.java
  6. 2
      designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionComboBoxPanel.java
  7. 37
      designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionTableProcedurePane.java
  8. 1
      designer-base/src/main/java/com/fr/design/data/datapane/preview/PreviewTablePane.java
  9. 13
      designer-base/src/main/java/com/fr/design/dialog/BasicPane.java
  10. 2
      designer-base/src/main/java/com/fr/design/extra/PluginWebBridge.java
  11. 2
      designer-base/src/main/java/com/fr/design/extra/ShopDialog.java
  12. 5
      designer-base/src/main/java/com/fr/design/extra/exe/callback/ModifyStatusCallback.java
  13. 20
      designer-base/src/main/java/com/fr/design/fun/PluginManagerProvider.java
  14. 30
      designer-base/src/main/java/com/fr/design/fun/impl/AbstractPluginManagerProvider.java
  15. 676
      designer-base/src/main/java/com/fr/design/gui/autocomplete/DefaultCompletionProvider.java
  16. 25
      designer-base/src/main/java/com/fr/design/gui/ilist/TableViewList.java
  17. 42
      designer-base/src/main/java/com/fr/design/gui/itextfield/UINumberField.java
  18. 30
      designer-base/src/main/java/com/fr/design/gui/style/BorderPane.java
  19. 4
      designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/SyntaxScheme.java
  20. 9
      designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/Theme.java
  21. 8
      designer-base/src/main/java/com/fr/design/gui/syntax/ui/rtextarea/Macro.java
  22. 57
      designer-base/src/main/java/com/fr/design/i18n/DesignSizeI18nManager.java
  23. 4
      designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java
  24. 32
      designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java
  25. 39
      designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java
  26. 4
      designer-base/src/main/java/com/fr/design/os/impl/PMDialogAction.java
  27. 28
      designer-base/src/main/java/com/fr/design/os/impl/SupportOSImpl.java
  28. 21
      designer-base/src/main/java/com/fr/design/plugin/DesignerPluginContext.java
  29. 14
      designer-base/src/main/java/com/fr/design/ui/Assistant.java
  30. 14
      designer-base/src/main/java/com/fr/design/ui/ModernUIPane.java
  31. 2
      designer-base/src/main/java/com/fr/design/upm/UpmFinder.java
  32. 2
      designer-base/src/main/java/com/fr/design/upm/UpmShowDialog.java
  33. 10
      designer-base/src/main/java/com/fr/design/utils/gui/GUICoreUtils.java
  34. 13
      designer-base/src/main/java/com/fr/design/utils/gui/GUIPaintUtils.java
  35. 29
      designer-base/src/main/java/com/fr/env/PluginErrorRemindDialog.java
  36. 5
      designer-base/src/main/java/com/fr/start/server/FineEmbedServerActivator.java
  37. 1
      designer-base/src/main/resources/com/fr/design/i18n/dimension_en.properties
  38. 0
      designer-base/src/main/resources/com/fr/design/i18n/dimension_ja_JP.properties
  39. 0
      designer-base/src/main/resources/com/fr/design/i18n/dimension_ko_KR.properties
  40. 1
      designer-base/src/main/resources/com/fr/design/i18n/dimension_zh.properties
  41. 0
      designer-base/src/main/resources/com/fr/design/i18n/dimension_zh_TW.properties
  42. BIN
      designer-base/src/main/resources/com/fr/design/images/bbs/workOrderCenter.png
  43. 7
      designer-base/src/main/resources/com/fr/design/images/bbs/workOrderCenter_normal.svg
  44. 8
      designer-base/src/main/resources/com/fr/design/images/buttonicon/prewidget_normal.svg
  45. 7
      designer-base/src/main/resources/com/fr/design/images/buttonicon/refresh_normal.svg
  46. 7
      designer-base/src/main/resources/com/fr/design/images/buttonicon/widget/files_up_normal.svg
  47. 8
      designer-base/src/main/resources/com/fr/design/images/control/edit_disabled.svg
  48. 8
      designer-base/src/main/resources/com/fr/design/images/control/edit_normal.svg
  49. 11
      designer-base/src/main/resources/com/fr/design/images/control/remove_disabled.svg
  50. 9
      designer-base/src/main/resources/com/fr/design/images/control/remove_normal.svg
  51. 11
      designer-base/src/main/resources/com/fr/design/images/m_file/preview_disabled.svg
  52. 7
      designer-base/src/main/resources/com/fr/design/images/m_file/preview_normal.svg
  53. 80
      designer-base/src/test/java/com/fr/design/i18n/DesignSizeI18nManagerTest.java
  54. 10
      designer-base/src/test/java/com/fr/design/os/impl/SupportOSImplTest.java
  55. 21
      designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java
  56. 5
      designer-chart/src/main/java/com/fr/van/chart/designer/component/marker/VanChartImageMarkerPane.java
  57. 64
      designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeLabelDetailPane.java
  58. 5
      designer-chart/src/main/java/com/fr/van/chart/map/designer/other/condition/item/VanChartCommonMarkerConditionPane.java
  59. 9
      designer-chart/src/main/java/com/fr/van/chart/map/designer/type/GisLayerPane.java
  60. 2
      designer-chart/src/main/java/com/fr/van/chart/structure/desinger/style/StructureNodeStylePane.java
  61. 28
      designer-chart/src/main/resources/com/fr/design/editor/rich_editor.html
  62. 10
      designer-chart/src/main/resources/com/fr/design/editor/script/editor.js
  63. 6
      designer-chart/src/main/resources/com/fr/design/editor/script/editor.model.js
  64. BIN
      designer-chart/src/main/resources/com/fr/design/images/form/toolbar/drillmap.png
  65. BIN
      designer-chart/src/main/resources/com/fr/design/images/form/toolbar/heatmap.png
  66. BIN
      designer-chart/src/main/resources/com/fr/design/images/form/toolbar/map.png
  67. BIN
      designer-chart/src/main/resources/com/fr/van/chart/drillmap/images/area-map.png
  68. BIN
      designer-chart/src/main/resources/com/fr/van/chart/drillmap/images/point-map.png
  69. BIN
      designer-chart/src/main/resources/com/fr/van/chart/heatmap/images/heatmap.png
  70. BIN
      designer-chart/src/main/resources/com/fr/van/chart/map/images/area-map.png
  71. BIN
      designer-chart/src/main/resources/com/fr/van/chart/map/images/custom-map.png
  72. BIN
      designer-chart/src/main/resources/com/fr/van/chart/map/images/line-map.png
  73. BIN
      designer-chart/src/main/resources/com/fr/van/chart/map/images/point-map.png
  74. 8
      designer-form/src/main/java/com/fr/design/form/parameter/FormParaDesigner.java
  75. 2
      designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/AbstractFRLayoutDefinePane.java
  76. 2
      designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/FRFitLayoutDefinePane.java
  77. 5
      designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellStylePane.java
  78. 4
      designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/style/CustomStylePane.java
  79. 5
      designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/style/StylePane.java
  80. 3
      designer-realize/src/main/java/com/fr/design/mainframe/messagecollect/solid/SolidCollector.java
  81. 10
      designer-realize/src/main/java/com/fr/design/report/WriteShortCutsPane.java
  82. 23
      designer-realize/src/main/java/com/fr/design/style/BorderUtils.java
  83. 3
      designer-realize/src/main/java/com/fr/poly/creator/ECBlockEditor.java

38
designer-base/src/main/java/com/fr/base/svg/IconUtils.java

@ -2,9 +2,15 @@ package com.fr.base.svg;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.stable.bridge.StableFactory;
import com.fr.stable.fun.ResourcePathTransformer;
import com.fr.stable.plugin.ExtraClassManagerProvider;
import javax.swing.Icon; import javax.swing.Icon;
import javax.swing.ImageIcon; import javax.swing.ImageIcon;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
/** /**
* 主要是用来读取svgIcon的工具类 * 主要是用来读取svgIcon的工具类
@ -36,7 +42,7 @@ public class IconUtils {
// 判断是否以.svg结尾 // 判断是否以.svg结尾
if (resource.endsWith(ICON_SUFFIX_SVG)) { if (resource.endsWith(ICON_SUFFIX_SVG)) {
if (IOUtils.readResource(resource) != null) { if (IOUtils.readResource(resource) != null) {
return SVGIcon.readSVGIcon(resource); return SVGIcon.readSVGIcon(transformPath(resource));
} }
// 适配插件 // 适配插件
return adjustPluginsPng(resource); return adjustPluginsPng(resource);
@ -68,15 +74,15 @@ public class IconUtils {
private static Icon readNoSuffixResource(String resource, String svgIconType) { private static Icon readNoSuffixResource(String resource, String svgIconType) {
String svgPath = resource + svgIconType; String svgPath = resource + svgIconType;
if (IOUtils.readResource(svgPath) != null) { if (IOUtils.readResource(svgPath) != null) {
return SVGIcon.readSVGIcon(svgPath); return SVGIcon.readSVGIcon(transformPath(svgPath));
} }
String pngPath = resource + ICON_SUFFIX_PNG; String pngPath = resource + ICON_SUFFIX_PNG;
if (IOUtils.readResource(pngPath) != null) { if (IOUtils.readResource(pngPath) != null) {
return IOUtils.readIcon(pngPath); return IOUtils.readIcon(transformPath(pngPath));
} }
String gifPath = resource + ICON_SUFFIX_GIF; String gifPath = resource + ICON_SUFFIX_GIF;
if (IOUtils.readResource(gifPath) != null) { if (IOUtils.readResource(gifPath) != null) {
return IOUtils.readIcon(gifPath); return IOUtils.readIcon(transformPath(gifPath));
} }
FineLoggerFactory.getLogger().error("File not exists:{}", resource); FineLoggerFactory.getLogger().error("File not exists:{}", resource);
return new ImageIcon(); return new ImageIcon();
@ -113,8 +119,30 @@ public class IconUtils {
private static Icon readSpecifiedTypeIcon(String resource, String oldSuffix, String newSuffix) { private static Icon readSpecifiedTypeIcon(String resource, String oldSuffix, String newSuffix) {
String iconPath = resource.replace(oldSuffix, newSuffix); String iconPath = resource.replace(oldSuffix, newSuffix);
if (IOUtils.readResource(iconPath) != null) { if (IOUtils.readResource(iconPath) != null) {
return SVGIcon.readSVGIcon(iconPath); return SVGIcon.readSVGIcon(transformPath(iconPath));
} }
return readIcon(resource); return readIcon(resource);
} }
private static String transformPath(String path) {
Set<ResourcePathTransformer> set = getResourcePathTransformers();
for (ResourcePathTransformer transformer : set) {
if (transformer.accept(path)) {
return transformer.transform(path);
}
}
return path;
}
private static Set<ResourcePathTransformer> getResourcePathTransformers() {
Set<ResourcePathTransformer> set = new HashSet<ResourcePathTransformer>();
ExtraClassManagerProvider provider = StableFactory.getExtraClassManager();
if (provider != null) {
Set<ResourcePathTransformer> pluginProvided = provider.getArray(ResourcePathTransformer.MARK_STRING);
set.addAll(pluginProvided);
}
ResourcePathTransformer[] oemSet = StableFactory.getMarkedObjectsFromCollection(ResourcePathTransformer.MARK_STRING, ResourcePathTransformer.class);
set.addAll(Arrays.asList(oemSet));
return set;
}
} }

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

@ -281,6 +281,12 @@ public abstract class DesignModelAdapter<T extends BaseBook, S extends JTemplate
TableData tableData, TableData tableData,
Map<String, ParameterProvider> map, Map<String, ParameterProvider> map,
Filter<ParameterProvider> filter) { Filter<ParameterProvider> filter) {
// 处理初始化添加
if (tableDataParametersMap.isEmpty()) {
addTableDataParameters(map, filter);
return;
}
ParameterProvider[] providers = null; ParameterProvider[] providers = null;

26
designer-base/src/main/java/com/fr/design/actions/community/WorkOrderCenterAction.java

@ -0,0 +1,26 @@
package com.fr.design.actions.community;
import com.fr.design.i18n.Toolkit;
import com.fr.design.utils.BrowseUtils;
import com.fr.general.CloudCenter;
import java.awt.event.ActionEvent;
/**
* @Description 工单中心
* @Author Henry.Wang
* @Date 2021/3/8 14:02
**/
public class WorkOrderCenterAction extends UpAction {
public WorkOrderCenterAction() {
this.setSmallIcon("/com/fr/design/images/bbs/workOrderCenter");
this.setName(Toolkit.i18nText("Fine-Design_Basic_Commuinity_Work_Order_Center"));
}
@Override
public void actionPerformed(ActionEvent arg0) {
String url = CloudCenter.getInstance().acquireUrlByKind("bbs.work.order.center");
BrowseUtils.browser(url);
}
}

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

@ -13,12 +13,14 @@ import javax.swing.KeyStroke;
import java.awt.event.KeyEvent; import java.awt.event.KeyEvent;
import java.lang.reflect.Constructor; import java.lang.reflect.Constructor;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import java.util.LinkedHashSet;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap; import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.CopyOnWriteArraySet;
/** /**
* 插入单元格元素和插入悬浮元素的一些集合方法 * 插入单元格元素和插入悬浮元素的一些集合方法
@ -27,8 +29,8 @@ import java.util.concurrent.ConcurrentMap;
* @version 2017年11月17日14点39分 * @version 2017年11月17日14点39分
*/ */
public class ActionFactory { public class ActionFactory {
private static LinkedHashSet<Class<?>> actionClasses = new LinkedHashSet<>(); private static Set<Class<?>> actionClasses = new CopyOnWriteArraySet<>();
private static LinkedHashSet<Class<?>> floatActionClasses = new LinkedHashSet<>(); private static Set<Class<?>> floatActionClasses = new CopyOnWriteArraySet<>();
private static Class chartCollectionClass = null; private static Class chartCollectionClass = null;
/** /**
* 无需每次实例化的悬浮元素编辑器 * 无需每次实例化的悬浮元素编辑器
@ -256,14 +258,14 @@ public class ActionFactory {
*/ */
public static void registerCellInsertActionClass(Class<?>[] cls) { public static void registerCellInsertActionClass(Class<?>[] cls) {
if (cls != null) { if (cls != null) {
Collections.addAll(actionClasses, cls); actionClasses.addAll(Arrays.asList(cls));
} }
} }
public static void referCellInsertActionClass(Class<?>[] cls) { public static void referCellInsertActionClass(Class<?>[] cls) {
if (cls != null) { if (cls != null) {
actionClasses.clear(); actionClasses.clear();
Collections.addAll(actionClasses, cls); actionClasses.addAll(Arrays.asList(cls));
} }
} }
@ -321,14 +323,14 @@ public class ActionFactory {
*/ */
public static void registerFloatInsertActionClass(Class<?>[] cls) { public static void registerFloatInsertActionClass(Class<?>[] cls) {
if (cls != null) { if (cls != null) {
Collections.addAll(floatActionClasses, cls); floatActionClasses.addAll(Arrays.asList(cls));
} }
} }
public static void referFloatInsertActionClass(Class<?>[] cls) { public static void referFloatInsertActionClass(Class<?>[] cls) {
if (cls != null) { if (cls != null) {
floatActionClasses.clear(); floatActionClasses.clear();
Collections.addAll(floatActionClasses, cls); floatActionClasses.addAll(Arrays.asList(cls));
} }
} }

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

@ -73,6 +73,24 @@ public final class WebPreviewUtils {
FILE currentTemplate = jt.getEditingFILE(); FILE currentTemplate = jt.getEditingFILE();
// carl:是否是保存在运行环境下的模板,不是就不能被预览 // carl:是否是保存在运行环境下的模板,不是就不能被预览
if (currentTemplate instanceof FileNodeFILE) { if (currentTemplate instanceof FileNodeFILE) {
// 判断下模板是否存在 不存在先提示
if (!currentTemplate.exists()) {
int selVal = showConfirmDialog(
DesignerContext.getDesignerFrame(),
Toolkit.i18nText("Fine-Design_Basic_Web_Preview_Message"),
Toolkit.i18nText("Fine-Design_Basic_Preview_Tool_Tips"),
OK_CANCEL_OPTION,
WARNING_MESSAGE
);
if (OK_OPTION == selVal) {
if (!jt.saveAsTemplate()) {
return;
}
} else {
return;
}
currentTemplate = jt.getEditingFILE();
}
browseUrl(currentTemplate, baseRoute, map, actionType, jt); browseUrl(currentTemplate, baseRoute, map, actionType, jt);
} else { } else {
// 说明模板没有保存在报表运行环境下面,提示用户 // 说明模板没有保存在报表运行环境下面,提示用户

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

@ -71,7 +71,7 @@ public class ConnectionComboBoxPanel extends ItemEditableComboBoxPanel {
EditLockUtils.CONNECTION_LOCKED_ICON, EditLockUtils.CONNECTION_LOCKED_ICON,
IconUtils.readIcon("/com/fr/design/images/m_web/connection"), IconUtils.readIcon("/com/fr/design/images/m_web/connection"),
EditLockUtils.CONNECTION_LOCKED_TOOLTIPS, EditLockUtils.CONNECTION_LOCKED_TOOLTIPS,
StringUtils.EMPTY null
); );
editButton.setPreferredSize(buttonSize); editButton.setPreferredSize(buttonSize);
editButton.addActionListener(new ActionListener() { editButton.addActionListener(new ActionListener() {

37
designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionTableProcedurePane.java

@ -1,27 +1,32 @@
package com.fr.design.data.datapane.connect; package com.fr.design.data.datapane.connect;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.data.core.db.TableProcedure;
import com.fr.data.impl.AbstractDatabaseConnection; import com.fr.data.impl.AbstractDatabaseConnection;
import com.fr.data.impl.Connection; import com.fr.data.impl.Connection;
import com.fr.design.constants.UIConstants;
import com.fr.data.core.db.TableProcedure;
import com.fr.design.border.UIRoundedBorder; import com.fr.design.border.UIRoundedBorder;
import com.fr.design.constants.UIConstants;
import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.gui.ilist.TableViewList; import com.fr.design.gui.ilist.TableViewList;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.dialog.BasicPane;
import com.fr.general.GeneralContext; import com.fr.general.GeneralContext;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import javax.swing.*; import javax.swing.JPanel;
import javax.swing.ToolTipManager;
import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener; import javax.swing.event.DocumentListener;
import java.awt.*; import java.awt.BorderLayout;
import java.awt.event.*; import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.List; import java.util.List;
/** /**
@ -48,10 +53,11 @@ public class ConnectionTableProcedurePane extends BasicPane {
filter(connection, conName, nameList); filter(connection, conName, nameList);
} }
@Override
protected void refreshItems() { protected void refreshItems() {
super.refreshItems(); super.refreshItems();
if (tableViewList != null) { if (tableViewList != null) {
search(); search(true);
} }
} }
}; };
@ -148,17 +154,17 @@ public class ConnectionTableProcedurePane extends BasicPane {
@Override @Override
public void removeUpdate(DocumentEvent e) { public void removeUpdate(DocumentEvent e) {
search(); search(false);
} }
@Override @Override
public void insertUpdate(DocumentEvent e) { public void insertUpdate(DocumentEvent e) {
search(); search(false);
} }
@Override @Override
public void changedUpdate(DocumentEvent e) { public void changedUpdate(DocumentEvent e) {
search(); search(false);
} }
}; };
@ -166,14 +172,14 @@ public class ConnectionTableProcedurePane extends BasicPane {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
search(); search(false);
} }
}; };
/** /**
* 选项改变需要重新刷新下拉列表里面的项 * 选项改变需要重新刷新下拉列表里面的项
*/ */
protected void search() { protected void search(boolean refresh) {
String selectedObj = connectionComboBox.getSelectedItem(); String selectedObj = connectionComboBox.getSelectedItem();
String[] types = ArrayUtils.EMPTY_STRING_ARRAY; String[] types = ArrayUtils.EMPTY_STRING_ARRAY;
@ -187,7 +193,7 @@ public class ConnectionTableProcedurePane extends BasicPane {
} else { } else {
types = (String[]) ArrayUtils.add(types, TableProcedure.PROCEDURE); types = (String[]) ArrayUtils.add(types, TableProcedure.PROCEDURE);
} }
tableViewList.populate(selectedObj, searchField.getText().trim(), types); tableViewList.populate(selectedObj, searchField.getText().trim(), refresh, types);
} }
@Override @Override
@ -196,7 +202,6 @@ public class ConnectionTableProcedurePane extends BasicPane {
} }
/** /**
*
* @param l * @param l
*/ */
public void addDoubleClickListener(DoubleClickSelectedNodeOnTreeListener l) { public void addDoubleClickListener(DoubleClickSelectedNodeOnTreeListener l) {

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

@ -169,7 +169,6 @@ public class PreviewTablePane extends BasicPane {
this.add(new JScrollPane(preveiwTable), BorderLayout.CENTER); this.add(new JScrollPane(preveiwTable), BorderLayout.CENTER);
if (this.dialog == null) { if (this.dialog == null) {
this.dialog = this.showWindow(new JFrame()); this.dialog = this.showWindow(new JFrame());
GUICoreUtils.centerWindow(DesignerContext.getDesignerFrame(), this.dialog);
} }
progressBar = new AutoProgressBar(this, Toolkit.i18nText("Fine-Design_Basic_Loading_Data"), "", 0, 100) { progressBar = new AutoProgressBar(this, Toolkit.i18nText("Fine-Design_Basic_Loading_Data"), "", 0, 100) {
public void doMonitorCanceled() { public void doMonitorCanceled() {

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

@ -3,6 +3,7 @@ package com.fr.design.dialog;
import com.fr.common.annotations.Open; import com.fr.common.annotations.Open;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.i18n.DesignSizeI18nManager;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.stable.core.PropertyChangeAdapter; import com.fr.stable.core.PropertyChangeAdapter;
@ -33,7 +34,7 @@ public abstract class BasicPane extends JPanel {
* @return 对话框 * @return 对话框
*/ */
public BasicDialog showWindow(Window window, DialogActionListener l) { public BasicDialog showWindow(Window window, DialogActionListener l) {
return showWindowWithCustomSize(window, l, BasicDialog.DEFAULT); return showWindowWithCustomSize(window, l, DesignSizeI18nManager.getInstance().i18nDimension(this.i18nText4PopupWindow()));
} }
/** /**
@ -236,6 +237,14 @@ public abstract class BasicPane extends JPanel {
return title4PopupWindow(); return title4PopupWindow();
} }
/**
* 国际化标识
* @return 默认是取当前类的全限定名
*/
protected String i18nText4PopupWindow() {
return this.getClass().getName();
}
/** /**
* 作为名字面板 * 作为名字面板
* *
@ -403,4 +412,4 @@ public abstract class BasicPane extends JPanel {
} }
} }

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

@ -16,6 +16,7 @@ import com.fr.design.gui.ilable.UILabel;
import com.fr.design.locale.impl.BbsRegisterMark; import com.fr.design.locale.impl.BbsRegisterMark;
import com.fr.design.locale.impl.BbsResetMark; import com.fr.design.locale.impl.BbsResetMark;
import com.fr.design.locale.impl.BbsSpaceMark; import com.fr.design.locale.impl.BbsSpaceMark;
import com.fr.design.plugin.DesignerPluginContext;
import com.fr.design.utils.concurrent.ThreadFactoryBuilder; import com.fr.design.utils.concurrent.ThreadFactoryBuilder;
import com.fr.general.CloudCenter; import com.fr.general.CloudCenter;
import com.fr.general.locale.LocaleCenter; import com.fr.general.locale.LocaleCenter;
@ -401,6 +402,7 @@ public class PluginWebBridge {
if (uiDialog != null) { if (uiDialog != null) {
uiDialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); uiDialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
uiDialog.setVisible(false); uiDialog.setVisible(false);
DesignerPluginContext.setPluginDialog(null);
} }
} }

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

@ -3,6 +3,7 @@ package com.fr.design.extra;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.design.dialog.UIDialog; import com.fr.design.dialog.UIDialog;
import com.fr.design.jdk.JdkVersion; import com.fr.design.jdk.JdkVersion;
import com.fr.design.plugin.DesignerPluginContext;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
@ -25,6 +26,7 @@ public class ShopDialog extends UIDialog {
setSize(createDefaultDimension()); setSize(createDefaultDimension());
GUICoreUtils.centerWindow(this); GUICoreUtils.centerWindow(this);
setResizable(false); setResizable(false);
DesignerPluginContext.setPluginDialog(this);
} }
private Dimension createDefaultDimension() { private Dimension createDefaultDimension() {

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

@ -5,6 +5,7 @@ import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.extra.PluginOperateUtils; import com.fr.design.extra.PluginOperateUtils;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.plugin.DesignerPluginContext;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.plugin.manage.control.PluginTaskCallback; import com.fr.plugin.manage.control.PluginTaskCallback;
import com.fr.plugin.manage.control.PluginTaskResult; import com.fr.plugin.manage.control.PluginTaskResult;
@ -31,9 +32,9 @@ public class ModifyStatusCallback implements PluginTaskCallback{
pluginInfo + Toolkit.i18nText("Fine-Design_Basic_Plugin_Has_Been_Disabled_Duplicate") : pluginInfo + Toolkit.i18nText("Fine-Design_Basic_Plugin_Has_Been_Disabled_Duplicate") :
pluginInfo + Toolkit.i18nText("Fine-Design_Plugin_Has_Been_Actived_Duplicate"); pluginInfo + Toolkit.i18nText("Fine-Design_Plugin_Has_Been_Actived_Duplicate");
FineLoggerFactory.getLogger().info(modifyMessage); FineLoggerFactory.getLogger().info(modifyMessage);
FineJOptionPane.showMessageDialog(null, modifyMessage); FineJOptionPane.showMessageDialog(DesignerPluginContext.getPluginDialog(), modifyMessage);
} else { } else {
FineJOptionPane.showMessageDialog(null, pluginInfo, Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), JOptionPane.ERROR_MESSAGE); FineJOptionPane.showMessageDialog(DesignerPluginContext.getPluginDialog(), pluginInfo, Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), JOptionPane.ERROR_MESSAGE);
} }
} }

20
designer-base/src/main/java/com/fr/design/fun/PluginManagerProvider.java

@ -0,0 +1,20 @@
package com.fr.design.fun;
import com.fr.design.actions.UpdateAction;
import com.fr.stable.fun.mark.Selectable;
/**
* 替换插件管理入口
* @author Lucian.Chen
* @version 10.0
* Created by Lucian.Chen on 2021/2/20
*/
public interface PluginManagerProvider extends Selectable {
String MARK_STRING = "PluginManagerProvider";
int CURRENT_LEVEL = 1;
// 插件管理
UpdateAction pluginManagerAction();
}

30
designer-base/src/main/java/com/fr/design/fun/impl/AbstractPluginManagerProvider.java

@ -0,0 +1,30 @@
package com.fr.design.fun.impl;
import com.fr.design.fun.PluginManagerProvider;
import com.fr.stable.fun.assist.Selector;
import com.fr.stable.fun.impl.AbstractProvider;
import com.fr.stable.fun.mark.API;
/**
* @author Lucian.Chen
* @version 10.0
* Created by Lucian.Chen on 2021/2/20
*/
@API(level = PluginManagerProvider.CURRENT_LEVEL)
public abstract class AbstractPluginManagerProvider extends AbstractProvider implements PluginManagerProvider {
public int currentAPILevel() {
return CURRENT_LEVEL;
}
@Override
public String mark4Provider() {
return getClass().getName();
}
@Override
public Selector selector() {
return Selector.ALWAYS;
}
}

676
designer-base/src/main/java/com/fr/design/gui/autocomplete/DefaultCompletionProvider.java

@ -2,7 +2,7 @@
* 12/21/2008 * 12/21/2008
* *
* DefaultCompletionProvider.java - A basic completion provider implementation. * DefaultCompletionProvider.java - A basic completion provider implementation.
* *
* This library is distributed under a modified BSD license. See the included * This library is distributed under a modified BSD license. See the included
* RSyntaxTextArea.License.txt file for details. * RSyntaxTextArea.License.txt file for details.
*/ */
@ -24,7 +24,11 @@ import javax.swing.text.Segment;
import javax.xml.parsers.ParserConfigurationException; import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory; import javax.xml.parsers.SAXParserFactory;
import com.fr.log.FineLoggerFactory;
import org.xml.sax.SAXException; import org.xml.sax.SAXException;
import org.xml.sax.SAXNotRecognizedException;
import org.xml.sax.SAXNotSupportedException;
/** /**
@ -38,337 +42,345 @@ import org.xml.sax.SAXException;
*/ */
public class DefaultCompletionProvider extends AbstractCompletionProvider { public class DefaultCompletionProvider extends AbstractCompletionProvider {
protected Segment seg; protected Segment seg;
/** /**
* Used to speed up {@link #getCompletionsAt(JTextComponent, Point)}. * Used to speed up {@link #getCompletionsAt(JTextComponent, Point)}.
*/ */
private String lastCompletionsAtText; private String lastCompletionsAtText;
/** /**
* Used to speed up {@link #getCompletionsAt(JTextComponent, Point)}, * Used to speed up {@link #getCompletionsAt(JTextComponent, Point)},
* since this may be called multiple times in succession (this is usually * since this may be called multiple times in succession (this is usually
* called by <tt>JTextComponent.getToolTipText()</tt>, and if the user * called by <tt>JTextComponent.getToolTipText()</tt>, and if the user
* wiggles the mouse while a tool tip is displayed, this method gets * wiggles the mouse while a tool tip is displayed, this method gets
* repeatedly called. It can be costly so we try to speed it up a tad). * repeatedly called. It can be costly so we try to speed it up a tad).
*/ */
private List<Completion> lastParameterizedCompletionsAt; private List<Completion> lastParameterizedCompletionsAt;
/** /**
* Constructor. The returned provider will not be aware of any completions. * Constructor. The returned provider will not be aware of any completions.
* *
* @see #addCompletion(Completion) * @see #addCompletion(Completion)
*/ */
public DefaultCompletionProvider() { public DefaultCompletionProvider() {
init(); init();
} }
/** /**
* Creates a completion provider that provides completion for a simple * Creates a completion provider that provides completion for a simple
* list of words. * list of words.
* *
* @param words The words to offer as completion suggestions. If this is * @param words The words to offer as completion suggestions. If this is
* <code>null</code>, no completions will be known. * <code>null</code>, no completions will be known.
* @see BasicCompletion * @see BasicCompletion
*/ */
public DefaultCompletionProvider(String[] words) { public DefaultCompletionProvider(String[] words) {
init(); init();
addWordCompletions(words); addWordCompletions(words);
} }
/** /**
* Returns the text just before the current caret position that could be * Returns the text just before the current caret position that could be
* the start of something auto-completable.<p> * the start of something auto-completable.<p>
* * <p>
* This method returns all characters before the caret that are matched * This method returns all characters before the caret that are matched
* by {@link #isValidChar(char)}. * by {@link #isValidChar(char)}.
* * <p>
* {@inheritDoc} * {@inheritDoc}
*/ */
public String getAlreadyEnteredText(JTextComponent comp) { public String getAlreadyEnteredText(JTextComponent comp) {
Document doc = comp.getDocument(); Document doc = comp.getDocument();
int dot = comp.getCaretPosition(); int dot = comp.getCaretPosition();
Element root = doc.getDefaultRootElement(); Element root = doc.getDefaultRootElement();
int index = root.getElementIndex(dot); int index = root.getElementIndex(dot);
Element elem = root.getElement(index); Element elem = root.getElement(index);
int start = elem.getStartOffset(); int start = elem.getStartOffset();
int len = dot-start; int len = dot - start;
try { try {
doc.getText(start, len, seg); doc.getText(start, len, seg);
} catch (BadLocationException ble) { } catch (BadLocationException ble) {
return EMPTY_STRING; return EMPTY_STRING;
} }
int segEnd = seg.offset + len; int segEnd = seg.offset + len;
start = segEnd - 1; start = segEnd - 1;
while (start>=seg.offset && isValidChar(seg.array[start])) { while (start >= seg.offset && isValidChar(seg.array[start])) {
start--; start--;
} }
start++; start++;
len = segEnd - start; len = segEnd - start;
return len==0 ? EMPTY_STRING : new String(seg.array, start, len); return len == 0 ? EMPTY_STRING : new String(seg.array, start, len);
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public List<Completion> getCompletionsAt(JTextComponent tc, Point p) { public List<Completion> getCompletionsAt(JTextComponent tc, Point p) {
int offset = tc.viewToModel(p); int offset = tc.viewToModel(p);
if (offset<0 || offset>=tc.getDocument().getLength()) { if (offset < 0 || offset >= tc.getDocument().getLength()) {
lastCompletionsAtText = null; lastCompletionsAtText = null;
return lastParameterizedCompletionsAt = null; return lastParameterizedCompletionsAt = null;
} }
Segment s = new Segment(); Segment s = new Segment();
Document doc = tc.getDocument(); Document doc = tc.getDocument();
Element root = doc.getDefaultRootElement(); Element root = doc.getDefaultRootElement();
int line = root.getElementIndex(offset); int line = root.getElementIndex(offset);
Element elem = root.getElement(line); Element elem = root.getElement(line);
int start = elem.getStartOffset(); int start = elem.getStartOffset();
int end = elem.getEndOffset() - 1; int end = elem.getEndOffset() - 1;
try { try {
doc.getText(start, end-start, s); doc.getText(start, end - start, s);
// Get the valid chars before the specified offset. // Get the valid chars before the specified offset.
int startOffs = s.offset + (offset-start) - 1; int startOffs = s.offset + (offset - start) - 1;
while (startOffs>=s.offset && isValidChar(s.array[startOffs])) { while (startOffs >= s.offset && isValidChar(s.array[startOffs])) {
startOffs--; startOffs--;
} }
// Get the valid chars at and after the specified offset. // Get the valid chars at and after the specified offset.
int endOffs = s.offset + (offset-start); int endOffs = s.offset + (offset - start);
while (endOffs<s.offset+s.count && isValidChar(s.array[endOffs])) { while (endOffs < s.offset + s.count && isValidChar(s.array[endOffs])) {
endOffs++; endOffs++;
} }
int len = endOffs - startOffs - 1; int len = endOffs - startOffs - 1;
if (len<=0) { if (len <= 0) {
return lastParameterizedCompletionsAt = null; return lastParameterizedCompletionsAt = null;
} }
String text = new String(s.array, startOffs+1, len); String text = new String(s.array, startOffs + 1, len);
if (text.equals(lastCompletionsAtText)) { if (text.equals(lastCompletionsAtText)) {
return lastParameterizedCompletionsAt; return lastParameterizedCompletionsAt;
} }
// Get a list of all Completions matching the text. // Get a list of all Completions matching the text.
List<Completion> list = getCompletionByInputText(text); List<Completion> list = getCompletionByInputText(text);
lastCompletionsAtText = text; lastCompletionsAtText = text;
return lastParameterizedCompletionsAt = list; return lastParameterizedCompletionsAt = list;
} catch (BadLocationException ble) { } catch (BadLocationException ble) {
// Never happens // Never happens
} }
lastCompletionsAtText = null; lastCompletionsAtText = null;
return lastParameterizedCompletionsAt = null; return lastParameterizedCompletionsAt = null;
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public List<ParameterizedCompletion> getParameterizedCompletions( public List<ParameterizedCompletion> getParameterizedCompletions(
JTextComponent tc) { JTextComponent tc) {
List<ParameterizedCompletion> list = null; List<ParameterizedCompletion> list = null;
// If this provider doesn't support parameterized completions, // If this provider doesn't support parameterized completions,
// bail out now. // bail out now.
char paramListStart = getParameterListStart(); char paramListStart = getParameterListStart();
if (paramListStart==0) { if (paramListStart == 0) {
return list; // null return list; // null
} }
int dot = tc.getCaretPosition(); int dot = tc.getCaretPosition();
Segment s = new Segment(); Segment s = new Segment();
Document doc = tc.getDocument(); Document doc = tc.getDocument();
Element root = doc.getDefaultRootElement(); Element root = doc.getDefaultRootElement();
int line = root.getElementIndex(dot); int line = root.getElementIndex(dot);
Element elem = root.getElement(line); Element elem = root.getElement(line);
int offs = elem.getStartOffset(); int offs = elem.getStartOffset();
int len = dot - offs - 1/*paramListStart.length()*/; int len = dot - offs - 1/*paramListStart.length()*/;
if (len<=0) { // Not enough chars on line for a method. if (len <= 0) { // Not enough chars on line for a method.
return list; // null return list; // null
} }
try { try {
doc.getText(offs, len, s); doc.getText(offs, len, s);
// Get the identifier preceding the '(', ignoring any whitespace // Get the identifier preceding the '(', ignoring any whitespace
// between them. // between them.
offs = s.offset + len - 1; offs = s.offset + len - 1;
while (offs>=s.offset && Character.isWhitespace(s.array[offs])) { while (offs >= s.offset && Character.isWhitespace(s.array[offs])) {
offs--; offs--;
} }
int end = offs; int end = offs;
while (offs>=s.offset && isValidChar(s.array[offs])) { while (offs >= s.offset && isValidChar(s.array[offs])) {
offs--; offs--;
} }
String text = new String(s.array, offs+1, end-offs); String text = new String(s.array, offs + 1, end - offs);
// Get a list of all Completions matching the text, but then // Get a list of all Completions matching the text, but then
// narrow it down to just the ParameterizedCompletions. // narrow it down to just the ParameterizedCompletions.
List<Completion> l = getCompletionByInputText(text); List<Completion> l = getCompletionByInputText(text);
if (l!=null && !l.isEmpty()) { if (l != null && !l.isEmpty()) {
for (int i=0; i<l.size(); i++) { for (int i = 0; i < l.size(); i++) {
Object o = l.get(i); Object o = l.get(i);
if (o instanceof ParameterizedCompletion) { if (o instanceof ParameterizedCompletion) {
if (list==null) { if (list == null) {
list = new ArrayList<ParameterizedCompletion>(1); list = new ArrayList<ParameterizedCompletion>(1);
} }
list.add((ParameterizedCompletion)o); list.add((ParameterizedCompletion) o);
} }
} }
} }
} catch (BadLocationException ble) { } catch (BadLocationException ble) {
// Never happens // Never happens
} }
return list; return list;
} }
/** /**
* Initializes this completion provider. * Initializes this completion provider.
*/ */
protected void init() { protected void init() {
completions = new ArrayList<Completion>(); completions = new ArrayList<Completion>();
seg = new Segment(); seg = new Segment();
} }
/** /**
* Returns whether the specified character is valid in an auto-completion. * Returns whether the specified character is valid in an auto-completion.
* The default implementation is equivalent to * The default implementation is equivalent to
* "<code>Character.isLetterOrDigit(ch) || ch=='_'</code>". Subclasses * "<code>Character.isLetterOrDigit(ch) || ch=='_'</code>". Subclasses
* can override this method to change what characters are matched. * can override this method to change what characters are matched.
* *
* @param ch The character. * @param ch The character.
* @return Whether the character is valid. * @return Whether the character is valid.
*/ */
protected boolean isValidChar(char ch) { protected boolean isValidChar(char ch) {
return Character.isLetterOrDigit(ch) || ch=='_'; return Character.isLetterOrDigit(ch) || ch == '_';
} }
/** /**
* Loads completions from an XML file. The XML should validate against * Loads completions from an XML file. The XML should validate against
* <code>CompletionXml.dtd</code>. * <code>CompletionXml.dtd</code>.
* *
* @param file An XML file to load from. * @param file An XML file to load from.
* @throws IOException If an IO error occurs. * @throws IOException If an IO error occurs.
*/ */
public void loadFromXML(File file) throws IOException { public void loadFromXML(File file) throws IOException {
BufferedInputStream bin = new BufferedInputStream( BufferedInputStream bin = new BufferedInputStream(
new FileInputStream(file)); new FileInputStream(file));
try { try {
loadFromXML(bin); loadFromXML(bin);
} finally { } finally {
bin.close(); bin.close();
} }
} }
/** /**
* Loads completions from an XML input stream. The XML should validate * Loads completions from an XML input stream. The XML should validate
* against <code>CompletionXml.dtd</code>. * against <code>CompletionXml.dtd</code>.
* *
* @param in The input stream to read from. * @param in The input stream to read from.
* @throws IOException If an IO error occurs. * @throws IOException If an IO error occurs.
*/ */
public void loadFromXML(InputStream in) throws IOException { public void loadFromXML(InputStream in) throws IOException {
loadFromXML(in, null); loadFromXML(in, null);
} }
/** /**
* Loads completions from an XML input stream. The XML should validate * Loads completions from an XML input stream. The XML should validate
* against <code>CompletionXml.dtd</code>. * against <code>CompletionXml.dtd</code>.
* *
* @param in The input stream to read from. * @param in The input stream to read from.
* @param cl The class loader to use when loading any extra classes defined * @param cl The class loader to use when loading any extra classes defined
* in the XML, such as custom {@link FunctionCompletion}s. This * in the XML, such as custom {@link FunctionCompletion}s. This
* may be <code>null</code> if the default is to be used, or if no * may be <code>null</code> if the default is to be used, or if no
* custom completions are defined in the XML. * custom completions are defined in the XML.
* @throws IOException If an IO error occurs. * @throws IOException If an IO error occurs.
*/ */
public void loadFromXML(InputStream in, ClassLoader cl) throws IOException { public void loadFromXML(InputStream in, ClassLoader cl) throws IOException {
//long start = System.currentTimeMillis(); //long start = System.currentTimeMillis();
SAXParserFactory factory = SAXParserFactory.newInstance(); SAXParserFactory factory = SAXParserFactory.newInstance();
factory.setValidating(true); try {
CompletionXMLParser handler = new CompletionXMLParser(this, cl); factory.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
BufferedInputStream bin = new BufferedInputStream(in); factory.setFeature("http://xml.org/sax/features/external-general-entities", false);
try { factory.setFeature("http://xml.org/sax/features/external-parameter-entities", false);
SAXParser saxParser = factory.newSAXParser(); factory.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);
saxParser.parse(bin, handler); } catch (ParserConfigurationException | SAXNotSupportedException | SAXNotRecognizedException e) {
List<Completion> completions = handler.getCompletions(); FineLoggerFactory.getLogger().warn(e.getMessage(), e);
addCompletions(completions); }
char startChar = handler.getParamStartChar();
if (startChar!=0) { factory.setValidating(true);
char endChar = handler.getParamEndChar(); CompletionXMLParser handler = new CompletionXMLParser(this, cl);
String sep = handler.getParamSeparator(); BufferedInputStream bin = new BufferedInputStream(in);
if (endChar!=0 && sep!=null && sep.length()>0) { // Sanity try {
setParameterizedCompletionParams(startChar, sep, endChar); SAXParser saxParser = factory.newSAXParser();
} saxParser.parse(bin, handler);
} List<Completion> completions = handler.getCompletions();
} catch (SAXException se) { addCompletions(completions);
throw new IOException(se.toString()); char startChar = handler.getParamStartChar();
} catch (ParserConfigurationException pce) { if (startChar != 0) {
throw new IOException(pce.toString()); char endChar = handler.getParamEndChar();
} finally { String sep = handler.getParamSeparator();
//long time = System.currentTimeMillis() - start; if (endChar != 0 && sep != null && sep.length() > 0) { // Sanity
//System.out.println("XML loaded in: " + time + "ms"); setParameterizedCompletionParams(startChar, sep, endChar);
bin.close(); }
} }
} catch (SAXException se) {
} throw new IOException(se.toString());
} catch (ParserConfigurationException pce) {
throw new IOException(pce.toString());
/** } finally {
* Loads completions from an XML file. The XML should validate against //long time = System.currentTimeMillis() - start;
* <code>CompletionXml.dtd</code>. //System.out.println("XML loaded in: " + time + "ms");
* bin.close();
* @param resource A resource the current ClassLoader can get to. }
* @throws IOException If an IO error occurs.
*/ }
public void loadFromXML(String resource) throws IOException {
ClassLoader cl = getClass().getClassLoader();
InputStream in = cl.getResourceAsStream(resource); /**
if (in==null) { * Loads completions from an XML file. The XML should validate against
File file = new File(resource); * <code>CompletionXml.dtd</code>.
if (file.isFile()) { *
in = new FileInputStream(file); * @param resource A resource the current ClassLoader can get to.
} * @throws IOException If an IO error occurs.
else { */
throw new IOException("No such resource: " + resource); public void loadFromXML(String resource) throws IOException {
} ClassLoader cl = getClass().getClassLoader();
} InputStream in = cl.getResourceAsStream(resource);
BufferedInputStream bin = new BufferedInputStream(in); if (in == null) {
try { File file = new File(resource);
loadFromXML(bin); if (file.isFile()) {
} finally { in = new FileInputStream(file);
bin.close(); } else {
} throw new IOException("No such resource: " + resource);
} }
}
BufferedInputStream bin = new BufferedInputStream(in);
try {
loadFromXML(bin);
} finally {
bin.close();
}
}
} }

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

@ -82,7 +82,7 @@ public class TableViewList extends UIList {
* @param searchFilter * @param searchFilter
* @param typesFilter * @param typesFilter
*/ */
public void populate(final String databaseName, final String searchFilter, final String... typesFilter) { public void populate(final String databaseName, final String searchFilter, boolean refresh, final String... typesFilter) {
DefaultListModel defaultListModel = new DefaultListModel(); DefaultListModel defaultListModel = new DefaultListModel();
defaultListModel.addElement(UIConstants.PENDING); defaultListModel.addElement(UIConstants.PENDING);
final DefaultListModel failed = new DefaultListModel(); final DefaultListModel failed = new DefaultListModel();
@ -106,12 +106,8 @@ public class TableViewList extends UIList {
if (!status) { if (!status) {
throw new Exception(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Database_Connection_Failed")); throw new Exception(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Database_Connection_Failed"));
} }
String[] schemas = DataCoreUtils.getDatabaseSchema(datasource); if (refresh) {
schemas = (schemas == null || schemas.length == 0) ? new String[]{null} : schemas; clearCache(datasource);
for (String schema : schemas) {
DataCoreUtils.refreshTables(datasource, TableProcedure.TABLE, schema);
DataCoreUtils.refreshTables(datasource, TableProcedure.VIEW, schema);
DataCoreUtils.refreshTables(datasource, TableProcedure.PROCEDURE, schema);
} }
return processDataInAnotherThread(databaseName, searchFilter, typesFilter); return processDataInAnotherThread(databaseName, searchFilter, typesFilter);
} }
@ -133,6 +129,21 @@ public class TableViewList extends UIList {
} }
} }
private void clearCache(Connection datasource) {
String[] schemas = DataCoreUtils.getDatabaseSchema(datasource);
schemas = (schemas == null || schemas.length == 0) ? new String[]{null} : schemas;
for (String schema : schemas) {
doClearCache(datasource, schema);
}
doClearCache(datasource, null);
}
private void doClearCache(Connection datasource, String schema) {
DataCoreUtils.refreshTables(datasource, TableProcedure.TABLE, schema);
DataCoreUtils.refreshTables(datasource, TableProcedure.VIEW, schema);
DataCoreUtils.refreshTables(datasource, TableProcedure.PROCEDURE, schema);
}
/** /**
* augustdatabaseName是数据库名字searchFilter是输入的过滤条件,typesFilter是视图 * augustdatabaseName是数据库名字searchFilter是输入的过滤条件,typesFilter是视图
* 存储过程中的一者或者几者 * 存储过程中的一者或者几者

42
designer-base/src/main/java/com/fr/design/gui/itextfield/UINumberField.java

@ -5,11 +5,15 @@ import com.fr.general.ComparatorUtils;
import com.fr.stable.CoreConstants; import com.fr.stable.CoreConstants;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.event.CaretEvent;
import javax.swing.event.CaretListener;
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.Dimension; import java.awt.Dimension;
import java.awt.Toolkit; import java.awt.Toolkit;
import java.awt.event.InputMethodEvent;
import java.awt.event.InputMethodListener;
/** /**
* Number Field. * Number Field.
@ -35,6 +39,11 @@ public class UINumberField extends UITextField {
private boolean isContentChanged = false; private boolean isContentChanged = false;
private boolean fillNegativeNumber = true; private boolean fillNegativeNumber = true;
/**
* 输入法输入完成一个字符输入过程的标记开始输入的时候是true输入完矫正光标后为false
*/
private boolean isInputMethodOnceInserting = false;
private int insertOffset = 0;
public UINumberField() { public UINumberField() {
this(MAX_INTEGERLENGTH_32, MAX_DECIMALLENGTH); this(MAX_INTEGERLENGTH_32, MAX_DECIMALLENGTH);
@ -55,6 +64,7 @@ public class UINumberField extends UITextField {
this.minValue = minValue; this.minValue = minValue;
this.maxValue = maxValue; this.maxValue = maxValue;
setFieldDocument(); setFieldDocument();
initFieldListener();
} }
public void setFieldDocument() { public void setFieldDocument() {
@ -62,6 +72,31 @@ public class UINumberField extends UITextField {
initListener(); initListener();
} }
private void initFieldListener() {
addInputMethodListener(new InputMethodListener() {
@Override
public void inputMethodTextChanged(InputMethodEvent event) {
isInputMethodOnceInserting = true;
}
@Override
public void caretPositionChanged(InputMethodEvent event) {
}
});
addCaretListener(new CaretListener() {
@Override
public void caretUpdate(CaretEvent e) {
if (isInputMethodOnceInserting) {
isInputMethodOnceInserting = false;
setCaretPosition(insertOffset);
} else {
insertOffset = e.getDot();
}
}
});
}
public void canFillNegativeNumber(boolean fillNegativeNumber) { public void canFillNegativeNumber(boolean fillNegativeNumber) {
this.fillNegativeNumber = fillNegativeNumber; this.fillNegativeNumber = fillNegativeNumber;
} }
@ -186,6 +221,13 @@ public class UINumberField extends UITextField {
super.insertString(offset, s, a); super.insertString(offset, s, a);
} }
public void remove(int offs, int len) throws BadLocationException {
if (isInputMethodOnceInserting) {
return;
}
super.remove(offs, len);
}
// kunsnat: 这种限制输入 有个不好的地方, 比如删除时: 10.1 最大值限定100, 那么就删除中间的小数点之后变为101, 超出了100. // kunsnat: 这种限制输入 有个不好的地方, 比如删除时: 10.1 最大值限定100, 那么就删除中间的小数点之后变为101, 超出了100.
// 但是直接限制不能删除中间类似小数点, 那么也可能遇到: 最小值10 , 从100变化到其中的19, 就很难.. // 但是直接限制不能删除中间类似小数点, 那么也可能遇到: 最小值10 , 从100变化到其中的19, 就很难..
private boolean notChange(String strNew) { private boolean notChange(String strNew) {

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

@ -217,18 +217,36 @@ public class BorderPane extends AbstractBasicStylePane implements GlobalNameObse
int lineStyle = currentLineCombo.getSelectedLineStyle(); int lineStyle = currentLineCombo.getSelectedLineStyle();
Color lineColor = currentLineColorPane.getSelectObject(); Color lineColor = currentLineColorPane.getSelectObject();
CellBorderStyle cellBorderStyle = new CellBorderStyle(); CellBorderStyle cellBorderStyle = new CellBorderStyle();
cellBorderStyle.setTopColor(lineColor); if (topToggleButton.isSelected()) {
cellBorderStyle.setTopColor(lineColor);
}
cellBorderStyle.setTopStyle(topToggleButton.isSelected() ? lineStyle : Constants.LINE_NONE); cellBorderStyle.setTopStyle(topToggleButton.isSelected() ? lineStyle : Constants.LINE_NONE);
cellBorderStyle.setBottomColor(lineColor);
if (bottomToggleButton.isSelected()) {
cellBorderStyle.setBottomColor(lineColor);
}
cellBorderStyle.setBottomStyle(bottomToggleButton.isSelected() ? lineStyle : Constants.LINE_NONE); cellBorderStyle.setBottomStyle(bottomToggleButton.isSelected() ? lineStyle : Constants.LINE_NONE);
cellBorderStyle.setLeftColor(lineColor);
if (leftToggleButton.isSelected()) {
cellBorderStyle.setLeftColor(lineColor);
}
cellBorderStyle.setLeftStyle(leftToggleButton.isSelected() ? lineStyle : Constants.LINE_NONE); cellBorderStyle.setLeftStyle(leftToggleButton.isSelected() ? lineStyle : Constants.LINE_NONE);
cellBorderStyle.setRightColor(lineColor);
if (rightToggleButton.isSelected()) {
cellBorderStyle.setRightColor(lineColor);
}
cellBorderStyle.setRightStyle(rightToggleButton.isSelected() ? lineStyle : Constants.LINE_NONE); cellBorderStyle.setRightStyle(rightToggleButton.isSelected() ? lineStyle : Constants.LINE_NONE);
cellBorderStyle.setVerticalColor(lineColor);
if (verticalToggleButton.isSelected()) {
cellBorderStyle.setVerticalColor(lineColor);
}
cellBorderStyle.setVerticalStyle(verticalToggleButton.isSelected() ? lineStyle : Constants.LINE_NONE); cellBorderStyle.setVerticalStyle(verticalToggleButton.isSelected() ? lineStyle : Constants.LINE_NONE);
cellBorderStyle.setHorizontalColor(lineColor);
if (horizontalToggleButton.isSelected()) {
cellBorderStyle.setHorizontalColor(lineColor);
}
cellBorderStyle.setHorizontalStyle(horizontalToggleButton.isSelected() ? lineStyle : Constants.LINE_NONE); cellBorderStyle.setHorizontalStyle(horizontalToggleButton.isSelected() ? lineStyle : Constants.LINE_NONE);
if (leftToggleButton.isSelected() && bottomToggleButton.isSelected() && rightToggleButton.isSelected() && topToggleButton.isSelected()) { if (leftToggleButton.isSelected() && bottomToggleButton.isSelected() && rightToggleButton.isSelected() && topToggleButton.isSelected()) {
outerToggleButton.setSelected(true); outerToggleButton.setSelected(true);
} else { } else {

4
designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/SyntaxScheme.java

@ -624,6 +624,10 @@ public class SyntaxScheme implements Cloneable, TokenTypes {
SyntaxSchemeLoader parser = null; SyntaxSchemeLoader parser = null;
try { try {
XMLReader reader = XMLReaderFactory.createXMLReader(); XMLReader reader = XMLReaderFactory.createXMLReader();
reader.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
reader.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);
reader.setFeature("http://xml.org/sax/features/external-general-entities", false);
reader.setFeature("http://xml.org/sax/features/external-parameter-entities", false);
parser = new SyntaxSchemeLoader(baseFont); parser = new SyntaxSchemeLoader(baseFont);
parser.baseFont = baseFont; parser.baseFont = baseFont;
reader.setContentHandler(parser); reader.setContentHandler(parser);

9
designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/Theme.java

@ -22,6 +22,7 @@ import java.lang.reflect.Field;
import javax.swing.UIManager; import javax.swing.UIManager;
import javax.swing.plaf.ColorUIResource; import javax.swing.plaf.ColorUIResource;
import javax.swing.text.StyleContext; import javax.swing.text.StyleContext;
import javax.xml.XMLConstants;
import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParser;
@ -493,6 +494,8 @@ public class Theme {
StreamResult result = new StreamResult(new PrintWriter( StreamResult result = new StreamResult(new PrintWriter(
new UnicodeWriter(bout, "UTF-8"))); new UnicodeWriter(bout, "UTF-8")));
TransformerFactory transFac = TransformerFactory.newInstance(); TransformerFactory transFac = TransformerFactory.newInstance();
transFac.setAttribute(XMLConstants.ACCESS_EXTERNAL_DTD, "");
transFac.setAttribute(XMLConstants.ACCESS_EXTERNAL_STYLESHEET, "");
Transformer transformer = transFac.newTransformer(); Transformer transformer = transFac.newTransformer();
transformer.setOutputProperty(OutputKeys.INDENT, "yes"); transformer.setOutputProperty(OutputKeys.INDENT, "yes");
transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "4"); transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "4");
@ -580,8 +583,12 @@ public class Theme {
public static void load(Theme theme, InputStream in) throws IOException { public static void load(Theme theme, InputStream in) throws IOException {
SAXParserFactory spf = SAXParserFactory.newInstance(); SAXParserFactory spf = SAXParserFactory.newInstance();
spf.setValidating(true);
try { try {
spf.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
spf.setFeature("http://xml.org/sax/features/external-general-entities", false);
spf.setFeature("http://xml.org/sax/features/external-parameter-entities", false);
spf.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);
spf.setValidating(true);
SAXParser parser = spf.newSAXParser(); SAXParser parser = spf.newSAXParser();
XMLReader reader = parser.getXMLReader(); XMLReader reader = parser.getXMLReader();
XmlHandler handler = new XmlHandler(); XmlHandler handler = new XmlHandler();

8
designer-base/src/main/java/com/fr/design/gui/syntax/ui/rtextarea/Macro.java

@ -14,6 +14,7 @@ import java.io.FileNotFoundException;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import javax.xml.XMLConstants;
import javax.xml.parsers.*; import javax.xml.parsers.*;
import javax.xml.transform.*; import javax.xml.transform.*;
import javax.xml.transform.dom.*; import javax.xml.transform.dom.*;
@ -94,6 +95,11 @@ public class Macro {
DocumentBuilder db = null; DocumentBuilder db = null;
Document doc = null; Document doc = null;
try { try {
dbf.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
dbf.setFeature("http://xml.org/sax/features/external-general-entities", false);
dbf.setFeature("http://xml.org/sax/features/external-parameter-entities", false);
dbf.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);
dbf.setXIncludeAware(false);
db = dbf.newDocumentBuilder(); db = dbf.newDocumentBuilder();
//InputSource is = new InputSource(new FileReader(file)); //InputSource is = new InputSource(new FileReader(file));
InputSource is = new InputSource(new UnicodeReader( InputSource is = new InputSource(new UnicodeReader(
@ -374,6 +380,8 @@ public class Macro {
StreamResult result = new StreamResult(new File(fileName)); StreamResult result = new StreamResult(new File(fileName));
DOMSource source = new DOMSource(doc); DOMSource source = new DOMSource(doc);
TransformerFactory transFac = TransformerFactory.newInstance(); TransformerFactory transFac = TransformerFactory.newInstance();
transFac.setAttribute(XMLConstants.ACCESS_EXTERNAL_DTD, "");
transFac.setAttribute(XMLConstants.ACCESS_EXTERNAL_STYLESHEET, "");
Transformer transformer = transFac.newTransformer(); Transformer transformer = transFac.newTransformer();
transformer.setOutputProperty(OutputKeys.INDENT, "yes"); transformer.setOutputProperty(OutputKeys.INDENT, "yes");
transformer.setOutputProperty(OutputKeys.ENCODING, FILE_ENCODING); transformer.setOutputProperty(OutputKeys.ENCODING, FILE_ENCODING);

57
designer-base/src/main/java/com/fr/design/i18n/DesignSizeI18nManager.java

@ -0,0 +1,57 @@
package com.fr.design.i18n;
import com.fr.design.dialog.BasicDialog;
import com.fr.general.GeneralContext;
import com.fr.locale.LocaleManager;
import com.fr.locale.impl.FineLocaleManager;
import java.awt.Dimension;
import java.util.Map;
/**
* Created by kerry on 2/23/21
*/
public class DesignSizeI18nManager {
private static final String I18N_DIMENSION_PATH = "com/fr/design/i18n/dimension";
private static final String DIMENSION_REGEX = "^[1-9]\\d*\\*[1-9]\\d*$";
private static final String SEPARATOR_REGEX = "\\*";
private static final int WIDTH_INDEX = 0;
private static final int HEIGHT_INDEX = 1;
private static final int SPLIT_LENGTH = 2;
private static DesignSizeI18nManager instance = new DesignSizeI18nManager();
public static DesignSizeI18nManager getInstance() {
return instance;
}
private LocaleManager localeManager = FineLocaleManager.create();
private DesignSizeI18nManager() {
localeManager.addResource(I18N_DIMENSION_PATH);
}
public Dimension i18nDimension(String key) {
if (!containKey(key)) {
return BasicDialog.DEFAULT;
}
String dimension = localeManager.getLocalBundle(GeneralContext.getLocale()).getText(localeManager, key);
return parseDimensionFromText(dimension);
}
private boolean containKey(String key) {
Map<String, String> localeKV = localeManager.getLocalBundle(GeneralContext.getLocale()).getKV(localeManager);
return localeKV != null && localeKV.containsKey(key);
}
private Dimension parseDimensionFromText(String dimensionText) {
if (!dimensionText.matches(DIMENSION_REGEX)) {
return BasicDialog.DEFAULT;
}
String[] arr = dimensionText.split(SEPARATOR_REGEX);
if (arr.length < SPLIT_LENGTH) {
return BasicDialog.DEFAULT;
}
return new Dimension(Integer.parseInt(arr[WIDTH_INDEX]), Integer.parseInt(arr[HEIGHT_INDEX]));
}
}

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

@ -977,6 +977,10 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
* @param jt 添加的模板. * @param jt 添加的模板.
*/ */
public void addAndActivateJTemplate(JTemplate<?, ?> jt) { public void addAndActivateJTemplate(JTemplate<?, ?> jt) {
JTemplate currentEditingTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
if (currentEditingTemplate != null) {
currentEditingTemplate.stopEditing();
}
//切换文件后清空FixedPopupPane面板 //切换文件后清空FixedPopupPane面板
EastRegionContainerPane.getInstance().clearCurrentPopupPane(); EastRegionContainerPane.getInstance().clearCurrentPopupPane();
//释放模板对象 //释放模板对象

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

@ -598,8 +598,9 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
}); });
// 重名提示 // 重名提示
warnLabel = new UILabel(); warnLabel = new UILabel();
warnLabel.setPreferredSize(new Dimension(300, 30)); warnLabel.setPreferredSize(new Dimension(300, 50));
warnLabel.setHorizontalAlignment(SwingConstants.LEFT); warnLabel.setHorizontalAlignment(SwingConstants.LEFT);
warnLabel.setVerticalAlignment(SwingConstants.TOP);
warnLabel.setForeground(Color.RED); warnLabel.setForeground(Color.RED);
warnLabel.setVisible(false); warnLabel.setVisible(false);
@ -609,7 +610,6 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
// 确认按钮 // 确认按钮
confirmButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Confirm")); confirmButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Confirm"));
confirmButton.setPreferredSize(new Dimension(60, 25));
confirmButton.addActionListener(new ActionListener() { confirmButton.addActionListener(new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
@ -619,7 +619,6 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
// 取消按钮 // 取消按钮
UIButton cancelButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Cancel")); UIButton cancelButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Cancel"));
cancelButton.setPreferredSize(new Dimension(60, 25));
cancelButton.addActionListener(new ActionListener() { cancelButton.addActionListener(new ActionListener() {
@ -629,25 +628,26 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
} }
}); });
JPanel bottomPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
bottomPanel.setBorder(BorderFactory.createEmptyBorder(0, 15, 0, 15)); JPanel buttonsPane = new JPanel(new FlowLayout(FlowLayout.RIGHT, 10, 0));
bottomPanel.add(confirmButton); buttonsPane.setBorder(BorderFactory.createEmptyBorder(10, 15, 10, 10));
bottomPanel.add(cancelButton); buttonsPane.add(confirmButton);
buttonsPane.add(cancelButton);
this.add( this.add(
TableLayoutHelper.createTableLayoutPane( TableLayoutHelper.createTableLayoutPane(
new Component[][]{ new Component[][]{
new Component[]{topPanel}, new Component[]{topPanel},
new Component[]{midPanel}, new Component[]{midPanel},
new Component[]{bottomPanel} new Component[]{buttonsPane}
}, },
new double[]{TableLayout.FILL, TableLayout.FILL, TableLayout.FILL}, new double[]{TableLayout.FILL, TableLayout.PREFERRED, TableLayout.PREFERRED},
new double[]{TableLayout.FILL} new double[]{TableLayout.FILL}
), ),
BorderLayout.CENTER); BorderLayout.CENTER);
this.setSize(340, 180); this.setSize(340, 200);
this.setTitle(Toolkit.i18nText("Fine-Design_Basic_Rename")); this.setTitle(Toolkit.i18nText("Fine-Design_Basic_Rename"));
this.setResizable(false); this.setResizable(false);
this.setAlwaysOnTop(true); this.setAlwaysOnTop(true);
@ -760,7 +760,6 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
); );
newNameLabel.setHorizontalAlignment(SwingConstants.RIGHT); newNameLabel.setHorizontalAlignment(SwingConstants.RIGHT);
newNameLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 10)); newNameLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 10));
newNameLabel.setPreferredSize(new Dimension(118, 15));
// 文件名输入框 // 文件名输入框
nameField = new UITextField(); nameField = new UITextField();
@ -804,8 +803,9 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
}); });
// 重名提示 // 重名提示
warnLabel = new UILabel(); warnLabel = new UILabel();
warnLabel.setPreferredSize(new Dimension(300, 30)); warnLabel.setPreferredSize(new Dimension(300, 50));
warnLabel.setHorizontalAlignment(SwingConstants.LEFT); warnLabel.setHorizontalAlignment(SwingConstants.LEFT);
warnLabel.setVerticalAlignment(SwingConstants.TOP);
warnLabel.setForeground(Color.RED); warnLabel.setForeground(Color.RED);
warnLabel.setVisible(false); warnLabel.setVisible(false);
@ -836,8 +836,8 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
} }
}); });
JPanel bottomPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT)); JPanel bottomPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT, 10, 0));
bottomPanel.setBorder(BorderFactory.createEmptyBorder(0, 15, 0, 15)); bottomPanel.setBorder(BorderFactory.createEmptyBorder(10, 15, 10, 10));
bottomPanel.add(confirmButton); bottomPanel.add(confirmButton);
bottomPanel.add(cancelButton); bottomPanel.add(cancelButton);
@ -848,13 +848,13 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
new Component[]{midPanel}, new Component[]{midPanel},
new Component[]{bottomPanel} new Component[]{bottomPanel}
}, },
new double[]{TableLayout.FILL, TableLayout.FILL, TableLayout.FILL}, new double[]{TableLayout.FILL, TableLayout.PREFERRED, TableLayout.PREFERRED},
new double[]{TableLayout.FILL} new double[]{TableLayout.FILL}
), ),
BorderLayout.CENTER); BorderLayout.CENTER);
this.setSize(380, 180); this.setSize(380, 200);
this.setTitle(Toolkit.i18nText("Fine-Design_Basic_Mkdir")); this.setTitle(Toolkit.i18nText("Fine-Design_Basic_Mkdir"));
this.setResizable(false); this.setResizable(false);
this.setAlwaysOnTop(true); this.setAlwaysOnTop(true);

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

@ -9,17 +9,7 @@ import com.fr.design.DesignState;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.ExtraDesignClassManager; import com.fr.design.ExtraDesignClassManager;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.design.actions.community.BBSAction; import com.fr.design.actions.community.*;
import com.fr.design.actions.community.BugAction;
import com.fr.design.actions.community.BugNeedAction;
import com.fr.design.actions.community.CenterAction;
import com.fr.design.actions.community.FacebookFansAction;
import com.fr.design.actions.community.NeedAction;
import com.fr.design.actions.community.QuestionAction;
import com.fr.design.actions.community.SignAction;
import com.fr.design.actions.community.TechSolutionAction;
import com.fr.design.actions.community.TechSupportAction;
import com.fr.design.actions.community.VideoAction;
import com.fr.design.actions.file.CloseCurrentTemplateAction; import com.fr.design.actions.file.CloseCurrentTemplateAction;
import com.fr.design.actions.file.ExitDesignerAction; import com.fr.design.actions.file.ExitDesignerAction;
import com.fr.design.actions.file.OpenRecentReportMenuDef; import com.fr.design.actions.file.OpenRecentReportMenuDef;
@ -41,6 +31,7 @@ import com.fr.design.actions.server.PluginManagerAction;
import com.fr.design.file.NewTemplatePane; import com.fr.design.file.NewTemplatePane;
import com.fr.design.fun.MenuHandler; import com.fr.design.fun.MenuHandler;
import com.fr.design.fun.OemProcessor; import com.fr.design.fun.OemProcessor;
import com.fr.design.fun.PluginManagerProvider;
import com.fr.design.fun.TableDataPaneProcessor; import com.fr.design.fun.TableDataPaneProcessor;
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;
@ -72,6 +63,7 @@ import com.fr.plugin.observer.PluginEventListener;
import com.fr.plugin.observer.PluginEventType; import com.fr.plugin.observer.PluginEventType;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.stable.bridge.ObjectHolder;
import com.fr.stable.os.support.OSBasedAction; import com.fr.stable.os.support.OSBasedAction;
import com.fr.stable.os.support.OSSupportCenter; import com.fr.stable.os.support.OSSupportCenter;
import com.fr.start.OemHandler; import com.fr.start.OemHandler;
@ -487,11 +479,7 @@ public abstract class ToolBarMenuDock {
} }
if (!DesignerMode.isAuthorityEditing()) { if (!DesignerMode.isAuthorityEditing()) {
if (shouldShowPlugin()) { addPluginManagerAction(menuDef);
menuDef.addShortCut(
new PluginManagerAction()
);
}
menuDef.addShortCut( menuDef.addShortCut(
new FunctionManagerAction(), new FunctionManagerAction(),
new GlobalParameterAction() new GlobalParameterAction()
@ -502,6 +490,23 @@ public abstract class ToolBarMenuDock {
return menuDef; return menuDef;
} }
private void addPluginManagerAction(MenuDef menuDef) {
Set<PluginManagerProvider> providers = ExtraDesignClassManager.getInstance().getArray(PluginManagerProvider.MARK_STRING);
if (providers != null) {
for (PluginManagerProvider provider : providers) {
if (provider.selector().accept(new ObjectHolder())) {
menuDef.addShortCut(provider.pluginManagerAction());
return;
}
}
}
if (shouldShowPlugin()) {
menuDef.addShortCut(
new PluginManagerAction()
);
}
}
private ShortCut createGlobalTDAction() { private ShortCut createGlobalTDAction() {
TableDataPaneProcessor processor = ExtraDesignClassManager.getInstance().getSingle(TableDataPaneProcessor.XML_TAG); TableDataPaneProcessor processor = ExtraDesignClassManager.getInstance().getSingle(TableDataPaneProcessor.XML_TAG);
return processor == null ? new GlobalTableDataAction() : processor.createServerTDAction(); return processor == null ? new GlobalTableDataAction() : processor.createServerTDAction();
@ -610,7 +615,7 @@ public abstract class ToolBarMenuDock {
}, SupportLocaleImpl.TECH_SUPPORT_COMMUNITY); }, SupportLocaleImpl.TECH_SUPPORT_COMMUNITY);
shortCuts.add(SeparatorDef.DEFAULT); shortCuts.add(SeparatorDef.DEFAULT);
shortCuts.add(new WorkOrderCenterAction());
shortCuts.add(new CenterAction()); shortCuts.add(new CenterAction());
shortCuts.add(new SignAction()); shortCuts.add(new SignAction());
LocaleCenter.buildAction(new LocaleAction() { LocaleCenter.buildAction(new LocaleAction() {

4
designer-base/src/main/java/com/fr/design/os/impl/PMDialogAction.java

@ -19,11 +19,11 @@ public class PMDialogAction implements OSBasedAction {
private static String PLUGIN_MANAGER_ROUTE = "#management/plugin"; private static String PLUGIN_MANAGER_ROUTE = "#management/plugin";
@Override @Override
public void execute(Object... objects) { public void execute(Object... objects) {
if(Arch.getArch() == Arch.ARM || OperatingSystem.isLinux()){ if(Arch.getArch() == Arch.ARM || OperatingSystem.isLinux() || SupportOSImpl.MACOS_WEB_PLUGIN_MANAGEMENT.support()){
DesignUtils.visitEnvServerByParameters( PLUGIN_MANAGER_ROUTE,null,null); DesignUtils.visitEnvServerByParameters( PLUGIN_MANAGER_ROUTE,null,null);
return; return;
} }
if (ServerPreferenceConfig.getInstance().isUseOptimizedUPM() && JdkVersion.LE_8.support()) { if (ServerPreferenceConfig.getInstance().isUseOptimizedUPM() || SupportOSImpl.MACOS_NEW_PLUGIN_MANAGEMENT.support()) {
UpmFinder.showUPMDialog(); UpmFinder.showUPMDialog();
} else { } else {
WebViewDlgHelper.createPluginDialog(); WebViewDlgHelper.createPluginDialog();

28
designer-base/src/main/java/com/fr/design/os/impl/SupportOSImpl.java

@ -1,6 +1,7 @@
package com.fr.design.os.impl; package com.fr.design.os.impl;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.design.jdk.JdkVersion;
import com.fr.general.CloudCenter; import com.fr.general.CloudCenter;
import com.fr.general.GeneralContext; import com.fr.general.GeneralContext;
import com.fr.json.JSON; import com.fr.json.JSON;
@ -124,6 +125,33 @@ public enum SupportOSImpl implements SupportOS {
public boolean support() { public boolean support() {
return OperatingSystem.isWindows(); return OperatingSystem.isWindows();
} }
},
MACOS_NEW_PLUGIN_MANAGEMENT {
@Override
public boolean support() {
return JdkVersion.GE_9.support() && OperatingSystem.isMacos() && getMacOsVersion() < BIG_SUR_VERSION_NUMBER;
}
},
MACOS_WEB_PLUGIN_MANAGEMENT {
@Override
public boolean support() {
return JdkVersion.GE_9.support() && OperatingSystem.isMacos() && getMacOsVersion() >= BIG_SUR_VERSION_NUMBER;
}
};
private static final int BIG_SUR_VERSION_NUMBER = 16;
protected int getMacOsVersion() {
String version = System.getProperty("os.version");
String[] versionSlice = version.split("\\.");
try {
return Integer.parseInt(versionSlice[1]);
} catch (Exception ignored) {
return 0;
}
} }
} }

21
designer-base/src/main/java/com/fr/design/plugin/DesignerPluginContext.java

@ -0,0 +1,21 @@
package com.fr.design.plugin;
import com.fr.design.dialog.UIDialog;
/**
* @author hades
* @version 10.0
* Created by hades on 2021/3/8
*/
public class DesignerPluginContext {
private static UIDialog DIALOG;
public static UIDialog getPluginDialog() {
return DIALOG;
}
public static void setPluginDialog(UIDialog pluginDialog) {
DesignerPluginContext.DIALOG = pluginDialog;
}
}

14
designer-base/src/main/java/com/fr/design/ui/Assistant.java

@ -3,6 +3,7 @@ package com.fr.design.ui;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.teamdev.jxbrowser.chromium.Browser; import com.teamdev.jxbrowser.chromium.Browser;
import com.teamdev.jxbrowser.chromium.BrowserContext; import com.teamdev.jxbrowser.chromium.BrowserContext;
import com.teamdev.jxbrowser.chromium.BrowserPreferences;
import com.teamdev.jxbrowser.chromium.ProtocolService; import com.teamdev.jxbrowser.chromium.ProtocolService;
import com.teamdev.jxbrowser.chromium.URLResponse; import com.teamdev.jxbrowser.chromium.URLResponse;
@ -12,6 +13,8 @@ import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.nio.file.Files; import java.nio.file.Files;
import java.nio.file.Path; import java.nio.file.Path;
import java.util.Collections;
import java.util.List;
/** /**
* @author richie * @author richie
@ -20,6 +23,14 @@ import java.nio.file.Path;
*/ */
public class Assistant { public class Assistant {
public static void addChromiumSwitches(String... switches) {
List<String> list = BrowserPreferences.getChromiumSwitches();
Collections.addAll(list, switches);
BrowserPreferences.setChromiumSwitches((list.toArray(new String[0])));
}
public static URLResponse inputStream2Response(InputStream inputStream, String filePath) throws Exception { public static URLResponse inputStream2Response(InputStream inputStream, String filePath) throws Exception {
URLResponse response = new URLResponse(); URLResponse response = new URLResponse();
DataInputStream stream = new DataInputStream(inputStream); DataInputStream stream = new DataInputStream(inputStream);
@ -48,7 +59,8 @@ public class Assistant {
if (path.endsWith(".svg")) { if (path.endsWith(".svg")) {
return "image/svg+xml"; return "image/svg+xml";
} }
if (path.endsWith(".png")) { // upm 文件夹中的图片如果返回 Content-type 为 image/png 时会显示异常
if (path.endsWith(".png") && !path.contains("/upm")) {
return "image/png"; return "image/png";
} }
if (path.endsWith(".woff")) { if (path.endsWith(".woff")) {

14
designer-base/src/main/java/com/fr/design/ui/ModernUIPane.java

@ -8,18 +8,18 @@ import com.fr.design.i18n.Toolkit;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.web.struct.AssembleComponent; import com.fr.web.struct.AssembleComponent;
import com.teamdev.jxbrowser.chromium.Browser; import com.teamdev.jxbrowser.chromium.Browser;
import com.teamdev.jxbrowser.chromium.BrowserPreferences;
import com.teamdev.jxbrowser.chromium.JSValue; import com.teamdev.jxbrowser.chromium.JSValue;
import com.teamdev.jxbrowser.chromium.events.FinishLoadingEvent;
import com.teamdev.jxbrowser.chromium.events.LoadAdapter;
import com.teamdev.jxbrowser.chromium.events.LoadListener; import com.teamdev.jxbrowser.chromium.events.LoadListener;
import com.teamdev.jxbrowser.chromium.events.ScriptContextAdapter; import com.teamdev.jxbrowser.chromium.events.ScriptContextAdapter;
import com.teamdev.jxbrowser.chromium.events.ScriptContextEvent; import com.teamdev.jxbrowser.chromium.events.ScriptContextEvent;
import com.teamdev.jxbrowser.chromium.events.ScriptContextListener; import com.teamdev.jxbrowser.chromium.events.ScriptContextListener;
import com.teamdev.jxbrowser.chromium.swing.BrowserView; import com.teamdev.jxbrowser.chromium.swing.BrowserView;
import javax.swing.*; import javax.swing.JDialog;
import java.awt.*; import javax.swing.SwingUtilities;
import javax.swing.WindowConstants;
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;
import java.util.Map; import java.util.Map;
@ -44,7 +44,7 @@ public class ModernUIPane<T> extends BasicPane {
private void initialize() { private void initialize() {
if (browser == null) { if (browser == null) {
setLayout(new BorderLayout()); setLayout(new BorderLayout());
BrowserPreferences.setChromiumSwitches("--disable-google-traffic"); Assistant.addChromiumSwitches("--disable-google-traffic");
if (DesignerEnvManager.getEnvManager().isOpenDebug()) { if (DesignerEnvManager.getEnvManager().isOpenDebug()) {
UIToolbar toolbar = new UIToolbar(); UIToolbar toolbar = new UIToolbar();
add(toolbar, BorderLayout.NORTH); add(toolbar, BorderLayout.NORTH);
@ -75,7 +75,7 @@ public class ModernUIPane<T> extends BasicPane {
SwingUtilities.getWindowAncestor(ModernUIPane.this).setVisible(false); SwingUtilities.getWindowAncestor(ModernUIPane.this).setVisible(false);
} }
}); });
BrowserPreferences.setChromiumSwitches("--remote-debugging-port=9222"); Assistant.addChromiumSwitches("--remote-debugging-port=9222");
initializeBrowser(); initializeBrowser();
add(new BrowserView(browser), BorderLayout.CENTER); add(new BrowserView(browser), BorderLayout.CENTER);
} else { } else {

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

@ -6,6 +6,7 @@ import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.dialog.UIDialog; import com.fr.design.dialog.UIDialog;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.plugin.DesignerPluginContext;
import com.fr.design.update.ui.dialog.UpdateMainDialog; import com.fr.design.update.ui.dialog.UpdateMainDialog;
import com.fr.event.Event; import com.fr.event.Event;
import com.fr.event.EventDispatcher; import com.fr.event.EventDispatcher;
@ -114,6 +115,7 @@ public class UpmFinder {
dialog.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); dialog.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
dialog.setVisible(false); dialog.setVisible(false);
dialog = null; dialog = null;
DesignerPluginContext.setPluginDialog(null);
} }
} }
} }

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

@ -2,6 +2,7 @@ package com.fr.design.upm;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.design.dialog.UIDialog; import com.fr.design.dialog.UIDialog;
import com.fr.design.plugin.DesignerPluginContext;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import javax.swing.*; import javax.swing.*;
@ -25,6 +26,7 @@ public class UpmShowDialog extends UIDialog {
setSize(DEFAULT_SHOP); setSize(DEFAULT_SHOP);
GUICoreUtils.centerWindow(this); GUICoreUtils.centerWindow(this);
setResizable(false); setResizable(false);
DesignerPluginContext.setPluginDialog(this);
} }
@Override @Override

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

@ -38,6 +38,7 @@ 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 java.awt.Container;
import javax.swing.AbstractButton; import javax.swing.AbstractButton;
import javax.swing.Action; import javax.swing.Action;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
@ -318,7 +319,14 @@ public final class GUICoreUtils {
public static void centerWindow(Window win) { public static void centerWindow(Window win) {
// Toolkit.getDefaultToolkit().getScreenSize()在有多个显示器也只能获取到主屏的大小 // Toolkit.getDefaultToolkit().getScreenSize()在有多个显示器也只能获取到主屏的大小
// getGraphicsConfiguration().getBounds()能获取多个屏时 设计器主体界面所在屏的大小和对应的坐标 // getGraphicsConfiguration().getBounds()能获取多个屏时 设计器主体界面所在屏的大小和对应的坐标
Rectangle rectangle = win.getGraphicsConfiguration().getBounds(); Rectangle rectangle;
Container parent = win.getParent();
boolean displayByDesignerFrame = (DesignerContext.getDesignerFrame() != null && parent == null) || (parent != null && !parent.isVisible() && DesignerContext.getDesignerFrame() != null);
if (displayByDesignerFrame) {
rectangle = DesignerContext.getDesignerFrame().getGraphicsConfiguration().getBounds();
} else {
rectangle = win.getGraphicsConfiguration().getBounds();
}
centerWindow(win, rectangle); centerWindow(win, rectangle);
} }

13
designer-base/src/main/java/com/fr/design/utils/gui/GUIPaintUtils.java

@ -1,16 +1,18 @@
package com.fr.design.utils.gui; package com.fr.design.utils.gui;
import com.fr.base.BaseUtils;
import com.fr.base.vcs.DesignerMode; import com.fr.base.vcs.DesignerMode;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import com.fr.stable.os.OperatingSystem;
import java.awt.*; import java.awt.*;
import java.awt.geom.GeneralPath; import java.awt.geom.GeneralPath;
import java.awt.geom.RoundRectangle2D; import java.awt.geom.RoundRectangle2D;
public class GUIPaintUtils { public class GUIPaintUtils {
private static boolean macos = OperatingSystem.isMacos();
public static final void drawBorder(Graphics2D g2d, int x, int y, int width, int height, boolean isRound, int rectDirection) { public static final void drawBorder(Graphics2D g2d, int x, int y, int width, int height, boolean isRound, int rectDirection) {
drawBorder(g2d, x, y, width, height, isRound, rectDirection, false); drawBorder(g2d, x, y, width, height, isRound, rectDirection, false);
} }
@ -40,7 +42,14 @@ public class GUIPaintUtils {
g2d.drawLine(x, y, x, height - 1); g2d.drawLine(x, y, x, height - 1);
g2d.drawLine(x, height - 1, x + 3, height - 1); g2d.drawLine(x, height - 1, x + 3, height - 1);
} else { } else {
g2d.drawRoundRect(x, y, width - 1, height - 1, UIConstants.ARC, UIConstants.ARC); if (macos) {
g2d.drawRoundRect(x, y, width - 1, height - 1, UIConstants.ARC, UIConstants.ARC);
} else {
double offsetX = Math.min(GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration().getDefaultTransform().getScaleX() - 1, 0.5d);
double offsetY = Math.min(GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration().getDefaultTransform().getScaleY() - 1, 0.5d);
Shape shape = new RoundRectangle2D.Double(x + offsetX, y + offsetY, width - 1d, height - 1d, UIConstants.ARC, UIConstants.ARC);
g2d.draw(shape);
}
} }
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);
} else { } else {

29
designer-base/src/main/java/com/fr/env/PluginErrorRemindDialog.java vendored

@ -1,12 +1,16 @@
package com.fr.env; package com.fr.env;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.actions.UpdateAction;
import com.fr.design.actions.server.PluginManagerAction; import com.fr.design.actions.server.PluginManagerAction;
import com.fr.design.fun.PluginManagerProvider;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.FRFont; import com.fr.general.FRFont;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
import com.fr.stable.bridge.ObjectHolder;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.Icon; import javax.swing.Icon;
@ -23,6 +27,7 @@ import java.awt.Frame;
import java.awt.Insets; import java.awt.Insets;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.util.Set;
/** /**
* 插件启动失败提示窗 * 插件启动失败提示窗
@ -77,7 +82,7 @@ public class PluginErrorRemindDialog extends JDialog implements ActionListener {
UIButton okButton = new UIButton(Toolkit.i18nText("Fine-Design_Plugin_Error_Remind_Deal_With")); UIButton okButton = new UIButton(Toolkit.i18nText("Fine-Design_Plugin_Error_Remind_Deal_With"));
cancelButton.addActionListener(this); cancelButton.addActionListener(this);
okButton.addActionListener(new PluginManagerActionAdapter(this)); okButton.addActionListener(new PluginManagerHandleAction(this));
// 按钮 // 按钮
JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT)); JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
@ -102,18 +107,34 @@ public class PluginErrorRemindDialog extends JDialog implements ActionListener {
this.dispose(); this.dispose();
} }
private static class PluginManagerActionAdapter extends PluginManagerAction { private static class PluginManagerHandleAction extends UpdateAction {
private JDialog jDialog; private JDialog jDialog;
private UpdateAction pluginManagerAction;
public PluginManagerActionAdapter(JDialog jDialog) { public PluginManagerHandleAction(JDialog jDialog) {
this.jDialog = jDialog; this.jDialog = jDialog;
initPluginManagerAction();
}
private void initPluginManagerAction() {
Set<PluginManagerProvider> providers = ExtraDesignClassManager.getInstance().getArray(PluginManagerProvider.MARK_STRING);
if (providers != null) {
for (PluginManagerProvider provider : providers) {
if (provider.selector().accept(new ObjectHolder())) {
this.pluginManagerAction = provider.pluginManagerAction();
}
}
}
if (this.pluginManagerAction == null) {
this.pluginManagerAction = new PluginManagerAction();
}
} }
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
this.jDialog.dispose(); this.jDialog.dispose();
super.actionPerformed(e); this.pluginManagerAction.actionPerformed(e);
} }
} }

5
designer-base/src/main/java/com/fr/start/server/FineEmbedServerActivator.java

@ -12,6 +12,7 @@ import com.fr.third.springframework.web.context.support.AnnotationConfigWebAppli
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
import org.apache.catalina.Context; import org.apache.catalina.Context;
import org.apache.catalina.LifecycleException; import org.apache.catalina.LifecycleException;
import org.apache.catalina.Wrapper;
import org.apache.catalina.loader.WebappLoader; import org.apache.catalina.loader.WebappLoader;
import org.apache.catalina.startup.Tomcat; import org.apache.catalina.startup.Tomcat;
import org.apache.catalina.webresources.StandardRoot; import org.apache.catalina.webresources.StandardRoot;
@ -73,6 +74,10 @@ public class FineEmbedServerActivator extends Activator {
String contextPath = "/" + ProductConstants.getAppFolderName(); String contextPath = "/" + ProductConstants.getAppFolderName();
final Context context = tomcat.addContext(contextPath, docBase); final Context context = tomcat.addContext(contextPath, docBase);
context.setResources(new StandardRoot(context)); context.setResources(new StandardRoot(context));
Wrapper servlet = Tomcat.addServlet(context, "DruidStatView", "com.fr.third.alibaba.druid.support.http.StatViewServlet");
context.addServletMappingDecoded("/druid/*", "DruidStatView");
servlet.setLoadOnStartup(1);
servlet.setOverridable(true);
Tomcat.initWebappDefaults(context); Tomcat.initWebappDefaults(context);
//覆盖tomcat的WebAppClassLoader //覆盖tomcat的WebAppClassLoader
context.setLoader(new FRTomcatLoader()); context.setLoader(new FRTomcatLoader());

1
designer-base/src/main/resources/com/fr/design/i18n/dimension_en.properties

@ -0,0 +1 @@
com.fr.design.report.ReportColumnsPane=800*600

0
designer-base/src/main/resources/com/fr/design/i18n/dimension_ja_JP.properties

0
designer-base/src/main/resources/com/fr/design/i18n/dimension_ko_KR.properties

1
designer-base/src/main/resources/com/fr/design/i18n/dimension_zh.properties

@ -0,0 +1 @@
# \u9ED8\u8BA4\u4E3A\u7C7B\u7684\u5168\u9650\u5B9A\u540D\uFF08\u53EF\u81EA\u5B9A\u4E49key\uFF09= width * height

0
designer-base/src/main/resources/com/fr/design/i18n/dimension_zh_TW.properties

BIN
designer-base/src/main/resources/com/fr/design/images/bbs/workOrderCenter.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 207 B

7
designer-base/src/main/resources/com/fr/design/images/bbs/workOrderCenter_normal.svg

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="16px" height="16px" viewBox="0 0 16 16" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>icon/社区/工单中心_normal</title>
<g id="icon/社区/工单中心_normal" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<path d="M14,1 L14,10.999 L10,15 L2,15 L2,1 L14,1 Z M13.001,2 L3,2 L3,14 L9.0002,14 L9.0002,9.9998 L13.001,9.9998 L13.001,2 Z M12.5862,10.9998 L10.0002,10.9998 L10.0002,13.5858 L12.5862,10.9998 Z M7,10 L7,11 L5,11 L5,10 L7,10 Z M11,7 L11,8 L5,8 L5,7 L11,7 Z M11,4 L11,5 L5,5 L5,4 L11,4 Z" id="形状结合" fill="#333334"></path>
</g>
</svg>

After

Width:  |  Height:  |  Size: 696 B

8
designer-base/src/main/resources/com/fr/design/images/buttonicon/prewidget_normal.svg

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="30px" height="20px" viewBox="0 0 30 20" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>icon_控件管理 有小箭头_normal</title>
<g id="icon_控件管理-有小箭头_normal" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<path d="M16.0758389,11.7597783 L17.7397914,13.4242307 L14.4118864,16.7516357 L11.4999696,17.9996 L12.747934,15.0876832 L16.0758389,11.7597783 Z M17,3 C17.5522847,3 18,3.44771525 18,4 L18.0005048,10.107534 C17.6771796,10.0020594 17.3340722,9.9742129 17.0003341,10.0239839 L17,4 L5,4 L5,15 L11.697,15 L11.268,16 L5,16 C4.44771525,16 4,15.5522847 4,15 L4,4 C4,3.44771525 4.44771525,3 5,3 L17,3 Z M18,14.577 L18,15 C18,15.5522847 17.5522847,16 17,16 L16.576,16 L18,14.577 Z M18.1553795,11.3442402 C18.6148663,11.803727 18.6148663,12.5487057 18.1553795,13.0081926 L16.491427,11.3442402 C16.9509139,10.8852533 17.6958926,10.8852533 18.1553795,11.3442402 Z M15,10 L15,11.42 L13.42,13 L9,13 L9,10 L15,10 Z M8,10 L8,12 L6,12 L6,10 L8,10 Z M14,11 L10,11 L10,12 L14,12 L14,11 Z M15,6 L15,9 L9,9 L9,6 L15,6 Z M8,6 L8,8 L6,8 L6,6 L8,6 Z M14,7 L10,7 L10,8 L14,8 L14,7 Z" id="Combined-Shape" fill="#333334" fill-rule="nonzero"></path>
<path d="M23.3414214,10.3414214 L27,14 L27,14 L23.3414214,17.6585786 C23.2633165,17.7366835 23.1366835,17.7366835 23.0585786,17.6585786 C23.0210714,17.6210714 23,17.5702006 23,17.5171573 L23,10.4828427 C23,10.3723858 23.0895431,10.2828427 23.2,10.2828427 C23.2530433,10.2828427 23.3039141,10.3039141 23.3414214,10.3414214 Z" id="Rectangle-2" fill="#333334"></path>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.6 KiB

7
designer-base/src/main/resources/com/fr/design/images/buttonicon/refresh_normal.svg

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="16px" height="16px" viewBox="0 0 16 16" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>icon_刷新_normal</title>
<g id="icon_刷新_normal" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<path d="M13.0593807,1 C13.4802225,1 13.8213822,1.34115968 13.8213822,1.76200147 L13.8213822,1.76200147 L13.8213822,5.2534957 C13.8213822,5.67433749 13.4802225,6.01549717 13.0593807,6.01549717 L13.0593807,6.01549717 L9.56788646,6.01549717 C9.14704467,6.01549717 8.80588499,5.67433749 8.80588499,5.2534957 C8.80588499,4.83265391 9.14704467,4.49149423 9.56788646,4.49149423 L9.56788646,4.49149423 L11.169634,4.48959417 C10.8434607,4.27112237 10.4895308,4.09123525 10.1125367,3.95402064 C7.56533579,3.02691531 4.74885407,4.34026231 3.82174874,6.88746326 C2.89464341,9.43466421 4.20799041,12.2511459 6.75519136,13.1782513 C9.30239231,14.1053566 12.118874,12.7920096 13.0459794,10.2448086 C13.1899157,9.84934672 13.6271844,9.64544497 14.0226464,9.78938133 C14.4181083,9.9333177 14.62201,10.3705864 14.4780737,10.7660483 C13.2630956,14.1041731 9.57207646,15.8253236 6.23395166,14.6103456 C2.89582685,13.3953675 1.17467636,9.70434836 2.38965442,6.36622356 C3.60463249,3.02809876 7.29565164,1.30694826 10.6337764,2.52192632 C11.3047108,2.76612647 11.9217951,3.11486447 12.467588,3.55405023 L12.297,3.423 L12.2973792,1.76200147 C12.2973792,1.37622983 12.5840481,1.05741329 12.9559816,1.00695618 Z" id="Combined-Shape" fill="#333334" fill-rule="nonzero"></path>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.6 KiB

7
designer-base/src/main/resources/com/fr/design/images/buttonicon/widget/files_up_normal.svg

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="16px" height="16px" viewBox="0 0 16 16" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>icon_控件_文件控件_normal</title>
<g id="icon_控件_文件控件_normal" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<path d="M11,-1.28785871e-13 L15,4.001 L15,14 L4,14 L4,3 L2,3 L2,15 L11,15 L11,14 L12,14 L12,16 L1,16 L1,2 L4,2 L4,-1.35780276e-13 L11,-1.28785871e-13 Z M10.586,1 L5,1 L5,13 L14,13 L13.999,4.415 L11,4.415 L10.999,4.405 L11,4.415 L10.586,4.415 L10.586,1 Z M13,10 L13,11 L6,11 L6,10 L13,10 Z M13,8 L13,9 L6,9 L6,8 L13,8 Z M13,6 L13,7 L6,7 L6,6 L13,6 Z" id="形状结合" fill="#333334"></path>
</g>
</svg>

After

Width:  |  Height:  |  Size: 758 B

8
designer-base/src/main/resources/com/fr/design/images/control/edit_disabled.svg

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="16px" height="16px" viewBox="0 0 16 16" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>icon_编辑_disable</title>
<g id="icon_编辑_disable" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" opacity="0.299107143">
<path d="M9.95422984,2.34704298 L13.4897637,5.88257688 L6.18790578,13.1844348 L0.884604926,14.9522018 L2.65237188,9.64890094 L9.95422984,2.34704298 Z M13.4897637,1.6399362 L14.1968705,2.34704298 C14.9368113,3.08698374 14.9757555,4.2624679 14.3137033,5.04825533 L14.1968705,5.1754701 L10.6613366,1.6399362 C11.4423852,0.858887612 12.7087152,0.858887612 13.4897637,1.6399362 Z" id="形状结合" fill="#333334"></path>
<rect id="矩形" fill="#333334" x="7" y="14" width="7" height="1"></rect>
</g>
</svg>

After

Width:  |  Height:  |  Size: 864 B

8
designer-base/src/main/resources/com/fr/design/images/control/edit_normal.svg

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="16px" height="16px" viewBox="0 0 16 16" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>icon_编辑_normal</title>
<g id="icon_编辑_normal" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<path d="M9.95422984,2.34704298 L13.4897637,5.88257688 L6.18790578,13.1844348 L0.884604926,14.9522018 L2.65237188,9.64890094 L9.95422984,2.34704298 Z M13.4897637,1.6399362 L14.1968705,2.34704298 C14.9368113,3.08698374 14.9757555,4.2624679 14.3137033,5.04825533 L14.1968705,5.1754701 L10.6613366,1.6399362 C11.4423852,0.858887612 12.7087152,0.858887612 13.4897637,1.6399362 Z" id="形状结合" fill="#333334"></path>
<rect id="矩形" fill="#333334" x="7" y="14" width="7" height="1"></rect>
</g>
</svg>

After

Width:  |  Height:  |  Size: 840 B

11
designer-base/src/main/resources/com/fr/design/images/control/remove_disabled.svg

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="14px" height="14px" viewBox="0 0 14 14" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>icon_删除_normal</title>
<g id="Symbols" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" opacity="0.3">
<g id="工具栏/导入数据集" transform="translate(-78.000000, -7.000000)" fill="#333334">
<g id="icon_删除_normal" transform="translate(77.000000, 6.000000)">
<path d="M11,1 L11,3 L15,3 L15,4 L13,4 L13,15 L3,15 L3,4 L1,4 L1,3 L5,3 L5,1 L11,1 Z M12,4 L4,4 L4,14 L12,14 L12,4 Z M7,6 L7,12 L6,12 L6,6 L7,6 Z M10,6 L10,12 L9,12 L9,6 L10,6 Z M10,2 L6,2 L6,3 L10,3 L10,2 Z" id="Combined-Shape"></path>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 804 B

9
designer-base/src/main/resources/com/fr/design/images/control/remove_normal.svg

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="14px" height="14px" viewBox="0 0 14 14" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>icon_删除_normal备份</title>
<g id="Symbols" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="Combined-Shape" transform="translate(-1.000000, -1.000000)" fill="#333334">
<path d="M11,1 L11,3 L15,3 L15,4 L13,4 L13,15 L3,15 L3,4 L1,4 L1,3 L5,3 L5,1 L11,1 Z M12,4 L4,4 L4,14 L12,14 L12,4 Z M7,6 L7,12 L6,12 L6,6 L7,6 Z M10,6 L10,12 L9,12 L9,6 L10,6 Z M10,2 L6,2 L6,3 L10,3 L10,2 Z"></path>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 660 B

11
designer-base/src/main/resources/com/fr/design/images/m_file/preview_disabled.svg

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="12px" height="14px" viewBox="0 0 12 14" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>icon_报表web属性_打印预览_normal</title>
<g id="Symbols" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" opacity="0.3">
<g id="工具栏/导入数据集" transform="translate(-116.000000, -7.000000)" fill="#333334">
<g id="icon_报表web属性_打印预览_normal" transform="translate(114.000000, 6.000000)">
<path d="M9.5,7 C11.432875,7 13,8.567125 13,10.5 C13,11.1075915 12.845147,11.679042 12.5727578,12.1770349 C12.6203353,12.2075319 12.6650188,12.2450114 12.7069,12.287 L13.7129,13.293 C14.1039,13.684 14.1039,14.316 13.7129,14.707 C13.5179,14.902 13.2619,15 13.0059,15 C12.7499,15 12.4939,14.902 12.2989,14.707 L11.2929,13.701 C11.251507,13.6597129 11.2144961,13.6157024 11.1818672,13.5695439 C10.6844106,13.8436886 10.110446,14 9.5,14 C7.567125,14 6,12.432875 6,10.5 C6,8.567125 7.567125,7 9.5,7 Z M10,1 L14,5 L14,8 L13,8 L13,6 L9,6 L9,2 L3,2 L3,14 L7,14 L7,15 L2,15 L2,1 L10,1 Z M9.5,8 C10.8783333,8 12,9.12166667 12,10.5 C12,11.8783333 10.8783333,13 9.5,13 C8.12166667,13 7,11.8783333 7,10.5 C7,9.12166667 8.12166667,8 9.5,8 Z M12.587,5 L10,2.414 L10,5 L12.587,5 Z" id="Combined-Shape"></path>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.4 KiB

7
designer-base/src/main/resources/com/fr/design/images/m_file/preview_normal.svg

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="16px" height="16px" viewBox="0 0 16 16" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>icon_预览_normal</title>
<g id="icon_预览_normal" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<path d="M9.5,7 C11.432875,7 13,8.567125 13,10.5 C13,11.1075915 12.845147,11.679042 12.5727578,12.1770349 C12.6203353,12.2075319 12.6650188,12.2450114 12.7069,12.287 L13.7129,13.293 C14.1039,13.684 14.1039,14.316 13.7129,14.707 C13.5179,14.902 13.2619,15 13.0059,15 C12.7499,15 12.4939,14.902 12.2989,14.707 L11.2929,13.701 C11.251507,13.6597129 11.2144961,13.6157024 11.1818672,13.5695439 C10.6844106,13.8436886 10.110446,14 9.5,14 C7.567125,14 6,12.432875 6,10.5 C6,8.567125 7.567125,7 9.5,7 Z M10,1 L14,5 L14,8 L13,8 L13,6 L9,6 L9,2 L3,2 L3,14 L7,14 L7,15 L2,15 L2,1 L10,1 Z M9.5,8 C10.8783333,8 12,9.12166667 12,10.5 C12,11.8783333 10.8783333,13 9.5,13 C8.12166667,13 7,11.8783333 7,10.5 C7,9.12166667 8.12166667,8 9.5,8 Z M12.587,5 L10,2.414 L10,5 L12.587,5 Z" id="Combined-Shape" fill="#333334"></path>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

80
designer-base/src/test/java/com/fr/design/i18n/DesignSizeI18nManagerTest.java

@ -0,0 +1,80 @@
package com.fr.design.i18n;
import com.fr.general.GeneralContext;
import com.fr.invoke.Reflect;
import org.easymock.EasyMock;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.api.easymock.PowerMock;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import java.awt.Dimension;
import java.util.Locale;
/**
* Created by kerry on 2/24/21
*/
@RunWith(PowerMockRunner.class)
@PrepareForTest(GeneralContext.class)
public class DesignSizeI18nManagerTest {
@Test
public void testI18nDimension() {
Dimension dimension = DesignSizeI18nManager.getInstance().i18nDimension("com.fr.design.report.ReportColumnsPane");
validDimension(dimension, 660, 600);
PowerMock.mockStatic(GeneralContext.class);
EasyMock.expect(GeneralContext.getLocale()).andReturn(Locale.ENGLISH).times(3);
PowerMock.replayAll();
dimension = DesignSizeI18nManager.getInstance().i18nDimension("com.fr.design.report.ReportColumnsPane");
validDimension(dimension, 800, 600);
}
@Test
public void testContainKey() {
PowerMock.mockStatic(GeneralContext.class);
EasyMock.expect(GeneralContext.getLocale()).andReturn(Locale.ENGLISH).times(3);
PowerMock.replayAll();
boolean result = Reflect.on(DesignSizeI18nManager.getInstance()).call("containKey", "testKey").get();
Assert.assertFalse(result);
result = Reflect.on(DesignSizeI18nManager.getInstance()).call("containKey", "com.fr.design.report.ReportColumnsPane").get();
Assert.assertTrue(result);
}
@Test
public void testParseDimensionFromText() {
String dimensionText = "800*600";
Dimension result = Reflect.on(DesignSizeI18nManager.getInstance()).call("parseDimensionFromText", dimensionText).get();
validDimension(result, 800, 600);
dimensionText = "800* 600";
result = Reflect.on(DesignSizeI18nManager.getInstance()).call("parseDimensionFromText", dimensionText).get();
validDimension(result, 660, 600);
dimensionText = " 800*600";
result = Reflect.on(DesignSizeI18nManager.getInstance()).call("parseDimensionFromText", dimensionText).get();
validDimension(result, 660, 600);
dimensionText = "800*600s";
result = Reflect.on(DesignSizeI18nManager.getInstance()).call("parseDimensionFromText", dimensionText).get();
validDimension(result, 660, 600);
dimensionText = "800s*600";
result = Reflect.on(DesignSizeI18nManager.getInstance()).call("parseDimensionFromText", dimensionText).get();
validDimension(result, 660, 600);
dimensionText = "800-600";
result = Reflect.on(DesignSizeI18nManager.getInstance()).call("parseDimensionFromText", dimensionText).get();
validDimension(result, 660, 600);
}
private void validDimension(Dimension dimension, int width, int height) {
Assert.assertEquals(width, dimension.width);
Assert.assertEquals(height, dimension.height);
}
}

10
designer-base/src/test/java/com/fr/design/os/impl/SupportOSImplTest.java

@ -6,6 +6,7 @@ import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
import java.util.Locale; import java.util.Locale;
import org.powermock.reflect.Whitebox;
/** /**
* @author hades * @author hades
@ -21,4 +22,13 @@ public class SupportOSImplTest extends TestCase {
Assert.assertFalse(SupportOSImpl.AUTOPUSHUPDATE.support()); Assert.assertFalse(SupportOSImpl.AUTOPUSHUPDATE.support());
} }
@Test
public void testGetMacOsVersion() throws Exception {
String backUp = System.getProperty("os.version");
System.setProperty("os.version", "10.16");
int number = Whitebox.invokeMethod(SupportOSImpl.MACOS_WEB_PLUGIN_MANAGEMENT, "getMacOsVersion");
Assert.assertEquals(16, number);
System.setProperty("os.version", backUp);
}
} }

21
designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java

@ -47,6 +47,7 @@ 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;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.util.Arrays;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -384,7 +385,7 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
private void fireRichEditor() { private void fireRichEditor() {
AttrTooltipRichText richText = this.richTextTooltipContent.getRichTextAttr(); AttrTooltipRichText richText = this.richTextTooltipContent.getRichTextAttr();
refreshTableFieldParams(richText.getParams());
ModernUIPane<VanChartRichEditorModel> richEditorPane = VanChartRichEditorPane.createRichEditorPane(richText); ModernUIPane<VanChartRichEditorModel> richEditorPane = VanChartRichEditorPane.createRichEditorPane(richText);
VanChartRichTextPane richTextPane = this.createRichTextPane(richEditorPane); VanChartRichTextPane richTextPane = this.createRichTextPane(richEditorPane);
@ -456,15 +457,25 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
params.put(fieldNames[i], fieldFormats[i].getJs()); params.put(fieldNames[i], fieldFormats[i].getJs());
} }
refreshTableFieldParams(params);
richText.setParams(params);
}
private void refreshTableFieldParams(Map<String, String> params) {
List<String> tableFieldNames = VanChartRichEditorPane.getFieldNames(); List<String> tableFieldNames = VanChartRichEditorPane.getFieldNames();
List<String> defaultParams = Arrays.asList(getRichTextFieldNames());
if (tableFieldNames != null) { if (tableFieldNames == null || params == null) {
for (String fieldName : tableFieldNames) { return;
}
for (String fieldName : tableFieldNames) {
// 富文本默认参数和数据集字段重名时,显示默认参数
if (!defaultParams.contains(fieldName)) {
params.put(fieldName, "${" + fieldName + "_" + fieldName.hashCode() + "}"); params.put(fieldName, "${" + fieldName + "_" + fieldName.hashCode() + "}");
} }
} }
richText.setParams(params);
} }
private JPanel createHtmlPane() { private JPanel createHtmlPane() {

5
designer-chart/src/main/java/com/fr/van/chart/designer/component/marker/VanChartImageMarkerPane.java

@ -4,6 +4,7 @@ import com.fr.base.background.ImageFileBackground;
import com.fr.design.beans.BasicBeanPane; import com.fr.design.beans.BasicBeanPane;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UISpinner; import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.gui.ispinner.chart.UISpinnerWithPx;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.backgroundpane.ImageBackgroundQuickPane; import com.fr.design.mainframe.backgroundpane.ImageBackgroundQuickPane;
@ -30,8 +31,8 @@ public class VanChartImageMarkerPane extends BasicBeanPane<VanChartAttrMarker> {
public VanChartImageMarkerPane() { public VanChartImageMarkerPane() {
imageBackgroundPane = new ImageBackgroundQuickPane(false); imageBackgroundPane = new ImageBackgroundQuickPane(false);
imageBackgroundPane.setPreferredSize(getImageBackgroundPreferredSize(imageBackgroundPane.getPreferredSize())); imageBackgroundPane.setPreferredSize(getImageBackgroundPreferredSize(imageBackgroundPane.getPreferredSize()));
width = new UISpinner(0, 100, 0.5, 30); width = new UISpinnerWithPx(0, 100, 0.5, 30);
height = new UISpinner(0, 100, 0.5, 30); height = new UISpinnerWithPx(0, 100, 0.5, 30);
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double f = TableLayout.FILL; double f = TableLayout.FILL;

64
designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeLabelDetailPane.java

@ -10,7 +10,6 @@ import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane; import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane;
import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPaneWithAuto; import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPaneWithAuto;
import com.fr.general.ComparatorUtils;
import com.fr.plugin.chart.base.AttrLabelDetail; import com.fr.plugin.chart.base.AttrLabelDetail;
import com.fr.plugin.chart.gauge.VanChartGaugePlot; import com.fr.plugin.chart.gauge.VanChartGaugePlot;
import com.fr.plugin.chart.type.FontAutoType; import com.fr.plugin.chart.type.FontAutoType;
@ -50,7 +49,7 @@ public class VanChartGaugeLabelDetailPane extends VanChartPlotLabelDetailPane {
} }
public GaugeStyle getGaugeStyle() { public GaugeStyle getGaugeStyle() {
return ((VanChartGaugePlot)this.getPlot()).getGaugeStyle(); return ((VanChartGaugePlot) this.getPlot()).getGaugeStyle();
} }
public void setGaugeStyle(GaugeStyle gaugeStyle) { public void setGaugeStyle(GaugeStyle gaugeStyle) {
@ -127,15 +126,13 @@ public class VanChartGaugeLabelDetailPane extends VanChartPlotLabelDetailPane {
protected Component[][] getLabelPaneComponents(Plot plot, double p, double[] columnSize) { protected Component[][] getLabelPaneComponents(Plot plot, double p, double[] columnSize) {
if (hasLabelAlignPane()) { if (hasLabelAlignPane()) {
return new Component[][]{ return new Component[][]{
new Component[]{getDataLabelContentPane(), null}, new Component[]{getDataLabelContentPane(), null},
new Component[]{createLabelPositionPane(Toolkit.i18nText("Fine-Design_Chart_Layout_Vertical"), plot), null}, new Component[]{createLabelPositionPane(getVerticalTitle(), plot), null},
new Component[]{createLabelAlignPane(Toolkit.i18nText("Fine-Design_Chart_Layout_Horizontal")), null}, new Component[]{createLabelAlignPane(), null},
new Component[]{createLabelStylePane(getLabelStyleRowSize(p), columnSize, plot), null}, new Component[]{createLabelStylePane(getLabelStyleRowSize(p), columnSize, plot), null},
}; };
} else { } else {
return new Component[][]{ return new Component[][]{
new Component[]{getDataLabelContentPane(), null}, new Component[]{getDataLabelContentPane(), null},
new Component[]{createLabelStylePane(getLabelStyleRowSize(p), columnSize, plot), null}, new Component[]{createLabelStylePane(getLabelStyleRowSize(p), columnSize, plot), null},
@ -143,50 +140,37 @@ public class VanChartGaugeLabelDetailPane extends VanChartPlotLabelDetailPane {
} }
} }
private JPanel createLabelAlignPane(String title) { private JPanel createLabelAlignPane() {
JPanel panel = new JPanel(new BorderLayout()); alignPane = new JPanel(new BorderLayout());
checkAlignPane();
alignPane = new JPanel(); return alignPane;
checkAlignPane(title);
panel.add(alignPane, BorderLayout.CENTER);
return panel;
} }
protected void checkAlignPane(String title) { protected void checkAlignPane() {
if (alignPane == null && !hasLabelAlign(getPlot())) { if (!hasLabelAlignPane()) {
return; return;
} }
if (alignPane != null && !hasLabelAlign(getPlot())) { if (!hasLabelAlign()) {
oldAlignValues = null;
alignPane.removeAll(); alignPane.removeAll();
return; return;
} }
if (alignPane == null && hasLabelAlign(getPlot())) {
alignPane = new JPanel(); if (alignPane.getComponents().length > 0) {
return;
} }
TwoTuple<String[], Integer[]> result = getAlignNamesAndValues(); TwoTuple<String[], Integer[]> result = getAlignNamesAndValues();
String[] names = result.getFirst(); String[] names = result.getFirst();
Integer[] values = result.getSecond(); Integer[] values = result.getSecond();
if (ComparatorUtils.equals(values, oldAlignValues)) { align = new UIButtonGroup<>(names, values);
return;
}
oldAlignValues = values;
align = new UIButtonGroup<Integer>(names, values);
Component[][] comps = new Component[2][2]; Component[][] comps = new Component[2][2];
comps[0] = new Component[]{null, null}; comps[0] = new Component[]{null, null};
comps[1] = new Component[]{new UILabel(title, SwingConstants.LEFT), align}; comps[1] = new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Layout_Horizontal"), SwingConstants.LEFT), align};
double[] row = new double[]{TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED}; double[] row = new double[]{TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED};
double[] col = new double[]{TableLayout.FILL, TableLayout4VanChartHelper.EDIT_AREA_WIDTH}; double[] col = new double[]{TableLayout.FILL, TableLayout4VanChartHelper.EDIT_AREA_WIDTH};
alignPane.removeAll();
alignPane.setLayout(new BorderLayout());
alignPane.add(getLabelPositionPane(comps, row, col), BorderLayout.CENTER); alignPane.add(getLabelPositionPane(comps, row, col), BorderLayout.CENTER);
if (getParentPane() != null) { if (getParentPane() != null) {
@ -214,12 +198,16 @@ public class VanChartGaugeLabelDetailPane extends VanChartPlotLabelDetailPane {
} }
protected void checkPane() { protected void checkPane() {
String verticalTitle = hasLabelAlign(getPlot()) String verticalTitle = getVerticalTitle();
? Toolkit.i18nText("Fine-Design_Chart_Layout_Vertical")
: Toolkit.i18nText("Fine-Design_Chart_Layout_Position");
checkPositionPane(verticalTitle); checkPositionPane(verticalTitle);
checkAlignPane(Toolkit.i18nText("Fine-Design_Chart_Layout_Horizontal")); checkAlignPane();
}
private String getVerticalTitle() {
return hasLabelAlign()
? Toolkit.i18nText("Fine-Design_Chart_Layout_Vertical")
: Toolkit.i18nText("Fine-Design_Chart_Layout_Position");
} }
protected void checkStyleUse() { protected void checkStyleUse() {
@ -227,8 +215,8 @@ public class VanChartGaugeLabelDetailPane extends VanChartPlotLabelDetailPane {
textFontPane.setPreferredSize(new Dimension(0, TEXT_FONT_PANE_HEIGHT)); textFontPane.setPreferredSize(new Dimension(0, TEXT_FONT_PANE_HEIGHT));
} }
protected boolean hasLabelAlign(Plot plot) { protected boolean hasLabelAlign() {
return getGaugeStyle() == GaugeStyle.THERMOMETER && !((VanChartGaugePlot) plot).getGaugeDetailStyle().isHorizontalLayout(); return getGaugeStyle() == GaugeStyle.THERMOMETER && !((VanChartGaugePlot) getPlot()).getGaugeDetailStyle().isHorizontalLayout();
} }
protected boolean hasLabelAlignPane() { protected boolean hasLabelAlignPane() {
@ -240,7 +228,7 @@ public class VanChartGaugeLabelDetailPane extends VanChartPlotLabelDetailPane {
style.setSelectedIndex(1); style.setSelectedIndex(1);
textFontPane.populate(detail.getTextAttr()); textFontPane.populate(detail.getTextAttr());
if (hasLabelAlign(this.getPlot()) && align != null) { if (hasLabelAlign() && align != null) {
align.setSelectedItem(detail.getAlign()); align.setSelectedItem(detail.getAlign());
} }

5
designer-chart/src/main/java/com/fr/van/chart/map/designer/other/condition/item/VanChartCommonMarkerConditionPane.java

@ -2,7 +2,6 @@ package com.fr.van.chart.map.designer.other.condition.item;
import com.fr.chart.base.DataSeriesCondition; import com.fr.chart.base.DataSeriesCondition;
import com.fr.design.condition.ConditionAttributesPane; import com.fr.design.condition.ConditionAttributesPane;
import com.fr.plugin.chart.base.VanChartAttrMarker; import com.fr.plugin.chart.base.VanChartAttrMarker;
import com.fr.van.chart.designer.other.condition.item.AbstractNormalMultiLineConditionPane; import com.fr.van.chart.designer.other.condition.item.AbstractNormalMultiLineConditionPane;
import com.fr.van.chart.map.designer.style.series.VanChartMapScatterMarkerPane; import com.fr.van.chart.map.designer.style.series.VanChartMapScatterMarkerPane;
@ -30,6 +29,10 @@ public class VanChartCommonMarkerConditionPane extends AbstractNormalMultiLineCo
return commonMarkerPane; return commonMarkerPane;
} }
public void setDefault() {
this.populate(new VanChartAttrMarker());
}
/** /**
* 条目名称 * 条目名称
* *

9
designer-chart/src/main/java/com/fr/van/chart/map/designer/type/GisLayerPane.java

@ -221,12 +221,9 @@ public class GisLayerPane extends JPanel implements UIObserver {
/* mapPlot.getGisLayer().setGisLayerType(GISLayerType.AUTO); /* mapPlot.getGisLayer().setGisLayerType(GISLayerType.AUTO);
mapPlot.getGisLayer().setLayerName(GISLayerType.getLocString(GISLayerType.AUTO));*/ mapPlot.getGisLayer().setLayerName(GISLayerType.getLocString(GISLayerType.AUTO));*/
GaoDeGisType gaoDeGisType= mapPlot.getDefaultGisLayerType(); GisLayer defaultGisLayer = mapPlot.getDefaultGisLayer();
mapPlot.setGisLayer(defaultGisLayer);
mapPlot.getGisLayer().setGisLayerType(GISLayerType.GAO_DE_API); populate(defaultGisLayer);
mapPlot.getGisLayer().setLayerName(gaoDeGisType.getTypeName());
mapPlot.getGisLayer().setGaoDeGisType(gaoDeGisType);
populate(mapPlot.getGisLayer());
} }
public void populate(GisLayer layer) { public void populate(GisLayer layer) {

2
designer-chart/src/main/java/com/fr/van/chart/structure/desinger/style/StructureNodeStylePane.java

@ -52,7 +52,7 @@ public class StructureNodeStylePane extends BasicBeanPane<AttrNode> {
protected Component[][] getPaneComponents() { protected Component[][] getPaneComponents() {
return new Component[][]{ return new Component[][]{
new Component[]{null, null}, new Component[]{null, null},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Node_Radius")), typeComboBox}, new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Form_Widget_Style_Border_Color")), typeComboBox},
new Component[]{null, centerPane}, new Component[]{null, centerPane},
}; };
} }

28
designer-chart/src/main/resources/com/fr/design/editor/rich_editor.html

@ -47,8 +47,7 @@
var getInitContent = function (params, initParams, align) { var getInitContent = function (params, initParams, align) {
var editorService = BI.Services.getService("bi.service.design.chart.common.editor"); var editorService = BI.Services.getService("bi.service.design.chart.common.editor");
var paramGroup = params.split("|"); var paramGroup = params.split("|");
var content = "";
content = "";
for (var i = 0, len = paramGroup.length; i < len; i++) { for (var i = 0, len = paramGroup.length; i < len; i++) {
var [key, value] = paramGroup[i].split(":"); var [key, value] = paramGroup[i].split(":");
@ -58,9 +57,25 @@
} }
} }
if (BI.endWith(content, '<br></p>')) {
content = content.slice(0, -8) + '</p>';
}
return content; return content;
} }
var selectLast = function (instance) {
if (instance == null) {
return;
}
var target = instance.selElm()
if (target) {
instance.selected({target});
}
};
var dimensionIds = getDimensionIds(params); var dimensionIds = getDimensionIds(params);
if (initParams) { if (initParams) {
@ -83,7 +98,10 @@
toolbar: { toolbar: {
buttons: [ buttons: [
{type: "bi.rich_editor_font_chooser"}, {type: "bi.rich_editor_font_chooser"},
{type: "bi.rich_editor_size_chooser"}, {
type: "bi.rich_editor_size_chooser",
width: 70
},
{type: "bi.rich_editor_bold_button"}, {type: "bi.rich_editor_bold_button"},
{type: "bi.rich_editor_italic_button"}, {type: "bi.rich_editor_italic_button"},
{type: "bi.rich_editor_underline_button"}, {type: "bi.rich_editor_underline_button"},
@ -104,6 +122,8 @@
} }
}); });
selectLast(rich_editor.editor.instance);
Pool.refresh = function () { Pool.refresh = function () {
var content = Pool.data.getContent(); var content = Pool.data.getContent();
var isAuto = Pool.data.isAuto(); var isAuto = Pool.data.isAuto();
@ -124,6 +144,8 @@
}); });
rich_editor.setFocus(); rich_editor.setFocus();
selectLast(rich_editor.editor.instance);
}; };
Pool.addField = function () { Pool.addField = function () {

10
designer-chart/src/main/resources/com/fr/design/editor/script/editor.js

@ -50,12 +50,14 @@
}, },
items: [{ items: [{
type: "bi.htape", type: "bi.htape",
tgap: 5, tgap: 3,
items: [{ items: [{
type: "bi.label", type: "bi.label",
text: BI.i18nText("BI-Design_Font_Style") + ": ", text: BI.i18nText("BI-Design_Font_Style") + ": ",
textAlign: "left", textAlign: "left",
width: 70 width: 60,
tgap: 2,
lgap: 3
}, { }, {
type: "bi.button_group", type: "bi.button_group",
items: this.model.fontStyleItems, items: this.model.fontStyleItems,
@ -72,10 +74,10 @@
}], }],
layouts: [{ layouts: [{
type: "bi.left", type: "bi.left",
rgap: 5 rgap: 2
}], }],
value: this.model.mode, value: this.model.mode,
width: 125 width: 170
}, this._getToolBar()], }, this._getToolBar()],
height: 24 height: 24
}, { }, {

6
designer-chart/src/main/resources/com/fr/design/editor/script/editor.model.js

@ -18,8 +18,7 @@
return [{ return [{
type: "bi.single_select_radio_item", type: "bi.single_select_radio_item",
text: BI.i18nText("BI-Basic_Auto"), text: BI.i18nText("BI-Basic_Auto"),
hgap: 5, width: 70,
width: 50,
logic: { logic: {
dynamic: true dynamic: true
}, },
@ -28,8 +27,7 @@
}, { }, {
type: "bi.single_select_radio_item", type: "bi.single_select_radio_item",
text: BI.i18nText("BI-Basic_Custom"), text: BI.i18nText("BI-Basic_Custom"),
hgap: 5, width: 80,
width: 60,
logic: { logic: {
dynamic: true dynamic: true
}, },

BIN
designer-chart/src/main/resources/com/fr/design/images/form/toolbar/drillmap.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 344 B

After

Width:  |  Height:  |  Size: 810 B

BIN
designer-chart/src/main/resources/com/fr/design/images/form/toolbar/heatmap.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 750 B

After

Width:  |  Height:  |  Size: 905 B

BIN
designer-chart/src/main/resources/com/fr/design/images/form/toolbar/map.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 344 B

After

Width:  |  Height:  |  Size: 819 B

BIN
designer-chart/src/main/resources/com/fr/van/chart/drillmap/images/area-map.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

BIN
designer-chart/src/main/resources/com/fr/van/chart/drillmap/images/point-map.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

BIN
designer-chart/src/main/resources/com/fr/van/chart/heatmap/images/heatmap.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

BIN
designer-chart/src/main/resources/com/fr/van/chart/map/images/area-map.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

BIN
designer-chart/src/main/resources/com/fr/van/chart/map/images/custom-map.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

BIN
designer-chart/src/main/resources/com/fr/van/chart/map/images/line-map.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

BIN
designer-chart/src/main/resources/com/fr/van/chart/map/images/point-map.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

8
designer-form/src/main/java/com/fr/design/form/parameter/FormParaDesigner.java

@ -474,7 +474,7 @@ public class FormParaDesigner extends FormDesigner implements ParameterDesignerP
*/ */
@Override @Override
public void updateUI() { public void updateUI() {
setUI(new FormDesignerUI(){ setUI(new FormDesignerUI() {
@Override @Override
protected Rectangle getFitPaintBounds(Component component, Component parent) { protected Rectangle getFitPaintBounds(Component component, Component parent) {
return new Rectangle(0, 0, parent.getSize().width, parent.getSize().height); return new Rectangle(0, 0, parent.getSize().width, parent.getSize().height);
@ -694,8 +694,8 @@ public class FormParaDesigner extends FormDesigner implements ParameterDesignerP
formSubmitButton.setWidgetName("Search"); formSubmitButton.setWidgetName("Search");
formSubmitButton.setText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Query")); formSubmitButton.setText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Query"));
XCreator xCreator = XCreatorUtils.createXCreator(formSubmitButton); XCreator xCreator = XCreatorUtils.createXCreator(formSubmitButton);
if (!(this.autoAddComponent(xCreator, H_COMPONENT_GAP * 3 + H_GAP, FIRST_V_LOCATION if (this.autoAddComponent(xCreator, H_COMPONENT_GAP * 3 + H_GAP, FIRST_V_LOCATION
+ V_COMPONENT_GAP * (currentIndex / NUM_IN_A_LINE)))) { + V_COMPONENT_GAP * (currentIndex / NUM_IN_A_LINE))) {
currentIndex = ((int) Math.ceil((currentIndex + 1) / (double) NUM_IN_A_LINE)) * NUM_IN_A_LINE; currentIndex = ((int) Math.ceil((currentIndex + 1) / (double) NUM_IN_A_LINE)) * NUM_IN_A_LINE;
} }
} }
@ -741,7 +741,7 @@ public class FormParaDesigner extends FormDesigner implements ParameterDesignerP
} }
@Override @Override
public boolean checkIfBeyondValidArea(MouseEvent e){ public boolean checkIfBeyondValidArea(MouseEvent e) {
return false; return false;
} }

2
designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/AbstractFRLayoutDefinePane.java

@ -31,6 +31,8 @@ public abstract class AbstractFRLayoutDefinePane<T extends WSortLayout> extends
for (int i = 0, len = srcLayout.getListenerSize(); i < len; i++) { for (int i = 0, len = srcLayout.getListenerSize(); i < len; i++) {
destLayout.addListener(srcLayout.getListener(i)); destLayout.addListener(srcLayout.getListener(i));
} }
srcLayout.clearListeners();
srcLayout.clearMobileWidgetList();
} }
} }

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

@ -207,7 +207,7 @@ public class FRFitLayoutDefinePane extends AbstractFRLayoutDefinePane<WFitLayout
} }
xwAbsoluteBodyLayout.add(component); xwAbsoluteBodyLayout.add(component);
} }
copyLayoutAttr(wFitLayout, wAbsoluteBodyLayout); copyLayoutAttr(wFitLayout, xwAbsoluteBodyLayout.toData());
xWFitLayout.setBackupParent(xwAbsoluteBodyLayout); xWFitLayout.setBackupParent(xwAbsoluteBodyLayout);
FormDesigner formDesigner = WidgetPropertyPane.getInstance().getEditingFormDesigner(); FormDesigner formDesigner = WidgetPropertyPane.getInstance().getEditingFormDesigner();
formDesigner.getSelectionModel().setSelectedCreators( formDesigner.getSelectionModel().setSelectedCreators(

5
designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellStylePane.java

@ -3,6 +3,7 @@ package com.fr.design.mainframe.cell.settingpane;
import com.fr.base.Style; import com.fr.base.Style;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.mainframe.cell.settingpane.style.StylePane; import com.fr.design.mainframe.cell.settingpane.style.StylePane;
import com.fr.design.style.BorderUtils;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.report.cell.DefaultTemplateCellElement; import com.fr.report.cell.DefaultTemplateCellElement;
@ -67,6 +68,7 @@ public class CellStylePane extends AbstractCellAttrPane {
@Override @Override
public void updateBeans() { public void updateBeans() {
Object[] selectionCellBorderObjects = BorderUtils.createCellBorderObject(elementCasePane);
if (stylePane.getSelectedIndex() == 1) { if (stylePane.getSelectedIndex() == 1) {
Style s = stylePane.updateBean(); Style s = stylePane.updateBean();
TemplateElementCase elementCase = elementCasePane.getEditingElementCase(); TemplateElementCase elementCase = elementCasePane.getEditingElementCase();
@ -110,7 +112,8 @@ public class CellStylePane extends AbstractCellAttrPane {
} }
} }
} }
stylePane.updateBorder();// border必须特别处理 // border必须特别处理
stylePane.updateBorder(selectionCellBorderObjects);
} }
} }

4
designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/style/CustomStylePane.java

@ -136,8 +136,8 @@ public class CustomStylePane extends MultiTabPane<Style> {
/** /**
* *
*/ */
public void updateBorder() { public void updateBorder(Object[] selectionCellBorderObjects) {
BorderUtils.update(reportPane, ((BorderPane) paneList.get(ONE_INDEX)).update()); BorderUtils.update(reportPane, selectionCellBorderObjects, ((BorderPane) paneList.get(ONE_INDEX)).update());
} }
/** /**

5
designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/style/StylePane.java

@ -38,10 +38,9 @@ public class StylePane extends UIComboBoxPane<Style> {
customStylePane.addTabChangeListener(changeListener); customStylePane.addTabChangeListener(changeListener);
} }
public void updateBorder(Object[] selectionCellBorderObjects) {
public void updateBorder() {
if (getSelectedIndex() == 0 && customStylePane.isBorderPaneSelected()) { if (getSelectedIndex() == 0 && customStylePane.isBorderPaneSelected()) {
customStylePane.updateBorder(); customStylePane.updateBorder(selectionCellBorderObjects);
} }
} }

3
designer-realize/src/main/java/com/fr/design/mainframe/messagecollect/solid/SolidCollector.java

@ -40,9 +40,6 @@ public class SolidCollector {
* 回传文件给云中心并删除服务端本地文件 * 回传文件给云中心并删除服务端本地文件
*/ */
public void sendToCloudCenterAndDeleteFile() { public void sendToCloudCenterAndDeleteFile() {
if (WorkContext.getCurrent().isLocal()) {
return;
}
String url = CloudCenter.getInstance().acquireConf("design.solid", "https://cloud.fanruan.com/api/solid/upload"); String url = CloudCenter.getInstance().acquireConf("design.solid", "https://cloud.fanruan.com/api/solid/upload");
if (StringUtils.isEmpty(url)) { if (StringUtils.isEmpty(url)) {
FineLoggerFactory.getLogger().info("failed to get solid content upload url..."); FineLoggerFactory.getLogger().info("failed to get solid content upload url...");

10
designer-realize/src/main/java/com/fr/design/report/WriteShortCutsPane.java

@ -8,6 +8,8 @@ import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.utils.gui.UIComponentUtils; import com.fr.design.utils.gui.UIComponentUtils;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.transaction.Configurations;
import com.fr.transaction.WorkerAdaptor;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.JPanel; import javax.swing.JPanel;
@ -140,7 +142,13 @@ public class WriteShortCutsPane extends JPanel{
nextRowString = temp; nextRowString = temp;
switchColRow(); switchColRow();
ServerPreferenceConfig.getInstance().setWriteShortCuts(ComparatorUtils.equals(nextColString, "Tab")); Configurations.update(new WorkerAdaptor(ServerPreferenceConfig.class) {
@Override
public void run() {
ServerPreferenceConfig.getInstance().setWriteShortCuts(ComparatorUtils.equals(nextColString, "Tab"));
}
});
} }
}; };

23
designer-realize/src/main/java/com/fr/design/style/BorderUtils.java

@ -464,8 +464,13 @@ public abstract class BorderUtils {
* changed, need to support undo/redo * changed, need to support undo/redo
*/ */
public static boolean update(ElementCasePane reportPane, CellBorderStyle newCellBorderStyle) { public static boolean update(ElementCasePane reportPane, CellBorderStyle newCellBorderStyle) {
Object[] selectionCellBorderObjects = createCellBorderObject(reportPane);
return update(reportPane, selectionCellBorderObjects, newCellBorderStyle);
}
public static boolean update(ElementCasePane reportPane, Object[] selectionCellBorderObjects, CellBorderStyle newCellBorderStyle) {
boolean isBorderColorStyleChanged = false; boolean isBorderColorStyleChanged = false;
Object[] fourObjectArray = createCellBorderObject(reportPane); Object[] fourObjectArray = selectionCellBorderObjects;
if (fourObjectArray == null || fourObjectArray.length < NUMBER) { if (fourObjectArray == null || fourObjectArray.length < NUMBER) {
return false; return false;
} }
@ -526,44 +531,60 @@ public abstract class BorderUtils {
if (cellBorderStyle.getLeftStyle() != newCellBorderStyle.getLeftStyle() if (cellBorderStyle.getLeftStyle() != newCellBorderStyle.getLeftStyle()
|| !ComparatorUtils.equals(cellBorderStyle.getLeftColor(), newCellBorderStyle.getLeftColor())) { || !ComparatorUtils.equals(cellBorderStyle.getLeftColor(), newCellBorderStyle.getLeftColor())) {
style = style.deriveBorderLeft(newCellBorderStyle.getLeftStyle(), newCellBorderStyle.getLeftColor()); style = style.deriveBorderLeft(newCellBorderStyle.getLeftStyle(), newCellBorderStyle.getLeftColor());
} else {
style = style.deriveBorderLeft(cellBorderStyle.getLeftStyle(), cellBorderStyle.getLeftColor());
} }
} else { } else {
if (cellBorderStyle.getVerticalStyle() != newCellBorderStyle.getVerticalStyle() if (cellBorderStyle.getVerticalStyle() != newCellBorderStyle.getVerticalStyle()
|| !ComparatorUtils.equals(cellBorderStyle.getVerticalColor(), newCellBorderStyle.getVerticalColor())) { || !ComparatorUtils.equals(cellBorderStyle.getVerticalColor(), newCellBorderStyle.getVerticalColor())) {
style = style.deriveBorderLeft(newCellBorderStyle.getVerticalStyle(), newCellBorderStyle.getVerticalColor()); style = style.deriveBorderLeft(newCellBorderStyle.getVerticalStyle(), newCellBorderStyle.getVerticalColor());
} else {
style = style.deriveBorderLeft(cellBorderStyle.getVerticalStyle(), cellBorderStyle.getVerticalColor());
} }
} }
if (tmpCellElement.getColumn() + tmpCellElement.getColumnSpan() == column + columnSpan) { if (tmpCellElement.getColumn() + tmpCellElement.getColumnSpan() == column + columnSpan) {
if (cellBorderStyle.getRightStyle() != newCellBorderStyle.getRightStyle() if (cellBorderStyle.getRightStyle() != newCellBorderStyle.getRightStyle()
|| !ComparatorUtils.equals(cellBorderStyle.getRightColor(), newCellBorderStyle.getRightColor())) { || !ComparatorUtils.equals(cellBorderStyle.getRightColor(), newCellBorderStyle.getRightColor())) {
style = style.deriveBorderRight(newCellBorderStyle.getRightStyle(), newCellBorderStyle.getRightColor()); style = style.deriveBorderRight(newCellBorderStyle.getRightStyle(), newCellBorderStyle.getRightColor());
} else {
style = style.deriveBorderRight(cellBorderStyle.getRightStyle(), cellBorderStyle.getRightColor());
} }
} else { } else {
if (cellBorderStyle.getVerticalStyle() != newCellBorderStyle.getVerticalStyle() if (cellBorderStyle.getVerticalStyle() != newCellBorderStyle.getVerticalStyle()
|| !ComparatorUtils.equals(cellBorderStyle.getVerticalColor(), newCellBorderStyle.getVerticalColor())) { || !ComparatorUtils.equals(cellBorderStyle.getVerticalColor(), newCellBorderStyle.getVerticalColor())) {
style = style.deriveBorderRight(newCellBorderStyle.getVerticalStyle(), newCellBorderStyle.getVerticalColor()); style = style.deriveBorderRight(newCellBorderStyle.getVerticalStyle(), newCellBorderStyle.getVerticalColor());
} else {
style = style.deriveBorderRight(cellBorderStyle.getVerticalStyle(), cellBorderStyle.getVerticalColor());
} }
} }
if (tmpCellElement.getRow() == row) { if (tmpCellElement.getRow() == row) {
if (cellBorderStyle.getTopStyle() != newCellBorderStyle.getTopStyle() if (cellBorderStyle.getTopStyle() != newCellBorderStyle.getTopStyle()
|| !ComparatorUtils.equals(cellBorderStyle.getTopColor(), newCellBorderStyle.getTopColor())) { || !ComparatorUtils.equals(cellBorderStyle.getTopColor(), newCellBorderStyle.getTopColor())) {
style = style.deriveBorderTop(newCellBorderStyle.getTopStyle(), newCellBorderStyle.getTopColor()); style = style.deriveBorderTop(newCellBorderStyle.getTopStyle(), newCellBorderStyle.getTopColor());
} else {
style = style.deriveBorderTop(cellBorderStyle.getTopStyle(), cellBorderStyle.getTopColor());
} }
} else { } else {
if (cellBorderStyle.getHorizontalStyle() != newCellBorderStyle.getHorizontalStyle() if (cellBorderStyle.getHorizontalStyle() != newCellBorderStyle.getHorizontalStyle()
|| !ComparatorUtils.equals(cellBorderStyle.getHorizontalColor(), newCellBorderStyle.getHorizontalColor())) { || !ComparatorUtils.equals(cellBorderStyle.getHorizontalColor(), newCellBorderStyle.getHorizontalColor())) {
style = style.deriveBorderTop(newCellBorderStyle.getHorizontalStyle(), newCellBorderStyle.getHorizontalColor()); style = style.deriveBorderTop(newCellBorderStyle.getHorizontalStyle(), newCellBorderStyle.getHorizontalColor());
} else {
style = style.deriveBorderTop(cellBorderStyle.getHorizontalStyle(), cellBorderStyle.getHorizontalColor());
} }
} }
if (tmpCellElement.getRow() + tmpCellElement.getRowSpan() == row + rowSpan) { if (tmpCellElement.getRow() + tmpCellElement.getRowSpan() == row + rowSpan) {
if (cellBorderStyle.getBottomStyle() != newCellBorderStyle.getBottomStyle() if (cellBorderStyle.getBottomStyle() != newCellBorderStyle.getBottomStyle()
|| !ComparatorUtils.equals(cellBorderStyle.getBottomColor(), newCellBorderStyle.getBottomColor())) { || !ComparatorUtils.equals(cellBorderStyle.getBottomColor(), newCellBorderStyle.getBottomColor())) {
style = style.deriveBorderBottom(newCellBorderStyle.getBottomStyle(), newCellBorderStyle.getBottomColor()); style = style.deriveBorderBottom(newCellBorderStyle.getBottomStyle(), newCellBorderStyle.getBottomColor());
} else {
style = style.deriveBorderBottom(cellBorderStyle.getBottomStyle(), cellBorderStyle.getBottomColor());
} }
} else { } else {
if (cellBorderStyle.getHorizontalStyle() != newCellBorderStyle.getHorizontalStyle() if (cellBorderStyle.getHorizontalStyle() != newCellBorderStyle.getHorizontalStyle()
|| !ComparatorUtils.equals(cellBorderStyle.getHorizontalColor(), newCellBorderStyle.getHorizontalColor())) { || !ComparatorUtils.equals(cellBorderStyle.getHorizontalColor(), newCellBorderStyle.getHorizontalColor())) {
style = style.deriveBorderBottom(newCellBorderStyle.getHorizontalStyle(), newCellBorderStyle.getHorizontalColor()); style = style.deriveBorderBottom(newCellBorderStyle.getHorizontalStyle(), newCellBorderStyle.getHorizontalColor());
} else {
style = style.deriveBorderBottom(cellBorderStyle.getHorizontalStyle(), cellBorderStyle.getHorizontalColor());
} }
} }
return style; return style;

3
designer-realize/src/main/java/com/fr/poly/creator/ECBlockEditor.java

@ -176,6 +176,7 @@ public class ECBlockEditor extends BlockEditor<ECBlockPane, PolyECBlock> {
// 超级链接 // 超级链接
HyperlinkGroupPane hyperlinkGroupPane = DesignerContext.getDesignerFrame().getSelectedJTemplate() HyperlinkGroupPane hyperlinkGroupPane = DesignerContext.getDesignerFrame().getSelectedJTemplate()
.getHyperLinkPane(HyperlinkGroupPaneActionImpl.getInstance()); .getHyperLinkPane(HyperlinkGroupPaneActionImpl.getInstance());
EastRegionContainerPane.getInstance().replaceHyperlinkPane(hyperlinkGroupPane);
hyperlinkGroupPane.populate(editComponent); hyperlinkGroupPane.populate(editComponent);
} }
@ -187,4 +188,4 @@ public class ECBlockEditor extends BlockEditor<ECBlockPane, PolyECBlock> {
ElementCasePane ePane = (ElementCasePane)jTemplate.getCurrentElementCasePane(); ElementCasePane ePane = (ElementCasePane)jTemplate.getCurrentElementCasePane();
return ePane != null && ePane.isSelectedOneCell(); return ePane != null && ePane.isSelectedOneCell();
} }
} }

Loading…
Cancel
Save