Browse Source

CHART-11701 仪表盘百分比设置逻辑优化

feature/big-screen
白岳 5 years ago
parent
commit
4d85a74eca
  1. 167
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/report/MeterPlotReportDataContentPane.java
  2. 210
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/MeterPlotTableDataContentPane.java
  3. 27
      designer-chart/src/main/java/com/fr/van/chart/designer/data/OneDimensionalPlotReportDataContentPane.java
  4. 77
      designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/gauge/VanChartGaugeDetailAxisPane.java

167
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/report/MeterPlotReportDataContentPane.java

@ -6,11 +6,11 @@ import com.fr.chart.chartattr.MeterPlot;
import com.fr.chart.chartdata.MeterReportDefinition;
import com.fr.design.formula.TinyFormulaPane;
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.ChartDataPane;
import com.fr.design.mainframe.chart.gui.data.ChartDataFilterPane;
import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import javax.swing.BorderFactory;
@ -20,19 +20,22 @@ import java.awt.Component;
/**
* 仪表盘 属性表 单元格数据界面
*
* @author kunsnat E-mail:kunsnat@gmail.com
* @version 创建时间2012-12-21 下午02:47:57
*/
public class MeterPlotReportDataContentPane extends AbstractReportDataContentPane {
private static final String CATENAME = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Category_Name");
private static final String NVALUE = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Pointer_Value");
private TinyFormulaPane singCatePane;
private TinyFormulaPane singValuePane;
private ChartDataFilterPane filterPane;
public MeterPlotReportDataContentPane(ChartDataPane parent) {
private static final String CATENAME = Toolkit.i18nText("Fine-Design_Chart_Category_Name");
private static final String NVALUE = Toolkit.i18nText("Fine-Design_Chart_Pointer_Value");
private static final String TARGET_VALUE = Toolkit.i18nText("Fine-Design_Chart_Target_Value");
private TinyFormulaPane singCatePane;
public TinyFormulaPane singValuePane;
private TinyFormulaPane customPane;
private ChartDataFilterPane filterPane;
public MeterPlotReportDataContentPane(ChartDataPane parent) {
// initEveryPane();
//
// List list = new ArrayList();
@ -41,73 +44,97 @@ public class MeterPlotReportDataContentPane extends AbstractReportDataContentPan
// seriesPane.populateBean(list);
//
// seriesPane.noAddUse();
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double[] columnSize = { p, f };
double[] rowSize = { p, p, p};
Component[][] components = new Component[][]{
new Component[]{new UILabel(getCateNameString()), getSingCatePane()},
new Component[]{new UILabel(getNValueString()), singValuePane = new TinyFormulaPane()},
new Component[]{null, null}
};
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components,rowSize,columnSize,24,6);
panel.setBorder(BorderFactory.createEmptyBorder(0,24,0,15));
this.setLayout(new BorderLayout());
this.add(panel, BorderLayout.NORTH);
filterPane = new ChartDataFilterPane(new MeterPlot(), parent);
JPanel pane = TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Data_Filter"),filterPane);
pane.setBorder(getSidesBorder());
filterPane.setBorder(getFilterPaneBorder());
this.add(pane, BorderLayout.CENTER);
}
protected String getCateNameString() {
return CATENAME;
}
protected String getNValueString() {
return NVALUE;
}
public void populateBean(ChartCollection collection) {
TopDefinitionProvider definition = collection.getSelectedChart().getFilterDefinition();
if(definition instanceof MeterReportDefinition) {
MeterReportDefinition meterDefinition = (MeterReportDefinition)definition;
if (meterDefinition.getName() != null) {
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double[] columnSize = {p, f};
double[] rowSize = getRowSize();
Component[][] components = getShowComponents();
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 24, 6);
panel.setBorder(BorderFactory.createEmptyBorder(0, 24, 5, 15));
this.setLayout(new BorderLayout());
this.add(panel, BorderLayout.NORTH);
filterPane = new ChartDataFilterPane(new MeterPlot(), parent);
JPanel pane = TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Data_Filter"), filterPane);
pane.setBorder(getSidesBorder());
filterPane.setBorder(getFilterPaneBorder());
this.add(pane, BorderLayout.CENTER);
}
protected double[] getRowSize() {
double p = TableLayout.PREFERRED;
return new double[]{p, p, p};
}
protected Component[][] getShowComponents() {
return new Component[][]{
new Component[]{new UILabel(getCateNameString()), getSingCatePane()},
new Component[]{new UILabel(getNValueString()), singValuePane = new TinyFormulaPane()},
new Component[]{new UILabel(TARGET_VALUE), customPane = new TinyFormulaPane()}
};
}
protected String getCateNameString() {
return CATENAME;
}
protected String getNValueString() {
return NVALUE;
}
public void populateBean(ChartCollection collection) {
TopDefinitionProvider definition = collection.getSelectedChart().getFilterDefinition();
if (definition instanceof MeterReportDefinition) {
MeterReportDefinition meterDefinition = (MeterReportDefinition) definition;
if (meterDefinition.getName() != null) {
populateSingCatePane(meterDefinition.getName().toString());
}
if (meterDefinition.getValue() != null) {
singValuePane.getUITextField().setText(meterDefinition.getValue().toString());
}
}
filterPane.populateBean(collection);
}
}
if (meterDefinition.getValue() != null) {
singValuePane.getUITextField().setText(meterDefinition.getValue().toString());
}
if (meterDefinition.getTarget() != null) {
populateCustomPane(meterDefinition.getTarget().toString());
}
}
filterPane.populateBean(collection);
}
protected void populateCustomPane(String target) {
customPane.getUITextField().setText(target);
}
protected void populateSingCatePane(String name) {
singCatePane.getUITextField().setText(name);
}
public void updateBean(ChartCollection collection) {
if (collection != null) {
MeterReportDefinition meterDefinition = new MeterReportDefinition();
if (collection != null) {
MeterReportDefinition meterDefinition = new MeterReportDefinition();
updateSingCatePane(meterDefinition);
meterDefinition.setValue(canBeFormula(singValuePane.getUITextField().getText()));
collection.getSelectedChart().setFilterDefinition(meterDefinition);
filterPane.updateBean(collection);
}
}
meterDefinition.setValue(canBeFormula(singValuePane.getUITextField().getText()));
updateCustomPane(meterDefinition);
collection.getSelectedChart().setFilterDefinition(meterDefinition);
filterPane.updateBean(collection);
}
}
protected void updateCustomPane(MeterReportDefinition meterDefinition) {
meterDefinition.setTarget(canBeFormula(customPane.getUITextField().getText()));
}
protected void updateSingCatePane(MeterReportDefinition meterDefinition) {
@ -116,9 +143,9 @@ public class MeterPlotReportDataContentPane extends AbstractReportDataContentPan
}
@Override
protected String[] columnNames() {
return new String[]{"", ""};
}
protected String[] columnNames() {
return new String[]{"", ""};
}
protected Component getSingCatePane() {
return singCatePane = new TinyFormulaPane();

210
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/MeterPlotTableDataContentPane.java

@ -4,117 +4,183 @@ import com.fr.base.Utils;
import com.fr.chart.chartattr.ChartCollection;
import com.fr.chart.chartattr.MeterPlot;
import com.fr.chart.chartdata.MeterTableDefinition;
import com.fr.design.formula.TinyFormulaPane;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.BoldFontTextLabel;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.chart.gui.ChartDataPane;
import com.fr.design.mainframe.chart.gui.data.ChartDataFilterPane;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.extended.chart.StringFormula;
import com.fr.extended.chart.UIComboBoxWithNone;
import com.fr.general.GeneralUtils;
import com.fr.stable.StringUtils;
import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import javax.swing.BorderFactory;
import javax.swing.BoxLayout;
import javax.swing.JPanel;
import java.util.List;
import java.awt.BorderLayout;
import java.awt.Component;
import java.util.List;
import java.awt.Dimension;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
/**
* 仪表盘, 属性表, 数据集数据界面.
*
* @author kunsnat E-mail:kunsnat@gmail.com
* @version 创建时间2012-12-21 下午04:51:50
*/
public class MeterPlotTableDataContentPane extends AbstractTableDataContentPane {
private static final String METER_NAME = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Style_Format_Category_Name");
private static final String METER_VALUE = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Pointer_Value");
private UIComboBox nameBox;
private UIComboBox valueBox;
private ChartDataFilterPane filterPane;
public MeterPlotTableDataContentPane(ChartDataPane parent) {
this.setLayout(new BorderLayout());
nameBox = new UIComboBox();
valueBox = new UIComboBox();
filterPane = new ChartDataFilterPane(new MeterPlot(), parent);
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double[] columnSize = {f, COMPONENT_WIDTH};
double[] rowSize = {p, p};
Component[][] components = createComponents();
JPanel jPanel = TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Data_Filter"),filterPane);
JPanel panel = TableLayoutHelper.createTableLayoutPane(components,rowSize,columnSize);
filterPane.setBorder(BorderFactory.createEmptyBorder(0,10,0,15));
panel.setBorder(BorderFactory.createEmptyBorder(10,24,10,15));
jPanel.setBorder(BorderFactory.createEmptyBorder(0,12,0,5));
this.add(getJSeparator(),BorderLayout.NORTH);
this.add(panel,BorderLayout.CENTER);
this.add(jPanel,BorderLayout.SOUTH);
private static final String METER_NAME = Toolkit.i18nText("Fine-Design_Chart_Style_Format_Category_Name");
private static final String METER_VALUE = Toolkit.i18nText("Fine-Design_Chart_Pointer_Value");
private static final String TARGET_VALUE = Toolkit.i18nText("Fine-Design_Chart_Target_Value");
private static final int COMBOBOX_WIDTH = 115;
private static final int COMBOBOX_HEIGHT = 20;
private static final int LABEL_WIDTH = 85;
private UIComboBox nameBox;
private UIComboBox valueBox;
private UIComboBox targetBox;
private TinyFormulaPane custom;
private ChartDataFilterPane filterPane;
private JPanel boxPane;
public MeterPlotTableDataContentPane(ChartDataPane parent) {
this.setLayout(new BorderLayout());
nameBox = new UIComboBoxWithNone();
valueBox = new UIComboBox();
targetBox = new UIComboBox();
custom = new TinyFormulaPane();
filterPane = new ChartDataFilterPane(new MeterPlot(), parent);
boxPane = new JPanel();
boxPane.setLayout(new BoxLayout(boxPane, BoxLayout.Y_AXIS));
JPanel namePane = createPaneWithLabel(Toolkit.i18nText(METER_NAME), getNameComponent());
boxPane.add(namePane);
JPanel valuePane = createPaneWithLabel(Toolkit.i18nText(METER_VALUE), valueBox);
boxPane.add(valuePane);
JPanel targetPane = createPaneWithLabel(Toolkit.i18nText(TARGET_VALUE), targetBox);
boxPane.add(targetPane);
final JPanel customPane = createPaneWithLabel(StringUtils.EMPTY, custom);
boxPane.add(customPane);
customPane.setVisible(false);
initTargetBoxValue();
targetBox.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
if (targetBox.getSelectedIndex() == targetBox.getItemCount() - 1) {
customPane.setVisible(true);
} else {
customPane.setVisible(false);
}
}
});
JPanel jPanel = TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Data_Filter"), filterPane);
filterPane.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 15));
boxPane.setBorder(BorderFactory.createEmptyBorder(7, 24, 7, 15));
jPanel.setBorder(BorderFactory.createEmptyBorder(0, 12, 0, 5));
this.add(getJSeparator(), BorderLayout.NORTH);
this.add(boxPane, BorderLayout.CENTER);
this.add(jPanel, BorderLayout.SOUTH);
nameBox.addItemListener(tooltipListener);
valueBox.addItemListener(tooltipListener);
}
targetBox.addItemListener(tooltipListener);
}
private Component[][] createComponents() {
return new Component[][]{
new Component[]{new BoldFontTextLabel(METER_NAME), getNameComponent()},
new Component[]{new BoldFontTextLabel(METER_VALUE), valueBox},
};
private JPanel createPaneWithLabel(String labelName, Component component) {
component.setPreferredSize(new Dimension(COMBOBOX_WIDTH, COMBOBOX_HEIGHT));
UILabel label = new BoldFontTextLabel(labelName);
label.setPreferredSize(new Dimension(LABEL_WIDTH, COMBOBOX_HEIGHT));
JPanel paneWithLabel = GUICoreUtils.createBorderLayoutPane(new Component[]{component, null, null, label, null});
paneWithLabel.setBorder(BorderFactory.createEmptyBorder(3, 0, 3, 0));
return paneWithLabel;
}
protected void refreshBoxListWithSelectTableData(List list) {
refreshBoxItems(nameBox, list);
refreshBoxItems(valueBox, list);
}
refreshBoxItems(nameBox, list);
refreshBoxItems(valueBox, list);
refreshBoxItems(targetBox, list);
initTargetBoxValue();
}
/**
* 清空所有的box设置
*/
public void clearAllBoxList(){
public void clearAllBoxList() {
clearBoxItems(nameBox);
clearBoxItems(valueBox);
}
/**
* 更新仪表盘数据界面
*/
public void populateBean(ChartCollection ob) {
if(ob != null && ob.getSelectedChart().getFilterDefinition() instanceof MeterTableDefinition) {
MeterTableDefinition meter = (MeterTableDefinition)ob.getSelectedChart().getFilterDefinition();
private void initTargetBoxValue() {
targetBox.addItem(Toolkit.i18nText("Fine-Design_Chart_Custom"));
targetBox.setSelectedItem(null);
}
/**
* 更新仪表盘数据界面
*/
public void populateBean(ChartCollection ob) {
if (ob != null && ob.getSelectedChart().getFilterDefinition() instanceof MeterTableDefinition) {
MeterTableDefinition meter = (MeterTableDefinition) ob.getSelectedChart().getFilterDefinition();
populateNameComponent(meter);
valueBox.setSelectedItem(meter.getValue());
filterPane.populateBean(ob);
}
}
valueBox.setSelectedItem(meter.getValue());
custom.getUITextField().setText(meter.getCustomTarget().getContent());
if (meter.isCustom()) {
targetBox.setSelectedIndex(targetBox.getItemCount() - 1);
} else {
targetBox.setSelectedItem(meter.getTargetValue());
}
filterPane.populateBean(ob);
}
}
protected void populateNameComponent(MeterTableDefinition meter) {
nameBox.setSelectedItem(meter.getName());
}
/**
* 保存界面属性.
*/
public void updateBean(ChartCollection ob) {
if(ob != null) {
MeterTableDefinition meter = getMeterTableDefinition();
ob.getSelectedChart().setFilterDefinition(meter);
* 保存界面属性.
*/
public void updateBean(ChartCollection ob) {
if (ob != null) {
MeterTableDefinition meter = getMeterTableDefinition();
ob.getSelectedChart().setFilterDefinition(meter);
updateNameComponent(meter);
meter.setValue(Utils.objectToString(valueBox.getSelectedItem()));
filterPane.updateBean(ob);
}
}
meter.setValue(Utils.objectToString(valueBox.getSelectedItem()));
if (targetBox.getSelectedIndex() == targetBox.getItemCount() - 1) {
meter.setCustom(true);
meter.setCustomTarget(new StringFormula(custom.getUITextField().getText()));
} else {
meter.setCustom(false);
meter.setTargetValue(GeneralUtils.objectToString(targetBox.getSelectedItem()));
}
filterPane.updateBean(ob);
}
}
protected MeterTableDefinition getMeterTableDefinition(){
protected MeterTableDefinition getMeterTableDefinition() {
return new MeterTableDefinition();
}
@ -125,9 +191,9 @@ public class MeterPlotTableDataContentPane extends AbstractTableDataContentPane
/**
* 重新布局整个面板
*/
public void redoLayoutPane(){
filterPane.relayoutPane(this.isNeedSummaryCaculateMethod());
}
public void redoLayoutPane() {
filterPane.relayoutPane(this.isNeedSummaryCaculateMethod());
}
protected Component getNameComponent() {

27
designer-chart/src/main/java/com/fr/van/chart/designer/data/OneDimensionalPlotReportDataContentPane.java

@ -1,15 +1,20 @@
package com.fr.van.chart.designer.data;
import com.fr.chart.chartdata.MeterReportDefinition;
import com.fr.design.formula.TinyFormulaPane;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.TableLayout;
import com.fr.design.mainframe.chart.gui.ChartDataPane;
import com.fr.design.mainframe.chart.gui.data.report.MeterPlotReportDataContentPane;
import java.awt.Component;
/**
* Created by Mitisky on 16/10/25.
* 一维 单元格数据配置界面.系列名,.
*/
public class OneDimensionalPlotReportDataContentPane extends MeterPlotReportDataContentPane{
public class OneDimensionalPlotReportDataContentPane extends MeterPlotReportDataContentPane {
public OneDimensionalPlotReportDataContentPane(ChartDataPane parent) {
super(parent);
}
@ -23,4 +28,24 @@ public class OneDimensionalPlotReportDataContentPane extends MeterPlotReportData
protected String getNValueString() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Series_Value");
}
@Override
protected double[] getRowSize() {
double p = TableLayout.PREFERRED;
return new double[]{p, p, p};
}
@Override
protected Component[][] getShowComponents() {
return new Component[][]{
new Component[]{new UILabel(getCateNameString()), getSingCatePane()},
new Component[]{new UILabel(getNValueString()), singValuePane = new TinyFormulaPane()},
};
}
protected void populateCustomPane(String target) {
}
protected void updateCustomPane(MeterReportDefinition meterDefinition) {
}
}

77
designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/gauge/VanChartGaugeDetailAxisPane.java

@ -9,7 +9,6 @@ import com.fr.design.mainframe.chart.PaneTitleConstants;
import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane;
import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPaneWithAuto;
import com.fr.design.style.color.ColorSelectBox;
import com.fr.plugin.chart.attr.axis.VanChartAxis;
import com.fr.plugin.chart.attr.axis.VanChartGaugeAxis;
import com.fr.plugin.chart.gauge.VanChartGaugePlot;
@ -18,7 +17,6 @@ import com.fr.plugin.chart.type.GaugeStyle;
import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import com.fr.van.chart.designer.style.VanChartStylePane;
import com.fr.van.chart.designer.style.axis.VanChartValueAxisPane;
import com.fr.van.chart.designer.style.axis.component.MinMaxValuePaneWithOutTick;
import com.fr.van.chart.designer.style.axis.component.VanChartMinMaxValuePane;
import javax.swing.BorderFactory;
@ -43,19 +41,19 @@ public class VanChartGaugeDetailAxisPane extends VanChartValueAxisPane {
public VanChartGaugeDetailAxisPane() {
}
protected JPanel createContentPane(boolean isXAxis){
if(gaugeStyle == null){
protected JPanel createContentPane(boolean isXAxis) {
if (gaugeStyle == null) {
gaugeStyle = GaugeStyle.POINTER;
}
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double[] columnSize = {f, p};
double[] rowSize = {p,p,p,p,p,p,p,p};
double[] rowSize = {p, p, p, p, p, p, p, p};
return TableLayoutHelper.createTableLayoutPane(getPanelComponents(p, f, columnSize), rowSize, columnSize);
}
private Component[][] getPanelComponents(double p, double f, double[] columnSize) {
switch (gaugeStyle){
switch (gaugeStyle) {
case THERMOMETER:
return new Component[][]{
new Component[]{createLabelPane(new double[]{p, p}, columnSize), null},
@ -80,12 +78,12 @@ public class VanChartGaugeDetailAxisPane extends VanChartValueAxisPane {
}
}
protected JPanel createLabelPane(double[] row, double[] col){
protected JPanel createLabelPane(double[] row, double[] col) {
showLabel = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_Use_Show"), Toolkit.i18nText("Fine-Design_Chart_Hidden")});
labelTextAttrPane = getChartTextAttrPane();
labelPanel = new JPanel(new BorderLayout());
labelPanel.add(labelTextAttrPane);
labelPanel.setBorder(BorderFactory.createEmptyBorder(0,15,0,0));
labelPanel.setBorder(BorderFactory.createEmptyBorder(0, 15, 0, 0));
JPanel panel = new JPanel(new BorderLayout(0, 6));
panel.add(TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Axis_Label"), showLabel), BorderLayout.NORTH);
panel.add(labelPanel, BorderLayout.CENTER);
@ -96,7 +94,7 @@ public class VanChartGaugeDetailAxisPane extends VanChartValueAxisPane {
}
});
JPanel jPanel = TableLayout4VanChartHelper.createExpandablePaneWithTitle(PaneTitleConstants.CHART_STYLE_LABEL_TITLE, panel);
panel.setBorder(BorderFactory.createEmptyBorder(10,10,0,15));
panel.setBorder(BorderFactory.createEmptyBorder(10, 10, 0, 15));
return jPanel;
}
@ -108,11 +106,40 @@ public class VanChartGaugeDetailAxisPane extends VanChartValueAxisPane {
}
}
private JPanel createValueDefinition(){
switch (gaugeStyle){
private JPanel createValueDefinition() {
switch (gaugeStyle) {
case RING:
case SLOT:
minMaxValuePane = new MinMaxValuePaneWithOutTick();
minMaxValuePane = new VanChartMinMaxValuePane() {
@Override
protected double[] getRowSize(double p) {
return new double[]{p};
}
@Override
protected Component[][] getShowComponents(JPanel minPaneWithCheckBox, JPanel maxPaneWithCheckBox, JPanel mainPaneWithCheckBox, JPanel secPaneWithCheckBox) {
return new Component[][]{
{minPaneWithCheckBox},
};
}
};
break;
case THERMOMETER:
minMaxValuePane = new VanChartMinMaxValuePane() {
@Override
protected double[] getRowSize(double p) {
return new double[]{p, p, p};
}
@Override
protected Component[][] getShowComponents(JPanel minPaneWithCheckBox, JPanel maxPaneWithCheckBox, JPanel mainPaneWithCheckBox, JPanel secPaneWithCheckBox) {
return new Component[][]{
{minPaneWithCheckBox},
{mainPaneWithCheckBox},
{secPaneWithCheckBox},
};
}
};
break;
default:
minMaxValuePane = new VanChartMinMaxValuePane();
@ -121,7 +148,7 @@ public class VanChartGaugeDetailAxisPane extends VanChartValueAxisPane {
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Value_Definition"), minMaxValuePane);
}
private JPanel createTickColorPane(double[] row, double[] col){
private JPanel createTickColorPane(double[] row, double[] col) {
mainTickColor = new ColorSelectBox(100);
secTickColor = new ColorSelectBox(100);
Component[][] components = new Component[][]{
@ -130,20 +157,20 @@ public class VanChartGaugeDetailAxisPane extends VanChartValueAxisPane {
};
JPanel panel = TableLayoutHelper.createTableLayoutPane(components, row, col);
JPanel jPanel = TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_TickColor"), panel);
panel.setBorder(BorderFactory.createEmptyBorder(10,10,0,15));
panel.setBorder(BorderFactory.createEmptyBorder(10, 10, 0, 15));
return jPanel;
}
private boolean isMulti(GaugeStyle style){
private boolean isMulti(GaugeStyle style) {
return style == GaugeStyle.POINTER || style == GaugeStyle.POINTER_SEMI;
}
private boolean samePane(GaugeStyle style1, GaugeStyle style2){
private boolean samePane(GaugeStyle style1, GaugeStyle style2) {
return style1 == style2 || (isMulti(style1) && isMulti(style2));
}
public void populateBean(VanChartGaugePlot gaugePlot, VanChartStylePane parent){
if(!samePane(gaugePlot.getGaugeStyle(), gaugeStyle)){
public void populateBean(VanChartGaugePlot gaugePlot, VanChartStylePane parent) {
if (!samePane(gaugePlot.getGaugeStyle(), gaugeStyle)) {
gaugeStyle = gaugePlot.getGaugeStyle();
reLayoutPane(false);
parent.initAllListeners();
@ -151,23 +178,23 @@ public class VanChartGaugeDetailAxisPane extends VanChartValueAxisPane {
populateBean(gaugePlot.getGaugeAxis());
}
public void populateBean(VanChartAxis axis){
VanChartGaugeAxis gaugeAxis = (VanChartGaugeAxis)axis;
if(mainTickColor != null){
public void populateBean(VanChartAxis axis) {
VanChartGaugeAxis gaugeAxis = (VanChartGaugeAxis) axis;
if (mainTickColor != null) {
mainTickColor.setSelectObject(gaugeAxis.getMainTickColor());
}
if(secTickColor != null){
if (secTickColor != null) {
secTickColor.setSelectObject(gaugeAxis.getSecTickColor());
}
super.populateBean(gaugeAxis);
}
public void updateBean(VanChartAxis axis) {
VanChartGaugeAxis gaugeAxis = (VanChartGaugeAxis)axis;
if(mainTickColor != null){
VanChartGaugeAxis gaugeAxis = (VanChartGaugeAxis) axis;
if (mainTickColor != null) {
gaugeAxis.setMainTickColor(mainTickColor.getSelectObject());
}
if(secTickColor != null){
if (secTickColor != null) {
gaugeAxis.setSecTickColor(secTickColor.getSelectObject());
}
super.updateBean(gaugeAxis);

Loading…
Cancel
Save