Browse Source

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

bugfix/10.0
Destiny.Lin 2 years ago
parent
commit
e0ca47bf42
  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
  6. 43
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/PluginSearchManager.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());
};
}
}

43
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/PluginSearchManager.java

@ -20,6 +20,7 @@ import com.fr.plugin.basic.version.Version;
import com.fr.plugin.basic.version.VersionIntervalFactory;
import com.fr.stable.ArrayUtils;
import com.fr.stable.EncodeConstants;
import com.fr.stable.ProductConstants;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
@ -29,7 +30,7 @@ import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
import java.util.function.ToLongFunction;
import java.util.stream.Collectors;
/**
* Created by XiaXiang on 2017/3/27.
@ -120,7 +121,7 @@ public class PluginSearchManager implements AlphaFineSearchProvider {
return lessModelList;
}
SearchResult noConnectList = AlphaFineHelper.getNoConnectList(Holder.INSTANCE);
if(noConnectList != null){
if (noConnectList != null) {
return noConnectList;
}
for (int j = 0; j < searchText.length; j++) {
@ -184,7 +185,7 @@ public class PluginSearchManager implements AlphaFineSearchProvider {
List<PluginModel> pluginModels = new ArrayList<>();
pluginModels.addAll(parseDefaultPluginModel(plugins));
pluginModels.forEach(m->this.defaultModelList.add(m));
pluginModels.forEach(m -> this.defaultModelList.add(m));
} catch (Exception e) {
FineLoggerFactory.getLogger().error("plugin search error :" + e.getMessage());
@ -196,33 +197,31 @@ public class PluginSearchManager implements AlphaFineSearchProvider {
/**
* 将jsonobject转化为PluginModel
* 并按照更新时间排序取最新的10个
* */
* 并按照更新时间排序取最新的10个并过滤掉不是当前版本的
*/
List<PluginModel> parseDefaultPluginModel(List<Map> jsonObjects) {
List<PluginModel> pluginModels = new ArrayList<>();
String version = "v" + ProductConstants.MAIN_VERSION;
if (!Collections.isEmpty(jsonObjects)) {
pluginModels = jsonObjects.stream()
.filter(o -> ((Integer) o.get(version)) == 1)
.sorted((Map map1, Map map2) -> Long.compare(parseTime(map2), parseTime(map1)))
.limit(DEFAULT_LIST_SIZE)
.map(jsonObject -> getPluginModel(new JSONObject(jsonObject), false))
.collect(Collectors.toList());
}
return pluginModels;
}
private static long parseTime(Map value) {
SimpleDateFormat format = new SimpleDateFormat(TIME_FORMAT);
long t = 0L;
try {
jsonObjects.sort(Comparator.comparingLong(new ToLongFunction<Map>() {
@Override
public long applyAsLong(Map value) {
long time = 0L;
try {
time = format.parse((String) value.get(UPLOAD_TIME)).getTime();
t = format.parse((String) value.get(UPLOAD_TIME)).getTime();
} catch (ParseException e) {
FineLoggerFactory.getLogger().error(e, e.getMessage());
}
return time;
}
}));
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e, e.getMessage());
}
for (int i = 0; i < DEFAULT_LIST_SIZE; i++) {
pluginModels.add(getPluginModel(new JSONObject(jsonObjects.get(i)), false));
}
}
return pluginModels;
return t;
}
}

Loading…
Cancel
Save