Browse Source

CHART-11549 修改箱型图条件属性界面

feature/big-screen
Qinghui.Liu 4 years ago
parent
commit
1d2507a471
  1. 83
      designer-chart/src/main/java/com/fr/van/chart/box/VanChartBoxBorderPane.java
  2. 19
      designer-chart/src/main/java/com/fr/van/chart/box/VanChartBoxConditionPane.java
  3. 6
      designer-chart/src/main/java/com/fr/van/chart/box/VanChartBoxPlotPane.java
  4. 30
      designer-chart/src/main/java/com/fr/van/chart/box/VanChartBoxSeriesPane.java
  5. 49
      designer-chart/src/main/java/com/fr/van/chart/box/condition/VanChartBoxBorderConditionPane.java
  6. 50
      designer-chart/src/main/java/com/fr/van/chart/box/condition/VanChartBoxNormalMarkerConditionPane.java
  7. 50
      designer-chart/src/main/java/com/fr/van/chart/box/condition/VanChartBoxOutlierMarkerConditionPane.java
  8. 8
      designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartMarkerPane.java

83
designer-chart/src/main/java/com/fr/van/chart/box/VanChartBoxBorderPane.java

@ -0,0 +1,83 @@
package com.fr.van.chart.box;
import com.fr.base.background.ColorBackground;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.TableLayout;
import com.fr.plugin.chart.base.AttrBorderWithWidth;
import com.fr.stable.StringUtils;
import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import com.fr.van.chart.designer.component.background.VanChartMarkerBackgroundPane;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Component;
public class VanChartBoxBorderPane extends BasicBeanPane<AttrBorderWithWidth> {
private VanChartMarkerBackgroundPane colorBackground;
private UISpinner lineWidth;
public VanChartBoxBorderPane() {
colorBackground = new VanChartMarkerBackgroundPane() {
protected Component[][] getPaneComponents() {
return new Component[][]{
new Component[]{null, null},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Color")), typeComboBox},
new Component[]{null, centerPane},
};
}
};
lineWidth = new UISpinner(0.5, Double.MAX_VALUE, 0.5, 0.5);
Component[][] components = new Component[][]{
new Component[]{null, null},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Line_Width")), lineWidth},
new Component[]{colorBackground, null}
};
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH;
double[] columnSize = {f, e};
double[] rowSize = {p, p, p};
JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(components, rowSize, columnSize);
this.setLayout(new BorderLayout());
this.add(panel, BorderLayout.CENTER);
}
public void populateBean(AttrBorderWithWidth border) {
if (border.getBorderColor() != null) {
this.colorBackground.populate(ColorBackground.getInstance(border.getBorderColor()));
}
this.lineWidth.setValue(border.getLineWidth());
}
public AttrBorderWithWidth updateBean() {
AttrBorderWithWidth border = new AttrBorderWithWidth();
ColorBackground colorBackground = this.colorBackground.update();
if (colorBackground == null) {
border.setBorderColor(null);
} else {
border.setBorderColor(colorBackground.getColor());
}
if (this.lineWidth != null) {
border.setLineWidth(this.lineWidth.getValue());
}
return border;
}
protected String title4PopupWindow() {
return StringUtils.EMPTY;
}
}

19
designer-chart/src/main/java/com/fr/van/chart/box/VanChartBoxConditionPane.java

