Browse Source

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

feature/x
Destiny.Lin 2 years ago
parent
commit
c899ce3df3
  1. 18
      designer-realize/src/main/java/com/fr/design/actions/replace/action/ShowSearchResultAction.java
  2. 6
      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

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

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

@ -76,6 +76,7 @@ public class SearchChartCollectionFormulaAction {
} }
private void searchChartPatternFormulaFromAlertLine(List<FormulaInfo> formulaInfos, ITContent chartContent, Chart chart) { private void searchChartPatternFormulaFromAlertLine(List<FormulaInfo> formulaInfos, ITContent chartContent, Chart chart) {
if (chart.getPlot() != null){
Axis xAxis = chart.getPlot().getxAxis(); Axis xAxis = chart.getPlot().getxAxis();
Axis yAxis = chart.getPlot().getyAxis(); Axis yAxis = chart.getPlot().getyAxis();
ITContent content = ITContent.copy(chartContent); ITContent content = ITContent.copy(chartContent);
@ -103,6 +104,8 @@ public class SearchChartCollectionFormulaAction {
dealAlertContent(formulaInfos, content, alertValue); dealAlertContent(formulaInfos, content, alertValue);
} }
} }
}
} }
@ -125,6 +128,7 @@ public class SearchChartCollectionFormulaAction {
} }
private void searchChartPatternFormulaFromAxisValue(List<FormulaInfo> formulaInfos, ITContent chartContent, Chart chart) { private void searchChartPatternFormulaFromAxisValue(List<FormulaInfo> formulaInfos, ITContent chartContent, Chart chart) {
if (chart.getPlot() != null){
Axis xAxis = chart.getPlot().getxAxis(); Axis xAxis = chart.getPlot().getxAxis();
Axis yAxis = chart.getPlot().getyAxis(); Axis yAxis = chart.getPlot().getyAxis();
//样式-坐标轴-x轴 //样式-坐标轴-x轴
@ -156,7 +160,7 @@ public class SearchChartCollectionFormulaAction {
dealTitle(formulaInfos, yAxisContent, yAxis.getTitle()); dealTitle(formulaInfos, yAxisContent, yAxis.getTitle());
dealChartValueDefine(formulaInfos, yAxisContent, yAxis); dealChartValueDefine(formulaInfos, yAxisContent, yAxis);
} }
}
} }

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.FineJOptionPane;
import com.fr.design.dialog.UIDialog; import com.fr.design.dialog.UIDialog;
import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
@ -97,7 +98,7 @@ public class ITReplaceMainDialog extends UIDialog {
setSize(width, height); setSize(width, height);
setLocation(new Point(point.x, point.y + jTemplate.getHeight() / 2 + jTemplate.getHeight() / 2 - 385)); 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); center.add(southPanel.getTableEditorPane(), BorderLayout.CENTER);
add(westPanel.getLeftJpanel(), BorderLayout.WEST); 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; 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.ibutton.UIButton;
import com.fr.design.gui.icombobox.UIComboBox; 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.ilable.UILabel;
import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
@ -12,6 +12,7 @@ import com.fr.stable.StringUtils;
import javax.swing.ComboBoxEditor; import javax.swing.ComboBoxEditor;
import javax.swing.JCheckBox; import javax.swing.JCheckBox;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.ScrollPaneConstants;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
@ -36,12 +37,16 @@ public class ITReplaceNorthPanel {
private UIComboBox findInputCombobox; private UIComboBox findInputCombobox;
private UIComboBox replaceInputCombobox; private UIComboBox replaceInputCombobox;
private UIScrollPane scrollPane;
private UIButton replaceButton; private UIButton replaceButton;
private UIButton searchButton; private UIButton searchButton;
//存储的5次最近输入 //存储的5次最近输入
private int maxItemCount = 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; private int findLabelX, findLabelY, findLabelWidth, findLabelHeight;
@ -52,9 +57,9 @@ public class ITReplaceNorthPanel {
private int resultLabelX, resultLabelY, resultLabelWidth, resultLabelHeight; private int resultLabelX, resultLabelY, resultLabelWidth, resultLabelHeight;
private int findInputComboBoxX, findInputComboBoxY, findInputComboBoxWidth, findInputComboBoxHeight; private int findInputComboBoxX, findInputComboBoxY, findInputComboBoxWidth, findInputComboBoxHeight;
private int replaceInputComboBoxX, replaceInputComboBoxY, replaceInputComboBoxWidth, replaceInputComboBoxHeight; private int replaceInputComboBoxX, replaceInputComboBoxY, replaceInputComboBoxWidth, replaceInputComboBoxHeight;
private int replaceButtonX, replaceButtonY, replaceButtonWidth, replaceButtonHeight; private int replaceButtonX, replaceButtonY, replaceButtonHeight;
private int searchButtonX, searchButtonY, searchButtonWidth, searchButtonHeight; private int searchButtonX, searchButtonY, searchButtonHeight;
private int buttonGap;
public static ArrayList<String> findItems = new ArrayList<>(); public static ArrayList<String> findItems = new ArrayList<>();
public static ArrayList<String> findInputItems = 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")); replaceButton = new UIButton(Toolkit.i18nText("Fine-Design_Replace_Button"));
searchButton = new UIButton(Toolkit.i18nText("Fine-Design_Search_Button")); searchButton = new UIButton(Toolkit.i18nText("Fine-Design_Search_Button"));
upPanel.setPreferredSize(new Dimension(LIMIT_WIDTH, HEIGHT));
setLimitSize(HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().getWidth()); scrollPane = new UIScrollPane(upPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
upPanel.add(findLabel); upPanel.add(findLabel);
upPanel.add(rangeLabel); upPanel.add(rangeLabel);
upPanel.add(resultLabel); upPanel.add(resultLabel);
@ -124,8 +128,9 @@ public class ITReplaceNorthPanel {
* @param width * @param width
*/ */
public void setLimitSize(int width) { public void setLimitSize(int width) {
width = Math.max(LIMIT_WIDTH, width);
upPanel.setMaximumSize(new Dimension(width, 161)); upPanel.setMaximumSize(new Dimension(width, 161));
upPanel.setMinimumSize(new Dimension(width, 161)); //upPanel.setMinimumSize(new Dimension(width, 161));
upPanel.setPreferredSize(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) { public void fitScreen(int x, int y, int templateWidth) {
templateWidth = Math.max(templateWidth, LIMIT_WIDTH);
setFindLabelBounds(x, y, templateWidth); setFindLabelBounds(x, y, templateWidth);
setRangeLabelBounds(x, y, templateWidth); setRangeLabelBounds(x, y, templateWidth);
setResultLabelBounds(x, y, templateWidth); setResultLabelBounds(x, y, templateWidth);
@ -152,6 +159,7 @@ public class ITReplaceNorthPanel {
setReplaceButtonBounds(x, y, templateWidth); setReplaceButtonBounds(x, y, templateWidth);
setSearchButtonBounds(x, y, templateWidth); setSearchButtonBounds(x, y, templateWidth);
} }
@ -198,27 +206,31 @@ public class ITReplaceNorthPanel {
} }
private void setSearchButtonBounds(int x, int y, int templateWidth) { public UIScrollPane getScrollPane() {
buttonGap = templateWidth / 90; return scrollPane;
searchButtonWidth = templateWidth / 30; }
public void setScrollPane(UIScrollPane scrollPane) {
this.scrollPane = scrollPane;
}
private void setSearchButtonBounds(int x, int y, int templateWidth) {
searchButtonHeight = 25; searchButtonHeight = 25;
searchButtonY = resultLabelY; searchButtonY = resultLabelY;
searchButtonX = replaceInputComboBoxX + replaceInputComboBoxWidth - replaceButtonWidth * 2 - buttonGap; searchButtonX = replaceInputComboBoxX + replaceInputComboBoxWidth - BUTTON_WIDTH * 2 - BUTTON_GAP;
searchButton.setBounds(searchButtonX, searchButtonY, searchButtonWidth, searchButtonHeight); searchButton.setBounds(searchButtonX, searchButtonY, BUTTON_WIDTH, searchButtonHeight);
} }
private void setReplaceButtonBounds(int x, int y, int templateWidth) { private void setReplaceButtonBounds(int x, int y, int templateWidth) {
buttonGap = templateWidth / 90;
replaceButtonWidth = templateWidth / 30;
replaceButtonHeight = 25; replaceButtonHeight = 25;
replaceButtonY = resultLabelY; replaceButtonY = resultLabelY;
replaceButtonX = replaceInputComboBoxX + replaceInputComboBoxWidth - replaceButtonWidth; replaceButtonX = replaceInputComboBoxX + replaceInputComboBoxWidth - BUTTON_WIDTH;
replaceButton.setBounds(replaceButtonX, replaceButtonY, replaceButtonWidth, replaceButtonHeight); replaceButton.setBounds(replaceButtonX, replaceButtonY, BUTTON_WIDTH, replaceButtonHeight);
} }
private void setReplaceInputComboboxBounds(int x, int y, int templateWidth) { private void setReplaceInputComboboxBounds(int x, int y, int templateWidth) {
replaceInputComboBoxX = x + templateWidth / 2 + templateWidth / 30; replaceInputComboBoxX = x + templateWidth / 2 + templateWidth / 60;
replaceInputComboBoxY = y + 55; replaceInputComboBoxY = y + 55;
replaceInputComboBoxWidth = templateWidth / 3 + templateWidth / 30 * 2; replaceInputComboBoxWidth = templateWidth / 3 + templateWidth / 30 * 2;
replaceInputComboBoxHeight = 25; replaceInputComboBoxHeight = 25;
@ -243,7 +255,7 @@ public class ITReplaceNorthPanel {
private void setRangeComboboxBounds(int x, int y, int templateWidth) { 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; rangeComboBoxY = y + 20;
rangeComboBoxWidth = templateWidth / 3 + templateWidth / 60; rangeComboBoxWidth = templateWidth / 3 + templateWidth / 60;
rangeComboBoxHeight = 25; rangeComboBoxHeight = 25;
@ -270,7 +282,7 @@ public class ITReplaceNorthPanel {
} }
private void setRangeLabelBounds(int x, int y, int templateWidth) { private void setRangeLabelBounds(int x, int y, int templateWidth) {
rangeLabelX = x + templateWidth / 2 + templateWidth / 30; rangeLabelX = x + templateWidth / 2 + templateWidth / 60;
rangeLabelY = y + 20; rangeLabelY = y + 20;
rangeLabelWidth = findLabelWidth; rangeLabelWidth = findLabelWidth;
rangeLabelHeight = 25; 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; package com.fr.design.actions.replace.utils;
import com.fr.chart.base.DataSeriesCondition;
import com.fr.chart.chartattr.ChartCollection; import com.fr.chart.chartattr.ChartCollection;
import com.fr.chart.chartglyph.ConditionAttr; import com.fr.chart.chartglyph.ConditionAttr;
import com.fr.chart.chartglyph.ConditionCollection; import com.fr.chart.chartglyph.ConditionCollection;
@ -16,6 +17,7 @@ import com.fr.js.JavaScriptImpl;
import com.fr.js.NameJavaScript; import com.fr.js.NameJavaScript;
import com.fr.js.NameJavaScriptGroup; import com.fr.js.NameJavaScriptGroup;
import com.fr.plugin.chart.attr.plot.VanChartPlot; 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.AttrTooltip;
import com.fr.plugin.chart.base.VanChartHtmlLabel; import com.fr.plugin.chart.base.VanChartHtmlLabel;
import com.fr.plugin.chart.vanchart.VanChart; 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) { private static void searchConditionCollection(List<Pair<VanChartHtmlLabel, String>> arrayList, ConditionAttr conditionAttr) {
int conditionSize = conditionAttr.getDataSeriesConditionCount(); int conditionSize = conditionAttr.getDataSeriesConditionCount();
for (int t = 0; t < conditionSize; t++) { for (int t = 0; t < conditionSize; t++) {
if (conditionAttr.getDataSeriesCondition(t) instanceof AttrTooltip) { DataSeriesCondition condition = conditionAttr.getDataSeriesCondition(t);
arrayList.add(new Pair<>(((AttrTooltip) conditionAttr.getDataSeriesCondition(t)).getContent().getHtmlLabel(), String str = Toolkit.i18nText("Fine-Design_Chart_Animation_Special") + "-" + Toolkit.i18nText("Fine-Design_Chart_Condition_Display");
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 * 获取图表-特效-交互属性中的JS
* *

Loading…
Cancel
Save