Browse Source

REPORT-67195 决策报表-单元格超链选项显示异常

【问题原因】此前不同面板使用的是同一个超链filter,导致若当前打开了cpt、frm模版,再安装使用了HyperlinkProvider接口的插件,刷新超链选项,所有模版的超链选项将变得完全相同
【改动思路】为不用超链面板设置不同的filter
security/10.0
Leo.Qin 2 years ago
parent
commit
cafde4b16d
  1. 24
      designer-base/src/main/java/com/fr/design/gui/controlpane/JControlPane.java
  2. 4
      designer-base/src/main/java/com/fr/design/gui/controlpane/shortcutfactory/ShortCutFactory.java
  3. 25
      designer-chart/src/main/java/com/fr/van/chart/custom/component/VanChartHyperLinkPane.java
  4. 13
      designer-form/src/main/java/com/fr/design/gui/xpane/FormHyperlinkGroupPane.java
  5. 28
      designer-realize/src/main/java/com/fr/design/mainframe/ReportHyperlinkGroupPane.java

24
designer-base/src/main/java/com/fr/design/gui/controlpane/JControlPane.java

@ -9,10 +9,16 @@ import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.menu.ToolBarDef;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.stable.ArrayUtils;
import com.fr.stable.Filter;
import com.fr.stable.Nameable;
import javax.swing.*;
import java.awt.*;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import javax.swing.JSplitPane;
import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.util.Arrays;
import java.util.stream.Stream;
/**
* Coder: zack
@ -27,6 +33,8 @@ abstract class JControlPane extends BasicPane implements UnrepeatedNameHelper, S
ShortCut4JControlPane[] shorts;
NameableCreator[] creators;
protected Filter<NameableCreator> creatorsFilter;
private ToolBarDef toolbarDef;
UIToolbar toolBar;
@ -38,6 +46,7 @@ abstract class JControlPane extends BasicPane implements UnrepeatedNameHelper, S
JControlPane() {
this.initShortCutFactory();
this.initCreatorsFilter();
this.initComponentPane();
}
@ -106,6 +115,10 @@ abstract class JControlPane extends BasicPane implements UnrepeatedNameHelper, S
this.checkButtonEnabled();
}
protected void initCreatorsFilter() {
this.creatorsFilter = nameableCreator -> true;
}
protected void initCardPane() {
this.controlUpdatePane = createControlUpdatePane();
@ -183,7 +196,12 @@ abstract class JControlPane extends BasicPane implements UnrepeatedNameHelper, S
}
public NameableCreator[] creators() {
return creators == null ? new NameableCreator[0] : creators;
if (creators == null) {
return new NameableCreator[0];
} else {
Stream<NameableCreator> nameableCreatorStream = Arrays.stream(creators).filter(creator -> creatorsFilter.accept(creator));
return nameableCreatorStream.toArray(NameableCreator[]::new);
}
}
/**

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

@ -142,10 +142,6 @@ public class ShortCutFactory extends AbstractShortCutFactory {
private void wrapActionListener(NameableCreator[] creators) {
for (final NameableCreator creator : creators) {
Filter<Class<? extends JavaScript>> filter = DesignModuleFactory.getHyperlinkGroupType().getFilter();
if (!filter.accept(creator.getHyperlink())) {
continue;
}
boolean isTrue = ComparatorUtils.equals(creator.menuName(), com.fr.design.i18n.Toolkit.i18nText("Datasource-Stored_Procedure")) ||
ComparatorUtils.equals(creator.menuName(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_DS_Relation_TableData")) || ComparatorUtils.equals(creator.menuName(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_DS_Multi_Dimensional_Database"));
if (isTrue) {

25
designer-chart/src/main/java/com/fr/van/chart/custom/component/VanChartHyperLinkPane.java

@ -13,6 +13,7 @@ import com.fr.design.chart.series.SeriesCondition.impl.ChartHyperRelateCellLinkP
import com.fr.design.chart.series.SeriesCondition.impl.ChartHyperRelateFloatLinkPane;
import com.fr.design.chart.series.SeriesCondition.impl.FormHyperlinkPane;
import com.fr.design.designer.TargetComponent;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.fun.HyperlinkProvider;
import com.fr.design.gui.controlpane.NameObjectCreator;
import com.fr.design.gui.controlpane.NameableCreator;
@ -21,7 +22,10 @@ import com.fr.design.hyperlink.ReportletHyperlinkPane;
import com.fr.design.hyperlink.WebHyperlinkPane;
import com.fr.design.javascript.JavaScriptImplPane;
import com.fr.design.javascript.ParameterJavaScriptPane;
import com.fr.design.mainframe.BaseJForm;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.module.DesignModuleFactory;
import com.fr.general.ComparatorUtils;
import com.fr.general.NameObject;
import com.fr.js.EmailJavaScript;
import com.fr.js.FormHyperlinkProvider;
@ -281,4 +285,25 @@ public class VanChartHyperLinkPane extends VanChartUIListControlPane {
}
@Override
protected void initCreatorsFilter() {
this.creatorsFilter = nameableCreator -> {
Class<? extends JavaScript> clazz = nameableCreator.getHyperlink();
JTemplate template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
if (template == null) {
return false;
}
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;
}
}
}
return true;
};
}
}

13
designer-form/src/main/java/com/fr/design/gui/xpane/FormHyperlinkGroupPane.java

@ -1,13 +1,14 @@
package com.fr.design.gui.xpane;
import com.fr.chart.web.ChartHyperRelateFloatLink;
import com.fr.design.form.javascript.FormEmailPane;
import com.fr.design.gui.controlpane.NameObjectCreator;
import com.fr.design.gui.controlpane.NameableCreator;
import com.fr.design.gui.frpane.HyperlinkGroupPane;
import com.fr.design.gui.frpane.HyperlinkGroupPaneActionProvider;
import com.fr.general.ComparatorUtils;
import com.fr.js.EmailJavaScript;
import com.fr.js.JavaScript;
public class FormHyperlinkGroupPane extends HyperlinkGroupPane {
private static FormHyperlinkGroupPane singleton;
@ -23,6 +24,16 @@ public class FormHyperlinkGroupPane extends HyperlinkGroupPane {
return singleton;
}
@Override
protected void initCreatorsFilter() {
this.creatorsFilter = nameableCreator -> {
Class<? extends JavaScript> clazz = nameableCreator.getHyperlink();
// 决策报表没有 ChartHyperRelateFloatLink
return !ComparatorUtils.equals(clazz, ChartHyperRelateFloatLink.class);
};
}
/**
* 生成添加按钮的NameableCreator
* 由于表单报表块的单元格超链和单元格条件属性超链中的emailPane都要用表单的emailPane这里调整下

28
designer-realize/src/main/java/com/fr/design/mainframe/ReportHyperlinkGroupPane.java

@ -1,21 +1,11 @@
package com.fr.design.mainframe;
import com.fr.base.Style;
import com.fr.design.actions.utils.ReportActionUtils;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.gui.frpane.HyperlinkGroupPane;
import com.fr.design.gui.frpane.HyperlinkGroupPaneActionProvider;
import com.fr.general.FRFont;
import com.fr.grid.selection.CellSelection;
import com.fr.grid.selection.FloatSelection;
import com.fr.grid.selection.Selection;
import com.fr.js.NameJavaScriptGroup;
import com.fr.report.cell.CellElement;
import com.fr.report.cell.FloatElement;
import com.fr.report.elementcase.TemplateElementCase;
import com.fr.stable.Constants;
import java.awt.*;
import com.fr.general.ComparatorUtils;
import com.fr.js.FormHyperlinkProvider;
import com.fr.stable.bridge.StableFactory;
/**
* Created by plough on 2017/7/21.
@ -37,10 +27,20 @@ public class ReportHyperlinkGroupPane extends HyperlinkGroupPane {
}
protected void refreshPane() {
ElementCasePane reportPane = ((JWorkBook)HistoryTemplateListPane.getInstance().getCurrentEditingTemplate()).getEditingElementCasePane();
ElementCasePane reportPane = ((JWorkBook) HistoryTemplateListPane.getInstance().getCurrentEditingTemplate()).getEditingElementCasePane();
if (reportPane == null) {
return;
}
populate(reportPane);
}
@Override
protected void initCreatorsFilter() {
this.creatorsFilter = nameableCreator -> {
// 如果是普通报表单元格,那么没有 FormHyperlink 选项
FormHyperlinkProvider formHyperlink = StableFactory.getMarkedInstanceObjectFromClass(FormHyperlinkProvider.XML_TAG, FormHyperlinkProvider.class);
return !ComparatorUtils.equals(nameableCreator.getHyperlink(), formHyperlink.getClass());
};
}
}

Loading…
Cancel
Save