From e21b50e0e27b52739ccea6257cbbe59c0f9a8ebc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E5=B2=B3?= <445798420@qq.com> Date: Tue, 27 Oct 2020 17:19:56 +0800 Subject: [PATCH] =?UTF-8?q?CHART-16440=20=E7=94=98=E7=89=B9=E5=9B=BE?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E8=BD=B4=E9=9D=A2=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../style/axis/GanttAxisStylePane.java | 38 ++++++++++--- .../axis/GanttAxisStylePaneWithPosition.java | 57 +++++++++++++++++++ .../style/axis/GanttProcessAxisPane.java | 8 +-- 3 files changed, 90 insertions(+), 13 deletions(-) create mode 100644 designer-chart/src/main/java/com/fr/van/chart/gantt/designer/style/axis/GanttAxisStylePaneWithPosition.java diff --git a/designer-chart/src/main/java/com/fr/van/chart/gantt/designer/style/axis/GanttAxisStylePane.java b/designer-chart/src/main/java/com/fr/van/chart/gantt/designer/style/axis/GanttAxisStylePane.java index 51e045edfb..8ff6786bad 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/gantt/designer/style/axis/GanttAxisStylePane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/gantt/designer/style/axis/GanttAxisStylePane.java @@ -23,22 +23,28 @@ public class GanttAxisStylePane extends BasicBeanPane { private ColorSelectBoxWithOutTransparent colorSelectBox4button; private UINumberDragPane transparent; + public ChartTextAttrPane getTextAttrPane() { + return textAttrPane; + } + + public ColorSelectBoxWithOutTransparent getColorSelectBox4button() { + return colorSelectBox4button; + } + + public UINumberDragPane getTransparent() { + return transparent; + } + public GanttAxisStylePane() { - textAttrPane = new ChartTextAttrPane(); - colorSelectBox4button = new ColorSelectBoxWithOutTransparent(100); - transparent = new UINumberDragPane(0, 100); + initComponents(); double p = TableLayout.PREFERRED; double f = TableLayout.FILL; double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; - double[] row = {p,p,p}; + double[] row = {p, p, p, p}; double[] col = {f, e}; - Component[][] components = new Component[][]{ - new Component[]{textAttrPane, null}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Color")), colorSelectBox4button}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Alpha")), transparent} - }; + Component[][] components = getUsedComponents(); JPanel content = TableLayoutHelper.createTableLayoutPane(components, row, col); @@ -46,6 +52,20 @@ public class GanttAxisStylePane extends BasicBeanPane { this.add(content, BorderLayout.CENTER); } + protected void initComponents() { + textAttrPane = new ChartTextAttrPane(); + colorSelectBox4button = new ColorSelectBoxWithOutTransparent(100); + transparent = new UINumberDragPane(0, 100); + } + + protected Component[][] getUsedComponents() { + return new Component[][]{ + new Component[]{textAttrPane, null}, + new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Color")), colorSelectBox4button}, + new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Alpha")), transparent} + }; + } + @Override public void populateBean(GanttAxisStyleAttr contentAttr) { textAttrPane.populate(contentAttr.getTextAttr()); diff --git a/designer-chart/src/main/java/com/fr/van/chart/gantt/designer/style/axis/GanttAxisStylePaneWithPosition.java b/designer-chart/src/main/java/com/fr/van/chart/gantt/designer/style/axis/GanttAxisStylePaneWithPosition.java new file mode 100644 index 0000000000..102b0c2321 --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/gantt/designer/style/axis/GanttAxisStylePaneWithPosition.java @@ -0,0 +1,57 @@ +package com.fr.van.chart.gantt.designer.style.axis; + +import com.fr.base.BaseUtils; +import com.fr.design.gui.ibutton.UIButtonGroup; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.i18n.Toolkit; +import com.fr.plugin.chart.gantt.attr.GanttAxisStyleAttr; +import com.fr.plugin.chart.gantt.attr.GanttAxisStyleAttrWithPosition; +import com.fr.stable.Constants; + +import javax.swing.Icon; +import java.awt.Component; + +/** + * @author Bjorn + * @version 10.0 + * Created by Bjorn on 2020-10-27 + */ +public class GanttAxisStylePaneWithPosition extends GanttAxisStylePane { + + private UIButtonGroup alignmentPane; + + protected void initComponents() { + super.initComponents(); + Icon[] alignmentIconArray = {BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_left_normal.png"), + BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_center_normal.png"), + BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_right_normal.png")}; + Integer[] alignment = new Integer[]{Constants.LEFT, Constants.CENTER, Constants.RIGHT}; + alignmentPane = new UIButtonGroup<>(alignmentIconArray, alignment); + } + + protected Component[][] getUsedComponents() { + return new Component[][]{ + new Component[]{getTextAttrPane(), null}, + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Color")), getColorSelectBox4button()}, + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Report_Alpha")), getTransparent()}, + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Form_BorderLayout_Constraints")), alignmentPane} + }; + } + + public void populateBean(GanttAxisStyleAttrWithPosition contentAttr) { + super.populateBean(contentAttr); + alignmentPane.setSelectedItem(contentAttr.getPosition()); + } + + public void updateBean(GanttAxisStyleAttrWithPosition contentAttr) { + super.updateBean(contentAttr); + contentAttr.setPosition(alignmentPane.getSelectedItem()); + } + + @Override + public GanttAxisStyleAttr updateBean() { + GanttAxisStyleAttrWithPosition styleAttr = new GanttAxisStyleAttrWithPosition(); + updateBean(styleAttr); + return styleAttr; + } +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/gantt/designer/style/axis/GanttProcessAxisPane.java b/designer-chart/src/main/java/com/fr/van/chart/gantt/designer/style/axis/GanttProcessAxisPane.java index c642c3e130..c2461899b5 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/gantt/designer/style/axis/GanttProcessAxisPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/gantt/designer/style/axis/GanttProcessAxisPane.java @@ -27,8 +27,8 @@ public class GanttProcessAxisPane extends AbstractVanChartScrollPane { private UISpinner horizontalProportion; private GanttAxisStylePane horizontalHeaderPane; - private GanttAxisStylePane verticalHeaderPane; - private GanttAxisStylePane bodyPane; + private GanttAxisStylePaneWithPosition verticalHeaderPane; + private GanttAxisStylePaneWithPosition bodyPane; @Override protected JPanel createContentPane() { @@ -54,7 +54,7 @@ public class GanttProcessAxisPane extends AbstractVanChartScrollPane { } private Component createBodyPane() { - bodyPane = new GanttAxisStylePane(); + bodyPane = new GanttAxisStylePaneWithPosition(); return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Content"), bodyPane); } @@ -66,7 +66,7 @@ public class GanttProcessAxisPane extends AbstractVanChartScrollPane { } private Component createVerticalHeaderPane() { - verticalHeaderPane = new GanttAxisStylePane(); + verticalHeaderPane = new GanttAxisStylePaneWithPosition(); return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Vertical_Table"), verticalHeaderPane); }