Browse Source

Merge branch 'feature/x' of https://code.fineres.com/scm/~henry.wang/design into feature/x

feature/x
wtianye 3 years ago
parent
commit
2b83f41edc
  1. 30
      designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartAxisPaneHelper.java
  2. 74
      designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartAxisStyleSettingPane.java
  3. 343
      designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartBaseAxisPane.java
  4. 5
      designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartTimeAxisPane.java
  5. 5
      designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartValueAxisPane.java
  6. 19
      designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/component/VanChartCategoryStylePaneWithCheckBox.java
  7. 13
      designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/gauge/VanChartGaugeDetailAxisPane.java
  8. 19
      designer-realize/src/main/java/com/fr/design/mainframe/form/FormReportComponentComposite.java
  9. 79
      designer-realize/src/main/java/com/fr/design/mainframe/form/FormReportComponentCompositeMouseWheelHandler.java
  10. 25
      designer-realize/src/main/java/com/fr/design/share/ui/effect/PreviewPane.java
  11. 69
      designer-realize/src/main/java/com/fr/design/share/ui/effect/PreviewPaneMouseWheelHandler.java

30
designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartAxisPaneHelper.java

@ -0,0 +1,30 @@
package com.fr.van.chart.designer.style.axis;
import com.fr.design.layout.TableLayout;
import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane;
import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPaneWithThemeStyle;
import com.fr.design.mainframe.chart.mode.ChartEditContext;
import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import javax.swing.JPanel;
public class VanChartAxisPaneHelper {
public static ChartTextAttrPane createAxisTextAttrPane() {
return ChartEditContext.supportTheme() ? new ChartTextAttrPaneWithThemeStyle() {
protected double getEdithAreaWidth() {
return TableLayout4VanChartHelper.SECOND_EDIT_AREA_WIDTH;
}
} : new ChartTextAttrPane() {
@Override
protected JPanel getContentPane(JPanel buttonPane) {
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double e = TableLayout4VanChartHelper.SECOND_EDIT_AREA_WIDTH;
double[] columnSize = {f, e};
double[] rowSize = {p, p, p};
return TableLayout4VanChartHelper.createGapTableLayoutPane(getComponents(buttonPane), rowSize, columnSize);
}
};
}
}

74
designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartAxisStyleSettingPane.java

@ -10,11 +10,9 @@ import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane; import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane;
import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPaneWithThemeStyle;
import com.fr.design.mainframe.chart.mode.ChartEditContext;
import com.fr.design.utils.gui.UIComponentUtils; import com.fr.design.utils.gui.UIComponentUtils;
import com.fr.design.widget.FRWidgetFactory; import com.fr.design.widget.FRWidgetFactory;
import com.fr.plugin.chart.VanChartAxisCategoryStyle; import com.fr.plugin.chart.attr.axis.VanChartAxisLabelStyle;
import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import com.fr.van.chart.designer.style.axis.component.AxisLabelDisplayComboBox; import com.fr.van.chart.designer.style.axis.component.AxisLabelDisplayComboBox;
@ -25,10 +23,11 @@ import java.awt.Dimension;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
public class VanChartAxisStyleSettingPane extends BasicBeanPane<VanChartAxisCategoryStyle> { public class VanChartAxisStyleSettingPane extends BasicBeanPane<VanChartAxisLabelStyle> {
private static final double ROTATION_MAX = 90.0; private static final double ROTATION_MAX = 90.0;
private AxisLabelDisplayComboBox labelDisplayComboBox; private AxisLabelDisplayComboBox labelDisplayComboBox;
private JPanel labelDisplayPane;
private ChartTextAttrPane labelTextAttrPane; private ChartTextAttrPane labelTextAttrPane;
private UINumberDragPane labelTextRotation; private UINumberDragPane labelTextRotation;
private UIButtonGroup<Integer> labelGapStyle; private UIButtonGroup<Integer> labelGapStyle;
@ -37,7 +36,10 @@ public class VanChartAxisStyleSettingPane extends BasicBeanPane<VanChartAxisCate
private JPanel labelGapValuePane; private JPanel labelGapValuePane;
private JPanel contentPane; private JPanel contentPane;
public VanChartAxisStyleSettingPane() { private boolean showLabelDisplayPane = true;
public VanChartAxisStyleSettingPane(boolean showLabelDisplayPane, ChartTextAttrPane textAttrPane) {
this.showLabelDisplayPane = showLabelDisplayPane;
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double f = TableLayout.FILL; double f = TableLayout.FILL;
double s = TableLayout4VanChartHelper.SECOND_EDIT_AREA_WIDTH; double s = TableLayout4VanChartHelper.SECOND_EDIT_AREA_WIDTH;
@ -45,9 +47,12 @@ public class VanChartAxisStyleSettingPane extends BasicBeanPane<VanChartAxisCate
double[] row = {p, p, p}; double[] row = {p, p, p};
labelDisplayComboBox = new AxisLabelDisplayComboBox(); labelDisplayComboBox = new AxisLabelDisplayComboBox();
JPanel labelDisplayPane = TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Axis_Label_Show"), labelDisplayComboBox, TableLayout4VanChartHelper.SECOND_EDIT_AREA_WIDTH); labelDisplayPane = TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Axis_Label_Show"), labelDisplayComboBox, TableLayout4VanChartHelper.SECOND_EDIT_AREA_WIDTH);
labelTextAttrPane = getChartTextAttrPane(); labelDisplayPane.setVisible(showLabelDisplayPane);
labelTextAttrPane = textAttrPane;
labelTextRotation = new UINumberDragPane(-ROTATION_MAX, ROTATION_MAX); labelTextRotation = new UINumberDragPane(-ROTATION_MAX, ROTATION_MAX);
labelGapStyle = new UIButtonGroup<>(new String[]{Toolkit.i18nText("Fine-Design_Chart_Automatic"), Toolkit.i18nText("Fine-Design_Chart_Fixed")}); labelGapStyle = new UIButtonGroup<>(new String[]{Toolkit.i18nText("Fine-Design_Chart_Automatic"), Toolkit.i18nText("Fine-Design_Chart_Fixed")});
labelGapValue = new UITextField(); labelGapValue = new UITextField();
labelGapPane = createLabelGapPane(row, column); labelGapPane = createLabelGapPane(row, column);
@ -61,6 +66,10 @@ public class VanChartAxisStyleSettingPane extends BasicBeanPane<VanChartAxisCate
initListner(); initListner();
} }
public VanChartAxisStyleSettingPane(ChartTextAttrPane textAttrPane) {
this(true, textAttrPane);
}
@Override @Override
public Dimension getPreferredSize() { public Dimension getPreferredSize() {
Dimension defaultSize = super.getPreferredSize(); Dimension defaultSize = super.getPreferredSize();
@ -71,33 +80,51 @@ public class VanChartAxisStyleSettingPane extends BasicBeanPane<VanChartAxisCate
labelDisplayComboBox.addActionListener(new ActionListener() { labelDisplayComboBox.addActionListener(new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
labelGapPane.setVisible(labelDisplayComboBox.getSelectedIndex() == 0); checkLabelGapPane();
} }
}); });
labelGapStyle.addActionListener(new ActionListener() { labelGapStyle.addActionListener(new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
labelGapValuePane.setVisible(labelGapStyle.getSelectedIndex() == 1); checkLabelGapValuePane();
} }
}); });
} }
private void checkLabelGapPane() {
if (labelGapPane != null) {
boolean visible = true;
if (showLabelDisplayPane && labelDisplayPane != null && labelDisplayComboBox != null) {
visible = labelDisplayComboBox.getSelectedIndex() == 0;
}
labelGapPane.setVisible(visible);
}
}
private void checkLabelGapValuePane() {
if (labelGapValuePane != null && labelGapStyle != null) {
labelGapValuePane.setVisible(labelGapStyle.getSelectedIndex() == 1);
}
}
@Override @Override
public void populateBean(VanChartAxisCategoryStyle style) { public void populateBean(VanChartAxisLabelStyle style) {
labelDisplayComboBox.populateBean(style.getLabelDisplay()); labelDisplayComboBox.populateBean(style.getLabelDisplay());
labelTextAttrPane.populate(style.getTextAttr()); labelTextAttrPane.populate(style.getTextAttr());
labelTextRotation.populateBean((double) style.getTextAttr().getRotation()); labelTextRotation.populateBean((double) style.getTextAttr().getRotation());
labelGapStyle.setSelectedIndex(style.isAutoLabelGap() ? 0 : 1); labelGapStyle.setSelectedIndex(style.isAutoLabelGap() ? 0 : 1);
labelGapValue.setText(style.getLabelIntervalNumber().getContent()); labelGapValue.setText(style.getLabelIntervalNumber().getContent());
labelGapPane.setVisible(labelDisplayComboBox.getSelectedIndex() == 0); checkLabelGapPane();
labelGapValuePane.setVisible(labelGapStyle.getSelectedIndex() == 1); checkLabelGapValuePane();
} }
@Override @Override
public VanChartAxisCategoryStyle updateBean() { public VanChartAxisLabelStyle updateBean() {
VanChartAxisCategoryStyle style = new VanChartAxisCategoryStyle(); VanChartAxisLabelStyle style = new VanChartAxisLabelStyle();
style.setLabelDisplay(labelDisplayComboBox.updateBean()); style.setLabelDisplay(labelDisplayComboBox.updateBean());
TextAttr textAttr = style.getTextAttr(); TextAttr textAttr = style.getTextAttr();
labelTextAttrPane.update(textAttr); labelTextAttrPane.update(textAttr);
@ -136,23 +163,4 @@ public class VanChartAxisStyleSettingPane extends BasicBeanPane<VanChartAxisCate
return panel; return panel;
} }
protected ChartTextAttrPane getChartTextAttrPane() {
return ChartEditContext.supportTheme() ? new ChartTextAttrPaneWithThemeStyle() {
protected double getEdithAreaWidth() {
return TableLayout4VanChartHelper.SECOND_EDIT_AREA_WIDTH;
}
} : new ChartTextAttrPane() {
@Override
protected JPanel getContentPane(JPanel buttonPane) {
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double e = TableLayout4VanChartHelper.SECOND_EDIT_AREA_WIDTH;
double[] columnSize = {f, e};
double[] rowSize = {p, p, p};
return TableLayout4VanChartHelper.createGapTableLayoutPane(getComponents(buttonPane), rowSize, columnSize);
}
};
}
} }

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

