From a012c7f67697155ee506f924cd31d53feae13872 Mon Sep 17 00:00:00 2001 From: "Qinghui.Liu" Date: Wed, 30 Sep 2020 11:39:48 +0800 Subject: [PATCH] =?UTF-8?q?CHART-15942=20=E6=A0=87=E7=AD=BE=E8=BE=B9?= =?UTF-8?q?=E6=A1=86=E7=BA=BF=E5=BD=A2=E9=80=89=E6=8B=A9=E4=B8=BA=E6=97=A0?= =?UTF-8?q?=E6=97=B6=EF=BC=8C=E5=85=B6=E4=BD=99=E9=9D=A2=E6=9D=BF=E9=9A=90?= =?UTF-8?q?=E8=97=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../border/VanChartBorderWithShapePane.java | 125 ++++++++++++++---- 1 file changed, 100 insertions(+), 25 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/border/VanChartBorderWithShapePane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/border/VanChartBorderWithShapePane.java index 5361495872..8ee10d0e7e 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/border/VanChartBorderWithShapePane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/border/VanChartBorderWithShapePane.java @@ -1,58 +1,133 @@ package com.fr.van.chart.designer.component.border; -import com.fr.chart.base.AttrBorder; import com.fr.chart.chartglyph.Marker; import com.fr.chart.chartglyph.MarkerFactory; +import com.fr.design.dialog.BasicPane; +import com.fr.design.gui.icombobox.LineComboBox; import com.fr.design.gui.ilable.UILabel; +import com.fr.design.gui.ispinner.UISpinner; import com.fr.design.gui.xcombox.MarkerComboBox; import com.fr.design.i18n.Toolkit; import com.fr.design.layout.TableLayout; +import com.fr.design.style.color.ColorSelectBox; import com.fr.design.utils.gui.UIComponentUtils; import com.fr.design.widget.FRWidgetFactory; import com.fr.plugin.chart.base.AttrBorderWithShape; import com.fr.plugin.chart.marker.type.MarkerType; +import com.fr.stable.Constants; +import com.fr.stable.CoreConstants; +import com.fr.van.chart.designer.TableLayout4VanChartHelper; +import javax.swing.JPanel; +import java.awt.BorderLayout; import java.awt.Component; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; -public class VanChartBorderWithShapePane extends VanChartBorderWithRadiusPane { +public class VanChartBorderWithShapePane extends BasicPane { - private MarkerComboBox shapePane; + private LineComboBox lineTypeBox; + private ColorSelectBox lineColorBox; + private MarkerComboBox borderShape; + private UISpinner borderRadius; - protected void initComponents() { - shapePane = new MarkerComboBox(MarkerFactory.getLabelShapeMarkers()); - super.initComponents(); + private JPanel detailPane; + + public VanChartBorderWithShapePane() { + initComponents(); + createBorderPane(); + } + + private void initComponents() { + lineTypeBox = new LineComboBox(CoreConstants.STRIKE_LINE_STYLE_ARRAY_4_CHART); + lineColorBox = new ColorSelectBox(100); + borderShape = new MarkerComboBox(MarkerFactory.getLabelShapeMarkers()); + borderRadius = new UISpinner(0, 1000, 1, 0); + } + + private void createBorderPane() { + this.setLayout(new BorderLayout()); + + detailPane = createDetailPane(); + + this.add(createLineTypePane(), BorderLayout.CENTER); + this.add(detailPane, BorderLayout.SOUTH); + + initLineTypeListener(); } - protected Component[][] getUseComponent() { - return new Component[][]{ + private void initLineTypeListener() { + lineTypeBox.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + checkDetailPane(); + } + }); + } + + private void checkDetailPane() { + detailPane.setVisible(lineTypeBox.getSelectedLineStyle() != Constants.LINE_NONE); + } + + private JPanel createLineTypePane() { + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; + + double[] columnSize = {f, e}; + double[] rowSize = {p, p}; + + Component[][] components = new Component[][]{ new Component[]{null, null}, new Component[]{FRWidgetFactory.createLineWrapLabel(Toolkit.i18nText("Fine-Design_Chart_Line_Style")), - UIComponentUtils.wrapWithBorderLayoutPane(currentLineCombo)}, - new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Color")), currentLineColorPane}, - new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Shape")), - UIComponentUtils.wrapWithBorderLayoutPane(shapePane)}, - new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Report_Radius")), getRadius()} - }; + UIComponentUtils.wrapWithBorderLayoutPane(lineTypeBox)}}; + + return TableLayout4VanChartHelper.createGapTableLayoutPane(components, rowSize, columnSize); } - protected double[] getRowSize() { + private JPanel createDetailPane() { double p = TableLayout.PREFERRED; - return new double[]{p, p, p, p, p}; + double f = TableLayout.FILL; + double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; + + double[] columnSize = {f, e}; + double[] rowSize = {p, p, p, p}; + + Component[][] components = new Component[][]{ + new Component[]{null, null}, + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Color")), lineColorBox}, + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Shape")), + UIComponentUtils.wrapWithBorderLayoutPane(borderShape)}, + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Report_Radius")), borderRadius} + }; + + return TableLayout4VanChartHelper.createGapTableLayoutPane(components, rowSize, columnSize); } - public void populate(AttrBorder border) { - super.populate(border); + protected String title4PopupWindow() { + return null; + } - if (border instanceof AttrBorderWithShape) { - shapePane.setSelectedMarker((Marker.createMarker(((AttrBorderWithShape) border).getShape()))); + public void populate(AttrBorderWithShape border) { + if (border == null) { + return; } - } - public void update(AttrBorder border) { - super.update(border); + lineTypeBox.setSelectedLineStyle(border.getBorderStyle()); + lineColorBox.setSelectObject(border.getBorderColor()); + borderShape.setSelectedMarker((Marker.createMarker(border.getShape()))); + borderRadius.setValue(border.getRoundRadius()); - if (border instanceof AttrBorderWithShape) { - ((AttrBorderWithShape) border).setShape(MarkerType.parse(shapePane.getSelectedMarkder().getMarkerType())); + checkDetailPane(); + } + + public void update(AttrBorderWithShape border) { + if (border == null) { + return; } + + border.setBorderStyle(lineTypeBox.getSelectedLineStyle()); + border.setBorderColor(lineColorBox.getSelectObject()); + border.setShape(MarkerType.parse(borderShape.getSelectedMarkder().getMarkerType())); + border.setRoundRadius((int) borderRadius.getValue()); } }