Browse Source

CHART-22247 甘特图边框/显示当前时间标识线优化

feature/x
方磊 3 years ago
parent
commit
bfa6ddb342
  1. 22
      designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartGanttTimeLinePane.java

22
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.JPanel;
import javax.swing.SwingConstants; import javax.swing.SwingConstants;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Color; import java.awt.Color;
import java.awt.Component; import java.awt.Component;
@ -21,6 +23,8 @@ public class VanChartGanttTimeLinePane extends JPanel {
private ColorSelectBoxWithOutTransparent colorSelect; private ColorSelectBoxWithOutTransparent colorSelect;
private UINumberDragPaneWithPercent opacity; private UINumberDragPaneWithPercent opacity;
private JPanel centerPane;
public VanChartGanttTimeLinePane() { public VanChartGanttTimeLinePane() {
this.setLayout(new BorderLayout()); this.setLayout(new BorderLayout());
this.add(createSwitchButtonPane(), BorderLayout.NORTH); this.add(createSwitchButtonPane(), BorderLayout.NORTH);
@ -32,6 +36,12 @@ public class VanChartGanttTimeLinePane extends JPanel {
double[] rowSize = {TableLayout.PREFERRED, TableLayout.PREFERRED}; 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")}; 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 = 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); UILabel text = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Guide_Line_Current_Line"), SwingConstants.LEFT);
return TableLayout4VanChartHelper.createGapTableLayoutPane(new Component[][] { return TableLayout4VanChartHelper.createGapTableLayoutPane(new Component[][] {
new Component[]{null, null}, new Component[]{null, null},
@ -46,11 +56,15 @@ public class VanChartGanttTimeLinePane extends JPanel {
colorSelect = new ColorSelectBoxWithOutTransparent(100); colorSelect = new ColorSelectBoxWithOutTransparent(100);
opacity = new UINumberDragPaneWithPercent(0, 100); opacity = new UINumberDragPaneWithPercent(0, 100);
return TableLayout4VanChartHelper.createGapTableLayoutPane(new Component[][] { centerPane = TableLayout4VanChartHelper.createGapTableLayoutPane(new Component[][] {
new Component[]{null, null}, new Component[]{null, null},
new Component[] {new UILabel(Toolkit.i18nText("Fine-Design_Chart_Color")), colorSelect}, new Component[] {new UILabel(Toolkit.i18nText("Fine-Design_Chart_Color")), colorSelect},
new Component[] {new UILabel(Toolkit.i18nText("Fine-Design_Report_Alpha")), opacity} new Component[] {new UILabel(Toolkit.i18nText("Fine-Design_Report_Alpha")), opacity}
}, rowSize, columnSize); }, rowSize, columnSize);
centerPane.setVisible(false);
return centerPane;
} }
public void populateBean(Plot plot) { public void populateBean(Plot plot) {
@ -59,6 +73,8 @@ public class VanChartGanttTimeLinePane extends JPanel {
setShowTimeLine(ganttPlot.isShowTimeLine()); setShowTimeLine(ganttPlot.isShowTimeLine());
setTimeLineColor(ganttPlot.getTimeLineColor()); setTimeLineColor(ganttPlot.getTimeLineColor());
setTimeLineOpacity(ganttPlot.getTimeLineOpacity()); 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() { public boolean isShowTimeLine() {
return switchButton.getSelectedIndex() == 1; return switchButton.getSelectedIndex() == 1;
} }

Loading…
Cancel
Save