Browse Source

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

feature/x
方磊 3 years ago
parent
commit
152b2890cc
  1. 97
      designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartGanttTimeLinePane.java
  2. 4
      designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartGuideLinesPane.java
  3. 15
      designer-chart/src/main/java/com/fr/van/chart/designer/style/background/VanChartGantAreaPane.java
  4. 102
      designer-chart/src/main/java/com/fr/van/chart/designer/style/background/VanChartGantPlotAreaBackgroundPane.java
  5. 6
      designer-chart/src/main/java/com/fr/van/chart/gantt/designer/style/VanChartGanttStylePane.java
  6. 15
      designer-chart/src/main/java/com/fr/van/chart/gantt/designer/style/series/VanChartGanttSeriesPane.java

97
designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartGanttTimeLinePane.java

@ -0,0 +1,97 @@
package com.fr.van.chart.designer.component;
import com.fr.chart.chartattr.Plot;
import com.fr.design.gui.frpane.UINumberDragPaneWithPercent;
import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.TableLayout;
import com.fr.design.mainframe.chart.gui.ColorSelectBoxWithOutTransparent;
import com.fr.plugin.chart.gantt.VanChartGanttPlot;
import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
public class VanChartGanttTimeLinePane extends JPanel {
private UIButtonGroup<String> switchButton;
private ColorSelectBoxWithOutTransparent colorSelect;
private UINumberDragPaneWithPercent opacity;
public VanChartGanttTimeLinePane() {
this.setLayout(new BorderLayout());
this.add(createSwitchButtonPane(), BorderLayout.NORTH);
this.add(createCenterPane(), BorderLayout.CENTER);
}
private JPanel createSwitchButtonPane() {
double[] columnSize = {TableLayout.PREFERRED, TableLayout.FILL};
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);
UILabel text = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Guide_Line_Current_Line"), SwingConstants.LEFT);
return TableLayout4VanChartHelper.createGapTableLayoutPane(new Component[][] {
new Component[]{null, null},
new Component[] {text, switchButton}
}, rowSize, columnSize);
}
private JPanel createCenterPane() {
double[] columnSize = {TableLayout.FILL, TableLayout4VanChartHelper.EDIT_AREA_WIDTH};
double[] rowSize = {TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED};
colorSelect = new ColorSelectBoxWithOutTransparent(100);
opacity = new UINumberDragPaneWithPercent(0, 100);
return 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);
}
public void populateBean(Plot plot) {
if (plot instanceof VanChartGanttPlot) {
VanChartGanttPlot ganttPlot = (VanChartGanttPlot) plot;
setShowTimeLine(ganttPlot.isShowTimeLine());
setTimeLineColor(ganttPlot.getTimeLineColor());
setTimeLineOpacity(ganttPlot.getTimeLineOpacity());
}
}
public void updateBean(Plot plot) {
if (plot instanceof VanChartGanttPlot) {
VanChartGanttPlot ganttPlot = (VanChartGanttPlot) plot;
ganttPlot.setShowTimeLine(isShowTimeLine());
ganttPlot.setTimeLineColor(getTimeLineColor());
ganttPlot.setTimeLineOpacity(getTimeLineOpacity());
}
}
public boolean isShowTimeLine() {
return switchButton.getSelectedIndex() == 1;
}
public void setShowTimeLine(boolean showTimeLine) {
switchButton.setSelectedIndex(showTimeLine ? 1 : 0);
}
public Color getTimeLineColor() {
return colorSelect.getSelectObject();
}
public void setTimeLineColor(Color timeLineColor) {
colorSelect.setSelectObject(timeLineColor);
}
public double getTimeLineOpacity() {
return opacity.updateBean();
}
public void setTimeLineOpacity(double timeLineOpacity) {
opacity.populateBean(timeLineOpacity);
}
}

4
designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartGuideLinesPane.java

@ -1,4 +0,0 @@
package com.fr.van.chart.designer.component;
public class VanChartGuideLinesPane {
}

15
designer-chart/src/main/java/com/fr/van/chart/designer/style/background/VanChartGantAreaPane.java

@ -0,0 +1,15 @@
package com.fr.van.chart.designer.style.background;
import com.fr.chart.chartattr.Plot;
import com.fr.design.gui.frpane.AbstractAttrNoScrollPane;
import com.fr.van.chart.designer.style.VanChartStylePane;
public class VanChartGantAreaPane extends VanChartAreaPane {
public VanChartGantAreaPane(Plot plot, VanChartStylePane parent) {
super(plot, parent);
}
protected void initPlotPane(boolean b, AbstractAttrNoScrollPane parent) {
plotPane = new VanChartGantPlotAreaBackgroundPane(parent);
}
}

