Browse Source

REPORT-75998 界面添加滚动条,优化一些可能会出错的判断、增加条件显示-条件属性-标签中的JS

feature/x
Destiny.Lin 2 years ago
parent
commit
c899ce3df3
  1. 22
      designer-realize/src/main/java/com/fr/design/actions/replace/action/ShowSearchResultAction.java
  2. 110
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartCollectionFormulaAction.java
  3. 5
      designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceMainDialog.java
  4. 54
      designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceNorthPanel.java
  5. 22
      designer-realize/src/main/java/com/fr/design/actions/replace/utils/SearchJSUtils.java

22
designer-realize/src/main/java/com/fr/design/actions/replace/action/ShowSearchResultAction.java

@ -2,6 +2,7 @@ package com.fr.design.actions.replace.action;
import com.fr.chart.chartattr.ChartCollection;
import com.fr.chart.chartattr.Title;
import com.fr.design.actions.replace.action.content.cell.SearchCellAction;
import com.fr.design.actions.replace.action.content.component.SearchComponentAction;
import com.fr.design.actions.replace.action.content.floatelement.SearchFloatAction;
@ -58,8 +59,8 @@ public enum ShowSearchResultAction implements ShowValue {
CellElement cellElement = (CellElement) info.getContent().getReplaceObject();
ChartCollection chartCollection = (ChartCollection) cellElement.getValue();
for (int i = 0; i < chartCollection.getChartCount(); i++) {
String titleName = GeneralUtils.objectToString(chartCollection.getChart(i).getTitle().getTextObject());
if (isTitleNameValid(titleName, str)) {
if (isTitleNameValid(chartCollection.getChart(i).getTitle(), str)) {
String titleName = GeneralUtils.objectToString(chartCollection.getChart(i).getTitle().getTextObject());
CellInfo cellInfo = ((CellInfo) info).copy();
cellInfo.setCellChartIndex(i);
cellInfo.getContent().addOtherPos(
@ -93,9 +94,6 @@ public enum ShowSearchResultAction implements ShowValue {
cellInfo.getContent().setSelected(true);
}
private boolean isTitleNameValid(String titleName, String str){
return titleName.contains(str) && StringUtils.isNotEmpty(titleName);
}
},
/**
* 搜索JS事件
@ -233,8 +231,8 @@ public enum ShowSearchResultAction implements ShowValue {
if (((FloatInfo) info).isChartExist()) {
ChartCollection chartCollection = (ChartCollection) floatElement.getValue();
for (int i = 0; i < chartCollection.getChartCount(); i++) {
String titleName = GeneralUtils.objectToString(chartCollection.getChart(i).getTitle().getTextObject());
if (titleName.contains(str)) {
if (isTitleNameValid(chartCollection.getChart(i).getTitle(),str)) {
String titleName = GeneralUtils.objectToString(chartCollection.getChart(i).getTitle().getTextObject());
FloatInfo floatInfo = ((FloatInfo) info).copy();
floatInfo.setFloatChartIndex(i);
floatInfo.getContent().addOtherPos(
@ -410,4 +408,14 @@ public enum ShowSearchResultAction implements ShowValue {
}
return null;
}
/**
* 标题是否可用
* @param title
* @param str
* @return
*/
public boolean isTitleNameValid(Title title, String str){
return title != null && GeneralUtils.objectToString(title.getTextObject()).contains(str) && StringUtils.isNotEmpty(GeneralUtils.objectToString(title.getTextObject()));
}
}

110
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartCollectionFormulaAction.java

@ -76,34 +76,37 @@ public class SearchChartCollectionFormulaAction {
}
private void searchChartPatternFormulaFromAlertLine(List<FormulaInfo> formulaInfos, ITContent chartContent, Chart chart) {
Axis xAxis = chart.getPlot().getxAxis();
Axis yAxis = chart.getPlot().getyAxis();
ITContent content = ITContent.copy(chartContent);
content.addOtherPos(
Toolkit.i18nText("Fine-Design_Chart_Pattern"),
Toolkit.i18nText("Fine-Design_Chart_Background"),
Toolkit.i18nText("Fine-Design_Chart_Plot_Region"),
Toolkit.i18nText("Fine-Design_Chart_Alert_Line")
);
if (xAxis instanceof VanChartAxis) {
List<VanChartAlertValue> list = ((VanChartAxis) xAxis).getAlertValues();
for (VanChartAlertValue alertValue : list) {
//警戒线设置
dealAlertValue(formulaInfos, content, alertValue);
//提示文字
dealAlertContent(formulaInfos, content, alertValue);
if (chart.getPlot() != null){
Axis xAxis = chart.getPlot().getxAxis();
Axis yAxis = chart.getPlot().getyAxis();
ITContent content = ITContent.copy(chartContent);
content.addOtherPos(
Toolkit.i18nText("Fine-Design_Chart_Pattern"),
Toolkit.i18nText("Fine-Design_Chart_Background"),
Toolkit.i18nText("Fine-Design_Chart_Plot_Region"),
Toolkit.i18nText("Fine-Design_Chart_Alert_Line")
);
if (xAxis instanceof VanChartAxis) {
List<VanChartAlertValue> list = ((VanChartAxis) xAxis).getAlertValues();
for (VanChartAlertValue alertValue : list) {
//警戒线设置
dealAlertValue(formulaInfos, content, alertValue);
//提示文字
dealAlertContent(formulaInfos, content, alertValue);
}
}
}
if (yAxis instanceof VanChartAxis) {
List<VanChartAlertValue> list = ((VanChartAxis) yAxis).getAlertValues();
for (VanChartAlertValue alertValue : list) {
//警戒线设置
dealAlertValue(formulaInfos, content, alertValue);
//提示文字
dealAlertContent(formulaInfos, content, alertValue);
if (yAxis instanceof VanChartAxis) {
List<VanChartAlertValue> list = ((VanChartAxis) yAxis).getAlertValues();
for (VanChartAlertValue alertValue : list) {
//警戒线设置
dealAlertValue(formulaInfos, content, alertValue);
//提示文字
dealAlertContent(formulaInfos, content, alertValue);
}
}
}
}
private void dealAlertContent(List<FormulaInfo> formulaInfos, ITContent content, VanChartAlertValue alertValue) {
@ -125,39 +128,40 @@ public class SearchChartCollectionFormulaAction {
}
private void searchChartPatternFormulaFromAxisValue(List<FormulaInfo> formulaInfos, ITContent chartContent, Chart chart) {
Axis xAxis = chart.getPlot().getxAxis();
Axis yAxis = chart.getPlot().getyAxis();
//样式-坐标轴-x轴
if (xAxis != null) {
//轴标题
ITContent xAxisContent = ITContent.copy(chartContent);
if (!chartContent.isFrm()) {
xAxisContent.addOtherPos(chart.getChartName());
if (chart.getPlot() != null){
Axis xAxis = chart.getPlot().getxAxis();
Axis yAxis = chart.getPlot().getyAxis();
//样式-坐标轴-x轴
if (xAxis != null) {
//轴标题
ITContent xAxisContent = ITContent.copy(chartContent);
if (!chartContent.isFrm()) {
xAxisContent.addOtherPos(chart.getChartName());
}
xAxisContent.addOtherPos(
Toolkit.i18nText("Fine-Design_Chart_Pattern"),
Toolkit.i18nText("Fine-Design_Chart_Axis"),
Toolkit.i18nText("Fine-Design_Chart_X_Axis")
);
dealTitle(formulaInfos, xAxisContent, xAxis.getTitle());
dealChartValueDefine(formulaInfos, xAxisContent, xAxis);
}
xAxisContent.addOtherPos(
Toolkit.i18nText("Fine-Design_Chart_Pattern"),
Toolkit.i18nText("Fine-Design_Chart_Axis"),
Toolkit.i18nText("Fine-Design_Chart_X_Axis")
);
dealTitle(formulaInfos, xAxisContent, xAxis.getTitle());
dealChartValueDefine(formulaInfos, xAxisContent, xAxis);
}
//样式-坐标轴-y轴-轴标题
if (yAxis != null) {
ITContent yAxisContent = ITContent.copy(chartContent);
yAxisContent.addOtherPos(
chart.getChartName(),
Toolkit.i18nText("Fine-Design_Chart_Pattern"),
Toolkit.i18nText("Fine-Design_Chart_Axis"),
Toolkit.i18nText("Fine-Design_Chart_Y_Axis")
);
dealTitle(formulaInfos, yAxisContent, yAxis.getTitle());
dealChartValueDefine(formulaInfos, yAxisContent, yAxis);
//样式-坐标轴-y轴-轴标题
if (yAxis != null) {
ITContent yAxisContent = ITContent.copy(chartContent);
yAxisContent.addOtherPos(
chart.getChartName(),
Toolkit.i18nText("Fine-Design_Chart_Pattern"),
Toolkit.i18nText("Fine-Design_Chart_Axis"),
Toolkit.i18nText("Fine-Design_Chart_Y_Axis")
);
dealTitle(formulaInfos, yAxisContent, yAxis.getTitle());
dealChartValueDefine(formulaInfos, yAxisContent, yAxis);
}
}
}
private void dealChartValueDefine(List<FormulaInfo> formulaInfos, ITContent axisContent, Axis axis) {

5
designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceMainDialog.java

@ -10,6 +10,7 @@ import com.fr.design.actions.replace.utils.ShowValueUtils;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.dialog.UIDialog;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.DesignerContext;
@ -97,7 +98,7 @@ public class ITReplaceMainDialog extends UIDialog {
setSize(width, height);
setLocation(new Point(point.x, point.y + jTemplate.getHeight() / 2 + jTemplate.getHeight() / 2 - 385));
northPane.fitScreen(0, 0, jTemplate.getWidth());
northPane.fitScreen(0, 0,width);
}
@ -142,7 +143,7 @@ public class ITReplaceMainDialog extends UIDialog {
}
}
});
center.add(northPane.getUpPanel(), BorderLayout.NORTH);
center.add(northPane.getScrollPane(), BorderLayout.NORTH);
center.add(southPanel.getTableEditorPane(), BorderLayout.CENTER);
add(westPanel.getLeftJpanel(), BorderLayout.WEST);
//主体部分

54
designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceNorthPanel.java

@ -1,8 +1,8 @@
package com.fr.design.actions.replace.ui;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.i18n.Toolkit;
@ -12,6 +12,7 @@ import com.fr.stable.StringUtils;
import javax.swing.ComboBoxEditor;
import javax.swing.JCheckBox;
import javax.swing.JPanel;
import javax.swing.ScrollPaneConstants;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
@ -36,12 +37,16 @@ public class ITReplaceNorthPanel {
private UIComboBox findInputCombobox;
private UIComboBox replaceInputCombobox;
private UIScrollPane scrollPane;
private UIButton replaceButton;
private UIButton searchButton;
//存储的5次最近输入
private int maxItemCount = 5;
private static final int LIMIT_WIDTH = 1250;
private static final int HEIGHT = 161;
private static final int BUTTON_WIDTH = 60;
private static final int BUTTON_GAP = 20;
private int findLabelX, findLabelY, findLabelWidth, findLabelHeight;
@ -52,9 +57,9 @@ public class ITReplaceNorthPanel {
private int resultLabelX, resultLabelY, resultLabelWidth, resultLabelHeight;
private int findInputComboBoxX, findInputComboBoxY, findInputComboBoxWidth, findInputComboBoxHeight;
private int replaceInputComboBoxX, replaceInputComboBoxY, replaceInputComboBoxWidth, replaceInputComboBoxHeight;
private int replaceButtonX, replaceButtonY, replaceButtonWidth, replaceButtonHeight;
private int searchButtonX, searchButtonY, searchButtonWidth, searchButtonHeight;
private int buttonGap;
private int replaceButtonX, replaceButtonY, replaceButtonHeight;
private int searchButtonX, searchButtonY, searchButtonHeight;
public static ArrayList<String> findItems = new ArrayList<>();
public static ArrayList<String> findInputItems = new ArrayList<>();
@ -103,9 +108,8 @@ public class ITReplaceNorthPanel {
replaceButton = new UIButton(Toolkit.i18nText("Fine-Design_Replace_Button"));
searchButton = new UIButton(Toolkit.i18nText("Fine-Design_Search_Button"));
setLimitSize(HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().getWidth());
upPanel.setPreferredSize(new Dimension(LIMIT_WIDTH, HEIGHT));
scrollPane = new UIScrollPane(upPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
upPanel.add(findLabel);
upPanel.add(rangeLabel);
upPanel.add(resultLabel);
@ -124,8 +128,9 @@ public class ITReplaceNorthPanel {
* @param width
*/
public void setLimitSize(int width) {
width = Math.max(LIMIT_WIDTH, width);
upPanel.setMaximumSize(new Dimension(width, 161));
upPanel.setMinimumSize(new Dimension(width, 161));
//upPanel.setMinimumSize(new Dimension(width, 161));
upPanel.setPreferredSize(new Dimension(width, 161));
}
@ -139,6 +144,8 @@ public class ITReplaceNorthPanel {
*/
public void fitScreen(int x, int y, int templateWidth) {
templateWidth = Math.max(templateWidth, LIMIT_WIDTH);
setFindLabelBounds(x, y, templateWidth);
setRangeLabelBounds(x, y, templateWidth);
setResultLabelBounds(x, y, templateWidth);
@ -152,6 +159,7 @@ public class ITReplaceNorthPanel {
setReplaceButtonBounds(x, y, templateWidth);
setSearchButtonBounds(x, y, templateWidth);
}
@ -198,27 +206,31 @@ public class ITReplaceNorthPanel {
}
private void setSearchButtonBounds(int x, int y, int templateWidth) {
buttonGap = templateWidth / 90;
searchButtonWidth = templateWidth / 30;
public UIScrollPane getScrollPane() {
return scrollPane;
}
public void setScrollPane(UIScrollPane scrollPane) {
this.scrollPane = scrollPane;
}
private void setSearchButtonBounds(int x, int y, int templateWidth) {
searchButtonHeight = 25;
searchButtonY = resultLabelY;
searchButtonX = replaceInputComboBoxX + replaceInputComboBoxWidth - replaceButtonWidth * 2 - buttonGap;
searchButton.setBounds(searchButtonX, searchButtonY, searchButtonWidth, searchButtonHeight);
searchButtonX = replaceInputComboBoxX + replaceInputComboBoxWidth - BUTTON_WIDTH * 2 - BUTTON_GAP;
searchButton.setBounds(searchButtonX, searchButtonY, BUTTON_WIDTH, searchButtonHeight);
}
private void setReplaceButtonBounds(int x, int y, int templateWidth) {
buttonGap = templateWidth / 90;
replaceButtonWidth = templateWidth / 30;
replaceButtonHeight = 25;
replaceButtonY = resultLabelY;
replaceButtonX = replaceInputComboBoxX + replaceInputComboBoxWidth - replaceButtonWidth;
replaceButton.setBounds(replaceButtonX, replaceButtonY, replaceButtonWidth, replaceButtonHeight);
replaceButtonX = replaceInputComboBoxX + replaceInputComboBoxWidth - BUTTON_WIDTH;
replaceButton.setBounds(replaceButtonX, replaceButtonY, BUTTON_WIDTH, replaceButtonHeight);
}
private void setReplaceInputComboboxBounds(int x, int y, int templateWidth) {
replaceInputComboBoxX = x + templateWidth / 2 + templateWidth / 30;
replaceInputComboBoxX = x + templateWidth / 2 + templateWidth / 60;
replaceInputComboBoxY = y + 55;
replaceInputComboBoxWidth = templateWidth / 3 + templateWidth / 30 * 2;
replaceInputComboBoxHeight = 25;
@ -243,7 +255,7 @@ public class ITReplaceNorthPanel {
private void setRangeComboboxBounds(int x, int y, int templateWidth) {
rangeComboBoxX = x + templateWidth / 2 + templateWidth / 15 + templateWidth / 60;
rangeComboBoxX = x + templateWidth / 2 + templateWidth / 15;
rangeComboBoxY = y + 20;
rangeComboBoxWidth = templateWidth / 3 + templateWidth / 60;
rangeComboBoxHeight = 25;
@ -270,7 +282,7 @@ public class ITReplaceNorthPanel {
}
private void setRangeLabelBounds(int x, int y, int templateWidth) {
rangeLabelX = x + templateWidth / 2 + templateWidth / 30;
rangeLabelX = x + templateWidth / 2 + templateWidth / 60;
rangeLabelY = y + 20;
rangeLabelWidth = findLabelWidth;
rangeLabelHeight = 25;

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

@ -1,5 +1,6 @@
package com.fr.design.actions.replace.utils;
import com.fr.chart.base.DataSeriesCondition;
import com.fr.chart.chartattr.ChartCollection;
import com.fr.chart.chartglyph.ConditionAttr;
import com.fr.chart.chartglyph.ConditionCollection;
@ -16,6 +17,7 @@ import com.fr.js.JavaScriptImpl;
import com.fr.js.NameJavaScript;
import com.fr.js.NameJavaScriptGroup;
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.vanchart.VanChart;
@ -148,14 +150,28 @@ public class SearchJSUtils {
private static void searchConditionCollection(List<Pair<VanChartHtmlLabel, String>> arrayList, ConditionAttr conditionAttr) {
int conditionSize = conditionAttr.getDataSeriesConditionCount();
for (int t = 0; t < conditionSize; t++) {
if (conditionAttr.getDataSeriesCondition(t) instanceof AttrTooltip) {
arrayList.add(new Pair<>(((AttrTooltip) conditionAttr.getDataSeriesCondition(t)).getContent().getHtmlLabel(),
Toolkit.i18nText("Fine-Design_Chart_Animation_Special") + "-" + Toolkit.i18nText("Fine-Design_Chart_Condition_Display")));
DataSeriesCondition condition = conditionAttr.getDataSeriesCondition(t);
String str = Toolkit.i18nText("Fine-Design_Chart_Animation_Special") + "-" + Toolkit.i18nText("Fine-Design_Chart_Condition_Display");
if (StringUtils.isNotEmpty(conditionAttr.getName())){
str += "-"+conditionAttr.getName();
}
if (condition instanceof AttrTooltip) {
arrayList.add(new Pair<>(((AttrTooltip) condition).getContent().getHtmlLabel(), str+"-"+Toolkit.i18nText("Fine-Design_Chart_Data_Point_Tooltip")));
}
if (condition instanceof AttrLabel){
AttrLabel label = (AttrLabel) condition;
if (isAttrLabelValid(label)){
arrayList.add(new Pair<>(label.getContent().getHtmlLabel(), str+"-"+Toolkit.i18nText("Fine-Design_Chart_Label")));
}
}
}
}
private static boolean isAttrLabelValid(AttrLabel label){
return label.isEnable() && label.getContent() != null && label.getContent().getHtmlLabel() != null;
}
/**
* 获取图表-特效-交互属性中的JS
*

Loading…
Cancel
Save