@ -2,15 +2,19 @@ package com.fr.van.chart.box;
import com.fr.chart.base.AttrAlpha; import com.fr.chart.base.AttrAlpha;
import com.fr.chart.base.AttrBackground; import com.fr.chart.base.AttrBackground;
import com.fr.chart.base.AttrBorder;
import com.fr.chart.chartattr.Plot; import com.fr.chart.chartattr.Plot;
import com.fr.design.chart.series.SeriesCondition.ChartConditionPane; import com.fr.design.chart.series.SeriesCondition.ChartConditionPane;
import com.fr.design.chart.series.SeriesCondition.DataSeriesConditionPane; import com.fr.design.chart.series.SeriesCondition.DataSeriesConditionPane;
import com.fr.design.chart.series.SeriesCondition.LabelAlphaPane; import com.fr.design.chart.series.SeriesCondition.LabelAlphaPane;
import com.fr.plugin.chart.base.AttrBorderWithWidth;
import com.fr.plugin.chart.box.VanChartAttrNormalMarker;
import com.fr.plugin.chart.box.VanChartAttrOutlierMarker;
import com.fr.plugin.chart.box.VanChartBoxPlot; import com.fr.plugin.chart.box.VanChartBoxPlot;
import com.fr.plugin.chart.type.ConditionKeyType; import com.fr.plugin.chart.type.ConditionKeyType;
import com.fr.van.chart.column.VanChartColumnLabelBorderPane; import com.fr.van.chart.box.condition.VanChartBoxBorderConditionPane;
import com.fr.van.chart.designer.other.condition.item.VanChartColumnSeriesColorConditionPane; import com.fr.van.chart.box.condition.VanChartBoxNormalMarkerConditionPane;
import com.fr.van.chart.box.condition.VanChartBoxOutlierMarkerConditionPane;
import com.fr.van.chart.designer.other.condition.item.VanChartSeriesColorConditionPane;
import java.awt.Dimension; import java.awt.Dimension;
@ -27,9 +31,14 @@ public class VanChartBoxConditionPane extends DataSeriesConditionPane {
} }
protected void addBasicAction() { protected void addBasicAction() {
classPaneMap.put(AttrBackground.class, new VanChartColumnSeriesColorConditionPane(this)); classPaneMap.put(AttrBackground.class, new VanChartSeriesColorConditionPane(this));
classPaneMap.put(AttrAlpha.class, new LabelAlphaPane(this)); classPaneMap.put(AttrAlpha.class, new LabelAlphaPane(this));
classPaneMap.put(AttrBorder.class, new VanChartColumnLabelBorderPane(this)); classPaneMap.put(AttrBorderWithWidth.class, new VanChartBoxBorderConditionPane(this));
if (((VanChartBoxPlot) plot).isDetailed()) {
classPaneMap.put(VanChartAttrNormalMarker.class, new VanChartBoxNormalMarkerConditionPane(this));
classPaneMap.put(VanChartAttrOutlierMarker.class, new VanChartBoxOutlierMarkerConditionPane(this));
}
} }
protected void addStyleAction() { protected void addStyleAction() {

6
designer-chart/src/main/java/com/fr/van/chart/box/VanChartBoxPlotPane.java

@ -3,6 +3,7 @@ package com.fr.van.chart.box;
import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.Chart;
import com.fr.chart.chartattr.Plot; import com.fr.chart.chartattr.Plot;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.plugin.chart.base.VanChartTools;
import com.fr.plugin.chart.box.BoxIndependentVanChart; import com.fr.plugin.chart.box.BoxIndependentVanChart;
import com.fr.plugin.chart.box.VanChartBoxPlot; import com.fr.plugin.chart.box.VanChartBoxPlot;
import com.fr.van.chart.designer.type.AbstractVanChartTypePane; import com.fr.van.chart.designer.type.AbstractVanChartTypePane;
@ -42,4 +43,9 @@ public class VanChartBoxPlotPane extends AbstractVanChartTypePane {
return BoxIndependentVanChart.BoxVanChartTypes[0]; return BoxIndependentVanChart.BoxVanChartTypes[0];
} }
protected VanChartTools createVanChartTools() {
VanChartTools tools = new VanChartTools();
tools.setSort(false);
return tools;
}
} }

30
designer-chart/src/main/java/com/fr/van/chart/box/VanChartBoxSeriesPane.java

