Browse Source

Merge branch 'release/10.0' of ssh://cloud.finedevelop.com:7999/~lanlan/design into release/10.0

feature/big-screen
Lanlan 4 years ago
parent
commit
634f5be0cd
  1. 16
      designer-base/src/main/java/com/fr/base/svg/IconUtils.java
  2. 4
      designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionComboBoxPanel.java
  3. 11
      designer-base/src/main/java/com/fr/design/dialog/BasicPane.java
  4. 6
      designer-base/src/main/java/com/fr/design/editlock/EditLockUtils.java
  5. 20
      designer-base/src/main/java/com/fr/design/fun/PluginManagerProvider.java
  6. 30
      designer-base/src/main/java/com/fr/design/fun/impl/AbstractPluginManagerProvider.java
  7. 57
      designer-base/src/main/java/com/fr/design/i18n/DesignSizeI18nManager.java
  8. 25
      designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java
  9. 15
      designer-base/src/main/java/com/fr/design/ui/Assistant.java
  10. 29
      designer-base/src/main/java/com/fr/env/PluginErrorRemindDialog.java
  11. 1
      designer-base/src/main/resources/com/fr/design/i18n/dimension_en.properties
  12. 0
      designer-base/src/main/resources/com/fr/design/i18n/dimension_ja_JP.properties
  13. 0
      designer-base/src/main/resources/com/fr/design/i18n/dimension_ko_KR.properties
  14. 1
      designer-base/src/main/resources/com/fr/design/i18n/dimension_zh.properties
  15. 0
      designer-base/src/main/resources/com/fr/design/i18n/dimension_zh_TW.properties
  16. 80
      designer-base/src/test/java/com/fr/design/i18n/DesignSizeI18nManagerTest.java
  17. 4
      designer-chart/src/main/java/com/fr/design/chartx/component/MapAreaMatchPane.java
  18. 4
      designer-chart/src/main/java/com/fr/design/chartx/component/MatchAreaTable.java
  19. 2
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartOtherPane.java
  20. 4
      designer-chart/src/main/java/com/fr/van/chart/custom/other/VanChartCustomConditionAttrPane.java
  21. 21
      designer-chart/src/main/java/com/fr/van/chart/custom/other/VanChartCustomPlotConditionAttrTabPane.java
  22. 15
      designer-chart/src/main/java/com/fr/van/chart/custom/style/VanChartCustomPlotLabelTabPane.java
  23. 15
      designer-chart/src/main/java/com/fr/van/chart/custom/style/VanChartCustomPlotTooltipTabPane.java
  24. 11
      designer-chart/src/main/java/com/fr/van/chart/custom/style/VanChartCustomStylePane.java
  25. 19
      designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java
  26. 5
      designer-chart/src/main/java/com/fr/van/chart/designer/component/marker/VanChartImageMarkerPane.java
  27. 40
      designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldButton.java
  28. 2
      designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldListPane.java
  29. 39
      designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichEditorPane.java
  30. 2
      designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichTextDialog.java
  31. 2
      designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichTextPane.java
  32. 2
      designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartStylePane.java
  33. 3
      designer-chart/src/main/java/com/fr/van/chart/designer/style/tooltip/VanChartPlotTooltipPane.java
  34. 2
      designer-chart/src/main/java/com/fr/van/chart/map/VanChartMapSeriesPane.java
  35. 2
      designer-chart/src/main/java/com/fr/van/chart/structure/desinger/style/StructureNodeStylePane.java
  36. 66
      designer-chart/src/main/resources/com/fr/design/editor/rich_editor.html
  37. 6
      designer-chart/src/main/resources/com/fr/design/editor/script/editor.js
  38. 2
      designer-chart/src/main/resources/com/fr/design/editor/script/editor.model.js
  39. 6
      designer-chart/src/main/resources/com/fr/design/editor/script/insertcombo/combo.insert_param.js
  40. 2
      designer-realize/src/main/java/com/fr/design/webattr/WriteToolBarPane.java

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

