Browse Source

REPORT-11586 不同语言环境超链选项展示问题

final/10.0
yaoh.wu 6 years ago
parent
commit
1a9ef4739d
  1. 59
      designer-base/src/main/java/com/fr/design/gui/HyperlinkFilterHelper.java
  2. 20
      designer-base/src/main/java/com/fr/design/gui/controlpane/NameableCreator.java
  3. 6
      designer-base/src/main/java/com/fr/design/gui/controlpane/shortcutfactory/OldShortCutFactory.java
  4. 11
      designer-base/src/main/java/com/fr/design/gui/controlpane/shortcutfactory/ShortCutFactory.java
  5. 19
      designer-base/src/main/java/com/fr/design/gui/frpane/BaseHyperlinkGroup.java
  6. 22
      designer-base/src/main/java/com/fr/design/gui/frpane/HyperLinkGroupFilter.java
  7. 7
      designer-base/src/main/java/com/fr/design/gui/frpane/HyperlinkGroupType.java
  8. 29
      designer-base/src/main/java/com/fr/design/gui/frpane/UICorrelationComboBoxPane.java
  9. 83
      designer-chart/src/main/java/com/fr/design/module/ChartHyperlinkGroup.java
  10. 6
      designer-chart/src/main/java/com/fr/design/module/FormHyperlinkGroup.java
  11. 22
      designer-chart/src/main/java/com/fr/van/chart/custom/component/VanChartShortCutFactory.java

59
designer-base/src/main/java/com/fr/design/gui/HyperlinkFilterHelper.java

@ -1,59 +0,0 @@
package com.fr.design.gui;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.mainframe.BaseJForm;
import com.fr.design.mainframe.JTemplate;
import com.fr.general.ComparatorUtils;
/**
* Created by mengao on 2017/9/22.
* 单元格超链图表超链在不同类型模版中下拉选项不同
*/
public class HyperlinkFilterHelper {
public static boolean whetherAddHyperlink4cell(String itemName) {
JTemplate jTemplate = getCurrentEditingTemplate();
if (jTemplate == null) {
return false;
}
//先屏蔽掉这个,之后还有别的
String[] names = {com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_ Hyperlink_Chart_Float")};
for (String name : names) {
if (!jTemplate.isJWorkBook() && ComparatorUtils.equals(itemName, name)) {
return false;
}
}
return whetherAddFormLink(jTemplate, itemName);
}
public static boolean whetherAddHyperlink4Chart(String itemName) {
JTemplate jTemplate = getCurrentEditingTemplate();
if (jTemplate == null) {
return false;
}
//先屏蔽掉这个,之后还有别的
String[] names = {com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_ Hyperlink_Chart_Float"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Hyperlink_Chart_Cell")};
for (String name : names) {
if (!jTemplate.isJWorkBook() && ComparatorUtils.equals(itemName, name)) {
if (jTemplate.getEditingReportIndex() == BaseJForm.ELEMENTCASE_TAB && ComparatorUtils.equals(itemName, names[0])) {
//表单报表块中图表悬浮元素超链,只屏蔽联动悬浮元素
return false;
} else if (jTemplate.getEditingReportIndex() == BaseJForm.FORM_TAB) {
//表单图表超链屏蔽掉联动悬浮元素和联动单元格
return false;
}
}
}
return whetherAddFormLink(jTemplate, itemName);
}
private static JTemplate getCurrentEditingTemplate() {
return HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
}
private static boolean whetherAddFormLink(JTemplate jTemplate, String itemName) {
String formName = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Hyperlink_Form_Link");
return !(jTemplate.isJWorkBook() && ComparatorUtils.equals(itemName, formName));
}
}

20
designer-base/src/main/java/com/fr/design/gui/controlpane/NameableCreator.java

