Browse Source

适配箱型图

feature/big-screen
Qinghui.Liu 4 years ago
parent
commit
137adaaef2
  1. 135
      designer-chart/src/main/java/com/fr/van/chart/box/VanChartBoxRichTextDetailedFieldListPane.java
  2. 41
      designer-chart/src/main/java/com/fr/van/chart/box/VanChartBoxRichTextResultFieldListPane.java
  3. 234
      designer-chart/src/main/java/com/fr/van/chart/box/VanChartBoxTooltipContentPane.java

135
designer-chart/src/main/java/com/fr/van/chart/box/VanChartBoxRichTextDetailedFieldListPane.java

@ -0,0 +1,135 @@
package com.fr.van.chart.box;
import com.fr.design.i18n.Toolkit;
import com.fr.design.ui.ModernUIPane;
import com.fr.plugin.chart.base.AttrTooltipContent;
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.AttrTooltipSeriesFormat;
import com.fr.plugin.chart.box.attr.AttrBoxTooltipContent;
import com.fr.van.chart.designer.component.richText.VanChartFieldAttrPane;
import com.fr.van.chart.designer.component.richText.VanChartFieldButton;
import com.fr.van.chart.designer.component.richText.VanChartFieldListPane;
import com.fr.van.chart.designer.component.richText.VanChartFieldListener;
import com.fr.van.chart.designer.component.richText.VanChartRichEditorModel;
import javax.swing.JPanel;
import java.util.ArrayList;
import java.util.List;
public class VanChartBoxRichTextDetailedFieldListPane extends VanChartFieldListPane {
private VanChartFieldButton richTextNumber;
private VanChartFieldButton richTextMax;
private VanChartFieldButton richTextQ3;
private VanChartFieldButton richTextMedian;
private VanChartFieldButton richTextQ1;
private VanChartFieldButton richTextMin;
private VanChartFieldButton richTextOutlier;
public VanChartBoxRichTextDetailedFieldListPane(VanChartFieldAttrPane fieldAttrPane, ModernUIPane<VanChartRichEditorModel> richEditorPane) {
super(fieldAttrPane, richEditorPane);
}
public VanChartFieldButton getRichTextMax() {
return richTextMax;
}
public VanChartFieldButton getRichTextQ3() {
return richTextQ3;
}
public VanChartFieldButton getRichTextMedian() {
return richTextMedian;
}
public VanChartFieldButton getRichTextQ1() {
return richTextQ1;
}
public VanChartFieldButton getRichTextMin() {
return richTextMin;
}
protected void initDefaultFieldButton() {
VanChartFieldListener listener = getFieldListener();
setCategoryNameButton(new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Category_Use_Name"), new AttrTooltipCategoryFormat(), listener));
setSeriesNameButton(new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Series_Name"), new AttrTooltipSeriesFormat(), listener));
richTextNumber = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Data_Number"), new AttrTooltipDataNumberFormat(), listener);
richTextMax = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Max_Value"), new AttrTooltipDataMaxFormat(), listener);
richTextQ3 = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Data_Q3"), new AttrTooltipDataQ3Format(), listener);
richTextMedian = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Data_Median"), new AttrTooltipDataMedianFormat(), listener);
richTextQ1 = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Data_Q1"), new AttrTooltipDataQ1Format(), listener);
richTextMin = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Min_Value"), new AttrTooltipDataMinFormat(), listener);
richTextOutlier = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Outlier_Value"), new AttrTooltipDataOutlierFormat(), listener);
}
protected void addDefaultFieldButton(JPanel fieldPane) {
fieldPane.add(getCategoryNameButton());
fieldPane.add(getSeriesNameButton());
fieldPane.add(richTextNumber);
fieldPane.add(richTextMax);
fieldPane.add(richTextQ3);
fieldPane.add(richTextMedian);
fieldPane.add(richTextQ1);
fieldPane.add(richTextMin);
fieldPane.add(richTextOutlier);
}
protected List<VanChartFieldButton> getDefaultFieldButtonList() {
List<VanChartFieldButton> fieldButtonList = new ArrayList<>();
fieldButtonList.add(getCategoryNameButton());
fieldButtonList.add(getSeriesNameButton());
fieldButtonList.add(richTextNumber);
fieldButtonList.add(richTextMax);
fieldButtonList.add(richTextQ3);
fieldButtonList.add(richTextMedian);
fieldButtonList.add(richTextQ1);
fieldButtonList.add(richTextMin);
fieldButtonList.add(richTextOutlier);
return fieldButtonList;
}
public void populateDefaultField(AttrTooltipContent tooltipContent) {
super.populateDefaultField(tooltipContent);
if (tooltipContent instanceof AttrBoxTooltipContent) {
AttrBoxTooltipContent box = (AttrBoxTooltipContent) tooltipContent;
populateButtonFormat(richTextNumber, box.getRichTextNumber());
populateButtonFormat(richTextMax, box.getRichTextMax());
populateButtonFormat(richTextQ3, box.getRichTextQ3());
populateButtonFormat(richTextMedian, box.getRichTextMedian());
populateButtonFormat(richTextQ1, box.getRichTextQ1());
populateButtonFormat(richTextMin, box.getRichTextMin());
populateButtonFormat(richTextOutlier, box.getRichTextOutlier());
}
}
public void updateDefaultField(AttrTooltipContent tooltipContent) {
super.updateDefaultField(tooltipContent);
if (tooltipContent instanceof AttrBoxTooltipContent) {
AttrBoxTooltipContent box = (AttrBoxTooltipContent) tooltipContent;
updateButtonFormat(richTextNumber, box.getRichTextNumber());
updateButtonFormat(richTextMax, box.getRichTextMax());
updateButtonFormat(richTextQ3, box.getRichTextQ3());
updateButtonFormat(richTextMedian, box.getRichTextMedian());
updateButtonFormat(richTextQ1, box.getRichTextQ1());
updateButtonFormat(richTextMin, box.getRichTextMin());
updateButtonFormat(richTextOutlier, box.getRichTextOutlier());
}
}
}

41
designer-chart/src/main/java/com/fr/van/chart/box/VanChartBoxRichTextResultFieldListPane.java

@ -0,0 +1,41 @@
package com.fr.van.chart.box;
import com.fr.design.ui.ModernUIPane;
import com.fr.van.chart.designer.component.richText.VanChartFieldAttrPane;
import com.fr.van.chart.designer.component.richText.VanChartFieldButton;
import com.fr.van.chart.designer.component.richText.VanChartRichEditorModel;
import javax.swing.JPanel;
import java.util.ArrayList;
import java.util.List;
public class VanChartBoxRichTextResultFieldListPane extends VanChartBoxRichTextDetailedFieldListPane {
public VanChartBoxRichTextResultFieldListPane(VanChartFieldAttrPane fieldAttrPane, ModernUIPane<VanChartRichEditorModel> richEditorPane) {
super(fieldAttrPane, richEditorPane);
}
protected void addDefaultFieldButton(JPanel fieldPane) {
fieldPane.add(getCategoryNameButton());
fieldPane.add(getSeriesNameButton());
fieldPane.add(getRichTextMax());
fieldPane.add(getRichTextQ3());
fieldPane.add(getRichTextMedian());
fieldPane.add(getRichTextQ1());
fieldPane.add(getRichTextMin());
}
protected List<VanChartFieldButton> getDefaultFieldButtonList() {
List<VanChartFieldButton> fieldButtonList = new ArrayList<>();
fieldButtonList.add(getCategoryNameButton());
fieldButtonList.add(getSeriesNameButton());
fieldButtonList.add(getRichTextMax());
fieldButtonList.add(getRichTextQ3());
fieldButtonList.add(getRichTextMedian());
fieldButtonList.add(getRichTextQ1());
fieldButtonList.add(getRichTextMin());
return fieldButtonList;
}
}

234
designer-chart/src/main/java/com/fr/van/chart/box/VanChartBoxTooltipContentPane.java

@ -4,8 +4,8 @@ import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.ui.ModernUIPane;
import com.fr.plugin.chart.base.AttrTooltipContent; 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.AttrTooltipCategoryFormat;
import com.fr.plugin.chart.base.format.AttrTooltipDataMaxFormat; import com.fr.plugin.chart.base.format.AttrTooltipDataMaxFormat;
import com.fr.plugin.chart.base.format.AttrTooltipDataMedianFormat; import com.fr.plugin.chart.base.format.AttrTooltipDataMedianFormat;
@ -25,12 +25,15 @@ import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithCheckB
import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithoutCheckBox;
import com.fr.van.chart.designer.component.format.VanChartFormatPaneWithCheckBox; import com.fr.van.chart.designer.component.format.VanChartFormatPaneWithCheckBox;
import com.fr.van.chart.designer.component.format.VanChartFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.component.format.VanChartFormatPaneWithoutCheckBox;
import com.fr.van.chart.designer.component.richText.VanChartFieldAttrPane;
import com.fr.van.chart.designer.component.richText.VanChartFieldListPane;
import com.fr.van.chart.designer.component.richText.VanChartRichEditorModel;
import com.fr.van.chart.designer.component.richText.VanChartRichTextPane;
import com.fr.van.chart.designer.style.VanChartStylePane; import com.fr.van.chart.designer.style.VanChartStylePane;
import javax.swing.JPanel; import javax.swing.JPanel;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Component; import java.awt.Component;
import java.util.Map;
public class VanChartBoxTooltipContentPane extends VanChartTooltipContentPane { public class VanChartBoxTooltipContentPane extends VanChartTooltipContentPane {
@ -55,9 +58,6 @@ public class VanChartBoxTooltipContentPane extends VanChartTooltipContentPane {
private JPanel dataNumberPane; private JPanel dataNumberPane;
private JPanel dataOutlierPane; private JPanel dataOutlierPane;
private JPanel richTextNumberPane;
private JPanel richTextOutlierPane;
public VanChartBoxTooltipContentPane(VanChartStylePane parent, JPanel showOnPane, boolean isDetailed) { public VanChartBoxTooltipContentPane(VanChartStylePane parent, JPanel showOnPane, boolean isDetailed) {
super(parent, showOnPane); super(parent, showOnPane);
checkFormatVisible(isDetailed); checkFormatVisible(isDetailed);
@ -155,14 +155,74 @@ public class VanChartBoxTooltipContentPane extends VanChartTooltipContentPane {
return commonPanel; return commonPanel;
} }
protected JPanel createRichFormatPanel() { protected VanChartRichTextPane createRichTextPane(ModernUIPane<VanChartRichEditorModel> richEditorPane) {
JPanel richFormatPanel = new JPanel(new BorderLayout());
return new VanChartRichTextPane(richEditorPane) {
protected VanChartFieldListPane createFieldListPane(VanChartFieldAttrPane fieldAttrPane, ModernUIPane<VanChartRichEditorModel> richEditor) {
if (detailed) {
return new VanChartBoxRichTextDetailedFieldListPane(fieldAttrPane, richEditor);
}
return new VanChartBoxRichTextResultFieldListPane(fieldAttrPane, richEditor);
}
protected AttrTooltipContent getInitialTooltipContent() {
return createAttrTooltip();
}
};
}
protected String[] getRichTextFieldNames() {
if (detailed) {
return new String[]{
Toolkit.i18nText("Fine-Design_Chart_Category_Use_Name"),
Toolkit.i18nText("Fine-Design_Chart_Series_Name"),
Toolkit.i18nText("Fine-Design_Chart_Data_Number"),
Toolkit.i18nText("Fine-Design_Chart_Max_Value"),
Toolkit.i18nText("Fine-Design_Chart_Data_Q3"),
Toolkit.i18nText("Fine-Design_Chart_Data_Median"),
Toolkit.i18nText("Fine-Design_Chart_Data_Q1"),
Toolkit.i18nText("Fine-Design_Chart_Min_Value"),
Toolkit.i18nText("Fine-Design_Chart_Outlier_Value")
};
}
return new String[]{
Toolkit.i18nText("Fine-Design_Chart_Category_Use_Name"),
Toolkit.i18nText("Fine-Design_Chart_Series_Name"),
Toolkit.i18nText("Fine-Design_Chart_Max_Value"),
Toolkit.i18nText("Fine-Design_Chart_Data_Q3"),
Toolkit.i18nText("Fine-Design_Chart_Data_Median"),
Toolkit.i18nText("Fine-Design_Chart_Data_Q1"),
Toolkit.i18nText("Fine-Design_Chart_Min_Value")
};
}
richFormatPanel.add(createRichTextCateAndSeriesPane(), BorderLayout.NORTH); protected AttrTooltipFormat[] getRichTextFieldFormats() {
richFormatPanel.add(createRichTextDataNumberPane(), BorderLayout.CENTER); if (detailed) {
richFormatPanel.add(createRichTextDataDetailPane(), BorderLayout.SOUTH); return new AttrTooltipFormat[]{
new AttrTooltipCategoryFormat(),
new AttrTooltipSeriesFormat(),
new AttrTooltipDataNumberFormat(),
new AttrTooltipDataMaxFormat(),
new AttrTooltipDataQ3Format(),
new AttrTooltipDataMedianFormat(),
new AttrTooltipDataQ1Format(),
new AttrTooltipDataMinFormat(),
new AttrTooltipDataOutlierFormat()
};
}
return richFormatPanel; return new AttrTooltipFormat[]{
new AttrTooltipCategoryFormat(),
new AttrTooltipSeriesFormat(),
new AttrTooltipDataMaxFormat(),
new AttrTooltipDataQ3Format(),
new AttrTooltipDataMedianFormat(),
new AttrTooltipDataQ1Format(),
new AttrTooltipDataMinFormat()
};
} }
protected Component[][] getRichTextComponents() { protected Component[][] getRichTextComponents() {
@ -249,72 +309,6 @@ public class VanChartBoxTooltipContentPane extends VanChartTooltipContentPane {
return detailPane; 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() { public boolean isDirty() {
return getCategoryNameFormatPane().isDirty() return getCategoryNameFormatPane().isDirty()
|| getSeriesNameFormatPane().isDirty() || getSeriesNameFormatPane().isDirty()
@ -362,65 +356,23 @@ public class VanChartBoxTooltipContentPane extends VanChartTooltipContentPane {
} }
} }
protected void populateRichEditor(AttrTooltipContent attrTooltipContent) { protected void updateTooltipFormat(AttrTooltipContent target, AttrTooltipContent source) {
setRichTextAttr(new AttrTooltipRichText()); super.updateTooltipFormat(target, source);
Map<String, String> params = getRichTextAttr().getParams();
AttrTooltipCategoryFormat categoryFormat = attrTooltipContent.getRichTextCategoryFormat();
getRichTextCategoryNameFormatPane().populate(categoryFormat);
getRichTextCategoryNameFormatPane().updateFormatParams(params, categoryFormat.getJs());
AttrTooltipSeriesFormat seriesFormat = attrTooltipContent.getRichTextSeriesFormat();
getRichTextSeriesNameFormatPane().populate(seriesFormat);
getRichTextSeriesNameFormatPane().updateFormatParams(params, seriesFormat.getJs());
if (attrTooltipContent instanceof AttrBoxTooltipContent) {
AttrBoxTooltipContent boxTooltipContent = (AttrBoxTooltipContent) attrTooltipContent;
VanChartFormatPaneWithoutCheckBox[] formatPaneGroup = getFormatPaneGroup();
AttrTooltipFormat[] formatGroup = getFormatGroup(boxTooltipContent);
populateRichTextFormat(formatPaneGroup, formatGroup); if (target instanceof AttrBoxTooltipContent && source instanceof AttrBoxTooltipContent) {
populateRichText(attrTooltipContent.getRichTextAttr()); AttrBoxTooltipContent targetGantt = (AttrBoxTooltipContent) target;
AttrBoxTooltipContent sourceGantt = (AttrBoxTooltipContent) source;
checkRichEditorState(attrTooltipContent); targetGantt.setRichTextNumber(sourceGantt.getRichTextNumber());
targetGantt.setRichTextMax(sourceGantt.getRichTextMax());
targetGantt.setRichTextQ3(sourceGantt.getRichTextQ3());
targetGantt.setRichTextMedian(sourceGantt.getRichTextMedian());
targetGantt.setRichTextQ1(sourceGantt.getRichTextQ1());
targetGantt.setRichTextMin(sourceGantt.getRichTextMin());
targetGantt.setRichTextOutlier(sourceGantt.getRichTextOutlier());
} }
} }
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) { protected void updateFormatPane(AttrTooltipContent attrTooltipContent) {
getCategoryNameFormatPane().update(attrTooltipContent.getCategoryFormat()); getCategoryNameFormatPane().update(attrTooltipContent.getCategoryFormat());
getSeriesNameFormatPane().update(attrTooltipContent.getSeriesFormat()); getSeriesNameFormatPane().update(attrTooltipContent.getSeriesFormat());
@ -440,30 +392,10 @@ public class VanChartBoxTooltipContentPane extends VanChartTooltipContentPane {
} }
} }
protected void updateRichEditor(AttrTooltipContent attrTooltipContent) {
getRichTextCategoryNameFormatPane().update(attrTooltipContent.getRichTextCategoryFormat());
getRichTextSeriesNameFormatPane().update(attrTooltipContent.getRichTextSeriesFormat());
if (attrTooltipContent instanceof AttrBoxTooltipContent) {
AttrBoxTooltipContent boxTooltipContent = (AttrBoxTooltipContent) attrTooltipContent;
richTextNumber.update(boxTooltipContent.getRichTextNumber());
richTextMax.update(boxTooltipContent.getRichTextMax());
richTextQ3.update(boxTooltipContent.getRichTextQ3());
richTextMedian.update(boxTooltipContent.getRichTextMedian());
richTextQ1.update(boxTooltipContent.getRichTextQ1());
richTextMin.update(boxTooltipContent.getRichTextMin());
richTextOutlier.update(boxTooltipContent.getRichTextOutlier());
}
}
public void checkFormatVisible(boolean detailed) { public void checkFormatVisible(boolean detailed) {
this.detailed = detailed; this.detailed = detailed;
dataNumberPane.setVisible(detailed); dataNumberPane.setVisible(detailed);
dataOutlierPane.setVisible(detailed); dataOutlierPane.setVisible(detailed);
richTextNumberPane.setVisible(detailed);
richTextOutlierPane.setVisible(detailed);
} }
} }

Loading…
Cancel
Save