@ -9,7 +9,6 @@ import com.fr.plugin.chart.box.VanChartBoxPlot;
import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import com.fr.van.chart.designer.component.VanChartBeautyPane; import com.fr.van.chart.designer.component.VanChartBeautyPane;
import com.fr.van.chart.designer.component.VanChartMarkerPane; import com.fr.van.chart.designer.component.VanChartMarkerPane;
import com.fr.van.chart.designer.component.border.VanChartBorderPane;
import com.fr.van.chart.designer.style.series.VanChartAbstractPlotSeriesPane; import com.fr.van.chart.designer.style.series.VanChartAbstractPlotSeriesPane;
import javax.swing.JPanel; import javax.swing.JPanel;
@ -18,6 +17,8 @@ import java.awt.Component;
public class VanChartBoxSeriesPane extends VanChartAbstractPlotSeriesPane { public class VanChartBoxSeriesPane extends VanChartAbstractPlotSeriesPane {
private VanChartBoxBorderPane boxBorderPane;
private JPanel normalMarker; private JPanel normalMarker;
private JPanel outlierMarker; private JPanel outlierMarker;
@ -36,7 +37,7 @@ public class VanChartBoxSeriesPane extends VanChartAbstractPlotSeriesPane {
double[] rowSize = {p, p, p}; double[] rowSize = {p, p, p};
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{createBorderPane()}, new Component[]{createBoxBorderPane()},
new Component[]{createNormalValuePane()}, new Component[]{createNormalValuePane()},
new Component[]{createOutlierValuePane()} new Component[]{createOutlierValuePane()}
}; };
@ -46,20 +47,21 @@ public class VanChartBoxSeriesPane extends VanChartAbstractPlotSeriesPane {
return contentPane; return contentPane;
} }
protected VanChartBorderPane createDiffBorderPane() { private JPanel createBoxBorderPane() {
return new VanChartBorderPane(); boxBorderPane = new VanChartBoxBorderPane();
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Border"), boxBorderPane);
} }
private JPanel createNormalValuePane() { private JPanel createNormalValuePane() {
normalValuePane = new VanChartMarkerPane(); normalValuePane = new VanChartMarkerPane();
normalMarker = TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Engine_Chart_Normal_Value"), normalValuePane); normalMarker = TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Normal_Value"), normalValuePane);
return normalMarker; return normalMarker;
} }
private JPanel createOutlierValuePane() { private JPanel createOutlierValuePane() {
outlierValuePane = new VanChartMarkerPane(); outlierValuePane = new VanChartMarkerPane();
outlierMarker = TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Engine_Chart_Outlier_Value"), outlierValuePane); outlierMarker = TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Outlier_Value"), outlierValuePane);
return outlierMarker; return outlierMarker;
} }
@ -85,10 +87,13 @@ public class VanChartBoxSeriesPane extends VanChartAbstractPlotSeriesPane {
super.populateBean(plot); super.populateBean(plot);
if (plot instanceof VanChartBoxPlot) { if (plot instanceof VanChartBoxPlot) {
normalValuePane.populate(((VanChartBoxPlot) plot).getNormalValue()); VanChartBoxPlot boxPlot = (VanChartBoxPlot) plot;
outlierValuePane.populate(((VanChartBoxPlot) plot).getOutlierValue());
boxBorderPane.populateBean(boxPlot.getBorder());
normalValuePane.populate(boxPlot.getNormalValue());
outlierValuePane.populate(boxPlot.getOutlierValue());
checkMarkerPane(((VanChartBoxPlot) plot).isDetailed()); checkMarkerPane(boxPlot.isDetailed());
} }
} }
@ -98,8 +103,11 @@ public class VanChartBoxSeriesPane extends VanChartAbstractPlotSeriesPane {
} }
if (plot instanceof VanChartBoxPlot) { if (plot instanceof VanChartBoxPlot) {
((VanChartBoxPlot) plot).setNormalValue(normalValuePane.update()); VanChartBoxPlot boxPlot = (VanChartBoxPlot) plot;
((VanChartBoxPlot) plot).setOutlierValue(outlierValuePane.update());
boxPlot.setBorder(boxBorderPane.updateBean());
boxPlot.setNormalValue(normalValuePane.update());
boxPlot.setOutlierValue(outlierValuePane.update());
} }
super.updateBean(plot); super.updateBean(plot);

49
designer-chart/src/main/java/com/fr/van/chart/box/condition/VanChartBoxBorderConditionPane.java

@ -0,0 +1,49 @@
package com.fr.van.chart.box.condition;
import com.fr.chart.base.DataSeriesCondition;
import com.fr.design.condition.ConditionAttributesPane;
import com.fr.design.i18n.Toolkit;
import com.fr.plugin.chart.base.AttrBorderWithWidth;
import com.fr.van.chart.box.VanChartBoxBorderPane;
import com.fr.van.chart.designer.other.condition.item.AbstractNormalMultiLineConditionPane;
import javax.swing.JPanel;
public class VanChartBoxBorderConditionPane extends AbstractNormalMultiLineConditionPane {
private VanChartBoxBorderPane borderPane;
protected JPanel initContentPane() {
borderPane = new VanChartBoxBorderPane();
return borderPane;
}
public VanChartBoxBorderConditionPane(ConditionAttributesPane conditionAttributesPane) {
super(conditionAttributesPane);
}
public String nameForPopupMenuItem() {
return Toolkit.i18nText("Fine-Design_Chart_Border");
}
protected String getItemLabelString() {
return nameForPopupMenuItem();
}
protected String title4PopupWindow() {
return nameForPopupMenuItem();
}
public void setDefault() {
borderPane.populateBean(new AttrBorderWithWidth());
}
public void populate(DataSeriesCondition condition) {
if (condition instanceof AttrBorderWithWidth) {
this.borderPane.populateBean((AttrBorderWithWidth) condition);
}
}
public DataSeriesCondition update() {
return this.borderPane.updateBean();
}
}

50
designer-chart/src/main/java/com/fr/van/chart/box/condition/VanChartBoxNormalMarkerConditionPane.java

