diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartGanttTimeLinePane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartGanttTimeLinePane.java index f6fb41edb..0af3a24b1 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartGanttTimeLinePane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartGanttTimeLinePane.java @@ -12,6 +12,8 @@ import com.fr.van.chart.designer.TableLayout4VanChartHelper; import javax.swing.JPanel; import javax.swing.SwingConstants; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Component; @@ -21,6 +23,8 @@ public class VanChartGanttTimeLinePane extends JPanel { private ColorSelectBoxWithOutTransparent colorSelect; private UINumberDragPaneWithPercent opacity; + private JPanel centerPane; + public VanChartGanttTimeLinePane() { this.setLayout(new BorderLayout()); this.add(createSwitchButtonPane(), BorderLayout.NORTH); @@ -32,6 +36,12 @@ public class VanChartGanttTimeLinePane extends JPanel { double[] rowSize = {TableLayout.PREFERRED, TableLayout.PREFERRED}; String[] array = new String[]{Toolkit.i18nText("Fine-Design_Chart_Guide_Line_Not_Show"), Toolkit.i18nText("Fine-Design_Chart_Guide_Line_Show")}; switchButton = new UIButtonGroup<>(array); + switchButton.addChangeListener(new ChangeListener() { + @Override + public void stateChanged(ChangeEvent e) { + setCenterPaneVisibility(); + } + }); UILabel text = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Guide_Line_Current_Line"), SwingConstants.LEFT); return TableLayout4VanChartHelper.createGapTableLayoutPane(new Component[][] { new Component[]{null, null}, @@ -46,11 +56,15 @@ public class VanChartGanttTimeLinePane extends JPanel { colorSelect = new ColorSelectBoxWithOutTransparent(100); opacity = new UINumberDragPaneWithPercent(0, 100); - return TableLayout4VanChartHelper.createGapTableLayoutPane(new Component[][] { + centerPane = TableLayout4VanChartHelper.createGapTableLayoutPane(new Component[][] { new Component[]{null, null}, new Component[] {new UILabel(Toolkit.i18nText("Fine-Design_Chart_Color")), colorSelect}, new Component[] {new UILabel(Toolkit.i18nText("Fine-Design_Report_Alpha")), opacity} }, rowSize, columnSize); + + centerPane.setVisible(false); + + return centerPane; } public void populateBean(Plot plot) { @@ -59,6 +73,8 @@ public class VanChartGanttTimeLinePane extends JPanel { setShowTimeLine(ganttPlot.isShowTimeLine()); setTimeLineColor(ganttPlot.getTimeLineColor()); setTimeLineOpacity(ganttPlot.getTimeLineOpacity()); + + centerPane.setVisible(ganttPlot.isShowTimeLine()); } } @@ -71,6 +87,10 @@ public class VanChartGanttTimeLinePane extends JPanel { } } + private void setCenterPaneVisibility() { + centerPane.setVisible(switchButton.getSelectedIndex() == 1); + } + public boolean isShowTimeLine() { return switchButton.getSelectedIndex() == 1; }