102
designer-chart/src/main/java/com/fr/van/chart/designer/style/background/VanChartGantPlotAreaBackgroundPane.java

@ -0,0 +1,102 @@
package com.fr.van.chart.designer.style.background;
import com.fr.chart.chartattr.Chart;
import com.fr.chart.chartattr.Plot;
import com.fr.design.gui.frpane.AbstractAttrNoScrollPane;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.chart.gui.ColorSelectBoxWithOutTransparent;
import com.fr.plugin.chart.gantt.VanChartGanttPlot;
import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Component;
public class VanChartGantPlotAreaBackgroundPane extends VanChartAreaBackgroundPane {
private ColorSelectBoxWithOutTransparent axisColorPane;
private ColorSelectBoxWithOutTransparent contentColorPane;
public VanChartGantPlotAreaBackgroundPane(AbstractAttrNoScrollPane parent) {
super(true, parent);
}
@Override
protected JPanel createContentPane() {
JPanel contentPane = new JPanel(new BorderLayout());
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double[] columnSize = {f};
double[] rowSize = {p, p};
Component[][] components = new Component[][]{
new Component[]{createAxisBorderPane()},
new Component[]{createContentBorderPane()}
};
contentPane.add(TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize), BorderLayout.CENTER);
return contentPane;
}
@Override
public void updateBean(Chart chart) {
if (chart == null) {
chart = new Chart();
}
Plot plot = chart.getPlot();
if (plot instanceof VanChartGanttPlot) {
VanChartGanttPlot ganttPlot = (VanChartGanttPlot) plot;
ganttPlot.setAxisBorderColor(axisColorPane.getSelectObject());
ganttPlot.setContentBorderColor(contentColorPane.getSelectObject());
}
}
@Override
public void populateBean(Chart chart) {
if (chart == null) {
chart = new Chart();
}
Plot plot = chart.getPlot();
if (plot instanceof VanChartGanttPlot) {
VanChartGanttPlot ganttPlot = (VanChartGanttPlot) plot;
axisColorPane.setSelectObject(ganttPlot.getAxisBorderColor());
contentColorPane.setSelectObject(ganttPlot.getContentBorderColor());
}
}
private JPanel createAxisBorderPane() {
axisColorPane = new ColorSelectBoxWithOutTransparent(100);
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(
Toolkit.i18nText("Fine-Design_Chart_Gant_Axis_Border"),
createBorderPane(axisColorPane)
);
}
private JPanel createContentBorderPane() {
contentColorPane = new ColorSelectBoxWithOutTransparent(100);
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(
Toolkit.i18nText("Fine-Design_Chart_Gant_Content_Border"),
createBorderPane(contentColorPane)
);
}
private JPanel createBorderPane(ColorSelectBoxWithOutTransparent colorPane) {
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double[] columnSize = {f, TableLayout4VanChartHelper.EDIT_AREA_WIDTH};
double[] rowSize = {p, p};
Component[][] components = new Component[][]{
new Component[]{null, null},
new Component[]{
new UILabel(Toolkit.i18nText("Fine-Design_Chart_Color")),
colorPane
}
};
return TableLayout4VanChartHelper.createGapTableLayoutPane(components, rowSize, columnSize);
}
}

6
designer-chart/src/main/java/com/fr/van/chart/gantt/designer/style/VanChartGanttStylePane.java

@ -4,6 +4,8 @@ import com.fr.chart.chartattr.Plot;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.frpane.AttributeChangeListener; import com.fr.design.gui.frpane.AttributeChangeListener;
import com.fr.van.chart.designer.style.VanChartStylePane; import com.fr.van.chart.designer.style.VanChartStylePane;
import com.fr.van.chart.designer.style.background.VanChartAreaPane;
import com.fr.van.chart.designer.style.background.VanChartGantAreaPane;
import com.fr.van.chart.gantt.designer.style.axis.GanttProcessAxisPane; import com.fr.van.chart.gantt.designer.style.axis.GanttProcessAxisPane;
import com.fr.van.chart.gantt.designer.style.axis.GanttTimeAxisPane; import com.fr.van.chart.gantt.designer.style.axis.GanttTimeAxisPane;
@ -31,4 +33,8 @@ public class VanChartGanttStylePane extends VanChartStylePane {
private void addProjectAxisPane(List<BasicPane> paneList, Plot plot) { private void addProjectAxisPane(List<BasicPane> paneList, Plot plot) {
paneList.add(new GanttProcessAxisPane()); paneList.add(new GanttProcessAxisPane());
} }
protected VanChartAreaPane createVanChartAreaPane() {
return new VanChartGantAreaPane(getChart().getPlot(), VanChartGanttStylePane.this);
}
} }

