Browse Source
Merge in DESIGN/design from ~FANGLEI/design:feature/x to feature/x * commit '152b2890ccb3aab8efdeeb7a1c47c4b3bca60bde': CHART-22247 甘特图边框/显示当前时间标识线优化feature/x
fanglei
3 years ago
6 changed files with 233 additions and 6 deletions
@ -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); |
||||||
|
} |
||||||
|
} |
@ -1,4 +0,0 @@ |
|||||||
package com.fr.van.chart.designer.component; |
|
||||||
|
|
||||||
public class VanChartGuideLinesPane { |
|
||||||
} |
|
@ -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); |
||||||
|
} |
||||||
|
} |
@ -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); |
||||||
|
} |
||||||
|
} |
Loading…
Reference in new issue