@ -0,0 +1,50 @@
package com.fr.van.chart.box.condition;
import com.fr.chart.base.DataSeriesCondition;
import com.fr.design.condition.ConditionAttributesPane;
import com.fr.plugin.chart.base.VanChartAttrMarker;
import com.fr.plugin.chart.box.VanChartAttrNormalMarker;
import com.fr.plugin.chart.marker.type.MarkerType;
import com.fr.van.chart.designer.component.VanChartMarkerPane;
import com.fr.van.chart.designer.other.condition.item.VanChartMarkerConditionPane;
public class VanChartBoxNormalMarkerConditionPane extends VanChartMarkerConditionPane {
public VanChartBoxNormalMarkerConditionPane(ConditionAttributesPane conditionAttributesPane) {
super(conditionAttributesPane);
}
public String nameForPopupMenuItem() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Normal_Value");
}
protected String getItemLabelString() {
return nameForPopupMenuItem();
}
protected void initMarkerPane() {
markerPane = new VanChartMarkerPane() {
protected VanChartAttrMarker createNewAttrMarker() {
return new VanChartAttrNormalMarker();
}
};
}
public void setDefault() {
VanChartAttrNormalMarker normalMarker = new VanChartAttrNormalMarker();
normalMarker.setMarkerType(MarkerType.MARKER_CIRCLE);
markerPane.populate(new VanChartAttrNormalMarker());
}
public void populate(DataSeriesCondition condition) {
if (condition instanceof VanChartAttrNormalMarker) {
markerPane.populate((VanChartAttrNormalMarker) condition);
}
}
public DataSeriesCondition update() {
return markerPane.update();
}
}

50
designer-chart/src/main/java/com/fr/van/chart/box/condition/VanChartBoxOutlierMarkerConditionPane.java

@ -0,0 +1,50 @@
package com.fr.van.chart.box.condition;
import com.fr.chart.base.DataSeriesCondition;
import com.fr.design.condition.ConditionAttributesPane;
import com.fr.plugin.chart.base.VanChartAttrMarker;
import com.fr.plugin.chart.box.VanChartAttrOutlierMarker;
import com.fr.plugin.chart.marker.type.MarkerType;
import com.fr.van.chart.designer.component.VanChartMarkerPane;
import com.fr.van.chart.designer.other.condition.item.VanChartMarkerConditionPane;
public class VanChartBoxOutlierMarkerConditionPane extends VanChartMarkerConditionPane {
public VanChartBoxOutlierMarkerConditionPane(ConditionAttributesPane conditionAttributesPane) {
super(conditionAttributesPane);
}
public String nameForPopupMenuItem() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Outlier_Value");
}
protected String getItemLabelString() {
return nameForPopupMenuItem();
}
public void setDefault() {
VanChartAttrOutlierMarker outlierMarker = new VanChartAttrOutlierMarker();
outlierMarker.setMarkerType(MarkerType.MARKER_CIRCLE_HOLLOW);
markerPane.populate(outlierMarker);
}
protected void initMarkerPane() {
markerPane = new VanChartMarkerPane() {
protected VanChartAttrMarker createNewAttrMarker() {
return new VanChartAttrOutlierMarker();
}
};
}
public void populate(DataSeriesCondition condition) {
if (condition instanceof VanChartAttrOutlierMarker) {
markerPane.populate((VanChartAttrOutlierMarker) condition);
}
}
public DataSeriesCondition update() {
return markerPane.update();
}
}

8
designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartMarkerPane.java

@ -104,9 +104,13 @@ public class VanChartMarkerPane extends BasicPane {
return Toolkit.i18nText("Fine-Design_Chart_Marker"); return Toolkit.i18nText("Fine-Design_Chart_Marker");
} }
protected VanChartAttrMarker createNewAttrMarker(){
return new VanChartAttrMarker();
}
public void populate(VanChartAttrMarker marker) { public void populate(VanChartAttrMarker marker) {
if(marker == null){ if(marker == null){
marker = new VanChartAttrMarker(); marker = createNewAttrMarker();
} }
commonORCustom.setSelectedIndex(marker.isCommon() ? 0 : 1); commonORCustom.setSelectedIndex(marker.isCommon() ? 0 : 1);
if(marker.isCommon()){ if(marker.isCommon()){
@ -120,7 +124,7 @@ public class VanChartMarkerPane extends BasicPane {
} }
public VanChartAttrMarker update() { public VanChartAttrMarker update() {
VanChartAttrMarker marker = new VanChartAttrMarker(); VanChartAttrMarker marker = createNewAttrMarker();
if(commonORCustom.getSelectedIndex() == 0){ if(commonORCustom.getSelectedIndex() == 0){
commonMarkerPane.updateBean(marker); commonMarkerPane.updateBean(marker);
} else { } else {

Loading…
Cancel
Save