15
designer-chart/src/main/java/com/fr/van/chart/gantt/designer/style/series/VanChartGanttSeriesPane.java

@ -5,6 +5,7 @@ import com.fr.design.beans.BasicBeanPane;
import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.icombobox.LineComboBox; import com.fr.design.gui.icombobox.LineComboBox;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.chart.gui.ChartStylePane; import com.fr.design.mainframe.chart.gui.ChartStylePane;
@ -14,6 +15,7 @@ import com.fr.plugin.chart.gantt.VanChartGanttPlot;
import com.fr.stable.CoreConstants; import com.fr.stable.CoreConstants;
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.component.VanChartBeautyPane;
import com.fr.van.chart.designer.component.VanChartGanttTimeLinePane;
import com.fr.van.chart.designer.component.VanChartMarkerPane; import com.fr.van.chart.designer.component.VanChartMarkerPane;
import com.fr.van.chart.designer.component.marker.VanChartCommonMarkerPane; import com.fr.van.chart.designer.component.marker.VanChartCommonMarkerPane;
import com.fr.van.chart.designer.style.series.VanChartAbstractPlotSeriesPane; import com.fr.van.chart.designer.style.series.VanChartAbstractPlotSeriesPane;
@ -30,6 +32,8 @@ public class VanChartGanttSeriesPane extends VanChartAbstractPlotSeriesPane {
private LineComboBox lineWidth;//线型 private LineComboBox lineWidth;//线型
private ColorSelectBoxWithOutTransparent colorSelect;//颜色 private ColorSelectBoxWithOutTransparent colorSelect;//颜色
private VanChartGanttTimeLinePane timeLinePane;
public VanChartGanttSeriesPane(ChartStylePane parent, Plot plot) { public VanChartGanttSeriesPane(ChartStylePane parent, Plot plot) {
super(parent, plot); super(parent, plot);
} }
@ -45,7 +49,8 @@ public class VanChartGanttSeriesPane extends VanChartAbstractPlotSeriesPane {
new Component[]{createGanntStylePane()}, new Component[]{createGanntStylePane()},
new Component[]{createLinkLinePane()}, new Component[]{createLinkLinePane()},
new Component[]{createMarkerPane()}, new Component[]{createMarkerPane()},
new Component[]{createLargeDataModelPane()} new Component[]{createLargeDataModelPane()},
new Component[]{createGuideLinePane()}
}; };
contentPane = TableLayoutHelper.createTableLayoutPane(components, row, col); contentPane = TableLayoutHelper.createTableLayoutPane(components, row, col);
@ -96,6 +101,11 @@ public class VanChartGanttSeriesPane extends VanChartAbstractPlotSeriesPane {
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Gannt_Marker"), markerPane); return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Gannt_Marker"), markerPane);
} }
protected JPanel createGuideLinePane() {
timeLinePane = new VanChartGanttTimeLinePane();
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Guide_Line_Identify"), timeLinePane);
}
@Override @Override
public void populateBean(Plot plot) { public void populateBean(Plot plot) {
super.populateBean(plot); super.populateBean(plot);
@ -104,10 +114,10 @@ public class VanChartGanttSeriesPane extends VanChartAbstractPlotSeriesPane {
VanChartGanttPlot ganttPlot = (VanChartGanttPlot)plot; VanChartGanttPlot ganttPlot = (VanChartGanttPlot)plot;
seriesNewLine.setSelectedIndex(ganttPlot.isSeriesNewLineEnable() ? 0 : 1); seriesNewLine.setSelectedIndex(ganttPlot.isSeriesNewLineEnable() ? 0 : 1);
lineWidth.setSelectedLineStyle(ganttPlot.getLineWidth()); lineWidth.setSelectedLineStyle(ganttPlot.getLineWidth());
colorSelect.setSelectObject(ganttPlot.getLineColor()); colorSelect.setSelectObject(ganttPlot.getLineColor());
timeLinePane.populateBean(plot);
} }
} }
@ -121,6 +131,7 @@ public class VanChartGanttSeriesPane extends VanChartAbstractPlotSeriesPane {
ganttPlot.setLineWidth(lineWidth.getSelectedLineStyle()); ganttPlot.setLineWidth(lineWidth.getSelectedLineStyle());
ganttPlot.setLineColor(colorSelect.getSelectObject()); ganttPlot.setLineColor(colorSelect.getSelectObject());
timeLinePane.updateBean(plot);
} }
} }

Loading…
Cancel
Save