Browse Source

Merge remote-tracking branch 'origin/release/11.0' into release/11.0

release/11.0
John.Ying 2 years ago
parent
commit
cb19a7962c
  1. 3
      designer-base/src/main/java/com/fr/design/actions/help/alphafine/AlphaFineConfigManager.java
  2. 28
      designer-base/src/main/java/com/fr/design/actions/help/alphafine/component/CustomSortPane.java
  3. 50
      designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java
  4. 7
      designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITTableButton.java
  5. 90
      designer-realize/src/main/java/com/fr/design/actions/replace/utils/SearchJSUtils.java
  6. 14
      designer-realize/src/main/java/com/fr/design/actions/replace/utils/ShowValueUtils.java

3
designer-base/src/main/java/com/fr/design/actions/help/alphafine/AlphaFineConfigManager.java

@ -108,6 +108,7 @@ public class AlphaFineConfigManager implements XMLable {
private Map<String, String> actionSearchTextCache = new HashMap<>(8);
private String cacheBuildNO;
private static final String CONTAIN_TEMPLATE_SHOP = "isContainTemplateShop";
/**
* key: 登录的bbs用户
@ -151,6 +152,7 @@ public class AlphaFineConfigManager implements XMLable {
this.setContainPlugin(reader.getAttrAsBoolean("isContainDocument", true));
this.setContainDocument(reader.getAttrAsBoolean("isContainDocument", true));
this.setContainRecommend(reader.getAttrAsBoolean("isContainRecommend", true));
this.setShowTemplateShop(reader.getAttrAsBoolean(CONTAIN_TEMPLATE_SHOP, true));
this.setContainAction(reader.getAttrAsBoolean("isContainAction", true));
this.setContainTemplate(reader.getAttrAsBoolean("isContainTemplate", true));
this.setContainFileContent(reader.getAttrAsBoolean("isContainFileContent", false));
@ -258,6 +260,7 @@ public class AlphaFineConfigManager implements XMLable {
.attr("needSegmentationCheckbox", this.isNeedSegmentationCheckbox())
.attr("needIntelligentCustomerService", this.isNeedIntelligentCustomerService())
.attr("productDynamics", this.isProductDynamics())
.attr(CONTAIN_TEMPLATE_SHOP, this.showTemplateShop)
.attr("tabOrder", this.getTabOrderString());
writeActionSearchTextCacheXML(writer);
writeSearchHistory(writer);

28
designer-base/src/main/java/com/fr/design/actions/help/alphafine/component/CustomSortPane.java

@ -85,7 +85,7 @@ public class CustomSortPane extends JPanel {
top.addActionListener(e -> {
SwingUtilities.invokeLater(() -> {
sortItemPane.setComponentZOrder(selectedLabel, 0);
setToolbarEnable(false, false, true, true);
setToolbarEnable(sortItemPane.getComponentZOrder(selectedLabel), sortItemPane.getComponentCount());
CustomSortPane.this.revalidate();
CustomSortPane.this.repaint();
refreshCurrentOrder();
@ -95,7 +95,7 @@ public class CustomSortPane extends JPanel {
bottom.addActionListener(e -> {
SwingUtilities.invokeLater(() -> {
sortItemPane.setComponentZOrder(selectedLabel, sortItemPane.getComponentCount() - 1);
setToolbarEnable(true, true, false, false);
setToolbarEnable(sortItemPane.getComponentZOrder(selectedLabel), sortItemPane.getComponentCount());
CustomSortPane.this.revalidate();
CustomSortPane.this.repaint();
refreshCurrentOrder();
@ -105,7 +105,7 @@ public class CustomSortPane extends JPanel {
up.addActionListener(e -> {
SwingUtilities.invokeLater(() -> {
sortItemPane.setComponentZOrder(selectedLabel, sortItemPane.getComponentZOrder(selectedLabel) - 1);
setToolbarEnable(true, true, true, true);
setToolbarEnable(sortItemPane.getComponentZOrder(selectedLabel), sortItemPane.getComponentCount());
CustomSortPane.this.revalidate();
CustomSortPane.this.repaint();
refreshCurrentOrder();
@ -115,7 +115,7 @@ public class CustomSortPane extends JPanel {
down.addActionListener(e -> {
SwingUtilities.invokeLater(() -> {
sortItemPane.setComponentZOrder(selectedLabel, sortItemPane.getComponentZOrder(selectedLabel) + 1);
setToolbarEnable(true, true, true, true);
setToolbarEnable(sortItemPane.getComponentZOrder(selectedLabel), sortItemPane.getComponentCount());
CustomSortPane.this.revalidate();
CustomSortPane.this.repaint();
refreshCurrentOrder();
@ -175,6 +175,26 @@ public class CustomSortPane extends JPanel {
this.bottom.setEnabled(bottom);
}
/**
* 根据选项当前位置以及菜单大小设置 置顶上移下移置底 按钮的状态
*/
private void setToolbarEnable(int order, int maxOrder) {
this.top.setEnabled(true);
this.up.setEnabled(true);
this.down.setEnabled(true);
this.bottom.setEnabled(true);
// 选项处于顶端,则置灰上移和置顶按钮
if (order == 0) {
this.top.setEnabled(false);
this.up.setEnabled(false);
}
// 选项处于底端,则置灰下移和置底按钮
if (order == maxOrder - 1) {
this.down.setEnabled(false);
this.bottom.setEnabled(false);
}
}
private void refreshCurrentOrder() {
String[] currentTabOrder = parentPane.getCurrentOrder();
HashSet<String> selectedTab = new HashSet<>();

50
designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java

@ -886,6 +886,54 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
layeredPane.repaint();
}
/**
* 激活模板
* <p>
* activateJTemplate需要模板存在openTemplate需要模板保存过该方法模板保存与未保存皆可激活模板如果关闭并且保存过会重新打开
*
* @param templatePath 模板路径 template.getPath()
*/
public void openOrActiveTemplate(String templatePath) {
//没保存过的模板如果要激活就要从当前历史模板列表里面找
String templateName = getTemplateNameFromPath(templatePath);
if (isTemplateNeverSaved(templatePath)) {
int index = HistoryTemplateListCache.getInstance().contains(templateName);
//如果历史模板列表中存在则激活
if (index != -1) {
DesignerContext.getDesignerFrame().activateJTemplate(HistoryTemplateListCache.getInstance().getTemplate(index));
}
} else {
DesignerContext.getDesignerFrame().openTemplate(FILEFactory.createFILE(templatePath));
}
}
/**
* 指定路径的模板是否保存过
*
* @param templatePath 模板路径 template.getPath()
* @return 如果模板没保存过则返回true
*/
private boolean isTemplateNeverSaved(String templatePath) {
FILE tplFile = FILEFactory.createFILE(templatePath);
//没保存过的模板获取到的templatePath所生成的FILE文件会不存在
return tplFile == null || !tplFile.exists() || StringUtils.isEmpty(templatePath);
}
/**
* 根据模板路径获取模板名称
* @param templatePath 模板路径 template.getPath()
* @return 模板名
*/
private String getTemplateNameFromPath(String templatePath) {
FILE tplFile = FILEFactory.createFILE(templatePath);
String templateName = StringUtils.EMPTY;
if (tplFile != null) {
templateName = tplFile.getName();
}
return templateName;
}
/**
* 当前模板 停用失败
*
@ -1231,6 +1279,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
/**
* 判断是否正在进行服务器配置
*
* @return boolean
*/
public boolean isServerConfig() {
@ -1239,6 +1288,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
/**
* 设置是否正在进行服务器配置
*
* @param serverConfig
*/
public void setServerConfig(boolean serverConfig) {

7
designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITTableButton.java

@ -6,10 +6,12 @@ import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.JTemplate;
import com.fr.file.FILE;
import com.fr.file.FILEFactory;
import com.fr.general.GeneralUtils;
import com.fr.stable.StringUtils;
import com.fr.stable.project.ProjectConstants;
import javax.swing.AbstractCellEditor;
@ -44,14 +46,13 @@ public class ITTableButton extends AbstractCellEditor implements TableCellEditor
if (StringUtils.isNotEmpty(GeneralUtils.objectToString(content.getTrlString()))) {
ITReplaceMainDialog.setITReplaceFlag(true);
TRL trl = new TRL(GeneralUtils.objectToString(content.getTrlString()));
DesignerContext.getDesignerFrame().openTemplate(FILEFactory.createFILE(content.getTemplatePath()));
DesignerContext.getDesignerFrame().openOrActiveTemplate(content.getTemplatePath());
HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().navigate(trl);
}
ITReplaceMainDialog.setITReplaceFlag(false);
}
});
}
/**

90
designer-realize/src/main/java/com/fr/design/actions/replace/utils/SearchJSUtils.java

@ -21,6 +21,9 @@ import com.fr.plugin.chart.attr.plot.VanChartPlot;
import com.fr.plugin.chart.base.AttrLabel;
import com.fr.plugin.chart.base.AttrTooltip;
import com.fr.plugin.chart.base.VanChartHtmlLabel;
import com.fr.plugin.chart.map.VanChartMapPlot;
import com.fr.plugin.chart.map.attr.AttrMapLabel;
import com.fr.plugin.chart.map.attr.AttrMapTooltip;
import com.fr.plugin.chart.vanchart.VanChart;
import com.fr.report.cell.Elem;
import com.fr.stable.StringUtils;
@ -39,6 +42,21 @@ import java.util.List;
*/
public class SearchJSUtils {
/**
* 样式-数据点提示
*/
public static final String STYLE_TOOLTIP_CUSTOM = ShowValueUtils.joinStr4Position(Toolkit.i18nText("Fine-Design_Basic_Style"), Toolkit.i18nText("Fine-Design_Chart_Tooltip"));
/**
* 样式-标签
*/
public static final String STYLE_LABEL = ShowValueUtils.joinStr4Position(Toolkit.i18nText("Fine-Design_Basic_Style"), Toolkit.i18nText("Fine-Design_Chart_Data_Label"));
/**
* 样式-分类标签
*/
public static final String CATEGORY_LABEL = ShowValueUtils.joinStr4Position(Toolkit.i18nText("Fine-Design_Basic_Style"), Toolkit.i18nText("Fine-Design_Chart_Data_Label"), Toolkit.i18nText("Fine-Design_Chart_Category_Label"));
/**
* 从Listener中获取JS
*/
@ -118,29 +136,77 @@ public class SearchJSUtils {
*/
private static void addAttrLabelHtmlLabel(VanChart chart, List<Pair<VanChartHtmlLabel, String>> arrayList) {
VanChartPlot plot = chart.getPlot();
addAttrToolTipCondition2Array(plot, arrayList);
if (isAttrLabelExist(plot)) {
addAttrLabelDetail2Array(plot, arrayList);
addAttrSecondLabelDetail2Array(plot, arrayList);
//如果是地图类型要特殊处理
if (plot instanceof VanChartMapPlot) {
addMapJS2Array((VanChartMapPlot) plot, arrayList);
} else {
addAttrToolTipCondition2Array(plot, arrayList);
if (isAttrLabelExist(plot)) {
addAttrLabelDetail2Array(plot, arrayList);
addAttrSecondLabelDetail2Array(plot, arrayList);
}
}
}
/**
* 用于处理地图类型图表中的样式中的JSAttrMapTooltip AttrMapLabel
*
* @param plot
* @param arrayList
*/
private static void addMapJS2Array(VanChartMapPlot plot, List<Pair<VanChartHtmlLabel, String>> arrayList) {
ConditionAttr defaultAttr = plot.getConditionCollection().getDefaultAttr();
AttrMapTooltip attrMapTooltip = defaultAttr.getExisted(AttrMapTooltip.class);
AttrMapLabel attrMapLabel = defaultAttr.getExisted(AttrMapLabel.class);
//处理三种地图的数据点提示——点地图、流向地图、区域地图
dealMapTooltipJS(attrMapTooltip.getAreaTooltip(), arrayList);
dealMapTooltipJS(attrMapTooltip.getLineTooltip(), arrayList);
dealMapTooltipJS(attrMapTooltip.getPointTooltip(), arrayList);
//处理两种地图的标签——点地图、区域地图(流向地图没有标签)
dealMapLabelJS(attrMapLabel.getAreaLabel(), arrayList);
dealMapLabelJS(attrMapLabel.getPointLabel(), arrayList);
}
/**
* 用于处理地图类型图表中的标签中的JS
*
* @param label 地图类型的标签点地图区域地图
* @param arrayList 用于存储htmlLabel的数组
*/
private static void dealMapLabelJS(AttrLabel label, List<Pair<VanChartHtmlLabel, String>> arrayList) {
if (isAttrLabelValid(label)) {
arrayList.add(new Pair<>(label.getContent().getHtmlLabel(), STYLE_LABEL));
}
}
/**
* 用于处理地图类型图表中的数据点提示中的JS
*
* @param tooltip 地图类型的数据点提示点地图流向地图区域地图
* @param arrayList 用于存储htmlLabel的数组
*/
private static void dealMapTooltipJS(AttrTooltip tooltip, List<Pair<VanChartHtmlLabel, String>> arrayList) {
if (isToolTipValid(tooltip)) {
arrayList.add(new Pair<>(tooltip.getContent().getHtmlLabel(), STYLE_TOOLTIP_CUSTOM));
}
}
private static void addAttrToolTipCondition2Array(VanChartPlot plot, List<Pair<VanChartHtmlLabel, String>> arrayList) {
if (isToolTipValid(plot)) {
arrayList.add(new Pair<>(((AttrTooltip) plot.getAttrTooltipFromConditionCollection()).getContent().getHtmlLabel(),
Toolkit.i18nText("Fine-Design_Chart_Tooltip") + "-" + Toolkit.i18nText("Fine-Design_Basic_Custom")));
if (isToolTipValid(plot.getAttrTooltipFromConditionCollection())) {
arrayList.add(new Pair<>(((AttrTooltip) plot.getAttrTooltipFromConditionCollection()).getContent().getHtmlLabel(), STYLE_TOOLTIP_CUSTOM));
}
}
private static boolean isToolTipValid(VanChartPlot plot) {
return plot.getAttrTooltipFromConditionCollection() != null && ((AttrTooltip) plot.getAttrTooltipFromConditionCollection()).isEnable() && plot.getAttrTooltipFromConditionCollection() instanceof AttrTooltip;
private static boolean isToolTipValid(DataSeriesCondition tooltip) {
return tooltip instanceof AttrTooltip && ((AttrTooltip) tooltip).isEnable() && ((AttrTooltip) tooltip).getContent() != null && ((AttrTooltip) tooltip).getContent().getHtmlLabel() != null;
}
private static void addAttrLabelDetail2Array(VanChartPlot plot, List<Pair<VanChartHtmlLabel, String>> arrayList) {
if (isLabelDetailValid(plot)) {
arrayList.add(new Pair<>(plot.getAttrLabelFromConditionCollection().getAttrLabelDetail().getContent().getHtmlLabel(), Toolkit.i18nText("Fine-Design_Chart_Value_Label")));
arrayList.add(new Pair<>(plot.getAttrLabelFromConditionCollection().getAttrLabelDetail().getContent().getHtmlLabel(), STYLE_LABEL));
}
}
@ -152,7 +218,7 @@ public class SearchJSUtils {
private static void addAttrSecondLabelDetail2Array(VanChartPlot plot, List<Pair<VanChartHtmlLabel, String>> arrayList) {
if (isSecondLabelDetailValid(plot)) {
arrayList.add(new Pair<>(plot.getAttrLabelFromConditionCollection().getSecondLabelDetail().getContent().getHtmlLabel(), Toolkit.i18nText("Fine-Design_Chart_Category_Label")));
arrayList.add(new Pair<>(plot.getAttrLabelFromConditionCollection().getSecondLabelDetail().getContent().getHtmlLabel(), CATEGORY_LABEL));
}
}
@ -194,7 +260,7 @@ public class SearchJSUtils {
}
private static boolean isAttrLabelValid(AttrLabel label) {
return label.isEnable() && label.getContent() != null && label.getContent().getHtmlLabel() != null;
return label != null && label.isEnable() && label.getContent() != null && label.getContent().getHtmlLabel() != null;
}
/**

14
designer-realize/src/main/java/com/fr/design/actions/replace/utils/ShowValueUtils.java

@ -2,6 +2,7 @@ package com.fr.design.actions.replace.utils;
import com.fr.design.actions.replace.ui.ITReplaceMainDialog;
import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils;
import com.fr.stable.collections.combination.Pair;
@ -46,6 +47,8 @@ public class ShowValueUtils {
public static final int HTML_TAIL_LEN = HTML_TAIL.length();
public static final int NOBR_LEN = NOBR.length();
public static final int NOBR_TAIL_LEN = NOBR_TAIL.length();
public static final String JOIN_GAP_STRING = "-";
/**
* <转变为&lt;的长度差
*/
@ -301,4 +304,15 @@ public class ShowValueUtils {
}
}
/**
* 用于拼接展示位置用的字符串中间用-拼接
*
* @param strings 用于拼接的字符串
* @return 拼接后的字符串
*/
public static String joinStr4Position(String... strings) {
return StableUtils.join(strings, JOIN_GAP_STRING);
}
}

Loading…
Cancel
Save