@ -17,31 +17,26 @@ import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.ibutton.UIToggleButton; 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.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;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.chart.PaneTitleConstants; import com.fr.design.mainframe.chart.PaneTitleConstants;
import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane; import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane;
import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPaneWithThemeStyle;
import com.fr.design.mainframe.chart.gui.style.ColorSelectBoxWithThemeStyle; import com.fr.design.mainframe.chart.gui.style.ColorSelectBoxWithThemeStyle;
import com.fr.design.mainframe.chart.mode.ChartEditContext;
import com.fr.design.utils.gui.UIComponentUtils; import com.fr.design.utils.gui.UIComponentUtils;
import com.fr.design.widget.FRWidgetFactory; import com.fr.design.widget.FRWidgetFactory;
import com.fr.plugin.chart.VanChartAxisCategoryStyle;
import com.fr.plugin.chart.attr.axis.VanChartAxis; import com.fr.plugin.chart.attr.axis.VanChartAxis;
import com.fr.plugin.chart.attr.axis.VanChartAxisLabelStyle;
import com.fr.plugin.chart.base.OverlapHandleType; import com.fr.plugin.chart.base.OverlapHandleType;
import com.fr.plugin.chart.base.VanChartConstants; import com.fr.plugin.chart.base.VanChartConstants;
import com.fr.plugin.chart.type.AxisTickLineType; import com.fr.plugin.chart.type.AxisTickLineType;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import com.fr.stable.CoreConstants; import com.fr.stable.CoreConstants;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils;
import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import com.fr.van.chart.designer.component.VanChartHtmlLabelPane; import com.fr.van.chart.designer.component.VanChartHtmlLabelPane;
import com.fr.van.chart.designer.style.VanChartStylePane; import com.fr.van.chart.designer.style.VanChartStylePane;
import com.fr.van.chart.designer.style.axis.component.AxisLabelDisplayComboBox;
import com.fr.van.chart.designer.style.axis.component.VanChartCategoryStylePaneWithCheckBox; import com.fr.van.chart.designer.style.axis.component.VanChartCategoryStylePaneWithCheckBox;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
@ -79,27 +74,17 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane<VanChartAxis> {
protected UIButtonGroup showLabel; protected UIButtonGroup showLabel;
protected UIButtonGroup showLogic; protected UIButtonGroup showLogic;
protected ChartTextAttrPane labelTextAttrPane;
protected UINumberDragPane labelTextRotation;
private AxisLabelDisplayComboBox labelDisplayComboBox;
//轴标签缩略间隔显示 恢复用注释。下面6行删除。
protected UITextField labelGapValue;
private UIButtonGroup<OverlapHandleType> overlapHandleTypeGroup; private UIButtonGroup<OverlapHandleType> overlapHandleTypeGroup;
protected UIButtonGroup<Integer> labelGapStyle;
//轴标签缩略间隔显示 恢复用注释。取消注释。 //轴标签缩略间隔显示 恢复用注释。取消注释。
//protected UISpinner labelGapValue; //protected UISpinner labelGapValue;
protected JPanel labelPanel; protected JPanel labelContentPane;
private JPanel labelStylePane; private VanChartAxisStyleSettingPane labelPane;
private JPanel showLogicPane; private JPanel showLogicPane;
private JPanel labelGapPane; private JPanel labelStylePane;
private JPanel labelGapStylePane;
private JPanel labelGapValuePane;
private JPanel labelDisplayPane;
private JPanel categoryStylePane; private JPanel categoryStylePane;
private VanChartAxisStyleSettingPane wholeDisplayLabelPanel;
private List<VanChartCategoryStylePaneWithCheckBox> categoryStyles = new ArrayList<>(); private List<VanChartCategoryStylePaneWithCheckBox> categoryStyles = new ArrayList<>();
protected LineComboBox axisLineStyle; protected LineComboBox axisLineStyle;
@ -234,17 +219,18 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane<VanChartAxis> {
protected JPanel createLabelPane(double[] row, double[] col) { protected JPanel createLabelPane(double[] row, double[] col) {
initLabelComponents(); initLabelComponents();
labelGapPane = createLabelGapPane(row, col); labelPane = new VanChartAxisStyleSettingPane(showLabelDisplay(), getChartTextAttrPane());
labelPanel = createLabelDetailPanel(); wholeDisplayLabelPanel = new VanChartAxisStyleSettingPane(showLabelDisplay(), getChartTextAttrPane());
wholeDisplayLabelPanel.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 10));
addComponentsListener(); addComponentsListener();
JPanel showLabelPane = TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Axis_Label"), showLabel); JPanel showLabelPane = TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Axis_Label"), showLabel);
JPanel showLogicPane = createShowLogicPane(); JPanel labelContentPane = createLabelContentPane();
JPanel labelPane = new JPanel(new BorderLayout()); JPanel labelPane = new JPanel(new BorderLayout());
labelPane.add(showLabelPane, BorderLayout.NORTH); labelPane.add(showLabelPane, BorderLayout.NORTH);
labelPane.add(showLogicPane, BorderLayout.CENTER); labelPane.add(labelContentPane, BorderLayout.CENTER);
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(PaneTitleConstants.CHART_STYLE_LABEL_TITLE, labelPane); return TableLayout4VanChartHelper.createExpandablePaneWithTitle(PaneTitleConstants.CHART_STYLE_LABEL_TITLE, labelPane);
} }
@ -253,15 +239,6 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane<VanChartAxis> {
showLabel = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_Use_Show"), Toolkit.i18nText("Fine-Design_Chart_Hidden")}); showLabel = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_Use_Show"), Toolkit.i18nText("Fine-Design_Chart_Hidden")});
showLogic = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_Axis_Style_Whole_Display"), Toolkit.i18nText("Fine-Design_Chart_Axis_Style_Layer_Display")}); showLogic = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_Axis_Style_Whole_Display"), Toolkit.i18nText("Fine-Design_Chart_Axis_Style_Layer_Display")});
initButtonGroupListener(); initButtonGroupListener();
labelDisplayComboBox = new AxisLabelDisplayComboBox();
labelDisplayPane = TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Axis_Label_Show"), labelDisplayComboBox, TableLayout4VanChartHelper.SECOND_EDIT_AREA_WIDTH);
labelDisplayPane.setVisible(showLabelDisplay());
labelTextAttrPane = getChartTextAttrPane();
labelTextRotation = new UINumberDragPane(-ROTATION_MAX, ROTATION_MAX);
labelGapStyle = new UIButtonGroup<>(new String[]{Toolkit.i18nText("Fine-Design_Chart_Automatic"), Toolkit.i18nText("Fine-Design_Chart_Fixed")});
labelGapValue = new UITextField();
} }
private void initButtonGroupListener() { private void initButtonGroupListener() {
@ -288,14 +265,18 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane<VanChartAxis> {
* *
* @return * @return
*/ */
private JPanel createShowLogicPane() { private JPanel createLabelContentPane() {
labelContentPane = new JPanel(new BorderLayout());
showLogicPane = new JPanel(new BorderLayout()); showLogicPane = new JPanel(new BorderLayout());
labelStylePane = new JPanel(new CardLayout()); labelStylePane = new JPanel(new CardLayout());
labelStylePane.add(labelPanel, WHOLE_DISPLAY); labelStylePane.add(wholeDisplayLabelPanel, WHOLE_DISPLAY);
labelStylePane.add(createCategoryStylePane(), LAYER_DISPLAY); labelStylePane.add(createCategoryStylePane(), LAYER_DISPLAY);
showLogicPane.add(TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Axis_Label_Show_Logic"), showLogic), BorderLayout.NORTH); showLogicPane.add(TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Axis_Label_Show_Logic"), showLogic), BorderLayout.NORTH);
showLogicPane.add(labelStylePane, BorderLayout.CENTER); showLogicPane.add(labelStylePane, BorderLayout.CENTER);
return showLogicPane; showLogicPane.setVisible(false);
labelContentPane.add(labelPane, BorderLayout.NORTH);
labelContentPane.add(showLogicPane, BorderLayout.CENTER);
return labelContentPane;
} }
/** /**
@ -309,37 +290,6 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane<VanChartAxis> {
return categoryStylePane; return categoryStylePane;
} }
private JPanel createLabelGapPane(double[] row, double[] col) {
Component[][] gapComponents = new Component[][]{
new Component[]{null, null},
new Component[]{
FRWidgetFactory.createLineWrapLabel(Toolkit.i18nText("Fine-Design_Chart_TextRotation")),
UIComponentUtils.wrapWithBorderLayoutPane(labelTextRotation)
},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Label_Interval")), labelGapStyle}
};
JPanel gapDetailPane = TableLayout4VanChartHelper.createGapTableLayoutPane(gapComponents, row, col);
labelGapValuePane = TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText(""), labelGapValue, TableLayout4VanChartHelper.SECOND_EDIT_AREA_WIDTH);
JPanel panel = new JPanel(new BorderLayout());
panel.add(gapDetailPane, BorderLayout.CENTER);
panel.add(labelGapValuePane, BorderLayout.SOUTH);
return panel;
}
private JPanel createLabelDetailPanel() {
JPanel panel = new JPanel(new BorderLayout());
panel.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 0));
panel.add(labelDisplayPane, BorderLayout.NORTH);
panel.add(labelTextAttrPane, BorderLayout.CENTER);
panel.add(labelGapPane, BorderLayout.SOUTH);
return panel;
}
private void addComponentsListener() { private void addComponentsListener() {
// 显示/隐藏 // 显示/隐藏
showLabel.addActionListener(new ActionListener() { showLabel.addActionListener(new ActionListener() {
@ -348,123 +298,10 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane<VanChartAxis> {
checkLabelPane(); checkLabelPane();
} }
}); });
// 间隔/缩略/换行
labelDisplayComboBox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
checkLabelGapPane();
}
});
// 自动/固定
labelGapStyle.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
checkLabelGapValuePane();
}
});
}
// protected JPanel createLabelPane(double[] row, double[] col){
// double p = TableLayout.PREFERRED;
// showLabel = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_Use_Show"), 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(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) {
labelTextRotation = new UINumberDragPane(-ROTATION_MAX, ROTATION_MAX);
Component[][] gapComponents = new Component[][]{
new Component[]{
FRWidgetFactory.createLineWrapLabel(Toolkit.i18nText("Fine-Design_Chart_TextRotation")),
UIComponentUtils.wrapWithBorderLayoutPane(labelTextRotation)
}
};
return TableLayout4VanChartHelper.createGapTableLayoutPane(gapComponents, new double[]{TableLayout.PREFERRED}, col);
}
private JPanel createLabelOverlapPane() {
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);
//轴标签缩略间隔显示 恢复用注释。取消注释。
//labelGapValue = new UISpinner(0, Integer.MAX_VALUE, 1, 1);
labelGapValuePane = TableLayout4VanChartHelper.createGapTableLayoutPane(StringUtils.EMPTY, labelGapValue, TableLayout4VanChartHelper.SECOND_EDIT_AREA_WIDTH);
JPanel panel = new JPanel(new BorderLayout(0, 0));
addOverlapGroupButton(panel);
panel.add(labelGapStylePane, BorderLayout.CENTER);
panel.add(labelGapValuePane, BorderLayout.SOUTH);
labelGapStyle.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
checkLabelGapValuePane();
}
});
return panel;
}
protected void addOverlapGroupButton(JPanel panel) {
overlapHandleTypeGroup = new UIButtonGroup<OverlapHandleType>(new String[]{Toolkit.i18nText("Fine-Design_Chart_Label_OverlapAbbreviate"), Toolkit.i18nText("Fine-Design_Chart_Label_OverlapInterval")},
new OverlapHandleType[]{OverlapHandleType.ABBREVIATE, OverlapHandleType.INTERVAL});
JPanel north = TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Label_WhenOverlap"), overlapHandleTypeGroup, TableLayout4VanChartHelper.SECOND_EDIT_AREA_WIDTH);
panel.add(north, BorderLayout.NORTH);
overlapHandleTypeGroup.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
checkLabelGapAndStylePane();
}
});
} }
protected ChartTextAttrPane getChartTextAttrPane() { protected ChartTextAttrPane getChartTextAttrPane() {
return ChartEditContext.supportTheme() ? new ChartTextAttrPaneWithThemeStyle() { return VanChartAxisPaneHelper.createAxisTextAttrPane();
protected double getEdithAreaWidth() {
return TableLayout4VanChartHelper.SECOND_EDIT_AREA_WIDTH;
}
} : new ChartTextAttrPane() {
@Override
protected JPanel getContentPane(JPanel buttonPane) {
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double e = TableLayout4VanChartHelper.SECOND_EDIT_AREA_WIDTH;
double[] columnSize = {f, e};
double[] rowSize = {p, p, p};
return TableLayout4VanChartHelper.createGapTableLayoutPane(getComponents(buttonPane), rowSize, columnSize);
}
};
} }
protected JPanel createLineStylePane(double[] row, double[] col) { protected JPanel createLineStylePane(double[] row, double[] col) {
@ -605,7 +442,6 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane<VanChartAxis> {
protected void checkAllUse() { protected void checkAllUse() {
checkCardPane(); checkCardPane();
checkLabelPane(); checkLabelPane();
checkLabelGapPane();
checkTitlePane(); checkTitlePane();
//区域显示策略 恢复用注释。删除下面一行。 //区域显示策略 恢复用注释。删除下面一行。
checkMaxProPortionUse(); checkMaxProPortionUse();
@ -638,14 +474,8 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane<VanChartAxis> {
protected void checkLabelPane() { protected void checkLabelPane() {
if (showLabel != null) { if (showLabel != null) {
boolean enabled = showLabel.getSelectedIndex() == 0; boolean enabled = showLabel.getSelectedIndex() == 0;
if (showLogicPane != null) { if (labelContentPane != null) {
showLogicPane.setVisible(enabled); labelContentPane.setVisible(enabled);
}
if (enabled) {
//轴标签缩略间隔显示 恢复用注释。下面1行删除。
checkLabelGapValuePane();
//轴标签缩略间隔显示 恢复用注释。取消注释。
//checkLabelGapAndStylePane();
} }
} }
} }
@ -656,39 +486,6 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane<VanChartAxis> {
} }
} }
private void checkLabelGapAndStylePane() {
if (overlapHandleTypeGroup != null && labelGapStylePane != null) {
boolean visible = overlapHandleTypeGroup.getSelectedItem() == OverlapHandleType.INTERVAL;
labelGapStylePane.setVisible(visible);
}
checkLabelGapValuePane();
}
protected void checkLabelGapPane() {
if (labelGapPane != null) {
boolean visible = true;
if (showLabelDisplay() && labelDisplayPane != null && labelDisplayComboBox != null) {
visible = labelDisplayComboBox.getSelectedIndex() == 0;
}
labelGapPane.setVisible(visible);
}
}
protected void checkLabelGapValuePane() {
if (labelGapValuePane != null && labelGapStyle != null) {
boolean visible = labelGapStyle.getSelectedIndex() == 1;
//轴标签缩略间隔显示 恢复用注释。取消注释。
// if (overlapHandleTypeGroup != null) {
// visible = visible && overlapHandleTypeGroup.getSelectedItem() == OverlapHandleType.INTERVAL;
// }
labelGapValuePane.setVisible(visible);
}
}
/** /**
* 是否是指定类型 * 是否是指定类型
* *
@ -767,7 +564,18 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane<VanChartAxis> {
showLabel.setSelectedIndex(axis.isShowAxisLabel() ? 0 : 1); showLabel.setSelectedIndex(axis.isShowAxisLabel() ? 0 : 1);
} }
labelPane.populateBean(getAxisLabelStyle(axis));
populateShowLogicPane(axis); populateShowLogicPane(axis);
switchLabelPane(axis);
labelContentPane.validate();
}
/**
* 切换显示是单分类样式设置面板还是多分类样式设置面板
*/
private void switchLabelPane(VanChartAxis axis) {
labelPane.setVisible(!axis.isMultiCategory());
showLogicPane.setVisible(axis.isMultiCategory());
} }
private void populateShowLogicPane(VanChartAxis axis) { private void populateShowLogicPane(VanChartAxis axis) {
@ -784,29 +592,16 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane<VanChartAxis> {
* populate整体显示那个card面板 * populate整体显示那个card面板
*/ */
private void populateWholeDisplayPane(VanChartAxis axis) { private void populateWholeDisplayPane(VanChartAxis axis) {
TextAttr labelTextAttr = axis.getTextAttr(); wholeDisplayLabelPanel.populateBean(getAxisLabelStyle(axis));
if (labelTextAttrPane != null) { }
labelTextAttrPane.populate(labelTextAttr);
} private VanChartAxisLabelStyle getAxisLabelStyle(VanChartAxis axis) {
if (labelTextRotation != null) { VanChartAxisLabelStyle style = new VanChartAxisLabelStyle();
labelTextRotation.populateBean((double) labelTextAttr.getRotation()); style.setLabelDisplay(axis.getLabelDisplay());
} style.setTextAttr(axis.getTextAttr());
//轴标签缩略间隔显示 恢复用注释。取消注释。 style.setAutoLabelGap(axis.isAutoLabelGap());
// if (overlapHandleTypeGroup != null) { style.setLabelIntervalNumber(axis.getLabelNumber());
// overlapHandleTypeGroup.setSelectedItem(axis.getOverlapHandleType()); return style;
// }
if (labelDisplayComboBox != null) {
labelDisplayComboBox.populateBean(axis.getLabelDisplay());
}
if (labelGapStyle != null) {
labelGapStyle.setSelectedIndex(axis.isAutoLabelGap() ? 0 : 1);
}
if (labelGapValue != null) {
//轴标签缩略间隔显示 恢复用注释。下面1行删除。
labelGapValue.setText(axis.getLabelNumber().getContent());
//轴标签缩略间隔显示 恢复用注释。取消注释。
//labelGapValue.setValue(axis.getIntervalNumber());
}
} }
/** /**
@ -871,21 +666,21 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane<VanChartAxis> {
private void populateCategoryStyles(VanChartAxis axis, String uuid, int index) { private void populateCategoryStyles(VanChartAxis axis, String uuid, int index) {
VanChartCategoryStylePaneWithCheckBox pane = new VanChartCategoryStylePaneWithCheckBox(parent, this, Toolkit.i18nText("Fine-Design_Chart_Style_Category") + (index + 1)); VanChartCategoryStylePaneWithCheckBox pane = new VanChartCategoryStylePaneWithCheckBox(parent, this, Toolkit.i18nText("Fine-Design_Chart_Style_Category") + (index + 1));
VanChartAxisCategoryStyle style = populateAxisCategoryStyles(axis, uuid, index); VanChartAxisLabelStyle style = populateAxisCategoryStyles(axis, uuid, index);
pane.populate(style, uuid); pane.populate(style, uuid);
categoryStyles.add(pane); categoryStyles.add(pane);
categoryStylePane.add(createCateLableStylePanel(), BorderLayout.NORTH); categoryStylePane.add(createCateLableStylePanel(), BorderLayout.NORTH);
} }
private VanChartAxisCategoryStyle populateAxisCategoryStyles(VanChartAxis axis, String uuid, int index) { private VanChartAxisLabelStyle populateAxisCategoryStyles(VanChartAxis axis, String uuid, int index) {
VanChartAxisCategoryStyle style; VanChartAxisLabelStyle style;
if (axis.getCategoryStyle(uuid) != null) { if (axis.getCategoryStyle(uuid) != null) {
style = axis.getCategoryStyle(uuid); style = axis.getCategoryStyle(uuid);
} else { } else {
style = axis.getCategoryStyleByIndex(index); style = axis.getCategoryStyleByIndex(index);
if (style == null) { if (style == null) {
style = new VanChartAxisCategoryStyle(); style = new VanChartAxisLabelStyle();
} }
axis.addCategoryStyle(uuid, style); axis.addCategoryStyle(uuid, style);
} }
@ -1041,7 +836,13 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane<VanChartAxis> {
if (showLabel != null) { if (showLabel != null) {
axis.setShowAxisLabel(showLabel.getSelectedIndex() == 0); axis.setShowAxisLabel(showLabel.getSelectedIndex() == 0);
} }
updateShowLogicPane(axis); if (!axis.isMultiCategory()) {
axis.setLabelDisplayMode(VanChartAxis.WHOLE_DISPLAY);
updateLabelPaneStyle(axis, labelPane);
} else {
updateShowLogicPane(axis);
}
switchLabelPane(axis);
} }
private void updateShowLogicPane(VanChartAxis axis) { private void updateShowLogicPane(VanChartAxis axis) {
@ -1057,33 +858,15 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane<VanChartAxis> {
* update整体显示那个card面板 * update整体显示那个card面板
*/ */
private void updateWholeDisplayPane(VanChartAxis axis) { private void updateWholeDisplayPane(VanChartAxis axis) {
TextAttr labelTextAttr = axis.getTextAttr(); updateLabelPaneStyle(axis, wholeDisplayLabelPanel);
if (labelTextAttrPane != null) { }
labelTextAttrPane.update(labelTextAttr);
} private void updateLabelPaneStyle(VanChartAxis axis, VanChartAxisStyleSettingPane pane) {
if (labelTextRotation != null) { VanChartAxisLabelStyle style = pane.updateBean();
labelTextAttr.setRotation(labelTextRotation.updateBean().intValue()); axis.setLabelDisplay(style.getLabelDisplay());
} axis.setTextAttr(style.getTextAttr());
//轴标签缩略间隔显示 恢复用注释。取消注释。 axis.setAutoLabelGap(style.isAutoLabelGap());
// if (overlapHandleTypeGroup != null) { axis.setLabelIntervalNumber(style.getLabelIntervalNumber());
// axis.setOverlapHandleType(overlapHandleTypeGroup.getSelectedItem());
// }
if (labelDisplayComboBox != null) {
axis.setLabelDisplay(labelDisplayComboBox.updateBean());
}
if (labelGapStyle != null) {
axis.setAutoLabelGap(labelGapStyle.getSelectedIndex() == 0);
}
if (labelGapValue != null) {
//轴标签缩略间隔显示 恢复用注释。下面5行删除。
if (axis.isAutoLabelGap()) {
axis.setLabelIntervalNumber(BaseFormula.createFormulaBuilder().build("1"));
} else {
axis.setLabelIntervalNumber(BaseFormula.createFormulaBuilder().build(labelGapValue.getText()));
}
//轴标签缩略间隔显示 恢复用注释。取消注释。
//axis.setIntervalNumber((int) labelGapValue.getValue());
}
} }
/** /**
@ -1093,8 +876,8 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane<VanChartAxis> {
*/ */
private void updateLayerDisplayPane(VanChartAxis axis) { private void updateLayerDisplayPane(VanChartAxis axis) {
for (VanChartCategoryStylePaneWithCheckBox categoryStyle : categoryStyles) { for (VanChartCategoryStylePaneWithCheckBox categoryStyle : categoryStyles) {
Map<String, VanChartAxisCategoryStyle> styleMap = categoryStyle.update(); Map<String, VanChartAxisLabelStyle> styleMap = categoryStyle.update();
for (Map.Entry<String, VanChartAxisCategoryStyle> entry : styleMap.entrySet()) { for (Map.Entry<String, VanChartAxisLabelStyle> entry : styleMap.entrySet()) {
axis.addCategoryStyle(entry.getKey(), entry.getValue()); axis.addCategoryStyle(entry.getKey(), entry.getValue());
} }
} }

5
designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartTimeAxisPane.java

@ -85,11 +85,6 @@ public class VanChartTimeAxisPane extends VanChartBaseAxisPane {
return false; return false;
} }
@Override
protected void addOverlapGroupButton(JPanel panel) {
//do nothing
}
private JPanel createValueDefinition(){ private JPanel createValueDefinition(){
timeMinMaxValuePane = new TimeMinMaxValuePane(); timeMinMaxValuePane = new TimeMinMaxValuePane();
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Value_Definition"), timeMinMaxValuePane); return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Value_Definition"), timeMinMaxValuePane);

5
designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartValueAxisPane.java

@ -66,11 +66,6 @@ public class VanChartValueAxisPane extends VanChartBaseAxisPane {
return false; return false;
} }
@Override
protected void addOverlapGroupButton(JPanel panel) {
//do nothing
}
protected JPanel createMinMaxValuePane(double[] row, double[] col){ protected JPanel createMinMaxValuePane(double[] row, double[] col){
JPanel panel = createCommenValuePane(row,col); JPanel panel = createCommenValuePane(row,col);
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Value_Definition"), panel); return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Value_Definition"), panel);

19
designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/component/VanChartCategoryStylePaneWithCheckBox.java

@ -5,8 +5,9 @@ import com.fr.design.gui.frpane.UIBubbleFloatPane;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.plugin.chart.VanChartAxisCategoryStyle; import com.fr.plugin.chart.attr.axis.VanChartAxisLabelStyle;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import com.fr.van.chart.designer.style.axis.VanChartAxisPaneHelper;
import com.fr.van.chart.designer.style.axis.VanChartAxisStyleSettingPane; import com.fr.van.chart.designer.style.axis.VanChartAxisStyleSettingPane;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
@ -30,7 +31,7 @@ public class VanChartCategoryStylePaneWithCheckBox extends JPanel {
private AbstractAttrNoScrollPane parent; private AbstractAttrNoScrollPane parent;
private String axisId; private String axisId;
private VanChartAxisCategoryStyle axis; private VanChartAxisLabelStyle axis;
public VanChartCategoryStylePaneWithCheckBox(AbstractAttrNoScrollPane parent, JPanel showOnPane, String checkBoxName) { public VanChartCategoryStylePaneWithCheckBox(AbstractAttrNoScrollPane parent, JPanel showOnPane, String checkBoxName) {
this.parent = parent; this.parent = parent;
@ -64,13 +65,13 @@ public class VanChartCategoryStylePaneWithCheckBox extends JPanel {
@Override @Override
public void mouseReleased(MouseEvent e) { public void mouseReleased(MouseEvent e) {
if (settingPane == null) { if (settingPane == null) {
settingPane = new VanChartAxisStyleSettingPane(); settingPane = new VanChartAxisStyleSettingPane(VanChartAxisPaneHelper.createAxisTextAttrPane());
} }
Point comPoint = settingButton.getLocationOnScreen(); Point comPoint = settingButton.getLocationOnScreen();
Point arrowPoint = new Point(comPoint.x +settingButton.getWidth() - 25, comPoint.y + settingButton.getHeight()); Point arrowPoint = new Point(comPoint.x +settingButton.getWidth() - 25, comPoint.y + settingButton.getHeight());
Dimension size = settingPane.getPreferredSize(); Dimension size = settingPane.getPreferredSize();
UIBubbleFloatPane<VanChartAxisCategoryStyle> pane = new UIBubbleFloatPane(Constants.LEFT, arrowPoint, settingPane, size.width, 216) { UIBubbleFloatPane<VanChartAxisLabelStyle> pane = new UIBubbleFloatPane(Constants.LEFT, arrowPoint, settingPane, size.width, 216) {
@Override @Override
public void updateContentPane() { public void updateContentPane() {
@ -87,15 +88,15 @@ public class VanChartCategoryStylePaneWithCheckBox extends JPanel {
} }
} }
public void populate(VanChartAxisCategoryStyle style, String uuid) { public void populate(VanChartAxisLabelStyle style, String uuid) {
this.axis = style; this.axis = style;
this.axisId = uuid; this.axisId = uuid;
checkBox.setSelected(axis.isAvailable()); checkBox.setSelected(axis.isShowLabel());
} }
public Map<String, VanChartAxisCategoryStyle> update() { public Map<String, VanChartAxisLabelStyle> update() {
axis.setAvailable(checkBox.isSelected()); axis.setShowLabel(checkBox.isSelected());
Map<String, VanChartAxisCategoryStyle> map = new LinkedHashMap<>(); Map<String, VanChartAxisLabelStyle> map = new LinkedHashMap<>();
map.put(axisId, axis); map.put(axisId, axis);
return map; return map;
} }

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

@ -1,5 +1,6 @@
package com.fr.van.chart.designer.style.axis.gauge; package com.fr.van.chart.designer.style.axis.gauge;
import com.fr.chart.base.TextAttr;
import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
@ -35,6 +36,7 @@ public class VanChartGaugeDetailAxisPane extends VanChartValueAxisPane {
private static final long serialVersionUID = -9213466625457882224L; private static final long serialVersionUID = -9213466625457882224L;
private ChartTextAttrPane labelTextAttrPane;
private ColorSelectBox mainTickColor; private ColorSelectBox mainTickColor;
private ColorSelectBox secTickColor; private ColorSelectBox secTickColor;
@ -83,12 +85,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")}); showLabel = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_Use_Show"), Toolkit.i18nText("Fine-Design_Chart_Hidden")});
labelTextAttrPane = getChartTextAttrPane(); labelTextAttrPane = getChartTextAttrPane();
labelPanel = new JPanel(new BorderLayout()); labelContentPane = new JPanel(new BorderLayout());
labelPanel.add(labelTextAttrPane); labelContentPane.add(labelTextAttrPane);
labelPanel.setBorder(BorderFactory.createEmptyBorder(0, 15, 0, 0)); labelContentPane.setBorder(BorderFactory.createEmptyBorder(0, 15, 0, 0));
JPanel panel = new JPanel(new BorderLayout(0, 6)); JPanel panel = new JPanel(new BorderLayout(0, 6));
panel.add(TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Axis_Label"), showLabel), BorderLayout.NORTH); panel.add(TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Axis_Label"), showLabel), BorderLayout.NORTH);
panel.add(labelPanel, BorderLayout.CENTER); panel.add(labelContentPane, BorderLayout.CENTER);
showLabel.addActionListener(new ActionListener() { showLabel.addActionListener(new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
@ -183,6 +185,7 @@ public class VanChartGaugeDetailAxisPane extends VanChartValueAxisPane {
public void populateBean(VanChartAxis axis) { public void populateBean(VanChartAxis axis) {
VanChartGaugeAxis gaugeAxis = (VanChartGaugeAxis) axis; VanChartGaugeAxis gaugeAxis = (VanChartGaugeAxis) axis;
labelTextAttrPane.populate(axis.getTextAttr());
if (mainTickColor != null) { if (mainTickColor != null) {
mainTickColor.setSelectObject(gaugeAxis.getMainTickColor()); mainTickColor.setSelectObject(gaugeAxis.getMainTickColor());
} }
@ -194,6 +197,8 @@ public class VanChartGaugeDetailAxisPane extends VanChartValueAxisPane {
public void updateBean(VanChartAxis axis) { public void updateBean(VanChartAxis axis) {
VanChartGaugeAxis gaugeAxis = (VanChartGaugeAxis) axis; VanChartGaugeAxis gaugeAxis = (VanChartGaugeAxis) axis;
TextAttr textAttr = axis.getTextAttr();
labelTextAttrPane.update(textAttr);
if (mainTickColor != null) { if (mainTickColor != null) {
gaugeAxis.setMainTickColor(mainTickColor.getSelectObject()); gaugeAxis.setMainTickColor(mainTickColor.getSelectObject());
} }

19
designer-realize/src/main/java/com/fr/design/mainframe/form/FormReportComponentComposite.java

@ -12,6 +12,8 @@ import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.DesignerUIModeConfig; import com.fr.design.mainframe.DesignerUIModeConfig;
import com.fr.design.mainframe.ElementCasePane; import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.mainframe.JFormSliderPane; import com.fr.design.mainframe.JFormSliderPane;
import com.fr.design.mainframe.ReportComponent;
import com.fr.design.mainframe.ReportComponentCompositeMouseWheelHandler;
import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus; import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus;
import com.fr.form.FormElementCaseContainerProvider; import com.fr.form.FormElementCaseContainerProvider;
import com.fr.form.FormElementCaseProvider; import com.fr.form.FormElementCaseProvider;
@ -53,23 +55,11 @@ public class FormReportComponentComposite extends JComponent implements TargetMo
sheetNameTab = new FormTabPane(ecContainer, jform); sheetNameTab = new FormTabPane(ecContainer, jform);
this.add(createSouthControlPane(), BorderLayout.SOUTH); this.add(createSouthControlPane(), BorderLayout.SOUTH);
jSliderContainer.addValueChangeListener(showValSpinnerChangeListener); jSliderContainer.addValueChangeListener(showValSpinnerChangeListener);
this.elementCaseDesigner.elementCasePane.getGrid().addMouseWheelListener(showValSpinnerMouseWheelListener); this.elementCaseDesigner.elementCasePane.getGrid().addMouseWheelListener(new FormReportComponentCompositeMouseWheelHandler(this));
elementCaseDesigner.addTargetModifiedListener(this); elementCaseDesigner.addTargetModifiedListener(this);
this.jSliderContainer.setShowValue((ScreenResolution.getScreenResolution() * HUND) / Constants.DEFAULT_WEBWRITE_AND_SCREEN_RESOLUTION); this.jSliderContainer.setShowValue((ScreenResolution.getScreenResolution() * HUND) / Constants.DEFAULT_WEBWRITE_AND_SCREEN_RESOLUTION);
} }
MouseWheelListener showValSpinnerMouseWheelListener = new MouseWheelListener() {
@Override
public void mouseWheelMoved(MouseWheelEvent e) {
if (InputEventBaseOnOS.isControlDown(e)) {
int dir = e.getWheelRotation();
int old_resolution = jSliderContainer.getShowValue();
jSliderContainer.setShowValue(old_resolution - (dir * DIR));
}
}
};
ChangeListener showValSpinnerChangeListener = new ChangeListener() { ChangeListener showValSpinnerChangeListener = new ChangeListener() {
@Override @Override
public void stateChanged(ChangeEvent e) { public void stateChanged(ChangeEvent e) {
@ -195,5 +185,8 @@ public class FormReportComponentComposite extends JComponent implements TargetMo
jForm.fireTargetModified(); jForm.fireTargetModified();
} }
public JFormSliderPane getSliderContainer() {
return this.jSliderContainer;
}
} }

79
designer-realize/src/main/java/com/fr/design/mainframe/form/FormReportComponentCompositeMouseWheelHandler.java

@ -0,0 +1,79 @@
package com.fr.design.mainframe.form;
import com.fr.common.inputevent.InputEventBaseOnOS;
import com.fr.design.mainframe.DesignerScaleMouseWheelHandler;
import com.fr.design.mainframe.DesignerTranslateMouseWheelHandler;
import com.fr.design.mainframe.JFormSliderPane;
import com.fr.design.mainframe.ReportComponentComposite;
import javax.swing.JScrollBar;
import javax.swing.JViewport;
import java.awt.event.MouseWheelEvent;
import java.awt.event.MouseWheelListener;
/**
* @author Starryi
* @version 1.0
* Created by Starryi on 2021/9/24
*/
public class FormReportComponentCompositeMouseWheelHandler implements MouseWheelListener {
private final DesignerTranslateMouseWheelHandler translateMouseWheelHandler;
private final DesignerScaleMouseWheelHandler scaleMouseWheelHandler;
public FormReportComponentCompositeMouseWheelHandler(FormReportComponentComposite componentComposite) {
translateMouseWheelHandler = new DesignerTranslateMouseWheelHandler(new ScrollPaneAdapter(componentComposite));
scaleMouseWheelHandler = new DesignerScaleMouseWheelHandler(new ScalePaneAdapter(componentComposite), ReportComponentComposite.DIR);
}
@Override
public void mouseWheelMoved(MouseWheelEvent e) {
if (InputEventBaseOnOS.isControlDown(e)) {
scaleMouseWheelHandler.mouseWheelMoved(e);
} else {
translateMouseWheelHandler.mouseWheelMoved(e);
}
}
private static class ScrollPaneAdapter implements DesignerTranslateMouseWheelHandler.ScrollPane {
private final FormReportComponentComposite componentComposite;
private JViewport viewport;
public ScrollPaneAdapter(FormReportComponentComposite componentComposite) {
this.componentComposite = componentComposite;
this.viewport = new JViewport();
}
@Override
public boolean isWheelScrollingEnabled() {
return true;
}
@Override
public JScrollBar getVerticalScrollBar() {
return componentComposite.elementCaseDesigner.getVerticalScrollBar();
}
@Override
public JScrollBar getHorizontalScrollBar() {
return componentComposite.elementCaseDesigner.getHorizontalScrollBar();
}
@Override
public JViewport getViewport() {
return viewport;
}
}
private static class ScalePaneAdapter implements DesignerScaleMouseWheelHandler.ScalePane {
private final FormReportComponentComposite componentComposite;
public ScalePaneAdapter(FormReportComponentComposite componentComposite) {
this.componentComposite = componentComposite;
}
@Override
public JFormSliderPane getSlidePane() {
return componentComposite.getSliderContainer();
}
}
}

25
designer-realize/src/main/java/com/fr/design/share/ui/effect/PreviewPane.java

@ -70,7 +70,6 @@ public class PreviewPane extends JPanel implements CallbackEvent{
private static final int MAX = 400; private static final int MAX = 400;
private static final int HUND = 100; private static final int HUND = 100;
private static final int MIN = 10; private static final int MIN = 10;
private static final int DIR = 10;
private static final double MIN_TIME = 0.4; private static final double MIN_TIME = 0.4;
private Widget widget; private Widget widget;
@ -194,27 +193,7 @@ public class PreviewPane extends JPanel implements CallbackEvent{
grid.removeMouseMotionListener(grid.getGridMouseAdapter()); grid.removeMouseMotionListener(grid.getGridMouseAdapter());
grid.removeMouseListener(grid.getGridMouseAdapter()); grid.removeMouseListener(grid.getGridMouseAdapter());
grid.addMouseWheelListener(new MouseWheelListener() { grid.addMouseWheelListener(new PreviewPaneMouseWheelHandler(this));
@Override
public void mouseWheelMoved(MouseWheelEvent e) {
if (!InputEventBaseOnOS.isControlDown(e)) {
ElementCasePane reportPane = grid.getElementCasePane();
if (reportPane.isVerticalScrollBarVisible()) {
JScrollBar scrollBar = reportPane.getVerticalScrollBar();
int maxValue = scrollBar.getModel().getMaximum();
int newValue = reportPane.getVerticalScrollBar().getValue() + e.getWheelRotation();
int extendValue = GridUtils.getExtentValue(newValue, elementCase.getRowHeightList_DEC(), grid.getHeight(), getResolution());
if (extendValue <= maxValue) {
reportPane.getVerticalScrollBar().setValue(newValue);
}
}
} else {
int dir = e.getWheelRotation();
addScale( - dir * DIR);
grid.setCursor(SCALE_CURSOR);
}
}
});
grid.addMouseMotionListener(new MouseMotionAdapter() { grid.addMouseMotionListener(new MouseMotionAdapter() {
@Override @Override
@ -320,7 +299,7 @@ public class PreviewPane extends JPanel implements CallbackEvent{
elementCasePane.repaint(); elementCasePane.repaint();
} }
private void addScale(int step) { public void addScale(int step) {
scaleValue += step; scaleValue += step;
scaleValue = fixedScale(scaleValue); scaleValue = fixedScale(scaleValue);
plusButton.setEnabled(scaleValue < MAX); plusButton.setEnabled(scaleValue < MAX);

69
designer-realize/src/main/java/com/fr/design/share/ui/effect/PreviewPaneMouseWheelHandler.java

@ -0,0 +1,69 @@
package com.fr.design.share.ui.effect;
import com.fr.common.inputevent.InputEventBaseOnOS;
import com.fr.design.mainframe.DesignerTranslateMouseWheelHandler;
import javax.swing.JScrollBar;
import javax.swing.JViewport;
import java.awt.event.MouseWheelEvent;
import java.awt.event.MouseWheelListener;
import static com.fr.design.share.ui.effect.PreviewPane.SCALE_CURSOR;
/**
* @author Starryi
* @version 1.0
* Created by Starryi on 2021/9/24
*/
public class PreviewPaneMouseWheelHandler implements MouseWheelListener {
private static final int DIR = 10;
private final DesignerTranslateMouseWheelHandler translateMouseWheelHandler;
private final PreviewPane previewPane;
public PreviewPaneMouseWheelHandler(PreviewPane previewPane) {
this.translateMouseWheelHandler = new DesignerTranslateMouseWheelHandler(new PreviewPaneScrollPaneAdapter(previewPane));
this.previewPane = previewPane;
}
@Override
public void mouseWheelMoved(MouseWheelEvent e) {
if (InputEventBaseOnOS.isControlDown(e)) {
int dir = e.getWheelRotation();
previewPane.addScale( - dir * DIR);
previewPane.getElementCasePane().getGrid().setCursor(SCALE_CURSOR);
} else {
translateMouseWheelHandler.mouseWheelMoved(e);
}
}
private static class PreviewPaneScrollPaneAdapter implements DesignerTranslateMouseWheelHandler.ScrollPane {
private final PreviewPane previewPane;
private final JViewport viewport;
public PreviewPaneScrollPaneAdapter(PreviewPane previewPane) {
this.previewPane = previewPane;
this.viewport = new JViewport();
}
@Override
public boolean isWheelScrollingEnabled() {
return true;
}
@Override
public JScrollBar getVerticalScrollBar() {
return previewPane.getElementCasePane().getVerticalScrollBar();
}
@Override
public JScrollBar getHorizontalScrollBar() {
return previewPane.getElementCasePane().getHorizontalScrollBar();
}
@Override
public JViewport getViewport() {
return this.viewport;
}
}
}
Loading…
Cancel
Save