@ -38,9 +38,8 @@ public class IconUtils {
if (IOUtils.readResource(resource) != null) { if (IOUtils.readResource(resource) != null) {
return SVGIcon.readSVGIcon(resource); return SVGIcon.readSVGIcon(resource);
} }
// 适配某些插件里是_normal.png、_selected.png的情况 // 适配插件
String pngResource = resource.replace(ICON_SUFFIX_SVG, ICON_SUFFIX_PNG); return adjustPluginsPng(resource);
return IOUtils.readIcon(pngResource);
} }
return IOUtils.readIcon(resource); return IOUtils.readIcon(resource);
} }
@ -48,6 +47,17 @@ public class IconUtils {
return readNoSuffixResource(resource, ICON_TYPE_NORMAL); 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 * 尝试读取不带扩展名的图标svg优先其次png最后gif都没读到就打印错误日志返回空白Icon
* @param resource 图片路径 * @param resource 图片路径

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

@ -71,7 +71,7 @@ public class ConnectionComboBoxPanel extends ItemEditableComboBoxPanel {
EditLockUtils.CONNECTION_LOCKED_ICON, EditLockUtils.CONNECTION_LOCKED_ICON,
IconUtils.readIcon("/com/fr/design/images/m_web/connection"), IconUtils.readIcon("/com/fr/design/images/m_web/connection"),
EditLockUtils.CONNECTION_LOCKED_TOOLTIPS, EditLockUtils.CONNECTION_LOCKED_TOOLTIPS,
StringUtils.EMPTY null
); );
editButton.setPreferredSize(buttonSize); editButton.setPreferredSize(buttonSize);
editButton.addActionListener(new ActionListener() { editButton.addActionListener(new ActionListener() {
@ -128,7 +128,7 @@ public class ConnectionComboBoxPanel extends ItemEditableComboBoxPanel {
boolean actionLock = EditLockUtils.lock(LockItem.CONNECTION); boolean actionLock = EditLockUtils.lock(LockItem.CONNECTION);
if (!actionLock) { if (!actionLock) {
// 锁定失败,代表已经被其他用户锁定,跳出弹窗提示 // 锁定失败,代表已经被其他用户锁定,跳出弹窗提示
EditLockUtils.showLockMessage(); EditLockUtils.showLockMessage(this);
return; return;
} }
// 锁定成功,执行后续操作 // 锁定成功,执行后续操作

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

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

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

@ -13,6 +13,8 @@ import org.jetbrains.annotations.Nullable;
import javax.swing.Icon; import javax.swing.Icon;
import javax.swing.JOptionPane; import javax.swing.JOptionPane;
import javax.swing.SwingUtilities;
import java.awt.Component;
import java.awt.Image; import java.awt.Image;
/** /**
@ -65,6 +67,10 @@ public class EditLockUtils {
FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), EditLockUtils.LOCKED_MESSAGE, EditLockUtils.TOOLTIPS, JOptionPane.INFORMATION_MESSAGE, EditLockUtils.TOOLTIPS_ICON); 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) { public static boolean lock(LockItem lockItem) {
return WorkContext.getCurrent().get(EditLockOperator.class).lock(lockItem); return WorkContext.getCurrent().get(EditLockOperator.class).lock(lockItem);
} }

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

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

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

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

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

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

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

@ -41,6 +41,7 @@ import com.fr.design.actions.server.PluginManagerAction;
import com.fr.design.file.NewTemplatePane; import com.fr.design.file.NewTemplatePane;
import com.fr.design.fun.MenuHandler; import com.fr.design.fun.MenuHandler;
import com.fr.design.fun.OemProcessor; import com.fr.design.fun.OemProcessor;
import com.fr.design.fun.PluginManagerProvider;
import com.fr.design.fun.TableDataPaneProcessor; import com.fr.design.fun.TableDataPaneProcessor;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
@ -72,6 +73,7 @@ import com.fr.plugin.observer.PluginEventListener;
import com.fr.plugin.observer.PluginEventType; import com.fr.plugin.observer.PluginEventType;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.stable.bridge.ObjectHolder;
import com.fr.stable.os.support.OSBasedAction; import com.fr.stable.os.support.OSBasedAction;
import com.fr.stable.os.support.OSSupportCenter; import com.fr.stable.os.support.OSSupportCenter;
import com.fr.start.OemHandler; import com.fr.start.OemHandler;
@ -487,11 +489,7 @@ public abstract class ToolBarMenuDock {
} }
if (!DesignerMode.isAuthorityEditing()) { if (!DesignerMode.isAuthorityEditing()) {
if (shouldShowPlugin()) { addPluginManagerAction(menuDef);
menuDef.addShortCut(
new PluginManagerAction()
);
}
menuDef.addShortCut( menuDef.addShortCut(
new FunctionManagerAction(), new FunctionManagerAction(),
new GlobalParameterAction() new GlobalParameterAction()
@ -502,6 +500,23 @@ public abstract class ToolBarMenuDock {
return menuDef; return menuDef;
} }
private void addPluginManagerAction(MenuDef menuDef) {
Set<PluginManagerProvider> providers = ExtraDesignClassManager.getInstance().getArray(PluginManagerProvider.MARK_STRING);
if (providers != null) {
for (PluginManagerProvider provider : providers) {
if (provider.selector().accept(new ObjectHolder())) {
menuDef.addShortCut(provider.pluginManagerAction());
return;
}
}
}
if (shouldShowPlugin()) {
menuDef.addShortCut(
new PluginManagerAction()
);
}
}
private ShortCut createGlobalTDAction() { private ShortCut createGlobalTDAction() {
TableDataPaneProcessor processor = ExtraDesignClassManager.getInstance().getSingle(TableDataPaneProcessor.XML_TAG); TableDataPaneProcessor processor = ExtraDesignClassManager.getInstance().getSingle(TableDataPaneProcessor.XML_TAG);
return processor == null ? new GlobalTableDataAction() : processor.createServerTDAction(); return processor == null ? new GlobalTableDataAction() : processor.createServerTDAction();

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.ProtocolService;
import com.teamdev.jxbrowser.chromium.URLResponse; import com.teamdev.jxbrowser.chromium.URLResponse;
import javax.activation.MimetypesFileTypeMap;
import java.io.DataInputStream; import java.io.DataInputStream;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.nio.file.Files; import java.nio.file.Files;
import java.nio.file.Path; import java.nio.file.Path;
import java.nio.file.Paths;
/** /**
* @author richie * @author richie
@ -50,6 +48,19 @@ public class Assistant {
if (path.endsWith(".svg")) { if (path.endsWith(".svg")) {
return "image/svg+xml"; 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(); Path file = new File(path).toPath();
try { try {
return Files.probeContentType(file); return Files.probeContentType(file);

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

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

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

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

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

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

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

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

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

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

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

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.TableDataSourceTailor;
import com.fr.data.impl.EmbeddedTableData; import com.fr.data.impl.EmbeddedTableData;
import com.fr.data.impl.NameTableData; 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.beans.BasicBeanPane;
import com.fr.design.data.DesignTableDataManager; import com.fr.design.data.DesignTableDataManager;
import com.fr.design.data.datapane.TableDataComboBox; 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.general.data.DataModel;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.plugin.chart.map.data.MapMatchResult; import com.fr.plugin.chart.map.data.MapMatchResult;
import com.fr.plugin.chart.map.server.ChartGEOJSONHelper;
import com.fr.script.Calculator; import com.fr.script.Calculator;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
@ -246,7 +246,7 @@ public class MapAreaMatchPane extends BasicBeanPane<MapMatchResult> {
private void populateMatchData(Object[] columnData) { private void populateMatchData(Object[] columnData) {
Set<String> geoAreas = matchAreaTable.getItems(); 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]; 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; 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.design.i18n.Toolkit;
import com.fr.general.GeneralUtils; import com.fr.general.GeneralUtils;
import com.fr.plugin.chart.map.server.ChartGEOJSONHelper;
import javax.swing.AbstractCellEditor; import javax.swing.AbstractCellEditor;
import javax.swing.JTable; import javax.swing.JTable;
@ -88,7 +88,7 @@ public class MatchAreaTable extends JTable {
return; return;
} }
int index = areaNameIndex.get(areaName); 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(); getColumnModel().getColumn(1).getCellEditor().stopCellEditing();
this.setValueAt(result, index, 1); this.setValueAt(result, index, 1);
} }

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

@ -111,7 +111,7 @@ public class ChartOtherPane extends AbstractChartAttrPane {
public void populateBean(Chart chart) { public void populateBean(Chart chart) {
interactivePane.populateBean(chart); interactivePane.populateBean(chart);
if (ChartOtherPane.this.isHaveCondition()) { if (ChartOtherPane.this.isHaveCondition()) {
VanChartRichEditorPane.refreshFieldNames(chart); VanChartRichEditorPane.refreshCommonChartFieldNames(chart);
conditionAttrPane.populateBean(chart); conditionAttrPane.populateBean(chart);
} }
} }

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(); layoutContentPane();
} }
if(conditionAttrPane != null) { 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; package com.fr.van.chart.custom.other;
import com.fr.chart.chartattr.Chart;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.plugin.chart.attr.plot.VanChartPlot; import com.fr.plugin.chart.attr.plot.VanChartPlot;
import com.fr.plugin.chart.custom.CustomPlotFactory; import com.fr.plugin.chart.custom.CustomPlotFactory;
import com.fr.plugin.chart.custom.VanChartCustomPlot; import com.fr.plugin.chart.custom.VanChartCustomPlot;
import com.fr.plugin.chart.custom.type.CustomPlotType; import com.fr.plugin.chart.custom.type.CustomPlotType;
import com.fr.van.chart.custom.component.VanChartCustomPlotTabPane; 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 com.fr.van.chart.designer.other.VanChartConditionAttrPane;
import javax.swing.JPanel; import javax.swing.JPanel;
@ -16,10 +18,17 @@ import java.util.List;
* Created by Fangjie on 2016/4/28. * Created by Fangjie on 2016/4/28.
*/ */
public class VanChartCustomPlotConditionAttrTabPane extends VanChartCustomPlotTabPane<VanChartCustomPlot, VanChartCustomPlot> { public class VanChartCustomPlotConditionAttrTabPane extends VanChartCustomPlotTabPane<VanChartCustomPlot, VanChartCustomPlot> {
private Chart chart;
public VanChartCustomPlotConditionAttrTabPane(VanChartCustomPlot plot, BasicPane parent) { public VanChartCustomPlotConditionAttrTabPane(VanChartCustomPlot plot, BasicPane parent) {
super(plot, parent); super(plot, parent);
} }
public void setChart(Chart chart) {
this.chart = chart;
}
@Override @Override
protected void initTabTitle() { protected void initTabTitle() {
List<VanChartPlot> customPlotList = plot.getCustomPlotList(); 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 @Override
public VanChartCustomPlot updateBean() { public VanChartCustomPlot updateBean() {
return null; 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 @Override
public VanChartCustomPlot updateBean() { public VanChartCustomPlot updateBean() {
return null; 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 @Override
public VanChartCustomPlot updateBean() { public VanChartCustomPlot updateBean() {
return null; 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.gui.frpane.AttributeChangeListener;
import com.fr.design.mainframe.chart.gui.style.series.ChartSeriesPane; 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.VanChartAxisPlot;
import com.fr.plugin.chart.attr.plot.VanChartPlot;
import com.fr.plugin.chart.custom.CustomPlotFactory; import com.fr.plugin.chart.custom.CustomPlotFactory;
import com.fr.plugin.chart.custom.VanChartCustomPlot; 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 com.fr.van.chart.designer.style.VanChartStylePane;
import java.util.List; import java.util.List;
@ -68,4 +71,12 @@ public class VanChartCustomStylePane extends VanChartStylePane {
CustomPlotFactory.dataSheetSynchronization((VanChartCustomPlot) collection.getSelectedChart().getPlot()); CustomPlotFactory.dataSheetSynchronization((VanChartCustomPlot) collection.getSelectedChart().getPlot());
} }
public void refreshTableFieldNames(VanChartPlot plot) {
CustomPlotType plotType = CustomPlotFactory.getCustomType(plot);
VanChartRichEditorPane.refreshCustomChartTableFieldNames(getChart(), plotType);
}
public void refreshTableFieldNames() {
}
} }

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

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

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

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

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

@ -2,11 +2,13 @@ package com.fr.van.chart.designer.component.richText;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.data.util.function.DataFunction; import com.fr.data.util.function.DataFunction;
import com.fr.data.util.function.NoneFunction;
import com.fr.design.gui.ibutton.UIButton; 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.gui.ibutton.UIToggleButton;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.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.AttrTooltipDurationFormat;
import com.fr.plugin.chart.base.format.AttrTooltipFormat; import com.fr.plugin.chart.base.format.AttrTooltipFormat;
import com.fr.plugin.chart.base.format.IntervalTimeFormat; import com.fr.plugin.chart.base.format.IntervalTimeFormat;
@ -15,9 +17,12 @@ import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import javax.swing.Icon; import javax.swing.Icon;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.plaf.ButtonUI;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component; import java.awt.Component;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.Graphics2D;
import java.awt.event.MouseAdapter; import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.awt.event.MouseListener; import java.awt.event.MouseListener;
@ -26,9 +31,10 @@ import java.text.Format;
public class VanChartFieldButton extends JPanel { public class VanChartFieldButton extends JPanel {
private static final Icon ADD_ICON = BaseUtils.readIcon("/com/fr/base/images/cell/control/add.png"); 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 W = 200;
private static final int H = 28; private static final int H = 24;
private final String fieldName; private final String fieldName;
private final String fieldId; private final String fieldId;
@ -40,7 +46,7 @@ public class VanChartFieldButton extends JPanel {
private UIToggleButton fieldButton; private UIToggleButton fieldButton;
private UIButton addButton; private UIButton addButton;
private DataFunction dataFunction = new NoneFunction(); private DataFunction dataFunction = new FirstFunction();
public VanChartFieldButton(String fieldName, AttrTooltipFormat format, VanChartFieldListener listener) { public VanChartFieldButton(String fieldName, AttrTooltipFormat format, VanChartFieldListener listener) {
this(fieldName, format, false, false, listener); this(fieldName, format, false, false, listener);
@ -134,9 +140,17 @@ public class VanChartFieldButton extends JPanel {
} }
}; };
} }
public ButtonUI getUI() {
return new FieldButtonUI();
}
}; };
addButton = new UIButton(ADD_ICON); addButton = new UIButton(ADD_ICON) {
public ButtonUI getUI() {
return new FieldButtonUI();
}
};
addButton.addMouseListener(new MouseAdapter() { addButton.addMouseListener(new MouseAdapter() {
@ -146,6 +160,9 @@ public class VanChartFieldButton extends JPanel {
listener.addSelectedField(fieldName, fieldId); listener.addSelectedField(fieldName, fieldId);
} }
}); });
fieldButton.setBorderPaintedOnlyWhenPressed(true);
addButton.setBorderPaintedOnlyWhenPressed(true);
} }
private JPanel getContentPane() { private JPanel getContentPane() {
@ -160,7 +177,7 @@ public class VanChartFieldButton extends JPanel {
double[] rowSize = {p}; double[] rowSize = {p};
double[] columnSize = {e, d}; double[] columnSize = {e, d};
JPanel content = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 5, 0); JPanel content = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 3, 0);
content.setPreferredSize(new Dimension(W, H)); content.setPreferredSize(new Dimension(W, H));
return content; return content;
@ -169,4 +186,17 @@ public class VanChartFieldButton extends JPanel {
public void setSelectedState(boolean selected) { public void setSelectedState(boolean selected) {
fieldButton.setSelected(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());
}
}
}
} }

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

@ -114,7 +114,7 @@ public class VanChartFieldListPane extends JPanel {
addDefaultFieldButton(fieldPane); addDefaultFieldButton(fieldPane);
fieldPane.setPreferredSize(new Dimension(FIELD_ADD_W, getDefaultFieldButtonList().size() * FIELD_ADD_H)); fieldPane.setPreferredSize(new Dimension(FIELD_ADD_W, getDefaultFieldButtonList().size() * FIELD_ADD_H));
fieldPane.setBorder(BorderFactory.createEmptyBorder(10, 5, 0, 0)); fieldPane.setBorder(BorderFactory.createEmptyBorder(5, 5, 0, 0));
return fieldPane; return fieldPane;
} }

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

@ -16,6 +16,8 @@ import com.fr.general.ComparatorUtils;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.plugin.chart.base.AttrTooltipRichText; 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.plugin.chart.type.TextAlign;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.van.chart.designer.PlotFactory; import com.fr.van.chart.designer.PlotFactory;
@ -30,6 +32,8 @@ import java.util.Map;
public class VanChartRichEditorPane { public class VanChartRichEditorPane {
private static final String PARAMS_SPLITTER = "|";
private static final String NAME_SPACE = "Pool"; private static final String NAME_SPACE = "Pool";
private static final String VARIABLE = "data"; private static final String VARIABLE = "data";
@ -46,21 +50,46 @@ public class VanChartRichEditorPane {
return fieldNames; return fieldNames;
} }
public static void refreshFieldNames(Chart chart) { // 更新普通图表中指定plot的数据集字段
VanChartRichEditorPane.fieldNames = null; public static void refreshCommonChartFieldNames(Chart chart) {
if (chart == null) { if (chart == null) {
return; return;
} }
Plot plot = chart.getPlot(); Plot plot = chart.getPlot();
if (plot == null || !PlotFactory.plotSupportAddTableField(plot)) { if (plot == null) {
return;
}
VanChartRichEditorPane.fieldNames = null;
if (!PlotFactory.plotSupportAddTableField(plot)) {
return; return;
} }
TopDefinitionProvider definition = chart.getFilterDefinition(); 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) { if (definition == null) {
return; return;
} }
@ -163,7 +192,7 @@ public class VanChartRichEditorPane {
if (paramsMap != null) { if (paramsMap != null) {
for (Map.Entry<String, String> entry : paramsMap.entrySet()) { for (Map.Entry<String, String> entry : paramsMap.entrySet()) {
paramsStr.append(entry.getKey()).append(":").append(entry.getValue()); paramsStr.append(entry.getKey()).append(":").append(entry.getValue());
paramsStr.append("-"); paramsStr.append(PARAMS_SPLITTER);
} }
} }

2
designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichTextDialog.java

@ -10,7 +10,7 @@ import java.awt.Frame;
public class VanChartRichTextDialog 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 VanChartRichTextDialog(Frame parent, BasicPane pane) { public VanChartRichTextDialog(Frame parent, BasicPane pane) {
super(parent, pane); super(parent, pane);

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

@ -20,7 +20,7 @@ public class VanChartRichTextPane extends BasicBeanPane<AttrTooltipContent> {
private static final int FIELD_PANE_H = 270; private static final int FIELD_PANE_H = 270;
private static final int RICH_EDITOR_W = 940; private static final int RICH_EDITOR_W = 940;
private static final int RICH_EDITOR_H = 260; private static final int RICH_EDITOR_H = 460;
private VanChartFieldListPane fieldListPane; private VanChartFieldListPane fieldListPane;
private VanChartFieldAttrPane fieldAttrPane; private VanChartFieldAttrPane fieldAttrPane;

2
designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartStylePane.java

@ -78,6 +78,6 @@ public class VanChartStylePane extends ChartStylePane {
} }
public void refreshTableFieldNames() { public void refreshTableFieldNames() {
VanChartRichEditorPane.refreshFieldNames(getChart()); VanChartRichEditorPane.refreshCommonChartFieldNames(getChart());
} }
} }

3
designer-chart/src/main/java/com/fr/van/chart/designer/style/tooltip/VanChartPlotTooltipPane.java

@ -98,6 +98,9 @@ public class VanChartPlotTooltipPane extends BasicPane {
return components; return components;
} }
public VanChartStylePane getParentPane() {
return parent;
}
protected void initTooltipContentPane(Plot plot){ protected void initTooltipContentPane(Plot plot){
tooltipContentPane = PlotFactory.createPlotTooltipContentPane(plot, parent, VanChartPlotTooltipPane.this); tooltipContentPane = PlotFactory.createPlotTooltipContentPane(plot, parent, VanChartPlotTooltipPane.this);

2
designer-chart/src/main/java/com/fr/van/chart/map/VanChartMapSeriesPane.java

@ -443,7 +443,7 @@ public class VanChartMapSeriesPane extends VanChartColorValueSeriesPane {
//不透明度 //不透明度
private JPanel createPointAlphaPane() { private JPanel createPointAlphaPane() {
pointAlphaPane = new UINumberDragPane(0, 100); pointAlphaPane = new UINumberDragPaneWithPercent(0, 100);
return TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Report_Alpha"), pointAlphaPane); return TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Report_Alpha"), pointAlphaPane);
} }

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

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

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

@ -3,8 +3,8 @@
<head> <head>
<meta charset="utf-8"/> <meta charset="utf-8"/>
<title></title> <title></title>
<link rel="stylesheet" type="text/css" href="http://fanruan.design/fineui/2.0/fineui.min.css"/> <link rel="stylesheet" type="text/css" href="emb:/com/fr/web/ui/fineui.min.css"/>
<link rel="stylesheet" type="text/css" href="./rich_editor.css"/> <link rel="stylesheet" type="text/css" href="emb:/com/fr/web/ui/materials.min.css"/>
</head> </head>
<body> <body>
<script src="script/enums.js"></script> <script src="script/enums.js"></script>
@ -26,9 +26,11 @@
var initParams = Pool.data.getInitParams(); var initParams = Pool.data.getInitParams();
var align = Pool.data.getAlign(); var align = Pool.data.getAlign();
var insert_param;
var getDimensionIds = function (params) { var getDimensionIds = function (params) {
var result = []; var result = [];
var paramGroup = params.split("-"); var paramGroup = params.split("|");
for (var i = 0, len = paramGroup.length; i < len; i++) { for (var i = 0, len = paramGroup.length; i < len; i++) {
var [key, value] = paramGroup[i].split(":"); var [key, value] = paramGroup[i].split(":");
@ -44,9 +46,8 @@
var getInitContent = function (params, initParams, align) { var getInitContent = function (params, initParams, align) {
var editorService = BI.Services.getService("bi.service.design.chart.common.editor"); var editorService = BI.Services.getService("bi.service.design.chart.common.editor");
var paramGroup = params.split("-"); var paramGroup = params.split("|");
var content = "";
content = "";
for (var i = 0, len = paramGroup.length; i < len; i++) { for (var i = 0, len = paramGroup.length; i < len; i++) {
var [key, value] = paramGroup[i].split(":"); var [key, value] = paramGroup[i].split(":");
@ -56,9 +57,25 @@
} }
} }
if (BI.endWith(content, '<br></p>')) {
content = content.slice(0, -8) + '</p>';
}
return content; return content;
} }
var selectLast = function (instance) {
if (instance == null) {
return;
}
var target = instance.selElm()
if (target) {
instance.selected({target});
}
};
var dimensionIds = getDimensionIds(params); var dimensionIds = getDimensionIds(params);
if (initParams) { if (initParams) {
@ -81,14 +98,23 @@
toolbar: { toolbar: {
buttons: [ buttons: [
{type: "bi.rich_editor_font_chooser"}, {type: "bi.rich_editor_font_chooser"},
{type: "bi.rich_editor_size_chooser"}, {
type: "bi.rich_editor_size_chooser",
width: 70
},
{type: "bi.rich_editor_bold_button"}, {type: "bi.rich_editor_bold_button"},
{type: "bi.rich_editor_italic_button"}, {type: "bi.rich_editor_italic_button"},
{type: "bi.rich_editor_underline_button"}, {type: "bi.rich_editor_underline_button"},
{type: "bi.rich_editor_color_chooser"}, {type: "bi.rich_editor_color_chooser"},
{type: "bi.rich_editor_align_left_button"}, {type: "bi.rich_editor_align_left_button"},
{type: "bi.rich_editor_align_center_button"}, {type: "bi.rich_editor_align_center_button"},
{type: "bi.rich_editor_align_right_button"} {type: "bi.rich_editor_align_right_button"},
{
type: "bi.design.chart.common.editor.insert_param",
ref: function (_ref) {
insert_param = _ref;
}
}
] ]
}, },
ref: function (_ref) { ref: function (_ref) {
@ -96,6 +122,8 @@
} }
}); });
selectLast(rich_editor.editor.instance);
Pool.refresh = function () { Pool.refresh = function () {
var content = Pool.data.getContent(); var content = Pool.data.getContent();
var isAuto = Pool.data.isAuto(); var isAuto = Pool.data.isAuto();
@ -116,30 +144,16 @@
}); });
rich_editor.setFocus(); rich_editor.setFocus();
selectLast(rich_editor.editor.instance);
}; };
Pool.addField = function () { Pool.addField = function () {
var editorService = BI.Services.getService("bi.service.design.chart.common.editor");
var content = Pool.data.getContent();
var isAuto = Pool.data.isAuto();
var params = Pool.data.getParams();
var addition = Pool.data.getAddition(); var addition = Pool.data.getAddition();
if (addition) { if (addition && insert_param) {
// todo 暂时先处理成在content后加一行 insert_param.selectedParam(addition);
content += '<p style="text-align:' + align + ';">' + editorService.getEditorParamImage(addition) + '<br></p>';
} }
rich_editor.editor.bindToolbar(rich_editor.bar);
rich_editor.setValue({
content: content,
isAuto: isAuto,
dimensionIds: getDimensionIds(params)
});
rich_editor.setFocus();
}; };
Pool.update = function () { Pool.update = function () {

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

@ -50,12 +50,14 @@
}, },
items: [{ items: [{
type: "bi.htape", type: "bi.htape",
tgap: 5, tgap: 3,
items: [{ items: [{
type: "bi.label", type: "bi.label",
text: BI.i18nText("BI-Design_Font_Style") + ": ", text: BI.i18nText("BI-Design_Font_Style") + ": ",
textAlign: "left", textAlign: "left",
width: 70 width: 60,
tgap: 2,
lgap: 3
}, { }, {
type: "bi.button_group", type: "bi.button_group",
items: this.model.fontStyleItems, items: this.model.fontStyleItems,

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

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

6
designer-chart/src/main/resources/com/fr/design/editor/script/insertcombo/combo.insert_param.js

@ -54,6 +54,7 @@
type: "bi.combo", type: "bi.combo",
direction: "bottom,left", direction: "bottom,left",
isNeedAdjustWidth: true, isNeedAdjustWidth: true,
invisible: true,
el: { el: {
type: "bi.vertical_adapt", type: "bi.vertical_adapt",
items: [{ items: [{
@ -99,6 +100,11 @@
_getInstance: function () { _getInstance: function () {
return this.options.editor.selectedInstance || this.options.editor.getInstance(); return this.options.editor.selectedInstance || this.options.editor.getInstance();
},
selectedParam: function (param) {
var editorService = BI.Services.getService("bi.service.design.chart.common.editor");
this.addParam(param, editorService.encode);
} }
}); });

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

@ -74,7 +74,7 @@ public class WriteToolBarPane extends AbstractEditToolBarPane {
northPane.add(GUICoreUtils.createFlowPane(new Component[]{rptShowLocationLabel, centerRadioButton, leftRadioButton}, FlowLayout.LEFT)); northPane.add(GUICoreUtils.createFlowPane(new Component[]{rptShowLocationLabel, centerRadioButton, leftRadioButton}, FlowLayout.LEFT));
colorBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Set_Face_Write_Current_Edit_Row_Background") + ":"); colorBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Set_Face_Write_Current_Edit_Row_Background") + ":");
colorBox.setSelected(true); colorBox.setSelected(false);
colorBox.addActionListener(colorListener); colorBox.addActionListener(colorListener);
colorButton = new UIColorButton(BaseUtils.readIcon("/com/fr/design/images/gui/color/background.png")); colorButton = new UIColorButton(BaseUtils.readIcon("/com/fr/design/images/gui/color/background.png"));
northPane.add(GUICoreUtils.createFlowPane(new Component[]{colorBox, colorButton}, FlowLayout.LEFT)); northPane.add(GUICoreUtils.createFlowPane(new Component[]{colorBox, colorButton}, FlowLayout.LEFT));

Loading…
Cancel
Save