@ -5,25 +5,25 @@ import com.fr.design.gui.ilist.ListModelElement;
import com.fr.js.JavaScript; import com.fr.js.JavaScript;
import com.fr.stable.Nameable; import com.fr.stable.Nameable;
import javax.swing.*; import javax.swing.Icon;
public interface NameableCreator { public interface NameableCreator {
public String menuName(); String menuName();
public Icon menuIcon(); Icon menuIcon();
public String createTooltip(); String createTooltip();
public Nameable createNameable(UnrepeatedNameHelper helper); Nameable createNameable(UnrepeatedNameHelper helper);
public Class<? extends BasicBeanPane> getUpdatePane(); Class<? extends BasicBeanPane> getUpdatePane();
public Object acceptObject2Populate(Object ob); Object acceptObject2Populate(Object ob);
public void saveUpdatedBean(ListModelElement wrapper, Object bean); void saveUpdatedBean(ListModelElement wrapper, Object bean);
public Class <? extends JavaScript> getHyperlink(); Class<? extends JavaScript> getHyperlink();
public boolean isNeedParameterWhenPopulateJControlPane(); boolean isNeedParameterWhenPopulateJControlPane();
} }

6
designer-base/src/main/java/com/fr/design/gui/controlpane/shortcutfactory/OldShortCutFactory.java

@ -2,13 +2,14 @@ package com.fr.design.gui.controlpane.shortcutfactory;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.design.gui.HyperlinkFilterHelper;
import com.fr.design.gui.controlpane.NameableCreator; import com.fr.design.gui.controlpane.NameableCreator;
import com.fr.design.gui.controlpane.ShortCut4JControlPane; import com.fr.design.gui.controlpane.ShortCut4JControlPane;
import com.fr.design.gui.controlpane.ShortCutListenerProvider; import com.fr.design.gui.controlpane.ShortCutListenerProvider;
import com.fr.design.gui.frpane.HyperLinkGroupFilter;
import com.fr.design.menu.LineSeparator; import com.fr.design.menu.LineSeparator;
import com.fr.design.menu.MenuDef; import com.fr.design.menu.MenuDef;
import com.fr.design.menu.ShortCut; import com.fr.design.menu.ShortCut;
import com.fr.design.module.DesignModuleFactory;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
@ -83,7 +84,8 @@ public class OldShortCutFactory extends AbstractShortCutFactory {
private void wrapActionListener(NameableCreator[] creators) { private void wrapActionListener(NameableCreator[] creators) {
for (final NameableCreator creator : creators) { for (final NameableCreator creator : creators) {
if (!HyperlinkFilterHelper.whetherAddHyperlink4cell(creator.menuName())) { HyperLinkGroupFilter filter = DesignModuleFactory.getHyperlinkGroupType().getFilter();
if (!filter.filter(creator.getHyperlink())) {
continue; continue;
} }
boolean isTrue = ComparatorUtils.equals(creator.menuName(), Inter.getLocText("Datasource-Stored_Procedure")) || boolean isTrue = ComparatorUtils.equals(creator.menuName(), Inter.getLocText("Datasource-Stored_Procedure")) ||

11
designer-base/src/main/java/com/fr/design/gui/controlpane/shortcutfactory/ShortCutFactory.java

@ -3,14 +3,15 @@ package com.fr.design.gui.controlpane.shortcutfactory;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.design.actions.core.ActionFactory; import com.fr.design.actions.core.ActionFactory;
import com.fr.design.gui.HyperlinkFilterHelper;
import com.fr.design.gui.controlpane.NameableCreator; import com.fr.design.gui.controlpane.NameableCreator;
import com.fr.design.gui.controlpane.ShortCut4JControlPane; import com.fr.design.gui.controlpane.ShortCut4JControlPane;
import com.fr.design.gui.controlpane.ShortCutListenerProvider; import com.fr.design.gui.controlpane.ShortCutListenerProvider;
import com.fr.design.gui.frpane.HyperLinkGroupFilter;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.menu.LineSeparator; import com.fr.design.menu.LineSeparator;
import com.fr.design.menu.MenuDef; import com.fr.design.menu.MenuDef;
import com.fr.design.menu.ShortCut; import com.fr.design.menu.ShortCut;
import com.fr.design.module.DesignModuleFactory;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
@ -124,6 +125,7 @@ public class ShortCutFactory extends AbstractShortCutFactory {
/** /**
* 生成UIButton * 生成UIButton
*
* @return 菜单按钮 * @return 菜单按钮
*/ */
public UIButton createUIButton() { public UIButton createUIButton() {
@ -139,7 +141,8 @@ public class ShortCutFactory extends AbstractShortCutFactory {
private void wrapActionListener(NameableCreator[] creators) { private void wrapActionListener(NameableCreator[] creators) {
for (final NameableCreator creator : creators) { for (final NameableCreator creator : creators) {
if (!whetherAdd(creator.menuName())) { HyperLinkGroupFilter filter = DesignModuleFactory.getHyperlinkGroupType().getFilter();
if (!filter.filter(creator.getHyperlink())) {
continue; continue;
} }
boolean isTrue = ComparatorUtils.equals(creator.menuName(), com.fr.design.i18n.Toolkit.i18nText("Datasource-Stored_Procedure")) || boolean isTrue = ComparatorUtils.equals(creator.menuName(), com.fr.design.i18n.Toolkit.i18nText("Datasource-Stored_Procedure")) ||
@ -163,9 +166,5 @@ public class ShortCutFactory extends AbstractShortCutFactory {
}); });
} }
} }
protected boolean whetherAdd(String itemName){
return HyperlinkFilterHelper.whetherAddHyperlink4cell(itemName);
}
} }
} }

19
designer-base/src/main/java/com/fr/design/gui/frpane/BaseHyperlinkGroup.java

@ -2,6 +2,7 @@ package com.fr.design.gui.frpane;
import com.fr.design.gui.controlpane.NameableCreator; import com.fr.design.gui.controlpane.NameableCreator;
import com.fr.design.module.DesignModuleFactory; import com.fr.design.module.DesignModuleFactory;
import com.fr.js.JavaScript;
/** /**
* 基础的超级链接类型, 不包括图表相关超链. * 基础的超级链接类型, 不包括图表相关超链.
@ -14,10 +15,26 @@ public class BaseHyperlinkGroup implements HyperlinkGroupType {
/** /**
* 返回支持的超级链接类型 * 返回支持的超级链接类型
* *
* @return * @return NameableCreator[]
*/ */
public NameableCreator[] getHyperlinkCreators() { public NameableCreator[] getHyperlinkCreators() {
return DesignModuleFactory.getCreators4Hyperlink(); return DesignModuleFactory.getCreators4Hyperlink();
} }
@Override
public HyperLinkGroupFilter getFilter() {
return new HyperLinkGroupFilter() {
@Override
public boolean filter(Class<? extends JavaScript> clazz) {
return true;
}
@Override
public boolean filter(Object object) {
return true;
}
};
}
} }

