Browse Source

CHART-15010

feature/big-screen
白岳 4 years ago
parent
commit
5340b0f3b5
  1. 100
      designer-chart/src/main/java/com/fr/van/chart/gauge/VanChartGaugeSeriesPane.java
  2. 3
      designer-chart/src/main/java/com/fr/van/chart/map/VanChartMapSeriesPane.java

100
designer-chart/src/main/java/com/fr/van/chart/gauge/VanChartGaugeSeriesPane.java

@ -21,6 +21,7 @@ import com.fr.plugin.chart.gauge.VanChartGaugePlot;
import com.fr.plugin.chart.type.GaugeStyle; import com.fr.plugin.chart.type.GaugeStyle;
import com.fr.stable.Constants; import com.fr.stable.Constants;
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.style.series.VanChartAbstractPlotSeriesPane; import com.fr.van.chart.designer.style.series.VanChartAbstractPlotSeriesPane;
import javax.swing.JPanel; import javax.swing.JPanel;
@ -61,22 +62,16 @@ public class VanChartGaugeSeriesPane extends VanChartAbstractPlotSeriesPane {
double f = TableLayout.FILL; double f = TableLayout.FILL;
double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH;
double[] columnSize = {f}; double[] columnSize = {f};
double[] rowSize = {p, p, p, p, p, p}; double[] rowSize = {p,p,p,p,p,p};
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{createGaugeLayoutPane()}, new Component[]{createGaugeLayoutPane()},
new Component[]{createGaugeStylePane(rowSize, new double[]{f, e})}, new Component[]{createGaugeStylePane(rowSize, new double[]{f,e})},
new Component[]{createGaugeBandsPane()} new Component[]{createGaugeBandsPane()}
}; };
return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
} }
//获取颜色面板
protected JPanel getColorPane() {
JPanel panel = new JPanel(new BorderLayout());
return panel;
}
private JPanel createGaugeLayoutPane() { private JPanel createGaugeLayoutPane() {
gaugeLayout = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_Direction_Horizontal"), Toolkit.i18nText("Fine-Design_Chart_Direction_Vertical")}); gaugeLayout = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_Direction_Horizontal"), Toolkit.i18nText("Fine-Design_Chart_Direction_Vertical")});
@ -101,20 +96,20 @@ public class VanChartGaugeSeriesPane extends VanChartAbstractPlotSeriesPane {
} }
private void changeLabelPosition() { private void changeLabelPosition() {
if (plot instanceof VanChartGaugePlot) { if(plot instanceof VanChartGaugePlot){
VanChartGaugePlot gaugePlot = (VanChartGaugePlot) plot; VanChartGaugePlot gaugePlot = (VanChartGaugePlot)plot;
if (ComparatorUtils.equals(gaugePlot.getGaugeStyle(), GaugeStyle.THERMOMETER)) { if (ComparatorUtils.equals(gaugePlot.getGaugeStyle(), GaugeStyle.THERMOMETER)){
ConditionAttr attrList = gaugePlot.getConditionCollection().getDefaultAttr(); ConditionAttr attrList = gaugePlot.getConditionCollection().getDefaultAttr();
AttrLabel attrLabel = (AttrLabel) attrList.getExisted(AttrLabel.class); AttrLabel attrLabel = (AttrLabel)attrList.getExisted(AttrLabel.class);
if (attrLabel == null) { if(attrLabel == null){
return; return;
} }
AttrLabelDetail attrLabelDetail = attrLabel.getAttrLabelDetail(); AttrLabelDetail attrLabelDetail = attrLabel.getAttrLabelDetail();
if (attrLabelDetail == null || attrLabelDetail.getTextAttr() == null) { if(attrLabelDetail == null || attrLabelDetail.getTextAttr() == null){
return; return;
} }
attrLabelDetail.getTextAttr().setFRFont(VanChartGaugePlot.THERMOMETER_LABEL_FONT); attrLabelDetail.getTextAttr().setFRFont(VanChartGaugePlot.THERMOMETER_LABEL_FONT);
if (gaugeLayout.getSelectedIndex() == 0) { if(gaugeLayout.getSelectedIndex() == 0){
attrLabel.getAttrLabelDetail().setPosition(Constants.LEFT); attrLabel.getAttrLabelDetail().setPosition(Constants.LEFT);
attrLabel.getGaugeValueLabelDetail().setPosition(Constants.LEFT); attrLabel.getGaugeValueLabelDetail().setPosition(Constants.LEFT);
} else { } else {
@ -129,7 +124,7 @@ public class VanChartGaugeSeriesPane extends VanChartAbstractPlotSeriesPane {
JPanel panel = new JPanel(new BorderLayout(0, 6)); JPanel panel = new JPanel(new BorderLayout(0, 6));
JPanel centerPanel = TableLayoutHelper.createTableLayoutPane(getDiffComponentsWithGaugeStyle(), row, col); JPanel centerPanel = TableLayoutHelper.createTableLayoutPane(getDiffComponentsWithGaugeStyle(), row, col);
panel.add(centerPanel, BorderLayout.CENTER); panel.add(centerPanel, BorderLayout.CENTER);
if (rotate != null) { if(rotate != null){
JPanel panel1 = TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Rotation_Direction"), rotate); JPanel panel1 = TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Rotation_Direction"), rotate);
panel.add(panel1, BorderLayout.NORTH); panel.add(panel1, BorderLayout.NORTH);
} }
@ -137,7 +132,7 @@ public class VanChartGaugeSeriesPane extends VanChartAbstractPlotSeriesPane {
} }
private Component[][] getDiffComponentsWithGaugeStyle() { private Component[][] getDiffComponentsWithGaugeStyle() {
GaugeStyle style = plot == null ? GaugeStyle.POINTER : ((VanChartGaugePlot) plot).getGaugeStyle(); GaugeStyle style = plot == null ? GaugeStyle.POINTER : ((VanChartGaugePlot)plot).getGaugeStyle();
switch (style) { switch (style) {
case RING: case RING:
initRotate(); initRotate();
@ -178,37 +173,37 @@ public class VanChartGaugeSeriesPane extends VanChartAbstractPlotSeriesPane {
private Component[] getHingeColor() { private Component[] getHingeColor() {
hingeColor = new ColorSelectBox(120); hingeColor = new ColorSelectBox(120);
return new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Hinge")), hingeColor}; return new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Hinge")),hingeColor};
} }
private Component[] getHingeBackgroundColor() { private Component[] getHingeBackgroundColor() {
hingeBackgroundColor = new ColorSelectBox(120); hingeBackgroundColor = new ColorSelectBox(120);
return new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Hinge_Background")), hingeBackgroundColor}; return new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Hinge_Background")),hingeBackgroundColor};
} }
private Component[] getNeedleColor() { private Component[] getNeedleColor() {
needleColor = new ColorSelectBox(120); needleColor = new ColorSelectBox(120);
return new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Needle")), needleColor}; return new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Needle")),needleColor};
} }
private Component[] getPaneBackgroundColor() { private Component[] getPaneBackgroundColor() {
paneBackgroundColor = new ColorSelectBox(120); paneBackgroundColor = new ColorSelectBox(120);
return new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Pane_Background")), paneBackgroundColor}; return new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Pane_Background")),paneBackgroundColor};
} }
private Component[] getSlotBackgroundColor() { private Component[] getSlotBackgroundColor() {
slotBackgroundColor = new ColorSelectBox(120); slotBackgroundColor = new ColorSelectBox(120);
return new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Slot_Background")), slotBackgroundColor}; return new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Slot_Background")),slotBackgroundColor};
} }
private Component[] getThermometerWidth() { private Component[] getThermometerWidth() {
thermometerWidth = new UISpinner(0, Double.MAX_VALUE, 0.1, 10); thermometerWidth = new UISpinner(0, Double.MAX_VALUE, 0.1, 10);
return new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Thermometer_Width")), thermometerWidth}; return new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Thermometer_Width")),thermometerWidth};
} }
private Component[] getChutePercent() { private Component[] getChutePercent() {
chutePercent = new UINumberDragPane(0, 100, 1); chutePercent = new UINumberDragPane(0, 100, 1);
return new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Chute_Percent")), chutePercent}; return new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Chute_Percent")),chutePercent};
} }
private void initRotate() { private void initRotate() {
@ -217,7 +212,7 @@ public class VanChartGaugeSeriesPane extends VanChartAbstractPlotSeriesPane {
private Component[] getInnerPaneBackgroundColor() { private Component[] getInnerPaneBackgroundColor() {
innerPaneBackgroundColor = new ColorSelectBox(120); innerPaneBackgroundColor = new ColorSelectBox(120);
return new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Inner_Pane_Background")), innerPaneBackgroundColor}; return new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Inner_Pane_Background")),innerPaneBackgroundColor};
} }
private JPanel createGaugeBandsPane() { private JPanel createGaugeBandsPane() {
@ -227,40 +222,40 @@ public class VanChartGaugeSeriesPane extends VanChartAbstractPlotSeriesPane {
public void populateBean(Plot plot) { public void populateBean(Plot plot) {
if (plot == null) { if(plot == null) {
return; return;
} }
super.populateBean(plot); super.populateBean(plot);
if (plot instanceof VanChartGaugePlot) { if(plot instanceof VanChartGaugePlot){
VanChartGaugePlot gaugePlot = (VanChartGaugePlot) plot; VanChartGaugePlot gaugePlot = (VanChartGaugePlot)plot;
GaugeDetailStyle detailStyle = gaugePlot.getGaugeDetailStyle(); GaugeDetailStyle detailStyle = gaugePlot.getGaugeDetailStyle();
gaugeLayout.setSelectedIndex(detailStyle.isHorizontalLayout() ? 0 : 1); gaugeLayout.setSelectedIndex(detailStyle.isHorizontalLayout() ? 0 : 1);
if (hingeColor != null) { if(hingeColor != null){
hingeColor.setSelectObject(detailStyle.getHingeColor()); hingeColor.setSelectObject(detailStyle.getHingeColor());
} }
if (hingeBackgroundColor != null) { if(hingeBackgroundColor != null){
hingeBackgroundColor.setSelectObject(detailStyle.getHingeBackgroundColor()); hingeBackgroundColor.setSelectObject(detailStyle.getHingeBackgroundColor());
} }
if (needleColor != null) { if(needleColor != null){
needleColor.setSelectObject(detailStyle.getNeedleColor()); needleColor.setSelectObject(detailStyle.getNeedleColor());
} }
if (paneBackgroundColor != null) { if(paneBackgroundColor != null){
paneBackgroundColor.setSelectObject(detailStyle.getPaneBackgroundColor()); paneBackgroundColor.setSelectObject(detailStyle.getPaneBackgroundColor());
} }
if (slotBackgroundColor != null) { if(slotBackgroundColor != null){
slotBackgroundColor.setSelectObject(detailStyle.getSlotBackgroundColor()); slotBackgroundColor.setSelectObject(detailStyle.getSlotBackgroundColor());
} }
if (rotate != null) { if(rotate != null){
rotate.setSelectedIndex(detailStyle.isAntiClockWise() ? 0 : 1); rotate.setSelectedIndex(detailStyle.isAntiClockWise() ? 0 : 1);
} }
if (innerPaneBackgroundColor != null) { if(innerPaneBackgroundColor != null){
innerPaneBackgroundColor.setSelectObject(detailStyle.getInnerPaneBackgroundColor()); innerPaneBackgroundColor.setSelectObject(detailStyle.getInnerPaneBackgroundColor());
} }
if (thermometerWidth != null) { if(thermometerWidth != null){
thermometerWidth.setValue(detailStyle.getThermometerWidth()); thermometerWidth.setValue(detailStyle.getThermometerWidth());
} }
if (chutePercent != null) { if(chutePercent != null){
chutePercent.populateBean(detailStyle.getChutePercent()); chutePercent.populateBean(detailStyle.getChutePercent());
} }
@ -270,45 +265,50 @@ public class VanChartGaugeSeriesPane extends VanChartAbstractPlotSeriesPane {
@Override @Override
public void updateBean(Plot plot) { public void updateBean(Plot plot) {
if (plot == null) { if(plot == null){
return; return;
} }
super.updateBean(plot); super.updateBean(plot);
if (plot instanceof VanChartGaugePlot) { if(plot instanceof VanChartGaugePlot){
VanChartGaugePlot gaugePlot = (VanChartGaugePlot) plot; VanChartGaugePlot gaugePlot = (VanChartGaugePlot)plot;
GaugeDetailStyle detailStyle = gaugePlot.getGaugeDetailStyle(); GaugeDetailStyle detailStyle = gaugePlot.getGaugeDetailStyle();
detailStyle.setHorizontalLayout(gaugeLayout.getSelectedIndex() == 0); detailStyle.setHorizontalLayout(gaugeLayout.getSelectedIndex() == 0);
if (hingeColor != null) { if(hingeColor != null){
detailStyle.setHingeColor(hingeColor.getSelectObject()); detailStyle.setHingeColor(hingeColor.getSelectObject());
} }
if (hingeBackgroundColor != null) { if(hingeBackgroundColor != null){
detailStyle.setHingeBackgroundColor(hingeBackgroundColor.getSelectObject()); detailStyle.setHingeBackgroundColor(hingeBackgroundColor.getSelectObject());
} }
if (needleColor != null) { if(needleColor != null){
detailStyle.setNeedleColor(needleColor.getSelectObject()); detailStyle.setNeedleColor(needleColor.getSelectObject());
} }
if (paneBackgroundColor != null) { if(paneBackgroundColor != null){
detailStyle.setPaneBackgroundColor(paneBackgroundColor.getSelectObject()); detailStyle.setPaneBackgroundColor(paneBackgroundColor.getSelectObject());
} }
if (slotBackgroundColor != null) { if(slotBackgroundColor != null){
detailStyle.setSlotBackgroundColor(slotBackgroundColor.getSelectObject()); detailStyle.setSlotBackgroundColor(slotBackgroundColor.getSelectObject());
} }
if (rotate != null) { if(rotate != null){
detailStyle.setAntiClockWise(rotate.getSelectedIndex() == 0); detailStyle.setAntiClockWise(rotate.getSelectedIndex() == 0);
} }
if (innerPaneBackgroundColor != null) { if(innerPaneBackgroundColor != null){
detailStyle.setInnerPaneBackgroundColor(innerPaneBackgroundColor.getSelectObject()); detailStyle.setInnerPaneBackgroundColor(innerPaneBackgroundColor.getSelectObject());
} }
if (thermometerWidth != null) { if(thermometerWidth != null){
detailStyle.setThermometerWidth(thermometerWidth.getValue()); detailStyle.setThermometerWidth(thermometerWidth.getValue());
} }
if (chutePercent != null) { if(chutePercent != null){
detailStyle.setChutePercent(chutePercent.updateBean()); detailStyle.setChutePercent(chutePercent.updateBean());
} }
colorPickerPane.updateBean(detailStyle.getHotAreaColor()); colorPickerPane.updateBean(detailStyle.getHotAreaColor());
} }
} }
}
@Override
protected VanChartBeautyPane createStylePane() {
return null;
}
}

3
designer-chart/src/main/java/com/fr/van/chart/map/VanChartMapSeriesPane.java

@ -158,7 +158,7 @@ public class VanChartMapSeriesPane extends VanChartColorValueSeriesPane {
markerTypeCom.setModel(new DefaultComboBoxModel(largeModel ? LARGE_MARKER_TYPES : MARKER_TYPES)); markerTypeCom.setModel(new DefaultComboBoxModel(largeModel ? LARGE_MARKER_TYPES : MARKER_TYPES));
if (ComparatorUtils.equals(MapMarkerType.IMAGE.toLocalString(), selectedItem) && largeModel) { if (ComparatorUtils.equals(MapMarkerType.IMAGE.toLocalString(), selectedItem) && largeModel) {
markerTypeCom.setSelectedItem(MapMarkerType.COMMON.toLocalString()); markerTypeCom.setSelectedItem(MapMarkerType.COMMON.toLocalString());
}else{ } else {
markerTypeCom.setSelectedItem(selectedItem); markerTypeCom.setSelectedItem(selectedItem);
} }
} }
@ -380,6 +380,7 @@ public class VanChartMapSeriesPane extends VanChartColorValueSeriesPane {
} else { } else {
panel = createMapCustomGroupPane(areaPane, pointPane, linePane); panel = createMapCustomGroupPane(areaPane, pointPane, linePane);
} }
panel.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 0));
return panel; return panel;
} }

Loading…
Cancel
Save