Browse Source

Merge pull request #3627 in DESIGN/design from release/10.0 to final/10.0

* commit '12f6eddb2772daa1e2992c5bc76d1a3cefb1ad96': (147 commits)
  merge code
  REPORT-47782 数据集-数据连接-数据集界面的数据连接按钮,鼠标悬浮时的提示不对 【问题原因】数据集查询页面以及服务器数据集页面中的按钮正常状态下没有tooltips,但是UILockButton在初始化的时候会传入一个空字符串,导致会有一个小方格显示出来 【改动思路】把初始化传入的空字符串修改为null,setTooltipsText方法中会判断是否为null,如果是null就会把tooltips隐藏
  CHART-18309 框架图面板边框颜色
  CHART-18270 点样式图片的宽高增加px单位
  CHART-18112 富文本组件新建和刷新后选中最后一个元素
  调整富文本组件间距
  REPORT-46723 填报智能添加单元格组 遗漏一个判断条件的同步修改
  update
  REPORT-48124 内置缓存插件漏掉了其它提交&方法改个名字
  REPORT-46723 填报智能添加单元格组
  CHART-18103 调整富文本字体选择组件宽度
  CHART-18257 支持组合图的富文本新增字段参数
  CHART-18255 富文本默认字段最后一个不需要添加换行
  REPORT-47516 远程锁定-集群单节点,两个用户先后进入,数据连接的锁定有问题 【问题原因】主要的原因有两个,一是当时测试同学在集群环境上的操作不当导致了用户lock后,在ClientAliveChecker中的check4EditLock方法报错,然后被认定成脏数据清除了;二是此前userIn和userBeat时存入的是LockItem枚举类对象,相当于常量,那么所有用户beat后存入的对象都是同一个,这个是逻辑问题,并且在集群环境上测试的过程中还发现LockItem对象的序列化有些问题,会报错 【改动思路】①将之前存入的ClientID-LockItem键值对修改为存入ClientID-LockedFile键值对,LockedFile是一个继承了HashSet的类,里面有birth和beat的逻辑,天然实现了序列化接口,是模板锁定那边写的一个类,这边就直接拿来用了;②将EditLock和模板锁定的一些逻辑分离了一下,避免过多耦合;③自己测试的时候还发现数据集查询页下的提示弹窗会出现二级弹窗问题,因此在EditLockUtils中添加了个api用于传入父窗口
  CHART-18066 调整富文本编辑器尺寸
  CHART-18102 JXBrowser资源请求增加文件类型
  REPORT-46915 重命名
  单元测试
  REPORT-47034 FRM新前端&新自适应合入主JAR
  使用内部类代替重复的方法
  ...
final/10.0
superman 4 years ago
parent
commit
186febda06
  1. 16
      designer-base/src/main/java/com/fr/base/svg/IconUtils.java
  2. 94
      designer-base/src/main/java/com/fr/design/DesignModelAdapter.java
  3. 7
      designer-base/src/main/java/com/fr/design/DesignerEnvManager.java
  4. 52
      designer-base/src/main/java/com/fr/design/actions/UpdateAction.java
  5. 37
      designer-base/src/main/java/com/fr/design/actions/server/ConnectionListAction.java
  6. 43
      designer-base/src/main/java/com/fr/design/actions/server/GlobalTableDataAction.java
  7. 23
      designer-base/src/main/java/com/fr/design/data/BasicTableDataTreePane.java
  8. 4
      designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java
  9. 47
      designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionComboBoxPanel.java
  10. 58
      designer-base/src/main/java/com/fr/design/data/datapane/connect/ItemEditableComboBoxPanel.java
  11. 25
      designer-base/src/main/java/com/fr/design/editlock/ConnectionLockChangeChecker.java
  12. 85
      designer-base/src/main/java/com/fr/design/editlock/EditLockChangeChecker.java
  13. 25
      designer-base/src/main/java/com/fr/design/editlock/EditLockChangeEvent.java
  14. 16
      designer-base/src/main/java/com/fr/design/editlock/EditLockChangeListener.java
  15. 87
      designer-base/src/main/java/com/fr/design/editlock/EditLockUtils.java
  16. 23
      designer-base/src/main/java/com/fr/design/editlock/ServerTableDataLockChangeChecker.java
  17. 10
      designer-base/src/main/java/com/fr/design/extra/LoginWebBridge.java
  18. 15
      designer-base/src/main/java/com/fr/design/extra/PluginWebBridge.java
  19. 42
      designer-base/src/main/java/com/fr/design/extra/exe/callback/InstallFromDiskCallback.java
  20. 18
      designer-base/src/main/java/com/fr/design/extra/exe/callback/InstallOnlineCallback.java
  21. 14
      designer-base/src/main/java/com/fr/design/extra/exe/callback/UninstallPluginCallback.java
  22. 38
      designer-base/src/main/java/com/fr/design/extra/exe/callback/UpdateFromDiskCallback.java
  23. 31
      designer-base/src/main/java/com/fr/design/fun/DesignerLifecycleMonitor.java
  24. 31
      designer-base/src/main/java/com/fr/design/fun/DesignerPortProvider.java
  25. 24
      designer-base/src/main/java/com/fr/design/gui/frpane/UINumberDragPaneWithPercent.java
  26. 55
      designer-base/src/main/java/com/fr/design/gui/ibutton/UILockButton.java
  27. 9
      designer-base/src/main/java/com/fr/design/gui/icontainer/UIModeControlContainer.java
  28. 47
      designer-base/src/main/java/com/fr/design/gui/imenu/UILockMenuItem.java
  29. 28
      designer-base/src/main/java/com/fr/design/gui/imenu/UILockMenuItemUI.java
  30. 26
      designer-base/src/main/java/com/fr/design/gui/ispinner/UISpinner.java
  31. 15
      designer-base/src/main/java/com/fr/design/gui/ispinner/chart/UISpinnerWithPercent.java
  32. 20
      designer-base/src/main/java/com/fr/design/gui/ispinner/chart/UISpinnerWithPx.java
  33. 26
      designer-base/src/main/java/com/fr/design/gui/ispinner/chart/UISpinnerWithUnit.java
  34. 22
      designer-base/src/main/java/com/fr/design/gui/itextfield/UINumberField.java
  35. 114
      designer-base/src/main/java/com/fr/design/gui/itextfield/UINumberFieldWithUnit.java
  36. 6
      designer-base/src/main/java/com/fr/design/gui/style/FormatPane.java
  37. 38
      designer-base/src/main/java/com/fr/design/locale/impl/BbsRegisterMark.java
  38. 38
      designer-base/src/main/java/com/fr/design/locale/impl/BbsResetMark.java
  39. 39
      designer-base/src/main/java/com/fr/design/locale/impl/BbsSpaceMark.java
  40. 47
      designer-base/src/main/java/com/fr/design/monitor/DesignerLifecycleMonitorContext.java
  41. 14
      designer-base/src/main/java/com/fr/design/os/impl/DatabaseDialogAction.java
  42. 32
      designer-base/src/main/java/com/fr/design/port/DesignerPortContext.java
  43. 4
      designer-base/src/main/java/com/fr/design/style/color/ColorAdjustPane.java
  44. 6
      designer-base/src/main/java/com/fr/design/style/color/ColorSelectPane.java
  45. 15
      designer-base/src/main/java/com/fr/design/ui/Assistant.java
  46. 15
      designer-base/src/main/java/com/fr/design/upm/UpmBridge.java
  47. 12
      designer-base/src/main/java/com/fr/design/utils/DesignerPort.java
  48. 4
      designer-base/src/main/java/com/fr/exit/DesignerExiter.java
  49. 2
      designer-base/src/main/java/com/fr/start/BaseDesigner.java
  50. 15
      designer-base/src/main/resources/com/fr/design/images/m_web/connection_locked_normal.svg
  51. 14
      designer-base/src/main/resources/com/fr/design/images/m_web/locked_normal.svg
  52. BIN
      designer-base/src/main/resources/com/fr/design/images/m_web/warningIcon.png
  53. 3
      designer-chart/src/main/java/com/fr/design/chart/ChartDesignerActivator.java
  54. 3
      designer-chart/src/main/java/com/fr/design/chart/series/SeriesCondition/LabelAlphaPane.java
  55. 6
      designer-chart/src/main/java/com/fr/design/chartx/component/AbstractCustomFieldComboBoxPane.java
  56. 4
      designer-chart/src/main/java/com/fr/design/chartx/component/MapAreaMatchPane.java
  57. 4
      designer-chart/src/main/java/com/fr/design/chartx/component/MatchAreaTable.java
  58. 8
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartOtherPane.java
  59. 102
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/CalculateComboBox.java
  60. 15
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/DatabaseTableDataPane.java
  61. 1
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/MeterPlotTableDataContentPane.java
  62. 2
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/SeriesNameUseFieldNamePane.java
  63. 3
      designer-chart/src/main/java/com/fr/van/chart/box/VanChartBoxBorderPane.java
  64. 135
      designer-chart/src/main/java/com/fr/van/chart/box/VanChartBoxRichTextDetailedFieldListPane.java
  65. 41
      designer-chart/src/main/java/com/fr/van/chart/box/VanChartBoxRichTextResultFieldListPane.java
  66. 294
      designer-chart/src/main/java/com/fr/van/chart/box/VanChartBoxTooltipContentPane.java
  67. 5
      designer-chart/src/main/java/com/fr/van/chart/bubble/component/VanChartBubblePane.java
  68. 3
      designer-chart/src/main/java/com/fr/van/chart/column/ColumnBorderAttriPane.java
  69. 8
      designer-chart/src/main/java/com/fr/van/chart/column/VanChartColumnSeriesPane.java
  70. 4
      designer-chart/src/main/java/com/fr/van/chart/custom/other/VanChartCustomConditionAttrPane.java
  71. 21
      designer-chart/src/main/java/com/fr/van/chart/custom/other/VanChartCustomPlotConditionAttrTabPane.java
  72. 15
      designer-chart/src/main/java/com/fr/van/chart/custom/style/VanChartCustomPlotLabelTabPane.java
  73. 15
      designer-chart/src/main/java/com/fr/van/chart/custom/style/VanChartCustomPlotTooltipTabPane.java
  74. 11
      designer-chart/src/main/java/com/fr/van/chart/custom/style/VanChartCustomStylePane.java
  75. 15
      designer-chart/src/main/java/com/fr/van/chart/designer/PlotFactory.java
  76. 3
      designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartAreaSeriesFillColorPane.java
  77. 5
      designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartLineTypePane.java
  78. 22
      designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartRefreshTooltipContentPane.java
  79. 191
      designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartRichEditorPane.java
  80. 285
      designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java
  81. 3
      designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTrendLinePane.java
  82. 3
      designer-chart/src/main/java/com/fr/van/chart/designer/component/background/VanChartBackgroundPane.java
  83. 23
      designer-chart/src/main/java/com/fr/van/chart/designer/component/background/VanChartBackgroundPaneWithOutImageAndShadow.java
  84. 3
      designer-chart/src/main/java/com/fr/van/chart/designer/component/background/VanChartBackgroundWithOutShadowWithRadiusPane.java
  85. 3
      designer-chart/src/main/java/com/fr/van/chart/designer/component/border/VanChartBorderWithAlphaPane.java
  86. 3
      designer-chart/src/main/java/com/fr/van/chart/designer/component/border/VanChartBorderWithRadiusPane.java
  87. 3
      designer-chart/src/main/java/com/fr/van/chart/designer/component/border/VanChartBorderWithShapePane.java
  88. 3
      designer-chart/src/main/java/com/fr/van/chart/designer/component/marker/VanChartCommonMarkerPane.java
  89. 5
      designer-chart/src/main/java/com/fr/van/chart/designer/component/marker/VanChartImageMarkerPane.java
  90. 103
      designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldAttrPane.java
  91. 202
      designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldButton.java
  92. 400
      designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldListPane.java
  93. 17
      designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldListener.java
  94. 75
      designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichEditorModel.java
  95. 232
      designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichEditorPane.java
  96. 10
      designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichTextDialog.java
  97. 97
      designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichTextPane.java
  98. 18
      designer-chart/src/main/java/com/fr/van/chart/designer/component/tooltip/RefreshTooltipContentPaneWithOutSeries.java
  99. 53
      designer-chart/src/main/java/com/fr/van/chart/designer/component/tooltip/TooltipContentPaneWithOutSeries.java
  100. 34
      designer-chart/src/main/java/com/fr/van/chart/designer/component/tooltip/VanChartFieldListPaneWithOutSeries.java
  101. Some files were not shown because too many files have changed in this diff Show More

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

@ -38,9 +38,8 @@ public class IconUtils {
if (IOUtils.readResource(resource) != null) {
return SVGIcon.readSVGIcon(resource);
}
// 适配某些插件里是_normal.png、_selected.png的情况
String pngResource = resource.replace(ICON_SUFFIX_SVG, ICON_SUFFIX_PNG);
return IOUtils.readIcon(pngResource);
// 适配插件
return adjustPluginsPng(resource);
}
return IOUtils.readIcon(resource);
}
@ -48,6 +47,17 @@ public class IconUtils {
return readNoSuffixResource(resource, ICON_TYPE_NORMAL);
}
/**
* 适配插件中使用_normal.png_selected.png_disabled.png的情况
* @param resource 图片路径
* @return Icon
*/
private static Icon adjustPluginsPng(String resource) {
String pngResource = resource.replace(ICON_SUFFIX_SVG, ICON_SUFFIX_PNG);
// 考虑到某些插件可能只会使用三种图标中的一部分,这里做个判断,不然就会因为资源不存在而报错
return IOUtils.readResource(pngResource) == null ? new ImageIcon() : IOUtils.readIcon(pngResource);
}
/**
* 尝试读取不带扩展名的图标svg优先其次png最后gif都没读到就打印错误日志返回空白Icon
* @param resource 图片路径

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

@ -1,8 +1,11 @@
package com.fr.design;
import com.fr.base.Parameter;
import com.fr.base.ParameterConfig;
import com.fr.base.TableData;
import com.fr.base.io.BaseBook;
import com.fr.data.TableDataSource;
import com.fr.data.operator.DataOperator;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.mainframe.DesignerFrameFileDealerPane;
import com.fr.design.mainframe.JTemplate;
@ -11,9 +14,14 @@ import com.fr.form.ui.DataControl;
import com.fr.form.ui.MultiFileEditor;
import com.fr.form.ui.Widget;
import com.fr.general.ComparatorUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.Filter;
import com.fr.stable.ParameterProvider;
import com.fr.stable.StringUtils;
import com.fr.stable.js.WidgetName;
import com.fr.util.ParameterApplyHelper;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
@ -40,7 +48,7 @@ public abstract class DesignModelAdapter<T extends BaseBook, S extends JTemplate
/**
* 全部的参数包括全局参数模板参数和数据集参数
*/
private Parameter[] parameters;
protected Parameter[] parameters;
/**
* 数据集参数
@ -52,6 +60,12 @@ public abstract class DesignModelAdapter<T extends BaseBook, S extends JTemplate
*/
private Parameter[] templateParameters;
/**
* 数据集参数缓存 更新时刷新
*/
protected Map<String, ParameterProvider[]> tableDataParametersMap = new HashMap<>();
public DesignModelAdapter(S jTemplate) {
this.jTemplate = jTemplate;
@ -241,6 +255,79 @@ public abstract class DesignModelAdapter<T extends BaseBook, S extends JTemplate
}
protected void addTableDataParameters(Map<String, ParameterProvider> map, Filter<ParameterProvider> filter) {
Iterator<String> it = this.getBook().getTableDataNameIterator();
try {
// 清空下缓存
tableDataParametersMap.clear();
while (it.hasNext()) {
String name = it.next();
TableData tableData = this.getBook().getTableData(name);
ParameterProvider[] parameterProviders = DataOperator.getInstance().getTableDataParameters(tableData);
if (filter != null) {
ParameterApplyHelper.addPara2Map(map, parameterProviders, filter);
} else {
ParameterApplyHelper.addPara2Map(map, parameterProviders);
}
tableDataParametersMap.put(name, parameterProviders);
}
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
}
protected void updateTableDataParameters(String oldName,
String tdName,
TableData tableData,
Map<String, ParameterProvider> map,
Filter<ParameterProvider> filter) {
ParameterProvider[] providers = null;
if (!ComparatorUtils.equals(oldName, tdName)) {
// 更新下缓存名称 替换下数据集名称
providers = tableDataParametersMap.remove(oldName);
if (providers != null) {
tableDataParametersMap.put(tdName, providers);
}
}
try {
for (Map.Entry<String, ParameterProvider[]> entry : tableDataParametersMap.entrySet()) {
ParameterProvider[] parameterProviders;
if (ComparatorUtils.equals(entry.getKey(), tdName)) {
parameterProviders = DataOperator.getInstance().getTableDataParameters(tableData);
// 用来更新缓存
providers = parameterProviders;
} else {
parameterProviders = entry.getValue();
}
if (filter != null) {
ParameterApplyHelper.addPara2Map(map, parameterProviders, filter);
} else {
ParameterApplyHelper.addPara2Map(map, parameterProviders);
}
}
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
if (providers != null) {
// 更新缓存
tableDataParametersMap.put(tdName, providers);
}
}
protected void addGlobalParameters(Map<String, ParameterProvider> map) {
// 添加全局参数
Parameter[] glbParas = ParameterConfig.getInstance().getGlobalParameters();
ParameterApplyHelper.addPara2Map(map, glbParas);
}
/**
* 环境改变.
*/
@ -251,6 +338,11 @@ public abstract class DesignModelAdapter<T extends BaseBook, S extends JTemplate
*/
public abstract void parameterChanged();
/**
* 数据集参数改变
*/
public abstract void tableDataParametersChanged(String oldName, String tdName, TableData tableData);
/**
* 控件配置改变.
*/

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

@ -15,10 +15,12 @@ import com.fr.design.env.DesignerWorkspaceType;
import com.fr.design.env.LocalDesignerWorkspaceInfo;
import com.fr.design.env.RemoteDesignerWorkspaceInfo;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.fun.DesignerPortProvider;
import com.fr.design.i18n.Toolkit;
import com.fr.design.locale.impl.ProductImproveMark;
import com.fr.design.mainframe.vcs.VcsConfigManager;
import com.fr.design.notification.SnapChatConfig;
import com.fr.design.port.DesignerPortContext;
import com.fr.design.update.push.DesignerPushUpdateConfigManager;
import com.fr.design.style.color.ColorSelectConfigManager;
import com.fr.design.utils.DesignUtils;
@ -42,6 +44,7 @@ import com.fr.stable.ListMap;
import com.fr.stable.ProductConstants;
import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils;
import com.fr.stable.bridge.StableFactory;
import com.fr.stable.core.UUID;
import com.fr.stable.project.ProjectConstants;
import com.fr.stable.xml.XMLPrintWriter;
@ -842,6 +845,10 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
* 返回Jetty服务器的端口号
*/
public int getEmbedServerPort() {
int embeddedServerPort = DesignerPortContext.getEmbeddedServerPort();
if (embeddedServerPort >= DesignerPort.MIN_PORT && embeddedServerPort <= DesignerPort.MAX_PORT) {
return embeddedServerPort;
}
return this.jettyServerPort;
}

52
designer-base/src/main/java/com/fr/design/actions/UpdateAction.java

@ -339,33 +339,37 @@ public abstract class UpdateAction extends ShortCut implements Action {
if (!(object instanceof AbstractButton)) {
UIButton button = null;
button = new UIButton();
// 添加一个名字作为自动化测试用
button.setName(getName());
button.set4ToolbarButton();
//设置属性.
Integer mnemonicInteger = (Integer) this.getValue(Action.MNEMONIC_KEY);
if (mnemonicInteger != null) {
button.setMnemonic((char) mnemonicInteger.intValue());
}
button.setIcon((Icon) this.getValue(Action.SMALL_ICON));
setPressedIcon4Button(button);
setDisabledIcon4Button(button);
button.addActionListener(this);
object = initButton(button, UIButton.class.getName());
}
button.registerKeyboardAction(this, this.getAccelerator(), JComponent.WHEN_IN_FOCUSED_WINDOW);
return (JComponent) object;
}
this.putValue(UIButton.class.getName(), button);
button.setText(StringUtils.EMPTY);
button.setEnabled(this.isEnabled());
protected JComponent initButton(UIButton button, String name) {
// 添加一个名字作为自动化测试用
button.setName(getName());
button.set4ToolbarButton();
//peter:产生tooltip
button.setToolTipText(getToolTipText());
object = button;
//设置属性.
Integer mnemonicInteger = (Integer) this.getValue(Action.MNEMONIC_KEY);
if (mnemonicInteger != null) {
button.setMnemonic((char) mnemonicInteger.intValue());
}
return (JComponent) object;
button.setIcon((Icon) this.getValue(Action.SMALL_ICON));
setPressedIcon4Button(button);
setDisabledIcon4Button(button);
button.addActionListener(this);
button.registerKeyboardAction(this, this.getAccelerator(), JComponent.WHEN_IN_FOCUSED_WINDOW);
this.putValue(name, button);
button.setText(StringUtils.EMPTY);
button.setEnabled(this.isEnabled());
//peter:产生tooltip
button.setToolTipText(getToolTipText());
return button;
}
/**
@ -641,14 +645,14 @@ public abstract class UpdateAction extends ShortCut implements Action {
shortPinyin.append(PinyinHelper.getShortPinyin(title)).append(separator);
}
private void setPressedIcon4Button(AbstractButton button) {
protected void setPressedIcon4Button(AbstractButton button) {
Icon pressedIcon = (Icon) this.getValue(UpdateAction.PRESSED_ICON);
if (pressedIcon != null && pressedIcon instanceof SVGIcon) {
button.setPressedIcon(pressedIcon);
}
}
private void setDisabledIcon4Button(AbstractButton button) {
protected void setDisabledIcon4Button(AbstractButton button) {
Icon disabledIcon = (Icon) this.getValue(UpdateAction.DISABLED_ICON);
if (disabledIcon != null && disabledIcon instanceof SVGIcon) {
button.setDisabledIcon(disabledIcon);

37
designer-base/src/main/java/com/fr/design/actions/server/ConnectionListAction.java

@ -1,19 +1,23 @@
package com.fr.design.actions.server;
import com.fr.base.svg.IconUtils;
import com.fr.data.impl.Connection;
import com.fr.design.actions.UpdateAction;
import com.fr.design.data.datapane.connect.ConnectionShowPane;
import com.fr.design.data.datapane.connect.DatabaseConnectionPane;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.editlock.ConnectionLockChangeChecker;
import com.fr.design.editlock.EditLockUtils;
import com.fr.design.gui.NameInspector;
import com.fr.design.gui.imenu.UILockMenuItem;
import com.fr.design.gui.imenu.UIMenuItem;
import com.fr.design.menu.MenuKeySet;
import com.fr.stable.os.support.OSBasedAction;
import com.fr.stable.os.support.OSSupportCenter;
import com.fr.design.os.impl.DatabaseDialogAction;
import com.fr.file.ConnectionConfig;
import com.fr.report.LockItem;
import javax.swing.*;
import javax.swing.KeyStroke;
import java.awt.event.ActionEvent;
import java.util.Map;
@ -53,8 +57,16 @@ public class ConnectionListAction extends UpdateAction {
* @param evt 事件
*/
public void actionPerformed(ActionEvent evt) {
OSBasedAction osBasedAction = OSSupportCenter.getAction(DatabaseDialogAction.class);
osBasedAction.execute();
// 尝试为数据连接加锁
boolean actionLock = EditLockUtils.lock(LockItem.CONNECTION);
if (!actionLock) {
// 锁定失败,代表已经被其他用户锁定,跳出弹窗提示
EditLockUtils.showLockMessage();
} else {
// 锁定成功,执行后续操作
OSBasedAction osBasedAction = OSSupportCenter.getAction(DatabaseDialogAction.class);
osBasedAction.execute();
}
}
/**
@ -96,4 +108,21 @@ public class ConnectionListAction extends UpdateAction {
public void update() {
this.setEnabled(true);
}
@Override
public UIMenuItem createMenuItem() {
Object object = this.getValue(UILockMenuItem.class.getName());
if (object == null && !(object instanceof UILockMenuItem)) {
UILockMenuItem menuItem = new UILockMenuItem(this, EditLockUtils.CONNECTION_LOCKED_TOOLTIPS, null, LockItem.CONNECTION);
// 设置名字用作单元测
menuItem.setName(getName());
setPressedIcon4Button(menuItem);
setDisabledIcon4Button(menuItem);
object = menuItem;
this.putValue(UILockMenuItem.class.getName(), object);
ConnectionLockChangeChecker.getInstance().addEditLockChangeListener((UILockMenuItem)object);
}
return (UILockMenuItem) object;
}
}

43
designer-base/src/main/java/com/fr/design/actions/server/GlobalTableDataAction.java

@ -4,7 +4,6 @@
package com.fr.design.actions.server;
import com.fr.base.TableData;
import com.fr.base.svg.IconUtils;
import com.fr.design.DesignModelAdapter;
import com.fr.design.actions.UpdateAction;
import com.fr.design.data.DesignTableDataManager;
@ -13,7 +12,11 @@ import com.fr.design.data.tabledata.ResponseDataSourceChange;
import com.fr.design.data.tabledata.tabledatapane.TableDataManagerPane;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.editlock.EditLockUtils;
import com.fr.design.editlock.ServerTableDataLockChangeChecker;
import com.fr.design.gui.NameInspector;
import com.fr.design.gui.imenu.UILockMenuItem;
import com.fr.design.gui.imenu.UIMenuItem;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.DesignerFrame;
import com.fr.design.menu.MenuKeySet;
@ -22,9 +25,10 @@ import com.fr.file.TableDataConfig;
import com.fr.transaction.CallBackAdaptor;
import com.fr.transaction.Configurations;
import com.fr.transaction.WorkerFacade;
import com.fr.report.LockItem;
import javax.swing.KeyStroke;
import java.awt.*;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.util.HashMap;
import java.util.Map;
@ -66,6 +70,14 @@ public class GlobalTableDataAction extends UpdateAction implements ResponseDataS
* @param evt 事件
*/
public void actionPerformed(ActionEvent evt) {
// 尝试为服务器数据集加锁
boolean actionLock = EditLockUtils.lock(LockItem.SERVER_TABLE_DATA);
if (!actionLock) {
// 锁定失败,代表已经被其他用户锁定,跳出弹窗提示
EditLockUtils.showLockMessage();
return;
}
// 锁定成功,执行后续操作
final DesignerFrame designerFrame = DesignerContext.getDesignerFrame();
final TableDataConfig tableDataConfig = TableDataConfig.getInstance();
final TableDataManagerPane globalTableDataPane = new TableDataManagerPane() {
@ -90,7 +102,6 @@ public class GlobalTableDataAction extends UpdateAction implements ResponseDataS
globalTableDataDialog.setDoOKSucceed(false);
return;
}
DesignTableDataManager.clearGlobalDs();
// 保存时 移除服务器数据集列名缓存
for (String name : tableDataConfig.getTableDatas().keySet()) {
@ -114,9 +125,18 @@ public class GlobalTableDataAction extends UpdateAction implements ResponseDataS
// 刷新共有数据集
TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter());
fireDSChanged(globalTableDataPane.getDsChangedNameMap());
// 关闭服务器数据集页面,为其解锁
EditLockUtils.unlock(LockItem.SERVER_TABLE_DATA);
}
}));
}
@Override
public void doCancel() {
super.doCancel();
// 关闭服务器数据集页面,为其解锁
EditLockUtils.unlock(LockItem.SERVER_TABLE_DATA);
}
});
globalTableDataDialog.setVisible(true);
}
@ -166,4 +186,21 @@ public class GlobalTableDataAction extends UpdateAction implements ResponseDataS
public void fireDSChanged(Map<String, String> map) {
DesignTableDataManager.fireDSChanged(map);
}
@Override
public UIMenuItem createMenuItem() {
Object object = this.getValue(UILockMenuItem.class.getName());
if (object == null && !(object instanceof UILockMenuItem)) {
UILockMenuItem menuItem = new UILockMenuItem(this, EditLockUtils.SERVER_TABLEDATA_LOCKED_TOOLTIPS, null, LockItem.SERVER_TABLE_DATA);
// 设置名字用作单元测
menuItem.setName(getName());
setPressedIcon4Button(menuItem);
setDisabledIcon4Button(menuItem);
object = menuItem;
this.putValue(UILockMenuItem.class.getName(), object);
ServerTableDataLockChangeChecker.getInstance().addEditLockChangeListener((UILockMenuItem)object);
}
return (UILockMenuItem) object;
}
}

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