22
designer-base/src/main/java/com/fr/design/gui/frpane/HyperLinkGroupFilter.java

@ -0,0 +1,22 @@
package com.fr.design.gui.frpane;
import com.fr.js.JavaScript;
public interface HyperLinkGroupFilter {
/**
* @param clazz clazz
* @return 是否可用返回true表示可用返回false表示不可用
*/
boolean filter(Class<? extends JavaScript> clazz);
/**
* 兼容老图表
*
* @param object object
* @return 是否可用返回true表示可用返回false表示不可用
* @see HyperLinkGroupFilter#filter(Class)
*/
boolean filter(Object object);
}

7
designer-base/src/main/java/com/fr/design/gui/frpane/HyperlinkGroupType.java

@ -4,6 +4,7 @@ import com.fr.design.gui.controlpane.NameableCreator;
/** /**
* 超级链接 支持的类型 种类. * 超级链接 支持的类型 种类.
*
* @author kunsnat E-mail:kunsnat@gmail.com * @author kunsnat E-mail:kunsnat@gmail.com
* @version 创建时间2013-6-26 下午04:41:55 * @version 创建时间2013-6-26 下午04:41:55
*/ */
@ -11,8 +12,12 @@ public interface HyperlinkGroupType {
/** /**
* 返回支持的超级链接类型 * 返回支持的超级链接类型
*
* @return NameableCreator[] * @return NameableCreator[]
*/ */
public NameableCreator[] getHyperlinkCreators(); NameableCreator[] getHyperlinkCreators();
HyperLinkGroupFilter getFilter();
} }

29
designer-base/src/main/java/com/fr/design/gui/frpane/UICorrelationComboBoxPane.java

