diff --git a/designer-chart/src/main/java/com/fr/van/chart/box/VanChartBoxTooltipContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/box/VanChartBoxTooltipContentPane.java index abba5f7539..25eb587d87 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/box/VanChartBoxTooltipContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/box/VanChartBoxTooltipContentPane.java @@ -7,6 +7,13 @@ import com.fr.design.layout.TableLayoutHelper; import com.fr.plugin.chart.base.AttrTooltipContent; import com.fr.plugin.chart.base.AttrTooltipRichText; import com.fr.plugin.chart.base.format.AttrTooltipCategoryFormat; +import com.fr.plugin.chart.base.format.AttrTooltipDataMaxFormat; +import com.fr.plugin.chart.base.format.AttrTooltipDataMedianFormat; +import com.fr.plugin.chart.base.format.AttrTooltipDataMinFormat; +import com.fr.plugin.chart.base.format.AttrTooltipDataNumberFormat; +import com.fr.plugin.chart.base.format.AttrTooltipDataOutlierFormat; +import com.fr.plugin.chart.base.format.AttrTooltipDataQ1Format; +import com.fr.plugin.chart.base.format.AttrTooltipDataQ3Format; import com.fr.plugin.chart.base.format.AttrTooltipFormat; import com.fr.plugin.chart.base.format.AttrTooltipSeriesFormat; import com.fr.plugin.chart.box.attr.AttrBoxTooltipContent; @@ -48,6 +55,9 @@ public class VanChartBoxTooltipContentPane extends VanChartTooltipContentPane { private JPanel dataNumberPane; private JPanel dataOutlierPane; + private JPanel richTextNumberPane; + private JPanel richTextOutlierPane; + public VanChartBoxTooltipContentPane(VanChartStylePane parent, JPanel showOnPane, boolean isDetailed) { super(parent, showOnPane); checkFormatVisible(isDetailed); @@ -145,6 +155,16 @@ public class VanChartBoxTooltipContentPane extends VanChartTooltipContentPane { return commonPanel; } + protected JPanel createRichFormatPanel() { + JPanel richFormatPanel = new JPanel(new BorderLayout()); + + richFormatPanel.add(createRichTextCateAndSeriesPane(), BorderLayout.NORTH); + richFormatPanel.add(createRichTextDataNumberPane(), BorderLayout.CENTER); + richFormatPanel.add(createRichTextDataDetailPane(), BorderLayout.SOUTH); + + return richFormatPanel; + } + protected Component[][] getRichTextComponents() { return new Component[][]{ new Component[]{getRichTextCategoryNameFormatPane(), null}, @@ -229,6 +249,72 @@ public class VanChartBoxTooltipContentPane extends VanChartTooltipContentPane { return detailPane; } + private JPanel createRichTextCateAndSeriesPane() { + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; + + double[] columnSize = {f, e}; + double[] rowSize = {p, p, p}; + + Component[][] cateAndSeries = new Component[][]{ + new Component[]{null, null}, + new Component[]{null, getRichTextCategoryNameFormatPane()}, + new Component[]{null, getRichTextSeriesNameFormatPane()} + }; + + return TableLayoutHelper.createTableLayoutPane(cateAndSeries, rowSize, columnSize); + } + + private JPanel createRichTextDataNumberPane() { + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; + + double[] columnSize = {f, e}; + double[] rowSize = {p, p}; + + Component[][] dataNumber = new Component[][]{ + new Component[]{null, null}, + new Component[]{null, richTextNumber}, + }; + + richTextNumberPane = TableLayoutHelper.createTableLayoutPane(dataNumber, rowSize, columnSize); + + return richTextNumberPane; + } + + private JPanel createRichTextDataDetailPane() { + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; + + double[] columnSize = {f, e}; + + JPanel detailPane = new JPanel(new BorderLayout()); + + Component[][] richTextDetail = new Component[][]{ + new Component[]{null, null}, + new Component[]{null, richTextMax}, + new Component[]{new UILabel(getLabelContentTitle()), richTextQ3}, + new Component[]{null, richTextMedian}, + new Component[]{null, richTextQ1}, + new Component[]{null, richTextMin} + }; + + Component[][] dataOutlier = new Component[][]{ + new Component[]{null, null}, + new Component[]{null, richTextOutlier}, + }; + + richTextOutlierPane = TableLayoutHelper.createTableLayoutPane(dataOutlier, new double[]{p, p}, columnSize); + + detailPane.add(TableLayoutHelper.createTableLayoutPane(richTextDetail, new double[]{p, p, p, p, p, p}, columnSize), BorderLayout.NORTH); + detailPane.add(richTextOutlierPane, BorderLayout.CENTER); + + return detailPane; + } + public boolean isDirty() { return getCategoryNameFormatPane().isDirty() || getSeriesNameFormatPane().isDirty() @@ -291,20 +377,8 @@ public class VanChartBoxTooltipContentPane extends VanChartTooltipContentPane { if (attrTooltipContent instanceof AttrBoxTooltipContent) { AttrBoxTooltipContent boxTooltipContent = (AttrBoxTooltipContent) attrTooltipContent; - VanChartFormatPaneWithoutCheckBox[] formatPaneGroup = new VanChartFormatPaneWithoutCheckBox[]{ - richTextNumber, richTextMax, richTextQ3, richTextMedian, - richTextQ1, richTextMin, richTextOutlier - }; - - AttrTooltipFormat[] formatGroup = new AttrTooltipFormat[]{ - boxTooltipContent.getRichTextNumber(), - boxTooltipContent.getRichTextMax(), - boxTooltipContent.getRichTextQ3(), - boxTooltipContent.getRichTextMedian(), - boxTooltipContent.getRichTextQ1(), - boxTooltipContent.getRichTextMin(), - boxTooltipContent.getRichTextOutlier() - }; + VanChartFormatPaneWithoutCheckBox[] formatPaneGroup = getFormatPaneGroup(); + AttrTooltipFormat[] formatGroup = getFormatGroup(boxTooltipContent); populateRichTextFormat(formatPaneGroup, formatGroup); populateRichText(attrTooltipContent.getRichTextAttr()); @@ -313,6 +387,40 @@ public class VanChartBoxTooltipContentPane extends VanChartTooltipContentPane { } } + private VanChartFormatPaneWithoutCheckBox[] getFormatPaneGroup() { + if (detailed) { + return new VanChartFormatPaneWithoutCheckBox[]{ + richTextNumber, richTextMax, richTextQ3, richTextMedian, + richTextQ1, richTextMin, richTextOutlier + }; + } + + return new VanChartFormatPaneWithoutCheckBox[]{ + richTextMax, richTextQ3, richTextMedian, richTextQ1, richTextMin + }; + } + + private AttrTooltipFormat[] getFormatGroup(AttrBoxTooltipContent boxTooltipContent) { + AttrTooltipDataNumberFormat richTextNumber = boxTooltipContent.getRichTextNumber(); + AttrTooltipDataMaxFormat richTextMaxFormat = boxTooltipContent.getRichTextMax(); + AttrTooltipDataQ3Format richTextQ3Format = boxTooltipContent.getRichTextQ3(); + AttrTooltipDataMedianFormat richTextMedianFormat = boxTooltipContent.getRichTextMedian(); + AttrTooltipDataQ1Format richTextQ1Format = boxTooltipContent.getRichTextQ1(); + AttrTooltipDataMinFormat richTextMinFormat = boxTooltipContent.getRichTextMin(); + AttrTooltipDataOutlierFormat richTextOutlierFormat = boxTooltipContent.getRichTextOutlier(); + + if (detailed) { + return new AttrTooltipFormat[]{ + richTextNumber, richTextMaxFormat, richTextQ3Format, richTextMedianFormat, + richTextQ1Format, richTextMinFormat, richTextOutlierFormat + }; + } + + return new AttrTooltipFormat[]{ + richTextMaxFormat, richTextQ3Format, richTextMedianFormat, richTextQ1Format, richTextMinFormat + }; + } + protected void updateFormatPane(AttrTooltipContent attrTooltipContent) { getCategoryNameFormatPane().update(attrTooltipContent.getCategoryFormat()); getSeriesNameFormatPane().update(attrTooltipContent.getSeriesFormat()); @@ -354,5 +462,8 @@ public class VanChartBoxTooltipContentPane extends VanChartTooltipContentPane { dataNumberPane.setVisible(detailed); dataOutlierPane.setVisible(detailed); + + richTextNumberPane.setVisible(detailed); + richTextOutlierPane.setVisible(detailed); } } diff --git a/designer-chart/src/main/java/com/fr/van/chart/column/VanChartColumnPlotLabelDetailPane.java b/designer-chart/src/main/java/com/fr/van/chart/column/VanChartColumnPlotLabelDetailPane.java index b2035522d2..a2be5f2905 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/column/VanChartColumnPlotLabelDetailPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/column/VanChartColumnPlotLabelDetailPane.java @@ -5,6 +5,8 @@ import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.plugin.chart.base.AttrLabelDetail; import com.fr.plugin.chart.base.AttrTooltipContent; import com.fr.plugin.chart.column.VanChartColumnPlot; +import com.fr.van.chart.designer.component.VanChartLabelContentPane; +import com.fr.van.chart.designer.component.VanChartTooltipContentPane; import com.fr.van.chart.designer.style.VanChartStylePane; import com.fr.van.chart.designer.style.label.VanChartPlotLabelDetailPane; @@ -14,6 +16,34 @@ public class VanChartColumnPlotLabelDetailPane extends VanChartPlotLabelDetailPa super(plot, parent); } + protected void initToolTipContentPane(Plot plot) { + VanChartLabelContentPane dataLabelContentPane = new VanChartLabelContentPane(getParentPane(), VanChartColumnPlotLabelDetailPane.this) { + protected void checkCardPane() { + super.checkCardPane(); + checkOrientationPane(); + } + }; + + setDataLabelContentPane(dataLabelContentPane); + } + + private void checkOrientationPane() { + VanChartLabelContentPane dataLabelContentPane = (VanChartLabelContentPane) getDataLabelContentPane(); + UIButtonGroup content = dataLabelContentPane.getContent(); + UIButtonGroup orientation = getOrientation(); + + if (content == null || orientation == null) { + return; + } + + if (content.getSelectedIndex() == VanChartTooltipContentPane.RICH_EDITOR_INDEX) { + orientation.setSelectedIndex(HORIZONTAL_INDEX); + orientation.setEnabled(false); + } else { + orientation.setEnabled(true); + } + } + protected boolean hasLabelOrientationPane() { return !((VanChartColumnPlot) this.getPlot()).isBar(); } diff --git a/designer-chart/src/main/java/com/fr/van/chart/custom/style/VanChartCustomPlotLabelTabPane.java b/designer-chart/src/main/java/com/fr/van/chart/custom/style/VanChartCustomPlotLabelTabPane.java index 5461b220f0..04b94ef5c1 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/custom/style/VanChartCustomPlotLabelTabPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/custom/style/VanChartCustomPlotLabelTabPane.java @@ -83,14 +83,14 @@ public class VanChartCustomPlotLabelTabPane extends VanChartCustomPlotTabPane customPlotList = plot.getCustomPlotList(); for (int i = 0; i < paneList.size() && i < customPlotList.size(); i++) { ConditionAttr attrList = customPlotList.get(i).getConditionCollection().getDefaultAttr(); - DataSeriesCondition attr = customPlotList.get(i).getAttrLabelFromConditionCollection(); - if (attr != null) { - attrList.remove(attr); - } VanChartPlotLabelPane labelPane = (VanChartPlotLabelPane) paneList.get(i); AttrLabel attrLabel = labelPane.update(); + DataSeriesCondition attr = customPlotList.get(i).getAttrLabelFromConditionCollection(); + if (attr != null) { + attrList.remove(attr); + } if (attrLabel != null) { attrList.addDataSeriesCondition(attrLabel); } diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartLabelContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartLabelContentPane.java index 7fe05a3600..957fcdaf72 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartLabelContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartLabelContentPane.java @@ -1,5 +1,7 @@ package com.fr.van.chart.designer.component; +import com.fr.plugin.chart.base.AttrTooltipContent; +import com.fr.plugin.chart.type.TextAlign; import com.fr.van.chart.designer.style.VanChartStylePane; import javax.swing.JPanel; @@ -15,4 +17,8 @@ public class VanChartLabelContentPane extends VanChartTooltipContentPane { protected VanChartHtmlLabelPane createHtmlLabelPane() { return new VanChartHtmlLabelPaneWithBackGroundLabel(); } + + protected AttrTooltipContent createAttrTooltip() { + return new AttrTooltipContent(TextAlign.CENTER); + } } diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartRichEditorDialog.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartRichEditorDialog.java index e584ea5444..a13208df56 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartRichEditorDialog.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartRichEditorDialog.java @@ -10,7 +10,7 @@ import java.awt.Frame; public class VanChartRichEditorDialog extends BasicDialog { - public static final Dimension DEFAULT = new Dimension(660, 600); + public static final Dimension DEFAULT = new Dimension(960, 600); public VanChartRichEditorDialog(Frame parent, BasicPane pane) { super(parent, pane); diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartRichEditorPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartRichEditorPane.java index 615979f306..408b730b28 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartRichEditorPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartRichEditorPane.java @@ -2,6 +2,7 @@ package com.fr.van.chart.designer.component; import com.fr.design.ui.ModernUIPane; import com.fr.plugin.chart.base.AttrTooltipRichText; +import com.fr.plugin.chart.type.TextAlign; import com.fr.stable.StringUtils; import com.teamdev.jxbrowser.chromium.Browser; import com.teamdev.jxbrowser.chromium.JSValue; @@ -71,12 +72,18 @@ public class VanChartRichEditorPane { String content = richText.getContent(); String initParams = StringUtils.EMPTY; + String align = StringUtils.EMPTY; if (content.contains("data-id") && !content.contains("class")) { initParams = richText.getInitParamsContent(); + + String left = TextAlign.LEFT.getAlign(); + String center = TextAlign.CENTER.getAlign(); + + align = content.contains(left) ? left : center; } - return new RichEditorModel(content, richText.isAuto(), paramsStr.toString(), initParams); + return new RichEditorModel(content, richText.isAuto(), paramsStr.toString(), initParams, align); } public static class RichEditorModel { @@ -84,12 +91,14 @@ public class VanChartRichEditorPane { private boolean auto; private String params; private String initParams; + private String align; - public RichEditorModel(String content, boolean auto, String params, String initParams) { + public RichEditorModel(String content, boolean auto, String params, String initParams, String align) { this.content = content; this.auto = auto; this.params = params; this.initParams = initParams; + this.align = align; } public String getContent() { @@ -123,5 +132,13 @@ public class VanChartRichEditorPane { public void setInitParams(String initParams) { this.initParams = initParams; } + + public String getAlign() { + return align; + } + + public void setAlign(String align) { + this.align = align; + } } } diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java index 5d0a613ac3..d4ef4ac774 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java @@ -57,10 +57,10 @@ public class VanChartTooltipContentPane extends BasicBeanPane content; @@ -202,6 +202,10 @@ public class VanChartTooltipContentPane extends BasicBeanPane getContent() { + return content; + } + public AttrTooltipRichText getRichTextAttr() { return richText; } @@ -384,17 +388,22 @@ public class VanChartTooltipContentPane extends BasicBeanPane -1) { - content += '

' + editorService.getEditorParamImage(key) + '

'; + content += '

' + editorService.getEditorParamImage(key) + '

'; } } @@ -78,7 +79,7 @@ var dimensionIds = getDimensionIds(params); if (initParams) { - content = getInitContent(params, initParams); + content = getInitContent(params, initParams, align); } var rich_editor = BI.createWidget({ @@ -118,16 +119,21 @@ var isAuto = Pool.data.isAuto(); var params = Pool.data.getParams(); var initParams = Pool.data.getInitParams(); + var align = Pool.data.getAlign(); if (initParams) { - content = getInitContent(params, initParams); + content = getInitContent(params, initParams, align); } + rich_editor.editor.bindToolbar(rich_editor.bar); + rich_editor.setValue({ content: content, isAuto: isAuto, dimensionIds: getDimensionIds(params) }); + + rich_editor.setFocus(); } Pool.update = function () { diff --git a/designer-chart/src/main/resources/com/fr/design/editor/script/editor.js b/designer-chart/src/main/resources/com/fr/design/editor/script/editor.js index 26d58f4954..e8d9e9a56e 100644 --- a/designer-chart/src/main/resources/com/fr/design/editor/script/editor.js +++ b/designer-chart/src/main/resources/com/fr/design/editor/script/editor.js @@ -27,7 +27,6 @@ this.editor = BI.createWidget({ type: "bi.nic_editor", $value: "chart-common-editor", - height: 365, cls: "editor bi-border bi-focus-shadow " + (o.textAlign === "center" ? "editor-center-text" : ""), listeners: [{ eventName: BI.NicEditor.EVENT_FOCUS, @@ -194,7 +193,7 @@ content = this.editor.getValue(BI.NicEditor.FormatType.ESCAPE), isEqualToPlaceholder = editorService.isRichTextEqual(content, this.options.placeholder); - var HTML_ONLY_STYLE_TAG = "||||||||||||||||||||

"; + var HTML_ONLY_STYLE_TAG = "|||||||||||||||||"; if (!isEqualToPlaceholder) { content = content.replaceAll(HTML_ONLY_STYLE_TAG, ""); diff --git a/designer-chart/src/main/resources/com/fr/design/editor/script/insertcombo/combo.insert_param.js b/designer-chart/src/main/resources/com/fr/design/editor/script/insertcombo/combo.insert_param.js index 7efb49c0c9..36c02fedaf 100644 --- a/designer-chart/src/main/resources/com/fr/design/editor/script/insertcombo/combo.insert_param.js +++ b/designer-chart/src/main/resources/com/fr/design/editor/script/insertcombo/combo.insert_param.js @@ -30,6 +30,7 @@ items: this.model.items, chooseType: BI.ButtonGroup.CHOOSE_TYPE_SINGLE, behaviors: {}, + width: 200, layouts: [{ type: "bi.vertical" }], @@ -45,27 +46,15 @@ var searchPopup = { type: "bi.vertical", cls: "bi-border", - hgap: 15, - tgap: 5, + tgap: 10, bgap: 10, - items: [{ - type: "bi.searcher", - adapter: this.adapter, - width: 210, - height: 24, - listeners: [{ - eventName: BI.Searcher.EVENT_CHANGE, - action: function () { - self.store.changeParam(this.getValue()[0]); - } - }] - }, this.adapter] + items: [this.adapter] }; return { type: "bi.combo", direction: "bottom,left", - isNeedAdjustWidth: false, + isNeedAdjustWidth: true, el: { type: "bi.vertical_adapt", items: [{