@ -18,7 +18,10 @@ import com.fr.design.data.tabledata.wrapper.TableDataWrapper;
import com.fr.design.data.tabledata.wrapper.TemplateTableDataWrapper;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.BasicPane;
import com.fr.design.editlock.ConnectionLockChangeChecker;
import com.fr.design.editlock.EditLockUtils;
import com.fr.design.gui.ibutton.UIHeadGroup;
import com.fr.design.gui.ibutton.UILockButton;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode;
import com.fr.design.icon.IconPathConstants;
@ -31,8 +34,11 @@ import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils;
import com.fr.workspace.WorkContext;
import javax.swing.AbstractButton;
import javax.swing.Action;
import javax.swing.DefaultCellEditor;
import javax.swing.Icon;
import javax.swing.JComponent;
import javax.swing.JTree;
import javax.swing.event.CellEditorListener;
import javax.swing.event.ChangeEvent;
@ -439,6 +445,23 @@ public abstract class BasicTableDataTreePane extends DockingView implements Resp
this.setMnemonic('D');
this.setSmallIcon("/com/fr/design/images/m_web/connection");
}
@Override
public JComponent createToolBarComponent() {
Object object = this.getValue(UILockButton.class.getName());
if (!(object instanceof AbstractButton)) {
UILockButton button = new UILockButton(
EditLockUtils.CONNECTION_LOCKED_ICON,
(Icon) this.getValue(Action.SMALL_ICON),
EditLockUtils.CONNECTION_LOCKED_TOOLTIPS,
getToolTipText()
);
initButton(button, UILockButton.class.getName());
object = button;
ConnectionLockChangeChecker.getInstance().addEditLockChangeListener((UILockButton)object);
}
return (JComponent) object;
}
}
/**

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

@ -228,7 +228,7 @@ public class TableDataTreePane extends BasicTableDataTreePane {
}
fireDSChanged(map);
tc.fireTargetModified();
tc.parameterChanged();
tc.tableDataParametersChanged(oldName, tdName, td);
int[] rows = dataTree.getSelectionRows();
dataTree.refreshChildByName(tdName);
dataTree.setSelectionRows(rows);
@ -366,7 +366,7 @@ public class TableDataTreePane extends BasicTableDataTreePane {
}
fireDSChanged(map);
tc.fireTargetModified();
tc.parameterChanged();
tc.tableDataParametersChanged(oldName, tdName, td);
int[] rows = dataTree.getSelectionRows();
dataTree.refreshChildByName(tdName);
dataTree.setSelectionRows(rows);

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

@ -1,5 +1,6 @@
package com.fr.design.data.datapane.connect;
import com.fr.base.svg.IconUtils;
import com.fr.data.impl.AbstractDatabaseConnection;
import com.fr.data.impl.Connection;
import com.fr.data.impl.NameDatabaseConnection;
@ -7,6 +8,10 @@ import com.fr.design.DesignerEnvManager;
import com.fr.design.actions.server.ConnectionListAction;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.editlock.ConnectionLockChangeChecker;
import com.fr.design.editlock.EditLockUtils;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ibutton.UILockButton;
import com.fr.design.mainframe.DesignerContext;
import com.fr.file.ConnectionConfig;
import com.fr.general.ComparatorUtils;
@ -16,8 +21,12 @@ import com.fr.transaction.Configurations;
import com.fr.transaction.WorkerFacade;
import com.fr.workspace.WorkContext;
import com.fr.workspace.server.connection.DBConnectAuth;
import com.fr.report.LockItem;
import javax.swing.SwingUtilities;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.util.ArrayList;
@ -56,6 +65,24 @@ public class ConnectionComboBoxPanel extends ItemEditableComboBoxPanel {
refreshItems();
}
@Override
protected UIButton initEditButton(UIButton editButton, Dimension buttonSize) {
editButton = new UILockButton(
EditLockUtils.CONNECTION_LOCKED_ICON,
IconUtils.readIcon("/com/fr/design/images/m_web/connection"),
EditLockUtils.CONNECTION_LOCKED_TOOLTIPS,
null
);
editButton.setPreferredSize(buttonSize);
editButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
editItems();
}
});
ConnectionLockChangeChecker.getInstance().addEditLockChangeListener((UILockButton) editButton);
return editButton;
}
/*
* 刷新ComboBox.items
*/
@ -97,6 +124,14 @@ public class ConnectionComboBoxPanel extends ItemEditableComboBoxPanel {
* 弹出对话框编辑Items
*/
protected void editItems() {
// 尝试为数据连接加锁
boolean actionLock = EditLockUtils.lock(LockItem.CONNECTION);
if (!actionLock) {
// 锁定失败,代表已经被其他用户锁定,跳出弹窗提示
EditLockUtils.showLockMessage(this);
return;
}
// 锁定成功,执行后续操作
final ConnectionListPane connectionListPane = new ConnectionListPane();
final ConnectionConfig connectionConfig = ConnectionConfig.getInstance();
ConnectionConfig cloned = connectionConfig.mirror();
@ -109,7 +144,6 @@ public class ConnectionComboBoxPanel extends ItemEditableComboBoxPanel {
connectionListDialog.setDoOKSucceed(false);
return;
}
Configurations.modify(new WorkerFacade(ConnectionConfig.class) {
@Override
public void run() {
@ -125,10 +159,19 @@ public class ConnectionComboBoxPanel extends ItemEditableComboBoxPanel {
@Override
public void afterCommit() {
DesignerContext.getDesignerBean("databasename").refreshBeanElement();
// 关闭定义数据连接页面,为其解锁
EditLockUtils.unlock(LockItem.CONNECTION);
}
}));
}
@Override
public void doCancel() {
// 关闭定义数据连接页面,为其解锁
super.doCancel();
EditLockUtils.unlock(LockItem.CONNECTION);
}
});
connectionListDialog.setVisible(true);
refreshItems();
@ -158,4 +201,4 @@ public class ConnectionComboBoxPanel extends ItemEditableComboBoxPanel {
}
}
}
}
}

58
designer-base/src/main/java/com/fr/design/data/datapane/connect/ItemEditableComboBoxPanel.java

@ -12,7 +12,7 @@ import java.awt.event.ActionListener;
public abstract class ItemEditableComboBoxPanel extends JPanel {
/**
*
*
*/
private static final long serialVersionUID = 1L;
@ -21,37 +21,29 @@ public abstract class ItemEditableComboBoxPanel extends JPanel {
return "";
}
};
protected UIComboBox itemComboBox;
protected UIButton editButton;
protected UIButton refreshButton;
public ItemEditableComboBoxPanel() {
super();
initComponents();
}
protected void initComponents() {
this.setLayout(FRGUIPaneFactory.createM_BorderLayout());
Dimension buttonSize = new Dimension(26, 20);
itemComboBox = new UIComboBox();
itemComboBox.setEnabled(true);
this.add(itemComboBox, BorderLayout.CENTER);
editButton = new UIButton(BaseUtils.readIcon("/com/fr/design/images/control/control-center2.png"));
refreshButton = new UIButton(BaseUtils.readIcon("/com/fr/design/images/control/refresh.png"));
JPanel jPanel = FRGUIPaneFactory.createNColumnGridInnerContainer_Pane(2, 4 ,4);
editButton = initEditButton(editButton, buttonSize);
jPanel.add(editButton);
jPanel.add(refreshButton);
this.add(jPanel, BorderLayout.EAST);
Dimension buttonSize = new Dimension(26, 20);
editButton.setPreferredSize(buttonSize);
editButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
editItems();
}
});
refreshButton.setPreferredSize(buttonSize);
refreshButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
@ -59,32 +51,44 @@ public abstract class ItemEditableComboBoxPanel extends JPanel {
}
});
}
protected UIButton initEditButton(UIButton editButton, Dimension buttonSize) {
editButton = new UIButton(BaseUtils.readIcon("/com/fr/design/images/control/control-center2.png"));
editButton.setPreferredSize(buttonSize);
editButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
editItems();
}
});
return editButton;
}
/**
* 给itemComboBox添加ActionListener
*/
public void addComboBoxActionListener(ActionListener l) {
itemComboBox.addActionListener(l);
}
/*
* 刷新itemComboBox的内容
*/
protected void refreshItems() {
// 记录原来选中的Item,重新加载后需要再次选中
Object lastSelectedItem = itemComboBox.getSelectedItem();
DefaultComboBoxModel model = ((DefaultComboBoxModel) itemComboBox.getModel());
model.removeAllElements();
// 先加EMPTY,再加items
model.addElement(EMPTY);
java.util.Iterator<String> itemIt = items();
while(itemIt.hasNext()) {
model.addElement(itemIt.next());
}
// 再次选中之前选中的Item
int idx = model.getIndexOf(lastSelectedItem);
if(idx < 0) {
@ -92,16 +96,16 @@ public abstract class ItemEditableComboBoxPanel extends JPanel {
}
itemComboBox.setSelectedIndex(idx);
}
/*
* 得到其中的itemComboBox所选中的Item
*/
public String getSelectedItem() {
Object selected = itemComboBox.getSelectedItem();
return selected instanceof String ? (String)selected : null;
}
/*
* 选中name项
*/
@ -109,14 +113,14 @@ public abstract class ItemEditableComboBoxPanel extends JPanel {
DefaultComboBoxModel model = ((DefaultComboBoxModel) itemComboBox.getModel());
model.setSelectedItem(name);
}
/*
* 刷新ComboBox.items
*/
protected abstract java.util.Iterator<String> items();
/*
* 弹出对话框编辑Items
*/
protected abstract void editItems();
}
}

25
designer-base/src/main/java/com/fr/design/editlock/ConnectionLockChangeChecker.java

@ -0,0 +1,25 @@
package com.fr.design.editlock;
import com.fr.report.LockItem;
/**
* @author Yvan
* @version 10.0
* Created by Yvan on 2021/1/20
* 定义数据连接的checker
*/
public class ConnectionLockChangeChecker extends EditLockChangeChecker{
private static class Holder {
private static final ConnectionLockChangeChecker INSTANCE = new ConnectionLockChangeChecker();
}
public static ConnectionLockChangeChecker getInstance() {
return ConnectionLockChangeChecker.Holder.INSTANCE;
}
public ConnectionLockChangeChecker() {
this.lockItem = LockItem.CONNECTION;
}
}

85
designer-base/src/main/java/com/fr/design/editlock/EditLockChangeChecker.java

@ -0,0 +1,85 @@
package com.fr.design.editlock;
import com.fr.concurrent.NamedThreadFactory;
import com.fr.design.ui.util.UIUtil;
import com.fr.log.FineLoggerFactory;
import com.fr.workspace.WorkContext;
import com.fr.workspace.server.lock.editlock.EditLockOperator;
import com.fr.report.LockItem;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
/**
* @author Yvan
* @version 10.0
* Created by Yvan on 2021/1/19
* 判断当前设计器在远程设计服务器中的锁状态是否发生了改变
*/
public abstract class EditLockChangeChecker {
private static final int INTERVAL = 30000;
private ScheduledExecutorService scheduler;
protected LockItem lockItem;
private boolean isLocked = false;
private List<EditLockChangeListener> listeners = new ArrayList<>();
/**
* 轮询任务如果是远程设计状态每隔30s查询一次相应lockItem的锁状态是否改变
*/
public void start() {
this.scheduler = Executors.newSingleThreadScheduledExecutor(new NamedThreadFactory("EditLockChangeChecker"));
this.scheduler.scheduleAtFixedRate(new Runnable() {
@Override
public void run() {
// 判断是否为远程设计环境
if (!WorkContext.getCurrent().isLocal()) {
try {
EditLockOperator operator = WorkContext.getCurrent().get(EditLockOperator.class);
boolean locked = operator.isLocked(lockItem);
if (isLocked() != locked) {
setLocked(locked);
fireChange();
}
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
} else if (isLocked()){
// 如果不是远程环境,且此前的远程状态下为锁定的话,切换回来后需要将其修改为不锁定
setLocked(false);
fireChange();
}
}
}, 0, INTERVAL, TimeUnit.MILLISECONDS);
}
public void stop() {
this.scheduler.shutdown();
}
public void addEditLockChangeListener(EditLockChangeListener listener) {
this.listeners.add(listener);
}
private void fireChange() {
UIUtil.invokeLaterIfNeeded(new Runnable() {
@Override
public void run() {
for (EditLockChangeListener listener : EditLockChangeChecker.this.listeners) {
listener.updateLockedState(new EditLockChangeEvent(isLocked()));
}
}
});
}
public boolean isLocked() {
return this.isLocked;
}
public void setLocked(boolean locked) {
this.isLocked = locked;
}
}

25
designer-base/src/main/java/com/fr/design/editlock/EditLockChangeEvent.java

@ -0,0 +1,25 @@
package com.fr.design.editlock;
import java.util.EventObject;
/**
* @author Yvan
* @version 10.0
* Created by Yvan on 2021/1/20
*/
public class EditLockChangeEvent extends EventObject {
private boolean isLocked;
/**
* @param source 锁状态发生了改变且当前锁状态就是source
*/
public EditLockChangeEvent(boolean source) {
super(source);
this.isLocked = source;
}
public boolean isLocked() {
return isLocked;
}
}

16
designer-base/src/main/java/com/fr/design/editlock/EditLockChangeListener.java

@ -0,0 +1,16 @@
package com.fr.design.editlock;
import java.util.EventListener;
/**
* @author Yvan
* @version 10.0
* Created by Yvan on 2021/1/20
*/
public interface EditLockChangeListener extends EventListener {
/**
* 锁定状态改变后执行的动作
* @param event 事件
*/
void updateLockedState(EditLockChangeEvent event);
}

87
designer-base/src/main/java/com/fr/design/editlock/EditLockUtils.java

@ -0,0 +1,87 @@
package com.fr.design.editlock;
import com.fr.base.svg.IconUtils;
import com.fr.base.svg.SVGLoader;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.DesignerContext;
import com.fr.general.IOUtils;
import com.fr.workspace.WorkContext;
import com.fr.workspace.server.lock.editlock.EditLockOperator;
import com.fr.report.LockItem;
import org.jetbrains.annotations.Nullable;
import javax.swing.Icon;
import javax.swing.JOptionPane;
import javax.swing.SwingUtilities;
import java.awt.Component;
import java.awt.Image;
/**
* @author Yvan
* @version 10.0
* Created by Yvan on 2021/1/20
* 关于编辑锁定的一些常量和静态方法
*/
public class EditLockUtils {
/**
* 数据连接锁定标志
*/
public static final Icon CONNECTION_LOCKED_ICON = IconUtils.readIcon("/com/fr/design/images/m_web/connection_locked");
/**
* 小锁图片
*/
public static final @Nullable Image LOCKED_IMAGE = SVGLoader.load("/com/fr/design/images/m_web/locked_normal.svg");
/**
* 提示弹窗中的提示标志
*/
public static final Icon TOOLTIPS_ICON = IOUtils.readIcon("/com/fr/design/images/m_web/warningIcon.png");
/**
* 数据连接锁定中
*/
public static final String CONNECTION_LOCKED_TOOLTIPS = Toolkit.i18nText("Fine_Designer_Remote_Design_Data_Connection_Locked");
/**
* 服务器数据集锁定中
*/
public static final String SERVER_TABLEDATA_LOCKED_TOOLTIPS = Toolkit.i18nText("Fine_Designer_Remote_Design_Server_TableData_Locked");
/**
* 提示弹窗中的提示信息
*/
public static final String LOCKED_MESSAGE = Toolkit.i18nText("Fine_Designer_Remote_Design_Locked_Message");
/**
* 提示弹窗中的标题
*/
public static final String TOOLTIPS = Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Title_Hint");
/**
* 已经被锁跳出弹窗提示
*/
public static void showLockMessage() {
FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), EditLockUtils.LOCKED_MESSAGE, EditLockUtils.TOOLTIPS, JOptionPane.INFORMATION_MESSAGE, EditLockUtils.TOOLTIPS_ICON);
}
public static void showLockMessage(Component parentComponent) {
FineJOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(parentComponent), EditLockUtils.LOCKED_MESSAGE, EditLockUtils.TOOLTIPS, JOptionPane.INFORMATION_MESSAGE, EditLockUtils.TOOLTIPS_ICON);
}
public static boolean lock(LockItem lockItem) {
return WorkContext.getCurrent().get(EditLockOperator.class).lock(lockItem);
}
public static boolean unlock(LockItem lockItem) {
return WorkContext.getCurrent().get(EditLockOperator.class).unlock(lockItem);
}
public static boolean isLocked(LockItem lockItem) {
EditLockOperator operator = WorkContext.getCurrent().get(EditLockOperator.class);
// 启动过程中UILockButton初始化的时候会调用这个方法,但是此时workObjectPool中还没有对象,会报npe
return operator != null && operator.isLocked(lockItem);
}
}

23
designer-base/src/main/java/com/fr/design/editlock/ServerTableDataLockChangeChecker.java

@ -0,0 +1,23 @@
package com.fr.design.editlock;
import com.fr.report.LockItem;
/**
* @author Yvan
* @version 10.0
* Created by Yvan on 2021/1/20
* 服务器数据集的checker
*/
public class ServerTableDataLockChangeChecker extends EditLockChangeChecker{
private static class Holder {
private static final ServerTableDataLockChangeChecker INSTANCE = new ServerTableDataLockChangeChecker();
}
public static ServerTableDataLockChangeChecker getInstance() {
return ServerTableDataLockChangeChecker.Holder.INSTANCE;
}
public ServerTableDataLockChangeChecker() {
this.lockItem = LockItem.SERVER_TABLE_DATA;
}
}

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