@ -8,7 +8,6 @@ import com.fr.design.dialog.DialogActionListener;
import com.fr.design.dialog.UIDialog; import com.fr.design.dialog.UIDialog;
import com.fr.design.event.UIObserver; import com.fr.design.event.UIObserver;
import com.fr.design.event.UIObserverListener; import com.fr.design.event.UIObserverListener;
import com.fr.design.gui.HyperlinkFilterHelper;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.imenu.UIMenuItem; import com.fr.design.gui.imenu.UIMenuItem;
import com.fr.design.gui.imenutable.UIMenuNameableCreator; import com.fr.design.gui.imenutable.UIMenuNameableCreator;
@ -16,9 +15,9 @@ import com.fr.design.gui.imenutable.UIMenuTable;
import com.fr.design.hyperlink.ReportletHyperlinkPane; import com.fr.design.hyperlink.ReportletHyperlinkPane;
import com.fr.design.hyperlink.WebHyperlinkPane; import com.fr.design.hyperlink.WebHyperlinkPane;
import com.fr.design.javascript.EmailPane; import com.fr.design.javascript.EmailPane;
import com.fr.design.module.DesignModuleFactory;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.js.AbstractJavaScript; import com.fr.js.AbstractJavaScript;
import com.fr.js.EmailJavaScript; import com.fr.js.EmailJavaScript;
import com.fr.js.ReportletHyperlink; import com.fr.js.ReportletHyperlink;
@ -26,10 +25,17 @@ import com.fr.js.WebHyperlink;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.*; import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JPopupMenu;
import javax.swing.SwingUtilities;
import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener; import javax.swing.event.ChangeListener;
import java.awt.*; import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.LayoutManager;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.util.ArrayList; import java.util.ArrayList;
@ -76,6 +82,7 @@ public class UICorrelationComboBoxPane extends JPanel implements UIObserver {
/** /**
* 刷新下拉列表和按钮 * 刷新下拉列表和按钮
*
* @param values 下拉列表里的值 * @param values 下拉列表里的值
*/ */
public void refreshMenuAndAddMenuAction(List<? extends UIMenuNameableCreator> values) { public void refreshMenuAndAddMenuAction(List<? extends UIMenuNameableCreator> values) {
@ -88,7 +95,8 @@ public class UICorrelationComboBoxPane extends JPanel implements UIObserver {
if (values.size() > 1) { if (values.size() > 1) {
for (UIMenuNameableCreator value : values) { for (UIMenuNameableCreator value : values) {
final String itemName = value.getName(); final String itemName = value.getName();
if(!HyperlinkFilterHelper.whetherAddHyperlink4Chart(itemName)){ HyperLinkGroupFilter filter = DesignModuleFactory.getHyperlinkGroupType().getFilter();
if (!filter.filter(value.getObj())) {
continue; continue;
} }
UIMenuItem item = new UIMenuItem(itemName); UIMenuItem item = new UIMenuItem(itemName);
@ -238,6 +246,7 @@ public class UICorrelationComboBoxPane extends JPanel implements UIObserver {
/** /**
* 增加布局 * 增加布局
*
* @param name 名字 * @param name 名字
* @param comp 组件 * @param comp 组件
*/ */
@ -247,6 +256,7 @@ public class UICorrelationComboBoxPane extends JPanel implements UIObserver {
/** /**
* 删除组件 * 删除组件
*
* @param comp 组件 * @param comp 组件
*/ */
public void removeLayoutComponent(Component comp) { public void removeLayoutComponent(Component comp) {
@ -255,6 +265,7 @@ public class UICorrelationComboBoxPane extends JPanel implements UIObserver {
/** /**
* 获得组件的大小 * 获得组件的大小
*
* @param parent 上层容器 * @param parent 上层容器
* @return 组件的大小 * @return 组件的大小
*/ */
@ -265,6 +276,7 @@ public class UICorrelationComboBoxPane extends JPanel implements UIObserver {
/** /**
* 最小的布局大小 * 最小的布局大小
*
* @param parent 上层容器 * @param parent 上层容器
* @return 最小的大小 * @return 最小的大小
*/ */
@ -274,6 +286,7 @@ public class UICorrelationComboBoxPane extends JPanel implements UIObserver {
/** /**
* 布局容器 * 布局容器
*
* @param parent 上层容器 * @param parent 上层容器
*/ */
public void layoutContainer(Container parent) { public void layoutContainer(Container parent) {
@ -287,6 +300,7 @@ public class UICorrelationComboBoxPane extends JPanel implements UIObserver {
/** /**
* 增加监听事件 * 增加监听事件
*
* @param l 监听的对象 * @param l 监听的对象
*/ */
public void addChangeListener(ChangeListener l) { public void addChangeListener(ChangeListener l) {
@ -296,6 +310,7 @@ public class UICorrelationComboBoxPane extends JPanel implements UIObserver {
/** /**
* 删除监听事件 * 删除监听事件
*
* @param l 需要删除的事件 * @param l 需要删除的事件
*/ */
public void removeChangeListener(ChangeListener l) { public void removeChangeListener(ChangeListener l) {
@ -337,6 +352,7 @@ public class UICorrelationComboBoxPane extends JPanel implements UIObserver {
/** /**
* 更新并且重载 当前列表的值 * 更新并且重载 当前列表的值
*
* @param list 更新的列表 * @param list 更新的列表
*/ */
public void populateBean(List list) { public void populateBean(List list) {
@ -369,6 +385,7 @@ public class UICorrelationComboBoxPane extends JPanel implements UIObserver {
/** /**
* 测试例子界面 * 测试例子界面
*
* @param args 参数向量 * @param args 参数向量
*/ */
public static void main(String... args) { public static void main(String... args) {
@ -397,6 +414,7 @@ public class UICorrelationComboBoxPane extends JPanel implements UIObserver {
/** /**
* 注册观察者监听事件 * 注册观察者监听事件
*
* @param listener 观察者监听事件 * @param listener 观察者监听事件
*/ */
public void registerChangeListener(UIObserverListener listener) { public void registerChangeListener(UIObserverListener listener) {
@ -406,6 +424,7 @@ public class UICorrelationComboBoxPane extends JPanel implements UIObserver {
/** /**
* 是否需要响应事件 * 是否需要响应事件
*
* @return 需要相应 * @return 需要相应
*/ */
public boolean shouldResponseChangeListener() { public boolean shouldResponseChangeListener() {

83
designer-chart/src/main/java/com/fr/design/module/ChartHyperlinkGroup.java

@ -7,11 +7,16 @@ import com.fr.design.chart.series.SeriesCondition.impl.ChartHyperPoplinkPane;
import com.fr.design.chart.series.SeriesCondition.impl.ChartHyperRelateCellLinkPane; import com.fr.design.chart.series.SeriesCondition.impl.ChartHyperRelateCellLinkPane;
import com.fr.design.chart.series.SeriesCondition.impl.ChartHyperRelateFloatLinkPane; import com.fr.design.chart.series.SeriesCondition.impl.ChartHyperRelateFloatLinkPane;
import com.fr.design.chart.series.SeriesCondition.impl.FormHyperlinkPane; import com.fr.design.chart.series.SeriesCondition.impl.FormHyperlinkPane;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.gui.controlpane.NameObjectCreator; import com.fr.design.gui.controlpane.NameObjectCreator;
import com.fr.design.gui.controlpane.NameableCreator; import com.fr.design.gui.controlpane.NameableCreator;
import com.fr.design.gui.frpane.BaseHyperlinkGroup; import com.fr.design.gui.frpane.BaseHyperlinkGroup;
import com.fr.design.gui.frpane.HyperLinkGroupFilter;
import com.fr.design.mainframe.BaseJForm;
import com.fr.design.mainframe.JTemplate;
import com.fr.general.ComparatorUtils;
import com.fr.js.FormHyperlinkProvider; import com.fr.js.FormHyperlinkProvider;
import com.fr.js.JavaScript;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.stable.bridge.StableFactory; import com.fr.stable.bridge.StableFactory;
@ -31,12 +36,84 @@ public class ChartHyperlinkGroup extends BaseHyperlinkGroup {
public NameableCreator[] getHyperlinkCreators() { public NameableCreator[] getHyperlinkCreators() {
FormHyperlinkProvider formHyperlink = StableFactory.getMarkedInstanceObjectFromClass(FormHyperlinkProvider.XML_TAG, FormHyperlinkProvider.class); FormHyperlinkProvider formHyperlink = StableFactory.getMarkedInstanceObjectFromClass(FormHyperlinkProvider.XML_TAG, FormHyperlinkProvider.class);
NameableCreator[] realted4CharthyperUse = { NameableCreator[] related4ChartHyper = {
new NameObjectCreator(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Float_Chart"), ChartHyperPoplink.class, ChartHyperPoplinkPane.ChartNoRename.class), new NameObjectCreator(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Float_Chart"), ChartHyperPoplink.class, ChartHyperPoplinkPane.ChartNoRename.class),
new NameObjectCreator(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Cell"), ChartHyperRelateCellLink.class, ChartHyperRelateCellLinkPane.ChartNoRename.class), new NameObjectCreator(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Cell"), ChartHyperRelateCellLink.class, ChartHyperRelateCellLinkPane.ChartNoRename.class),
new NameObjectCreator(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Float"), ChartHyperRelateFloatLink.class, ChartHyperRelateFloatLinkPane.ChartNoRename.class), new NameObjectCreator(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Float"), ChartHyperRelateFloatLink.class, ChartHyperRelateFloatLinkPane.ChartNoRename.class),
new NameObjectCreator(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Hyperlink_Form_Link"), formHyperlink.getClass(), FormHyperlinkPane.class)}; new NameObjectCreator(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Hyperlink_Form_Link"), formHyperlink.getClass(), FormHyperlinkPane.class)};
return (NameableCreator[]) ArrayUtils.addAll(super.getHyperlinkCreators(), realted4CharthyperUse); return ArrayUtils.addAll(super.getHyperlinkCreators(), related4ChartHyper);
}
@Override
public HyperLinkGroupFilter getFilter() {
return new HyperLinkGroupFilter() {
@Override
public boolean filter(Class<? extends JavaScript> clazz) {
JTemplate template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
if (template == null) {
return false;
}
if (template.isJWorkBook()) {
// 如果是普通报表单元格,那么没有 FormHyperlink 选项
FormHyperlinkProvider formHyperlink = StableFactory.getMarkedInstanceObjectFromClass(FormHyperlinkProvider.XML_TAG, FormHyperlinkProvider.class);
//返回true表示可用,返回false表示不可用
return !ComparatorUtils.equals(clazz, formHyperlink.getClass());
} else {
// 如果是决策报表
Class[] classes = new Class[]{ChartHyperRelateCellLink.class, ChartHyperRelateFloatLink.class};
for (Class aClass : classes) {
if (template.getEditingReportIndex() == BaseJForm.FORM_TAB) {
// 编辑的是决策报表中的图表,那么没有ChartHyperRelateFloatLink 和 ChartHyperRelateCellLink 选项,有FormHyperlink 选项
if (ComparatorUtils.equals(aClass, clazz)) {
return false;
}
} else if (template.getEditingReportIndex() == BaseJForm.ELEMENTCASE_TAB) {
// 编辑的是决策报表中的报表块,那么没有 ChartHyperRelateFloatLink,有ChartHyperRelateCellLink 和 FormHyperlink 选项
return !ComparatorUtils.equals(clazz, ChartHyperRelateFloatLink.class);
}
}
}
return true;
}
/**
* 兼容老图表
* @param object
* @return
*/
@Override
public boolean filter(Object object) {
JTemplate template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
if (template == null) {
return false;
}
if (template.isJWorkBook()) {
// 如果是普通报表单元格,那么没有 FormHyperlink 选项
FormHyperlinkProvider formHyperlink = StableFactory.getMarkedInstanceObjectFromClass(FormHyperlinkProvider.XML_TAG, FormHyperlinkProvider.class);
//返回true表示可用,返回false表示不可用
return !ComparatorUtils.equals(object.getClass(), formHyperlink.getClass());
} else {
// 如果是决策报表
Class[] classes = new Class[]{ChartHyperRelateCellLink.class, ChartHyperRelateFloatLink.class};
for (Class aClass : classes) {
if (template.getEditingReportIndex() == BaseJForm.FORM_TAB) {
// 编辑的是决策报表中的图表,那么没有ChartHyperRelateFloatLink 和 ChartHyperRelateCellLink 选项,有FormHyperlink 选项
if (ComparatorUtils.equals(aClass, object.getClass())) {
return false;
}
} else if (template.getEditingReportIndex() == BaseJForm.ELEMENTCASE_TAB) {
// 编辑的是决策报表中的报表块,那么没有 ChartHyperRelateFloatLink,有ChartHyperRelateCellLink 和 FormHyperlink 选项
return !ComparatorUtils.equals(object.getClass(), ChartHyperRelateFloatLink.class);
}
}
}
return true;
}
};
} }
} }

6
designer-chart/src/main/java/com/fr/design/module/FormHyperlinkGroup.java

@ -8,7 +8,6 @@ import com.fr.design.chart.series.SeriesCondition.impl.FormHyperlinkPane;
import com.fr.design.gui.controlpane.NameObjectCreator; import com.fr.design.gui.controlpane.NameObjectCreator;
import com.fr.design.gui.controlpane.NameableCreator; import com.fr.design.gui.controlpane.NameableCreator;
import com.fr.design.gui.frpane.BaseHyperlinkGroup; import com.fr.design.gui.frpane.BaseHyperlinkGroup;
import com.fr.js.FormHyperlinkProvider; import com.fr.js.FormHyperlinkProvider;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.stable.bridge.StableFactory; import com.fr.stable.bridge.StableFactory;
@ -23,15 +22,16 @@ public class FormHyperlinkGroup extends BaseHyperlinkGroup {
/** /**
* 返回支持的超级链接类型 * 返回支持的超级链接类型
*
* @return NameableCreator[] * @return NameableCreator[]
*/ */
public NameableCreator[] getHyperlinkCreators() { public NameableCreator[] getHyperlinkCreators() {
FormHyperlinkProvider formHyperlink = StableFactory.getMarkedInstanceObjectFromClass(FormHyperlinkProvider.XML_TAG, FormHyperlinkProvider.class); FormHyperlinkProvider formHyperlink = StableFactory.getMarkedInstanceObjectFromClass(FormHyperlinkProvider.XML_TAG, FormHyperlinkProvider.class);
NameableCreator[] realted4CharthyperUse = { NameableCreator[] related4ChartHyper = {
new NameObjectCreator(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Float_Chart"), ChartHyperPoplink.class, ChartHyperPoplinkPane.ChartNoRename.class), new NameObjectCreator(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Float_Chart"), ChartHyperPoplink.class, ChartHyperPoplinkPane.ChartNoRename.class),
new NameObjectCreator(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Cell"), ChartHyperRelateCellLink.class, ChartHyperRelateCellLinkPane.ChartNoRename.class), new NameObjectCreator(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Cell"), ChartHyperRelateCellLink.class, ChartHyperRelateCellLinkPane.ChartNoRename.class),
new NameObjectCreator(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Hyperlink_Form_Link"), formHyperlink.getClass(), FormHyperlinkPane.class)}; new NameObjectCreator(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Hyperlink_Form_Link"), formHyperlink.getClass(), FormHyperlinkPane.class)};
return (NameableCreator[]) ArrayUtils.addAll(super.getHyperlinkCreators(), realted4CharthyperUse); return ArrayUtils.addAll(super.getHyperlinkCreators(), related4ChartHyper);
} }
} }

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

@ -1,10 +1,7 @@
package com.fr.van.chart.custom.component; package com.fr.van.chart.custom.component;
import com.fr.design.gui.HyperlinkFilterHelper;
import com.fr.design.gui.controlpane.NameableCreator;
import com.fr.design.gui.controlpane.shortcutfactory.ShortCutFactory;
import com.fr.design.gui.controlpane.ShortCutListenerProvider; import com.fr.design.gui.controlpane.ShortCutListenerProvider;
import com.fr.design.menu.ShortCut; import com.fr.design.gui.controlpane.shortcutfactory.ShortCutFactory;
/** /**
* Created by plough on 2018/8/13. * Created by plough on 2018/8/13.
@ -17,21 +14,4 @@ class VanChartShortCutFactory extends ShortCutFactory {
public static VanChartShortCutFactory newInstance(ShortCutListenerProvider listenerProvider) { public static VanChartShortCutFactory newInstance(ShortCutListenerProvider listenerProvider) {
return new VanChartShortCutFactory(listenerProvider); return new VanChartShortCutFactory(listenerProvider);
} }
@Override
public ShortCut createAddItemMenuDef(NameableCreator[] creators) {
return new AddVanChartItemMenuDef(creators);
}
private class AddVanChartItemMenuDef extends AddItemMenuDef {
AddVanChartItemMenuDef(NameableCreator[] creators) {
super(creators);
}
@Override
protected boolean whetherAdd(String itemName) {
return HyperlinkFilterHelper.whetherAddHyperlink4Chart(itemName);
}
}
} }

Loading…
Cancel
Save