Browse Source

CHART-12733 轴标签缩略间隔显示 回退

research/11.0
shine 5 years ago
parent
commit
ac96f72254
  1. 110
      designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartBaseAxisPane.java

110
designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartBaseAxisPane.java

@ -13,6 +13,7 @@ import com.fr.design.gui.ibutton.UIToggleButton;
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.gui.ispinner.UISpinner; import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.gui.style.FormatPane; import com.fr.design.gui.style.FormatPane;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
@ -63,9 +64,13 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane<VanChartAxis> {
protected ChartTextAttrPane labelTextAttrPane; protected ChartTextAttrPane labelTextAttrPane;
protected UINumberDragPane labelTextRotation; protected UINumberDragPane labelTextRotation;
//轴标签缩略间隔显示 恢复用注释。下面6行删除。
protected UITextField labelGapValue;
private UIButtonGroup<OverlapHandleType> overlapHandleTypeGroup; private UIButtonGroup<OverlapHandleType> overlapHandleTypeGroup;
protected UIButtonGroup<Integer> labelGapStyle; protected UIButtonGroup<Integer> labelGapStyle;
protected UISpinner labelGapValue; //轴标签缩略间隔显示 恢复用注释。取消注释。
//protected UISpinner labelGapValue;
protected JPanel labelPanel; protected JPanel labelPanel;
private JPanel labelGapStylePane; private JPanel labelGapStylePane;
@ -176,22 +181,32 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane<VanChartAxis> {
} }
protected JPanel createLabelPane(double[] row, double[] col){ protected JPanel createLabelPane(double[] row, double[] col){
double p = TableLayout.PREFERRED;
showLabel = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Use_Show"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Hidden")}); showLabel = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Use_Show"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Hidden")});
labelTextAttrPane = getChartTextAttrPane(); labelTextAttrPane = getChartTextAttrPane();
JPanel rotationPane = createLabelRotationPane(col); labelTextRotation = new UINumberDragPane(-ROTATION_MAX, ROTATION_MAX);
JPanel overlapPane = createLabelOverlapPane(); labelGapStyle = new UIButtonGroup<Integer>(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Automatic"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Fixed")});
labelGapValue = new UITextField();
Component[][] gapComponents = new Component[][]{
new Component[]{
FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_TextRotation")),
UIComponentUtils.wrapWithBorderLayoutPane(labelTextRotation)
},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Label_Interval")), labelGapStyle},
};
JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(gapComponents, row, col);
labelGapValuePane = TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText(""), labelGapValue, TableLayout4VanChartHelper.SECOND_EDIT_AREA_WIDTH);
JPanel gapPanel = new JPanel(new BorderLayout());
gapPanel.add(panel, BorderLayout.CENTER);
gapPanel.add(labelGapValuePane, BorderLayout.SOUTH);
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{labelTextAttrPane, null}, new Component[]{labelTextAttrPane, null},
new Component[]{rotationPane, null}, new Component[]{gapPanel, null},
new Component[]{overlapPane, null},
}; };
JPanel showLabelPane = TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Axis_Label"),showLabel); JPanel showLabelPane = TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Axis_Label"),showLabel);
labelPanel = TableLayout4VanChartHelper.createGapTableLayoutPane(components, new double[]{p, p, p}, col); labelPanel = TableLayout4VanChartHelper.createGapTableLayoutPane(components, row, col);
labelPanel.setBorder(BorderFactory.createEmptyBorder(0,10,0,0)); labelPanel.setBorder(BorderFactory.createEmptyBorder(0,10,0,0));
showLabel.addActionListener(new ActionListener() { showLabel.addActionListener(new ActionListener() {
@Override @Override
@ -199,12 +214,48 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane<VanChartAxis> {
checkLabelPane(); checkLabelPane();
} }
}); });
labelGapStyle.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
checkLabelGapValuePane();
}
});
JPanel jPanel = new JPanel(new BorderLayout()); JPanel jPanel = new JPanel(new BorderLayout());
jPanel.add(showLabelPane, BorderLayout.NORTH); jPanel.add(showLabelPane, BorderLayout.NORTH);
jPanel.add(labelPanel, BorderLayout.CENTER); jPanel.add(labelPanel, BorderLayout.CENTER);
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(PaneTitleConstants.CHART_STYLE_LABEL_TITLE, jPanel); return TableLayout4VanChartHelper.createExpandablePaneWithTitle(PaneTitleConstants.CHART_STYLE_LABEL_TITLE, jPanel);
} }
// protected JPanel createLabelPane(double[] row, double[] col){
// double p = TableLayout.PREFERRED;
// showLabel = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Use_Show"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Hidden")});
// labelTextAttrPane = getChartTextAttrPane();
//
// JPanel rotationPane = createLabelRotationPane(col);
// JPanel overlapPane = createLabelOverlapPane();
//
//
// Component[][] components = new Component[][]{
// new Component[]{labelTextAttrPane, null},
// new Component[]{rotationPane, null},
// new Component[]{overlapPane, null},
// };
//
// JPanel showLabelPane = TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Axis_Label"),showLabel);
// labelPanel = TableLayout4VanChartHelper.createGapTableLayoutPane(components, new double[]{p, p, p}, col);
// labelPanel.setBorder(BorderFactory.createEmptyBorder(0,10,0,0));
// showLabel.addActionListener(new ActionListener() {
// @Override
// public void actionPerformed(ActionEvent e) {
// checkLabelPane();
// }
// });
// JPanel jPanel = new JPanel(new BorderLayout());
// jPanel.add(showLabelPane, BorderLayout.NORTH);
// jPanel.add(labelPanel, BorderLayout.CENTER);
// return TableLayout4VanChartHelper.createExpandablePaneWithTitle(PaneTitleConstants.CHART_STYLE_LABEL_TITLE, jPanel);
// }
private JPanel createLabelRotationPane(double[] col) { private JPanel createLabelRotationPane(double[] col) {
labelTextRotation = new UINumberDragPane(-ROTATION_MAX, ROTATION_MAX); labelTextRotation = new UINumberDragPane(-ROTATION_MAX, ROTATION_MAX);
@ -222,7 +273,8 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane<VanChartAxis> {
labelGapStyle = new UIButtonGroup<Integer>(new String[]{Toolkit.i18nText("Fine-Design_Chart_Automatic"), Toolkit.i18nText("Fine-Design_Chart_Fixed")}); labelGapStyle = new UIButtonGroup<Integer>(new String[]{Toolkit.i18nText("Fine-Design_Chart_Automatic"), Toolkit.i18nText("Fine-Design_Chart_Fixed")});
labelGapStylePane = TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Label_Interval"), labelGapStyle, TableLayout4VanChartHelper.SECOND_EDIT_AREA_WIDTH); labelGapStylePane = TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Label_Interval"), labelGapStyle, TableLayout4VanChartHelper.SECOND_EDIT_AREA_WIDTH);
labelGapValue = new UISpinner(0, Integer.MAX_VALUE, 1, 1); //轴标签缩略间隔显示 恢复用注释。取消注释。
//labelGapValue = new UISpinner(0, Integer.MAX_VALUE, 1, 1);
labelGapValuePane = TableLayout4VanChartHelper.createGapTableLayoutPane(StringUtils.EMPTY, labelGapValue, TableLayout4VanChartHelper.SECOND_EDIT_AREA_WIDTH); labelGapValuePane = TableLayout4VanChartHelper.createGapTableLayoutPane(StringUtils.EMPTY, labelGapValue, TableLayout4VanChartHelper.SECOND_EDIT_AREA_WIDTH);
JPanel panel = new JPanel(new BorderLayout(0, 0)); JPanel panel = new JPanel(new BorderLayout(0, 0));
@ -445,7 +497,10 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane<VanChartAxis> {
labelPanel.setVisible(enabled); labelPanel.setVisible(enabled);
} }
if(enabled){ if(enabled){
checkLabelGapAndStylePane(); //轴标签缩略间隔显示 恢复用注释。下面1行删除。
checkLabelGapValuePane();
//轴标签缩略间隔显示 恢复用注释。取消注释。
//checkLabelGapAndStylePane();
} }
} }
} }
@ -462,9 +517,10 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane<VanChartAxis> {
protected void checkLabelGapValuePane() { protected void checkLabelGapValuePane() {
if (labelGapValuePane != null && labelGapStyle != null) { if (labelGapValuePane != null && labelGapStyle != null) {
boolean visible = labelGapStyle.getSelectedIndex() == 1; boolean visible = labelGapStyle.getSelectedIndex() == 1;
if (overlapHandleTypeGroup != null) { //轴标签缩略间隔显示 恢复用注释。取消注释。
visible = visible && overlapHandleTypeGroup.getSelectedItem() == OverlapHandleType.INTERVAL; // if (overlapHandleTypeGroup != null) {
} // visible = visible && overlapHandleTypeGroup.getSelectedItem() == OverlapHandleType.INTERVAL;
// }
labelGapValuePane.setVisible(visible); labelGapValuePane.setVisible(visible);
} }
} }
@ -548,14 +604,18 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane<VanChartAxis> {
if(labelTextRotation != null){ if(labelTextRotation != null){
labelTextRotation.populateBean((double)labelTextAttr.getRotation()); labelTextRotation.populateBean((double)labelTextAttr.getRotation());
} }
if (overlapHandleTypeGroup != null) { //轴标签缩略间隔显示 恢复用注释。取消注释。
overlapHandleTypeGroup.setSelectedItem(axis.getOverlapHandleType()); // if (overlapHandleTypeGroup != null) {
} // overlapHandleTypeGroup.setSelectedItem(axis.getOverlapHandleType());
// }
if(labelGapStyle != null){ if(labelGapStyle != null){
labelGapStyle.setSelectedIndex(axis.isAutoLabelGap() ? 0 : 1); labelGapStyle.setSelectedIndex(axis.isAutoLabelGap() ? 0 : 1);
} }
if(labelGapValue != null){ if(labelGapValue != null){
labelGapValue.setValue(axis.getIntervalNumber()); //轴标签缩略间隔显示 恢复用注释。下面1行删除。
labelGapValue.setText(axis.getLabelNumber().getContent());
//轴标签缩略间隔显示 恢复用注释。取消注释。
//labelGapValue.setValue(axis.getIntervalNumber());
} }
} }
@ -676,14 +736,22 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane<VanChartAxis> {
if(labelTextRotation != null){ if(labelTextRotation != null){
labelTextAttr.setRotation(labelTextRotation.updateBean().intValue()); labelTextAttr.setRotation(labelTextRotation.updateBean().intValue());
} }
if (overlapHandleTypeGroup != null) { //轴标签缩略间隔显示 恢复用注释。取消注释。
axis.setOverlapHandleType(overlapHandleTypeGroup.getSelectedItem()); // if (overlapHandleTypeGroup != null) {
} // axis.setOverlapHandleType(overlapHandleTypeGroup.getSelectedItem());
// }
if(labelGapStyle != null){ if(labelGapStyle != null){
axis.setAutoLabelGap(labelGapStyle.getSelectedIndex() == 0); axis.setAutoLabelGap(labelGapStyle.getSelectedIndex() == 0);
} }
if(labelGapValue != null){ if(labelGapValue != null){
axis.setIntervalNumber((int) labelGapValue.getValue()); //轴标签缩略间隔显示 恢复用注释。下面5行删除。
if (axis.isAutoLabelGap()) {
axis.setLabelIntervalNumber(BaseFormula.createFormulaBuilder().build("1"));
} else {
axis.setLabelIntervalNumber(BaseFormula.createFormulaBuilder().build(labelGapValue.getText()));
}
//轴标签缩略间隔显示 恢复用注释。取消注释。
//axis.setIntervalNumber((int) labelGapValue.getValue());
} }
} }

Loading…
Cancel
Save