@ -6,8 +6,12 @@ import com.fr.config.MarketConfig;
import com.fr.design.dialog.UIDialog;
import com.fr.design.extra.exe.PluginLoginExecutor;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.locale.impl.BbsRegisterMark;
import com.fr.design.locale.impl.BbsResetMark;
import com.fr.general.CloudCenter;
import com.fr.general.http.HttpClient;
import com.fr.general.locale.LocaleCenter;
import com.fr.general.locale.LocaleMark;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils;
import javafx.concurrent.Task;
@ -118,7 +122,8 @@ public class LoginWebBridge {
*/
public void registerHref() {
try {
Desktop.getDesktop().browse(new URI(CloudCenter.getInstance().acquireUrlByKind("bbs.register")));
LocaleMark<String> registerMark = LocaleCenter.getMark(BbsRegisterMark.class);
Desktop.getDesktop().browse(new URI(registerMark.getValue()));
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
@ -129,7 +134,8 @@ public class LoginWebBridge {
*/
public void forgetHref() {
try {
Desktop.getDesktop().browse(new URI(CloudCenter.getInstance().acquireUrlByKind("bbs.reset")));
LocaleMark<String> resetMark = LocaleCenter.getMark(BbsResetMark.class);
Desktop.getDesktop().browse(new URI(resetMark.getValue()));
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}

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

@ -13,8 +13,13 @@ import com.fr.design.extra.exe.PluginLoginExecutor;
import com.fr.design.extra.exe.ReadUpdateOnlineExecutor;
import com.fr.design.extra.exe.SearchOnlineExecutor;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.locale.impl.BbsRegisterMark;
import com.fr.design.locale.impl.BbsResetMark;
import com.fr.design.locale.impl.BbsSpaceMark;
import com.fr.design.utils.concurrent.ThreadFactoryBuilder;
import com.fr.general.CloudCenter;
import com.fr.general.locale.LocaleCenter;
import com.fr.general.locale.LocaleMark;
import com.fr.json.JSONObject;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.context.PluginMarker;
@ -434,8 +439,8 @@ public class PluginWebBridge {
*/
public void getPriviteMessage() {
try {
String loginUrl = CloudCenter.getInstance().acquireUrlByKind("bbs.default");
Desktop.getDesktop().browse(new URI(loginUrl));
LocaleMark<String> spaceMark = LocaleCenter.getMark(BbsSpaceMark.class);
Desktop.getDesktop().browse(new URI(spaceMark.getValue()));
} catch (Exception exp) {
FineLoggerFactory.getLogger().info(exp.getMessage());
}
@ -497,7 +502,8 @@ public class PluginWebBridge {
*/
public void registerHref() {
try {
Desktop.getDesktop().browse(new URI(CloudCenter.getInstance().acquireUrlByKind("bbs.register")));
LocaleMark<String> registerMark = LocaleCenter.getMark(BbsRegisterMark.class);
Desktop.getDesktop().browse(new URI(registerMark.getValue()));
} catch (Exception e) {
FineLoggerFactory.getLogger().info(e.getMessage());
}
@ -511,7 +517,8 @@ public class PluginWebBridge {
*/
public void forgetHref() {
try {
Desktop.getDesktop().browse(new URI(CloudCenter.getInstance().acquireUrlByKind("bbs.reset")));
LocaleMark<String> resetMark = LocaleCenter.getMark(BbsResetMark.class);
Desktop.getDesktop().browse(new URI(resetMark.getValue()));
} catch (Exception e) {
FineLoggerFactory.getLogger().info(e.getMessage());
}

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

@ -44,40 +44,32 @@ public class InstallFromDiskCallback extends AbstractPluginTaskCallback {
FineLoggerFactory.getLogger().info(successInfo);
FineJOptionPane.showMessageDialog(null, successInfo);
} else if (result.errorCode() == PluginErrorCode.NeedDealWithPluginDependency) {
int rv = FineJOptionPane.showOptionDialog(
int rv = FineJOptionPane.showConfirmDialog(
null,
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Install_Dependence"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"),
FineJOptionPane.YES_NO_CANCEL_OPTION,
FineJOptionPane.INFORMATION_MESSAGE,
null,
FineJOptionPane.OPTION_YES_NO_CANCEL,
null
Toolkit.i18nText("Fine-Design_Basic_Plugin_Install_Dependence"),
Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"),
FineJOptionPane.OK_CANCEL_OPTION,
FineJOptionPane.INFORMATION_MESSAGE
);
if (rv == FineJOptionPane.NO_OPTION || rv == FineJOptionPane.CANCEL_OPTION || rv == FineJOptionPane.CLOSED_OPTION) {
return;
if (rv == FineJOptionPane.OK_OPTION) {
List<PluginTask> pluginTasks = result.getPreTasks();
for(PluginTask pluginTask : pluginTasks){
PluginMarker marker = pluginTask.getMarker();
PluginOperateUtils.installPluginOnline(marker, jsCallback);
}
PluginManager.getController().install(zipFile, new InstallFromDiskCallback(zipFile, jsCallback));
}
List<PluginTask> pluginTasks = result.getPreTasks();
for(PluginTask pluginTask : pluginTasks){
PluginMarker marker = pluginTask.getMarker();
PluginOperateUtils.installPluginOnline(marker, jsCallback);
}
PluginManager.getController().install(zipFile, new InstallFromDiskCallback(zipFile, jsCallback));
} else if(result.errorCode() == PluginErrorCode.HasLowerPluginWhenInstall){
int rv = FineJOptionPane.showOptionDialog(
int rv = FineJOptionPane.showConfirmDialog(
null,
Toolkit.i18nText("Fine-Design_Basic_Plugin_Has_Install_Lower"),
Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"),
FineJOptionPane.YES_NO_CANCEL_OPTION,
FineJOptionPane.INFORMATION_MESSAGE,
null,
FineJOptionPane.OPTION_YES_NO_CANCEL,
null
FineJOptionPane.OK_CANCEL_OPTION,
FineJOptionPane.INFORMATION_MESSAGE
);
if (rv == FineJOptionPane.NO_OPTION || rv == FineJOptionPane.CANCEL_OPTION || rv == FineJOptionPane.CLOSED_OPTION) {
return;
if (rv == FineJOptionPane.OK_OPTION) {
PluginOperateUtils.updatePluginFromDisk(zipFile, jsCallback);
}
PluginOperateUtils.updatePluginFromDisk(zipFile, jsCallback);
}else {
jsCallback.execute("failed");
FineLoggerFactory.getLogger().info(Toolkit.i18nText("Fine-Design_Basic_Plugin_Install_Failed"));

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

@ -41,22 +41,20 @@ public class InstallOnlineCallback extends AbstractDealPreTaskCallback {
FineLoggerFactory.getLogger().info(successInfo);
FineJOptionPane.showMessageDialog(null, successInfo);
} else if(result.errorCode() == PluginErrorCode.HasLowerPluginWhenInstall){
int rv = FineJOptionPane.showOptionDialog(
int rv = FineJOptionPane.showConfirmDialog(
null,
Toolkit.i18nText("Fine-Design_Basic_Plugin_Has_Install_Lower"),
Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"),
FineJOptionPane.YES_NO_CANCEL_OPTION,
FineJOptionPane.INFORMATION_MESSAGE,
null,
FineJOptionPane.OPTION_YES_NO_CANCEL,
null
FineJOptionPane.OK_CANCEL_OPTION,
FineJOptionPane.INFORMATION_MESSAGE
);
if (rv == FineJOptionPane.NO_OPTION || rv == FineJOptionPane.CANCEL_OPTION || rv == FineJOptionPane.CLOSED_OPTION) {
if (rv == FineJOptionPane.OK_OPTION) {
PluginMarker pluginMarker = result.getCurrentTask().getMarker();
PluginOperateUtils.updatePluginOnline(pluginMarker, jsCallback);
}
else {
jsCallback.execute("success");
return;
}
PluginMarker pluginMarker = result.getCurrentTask().getMarker();
PluginOperateUtils.updatePluginOnline(pluginMarker, jsCallback);
} else {
jsCallback.execute("failed");
FineLoggerFactory.getLogger().info(Toolkit.i18nText("Fine-Design_Basic_Plugin_Install_Failed"));

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

@ -31,20 +31,16 @@ public class UninstallPluginCallback extends AbstractPluginTaskCallback {
FineLoggerFactory.getLogger().info(successInfo);
FineJOptionPane.showMessageDialog(null, successInfo);
}else if (result.errorCode() == PluginErrorCode.NeedUninstallDependingPluginFirst) {
int rv = FineJOptionPane.showOptionDialog(
int rv = FineJOptionPane.showConfirmDialog(
null,
Toolkit.i18nText("Fine-Design_Basic_Plugin_Delete_Dependence"),
Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"),
FineJOptionPane.YES_NO_CANCEL_OPTION,
FineJOptionPane.INFORMATION_MESSAGE,
null,
FineJOptionPane.OPTION_YES_NO_CANCEL,
null
FineJOptionPane.OK_CANCEL_OPTION,
FineJOptionPane.INFORMATION_MESSAGE
);
if (rv == FineJOptionPane.CANCEL_OPTION || rv == FineJOptionPane.CLOSED_OPTION) {
return;
if (rv == FineJOptionPane.OK_OPTION) {
PluginManager.getController().uninstall(pluginMarker, true, new UninstallPluginCallback(pluginMarker, jsCallback));
}
PluginManager.getController().uninstall(pluginMarker, true, new UninstallPluginCallback(pluginMarker, jsCallback));
} else {
jsCallback.execute("failed");
FineLoggerFactory.getLogger().info(Toolkit.i18nText("Fine-Design_Basic_Plugin_Delete_Failed"));

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

@ -43,40 +43,32 @@ public class UpdateFromDiskCallback extends AbstractPluginTaskCallback {
FineLoggerFactory.getLogger().info(successInfo);
FineJOptionPane.showMessageDialog(null, successInfo);
} else if (result.errorCode() == PluginErrorCode.NeedDealWithPluginDependency) {
int rv = FineJOptionPane.showOptionDialog(
int rv = FineJOptionPane.showConfirmDialog(
null,
Toolkit.i18nText("Fine-Design_Basic_Plugin_Update_Dependence"),
Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"),
FineJOptionPane.YES_NO_CANCEL_OPTION,
FineJOptionPane.INFORMATION_MESSAGE,
null,
FineJOptionPane.OPTION_YES_NO_CANCEL,
null
FineJOptionPane.OK_CANCEL_OPTION,
FineJOptionPane.INFORMATION_MESSAGE
);
if (rv == FineJOptionPane.NO_OPTION || rv == FineJOptionPane.CANCEL_OPTION || rv == FineJOptionPane.CLOSED_OPTION) {
return;
}
List<PluginTask> pluginTasks = result.getPreTasks();
for(PluginTask pluginTask : pluginTasks){
PluginMarker marker = pluginTask.getMarker();
PluginOperateUtils.updatePluginOnline(marker, jsCallback);
if (rv == FineJOptionPane.OK_OPTION) {
List<PluginTask> pluginTasks = result.getPreTasks();
for(PluginTask pluginTask : pluginTasks){
PluginMarker marker = pluginTask.getMarker();
PluginOperateUtils.updatePluginOnline(marker, jsCallback);
}
PluginManager.getController().update(zipFile, new UpdateFromDiskCallback(zipFile, jsCallback));
}
PluginManager.getController().update(zipFile, new UpdateFromDiskCallback(zipFile, jsCallback));
} else if(result.errorCode() == PluginErrorCode.NoPluginToUpdate){
int rv = FineJOptionPane.showOptionDialog(
int rv = FineJOptionPane.showConfirmDialog(
null,
Toolkit.i18nText("Fine-Design_Basic_Plugin_No_Plugin_Update"),
Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"),
FineJOptionPane.YES_NO_CANCEL_OPTION,
FineJOptionPane.INFORMATION_MESSAGE,
null,
FineJOptionPane.OPTION_YES_NO_CANCEL,
null
FineJOptionPane.OK_CANCEL_OPTION,
FineJOptionPane.INFORMATION_MESSAGE
);
if (rv == FineJOptionPane.NO_OPTION || rv == FineJOptionPane.CANCEL_OPTION || rv == FineJOptionPane.CLOSED_OPTION) {
return;
if (rv == FineJOptionPane.OK_OPTION) {
PluginOperateUtils.installPluginFromDisk(zipFile, jsCallback);
}
PluginOperateUtils.installPluginFromDisk(zipFile, jsCallback);
}else {
jsCallback.execute("failed");
FineLoggerFactory.getLogger().info(Toolkit.i18nText("Fine-Design_Basic_Plugin_Update_Failed"));

31
designer-base/src/main/java/com/fr/design/fun/DesignerLifecycleMonitor.java

@ -0,0 +1,31 @@
package com.fr.design.fun;
/**
* 设计器生命周期接口
*
* @author hades
* @version 10.0
* Created by hades on 2021/1/26
*/
public interface DesignerLifecycleMonitor {
String MARK_STRING = "DesignerLifecycleMonitor";
int CURRENT_LEVEL = 1;
/**
* 设计器启动之前
*/
void beforeStart();
/**
* 设计器启动完成 界面出现之后
*/
void afterStart();
/**
* 设计器关闭退出之前
*/
void beforeStop();
}

31
designer-base/src/main/java/com/fr/design/fun/DesignerPortProvider.java

@ -0,0 +1,31 @@
package com.fr.design.fun;
/**
* 设计器所有端口获取
*
* @author hades
* @version 10.0
* Created by hades on 2021/1/18
*/
public interface DesignerPortProvider {
String MARK_STRING = "DesignerPortProvider";
int CURRENT_LEVEL = 1;
/**
* 设计器自身端口
*
* @return
*/
int messagePort();
/**
* 内置服务器端口
*
* @return
*/
int embeddedServerPort();
}

24
designer-base/src/main/java/com/fr/design/gui/frpane/UINumberDragPaneWithPercent.java

@ -0,0 +1,24 @@
package com.fr.design.gui.frpane;
import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.gui.ispinner.chart.UISpinnerWithPercent;
/**
* @author Bjorn
* @version 10.0
* Created by Bjorn on 2021-01-21
*/
public class UINumberDragPaneWithPercent extends UINumberDragPane {
public UINumberDragPaneWithPercent(double minValue, double maxValue) {
super(minValue, maxValue);
}
public UINumberDragPaneWithPercent(double minValue, double maxValue, double dierta) {
super(minValue, maxValue, dierta);
}
protected UISpinner createUISpinner(double minValue, double maxValue, double dierta) {
return new UISpinnerWithPercent(minValue, maxValue, dierta, minValue);
}
}

55
designer-base/src/main/java/com/fr/design/gui/ibutton/UILockButton.java

@ -0,0 +1,55 @@
package com.fr.design.gui.ibutton;
import com.fr.design.editlock.EditLockChangeEvent;
import com.fr.design.editlock.EditLockChangeListener;
import com.fr.design.editlock.EditLockUtils;
import com.fr.report.LockItem;
import javax.swing.Icon;
/**
* @author Yvan
* @version 10.0
* Created by Yvan on 2021/1/20
*/
public class UILockButton extends UIButton implements EditLockChangeListener {
/**
* 锁定状态图标
*/
private Icon lockedIcon;
/**
* 正常状态图标
*/
private Icon normalIcon;
/**
* 锁定状态的提示信息
*/
private String lockedTooltips;
/**
* 正常状态的提示信息
*/
private String normalTooltips;
public UILockButton(Icon lockedIcon, Icon normalIcon, String lockedTooltips, String normalTooltips) {
super();
this.lockedIcon = lockedIcon;
this.normalIcon = normalIcon;
this.lockedTooltips = lockedTooltips;
this.normalTooltips = normalTooltips;
init();
}
private void init() {
boolean locked = EditLockUtils.isLocked(LockItem.CONNECTION);
this.setIcon(locked ? lockedIcon : normalIcon);
this.setToolTipText(locked ? lockedTooltips : normalTooltips);
}
@Override
public void updateLockedState(EditLockChangeEvent event) {
this.setIcon(event.isLocked() ? lockedIcon : normalIcon);
this.setToolTipText(event.isLocked() ? lockedTooltips : normalTooltips);
this.repaint();
}
}

9
designer-base/src/main/java/com/fr/design/gui/icontainer/UIModeControlContainer.java

@ -167,6 +167,9 @@ public class UIModeControlContainer extends JLayeredPane {
// 拖动的距离,为正值表示往下拖动,为负值表示往上拖动
int deltaY = e.getY();
toolPaneY += deltaY;
if (toolPaneY < 0) {
toolPaneY = 0;
}
onResize(toolPaneY);
refreshContainer();
}
@ -241,7 +244,7 @@ public class UIModeControlContainer extends JLayeredPane {
};
protected void onModeChanged() {
//do nothing here
//do nothing here
}
/**
@ -312,7 +315,7 @@ public class UIModeControlContainer extends JLayeredPane {
addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
// do nothing
// do nothing
}
});
}
@ -337,7 +340,7 @@ public class UIModeControlContainer extends JLayeredPane {
@Override
public void layoutContainer(Container parent) {
// do nothing
// do nothing
}
@Override

47
designer-base/src/main/java/com/fr/design/gui/imenu/UILockMenuItem.java

@ -0,0 +1,47 @@
package com.fr.design.gui.imenu;
import com.fr.design.editlock.EditLockChangeEvent;
import com.fr.design.editlock.EditLockChangeListener;
import com.fr.report.LockItem;
import javax.swing.Action;
/**
* @author Yvan
* @version 10.0
* Created by Yvan on 2021/1/20
*/
public class UILockMenuItem extends UIMenuItem implements EditLockChangeListener {
/**
* 锁定状态的提示信息
*/
private String lockedTooltips;
/**
* 正常状态的提示信息
*/
private String normalTooltips;
/**
* 当前锁定项
*/
private LockItem lockItem;
public UILockMenuItem(Action action, String lockedTooltips, String normalTooltips, LockItem lockItem) {
super(action);
this.lockedTooltips = lockedTooltips;
this.normalTooltips = normalTooltips;
this.lockItem = lockItem;
setUI(new UILockMenuItemUI());
}
public LockItem getLockItem() {
return lockItem;
}
@Override
public void updateLockedState(EditLockChangeEvent event) {
this.setToolTipText(event.isLocked() ? lockedTooltips : normalTooltips);
this.repaint();
}
}

28
designer-base/src/main/java/com/fr/design/gui/imenu/UILockMenuItemUI.java

@ -0,0 +1,28 @@
package com.fr.design.gui.imenu;
import com.fr.design.editlock.EditLockUtils;
import javax.swing.JMenuItem;
import java.awt.Graphics;
import java.awt.Rectangle;
/**
* @author Yvan
* @version 10.0
* Created by Yvan on 2021/1/20
*/
public class UILockMenuItemUI extends UIMenuItemUI{
@Override
protected void paintText(Graphics g, JMenuItem menuItem, Rectangle textRect, String text) {
super.paintText(g, menuItem, textRect, text);
// 除了绘制text之外,还需要画一下锁定图标
UILockMenuItem lockMenuItem = (UILockMenuItem) menuItem;
if (EditLockUtils.isLocked(lockMenuItem.getLockItem())) {
int width = menuItem.getWidth();
int height = menuItem.getHeight();
g.drawImage(EditLockUtils.LOCKED_IMAGE, (int) Math.round(width * 0.9), (int) Math.round(height * 0.1), 16, 16, null);
}
}
}

26
designer-base/src/main/java/com/fr/design/gui/ispinner/UISpinner.java

@ -13,15 +13,28 @@ import com.fr.stable.CommonUtils;
import com.fr.stable.Constants;
import com.fr.stable.StringUtils;
import com.fr.stable.collections.utils.MathUtils;
import javax.swing.*;
import javax.swing.ButtonModel;
import javax.swing.Icon;
import javax.swing.JComponent;
import javax.swing.JPanel;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import javax.swing.plaf.ButtonUI;
import java.awt.*;
import java.awt.event.*;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.FocusAdapter;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
import java.awt.event.MouseWheelEvent;
import java.awt.event.MouseWheelListener;
public class UISpinner extends JPanel implements UIObserver, GlobalNameObserver {
@ -46,6 +59,9 @@ public class UISpinner extends JPanel implements UIObserver, GlobalNameObserver
*/
private int numberFieldColumns;
public UISpinner() {
}
public UISpinner(double minValue, double maxValue, double dierta) {
init(minValue, maxValue, dierta);
@ -56,7 +72,7 @@ public class UISpinner extends JPanel implements UIObserver, GlobalNameObserver
textField.setValue(defaultValue);
}
private void init(double minValue, double maxValue, double dierta) {
protected void init(double minValue, double maxValue, double dierta) {
this.minValue = minValue;
this.maxValue = maxValue;
this.dierta = dierta;

15
designer-base/src/main/java/com/fr/design/gui/ispinner/chart/UISpinnerWithPercent.java

@ -0,0 +1,15 @@
package com.fr.design.gui.ispinner.chart;
/**
* @author Bjorn
* @version 10.0
* Created by Bjorn on 2021-01-21
*/
public class UISpinnerWithPercent extends UISpinnerWithUnit {
private static final String UNIT = "%";
public UISpinnerWithPercent(double minValue, double maxValue, double dierta, double defaultValue) {
super(minValue, maxValue, dierta, defaultValue, UNIT);
}
}

20
designer-base/src/main/java/com/fr/design/gui/ispinner/chart/UISpinnerWithPx.java

@ -0,0 +1,20 @@
package com.fr.design.gui.ispinner.chart;
/**
* @author Bjorn
* @version 10.0
* Created by Bjorn on 2021-01-21
*/
public class UISpinnerWithPx extends UISpinnerWithUnit {
private static final String UNIT = "px";
public UISpinnerWithPx(double defaultValue) {
this(0, Double.MAX_VALUE, 1, defaultValue);
}
public UISpinnerWithPx(double minValue, double maxValue, double dierta, double defaultValue) {
super(minValue, maxValue, dierta, defaultValue, UNIT);
this.getTextField().canFillNegativeNumber(false);
}
}

26
designer-base/src/main/java/com/fr/design/gui/ispinner/chart/UISpinnerWithUnit.java

@ -0,0 +1,26 @@
package com.fr.design.gui.ispinner.chart;
import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.gui.itextfield.UINumberField;
import com.fr.design.gui.itextfield.UINumberFieldWithUnit;
/**
* @author Bjorn
* @version 10.0
* Created by Bjorn on 2021-01-20
*/
public class UISpinnerWithUnit extends UISpinner {
private String unit;
public UISpinnerWithUnit(double minValue, double maxValue, double dierta, double defaultValue, String unit) {
this.unit = unit;
init(minValue, maxValue, dierta);
getTextField().setValue(defaultValue);
}
@Override
protected UINumberField initNumberField() {
return new UINumberFieldWithUnit(3, unit);
}
}

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

@ -1,16 +1,15 @@
package com.fr.design.gui.itextfield;
import com.fr.base.Utils;
import com.fr.design.gui.ilable.UILabel;
import com.fr.general.ComparatorUtils;
import com.fr.stable.CoreConstants;
import com.fr.stable.StringUtils;
import javax.swing.*;
import javax.swing.text.AttributeSet;
import javax.swing.text.BadLocationException;
import javax.swing.text.PlainDocument;
import java.awt.*;
import java.awt.Dimension;
import java.awt.Toolkit;
/**
* Number Field.
@ -193,7 +192,6 @@ public class UINumberField extends UITextField {
if (!fillNegativeNumber && strNew.contains("-")) {
return true;
}
boolean noChange = false;
boolean isMinus = strNew.startsWith("-");
strNew = strNew.replaceFirst("-", StringUtils.EMPTY); // 控制能输入负数
String strIntPart;
@ -207,25 +205,27 @@ public class UINumberField extends UITextField {
}
if (isOverMaxOrMinValue(strIntPart, strDecPart, strNew)) {
Toolkit.getDefaultToolkit().beep();
noChange = true;
return true;
}
return checkNumber(strNew, isMinus);
}
protected boolean checkNumber(String strValue, boolean isMinus) {
try {
if (!ComparatorUtils.equals(strNew, StringUtils.EMPTY) && !ComparatorUtils.equals(strNew, "-")) {// 控制能输入负数
double d = Double.parseDouble(strNew) * (isMinus ? -1 : 1);
if (!ComparatorUtils.equals(strValue, StringUtils.EMPTY) && !ComparatorUtils.equals(strValue, "-")) {// 控制能输入负数
double d = Double.parseDouble(strValue) * (isMinus ? -1 : 1);
if (d < minValue || d > maxValue) {
throw new Exception();
}
}
} catch (Exception e) {
Toolkit.getDefaultToolkit().beep();
noChange = true;
return true;
}
return noChange;
return false;
}
private boolean isOverMaxOrMinValue(String strIntPart, String strDecPart, String strNew) {
protected boolean isOverMaxOrMinValue(String strIntPart, String strDecPart, String strNew) {
boolean checkLength = strIntPart.length() > maxIntegerLength
|| strDecPart.length() > maxDecimalLength;
return checkLength || (strNew.length() > 1 && ComparatorUtils.equals(strNew.substring(0, 1), "0") && !ComparatorUtils.equals(strNew.substring(1, 2), "."));

114
designer-base/src/main/java/com/fr/design/gui/itextfield/UINumberFieldWithUnit.java

@ -0,0 +1,114 @@
package com.fr.design.gui.itextfield;
import com.fr.base.Utils;
import com.fr.general.ComparatorUtils;
import com.fr.stable.StringUtils;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
import java.awt.Toolkit;
/**
* @author Bjorn
* @version 10.0
* Created by Bjorn on 2021-01-20
* 这个控件不会限制输入的数字大小但是同样不允许输入数字之外的字符
*/
public class UINumberFieldWithUnit extends UINumberField {
private String unit;
private List<String> unitList = new ArrayList<>();
public UINumberFieldWithUnit(int columns, String unit) {
super(columns);
this.unit = unit;
initUnitList();
}
//对单位的字符进行组合
private void initUnitList() {
char[] chars = unit.toCharArray();
Set<String> set = new LinkedHashSet<>();
initUnitList(chars, 0, StringUtils.EMPTY, set);
unitList.addAll(set);
Collections.sort(unitList, Comparator.comparing(String::length));
}
private void initUnitList(char[] chars, int index, String str, Set<String> set) {
if (index == chars.length) {
return;
}
for (int i = index; i < chars.length; i++) {
String newStr = str + chars[i];
set.add(newStr);
initUnitList(chars, i + 1, newStr, set);
}
}
public void setFieldDocument() {
setDocument(new NumberDocumentNoLimit());
}
public void setValue(double value) {
this.setText(Utils.doubleToString(value) + unit);
}
public double getValue() throws NumberFormatException {
try {
String text = this.getText();
if (StringUtils.isEmpty(text)) {
return 0;
}
return Double.parseDouble(text.replace(getEndString(text), StringUtils.EMPTY));
} catch (NumberFormatException numberFormatException) {
return UINumberField.ERROR_VALUE;
}
}
private String getEndString(String text) {
int size = unitList.size();
for (int i = size - 1; i >= 0; i--) {
String unit = unitList.get(i);
if (text.endsWith(unit)) {
return unit;
}
}
return StringUtils.EMPTY;
}
class NumberDocumentNoLimit extends NumberDocument {
public boolean checkString(int offset, String s, String str) {
return (ComparatorUtils.equals(s, "F")
|| ComparatorUtils.equals(s, "f")
|| ComparatorUtils.equals(s, "D")
|| ComparatorUtils.equals(s, "d")
|| (ComparatorUtils.equals(s, ".") && getMaxDecimalLength() == 0));
}
protected boolean isOverMaxOrMinValue(String strIntPart, String strDecPart, String strNew) {
return super.isOverMaxOrMinValue(strIntPart, strDecPart, strNew.replaceFirst(getEndString(strNew), StringUtils.EMPTY));
}
protected boolean checkNumber(String strValue, boolean isMinus) {
try {
if (ComparatorUtils.equals(strValue, StringUtils.EMPTY) || ComparatorUtils.equals(strValue, "-")) {
return false;
}
Double.parseDouble(strValue.replaceFirst(getEndString(strValue), StringUtils.EMPTY));
} catch (Exception e) {
Toolkit.getDefaultToolkit().beep();
return true;
}
return false;
}
}
}

6
designer-base/src/main/java/com/fr/design/gui/style/FormatPane.java

@ -6,6 +6,7 @@ import com.fr.base.Style;
import com.fr.base.TextFormat;
import com.fr.data.core.FormatField;
import com.fr.data.core.FormatField.FormatContents;
import com.fr.design.event.UIObserverListener;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.i18n.Toolkit;
import com.fr.design.border.UIRoundedBorder;
@ -469,6 +470,11 @@ public class FormatPane extends AbstractBasicStylePane implements GlobalNameObse
globalNameListener = listener;
}
public void registerChangeListener(UIObserverListener listener) {
typeComboBox.registerChangeListener(listener);
textField.registerChangeListener(listener);
}
@Override
public boolean shouldResponseNameListener() {
return false;

38
designer-base/src/main/java/com/fr/design/locale/impl/BbsRegisterMark.java

@ -0,0 +1,38 @@
package com.fr.design.locale.impl;
import com.fr.general.CloudCenter;
import com.fr.general.GeneralContext;
import com.fr.general.locale.LocaleMark;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
/**
* @author hades
* @version 10.0
* Created by hades on 2021/1/29
*/
public class BbsRegisterMark implements LocaleMark<String> {
private final Map<Locale, String> map = new HashMap<>();
private static final String BBS_REGISTER_CN = CloudCenter.getInstance().acquireUrlByKind("bbs.register");
private static final String BBS_REGISTER_TW = CloudCenter.getInstance().acquireUrlByKind("bbs.register");
private static final String BBS_REGISTER_EN = CloudCenter.getInstance().acquireUrlByKind("bbs.register.en_US");
private static final String BBS_REGISTER_KR = CloudCenter.getInstance().acquireUrlByKind("bbs.register.en_US");
private static final String BBS_REGISTER_JP = CloudCenter.getInstance().acquireUrlByKind("bbs.register.en_US");
public BbsRegisterMark() {
map.put(Locale.CHINA, BBS_REGISTER_CN);
map.put(Locale.KOREA, BBS_REGISTER_KR);
map.put(Locale.JAPAN, BBS_REGISTER_JP);
map.put(Locale.US, BBS_REGISTER_EN);
map.put(Locale.TAIWAN, BBS_REGISTER_TW);
}
@Override
public String getValue() {
String result = map.get(GeneralContext.getLocale());
return result == null ? BBS_REGISTER_EN : result;
}
}

38
designer-base/src/main/java/com/fr/design/locale/impl/BbsResetMark.java

@ -0,0 +1,38 @@
package com.fr.design.locale.impl;
import com.fr.general.CloudCenter;
import com.fr.general.GeneralContext;
import com.fr.general.locale.LocaleMark;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
/**
* @author hades
* @version 10.0
* Created by hades on 2021/1/29
*/
public class BbsResetMark implements LocaleMark<String> {
private final Map<Locale, String> map = new HashMap<>();
private static final String BBS_RESET_CN = CloudCenter.getInstance().acquireUrlByKind("bbs.reset");
private static final String BBS_RESET_TW = CloudCenter.getInstance().acquireUrlByKind("bbs.reset");
private static final String BBS_RESET_EN = CloudCenter.getInstance().acquireUrlByKind("bbs.reset.en_US");
private static final String BBS_RESET_KR = CloudCenter.getInstance().acquireUrlByKind("bbs.reset.en_US");
private static final String BBS_RESET_JP = CloudCenter.getInstance().acquireUrlByKind("bbs.reset.en_US");
public BbsResetMark() {
map.put(Locale.CHINA, BBS_RESET_CN);
map.put(Locale.KOREA, BBS_RESET_KR);
map.put(Locale.JAPAN, BBS_RESET_JP);
map.put(Locale.US, BBS_RESET_EN);
map.put(Locale.TAIWAN, BBS_RESET_TW);
}
@Override
public String getValue() {
String result = map.get(GeneralContext.getLocale());
return result == null ? BBS_RESET_EN : result;
}
}

39
designer-base/src/main/java/com/fr/design/locale/impl/BbsSpaceMark.java

@ -0,0 +1,39 @@
package com.fr.design.locale.impl;
import com.fr.general.CloudCenter;
import com.fr.general.GeneralContext;
import com.fr.general.locale.LocaleMark;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
/**
* @author hades
* @version 10.0
* Created by hades on 2021/1/29
*/
public class BbsSpaceMark implements LocaleMark<String> {
private final Map<Locale, String> map = new HashMap<>();
private static final String BBS_SPACE_CN = CloudCenter.getInstance().acquireUrlByKind("bbs.default");
private static final String BBS_SPACE_TW = CloudCenter.getInstance().acquireUrlByKind("bbs.default");
private static final String BBS_SPACE_EN = CloudCenter.getInstance().acquireUrlByKind("bbs.default.en_US");
private static final String BBS_SPACE_KR = CloudCenter.getInstance().acquireUrlByKind("bbs.default.en_US");
private static final String BBS_SPACE_JP = CloudCenter.getInstance().acquireUrlByKind("bbs.default.en_US");
public BbsSpaceMark() {
map.put(Locale.CHINA, BBS_SPACE_CN);
map.put(Locale.KOREA, BBS_SPACE_KR);
map.put(Locale.JAPAN, BBS_SPACE_JP);
map.put(Locale.US, BBS_SPACE_EN);
map.put(Locale.TAIWAN, BBS_SPACE_TW);
}
@Override
public String getValue() {
String result = map.get(GeneralContext.getLocale());
return result == null ? BBS_SPACE_EN : result;
}
}

47
designer-base/src/main/java/com/fr/design/monitor/DesignerLifecycleMonitorContext.java

@ -0,0 +1,47 @@
package com.fr.design.monitor;
import com.fr.design.fun.DesignerLifecycleMonitor;
import com.fr.stable.bridge.StableFactory;
/**
* @author hades
* @version 10.0
* Created by hades on 2021/1/27
*/
public class DesignerLifecycleMonitorContext {
private static DesignerLifecycleMonitor monitor;
static {
DesignerLifecycleMonitor designerLifecycleMonitor = StableFactory.getMarkedInstanceObjectFromClass(DesignerLifecycleMonitor.MARK_STRING, DesignerLifecycleMonitor.class);
if (designerLifecycleMonitor != null) {
monitor = designerLifecycleMonitor;
} else {
monitor = new EmptyDesignerLifecycleMonitor();
}
}
public static DesignerLifecycleMonitor getMonitor() {
return monitor;
}
static class EmptyDesignerLifecycleMonitor implements DesignerLifecycleMonitor {
@Override
public void beforeStart() {
}
@Override
public void afterStart() {
}
@Override
public void beforeStop() {
}
}
}

14
designer-base/src/main/java/com/fr/design/os/impl/DatabaseDialogAction.java

@ -1,18 +1,17 @@
package com.fr.design.os.impl;
import com.fr.config.ServerPreferenceConfig;
import com.fr.design.data.datapane.connect.ConnectionManagerPane;
import com.fr.design.dcm.UniversalDatabaseOpener;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.editlock.EditLockUtils;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.DesignerFrame;
import com.fr.file.ConnectionConfig;
import com.fr.stable.os.OperatingSystem;
import com.fr.stable.os.support.OSBasedAction;
import com.fr.transaction.CallBackAdaptor;
import com.fr.transaction.Configurations;
import com.fr.transaction.WorkerFacade;
import com.fr.report.LockItem;
import static com.fr.design.actions.server.ConnectionListAction.doWithDatasourceManager;
/**
@ -68,9 +67,18 @@ public class DatabaseDialogAction implements OSBasedAction {
@Override
public void afterCommit() {
DesignerContext.getDesignerBean("databasename").refreshBeanElement();
// 定义数据连接弹窗关闭后,解锁
EditLockUtils.unlock(LockItem.CONNECTION);
}
}));
}
@Override
public void doCancel() {
super.doCancel();
// 定义数据连接弹窗关闭后,解锁
EditLockUtils.unlock(LockItem.CONNECTION);
}
});
databaseListDialog.setVisible(true);
}

32
designer-base/src/main/java/com/fr/design/port/DesignerPortContext.java

@ -0,0 +1,32 @@
package com.fr.design.port;
import com.fr.design.fun.DesignerPortProvider;
import com.fr.stable.bridge.StableFactory;
/**
* @author hades
* @version 10.0
* Created by hades on 2021/1/27
*/
public class DesignerPortContext {
private static int messagePort = -1;
private static int embeddedServerPort = -1;
static {
DesignerPortProvider designerPortProvider = StableFactory.getMarkedInstanceObjectFromClass(DesignerPortProvider.MARK_STRING, DesignerPortProvider.class);
if (designerPortProvider != null) {
messagePort = designerPortProvider.messagePort();
embeddedServerPort = designerPortProvider.embeddedServerPort();
}
}
public static int getMessagePort() {
return messagePort;
}
public static int getEmbeddedServerPort() {
return embeddedServerPort;
}
}

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

@ -206,6 +206,10 @@ public class ColorAdjustPane extends JPanel implements UIObserver {
public void setVisible(boolean b) {
super.setVisible(b);
}
protected boolean selectRealTime() {
return false;
}
};
colorPane.addChangeListener(new ChangeListener() {
public void stateChanged(ChangeEvent e) {

6
designer-base/src/main/java/com/fr/design/style/color/ColorSelectPane.java

@ -115,12 +115,16 @@ public class ColorSelectPane extends TransparentPane implements ColorSelectable
row1Pane.setPreferredSize(new Dimension(135, 24)); // 宽度为 16 * 8 + 7
// 最近使用
UsedColorPane usedColorPane = new UsedColorPane(1, 8, 1, this, true, true);
UsedColorPane usedColorPane = new UsedColorPane(1, 8, 1, this, true, selectRealTime());
usedColorPane.getPane().setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 8));
row1Pane.add(usedColorPane.getPane());
return row1Pane;
}
protected boolean selectRealTime() {
return true;
}
protected Color[] getColorArray() {
return ColorFactory.MenuColors;
}

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

@ -6,14 +6,12 @@ import com.teamdev.jxbrowser.chromium.BrowserContext;
import com.teamdev.jxbrowser.chromium.ProtocolService;
import com.teamdev.jxbrowser.chromium.URLResponse;
import javax.activation.MimetypesFileTypeMap;
import java.io.DataInputStream;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
/**
* @author richie
@ -50,6 +48,19 @@ public class Assistant {
if (path.endsWith(".svg")) {
return "image/svg+xml";
}
if (path.endsWith(".png")) {
return "image/png";
}
if (path.endsWith(".woff")) {
return "font/woff";
}
if (path.endsWith(".ttf")) {
return "truetype";
}
if (path.endsWith(".eot")) {
return "embedded-opentype";
}
Path file = new File(path).toPath();
try {
return Files.probeContentType(file);

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

@ -16,6 +16,9 @@ import com.fr.design.extra.exe.PluginLoginExecutor;
import com.fr.design.extra.exe.ReadUpdateOnlineExecutor;
import com.fr.design.extra.exe.SearchOnlineExecutor;
import com.fr.design.i18n.Toolkit;
import com.fr.design.locale.impl.BbsRegisterMark;
import com.fr.design.locale.impl.BbsResetMark;
import com.fr.design.locale.impl.BbsSpaceMark;
import com.fr.design.upm.event.CertificateEvent;
import com.fr.design.upm.event.DownloadEvent;
import com.fr.design.upm.exec.UpmBrowserExecutor;
@ -23,6 +26,8 @@ import com.fr.design.upm.task.UpmTaskWorker;
import com.fr.event.EventDispatcher;
import com.fr.general.CloudCenter;
import com.fr.general.GeneralUtils;
import com.fr.general.locale.LocaleCenter;
import com.fr.general.locale.LocaleMark;
import com.fr.json.JSONObject;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.context.PluginMarker;
@ -424,8 +429,8 @@ public class UpmBridge {
@JSBridge
public void getPriviteMessage() {
try {
String loginUrl = CloudCenter.getInstance().acquireUrlByKind("bbs.default");
Desktop.getDesktop().browse(new URI(loginUrl));
LocaleMark<String> spaceMark = LocaleCenter.getMark(BbsSpaceMark.class);
Desktop.getDesktop().browse(new URI(spaceMark.getValue()));
} catch (Exception exp) {
FineLoggerFactory.getLogger().info(exp.getMessage());
}
@ -437,7 +442,8 @@ public class UpmBridge {
@JSBridge
public void forgetHref() {
try {
Desktop.getDesktop().browse(new URI(CloudCenter.getInstance().acquireUrlByKind("bbs.reset")));
LocaleMark<String> resetMark = LocaleCenter.getMark(BbsResetMark.class);
Desktop.getDesktop().browse(new URI(resetMark.getValue()));
} catch (Exception e) {
FineLoggerFactory.getLogger().info(e.getMessage());
}
@ -449,7 +455,8 @@ public class UpmBridge {
@JSBridge
public void registerHref() {
try {
Desktop.getDesktop().browse(new URI(CloudCenter.getInstance().acquireUrlByKind("bbs.register")));
LocaleMark<String> registerMark = LocaleCenter.getMark(BbsRegisterMark.class);
Desktop.getDesktop().browse(new URI(registerMark.getValue()));
} catch (Exception e) {
FineLoggerFactory.getLogger().info(e.getMessage());
}

12
designer-base/src/main/java/com/fr/design/utils/DesignerPort.java

@ -4,19 +4,21 @@ import com.fr.common.report.ReportState;
import com.fr.design.DesignerEnvManager;
import com.fr.design.RestartHelper;
import com.fr.design.dialog.TipDialog;
import com.fr.design.fun.DesignerPortProvider;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.port.DesignerPortContext;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.exit.DesignerExiter;
import com.fr.general.ComparatorUtils;
import com.fr.general.IOUtils;
import com.fr.process.ProcessEventPipe;
import com.fr.process.engine.core.CarryMessageEvent;
import com.fr.process.engine.core.FineProcessContext;
import com.fr.stable.StringUtils;
import com.fr.stable.bridge.StableFactory;
import com.fr.stable.xml.XMLPrintWriter;
import com.fr.stable.xml.XMLReadable;
import com.fr.stable.xml.XMLWriter;
@ -35,8 +37,8 @@ import java.awt.event.ActionListener;
public class DesignerPort implements XMLReadable, XMLWriter {
public static final String XML_TAG = "DesignerPort";
private static final int MIN_PORT = 1024;
private static final int MAX_PORT = 65535;
public static final int MIN_PORT = 1024;
public static final int MAX_PORT = 65535;
public static final DesignerPort INSTANCE = new DesignerPort();
@ -58,6 +60,10 @@ public class DesignerPort implements XMLReadable, XMLWriter {
private int debugMessagePort = 51463;
public int getMessagePort() {
int extraMessagePort = DesignerPortContext.getMessagePort();
if (extraMessagePort >= MIN_PORT && extraMessagePort <= MAX_PORT) {
return extraMessagePort;
}
return messagePort;
}

4
designer-base/src/main/java/com/fr/exit/DesignerExiter.java

@ -1,10 +1,9 @@
package com.fr.exit;
import com.fr.design.env.DesignerWorkspaceGenerator;
import com.fr.design.monitor.DesignerLifecycleMonitorContext;
import com.fr.process.engine.core.FineProcessContext;
import com.fr.process.engine.core.FineProcessEngineEvent;
import com.fr.stable.StableUtils;
/**
* @author hades
@ -20,6 +19,7 @@ public class DesignerExiter {
}
public void execute() {
DesignerLifecycleMonitorContext.getMonitor().beforeStop();
beforeExit();
if (FineProcessContext.getParentPipe() != null) {
FineProcessContext.getParentPipe().syncFire(FineProcessEngineEvent.DESTROY);

2
designer-base/src/main/java/com/fr/start/BaseDesigner.java

@ -14,6 +14,7 @@ import com.fr.design.fun.DesignerStartOpenFileProcessor;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.DesignerFrame;
import com.fr.design.mainframe.toolbar.ToolBarMenuDock;
import com.fr.design.monitor.DesignerLifecycleMonitorContext;
import com.fr.design.ui.util.UIUtil;
import com.fr.event.Event;
import com.fr.event.EventDispatcher;
@ -75,6 +76,7 @@ public abstract class BaseDesigner extends ToolBarMenuDock {
EventDispatcher.listen(DesignerLaunchStatus.STARTUP_COMPLETE, new Listener<Null>() {
@Override
public void on(Event event, Null param) {
DesignerLifecycleMonitorContext.getMonitor().afterStart();
EventDispatcher.stopListen(this);
// 启动完成 停止监听
ProcessEventPipe eventPipe = FineProcessContext.getParentPipe();

15
designer-base/src/main/resources/com/fr/design/images/m_web/connection_locked_normal.svg

@ -0,0 +1,15 @@
<?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>编组 3</title>
<g id="远程设计数据连接/服务器数据集增加锁定" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g transform="translate(-162.000000, -121.000000)" id="template">
<g transform="translate(24.000000, 115.000000)">
<g id="编组-3" transform="translate(138.000000, 6.000000)">
<rect id="矩形" fill-opacity="0" fill="#FFFFFF" x="0" y="0" width="16" height="16"></rect>
<path d="M13.9931545,2 C14.5492199,2 15,2.44371665 15,2.99980749 L15,6.00019251 C15,6.18235446 14.9510312,6.35313811 14.8654084,6.50022573 C14.9510251,6.64542671 15,6.81651267 15,6.99980749 L15,8 L13.999,8 L14,6.99980749 L2.00684547,7 C2.00567632,7 2.00469979,7.12351139 2.00388585,7.32041361 L2.003125,7.53992312 C2.00300685,7.57996653 2.00289294,7.6215845 2.00278313,7.66454498 L2.00201498,8.01864019 L2.00184669,8.11271215 L2.00184669,8.11271215 L2.00113666,8.59786697 C2.00105585,8.66296526 2.00098034,8.72781696 2.00090983,8.7919289 L2.00000644,9.98367135 C2.00000205,9.99452107 2,10.0001925 2,10.0001925 L8,10 L8,10.999 L2.00684547,11 C2.00567632,11 2.00469979,11.1235114 2.00388585,11.3204136 L2.003125,11.5399231 C2.00300685,11.5799665 2.00289294,11.6215845 2.00278313,11.664545 L2.00201498,12.0186402 L2.00184669,12.1127121 L2.00184669,12.1127121 L2.00113666,12.597867 C2.00105585,12.6629653 2.00098034,12.727817 2.00090983,12.7919289 L2.00000644,13.9836714 C2.00000205,13.9945211 2,14.0001925 2,14.0001925 L8,14 L8,15 L2.00684547,15 C1.45078007,15 1,14.5562834 1,14.0001925 L1,10.9998075 C1,10.8176455 1.04896881,10.6468619 1.13459156,10.4997743 C1.04897491,10.3545733 1,10.1834873 1,10.0001925 L1,6.99980749 C1,6.81764554 1.04896881,6.64686189 1.13459156,6.49977427 C1.04897491,6.35457329 1,6.18348733 1,6.00019251 L1,2.99980749 C1,2.44762906 1.44994876,2 2.00684547,2 L13.9931545,2 Z M14,2.99980749 L2.00684547,3 C2.00567632,3 2.00469979,3.12351139 2.00388585,3.32041361 L2.003125,3.53992312 C2.00300685,3.57996653 2.00289294,3.6215845 2.00278313,3.66454498 L2.00201498,4.01864019 L2.00184669,4.11271215 L2.00184669,4.11271215 L2.00113666,4.59786697 C2.00105585,4.66296526 2.00098034,4.72781696 2.00090983,4.7919289 L2.00000644,5.98367135 C2.00000205,5.99452107 2,6.00019251 2,6.00019251 L13.9814047,6.00000045 C13.9891898,6.00000015 13.9931545,6 13.9931545,6 C13.9943237,6 13.9953002,5.87648861 13.9961142,5.67958639 L13.996875,5.46007688 C13.9969932,5.42003347 13.9971071,5.3784155 13.9972169,5.33545502 L13.997985,4.98135981 L13.9981533,4.88728785 L13.9981533,4.88728785 L13.9988633,4.40213303 C13.9989441,4.33703474 13.9990197,4.27218304 13.9990902,4.2080711 L14,2.99980749 Z M4,4 L4,5 L3,5 L3,4 L4,4 Z M6,4 L6,5 L5,5 L5,4 L6,4 Z" id="形状结合" fill="#333334" fill-rule="nonzero"></path>
<path d="M14,8 L14,10 L15,10 L15,15 L9,15 L9,10 L10,10 L10,8 L14,8 Z M13,12 L11,12 L11,13 L13,13 L13,12 Z M13,9 L11,9 L11,10 L13,10 L13,9 Z" id="形状结合" fill="#E21E20" fill-rule="nonzero"></path>
</g>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 3.2 KiB

14
designer-base/src/main/resources/com/fr/design/images/m_web/locked_normal.svg

@ -0,0 +1,14 @@
<?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>编组 2</title>
<g id="远程设计数据连接/服务器数据集增加锁定" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g transform="translate(-476.000000, -106.000000)" id="列表/导航栏下拉列表">
<g transform="translate(243.000000, 70.000000)">
<g id="编组-2" transform="translate(233.000000, 36.000000)">
<rect id="矩形" fill="#FFFFFF" opacity="0" x="0" y="0" width="16" height="16"></rect>
<path d="M11,3 L11,6 L12,6 L12,13 L4,13 L4,6 L5,6 L5,3 L11,3 Z M10,9 L6,9 L6,10 L10,10 L10,9 Z M10,4 L6,4 L6,6 L10,6 L10,4 Z" id="形状结合" fill="#E21E20" fill-rule="nonzero"></path>
</g>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 959 B

BIN
designer-base/src/main/resources/com/fr/design/images/m_web/warningIcon.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

3
designer-chart/src/main/java/com/fr/design/chart/ChartDesignerActivator.java

@ -14,6 +14,7 @@ import com.fr.locale.LocaleMarker;
import com.fr.locale.LocaleScope;
import com.fr.module.Activator;
import com.fr.module.extension.Prepare;
import com.fr.plugin.chart.DownloadSourcesHelper;
import com.fr.plugin.chart.vanchart.export.ImagePainter;
import com.fr.stable.bridge.StableFactory;
import com.fr.stable.plugin.ExtraChartDesignClassManagerProvider;
@ -44,7 +45,7 @@ public class ChartDesignerActivator extends Activator implements Prepare {
DesignModuleFactory.registerExtraWidgetOptions(ChartTypeInterfaceManager.initWidgetOption());
ImagePainter.registerDownloadSourcesEvent(new DownloadOnlineSourcesHelper());
DownloadSourcesHelper.registerDownloadSourcesEvent(new DownloadOnlineSourcesHelper());
ImagePainter.registerDefaultCallbackEvent(HistoryTemplateListCache.getInstance());
ChartTypeInterfaceManager.addPluginChangedListener();

3
designer-chart/src/main/java/com/fr/design/chart/series/SeriesCondition/LabelAlphaPane.java

@ -5,6 +5,7 @@ import com.fr.chart.base.DataSeriesCondition;
import com.fr.design.condition.ConditionAttrSingleConditionPane;
import com.fr.design.condition.ConditionAttributesPane;
import com.fr.design.gui.frpane.UINumberDragPane;
import com.fr.design.gui.frpane.UINumberDragPaneWithPercent;
import com.fr.design.gui.ilable.UILabel;
@ -32,7 +33,7 @@ public class LabelAlphaPane extends ConditionAttrSingleConditionPane<DataSeriesC
nameLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Alpha"));
UILabel label = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Alpha") + ":");
alphaPane = new UINumberDragPane(0, ALPHASIZE);
alphaPane = new UINumberDragPaneWithPercent(0, ALPHASIZE);
JPanel panel = new JPanel(new BorderLayout());

6
designer-chart/src/main/java/com/fr/design/chartx/component/AbstractCustomFieldComboBoxPane.java

@ -23,13 +23,13 @@ import javax.swing.JPanel;
import javax.swing.SwingConstants;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.util.ArrayList;
import java.util.List;
import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Component;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.util.ArrayList;
import java.util.List;
/**
* Created by shine on 2018/9/12.
@ -253,7 +253,7 @@ public abstract class AbstractCustomFieldComboBoxPane<T> extends BasicBeanPane<T
@Override
protected Object[] createLine() {
return new String[]{StringUtils.EMPTY, StringUtils.EMPTY, Toolkit.i18nText("Fine-Design_Chart_Use_None")};
return new String[]{StringUtils.EMPTY, StringUtils.EMPTY, Toolkit.i18nText("Fine-Design_Chart_Data_Function_Sum")};
}
@Override

4
designer-chart/src/main/java/com/fr/design/chartx/component/MapAreaMatchPane.java

@ -6,6 +6,7 @@ import com.fr.data.TableDataSource;
import com.fr.data.TableDataSourceTailor;
import com.fr.data.impl.EmbeddedTableData;
import com.fr.data.impl.NameTableData;
import com.fr.decision.webservice.v10.map.geojson.helper.GEOMatchHelper;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.data.DesignTableDataManager;
import com.fr.design.data.datapane.TableDataComboBox;
@ -21,7 +22,6 @@ import com.fr.general.GeneralUtils;
import com.fr.general.data.DataModel;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.chart.map.data.MapMatchResult;
import com.fr.plugin.chart.map.server.ChartGEOJSONHelper;
import com.fr.script.Calculator;
import com.fr.stable.StringUtils;
@ -246,7 +246,7 @@ public class MapAreaMatchPane extends BasicBeanPane<MapMatchResult> {
private void populateMatchData(Object[] columnData) {
Set<String> geoAreas = matchAreaTable.getItems();
Map<String, String> resultMap = ChartGEOJSONHelper.matchAreaList(columnData, geoAreas, matchResultTable.getCustomResult());
Map<String, String> resultMap = GEOMatchHelper.getInstance().matchAreaList(columnData, geoAreas, matchResultTable.getCustomResult());
Object[][] data = new Object[resultMap.size()][2];

4
designer-chart/src/main/java/com/fr/design/chartx/component/MatchAreaTable.java

@ -1,8 +1,8 @@
package com.fr.design.chartx.component;
import com.fr.decision.webservice.v10.map.geojson.helper.GEOMatchHelper;
import com.fr.design.i18n.Toolkit;
import com.fr.general.GeneralUtils;
import com.fr.plugin.chart.map.server.ChartGEOJSONHelper;
import javax.swing.AbstractCellEditor;
import javax.swing.JTable;
@ -88,7 +88,7 @@ public class MatchAreaTable extends JTable {
return;
}
int index = areaNameIndex.get(areaName);
String result = ChartGEOJSONHelper.matchArea(GeneralUtils.objectToString(areaName), items);
String result = GEOMatchHelper.getInstance().matchArea(GeneralUtils.objectToString(areaName), items, new HashMap<>());
getColumnModel().getColumn(1).getCellEditor().stopCellEditing();
this.setValueAt(result, index, 1);
}

8
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartOtherPane.java

@ -13,6 +13,7 @@ import com.fr.design.mainframe.chart.gui.other.ChartConditionAttrPane;
import com.fr.design.mainframe.chart.gui.other.ChartInteractivePane;
import com.fr.design.mainframe.chart.gui.type.ChartTabPane;
import com.fr.design.mainframe.chart.info.ChartInfoCollector;
import com.fr.van.chart.designer.component.richText.VanChartRichEditorPane;
import javax.swing.JPanel;
import java.util.ArrayList;
@ -76,11 +77,11 @@ public class ChartOtherPane extends AbstractChartAttrPane {
public String title4PopupWindow() {
return PaneTitleConstants.CHART_OTHER_TITLE;
}
private boolean isHaveCondition() {
return hasCondition;
}
/**
* 设置选中的界面id
*/
@ -110,6 +111,7 @@ public class ChartOtherPane extends AbstractChartAttrPane {
public void populateBean(Chart chart) {
interactivePane.populateBean(chart);
if (ChartOtherPane.this.isHaveCondition()) {
VanChartRichEditorPane.refreshCommonChartFieldNames(chart);
conditionAttrPane.populateBean(chart);
}
}
@ -126,7 +128,7 @@ public class ChartOtherPane extends AbstractChartAttrPane {
//特效埋点
ChartInfoCollector.getInstance().updateChartConfig(chart, ConfigType.EFFECT, chart.getBuryingPointEffectConfig());
}
/**
* 注册 切换按钮的切换事件.
* @param currentChartEditPane 当前编辑的图表编辑界面.

102
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/CalculateComboBox.java

@ -8,61 +8,65 @@ import com.fr.data.util.function.MinFunction;
import com.fr.data.util.function.NoneFunction;
import com.fr.data.util.function.SumFunction;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.i18n.Toolkit;
import com.fr.general.ComparatorUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.chart.base.FirstFunction;
/**
* 公式选择.
* @author kunsnat E-mail:kunsnat@gmail.com
* @version 创建时间2013-1-8 上午09:52:15
*
* @author kunsnat E-mail:kunsnat@gmail.com
* @version 创建时间2013-1-8 上午09:52:15
*/
public class CalculateComboBox extends UIComboBox{
public class CalculateComboBox extends UIComboBox {
public static final String[] CALCULATE_ARRAY = {com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Data_Function_None"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Data_Function_Sum"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Data_Function_Average"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Data_Function_Max"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Data_Function_Min"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Data_Function_Count")};
public static final Class[] CLASS_ARRAY = {NoneFunction.class, SumFunction.class, AverageFunction.class,
MaxFunction.class, MinFunction.class, CountFunction.class};
public CalculateComboBox() {
super(CALCULATE_ARRAY);
setSelectedIndex(0);
}
public void reset() {
this.setSelectedItem(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Data_Function_None"));
}
/**
* 更新公式选择.
*/
public void populateBean(AbstractDataFunction function) {
for(int i = 0; i < CLASS_ARRAY.length; i++) {
if(function != null && ComparatorUtils.equals(function.getClass(), CLASS_ARRAY[i])) {
setSelectedIndex(i);
break;
}
}
}
/**
* 返回当前选择的公式
*/
public AbstractDataFunction updateBean() {
try {
int selectIndex = getSelectedIndex();
if(selectIndex >= 0 && selectIndex < CLASS_ARRAY.length) {
return (AbstractDataFunction)CLASS_ARRAY[selectIndex].newInstance();
}
} catch (InstantiationException e) {
FineLoggerFactory.getLogger().error("Function Error");
return null;
} catch (IllegalAccessException e) {
FineLoggerFactory.getLogger().error("Function Error");
return null;
}
return null;
}
public static final String[] CALCULATE_ARRAY = {Toolkit.i18nText("Fine-Design_Chart_Data_Function_First"), Toolkit.i18nText("Fine-Design_Chart_Data_Function_Last"),
Toolkit.i18nText("Fine-Design_Chart_Data_Function_Sum"), Toolkit.i18nText("Fine-Design_Chart_Data_Function_Average"),
Toolkit.i18nText("Fine-Design_Chart_Data_Function_Max"), Toolkit.i18nText("Fine-Design_Chart_Data_Function_Min"),
Toolkit.i18nText("Fine-Design_Chart_Data_Function_Count")};
public static final Class[] CLASS_ARRAY = {FirstFunction.class, NoneFunction.class, SumFunction.class, AverageFunction.class,
MaxFunction.class, MinFunction.class, CountFunction.class};
public CalculateComboBox() {
super(CALCULATE_ARRAY);
setSelectedIndex(2);
}
public void reset() {
this.setSelectedItem(Toolkit.i18nText("Fine-Design_Chart_Data_Function_Sum"));
}
/**
* 更新公式选择.
*/
public void populateBean(AbstractDataFunction function) {
for (int i = 0; i < CLASS_ARRAY.length; i++) {
if (function != null && ComparatorUtils.equals(function.getClass(), CLASS_ARRAY[i])) {
setSelectedIndex(i);
break;
}
}
}
/**
* 返回当前选择的公式
*/
public AbstractDataFunction updateBean() {
try {
int selectIndex = getSelectedIndex();
if (selectIndex >= 0 && selectIndex < CLASS_ARRAY.length) {
return (AbstractDataFunction) CLASS_ARRAY[selectIndex].newInstance();
}
} catch (InstantiationException e) {
FineLoggerFactory.getLogger().error("Function Error");
return null;
} catch (IllegalAccessException e) {
FineLoggerFactory.getLogger().error("Function Error");
return null;
}
return null;
}
}

15
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/DatabaseTableDataPane.java

@ -58,7 +58,7 @@ public class DatabaseTableDataPane extends BasicPane{
* 返回选中的数据源.
*/
public TableDataWrapper getTableDataWrapper() {
return tableNameCombox.getSelectedItem();
return tableNameCombox.getSelectedItem();
}
public void populateBean(TableData nameTableData) {
@ -68,12 +68,12 @@ public class DatabaseTableDataPane extends BasicPane{
tableNameCombox.setSelectedTableDataByName(((NameTableData)nameTableData).getName());
}
}
@Override
protected String title4PopupWindow() {
return null;
}
/**
* 数据集列表选中后的事件
*/
@ -82,7 +82,12 @@ public class DatabaseTableDataPane extends BasicPane{
}
private void initTableCombox() {
tableNameCombox = new TableDataComboBox(DesignTableDataManager.getEditingTableDataSource());
tableNameCombox = new TableDataComboBox(DesignTableDataManager.getEditingTableDataSource()){
//图表的数据集选择下拉框,不需要注册监听,chartEditPane已经注册了。
public void registerDSChangeListener() {
}
};
tableNameCombox.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
@ -94,7 +99,7 @@ public class DatabaseTableDataPane extends BasicPane{
}
});
}
private void initReviewButton() {
reviewButton = new UIButton(BaseUtils.readIcon("com/fr/design/images/data/search.png"));
reviewButton.setBorder(new LineBorder(UIConstants.LINE_COLOR));

1
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/MeterPlotTableDataContentPane.java

@ -56,6 +56,7 @@ public class MeterPlotTableDataContentPane extends AbstractTableDataContentPane
this.setLayout(new BorderLayout());
nameBox = new UIComboBoxWithNone();
nameBox.setSelectedIndex(nameBox.getItemCount() -1);
valueBox = new UIComboBox();
targetBox = new UIComboBox();
custom = new TinyFormulaPane();

2
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/SeriesNameUseFieldNamePane.java

@ -70,7 +70,7 @@ public class SeriesNameUseFieldNamePane extends FurtherBasicBeanPane<ChartCollec
return new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
String[] blank = heads.length == 3 ? new String[]{StringUtils.EMPTY, StringUtils.EMPTY, Toolkit.i18nText("Fine-Design_Chart_Use_None")} :
String[] blank = heads.length == 3 ? new String[]{StringUtils.EMPTY, StringUtils.EMPTY, Toolkit.i18nText("Fine-Design_Chart_Data_Function_Sum")} :
new String[]{StringUtils.EMPTY, StringUtils.EMPTY};
tablePane.addLine(blank);
fireTargetChanged();

3
designer-chart/src/main/java/com/fr/van/chart/box/VanChartBoxBorderPane.java

@ -4,6 +4,7 @@ import com.fr.base.background.ColorBackground;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.gui.ispinner.chart.UISpinnerWithPx;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.TableLayout;
import com.fr.plugin.chart.base.AttrBorderWithWidth;
@ -31,7 +32,7 @@ public class VanChartBoxBorderPane extends BasicBeanPane<AttrBorderWithWidth> {
};
}
};
lineWidth = new UISpinner(0.5, Double.MAX_VALUE, 0.5, 0.5);
lineWidth = new UISpinnerWithPx(0.5, Double.MAX_VALUE, 0.5, 0.5);
Component[][] components = new Component[][]{
new Component[]{null, null},

135
designer-chart/src/main/java/com/fr/van/chart/box/VanChartBoxRichTextDetailedFieldListPane.java

@ -0,0 +1,135 @@
package com.fr.van.chart.box;
import com.fr.design.i18n.Toolkit;
import com.fr.design.ui.ModernUIPane;
import com.fr.plugin.chart.base.AttrTooltipContent;
import com.fr.plugin.chart.base.format.AttrTooltipCategoryFormat;
import com.fr.plugin.chart.base.format.AttrTooltipDataMaxFormat;
import com.fr.plugin.chart.base.format.AttrTooltipDataMedianFormat;
import com.fr.plugin.chart.base.format.AttrTooltipDataMinFormat;
import com.fr.plugin.chart.base.format.AttrTooltipDataNumberFormat;
import com.fr.plugin.chart.base.format.AttrTooltipDataOutlierFormat;
import com.fr.plugin.chart.base.format.AttrTooltipDataQ1Format;
import com.fr.plugin.chart.base.format.AttrTooltipDataQ3Format;
import com.fr.plugin.chart.base.format.AttrTooltipSeriesFormat;
import com.fr.plugin.chart.box.attr.AttrBoxTooltipContent;
import com.fr.van.chart.designer.component.richText.VanChartFieldAttrPane;
import com.fr.van.chart.designer.component.richText.VanChartFieldButton;
import com.fr.van.chart.designer.component.richText.VanChartFieldListPane;
import com.fr.van.chart.designer.component.richText.VanChartFieldListener;
import com.fr.van.chart.designer.component.richText.VanChartRichEditorModel;
import javax.swing.JPanel;
import java.util.ArrayList;
import java.util.List;
public class VanChartBoxRichTextDetailedFieldListPane extends VanChartFieldListPane {
private VanChartFieldButton richTextNumber;
private VanChartFieldButton richTextMax;
private VanChartFieldButton richTextQ3;
private VanChartFieldButton richTextMedian;
private VanChartFieldButton richTextQ1;
private VanChartFieldButton richTextMin;
private VanChartFieldButton richTextOutlier;
public VanChartBoxRichTextDetailedFieldListPane(VanChartFieldAttrPane fieldAttrPane, ModernUIPane<VanChartRichEditorModel> richEditorPane) {
super(fieldAttrPane, richEditorPane);
}
public VanChartFieldButton getRichTextMax() {
return richTextMax;
}
public VanChartFieldButton getRichTextQ3() {
return richTextQ3;
}
public VanChartFieldButton getRichTextMedian() {
return richTextMedian;
}
public VanChartFieldButton getRichTextQ1() {
return richTextQ1;
}
public VanChartFieldButton getRichTextMin() {
return richTextMin;
}
protected void initDefaultFieldButton() {
VanChartFieldListener listener = getFieldListener();
setCategoryNameButton(new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Category_Use_Name"), new AttrTooltipCategoryFormat(), listener));
setSeriesNameButton(new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Series_Name"), new AttrTooltipSeriesFormat(), listener));
richTextNumber = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Data_Number"), new AttrTooltipDataNumberFormat(), listener);
richTextMax = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Max_Value"), new AttrTooltipDataMaxFormat(), listener);
richTextQ3 = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Data_Q3"), new AttrTooltipDataQ3Format(), listener);
richTextMedian = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Data_Median"), new AttrTooltipDataMedianFormat(), listener);
richTextQ1 = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Data_Q1"), new AttrTooltipDataQ1Format(), listener);
richTextMin = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Min_Value"), new AttrTooltipDataMinFormat(), listener);
richTextOutlier = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Outlier_Value"), new AttrTooltipDataOutlierFormat(), listener);
}
protected void addDefaultFieldButton(JPanel fieldPane) {
fieldPane.add(getCategoryNameButton());
fieldPane.add(getSeriesNameButton());
fieldPane.add(richTextNumber);
fieldPane.add(richTextMax);
fieldPane.add(richTextQ3);
fieldPane.add(richTextMedian);
fieldPane.add(richTextQ1);
fieldPane.add(richTextMin);
fieldPane.add(richTextOutlier);
}
protected List<VanChartFieldButton> getDefaultFieldButtonList() {
List<VanChartFieldButton> fieldButtonList = new ArrayList<>();
fieldButtonList.add(getCategoryNameButton());
fieldButtonList.add(getSeriesNameButton());
fieldButtonList.add(richTextNumber);
fieldButtonList.add(richTextMax);
fieldButtonList.add(richTextQ3);
fieldButtonList.add(richTextMedian);
fieldButtonList.add(richTextQ1);
fieldButtonList.add(richTextMin);
fieldButtonList.add(richTextOutlier);
return fieldButtonList;
}
public void populateDefaultField(AttrTooltipContent tooltipContent) {
super.populateDefaultField(tooltipContent);
if (tooltipContent instanceof AttrBoxTooltipContent) {
AttrBoxTooltipContent box = (AttrBoxTooltipContent) tooltipContent;
populateButtonFormat(richTextNumber, box.getRichTextNumber());
populateButtonFormat(richTextMax, box.getRichTextMax());
populateButtonFormat(richTextQ3, box.getRichTextQ3());
populateButtonFormat(richTextMedian, box.getRichTextMedian());
populateButtonFormat(richTextQ1, box.getRichTextQ1());
populateButtonFormat(richTextMin, box.getRichTextMin());
populateButtonFormat(richTextOutlier, box.getRichTextOutlier());
}
}
public void updateDefaultField(AttrTooltipContent tooltipContent) {
super.updateDefaultField(tooltipContent);
if (tooltipContent instanceof AttrBoxTooltipContent) {
AttrBoxTooltipContent box = (AttrBoxTooltipContent) tooltipContent;
updateButtonFormat(richTextNumber, box.getRichTextNumber());
updateButtonFormat(richTextMax, box.getRichTextMax());
updateButtonFormat(richTextQ3, box.getRichTextQ3());
updateButtonFormat(richTextMedian, box.getRichTextMedian());
updateButtonFormat(richTextQ1, box.getRichTextQ1());
updateButtonFormat(richTextMin, box.getRichTextMin());
updateButtonFormat(richTextOutlier, box.getRichTextOutlier());
}
}
}

41
designer-chart/src/main/java/com/fr/van/chart/box/VanChartBoxRichTextResultFieldListPane.java

@ -0,0 +1,41 @@
package com.fr.van.chart.box;
import com.fr.design.ui.ModernUIPane;
import com.fr.van.chart.designer.component.richText.VanChartFieldAttrPane;
import com.fr.van.chart.designer.component.richText.VanChartFieldButton;
import com.fr.van.chart.designer.component.richText.VanChartRichEditorModel;
import javax.swing.JPanel;
import java.util.ArrayList;
import java.util.List;
public class VanChartBoxRichTextResultFieldListPane extends VanChartBoxRichTextDetailedFieldListPane {
public VanChartBoxRichTextResultFieldListPane(VanChartFieldAttrPane fieldAttrPane, ModernUIPane<VanChartRichEditorModel> richEditorPane) {
super(fieldAttrPane, richEditorPane);
}
protected void addDefaultFieldButton(JPanel fieldPane) {
fieldPane.add(getCategoryNameButton());
fieldPane.add(getSeriesNameButton());
fieldPane.add(getRichTextMax());
fieldPane.add(getRichTextQ3());
fieldPane.add(getRichTextMedian());
fieldPane.add(getRichTextQ1());
fieldPane.add(getRichTextMin());
}
protected List<VanChartFieldButton> getDefaultFieldButtonList() {
List<VanChartFieldButton> fieldButtonList = new ArrayList<>();
fieldButtonList.add(getCategoryNameButton());
fieldButtonList.add(getSeriesNameButton());
fieldButtonList.add(getRichTextMax());
fieldButtonList.add(getRichTextQ3());
fieldButtonList.add(getRichTextMedian());
fieldButtonList.add(getRichTextQ1());
fieldButtonList.add(getRichTextMin());
return fieldButtonList;
}
}

294
designer-chart/src/main/java/com/fr/van/chart/box/VanChartBoxTooltipContentPane.java

@ -4,8 +4,8 @@ import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.ui.ModernUIPane;
import com.fr.plugin.chart.base.AttrTooltipContent;
import com.fr.plugin.chart.base.AttrTooltipRichText;
import com.fr.plugin.chart.base.format.AttrTooltipCategoryFormat;
import com.fr.plugin.chart.base.format.AttrTooltipDataMaxFormat;
import com.fr.plugin.chart.base.format.AttrTooltipDataMedianFormat;
@ -20,17 +20,17 @@ import com.fr.plugin.chart.box.attr.AttrBoxTooltipContent;
import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import com.fr.van.chart.designer.component.VanChartTooltipContentPane;
import com.fr.van.chart.designer.component.format.CategoryNameFormatPaneWithCheckBox;
import com.fr.van.chart.designer.component.format.CategoryNameFormatPaneWithoutCheckBox;
import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithCheckBox;
import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithoutCheckBox;
import com.fr.van.chart.designer.component.format.VanChartFormatPaneWithCheckBox;
import com.fr.van.chart.designer.component.format.VanChartFormatPaneWithoutCheckBox;
import com.fr.van.chart.designer.component.richText.VanChartFieldAttrPane;
import com.fr.van.chart.designer.component.richText.VanChartFieldListPane;
import com.fr.van.chart.designer.component.richText.VanChartRichEditorModel;
import com.fr.van.chart.designer.component.richText.VanChartRichTextPane;
import com.fr.van.chart.designer.style.VanChartStylePane;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Component;
import java.util.Map;
public class VanChartBoxTooltipContentPane extends VanChartTooltipContentPane {
@ -44,20 +44,9 @@ public class VanChartBoxTooltipContentPane extends VanChartTooltipContentPane {
private VanChartFormatPaneWithCheckBox min;
private VanChartFormatPaneWithCheckBox outlier;
private VanChartFormatPaneWithoutCheckBox richTextNumber;
private VanChartFormatPaneWithoutCheckBox richTextMax;
private VanChartFormatPaneWithoutCheckBox richTextQ3;
private VanChartFormatPaneWithoutCheckBox richTextMedian;
private VanChartFormatPaneWithoutCheckBox richTextQ1;
private VanChartFormatPaneWithoutCheckBox richTextMin;
private VanChartFormatPaneWithoutCheckBox richTextOutlier;
private JPanel dataNumberPane;
private JPanel dataOutlierPane;
private JPanel richTextNumberPane;
private JPanel richTextOutlierPane;
public VanChartBoxTooltipContentPane(VanChartStylePane parent, JPanel showOnPane, boolean isDetailed) {
super(parent, showOnPane);
checkFormatVisible(isDetailed);
@ -104,47 +93,6 @@ public class VanChartBoxTooltipContentPane extends VanChartTooltipContentPane {
};
}
protected void initRichTextFormatPane(VanChartStylePane parent, JPanel showOnPane) {
setRichTextCategoryNameFormatPane(new CategoryNameFormatPaneWithoutCheckBox(parent, showOnPane));
setRichTextSeriesNameFormatPane(new SeriesNameFormatPaneWithoutCheckBox(parent, showOnPane));
richTextNumber = new VanChartFormatPaneWithoutCheckBox(parent, showOnPane) {
protected String getCheckBoxText() {
return Toolkit.i18nText("Fine-Design_Chart_Data_Number");
}
};
richTextMax = new VanChartFormatPaneWithoutCheckBox(parent, showOnPane) {
protected String getCheckBoxText() {
return Toolkit.i18nText("Fine-Design_Chart_Max_Value");
}
};
richTextQ3 = new VanChartFormatPaneWithoutCheckBox(parent, showOnPane) {
protected String getCheckBoxText() {
return Toolkit.i18nText("Fine-Design_Chart_Data_Q3");
}
};
richTextMedian = new VanChartFormatPaneWithoutCheckBox(parent, showOnPane) {
protected String getCheckBoxText() {
return Toolkit.i18nText("Fine-Design_Chart_Data_Median");
}
};
richTextQ1 = new VanChartFormatPaneWithoutCheckBox(parent, showOnPane) {
protected String getCheckBoxText() {
return Toolkit.i18nText("Fine-Design_Chart_Data_Q1");
}
};
richTextMin = new VanChartFormatPaneWithoutCheckBox(parent, showOnPane) {
protected String getCheckBoxText() {
return Toolkit.i18nText("Fine-Design_Chart_Min_Value");
}
};
richTextOutlier = new VanChartFormatPaneWithoutCheckBox(parent, showOnPane) {
protected String getCheckBoxText() {
return Toolkit.i18nText("Fine-Design_Chart_Outlier_Value");
}
};
}
protected JPanel createCommonFormatPanel() {
JPanel commonPanel = new JPanel(new BorderLayout());
@ -155,27 +103,73 @@ public class VanChartBoxTooltipContentPane extends VanChartTooltipContentPane {
return commonPanel;
}
protected JPanel createRichFormatPanel() {
JPanel richFormatPanel = new JPanel(new BorderLayout());
protected VanChartRichTextPane createRichTextPane(ModernUIPane<VanChartRichEditorModel> richEditorPane) {
richFormatPanel.add(createRichTextCateAndSeriesPane(), BorderLayout.NORTH);
richFormatPanel.add(createRichTextDataNumberPane(), BorderLayout.CENTER);
richFormatPanel.add(createRichTextDataDetailPane(), BorderLayout.SOUTH);
return new VanChartRichTextPane(richEditorPane) {
return richFormatPanel;
protected VanChartFieldListPane createFieldListPane(VanChartFieldAttrPane fieldAttrPane, ModernUIPane<VanChartRichEditorModel> richEditor) {
if (detailed) {
return new VanChartBoxRichTextDetailedFieldListPane(fieldAttrPane, richEditor);
}
return new VanChartBoxRichTextResultFieldListPane(fieldAttrPane, richEditor);
}
protected AttrTooltipContent getInitialTooltipContent() {
return createAttrTooltip();
}
};
}
protected String[] getRichTextFieldNames() {
if (detailed) {
return new String[]{
Toolkit.i18nText("Fine-Design_Chart_Category_Use_Name"),
Toolkit.i18nText("Fine-Design_Chart_Series_Name"),
Toolkit.i18nText("Fine-Design_Chart_Data_Number"),
Toolkit.i18nText("Fine-Design_Chart_Max_Value"),
Toolkit.i18nText("Fine-Design_Chart_Data_Q3"),
Toolkit.i18nText("Fine-Design_Chart_Data_Median"),
Toolkit.i18nText("Fine-Design_Chart_Data_Q1"),
Toolkit.i18nText("Fine-Design_Chart_Min_Value"),
Toolkit.i18nText("Fine-Design_Chart_Outlier_Value")
};
}
return new String[]{
Toolkit.i18nText("Fine-Design_Chart_Category_Use_Name"),
Toolkit.i18nText("Fine-Design_Chart_Series_Name"),
Toolkit.i18nText("Fine-Design_Chart_Max_Value"),
Toolkit.i18nText("Fine-Design_Chart_Data_Q3"),
Toolkit.i18nText("Fine-Design_Chart_Data_Median"),
Toolkit.i18nText("Fine-Design_Chart_Data_Q1"),
Toolkit.i18nText("Fine-Design_Chart_Min_Value")
};
}
protected Component[][] getRichTextComponents() {
return new Component[][]{
new Component[]{getRichTextCategoryNameFormatPane(), null},
new Component[]{getRichTextSeriesNameFormatPane(), null},
new Component[]{richTextNumber, null},
new Component[]{richTextMax, null},
new Component[]{richTextQ3, null},
new Component[]{richTextMedian, null},
new Component[]{richTextQ1, null},
new Component[]{richTextMin, null},
new Component[]{richTextOutlier, null}
protected AttrTooltipFormat[] getRichTextFieldFormats() {
if (detailed) {
return new AttrTooltipFormat[]{
new AttrTooltipCategoryFormat(),
new AttrTooltipSeriesFormat(),
new AttrTooltipDataNumberFormat(),
new AttrTooltipDataMaxFormat(),
new AttrTooltipDataQ3Format(),
new AttrTooltipDataMedianFormat(),
new AttrTooltipDataQ1Format(),
new AttrTooltipDataMinFormat(),
new AttrTooltipDataOutlierFormat()
};
}
return new AttrTooltipFormat[]{
new AttrTooltipCategoryFormat(),
new AttrTooltipSeriesFormat(),
new AttrTooltipDataMaxFormat(),
new AttrTooltipDataQ3Format(),
new AttrTooltipDataMedianFormat(),
new AttrTooltipDataQ1Format(),
new AttrTooltipDataMinFormat()
};
}
@ -249,72 +243,6 @@ public class VanChartBoxTooltipContentPane extends VanChartTooltipContentPane {
return detailPane;
}
private JPanel createRichTextCateAndSeriesPane() {
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH;
double[] columnSize = {f, e};
double[] rowSize = {p, p, p};
Component[][] cateAndSeries = new Component[][]{
new Component[]{null, null},
new Component[]{null, getRichTextCategoryNameFormatPane()},
new Component[]{null, getRichTextSeriesNameFormatPane()}
};
return TableLayoutHelper.createTableLayoutPane(cateAndSeries, rowSize, columnSize);
}
private JPanel createRichTextDataNumberPane() {
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH;
double[] columnSize = {f, e};
double[] rowSize = {p, p};
Component[][] dataNumber = new Component[][]{
new Component[]{null, null},
new Component[]{null, richTextNumber},
};
richTextNumberPane = TableLayoutHelper.createTableLayoutPane(dataNumber, rowSize, columnSize);
return richTextNumberPane;
}
private JPanel createRichTextDataDetailPane() {
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH;
double[] columnSize = {f, e};
JPanel detailPane = new JPanel(new BorderLayout());
Component[][] richTextDetail = new Component[][]{
new Component[]{null, null},
new Component[]{null, richTextMax},
new Component[]{new UILabel(getLabelContentTitle()), richTextQ3},
new Component[]{null, richTextMedian},
new Component[]{null, richTextQ1},
new Component[]{null, richTextMin}
};
Component[][] dataOutlier = new Component[][]{
new Component[]{null, null},
new Component[]{null, richTextOutlier},
};
richTextOutlierPane = TableLayoutHelper.createTableLayoutPane(dataOutlier, new double[]{p, p}, columnSize);
detailPane.add(TableLayoutHelper.createTableLayoutPane(richTextDetail, new double[]{p, p, p, p, p, p}, columnSize), BorderLayout.NORTH);
detailPane.add(richTextOutlierPane, BorderLayout.CENTER);
return detailPane;
}
public boolean isDirty() {
return getCategoryNameFormatPane().isDirty()
|| getSeriesNameFormatPane().isDirty()
@ -362,63 +290,21 @@ public class VanChartBoxTooltipContentPane extends VanChartTooltipContentPane {
}
}
protected void populateRichEditor(AttrTooltipContent attrTooltipContent) {
setRichTextAttr(new AttrTooltipRichText());
Map<String, String> params = getRichTextAttr().getParams();
AttrTooltipCategoryFormat categoryFormat = attrTooltipContent.getRichTextCategoryFormat();
getRichTextCategoryNameFormatPane().populate(categoryFormat);
getRichTextCategoryNameFormatPane().updateFormatParams(params, categoryFormat.getJs());
AttrTooltipSeriesFormat seriesFormat = attrTooltipContent.getRichTextSeriesFormat();
getRichTextSeriesNameFormatPane().populate(seriesFormat);
getRichTextSeriesNameFormatPane().updateFormatParams(params, seriesFormat.getJs());
if (attrTooltipContent instanceof AttrBoxTooltipContent) {
AttrBoxTooltipContent boxTooltipContent = (AttrBoxTooltipContent) attrTooltipContent;
VanChartFormatPaneWithoutCheckBox[] formatPaneGroup = getFormatPaneGroup();
AttrTooltipFormat[] formatGroup = getFormatGroup(boxTooltipContent);
populateRichTextFormat(formatPaneGroup, formatGroup);
populateRichText(attrTooltipContent.getRichTextAttr());
checkRichEditorState(attrTooltipContent);
}
}
private VanChartFormatPaneWithoutCheckBox[] getFormatPaneGroup() {
if (detailed) {
return new VanChartFormatPaneWithoutCheckBox[]{
richTextNumber, richTextMax, richTextQ3, richTextMedian,
richTextQ1, richTextMin, richTextOutlier
};
}
return new VanChartFormatPaneWithoutCheckBox[]{
richTextMax, richTextQ3, richTextMedian, richTextQ1, richTextMin
};
}
protected void updateTooltipFormat(AttrTooltipContent target, AttrTooltipContent source) {
super.updateTooltipFormat(target, source);
private AttrTooltipFormat[] getFormatGroup(AttrBoxTooltipContent boxTooltipContent) {
AttrTooltipDataNumberFormat richTextNumber = boxTooltipContent.getRichTextNumber();
AttrTooltipDataMaxFormat richTextMaxFormat = boxTooltipContent.getRichTextMax();
AttrTooltipDataQ3Format richTextQ3Format = boxTooltipContent.getRichTextQ3();
AttrTooltipDataMedianFormat richTextMedianFormat = boxTooltipContent.getRichTextMedian();
AttrTooltipDataQ1Format richTextQ1Format = boxTooltipContent.getRichTextQ1();
AttrTooltipDataMinFormat richTextMinFormat = boxTooltipContent.getRichTextMin();
AttrTooltipDataOutlierFormat richTextOutlierFormat = boxTooltipContent.getRichTextOutlier();
if (target instanceof AttrBoxTooltipContent && source instanceof AttrBoxTooltipContent) {
AttrBoxTooltipContent targetGantt = (AttrBoxTooltipContent) target;
AttrBoxTooltipContent sourceGantt = (AttrBoxTooltipContent) source;
if (detailed) {
return new AttrTooltipFormat[]{
richTextNumber, richTextMaxFormat, richTextQ3Format, richTextMedianFormat,
richTextQ1Format, richTextMinFormat, richTextOutlierFormat
};
targetGantt.setRichTextNumber(sourceGantt.getRichTextNumber());
targetGantt.setRichTextMax(sourceGantt.getRichTextMax());
targetGantt.setRichTextQ3(sourceGantt.getRichTextQ3());
targetGantt.setRichTextMedian(sourceGantt.getRichTextMedian());
targetGantt.setRichTextQ1(sourceGantt.getRichTextQ1());
targetGantt.setRichTextMin(sourceGantt.getRichTextMin());
targetGantt.setRichTextOutlier(sourceGantt.getRichTextOutlier());
}
return new AttrTooltipFormat[]{
richTextMaxFormat, richTextQ3Format, richTextMedianFormat, richTextQ1Format, richTextMinFormat
};
}
protected void updateFormatPane(AttrTooltipContent attrTooltipContent) {
@ -440,30 +326,10 @@ public class VanChartBoxTooltipContentPane extends VanChartTooltipContentPane {
}
}
protected void updateRichEditor(AttrTooltipContent attrTooltipContent) {
getRichTextCategoryNameFormatPane().update(attrTooltipContent.getRichTextCategoryFormat());
getRichTextSeriesNameFormatPane().update(attrTooltipContent.getRichTextSeriesFormat());
if (attrTooltipContent instanceof AttrBoxTooltipContent) {
AttrBoxTooltipContent boxTooltipContent = (AttrBoxTooltipContent) attrTooltipContent;
richTextNumber.update(boxTooltipContent.getRichTextNumber());
richTextMax.update(boxTooltipContent.getRichTextMax());
richTextQ3.update(boxTooltipContent.getRichTextQ3());
richTextMedian.update(boxTooltipContent.getRichTextMedian());
richTextQ1.update(boxTooltipContent.getRichTextQ1());
richTextMin.update(boxTooltipContent.getRichTextMin());
richTextOutlier.update(boxTooltipContent.getRichTextOutlier());
}
}
public void checkFormatVisible(boolean detailed) {
this.detailed = detailed;
dataNumberPane.setVisible(detailed);
dataOutlierPane.setVisible(detailed);
richTextNumberPane.setVisible(detailed);
richTextOutlierPane.setVisible(detailed);
}
}

5
designer-chart/src/main/java/com/fr/van/chart/bubble/component/VanChartBubblePane.java

@ -4,6 +4,7 @@ import com.fr.design.beans.BasicBeanPane;
import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.ilable.UILabel;
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.TableLayoutHelper;
@ -24,8 +25,8 @@ public class VanChartBubblePane extends BasicBeanPane<VanChartAttrBubble> {
private UIButtonGroup<Integer> displayNegative;
public VanChartBubblePane(){
minDiameter = new UISpinner(0,Double.MAX_VALUE,1,0);
maxDiameter = new UISpinner(0,Double.MAX_VALUE,1,0);
minDiameter = new UISpinnerWithPx(0);
maxDiameter = new UISpinnerWithPx(0);
shadow = new UIButtonGroup<Integer>(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Open"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Close")});
displayNegative = new UIButtonGroup<Integer>(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Open"),

3
designer-chart/src/main/java/com/fr/van/chart/column/ColumnBorderAttriPane.java

@ -3,6 +3,7 @@ package com.fr.van.chart.column;
import com.fr.design.chart.comp.BorderAttriPane;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.gui.ispinner.chart.UISpinnerWithPx;
import java.awt.Dimension;
@ -19,7 +20,7 @@ public class ColumnBorderAttriPane extends BorderAttriPane {
public ColumnBorderAttriPane(String radiusString) {
this.add(new UILabel(radiusString + ":"));
radius = new UISpinner(0,1000,1,0);
radius = new UISpinnerWithPx(0,1000,1,0);
this.add(radius);
radius.setPreferredSize(new Dimension(60, 18));
}

8
designer-chart/src/main/java/com/fr/van/chart/column/VanChartColumnSeriesPane.java

@ -3,6 +3,8 @@ package com.fr.van.chart.column;
import com.fr.base.background.ImageBackground;
import com.fr.chart.chartattr.Plot;
import com.fr.chart.chartglyph.ConditionAttr;
import com.fr.design.gui.frpane.UINumberDragPaneWithPercent;
import com.fr.design.gui.ispinner.chart.UISpinnerWithPx;
import com.fr.design.i18n.Toolkit;
import com.fr.design.gui.frpane.UINumberDragPane;
import com.fr.design.gui.ibutton.UIButtonGroup;
@ -76,10 +78,10 @@ public class VanChartColumnSeriesPane extends VanChartAbstractPlotSeriesPane {
private JPanel createSeriesStylePane(double[] row, double[] col) {
isFixedWidth = new UIButtonGroup<Integer>(new String[]{Toolkit.i18nText("Fine-Design_Chart_YES"), Toolkit.i18nText("Fine-Design_Chart_NO")});
columnWidth = new UISpinner(0,1000,1,0);
columnWidth = new UISpinnerWithPx(0,1000,1,0);
columnWidth.setBorder(BorderFactory.createEmptyBorder(0, (int)TableLayout4VanChartHelper.DESCRIPTION_AREA_WIDTH + TableLayout4VanChartHelper.COMPONENT_INTERVAL,0,0));
seriesGap = new UINumberDragPane(-100, 100);
categoryGap = new UINumberDragPane(0, 100);
seriesGap = new UINumberDragPaneWithPercent(-100, 100);
categoryGap = new UINumberDragPaneWithPercent(0, 100);
isFillWithImage = new UIButtonGroup<Integer>(new String[]{Toolkit.i18nText("Fine-Design_Chart_YES"), Toolkit.i18nText("Fine-Design_Chart_NO")});
imagePane = new ImageBackgroundQuickPane(false);
imagePane.setBorder(BorderFactory.createEmptyBorder(0,(int)TableLayout4VanChartHelper.DESCRIPTION_AREA_WIDTH + TableLayout4VanChartHelper.COMPONENT_INTERVAL,0,0));

4
designer-chart/src/main/java/com/fr/van/chart/custom/other/VanChartCustomConditionAttrPane.java

@ -39,7 +39,9 @@ public class VanChartCustomConditionAttrPane extends BasicScrollPane<Chart> {
layoutContentPane();
}
if(conditionAttrPane != null) {
conditionAttrPane.populateBean((VanChartCustomPlot)chart.getPlot());
conditionAttrPane.setChart(chart);
conditionAttrPane.populateBean(chart.getPlot());
conditionAttrPane.tabChanged();
}
}

21
designer-chart/src/main/java/com/fr/van/chart/custom/other/VanChartCustomPlotConditionAttrTabPane.java

@ -1,11 +1,13 @@
package com.fr.van.chart.custom.other;
import com.fr.chart.chartattr.Chart;
import com.fr.design.dialog.BasicPane;
import com.fr.plugin.chart.attr.plot.VanChartPlot;
import com.fr.plugin.chart.custom.CustomPlotFactory;
import com.fr.plugin.chart.custom.VanChartCustomPlot;
import com.fr.plugin.chart.custom.type.CustomPlotType;
import com.fr.van.chart.custom.component.VanChartCustomPlotTabPane;
import com.fr.van.chart.designer.component.richText.VanChartRichEditorPane;
import com.fr.van.chart.designer.other.VanChartConditionAttrPane;
import javax.swing.JPanel;
@ -16,10 +18,17 @@ import java.util.List;
* Created by Fangjie on 2016/4/28.
*/
public class VanChartCustomPlotConditionAttrTabPane extends VanChartCustomPlotTabPane<VanChartCustomPlot, VanChartCustomPlot> {
private Chart chart;
public VanChartCustomPlotConditionAttrTabPane(VanChartCustomPlot plot, BasicPane parent) {
super(plot, parent);
}
public void setChart(Chart chart) {
this.chart = chart;
}
@Override
protected void initTabTitle() {
List<VanChartPlot> customPlotList = plot.getCustomPlotList();
@ -73,6 +82,18 @@ public class VanChartCustomPlotConditionAttrTabPane extends VanChartCustomPlotTa
}
}
protected void tabChanged() {
List<VanChartPlot> customPlotList = plot.getCustomPlotList();
int index = getSelectedIndex();
if (customPlotList.size() > index && paneList.size() > index) {
VanChartPlot chartPlot = customPlotList.get(index);
CustomPlotType plotType = CustomPlotFactory.getCustomType(chartPlot);
VanChartRichEditorPane.refreshCustomChartTableFieldNames(chart, plotType);
}
}
@Override
public VanChartCustomPlot updateBean() {
return null;

15
designer-chart/src/main/java/com/fr/van/chart/custom/style/VanChartCustomPlotLabelTabPane.java

@ -68,6 +68,21 @@ public class VanChartCustomPlotLabelTabPane extends VanChartCustomPlotTabPane<Va
}
}
protected void tabChanged() {
List<VanChartPlot> customPlotList = plot.getCustomPlotList();
int index = getSelectedIndex();
if (customPlotList.size() > index && paneList.size() > index) {
VanChartPlot chartPlot = customPlotList.get(index);
VanChartPlotLabelPane labelPane = (VanChartPlotLabelPane)paneList.get(index);
VanChartCustomStylePane stylePane = (VanChartCustomStylePane)labelPane.getParentPane();
if (stylePane != null) {
stylePane.refreshTableFieldNames(chartPlot);
}
}
}
@Override
public VanChartCustomPlot updateBean() {
return null;

15
designer-chart/src/main/java/com/fr/van/chart/custom/style/VanChartCustomPlotTooltipTabPane.java

@ -67,6 +67,21 @@ public class VanChartCustomPlotTooltipTabPane extends VanChartCustomPlotTabPane<
}
}
protected void tabChanged() {
List<VanChartPlot> customPlotList = plot.getCustomPlotList();
int index = getSelectedIndex();
if (customPlotList.size() > index && paneList.size() > index) {
VanChartPlot chartPlot = customPlotList.get(index);
VanChartPlotTooltipPane tooltipPane = (VanChartPlotTooltipPane)paneList.get(index);
VanChartCustomStylePane stylePane = (VanChartCustomStylePane)tooltipPane.getParentPane();
if (stylePane != null) {
stylePane.refreshTableFieldNames(chartPlot);
}
}
}
@Override
public VanChartCustomPlot updateBean() {
return null;

11
designer-chart/src/main/java/com/fr/van/chart/custom/style/VanChartCustomStylePane.java

@ -5,8 +5,11 @@ import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.frpane.AttributeChangeListener;
import com.fr.design.mainframe.chart.gui.style.series.ChartSeriesPane;
import com.fr.plugin.chart.attr.plot.VanChartAxisPlot;
import com.fr.plugin.chart.attr.plot.VanChartPlot;
import com.fr.plugin.chart.custom.CustomPlotFactory;
import com.fr.plugin.chart.custom.VanChartCustomPlot;
import com.fr.plugin.chart.custom.type.CustomPlotType;
import com.fr.van.chart.designer.component.richText.VanChartRichEditorPane;
import com.fr.van.chart.designer.style.VanChartStylePane;
import java.util.List;
@ -68,4 +71,12 @@ public class VanChartCustomStylePane extends VanChartStylePane {
CustomPlotFactory.dataSheetSynchronization((VanChartCustomPlot) collection.getSelectedChart().getPlot());
}
public void refreshTableFieldNames(VanChartPlot plot) {
CustomPlotType plotType = CustomPlotFactory.getCustomType(plot);
VanChartRichEditorPane.refreshCustomChartTableFieldNames(getChart(), plotType);
}
public void refreshTableFieldNames() {
}
}

15
designer-chart/src/main/java/com/fr/van/chart/designer/PlotFactory.java

@ -19,6 +19,7 @@ import com.fr.plugin.chart.heatmap.VanChartHeatMapPlot;
import com.fr.plugin.chart.line.VanChartLinePlot;
import com.fr.plugin.chart.map.VanChartMapPlot;
import com.fr.plugin.chart.multilayer.VanChartMultiPiePlot;
import com.fr.plugin.chart.radar.VanChartRadarPlot;
import com.fr.plugin.chart.scatter.VanChartScatterPlot;
import com.fr.plugin.chart.structure.VanChartStructurePlot;
import com.fr.plugin.chart.treemap.VanChartTreeMapPlot;
@ -94,6 +95,20 @@ public class PlotFactory {
return autoAdjustLabelPlots.contains(plot.getClass());
}
private static Set<Class<? extends Plot>> supportAddTableFieldPlots = new HashSet<>();
static {
supportAddTableFieldPlots.add(PiePlot4VanChart.class);
supportAddTableFieldPlots.add(VanChartColumnPlot.class);
supportAddTableFieldPlots.add(VanChartLinePlot.class);
supportAddTableFieldPlots.add(VanChartAreaPlot.class);
supportAddTableFieldPlots.add(VanChartRadarPlot.class);
}
public static boolean plotSupportAddTableField(Plot plot) {
return supportAddTableFieldPlots.contains(plot.getClass());
}
private static Set<Class<? extends Plot>> borderAndBackgroundLabelPlots = new HashSet<>();
static {

3
designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartAreaSeriesFillColorPane.java

@ -2,6 +2,7 @@ package com.fr.van.chart.designer.component;
import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.frpane.UINumberDragPane;
import com.fr.design.gui.frpane.UINumberDragPaneWithPercent;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.TableLayout;
@ -36,7 +37,7 @@ public class VanChartAreaSeriesFillColorPane extends BasicPane {
};
}
};
transparent = new UINumberDragPane(0, 100);
transparent = new UINumberDragPaneWithPercent(0, 100);
JPanel transparentPane = TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Alpha"), transparent);

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

@ -4,6 +4,7 @@ import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.gui.ispinner.chart.UISpinnerWithPx;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.TableLayout;
import com.fr.design.utils.gui.UIComponentUtils;
@ -15,11 +16,11 @@ import com.fr.plugin.chart.type.LineType;
import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import javax.swing.JPanel;
import java.util.Arrays;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Arrays;
/**
* line相关设置
@ -74,7 +75,7 @@ public class VanChartLineTypePane extends BasicPane {
lineTypeComboBox = createLineType();
lineWidthSpinner = new UISpinner(LINE_WIDTH_MIN_VALUE, Integer.MAX_VALUE, LINE_WIDTH_DIERTA_VALUE, LINE_WIDTH_DEFAULT_VALUE);
lineWidthSpinner = new UISpinnerWithPx(LINE_WIDTH_MIN_VALUE, Integer.MAX_VALUE, LINE_WIDTH_DIERTA_VALUE, LINE_WIDTH_DEFAULT_VALUE);
lineTypeComboBox.addActionListener(new ActionListener() {
@Override

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

@ -1,9 +1,7 @@
package com.fr.van.chart.designer.component;
import com.fr.van.chart.designer.component.format.ChangedPercentFormatPaneWithCheckBox;
import com.fr.van.chart.designer.component.format.ChangedPercentFormatPaneWithoutCheckBox;
import com.fr.van.chart.designer.component.format.ChangedValueFormatPaneWithCheckBox;
import com.fr.van.chart.designer.component.format.ChangedValueFormatPaneWithoutCheckBox;
import com.fr.van.chart.designer.style.VanChartStylePane;
import javax.swing.JPanel;
@ -34,14 +32,6 @@ public class VanChartRefreshTooltipContentPane extends VanChartTooltipContentPan
setChangedPercentFormatPane(new ChangedPercentFormatPaneWithCheckBox(parent, showOnPane));
}
@Override
protected void initRichTextFormatPane(VanChartStylePane parent, JPanel showOnPane) {
super.initRichTextFormatPane(parent, showOnPane);
setRichTextChangedValueFormatPane(new ChangedValueFormatPaneWithoutCheckBox(parent, showOnPane));
setRichTextChangedPercentFormatPane(new ChangedPercentFormatPaneWithoutCheckBox(parent, showOnPane));
}
protected Component[][] getPaneComponents(){
return new Component[][]{
new Component[]{getCategoryNameFormatPane(), null},
@ -52,16 +42,4 @@ public class VanChartRefreshTooltipContentPane extends VanChartTooltipContentPan
new Component[]{getChangedPercentFormatPane(), null},
};
}
protected Component[][] getRichTextComponents() {
return new Component[][]{
new Component[]{getRichTextCategoryNameFormatPane(), null},
new Component[]{getRichTextSeriesNameFormatPane(), null},
new Component[]{getRichTextValueFormatPane(), null},
new Component[]{getRichTextChangedValueFormatPane(), null},
new Component[]{getRichTextPercentFormatPane(), null},
new Component[]{getRichTextChangedPercentFormatPane(), null}
};
}
}

191
designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartRichEditorPane.java

@ -1,191 +0,0 @@
package com.fr.van.chart.designer.component;
import com.fr.concurrent.NamedThreadFactory;
import com.fr.design.DesignerEnvManager;
import com.fr.design.ui.ModernUIPane;
import com.fr.general.IOUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.chart.base.AttrTooltipRichText;
import com.fr.plugin.chart.type.TextAlign;
import com.fr.stable.StringUtils;
import com.teamdev.jxbrowser.chromium.Browser;
import com.teamdev.jxbrowser.chromium.JSValue;
import com.teamdev.jxbrowser.chromium.events.ScriptContextAdapter;
import com.teamdev.jxbrowser.chromium.events.ScriptContextEvent;
import java.util.Locale;
import java.util.Map;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
public class VanChartRichEditorPane {
private static final String namespace = "Pool";
private static final String variable = "data";
private static final String richEditorPath = "/com/fr/design/editor/rich_editor.html";
private static final String expression = "dispatch()";
private static ModernUIPane<RichEditorModel> richEditorPane;
private static Browser browser;
public static void initRichEditorPane() {
ExecutorService singleThreadExecutor = Executors.newSingleThreadExecutor(new NamedThreadFactory("VanChartRichEditor"));
try {
singleThreadExecutor.submit(new Runnable() {
@Override
public void run() {
try {
richEditorPane = initPane(new RichEditorModel());
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
}
});
} finally {
singleThreadExecutor.shutdown();
}
}
public static ModernUIPane<RichEditorModel> createRichEditorPane(AttrTooltipRichText richEditor) {
RichEditorModel model = getRichEditorModel(richEditor);
if (richEditorPane == null) {
richEditorPane = initPane(model);
} else if (browser != null) {
updatePane(browser, model);
}
return richEditorPane;
}
public static ModernUIPane<RichEditorModel> initPane(RichEditorModel model) {
return new ModernUIPane.Builder<RichEditorModel>()
.prepare(new ScriptContextAdapter() {
public void onScriptContextCreated(ScriptContextEvent event) {
browser = event.getBrowser();
browser.getCacheStorage().clearCache();
browser.executeJavaScript(IOUtils.readResourceAsString("/com/fr/web/ui/fineui.min.js"));
browser.executeJavaScript(IOUtils.readResourceAsString("/com/fr/design/editor/script/i18n.js"));
browser.executeJavaScript(generateTransformI18nJS());
browser.executeJavaScript(IOUtils.readResourceAsString("/com/fr/web/ui/materials.min.js"));
JSValue ns = browser.executeJavaScriptAndReturnValue("window." + namespace);
ns.asObject().setProperty(variable, model);
}
})
.withEMB(richEditorPath)
.namespace(namespace).build();
}
public static void updatePane(Browser browser, RichEditorModel model) {
JSValue ns = browser.executeJavaScriptAndReturnValue("window." + namespace);
ns.asObject().setProperty(variable, model);
browser.executeJavaScript("window." + namespace + "." + expression);
}
public static RichEditorModel getRichEditorModel(AttrTooltipRichText richText) {
Map<String, String> paramsMap = richText.getParams();
StringBuilder paramsStr = new StringBuilder(StringUtils.EMPTY);
if (paramsMap != null) {
for (Map.Entry<String, String> entry : paramsMap.entrySet()) {
paramsStr.append(entry.getKey()).append(":").append(entry.getValue());
paramsStr.append("-");
}
}
int len = paramsStr.length();
if (len > 0) {
paramsStr.deleteCharAt(len - 1);
}
String content = richText.getContent();
String initParams = StringUtils.EMPTY;
String align = StringUtils.EMPTY;
if (content.contains("data-id") && !content.contains("class")) {
initParams = richText.getInitParamsContent();
String left = TextAlign.LEFT.getAlign();
String center = TextAlign.CENTER.getAlign();
align = content.contains(left) ? left : center;
}
return new RichEditorModel(content, richText.isAuto(), paramsStr.toString(), initParams, align);
}
public static String generateTransformI18nJS() {
String language = "zh_CN";
Locale locale = DesignerEnvManager.getEnvManager().getLanguage();
if (locale != null) {
language = locale.toString();
}
return "!(function () { window.transformI18n && window.transformI18n('" + language + "' || 'zh_CN'); }());";
}
public static class RichEditorModel {
private String content = StringUtils.EMPTY;
private boolean auto = true;
private String params = StringUtils.EMPTY;
private String initParams = StringUtils.EMPTY;
private String align = TextAlign.LEFT.getAlign();
public RichEditorModel() {
}
public RichEditorModel(String content, boolean auto, String params, String initParams, String align) {
this.content = content;
this.auto = auto;
this.params = params;
this.initParams = initParams;
this.align = align;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public boolean isAuto() {
return auto;
}
public void setAuto(boolean auto) {
this.auto = auto;
}
public String getParams() {
return params;
}
public void setParams(String params) {
this.params = params;
}
public String getInitParams() {
return initParams;
}
public void setInitParams(String initParams) {
this.initParams = initParams;
}
public String getAlign() {
return align;
}
public void setAlign(String align) {
this.align = align;
}
}
}

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

@ -15,23 +15,25 @@ import com.fr.design.ui.ModernUIPane;
import com.fr.general.ComparatorUtils;
import com.fr.plugin.chart.base.AttrTooltipContent;
import com.fr.plugin.chart.base.AttrTooltipRichText;
import com.fr.plugin.chart.base.TableFieldCollection;
import com.fr.plugin.chart.base.format.AttrTooltipCategoryFormat;
import com.fr.plugin.chart.base.format.AttrTooltipFormat;
import com.fr.plugin.chart.base.format.AttrTooltipPercentFormat;
import com.fr.plugin.chart.base.format.AttrTooltipSeriesFormat;
import com.fr.plugin.chart.base.format.AttrTooltipValueFormat;
import com.fr.stable.StringUtils;
import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import com.fr.van.chart.designer.component.format.CategoryNameFormatPaneWithCheckBox;
import com.fr.van.chart.designer.component.format.CategoryNameFormatPaneWithoutCheckBox;
import com.fr.van.chart.designer.component.format.ChangedPercentFormatPaneWithCheckBox;
import com.fr.van.chart.designer.component.format.ChangedPercentFormatPaneWithoutCheckBox;
import com.fr.van.chart.designer.component.format.ChangedValueFormatPaneWithCheckBox;
import com.fr.van.chart.designer.component.format.ChangedValueFormatPaneWithoutCheckBox;
import com.fr.van.chart.designer.component.format.PercentFormatPaneWithCheckBox;
import com.fr.van.chart.designer.component.format.PercentFormatPaneWithoutCheckBox;
import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithCheckBox;
import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithoutCheckBox;
import com.fr.van.chart.designer.component.format.ValueFormatPaneWithCheckBox;
import com.fr.van.chart.designer.component.format.ValueFormatPaneWithoutCheckBox;
import com.fr.van.chart.designer.component.format.VanChartFormatPaneWithCheckBox;
import com.fr.van.chart.designer.component.format.VanChartFormatPaneWithoutCheckBox;
import com.fr.van.chart.designer.component.richText.VanChartRichEditorModel;
import com.fr.van.chart.designer.component.richText.VanChartRichEditorPane;
import com.fr.van.chart.designer.component.richText.VanChartRichTextDialog;
import com.fr.van.chart.designer.component.richText.VanChartRichTextPane;
import com.fr.van.chart.designer.style.VanChartStylePane;
import javax.swing.JComponent;
@ -45,6 +47,10 @@ import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.Arrays;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
/**
* 数据点提示内容界面含有通用设置富文本编辑器自定义JS界面
@ -73,13 +79,6 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
private ChangedValueFormatPaneWithCheckBox changedValueFormatPane;
private ChangedPercentFormatPaneWithCheckBox changedPercentFormatPane;
private CategoryNameFormatPaneWithoutCheckBox richTextCategoryNameFormatPane;
private SeriesNameFormatPaneWithoutCheckBox richTextSeriesNameFormatPane;
private ValueFormatPaneWithoutCheckBox richTextValueFormatPane;
private PercentFormatPaneWithoutCheckBox richTextPercentFormatPane;
private ChangedValueFormatPaneWithoutCheckBox richTextChangedValueFormatPane;
private ChangedPercentFormatPaneWithoutCheckBox richTextChangedPercentFormatPane;
private JPanel centerPanel;
private JPanel commonPanel;
private JPanel editorPanel;
@ -92,7 +91,7 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
private VanChartStylePane parent;
private JPanel showOnPane;
private AttrTooltipRichText richText;
private AttrTooltipContent richTextTooltipContent;
private boolean inCondition;
public VanChartTooltipContentPane(VanChartStylePane parent, JPanel showOnPane) {
@ -103,10 +102,10 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
this.inCondition = inCondition;
this.parent = parent;
this.showOnPane = showOnPane;
this.richText = new AttrTooltipRichText();
this.richTextTooltipContent = createAttrTooltip();
initFormatPane(parent, showOnPane);
initRichTextFormatPane(parent, showOnPane);
this.setLayout(new BorderLayout());
this.add(createLabelContentPane(), BorderLayout.CENTER);
@ -172,64 +171,20 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
this.changedPercentFormatPane = changedPercentFormatPane;
}
public CategoryNameFormatPaneWithoutCheckBox getRichTextCategoryNameFormatPane() {
return richTextCategoryNameFormatPane;
}
public void setRichTextCategoryNameFormatPane(CategoryNameFormatPaneWithoutCheckBox richTextCategoryNameFormatPane) {
this.richTextCategoryNameFormatPane = richTextCategoryNameFormatPane;
}
public SeriesNameFormatPaneWithoutCheckBox getRichTextSeriesNameFormatPane() {
return richTextSeriesNameFormatPane;
}
public void setRichTextSeriesNameFormatPane(SeriesNameFormatPaneWithoutCheckBox richTextSeriesNameFormatPane) {
this.richTextSeriesNameFormatPane = richTextSeriesNameFormatPane;
}
public ValueFormatPaneWithoutCheckBox getRichTextValueFormatPane() {
return richTextValueFormatPane;
}
public void setRichTextValueFormatPane(ValueFormatPaneWithoutCheckBox richTextValueFormatPane) {
this.richTextValueFormatPane = richTextValueFormatPane;
}
public PercentFormatPaneWithoutCheckBox getRichTextPercentFormatPane() {
return richTextPercentFormatPane;
}
public void setRichTextPercentFormatPane(PercentFormatPaneWithoutCheckBox richTextPercentFormatPane) {
this.richTextPercentFormatPane = richTextPercentFormatPane;
}
public ChangedValueFormatPaneWithoutCheckBox getRichTextChangedValueFormatPane() {
return richTextChangedValueFormatPane;
}
public void setRichTextChangedValueFormatPane(ChangedValueFormatPaneWithoutCheckBox richTextChangedValueFormatPane) {
this.richTextChangedValueFormatPane = richTextChangedValueFormatPane;
}
public ChangedPercentFormatPaneWithoutCheckBox getRichTextChangedPercentFormatPane() {
return richTextChangedPercentFormatPane;
}
public void setRichTextChangedPercentFormatPane(ChangedPercentFormatPaneWithoutCheckBox richTextChangedPercentFormatPane) {
this.richTextChangedPercentFormatPane = richTextChangedPercentFormatPane;
}
public UIButtonGroup<Integer> getContent() {
return content;
}
public AttrTooltipRichText getRichTextAttr() {
return richText;
return this.richTextTooltipContent.getRichTextAttr();
}
public void setRichTextAttr(AttrTooltipRichText richText) {
this.richText = richText;
this.richTextTooltipContent.setRichTextAttr(richText);
}
public void setRichTextTooltipContent(AttrTooltipContent richTextTooltipContent) {
this.richTextTooltipContent = richTextTooltipContent;
}
private JPanel createLabelContentPane() {
@ -406,24 +361,16 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH;
double[] columnSize = {f, e};
double[] rowSize = {p, p, p};
double[] rowSize = {p, p};
Component[][] components = new Component[][]{
new Component[]{null, null},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Content_Style")), createRichEditorButton()},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Use_Format")), createRichFormatPanel()}
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Content_Style")), createRichEditorButton()}
};
return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
}
protected JPanel createRichFormatPanel() {
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
return TableLayoutHelper.createTableLayoutPane(getRichTextComponents(), getRowSize(p), new double[]{f, p});
}
private JComponent createRichEditorButton() {
UIButton contentTextArea = new UIButton(Toolkit.i18nText("Fine-Design_Chart_Rich_Text_Edit"));
@ -437,34 +384,100 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
}
private void fireRichEditor() {
final ModernUIPane<VanChartRichEditorPane.RichEditorModel> pane = VanChartRichEditorPane.createRichEditorPane(richText);
BasicDialog dialog = new VanChartRichEditorDialog(DesignerContext.getDesignerFrame(), pane);
AttrTooltipRichText richText = this.richTextTooltipContent.getRichTextAttr();
refreshTableFieldParams(richText.getParams());
ModernUIPane<VanChartRichEditorModel> richEditorPane = VanChartRichEditorPane.createRichEditorPane(richText);
VanChartRichTextPane richTextPane = this.createRichTextPane(richEditorPane);
pane.populate(VanChartRichEditorPane.getRichEditorModel(richText));
BasicDialog richTextDialog = new VanChartRichTextDialog(DesignerContext.getDesignerFrame(), richTextPane);
dialog.addDialogActionListener(new DialogActionAdapter() {
richTextPane.populateBean(this.richTextTooltipContent);
richEditorPane.populate(VanChartRichEditorPane.getRichEditorModel(richText));
richTextDialog.addDialogActionListener(new DialogActionAdapter() {
public void doOk() {
VanChartRichEditorPane.RichEditorModel model = pane.update();
AttrTooltipContent temporary = richTextPane.updateBean();
VanChartRichEditorModel model = richEditorPane.update();
String content = model.getContent();
updateLocalRichText(content, model.isAuto());
SwingUtilities.getWindowAncestor(pane).setVisible(false);
TableFieldCollection fieldCollection = temporary.getFieldCollection();
if (fieldCollection != null) {
fieldCollection.checkFieldDefinition(content);
}
updateTooltipFormat(richTextTooltipContent, temporary);
SwingUtilities.getWindowAncestor(richEditorPane).setVisible(false);
}
public void doCancel() {
SwingUtilities.getWindowAncestor(pane).setVisible(false);
SwingUtilities.getWindowAncestor(richEditorPane).setVisible(false);
}
});
dialog.setVisible(true);
richTextDialog.setVisible(true);
if (parent != null) {
parent.attributeChanged();
}
}
protected VanChartRichTextPane createRichTextPane(ModernUIPane<VanChartRichEditorModel> richEditorPane) {
return new VanChartRichTextPane(richEditorPane);
}
protected String[] getRichTextFieldNames() {
return new String[]{
Toolkit.i18nText("Fine-Design_Chart_Category_Use_Name"),
Toolkit.i18nText("Fine-Design_Chart_Series_Name"),
Toolkit.i18nText("Fine-Design_Chart_Use_Value"),
Toolkit.i18nText("Fine-Design_Chart_Use_Percent")
};
}
protected AttrTooltipFormat[] getRichTextFieldFormats() {
return new AttrTooltipFormat[]{
new AttrTooltipCategoryFormat(),
new AttrTooltipSeriesFormat(),
new AttrTooltipValueFormat(),
new AttrTooltipPercentFormat()
};
}
private void refreshRichTextParams(AttrTooltipRichText richText) {
String[] fieldNames = getRichTextFieldNames();
AttrTooltipFormat[] fieldFormats = getRichTextFieldFormats();
Map<String, String> params = new LinkedHashMap<>();
for (int i = 0, len = fieldNames.length; i < len; i++) {
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> defaultParams = Arrays.asList(getRichTextFieldNames());
if (tableFieldNames == null || params == null) {
return;
}
for (String fieldName : tableFieldNames) {
// 富文本默认参数和数据集字段重名时,显示默认参数
if (!defaultParams.contains(fieldName)) {
params.put(fieldName, "${" + fieldName + "_" + fieldName.hashCode() + "}");
}
}
}
private JPanel createHtmlPane() {
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
@ -494,13 +507,6 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
percentFormatPane = new PercentFormatPaneWithCheckBox(parent, showOnPane);
}
protected void initRichTextFormatPane(VanChartStylePane parent, JPanel showOnPane) {
richTextCategoryNameFormatPane = new CategoryNameFormatPaneWithoutCheckBox(parent, showOnPane);
richTextSeriesNameFormatPane = new SeriesNameFormatPaneWithoutCheckBox(parent, showOnPane);
richTextValueFormatPane = new ValueFormatPaneWithoutCheckBox(parent, showOnPane);
richTextPercentFormatPane = new PercentFormatPaneWithoutCheckBox(parent, showOnPane);
}
protected JPanel createTableLayoutPaneWithTitle(String title, JPanel panel) {
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(title, panel);
}
@ -518,15 +524,6 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
};
}
protected Component[][] getRichTextComponents() {
return new Component[][]{
new Component[]{richTextCategoryNameFormatPane, null},
new Component[]{richTextSeriesNameFormatPane, null},
new Component[]{richTextValueFormatPane, null},
new Component[]{richTextPercentFormatPane, null},
};
}
private void initContentListener() {
content.addActionListener(new ActionListener() {
@Override
@ -695,53 +692,26 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
}
protected void populateRichEditor(AttrTooltipContent attrTooltipContent) {
VanChartFormatPaneWithoutCheckBox[] formatPaneGroup = new VanChartFormatPaneWithoutCheckBox[]{
richTextCategoryNameFormatPane,
richTextSeriesNameFormatPane,
richTextValueFormatPane,
richTextPercentFormatPane,
richTextChangedValueFormatPane,
richTextChangedPercentFormatPane
};
AttrTooltipFormat[] formatGroup = new AttrTooltipFormat[]{
attrTooltipContent.getRichTextCategoryFormat(),
attrTooltipContent.getRichTextSeriesFormat(),
attrTooltipContent.getRichTextValueFormat(),
attrTooltipContent.getRichTextPercentFormat(),
attrTooltipContent.getRichTextChangedValueFormat(),
attrTooltipContent.getRichTextChangedPercentFormat()
};
if (parent != null) {
parent.refreshTableFieldNames();
}
richText = new AttrTooltipRichText();
populateRichTextFormat(formatPaneGroup, formatGroup);
updateTooltipFormat(richTextTooltipContent, attrTooltipContent);
refreshRichTextParams(richTextTooltipContent.getRichTextAttr());
populateRichText(attrTooltipContent.getRichTextAttr());
checkRichEditorState(attrTooltipContent);
}
protected void populateRichTextFormat(VanChartFormatPaneWithCheckBox[] formatPaneGroup, AttrTooltipFormat[] formatGroup) {
for (int i = 0, len = formatPaneGroup.length; i < len; i++) {
VanChartFormatPaneWithCheckBox formatPane = formatPaneGroup[i];
AttrTooltipFormat format = formatGroup[i];
if (formatPane != null && format != null) {
formatPane.populate(format);
// 填充面板时,更新富文本编辑器参数
formatPane.updateFormatParams(richText.getParams(), format.getJs());
}
}
}
protected void populateRichText(AttrTooltipRichText tooltipRichText) {
if (tooltipRichText != null) {
updateLocalRichText(tooltipRichText.getContent(), tooltipRichText.isAuto());
richText.setInitParamsContent(tooltipRichText.getInitParamsContent());
richTextTooltipContent.getRichTextAttr().setInitParamsContent(tooltipRichText.getInitParamsContent());
}
}
protected void checkRichEditorState(AttrTooltipContent attrTooltipContent) {
AttrTooltipRichText richText = this.richTextTooltipContent.getRichTextAttr();
if (ComparatorUtils.equals(richText.getInitParamsContent(), StringUtils.EMPTY)) {
richText.setContent(attrTooltipContent.getRichTextDefaultContent());
richText.setInitParamsContent(attrTooltipContent.getRichTextDefaultParams());
@ -754,7 +724,7 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
updateLabelType(attrTooltipContent);
updateFormatPane(attrTooltipContent);
if (supportRichEditor()) {
updateRichEditor(attrTooltipContent);
updateTooltipFormat(attrTooltipContent, this.richTextTooltipContent);
updateTooltipRichText(attrTooltipContent);
}
updateTextAttr(attrTooltipContent);
@ -810,38 +780,35 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
}
}
protected void updateRichEditor(AttrTooltipContent attrTooltipContent) {
if (richTextCategoryNameFormatPane != null) {
richTextCategoryNameFormatPane.update(attrTooltipContent.getRichTextCategoryFormat());
}
if (richTextSeriesNameFormatPane != null) {
richTextSeriesNameFormatPane.update(attrTooltipContent.getRichTextSeriesFormat());
}
if (richTextValueFormatPane != null) {
richTextValueFormatPane.update(attrTooltipContent.getRichTextValueFormat());
}
if (richTextPercentFormatPane != null) {
richTextPercentFormatPane.update(attrTooltipContent.getRichTextPercentFormat());
}
if (richTextChangedValueFormatPane != null) {
richTextChangedValueFormatPane.update(attrTooltipContent.getRichTextChangedValueFormat());
}
if (richTextChangedPercentFormatPane != null) {
richTextChangedPercentFormatPane.update(attrTooltipContent.getRichTextChangedPercentFormat());
protected void updateTooltipFormat(AttrTooltipContent target, AttrTooltipContent source) {
if (target == null || source == null) {
return;
}
// 更新富文本字段格式
target.setRichTextCategoryFormat(source.getRichTextCategoryFormat());
target.setRichTextSeriesFormat(source.getRichTextSeriesFormat());
target.setRichTextValueFormat(source.getRichTextValueFormat());
target.setRichTextPercentFormat(source.getRichTextPercentFormat());
// 更新新增字段格式和汇总
target.setFieldCollection(source.getFieldCollection());
}
private void updateLocalRichText(String content, boolean isAuto) {
AttrTooltipRichText richText = this.richTextTooltipContent.getRichTextAttr();
richText.setContent(content);
richText.setAuto(isAuto);
}
private void updateTooltipRichText(AttrTooltipContent attrTooltipContent) {
if (attrTooltipContent != null) {
AttrTooltipRichText tooltipRichText = attrTooltipContent.getRichTextAttr();
tooltipRichText.setContent(richText.getContent());
tooltipRichText.setInitParamsContent(richText.getInitParamsContent());
tooltipRichText.setAuto(richText.isAuto());
AttrTooltipRichText targetRichText = attrTooltipContent.getRichTextAttr();
AttrTooltipRichText localRichText = this.richTextTooltipContent.getRichTextAttr();
targetRichText.setContent(localRichText.getContent());
targetRichText.setInitParamsContent(localRichText.getInitParamsContent());
targetRichText.setAuto(localRichText.isAuto());
}
}
}

3
designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTrendLinePane.java

@ -7,6 +7,7 @@ import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.gui.ispinner.chart.UISpinnerWithPx;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.TableLayout;
@ -61,7 +62,7 @@ public class VanChartTrendLinePane extends BasicPane{
trendLineName = new UITextField();
trendLineColor = new ColorSelectBox(PREFERRED_WIDTH);
trendLineStyle = new LineTypeComboBox(new LineType[]{LineType.NONE, LineType.SOLID, LineType.DASHED});
lineWidthSpinner = new UISpinner(LINE_WIDTH_MIN_VALUE, Integer.MAX_VALUE, LINE_WIDTH_DIERTA_VALUE, LINE_WIDTH_DEFAULT_VALUE);
lineWidthSpinner = new UISpinnerWithPx(LINE_WIDTH_MIN_VALUE, Integer.MAX_VALUE, LINE_WIDTH_DIERTA_VALUE, LINE_WIDTH_DEFAULT_VALUE);
trendLineType = new UIComboBox(TYPES);
prePeriod = new UISpinner(0, Integer.MAX_VALUE, 1, 0);
afterPeriod = new UISpinner(0, Integer.MAX_VALUE, 1, 0);

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

@ -4,6 +4,7 @@ import com.fr.base.background.ImageBackground;
import com.fr.chart.chartglyph.GeneralInfo;
import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.frpane.UINumberDragPane;
import com.fr.design.gui.frpane.UINumberDragPaneWithPercent;
import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel;
@ -112,7 +113,7 @@ public class VanChartBackgroundPane extends BasicPane {
}
});
transparentLabel = new UILabel(Toolkit.i18nText("Fine-Design_Report_Alpha"));
transparent = new UINumberDragPane(0, 100);
transparent = new UINumberDragPaneWithPercent(0, 100);
}
protected Component[][] getPaneComponents() {

23
designer-chart/src/main/java/com/fr/van/chart/designer/component/background/VanChartBackgroundPaneWithOutImageAndShadow.java

@ -1,10 +1,15 @@
package com.fr.van.chart.designer.component.background;
import com.fr.design.constants.LayoutConstants;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.backgroundpane.ColorBackgroundQuickPane;
import com.fr.design.mainframe.backgroundpane.NullBackgroundQuickPane;
import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import java.awt.Component;
@ -28,10 +33,13 @@ public class VanChartBackgroundPaneWithOutImageAndShadow extends VanChartBackgro
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double[] columnSize = {p, f};
double[] rowSize = { p,p,p};
double[] columnSize = {f, TableLayout4VanChartHelper.SECOND_EDIT_AREA_WIDTH};
double[] rowSize = {p, p, p};
return TableLayoutHelper.createTableLayoutPane(getPaneComponents(),rowSize,columnSize);
JPanel tableLayoutPane = TableLayoutHelper.createGapTableLayoutPane(getPaneComponents(), rowSize, columnSize,
TableLayout4VanChartHelper.COMPONENT_INTERVAL, LayoutConstants.VGAP_MEDIUM);
tableLayoutPane.setBorder(BorderFactory.createEmptyBorder(0, 12, 4, 0));
return tableLayoutPane;
}
@Override
@ -44,7 +52,7 @@ public class VanChartBackgroundPaneWithOutImageAndShadow extends VanChartBackgro
*/
@Override
public String title4PopupWindow() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Default_Name");
return Toolkit.i18nText("Fine-Design_Chart_Default_Name");
}
});
paneList.add(new ColorBackgroundQuickPane());
@ -54,11 +62,14 @@ public class VanChartBackgroundPaneWithOutImageAndShadow extends VanChartBackgro
@Override
protected Component[][] getPaneComponents() {
return new Component[][]{
new Component[]{typeComboBox, null},
new Component[]{centerPane, null},
new Component[]{new UILabel(labelName()), typeComboBox},
new Component[]{null, centerPane},
new Component[]{getTransparentLabel(), transparent},
};
}
protected String labelName() {
return Toolkit.i18nText("Fine-Design_Chart_Background");
}
}

3
designer-chart/src/main/java/com/fr/van/chart/designer/component/background/VanChartBackgroundWithOutShadowWithRadiusPane.java

@ -3,6 +3,7 @@ package com.fr.van.chart.designer.component.background;
import com.fr.chart.chartglyph.GeneralInfo;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.gui.ispinner.chart.UISpinnerWithPx;
import com.fr.design.i18n.Toolkit;
import java.awt.Component;
@ -24,7 +25,7 @@ public class VanChartBackgroundWithOutShadowWithRadiusPane extends VanChartBackg
}
protected Component[][] getPaneComponents() {
radius = new UISpinner(0, 1000, 1, 0);
radius = new UISpinnerWithPx(0, 1000, 1, 0);
return new Component[][]{
new Component[]{null, null},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Report_Fill")), typeComboBox},

3
designer-chart/src/main/java/com/fr/van/chart/designer/component/border/VanChartBorderWithAlphaPane.java

@ -1,6 +1,7 @@
package com.fr.van.chart.designer.component.border;
import com.fr.design.gui.frpane.UINumberDragPane;
import com.fr.design.gui.frpane.UINumberDragPaneWithPercent;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.utils.gui.UIComponentUtils;
import com.fr.design.widget.FRWidgetFactory;
@ -29,7 +30,7 @@ public class VanChartBorderWithAlphaPane extends VanChartBorderPane{
@Override
protected void initComponents() {
super.initComponents();
transparent = new UINumberDragPane(0,100);
transparent = new UINumberDragPaneWithPercent(0,100);
}
protected void initContent() {

3
designer-chart/src/main/java/com/fr/van/chart/designer/component/border/VanChartBorderWithRadiusPane.java

@ -4,6 +4,7 @@ import com.fr.chart.base.AttrBorder;
import com.fr.chart.chartglyph.GeneralInfo;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.gui.ispinner.chart.UISpinnerWithPx;
import com.fr.design.i18n.Toolkit;
import com.fr.design.utils.gui.UIComponentUtils;
import com.fr.design.widget.FRWidgetFactory;
@ -34,7 +35,7 @@ public class VanChartBorderWithRadiusPane extends VanChartBorderPane {
@Override
protected void initComponents() {
super.initComponents();
radius = new UISpinner(0,1000,1,0);
radius = new UISpinnerWithPx(0,1000,1,0);
}
@Override

3
designer-chart/src/main/java/com/fr/van/chart/designer/component/border/VanChartBorderWithShapePane.java

@ -7,6 +7,7 @@ import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.icombobox.LineComboBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.gui.ispinner.chart.UISpinnerWithPx;
import com.fr.design.gui.xcombox.MarkerComboBox;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.TableLayout;
@ -58,7 +59,7 @@ public class VanChartBorderWithShapePane extends BasicPane {
});
lineColorBox = new ColorSelectBox(100);
borderShape = new MarkerComboBox(MarkerFactory.getLabelShapeMarkers());
borderRadius = new UISpinner(0, 1000, 1, 0);
borderRadius = new UISpinnerWithPx(0, 1000, 1, 0);
}
private void createBorderPane() {

3
designer-chart/src/main/java/com/fr/van/chart/designer/component/marker/VanChartCommonMarkerPane.java

@ -4,6 +4,7 @@ import com.fr.chart.chartglyph.Marker;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.gui.ispinner.chart.UISpinnerWithPx;
import com.fr.design.gui.xcombox.MarkerComboBox;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.TableLayout;
@ -89,7 +90,7 @@ public class VanChartCommonMarkerPane extends BasicBeanPane<VanChartAttrMarker>
};
}
};
radius = new UISpinner(0, 100, 0.5, 0);
radius = new UISpinnerWithPx(0, 100, 0.5, 0);
double p = TableLayout.PREFERRED;

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

103
designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldAttrPane.java

@ -0,0 +1,103 @@
package com.fr.van.chart.designer.component.richText;
import com.fr.data.util.function.AbstractDataFunction;
import com.fr.design.event.UIObserverListener;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.style.FormatPane;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.TableLayout;
import com.fr.design.mainframe.chart.gui.data.CalculateComboBox;
import com.fr.plugin.chart.base.format.IntervalTimeFormat;
import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import com.fr.van.chart.designer.component.format.FormatPaneWithOutFont;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.event.ActionListener;
import java.text.Format;
public class VanChartFieldAttrPane extends JPanel {
private FormatPane fieldFormatPane;
private UIComboBox intervalTimeBox;
private CalculateComboBox dataFunctionBox;
private JPanel formatPane;
private JPanel intervalTimePane;
private JPanel fieldFunctionPane;
public VanChartFieldAttrPane() {
initComponents();
this.setLayout(new BorderLayout());
this.add(formatPane, BorderLayout.NORTH);
this.add(fieldFunctionPane, BorderLayout.CENTER);
this.setBorder(BorderFactory.createEmptyBorder(0, 30, 0, 0));
}
private void initComponents() {
double p = TableLayout.PREFERRED;
double d = TableLayout4VanChartHelper.DESCRIPTION_AREA_WIDTH;
double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH;
fieldFormatPane = new FormatPaneWithOutFont() {
protected JPanel createContentPane(Component[][] components) {
return TableLayout4VanChartHelper.createGapTableLayoutPane(components, new double[]{p, p, p}, new double[]{d, e});
}
};
intervalTimeBox = new UIComboBox(IntervalTimeFormat.getFormats());
dataFunctionBox = new CalculateComboBox();
Component[][] intervalTimeComponents = new Component[][]{
new Component[]{null, null},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Report_Base_Format"), SwingConstants.LEFT), intervalTimeBox}
};
Component[][] dataFunctionComponents = new Component[][]{
new Component[]{null, null},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Summary_Method"), SwingConstants.LEFT), dataFunctionBox}
};
intervalTimePane = TableLayout4VanChartHelper.createGapTableLayoutPane(intervalTimeComponents, new double[]{p, p}, new double[]{d, e});
formatPane = new JPanel(new BorderLayout());
formatPane.add(fieldFormatPane, BorderLayout.NORTH);
formatPane.add(intervalTimePane, BorderLayout.CENTER);
fieldFunctionPane = TableLayout4VanChartHelper.createGapTableLayoutPane(dataFunctionComponents, new double[]{p, p}, new double[]{d, e});
}
public void registerFormatListener(UIObserverListener listener) {
fieldFormatPane.registerChangeListener(listener);
intervalTimeBox.registerChangeListener(listener);
}
public void registerFunctionListener(ActionListener listener) {
dataFunctionBox.addActionListener(listener);
}
public void populate(Format format, IntervalTimeFormat intervalTime, AbstractDataFunction dataFunction, boolean showDataFunction, boolean showIntervalTime) {
fieldFormatPane.populateBean(format);
intervalTimeBox.setSelectedItem(intervalTime);
dataFunctionBox.populateBean(dataFunction);
fieldFormatPane.setVisible(!showIntervalTime);
intervalTimePane.setVisible(showIntervalTime);
fieldFunctionPane.setVisible(showDataFunction);
}
public Format updateFormat() {
return fieldFormatPane.update();
}
public IntervalTimeFormat updateIntervalTime() {
return (IntervalTimeFormat) intervalTimeBox.getSelectedItem();
}
public AbstractDataFunction updateDataFunction() {
return dataFunctionBox.updateBean();
}
}

202
designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldButton.java

@ -0,0 +1,202 @@
package com.fr.van.chart.designer.component.richText;
import com.fr.base.BaseUtils;
import com.fr.data.util.function.DataFunction;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ibutton.UIButtonUI;
import com.fr.design.gui.ibutton.UIToggleButton;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.utils.gui.GUIPaintUtils;
import com.fr.plugin.chart.base.FirstFunction;
import com.fr.plugin.chart.base.format.AttrTooltipDurationFormat;
import com.fr.plugin.chart.base.format.AttrTooltipFormat;
import com.fr.plugin.chart.base.format.IntervalTimeFormat;
import com.fr.stable.StringUtils;
import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import javax.swing.Icon;
import javax.swing.JPanel;
import javax.swing.plaf.ButtonUI;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Graphics2D;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.text.Format;
public class VanChartFieldButton extends JPanel {
private static final Icon ADD_ICON = BaseUtils.readIcon("/com/fr/base/images/cell/control/add.png");
private static final Color HOVER_COLOR = new Color(232, 232, 232);
private static final int W = 200;
private static final int H = 24;
private final String fieldName;
private final String fieldId;
private final AttrTooltipFormat tooltipFormat;
private final boolean showDataFunction;
private final boolean showIntervalTime;
private UIToggleButton fieldButton;
private UIButton addButton;
private DataFunction dataFunction = new FirstFunction();
public VanChartFieldButton(String fieldName, AttrTooltipFormat format, VanChartFieldListener listener) {
this(fieldName, format, false, false, listener);
}
public VanChartFieldButton(String fieldName, AttrTooltipFormat format, boolean showDataFunction, VanChartFieldListener listener) {
this(fieldName, format, showDataFunction, false, listener);
}
public VanChartFieldButton(String fieldName, AttrTooltipFormat format, boolean showDataFunction, boolean showIntervalTime, VanChartFieldListener listener) {
this.fieldName = fieldName;
this.tooltipFormat = format;
this.showDataFunction = showDataFunction;
this.showIntervalTime = showIntervalTime;
this.fieldId = format == null ? StringUtils.EMPTY : format.getFormatJSONKey();
initComponents(fieldName, listener);
this.setLayout(new BorderLayout());
this.add(getContentPane(), BorderLayout.CENTER);
}
public String getFieldName() {
return fieldName;
}
public boolean isEnable() {
return this.tooltipFormat.isEnable();
}
public void setEnable(boolean enable) {
this.tooltipFormat.setEnable(enable);
}
public Format getFormat() {
return tooltipFormat.getFormat();
}
public void setFormat(Format format) {
this.tooltipFormat.setFormat(format);
}
public IntervalTimeFormat getIntervalTimeFormat() {
if (tooltipFormat instanceof AttrTooltipDurationFormat) {
return ((AttrTooltipDurationFormat) tooltipFormat).getIntervalTimeFormat();
}
return IntervalTimeFormat.DAY;
}
public void setIntervalTimeFormat(IntervalTimeFormat intervalTime) {
if (tooltipFormat instanceof AttrTooltipDurationFormat) {
((AttrTooltipDurationFormat) tooltipFormat).setIntervalTimeFormat(intervalTime);
}
}
public DataFunction getDataFunction() {
return dataFunction;
}
public void setDataFunction(DataFunction dataFunction) {
this.dataFunction = dataFunction;
}
public boolean isShowDataFunction() {
return showDataFunction;
}
public boolean isShowIntervalTime() {
return showIntervalTime;
}
public String getFormatJs() {
return this.tooltipFormat.getJs();
}
private void initComponents(String fieldName, VanChartFieldListener listener) {
fieldButton = new UIToggleButton(fieldName) {
protected MouseListener getMouseListener() {
return new MouseAdapter() {
public void mousePressed(MouseEvent e) {
setSelected(true);
listener.refreshSelectedPane(fieldName);
listener.setGlobalName(fieldName);
listener.populateFieldFormatPane();
}
};
}
public ButtonUI getUI() {
return new FieldButtonUI();
}
};
addButton = new UIButton(ADD_ICON) {
public ButtonUI getUI() {
return new FieldButtonUI();
}
};
addButton.addMouseListener(new MouseAdapter() {
public void mousePressed(MouseEvent e) {
super.mousePressed(e);
listener.addSelectedField(fieldName, fieldId);
}
});
fieldButton.setBorderPaintedOnlyWhenPressed(true);
addButton.setBorderPaintedOnlyWhenPressed(true);
}
private JPanel getContentPane() {
Component[][] components = new Component[][]{
new Component[]{fieldButton, addButton}
};
double p = TableLayout.PREFERRED;
double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH;
double d = TableLayout4VanChartHelper.DESCRIPTION_AREA_WIDTH;
double[] rowSize = {p};
double[] columnSize = {e, d};
JPanel content = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 3, 0);
content.setPreferredSize(new Dimension(W, H));
return content;
}
public void setSelectedState(boolean selected) {
fieldButton.setSelected(selected);
}
private static class FieldButtonUI extends UIButtonUI {
protected void doExtraPainting(UIButton b, Graphics2D g2d, int w, int h, String selectedRoles) {
if (isPressed(b) && b.isPressedPainted()) {
GUIPaintUtils.fillPressed(g2d, 0, 0, w, h, b.isRoundBorder(), b.getRectDirection(), b.isDoneAuthorityEdited(selectedRoles));
} else if (isRollOver(b)) {
GUIPaintUtils.fillRollOver(g2d, 0, 0, w, h, b.isRoundBorder(), b.getRectDirection(), b.isDoneAuthorityEdited(selectedRoles), b.isPressedPainted(), HOVER_COLOR);
} else if (b.isNormalPainted()) {
GUIPaintUtils.fillNormal(g2d, 0, 0, w, h, b.isRoundBorder(), b.getRectDirection(), b.isDoneAuthorityEdited(selectedRoles), b.isPressedPainted());
}
}
}
}

400
designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldListPane.java

@ -0,0 +1,400 @@
package com.fr.van.chart.designer.component.richText;
import com.fr.data.util.function.AbstractDataFunction;
import com.fr.data.util.function.DataFunction;
import com.fr.design.event.UIObserverListener;
import com.fr.design.i18n.Toolkit;
import com.fr.design.ui.ModernUIPane;
import com.fr.general.ComparatorUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.chart.base.AttrTooltipContent;
import com.fr.plugin.chart.base.TableFieldCollection;
import com.fr.plugin.chart.base.TableFieldDefinition;
import com.fr.plugin.chart.base.format.AttrTooltipCategoryFormat;
import com.fr.plugin.chart.base.format.AttrTooltipDurationFormat;
import com.fr.plugin.chart.base.format.AttrTooltipFieldFormat;
import com.fr.plugin.chart.base.format.AttrTooltipFormat;
import com.fr.plugin.chart.base.format.AttrTooltipPercentFormat;
import com.fr.plugin.chart.base.format.AttrTooltipSeriesFormat;
import com.fr.plugin.chart.base.format.AttrTooltipValueFormat;
import com.fr.plugin.chart.base.format.IntervalTimeFormat;
import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.text.Format;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
public class VanChartFieldListPane extends JPanel {
private static final int FIELD_ADD_W = 400;
private static final int FIELD_ADD_H = 28;
private VanChartFieldButton categoryNameButton;
private VanChartFieldButton seriesNameButton;
private VanChartFieldButton valueButton;
private VanChartFieldButton percentButton;
private VanChartFieldAttrPane fieldAttrPane;
private ModernUIPane<VanChartRichEditorModel> richEditorPane;
private List<String> tableFieldNameList;
private List<VanChartFieldButton> tableFieldButtonList = new ArrayList<>();
private TableFieldCollection tableFieldCollection = new TableFieldCollection();
private VanChartFieldListener fieldListener;
public VanChartFieldListPane(VanChartFieldAttrPane fieldAttrPane, ModernUIPane<VanChartRichEditorModel> richEditorPane) {
List<String> richEditorFieldNames = VanChartRichEditorPane.getFieldNames();
this.tableFieldNameList = (!supportAddField() || richEditorFieldNames == null) ? new ArrayList<>() : richEditorFieldNames;
this.fieldAttrPane = fieldAttrPane;
this.richEditorPane = richEditorPane;
initFieldListListener();
initDefaultFieldButton();
registerAttrListener();
this.setLayout(new BorderLayout());
this.add(createDefaultFieldPane(), BorderLayout.CENTER);
this.add(createTableFieldPane(), BorderLayout.SOUTH);
}
public VanChartFieldButton getCategoryNameButton() {
return categoryNameButton;
}
public void setCategoryNameButton(VanChartFieldButton categoryNameButton) {
this.categoryNameButton = categoryNameButton;
}
public VanChartFieldButton getSeriesNameButton() {
return seriesNameButton;
}
public void setSeriesNameButton(VanChartFieldButton seriesNameButton) {
this.seriesNameButton = seriesNameButton;
}
public VanChartFieldButton getValueButton() {
return valueButton;
}
public void setValueButton(VanChartFieldButton valueButton) {
this.valueButton = valueButton;
}
public VanChartFieldButton getPercentButton() {
return percentButton;
}
public void setPercentButton(VanChartFieldButton percentButton) {
this.percentButton = percentButton;
}
public VanChartFieldListener getFieldListener() {
return fieldListener;
}
private JPanel createDefaultFieldPane() {
JPanel fieldPane = new JPanel();
fieldPane.setLayout(new GridLayout(0, 1, 1, 0));
addDefaultFieldButton(fieldPane);
fieldPane.setPreferredSize(new Dimension(FIELD_ADD_W, getDefaultFieldButtonList().size() * FIELD_ADD_H));
fieldPane.setBorder(BorderFactory.createEmptyBorder(5, 5, 0, 0));
return fieldPane;
}
protected void initDefaultFieldButton() {
categoryNameButton = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Category_Use_Name"),
new AttrTooltipCategoryFormat(), false, fieldListener);
seriesNameButton = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Series_Name"),
new AttrTooltipSeriesFormat(), false, fieldListener);
valueButton = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Use_Value"),
new AttrTooltipValueFormat(), false, fieldListener);
percentButton = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Use_Percent"),
new AttrTooltipPercentFormat(), false, fieldListener);
}
protected boolean supportAddField() {
return true;
}
protected void addDefaultFieldButton(JPanel fieldPane) {
fieldPane.add(categoryNameButton);
fieldPane.add(seriesNameButton);
fieldPane.add(valueButton);
fieldPane.add(percentButton);
}
private JPanel createTableFieldPane() {
if (tableFieldNameList == null || tableFieldNameList.isEmpty()) {
return new JPanel();
}
JPanel tableField = new JPanel();
tableField.setLayout(new GridLayout(0, 1, 1, 0));
for (String name : tableFieldNameList) {
VanChartFieldButton fieldButton = new VanChartFieldButton(name, new AttrTooltipFieldFormat(name), true, fieldListener);
tableField.add(fieldButton);
tableFieldButtonList.add(fieldButton);
}
tableField.setPreferredSize(new Dimension(FIELD_ADD_W, tableFieldNameList.size() * FIELD_ADD_H));
return TableLayout4VanChartHelper.createExpandablePaneWithTitleTopGap(Toolkit.i18nText("Fine-Design_Report_Table_Field"), tableField);
}
protected List<VanChartFieldButton> getDefaultFieldButtonList() {
List<VanChartFieldButton> defaultFieldButtonList = new ArrayList<>();
defaultFieldButtonList.add(categoryNameButton);
defaultFieldButtonList.add(seriesNameButton);
defaultFieldButtonList.add(valueButton);
defaultFieldButtonList.add(percentButton);
return defaultFieldButtonList;
}
private void initFieldListListener() {
fieldListener = new VanChartFieldListener() {
private String fieldName;
public void setGlobalName(String fieldName) {
this.fieldName = fieldName;
}
public String getGlobalName() {
return this.fieldName;
}
public VanChartFieldButton getSelectedField() {
List<VanChartFieldButton> defaultFieldButtonList = getDefaultFieldButtonList();
for (VanChartFieldButton fieldButton : defaultFieldButtonList) {
if (ComparatorUtils.equals(fieldButton.getFieldName(), this.fieldName)) {
return fieldButton;
}
}
for (VanChartFieldButton fieldButton : tableFieldButtonList) {
if (ComparatorUtils.equals(fieldButton.getFieldName(), this.fieldName)) {
return fieldButton;
}
}
return null;
}
public void refreshSelectedPane(String fieldName) {
if (ComparatorUtils.equals(fieldName, this.fieldName)) {
return;
}
List<VanChartFieldButton> defaultFieldButtonList = getDefaultFieldButtonList();
for (VanChartFieldButton fieldButton : defaultFieldButtonList) {
fieldButton.setSelectedState(ComparatorUtils.equals(fieldButton.getFieldName(), fieldName));
}
for (VanChartFieldButton fieldButton : tableFieldButtonList) {
fieldButton.setSelectedState(ComparatorUtils.equals(fieldButton.getFieldName(), fieldName));
}
}
public void addSelectedField(String fieldName, String fieldId) {
VanChartRichEditorModel model = richEditorPane.update();
model.setAddition(fieldName);
VanChartRichEditorPane.richEditorAddField(model);
if (tableFieldNameList.contains(fieldName)) {
int index = tableFieldNameList.indexOf(fieldName);
VanChartFieldButton fieldButton = tableFieldButtonList.get(index);
Format fieldFormat = fieldButton.getFormat();
DataFunction dataFunction = fieldButton.getDataFunction();
tableFieldCollection.addFieldDefinition(fieldName, new TableFieldDefinition(fieldName, fieldFormat, dataFunction));
}
}
public void populateFieldFormatPane() {
VanChartFieldButton fieldButton = this.getSelectedField();
if (fieldButton == null) {
return;
}
Format format = fieldButton.getFormat();
IntervalTimeFormat intervalTime = fieldButton.getIntervalTimeFormat();
AbstractDataFunction dataFunction = (AbstractDataFunction) fieldButton.getDataFunction();
boolean showDataFunction = fieldButton.isShowDataFunction();
boolean showIntervalTime = fieldButton.isShowIntervalTime();
fieldAttrPane.populate(format, intervalTime, dataFunction, showDataFunction, showIntervalTime);
}
public void updateFieldFormatPane() {
VanChartFieldButton fieldButton = this.getSelectedField();
if (fieldButton == null) {
return;
}
fieldButton.setFormat(fieldAttrPane.updateFormat());
fieldButton.setIntervalTimeFormat(fieldAttrPane.updateIntervalTime());
fieldButton.setDataFunction(fieldAttrPane.updateDataFunction());
if (tableFieldNameList.contains(fieldName)) {
Format fieldFormat = fieldButton.getFormat();
DataFunction dataFunction = fieldButton.getDataFunction();
tableFieldCollection.addFieldDefinition(fieldName, new TableFieldDefinition(fieldName, fieldFormat, dataFunction));
}
}
};
}
private void registerAttrListener() {
fieldAttrPane.registerFunctionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
fieldListener.updateFieldFormatPane();
}
});
fieldAttrPane.registerFormatListener(new UIObserverListener() {
public void doChange() {
fieldListener.updateFieldFormatPane();
}
});
}
private void checkFieldListSelected() {
List<VanChartFieldButton> defaultFieldButtonList = getDefaultFieldButtonList();
if (defaultFieldButtonList != null && defaultFieldButtonList.size() > 0) {
String selected = defaultFieldButtonList.get(0).getFieldName();
fieldListener.refreshSelectedPane(selected);
fieldListener.setGlobalName(selected);
fieldListener.populateFieldFormatPane();
}
}
public void populate(AttrTooltipContent tooltipContent) {
populateDefaultField(tooltipContent);
populateTableField(tooltipContent);
// 初次打开富文本界面选中第一个
checkFieldListSelected();
}
public void populateDefaultField(AttrTooltipContent tooltipContent) {
populateButtonFormat(categoryNameButton, tooltipContent.getRichTextCategoryFormat());
populateButtonFormat(seriesNameButton, tooltipContent.getRichTextSeriesFormat());
populateButtonFormat(valueButton, tooltipContent.getRichTextValueFormat());
populateButtonFormat(percentButton, tooltipContent.getRichTextPercentFormat());
}
public void populateButtonFormat(VanChartFieldButton button, AttrTooltipFormat format) {
if (button == null || format == null) {
return;
}
button.setEnable(format.isEnable());
button.setFormat(format.getFormat());
if (button.isShowIntervalTime() && format instanceof AttrTooltipDurationFormat) {
button.setIntervalTimeFormat(((AttrTooltipDurationFormat) format).getIntervalTimeFormat());
}
}
public void populateTableField(AttrTooltipContent tooltipContent) {
TableFieldCollection fieldCollection = tooltipContent.getFieldCollection();
if (fieldCollection == null) {
return;
}
Map<String, TableFieldDefinition> fieldDefinitionGroup = fieldCollection.getFieldNameFormulaMap();
if (fieldDefinitionGroup == null || fieldDefinitionGroup.isEmpty()) {
return;
}
this.tableFieldCollection = new TableFieldCollection();
for (int i = 0, len = tableFieldNameList.size(); i < len; i++) {
String fieldName = tableFieldNameList.get(i);
VanChartFieldButton fieldButton = tableFieldButtonList.get(i);
TableFieldDefinition fieldDefinition = fieldDefinitionGroup.get(fieldName);
if (fieldDefinitionGroup.containsKey(fieldName)) {
Format fieldFormat = fieldDefinition.getFormat();
DataFunction dataFunction = fieldDefinition.getDataFunction();
fieldButton.setFormat(fieldFormat);
fieldButton.setDataFunction(dataFunction);
this.tableFieldCollection.addFieldDefinition(fieldName, new TableFieldDefinition(fieldName, fieldFormat, dataFunction));
}
}
}
public void update(AttrTooltipContent tooltipContent) {
updateDefaultField(tooltipContent);
updateTableField(tooltipContent);
}
public void updateDefaultField(AttrTooltipContent tooltipContent) {
updateButtonFormat(categoryNameButton, tooltipContent.getRichTextCategoryFormat());
updateButtonFormat(seriesNameButton, tooltipContent.getRichTextSeriesFormat());
updateButtonFormat(valueButton, tooltipContent.getRichTextValueFormat());
updateButtonFormat(percentButton, tooltipContent.getRichTextPercentFormat());
}
public void updateTableField(AttrTooltipContent tooltipContent) {
try {
tooltipContent.setFieldCollection(this.tableFieldCollection);
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
}
public void updateButtonFormat(VanChartFieldButton button, AttrTooltipFormat format) {
if (button == null || format == null) {
return;
}
format.setEnable(button.isEnable());
format.setFormat(button.getFormat());
if (button.isShowIntervalTime() && format instanceof AttrTooltipDurationFormat) {
((AttrTooltipDurationFormat) format).setIntervalTimeFormat(button.getIntervalTimeFormat());
}
}
}

17
designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldListener.java

@ -0,0 +1,17 @@
package com.fr.van.chart.designer.component.richText;
import com.fr.design.event.GlobalNameListener;
public interface VanChartFieldListener extends GlobalNameListener {
public VanChartFieldButton getSelectedField();
public void refreshSelectedPane(String fieldName);
public void addSelectedField(String fieldName, String fieldId);
public void populateFieldFormatPane();
public void updateFieldFormatPane();
}

75
designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichEditorModel.java

@ -0,0 +1,75 @@
package com.fr.van.chart.designer.component.richText;
import com.fr.plugin.chart.type.TextAlign;
import com.fr.stable.StringUtils;
public class VanChartRichEditorModel {
private String content = StringUtils.EMPTY;
private boolean auto = true;
private String params = StringUtils.EMPTY;
private String initParams = StringUtils.EMPTY;
private String align = TextAlign.LEFT.getAlign();
private String addition = StringUtils.EMPTY;
public VanChartRichEditorModel() {
}
public VanChartRichEditorModel(String content, boolean auto, String params, String initParams, String align) {
this.content = content;
this.auto = auto;
this.params = params;
this.initParams = initParams;
this.align = align;
this.addition = StringUtils.EMPTY;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public boolean isAuto() {
return auto;
}
public void setAuto(boolean auto) {
this.auto = auto;
}
public String getParams() {
return params;
}
public void setParams(String params) {
this.params = params;
}
public String getInitParams() {
return initParams;
}
public void setInitParams(String initParams) {
this.initParams = initParams;
}
public String getAlign() {
return align;
}
public void setAlign(String align) {
this.align = align;
}
public String getAddition() {
return addition;
}
public void setAddition(String addition) {
this.addition = addition;
}
}

232
designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichEditorPane.java

@ -0,0 +1,232 @@
package com.fr.van.chart.designer.component.richText;
import com.fr.base.TableData;
import com.fr.base.chart.chartdata.TopDefinitionProvider;
import com.fr.chart.chartattr.Chart;
import com.fr.chart.chartattr.Plot;
import com.fr.chart.chartdata.MoreNameCDDefinition;
import com.fr.chart.chartdata.OneValueCDDefinition;
import com.fr.data.TableDataSource;
import com.fr.data.impl.EmbeddedTableData;
import com.fr.design.DesignModelAdapter;
import com.fr.design.DesignerEnvManager;
import com.fr.design.data.DesignTableDataManager;
import com.fr.design.ui.ModernUIPane;
import com.fr.general.ComparatorUtils;
import com.fr.general.IOUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.chart.base.AttrTooltipRichText;
import com.fr.plugin.chart.custom.CustomDefinition;
import com.fr.plugin.chart.custom.type.CustomPlotType;
import com.fr.plugin.chart.type.TextAlign;
import com.fr.stable.StringUtils;
import com.fr.van.chart.designer.PlotFactory;
import com.teamdev.jxbrowser.chromium.Browser;
import com.teamdev.jxbrowser.chromium.JSValue;
import com.teamdev.jxbrowser.chromium.events.ScriptContextAdapter;
import com.teamdev.jxbrowser.chromium.events.ScriptContextEvent;
import java.util.List;
import java.util.Locale;
import java.util.Map;
public class VanChartRichEditorPane {
private static final String PARAMS_SPLITTER = "|";
private static final String NAME_SPACE = "Pool";
private static final String VARIABLE = "data";
private static final String RICH_EDITOR_HTML = "/com/fr/design/editor/rich_editor.html";
private static final String REFRESH = "refresh()";
private static final String ADD_FIELD = "addField()";
private static ModernUIPane<VanChartRichEditorModel> richEditorPane;
private static Browser browser;
private static List<String> fieldNames;
public static List<String> getFieldNames() {
return fieldNames;
}
// 更新普通图表中指定plot的数据集字段
public static void refreshCommonChartFieldNames(Chart chart) {
if (chart == null) {
return;
}
Plot plot = chart.getPlot();
if (plot == null) {
return;
}
VanChartRichEditorPane.fieldNames = null;
if (!PlotFactory.plotSupportAddTableField(plot)) {
return;
}
TopDefinitionProvider definition = chart.getFilterDefinition();
VanChartRichEditorPane.refreshFieldNames(definition);
}
// 更新组合图表中指定plot的数据集字段
public static void refreshCustomChartTableFieldNames(Chart chart, CustomPlotType plotType) {
if (chart == null || plotType == null) {
return;
}
VanChartRichEditorPane.fieldNames = null;
TopDefinitionProvider filterDefinition = chart.getFilterDefinition();
if (filterDefinition instanceof CustomDefinition) {
CustomDefinition customDefinition = (CustomDefinition) filterDefinition;
Map<CustomPlotType, TopDefinitionProvider> definitionProviderMap = customDefinition.getDefinitionProviderMap();
VanChartRichEditorPane.refreshFieldNames(definitionProviderMap.get(plotType));
}
}
// 更新富文本数据集字段
public static void refreshFieldNames(TopDefinitionProvider definition) {
if (definition == null) {
return;
}
DesignModelAdapter adapter = DesignModelAdapter.getCurrentModelAdapter();
TableDataSource tableDataSource = adapter == null ? null : adapter.getBook();
TableData tableData = null;
if (ComparatorUtils.equals(definition.getDataDefinitionType(), OneValueCDDefinition.DEFINITION_TYPE)) {
OneValueCDDefinition oneValueCDDefinition = (OneValueCDDefinition) definition;
tableData = oneValueCDDefinition.getTableData();
}
if (ComparatorUtils.equals(definition.getDataDefinitionType(), MoreNameCDDefinition.DEFINITION_TYPE)) {
MoreNameCDDefinition moreNameCDDefinition = (MoreNameCDDefinition) definition;
tableData = moreNameCDDefinition.getTableData();
}
if (tableData == null) {
return;
}
try {
EmbeddedTableData embeddedTableData = DesignTableDataManager.previewTableDataNotNeedInputParameters(tableDataSource,
tableData, TableData.RESULT_NOT_NEED, false);
List<String> fieldNames = DesignTableDataManager.getColumnNamesByTableData(embeddedTableData);
VanChartRichEditorPane.fieldNames = fieldNames;
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
}
public static ModernUIPane<VanChartRichEditorModel> createRichEditorPane(AttrTooltipRichText richEditor) {
VanChartRichEditorModel model = getRichEditorModel(richEditor);
return createRichEditorPane(model);
}
public static ModernUIPane<VanChartRichEditorModel> createRichEditorPane(VanChartRichEditorModel model) {
if (richEditorPane == null) {
richEditorPane = initPane(model);
} else {
richEditorRefresh(model);
}
return richEditorPane;
}
public static void richEditorRefresh(VanChartRichEditorModel model) {
if (richEditorPane != null && browser != null) {
refresh(browser, model);
}
}
public static void richEditorAddField(VanChartRichEditorModel model) {
if (richEditorPane != null && browser != null) {
addField(browser, model);
}
}
public static ModernUIPane<VanChartRichEditorModel> initPane(VanChartRichEditorModel model) {
return new ModernUIPane.Builder<VanChartRichEditorModel>()
.prepare(new ScriptContextAdapter() {
public void onScriptContextCreated(ScriptContextEvent event) {
browser = event.getBrowser();
browser.getCacheStorage().clearCache();
browser.executeJavaScript(IOUtils.readResourceAsString("/com/fr/web/ui/fineui.min.js"));
browser.executeJavaScript(IOUtils.readResourceAsString("/com/fr/design/editor/script/i18n.js"));
browser.executeJavaScript(generateTransformI18nJS());
browser.executeJavaScript(IOUtils.readResourceAsString("/com/fr/web/ui/materials.min.js"));
JSValue ns = browser.executeJavaScriptAndReturnValue("window." + NAME_SPACE);
ns.asObject().setProperty(VARIABLE, model);
}
})
.withEMB(RICH_EDITOR_HTML)
.namespace(NAME_SPACE).build();
}
public static void refresh(Browser browser, VanChartRichEditorModel model) {
stateChange(browser, model, REFRESH);
}
public static void addField(Browser browser, VanChartRichEditorModel model) {
stateChange(browser, model, ADD_FIELD);
}
public static void stateChange(Browser browser, VanChartRichEditorModel model, String trigger) {
JSValue ns = browser.executeJavaScriptAndReturnValue("window." + NAME_SPACE);
ns.asObject().setProperty(VARIABLE, model);
browser.executeJavaScript("window." + NAME_SPACE + "." + trigger);
}
public static VanChartRichEditorModel getRichEditorModel(AttrTooltipRichText richText) {
Map<String, String> paramsMap = richText.getParams();
StringBuilder paramsStr = new StringBuilder(StringUtils.EMPTY);
if (paramsMap != null) {
for (Map.Entry<String, String> entry : paramsMap.entrySet()) {
paramsStr.append(entry.getKey()).append(":").append(entry.getValue());
paramsStr.append(PARAMS_SPLITTER);
}
}
int len = paramsStr.length();
if (len > 0) {
paramsStr.deleteCharAt(len - 1);
}
String content = richText.getContent();
String initParams = StringUtils.EMPTY;
String align = StringUtils.EMPTY;
if (content.contains("data-id") && !content.contains("class")) {
initParams = richText.getInitParamsContent();
String left = TextAlign.LEFT.getAlign();
String center = TextAlign.CENTER.getAlign();
align = content.contains(left) ? left : center;
}
return new VanChartRichEditorModel(content, richText.isAuto(), paramsStr.toString(), initParams, align);
}
public static String generateTransformI18nJS() {
String language = "zh_CN";
Locale locale = DesignerEnvManager.getEnvManager().getLanguage();
if (locale != null) {
language = locale.toString();
}
return "!(function () { window.transformI18n && window.transformI18n('" + language + "' || 'zh_CN'); }());";
}
}

10
designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartRichEditorDialog.java → designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichTextDialog.java

@ -1,4 +1,4 @@
package com.fr.van.chart.designer.component;
package com.fr.van.chart.designer.component.richText;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.BasicPane;
@ -8,17 +8,17 @@ import com.fr.design.utils.gui.GUICoreUtils;
import java.awt.Dimension;
import java.awt.Frame;
public class VanChartRichEditorDialog extends BasicDialog {
public class VanChartRichTextDialog extends BasicDialog {
public static final Dimension DEFAULT = new Dimension(960, 600);
public static final Dimension DEFAULT = new Dimension(960, 800);
public VanChartRichEditorDialog(Frame parent, BasicPane pane) {
public VanChartRichTextDialog(Frame parent, BasicPane pane) {
super(parent, pane);
this.setTitle(Toolkit.i18nText("Fine-Design_Report_RichTextEditor"));
this.setBasicDialogSize(DEFAULT);
GUICoreUtils.centerWindow(this);
this.setResizable(true);
this.setResizable(false);
this.setModal(true);
}

97
designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichTextPane.java

@ -0,0 +1,97 @@
package com.fr.van.chart.designer.component.richText;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.ui.ModernUIPane;
import com.fr.plugin.chart.base.AttrTooltipContent;
import com.fr.stable.StringUtils;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import java.awt.BorderLayout;
import java.awt.Dimension;
// 标签提示中的富文本面板,包含字段设置和富文本编辑器
public class VanChartRichTextPane extends BasicBeanPane<AttrTooltipContent> {
private static final int FIELD_PANE_W = 470;
private static final int FIELD_PANE_H = 270;
private static final int RICH_EDITOR_W = 940;
private static final int RICH_EDITOR_H = 460;
private VanChartFieldListPane fieldListPane;
private VanChartFieldAttrPane fieldAttrPane;
public VanChartRichTextPane(ModernUIPane<VanChartRichEditorModel> richEditor) {
fieldAttrPane = new VanChartFieldAttrPane();
fieldListPane = createFieldListPane(fieldAttrPane, richEditor);
this.setLayout(new BorderLayout());
this.add(createFieldContentPane(), BorderLayout.CENTER);
this.add(createRichEditorPane(richEditor), BorderLayout.SOUTH);
}
public VanChartFieldListPane getFieldListPane() {
return fieldListPane;
}
private JPanel createFieldContentPane() {
JPanel fieldPane = new JPanel();
fieldPane.setLayout(FRGUIPaneFactory.create2ColumnGridLayout());
// 新增字段目录
JPanel fieldListContent = new JPanel();
fieldListContent.setLayout(new BorderLayout());
fieldListContent.add(fieldListPane, BorderLayout.NORTH);
JScrollPane fieldListScrollPane = new JScrollPane(fieldListContent);
fieldListScrollPane.setPreferredSize(new Dimension(FIELD_PANE_W, FIELD_PANE_H));
fieldListScrollPane.setHorizontalScrollBar(null);
fieldListScrollPane.setBorder(BorderFactory.createTitledBorder(Toolkit.i18nText("Fine-Design_Report_Add_Field")));
// 字段格式和汇总
JScrollPane fieldAttrScrollPane = new JScrollPane(fieldAttrPane);
fieldAttrScrollPane.setPreferredSize(new Dimension(FIELD_PANE_W, FIELD_PANE_H));
fieldAttrScrollPane.setBorder(BorderFactory.createTitledBorder(Toolkit.i18nText("Fine-Design_Report_Field_Setting")));
fieldPane.add(fieldListScrollPane);
fieldPane.add(fieldAttrScrollPane);
return fieldPane;
}
protected VanChartFieldListPane createFieldListPane(VanChartFieldAttrPane fieldAttrPane, ModernUIPane<VanChartRichEditorModel> richEditor) {
return new VanChartFieldListPane(fieldAttrPane, richEditor);
}
private JPanel createRichEditorPane(JPanel richEditor) {
JPanel richEditorPane = new JPanel();
richEditorPane.setLayout(new BorderLayout());
richEditorPane.setPreferredSize(new Dimension(RICH_EDITOR_W, RICH_EDITOR_H));
richEditorPane.add(richEditor, BorderLayout.CENTER);
return richEditorPane;
}
protected AttrTooltipContent getInitialTooltipContent() {
return new AttrTooltipContent();
}
public void populateBean(AttrTooltipContent tooltipContent) {
fieldListPane.populate(tooltipContent);
}
public AttrTooltipContent updateBean() {
AttrTooltipContent content = getInitialTooltipContent();
fieldListPane.update(content);
return content;
}
protected String title4PopupWindow() {
return StringUtils.EMPTY;
}
}

18
designer-chart/src/main/java/com/fr/van/chart/designer/component/tooltip/RefreshTooltipContentPaneWithOutSeries.java

@ -29,14 +29,6 @@ public class RefreshTooltipContentPaneWithOutSeries extends TooltipContentPaneWi
setChangedPercentFormatPane(new ChangedPercentFormatPaneWithCheckBox(parent, showOnPane));
}
@Override
protected void initRichTextFormatPane(VanChartStylePane parent, JPanel showOnPane) {
super.initRichTextFormatPane(parent, showOnPane);
setRichTextChangedValueFormatPane(new ChangedValueFormatPaneWithoutCheckBox(parent, showOnPane));
setRichTextChangedPercentFormatPane(new ChangedPercentFormatPaneWithoutCheckBox(parent, showOnPane));
}
protected double[] getRowSize(double p){
return new double[]{p,p,p,p,p};
}
@ -50,14 +42,4 @@ public class RefreshTooltipContentPaneWithOutSeries extends TooltipContentPaneWi
new Component[]{getChangedPercentFormatPane(),null},
};
}
protected Component[][] getRichTextComponents() {
return new Component[][]{
new Component[]{getRichTextCategoryNameFormatPane(), null},
new Component[]{getRichTextValueFormatPane(), null},
new Component[]{getRichTextChangedValueFormatPane(), null},
new Component[]{getRichTextPercentFormatPane(), null},
new Component[]{getRichTextChangedPercentFormatPane(), null}
};
}
}

53
designer-chart/src/main/java/com/fr/van/chart/designer/component/tooltip/TooltipContentPaneWithOutSeries.java

@ -1,10 +1,17 @@
package com.fr.van.chart.designer.component.tooltip;
import com.fr.design.i18n.Toolkit;
import com.fr.design.ui.ModernUIPane;
import com.fr.plugin.chart.base.AttrTooltipContent;
import com.fr.plugin.chart.base.AttrTooltipRichText;
import com.fr.plugin.chart.base.format.AttrTooltipCategoryFormat;
import com.fr.plugin.chart.base.format.AttrTooltipFormat;
import com.fr.plugin.chart.base.format.AttrTooltipPercentFormat;
import com.fr.plugin.chart.base.format.AttrTooltipValueFormat;
import com.fr.van.chart.designer.component.VanChartTooltipContentPane;
import com.fr.van.chart.designer.component.format.VanChartFormatPaneWithoutCheckBox;
import com.fr.van.chart.designer.component.richText.VanChartFieldAttrPane;
import com.fr.van.chart.designer.component.richText.VanChartFieldListPane;
import com.fr.van.chart.designer.component.richText.VanChartRichEditorModel;
import com.fr.van.chart.designer.component.richText.VanChartRichTextPane;
import com.fr.van.chart.designer.style.VanChartStylePane;
import javax.swing.JPanel;
@ -33,31 +40,33 @@ public class TooltipContentPaneWithOutSeries extends VanChartTooltipContentPane
};
}
protected Component[][] getRichTextComponents() {
return new Component[][]{
new Component[]{getRichTextCategoryNameFormatPane(), null},
new Component[]{getRichTextValueFormatPane(), null},
new Component[]{getRichTextPercentFormatPane(), null}
protected VanChartRichTextPane createRichTextPane(ModernUIPane<VanChartRichEditorModel> richEditorPane) {
return new VanChartRichTextPane(richEditorPane) {
protected VanChartFieldListPane createFieldListPane(VanChartFieldAttrPane fieldAttrPane, ModernUIPane<VanChartRichEditorModel> richEditor) {
return new VanChartFieldListPaneWithOutSeries(fieldAttrPane, richEditor);
}
protected AttrTooltipContent getInitialTooltipContent() {
return createAttrTooltip();
}
};
}
protected void populateRichEditor(AttrTooltipContent attrTooltipContent) {
VanChartFormatPaneWithoutCheckBox[] formatPaneGroup = new VanChartFormatPaneWithoutCheckBox[]{
getRichTextCategoryNameFormatPane(),
getRichTextValueFormatPane(),
getRichTextPercentFormatPane()
protected String[] getRichTextFieldNames() {
return new String[]{
Toolkit.i18nText("Fine-Design_Chart_Category_Use_Name"),
Toolkit.i18nText("Fine-Design_Chart_Use_Value"),
Toolkit.i18nText("Fine-Design_Chart_Use_Percent")
};
}
AttrTooltipFormat[] formatGroup = new AttrTooltipFormat[]{
attrTooltipContent.getRichTextCategoryFormat(),
attrTooltipContent.getRichTextValueFormat(),
attrTooltipContent.getRichTextPercentFormat()
protected AttrTooltipFormat[] getRichTextFieldFormats() {
return new AttrTooltipFormat[]{
new AttrTooltipCategoryFormat(),
new AttrTooltipValueFormat(),
new AttrTooltipPercentFormat()
};
setRichTextAttr(new AttrTooltipRichText());
populateRichTextFormat(formatPaneGroup, formatGroup);
populateRichText(attrTooltipContent.getRichTextAttr());
checkRichEditorState(attrTooltipContent);
}
}

34
designer-chart/src/main/java/com/fr/van/chart/designer/component/tooltip/VanChartFieldListPaneWithOutSeries.java

@ -0,0 +1,34 @@
package com.fr.van.chart.designer.component.tooltip;
import com.fr.design.ui.ModernUIPane;
import com.fr.van.chart.designer.component.richText.VanChartFieldAttrPane;
import com.fr.van.chart.designer.component.richText.VanChartFieldButton;
import com.fr.van.chart.designer.component.richText.VanChartFieldListPane;
import com.fr.van.chart.designer.component.richText.VanChartRichEditorModel;
import javax.swing.JPanel;
import java.util.ArrayList;
import java.util.List;
public class VanChartFieldListPaneWithOutSeries extends VanChartFieldListPane {
public VanChartFieldListPaneWithOutSeries(VanChartFieldAttrPane fieldAttrPane, ModernUIPane<VanChartRichEditorModel> richEditorPane) {
super(fieldAttrPane, richEditorPane);
}
protected void addDefaultFieldButton(JPanel fieldPane) {
fieldPane.add(getCategoryNameButton());
fieldPane.add(getValueButton());
fieldPane.add(getPercentButton());
}
protected List<VanChartFieldButton> getDefaultFieldButtonList() {
List<VanChartFieldButton> fieldButtonList = new ArrayList<>();
fieldButtonList.add(getCategoryNameButton());
fieldButtonList.add(getValueButton());
fieldButtonList.add(getPercentButton());
return fieldButtonList;
}
}

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

Loading…
Cancel
Save