Browse Source

CHART-10225 折现线型 配置界面

research/11.0
shine 5 years ago
parent
commit
862cbf69ea
  1. 2
      designer-chart/src/main/java/com/fr/van/chart/designer/component/LineTypeComboBox.java
  2. 64
      designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartLineTypePane.java
  3. 4
      designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartLineWidthPane.java
  4. 5
      designer-chart/src/main/java/com/fr/van/chart/scatter/component/VanChartScatterLineTypePane.java

2
designer-chart/src/main/java/com/fr/van/chart/designer/component/LineTypeComboBox.java

@ -30,7 +30,7 @@ public class LineTypeComboBox extends UIComboBox {
this.setRenderer(new CellRenderer()); this.setRenderer(new CellRenderer());
} }
private class CellRenderer extends UIComboBoxRenderer { private static class CellRenderer extends UIComboBoxRenderer {
private LineType lineType; private LineType lineType;

64
designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartLineTypePane.java

@ -32,10 +32,11 @@ public class VanChartLineTypePane extends BasicPane {
protected UIButtonGroup<LineStyle> lineStyle;//形态 protected UIButtonGroup<LineStyle> lineStyle;//形态
private UIButtonGroup nullValueBreak;//空值断开 private UIButtonGroup nullValueBreak;//空值断开
private JPanel lineWidthPane;
public VanChartLineTypePane() { public VanChartLineTypePane() {
lineTypeComboBox = new LineTypeComboBox(new LineType[]{LineType.NONE, LineType.NORMAL, LineType.DASH});
lineWidthSpinner = new UISpinner(0.5, Integer.MAX_VALUE, 0.5, 2); JPanel typeAndWidthPane = createTypeAndWidthPane();
createLineStyle(); createLineStyle();
@ -52,14 +53,10 @@ public class VanChartLineTypePane extends BasicPane {
double f = TableLayout.FILL; double f = TableLayout.FILL;
double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH;
Component[] lineTypeComponent = new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Line_Style")), lineTypeComboBox}, Component[] lineStyleComponent = new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Style_Present")), lineStyle},
lineWidthComponent = new Component[]{
FRWidgetFactory.createLineWrapLabel(Toolkit.i18nText("Fine-Design_Chart_Line_Width")),
UIComponentUtils.wrapWithBorderLayoutPane(lineWidthSpinner)},
lineStyleComponent = new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Style_Present")), lineStyle},
nullValueBreakComponent = new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Null_Value_Break")), nullValueBreak}; nullValueBreakComponent = new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Null_Value_Break")), nullValueBreak};
Component[][] components = createContentComponent(lineTypeComponent, lineWidthComponent, lineStyleComponent, nullValueBreakComponent); Component[][] components = createContentComponent(lineStyleComponent, nullValueBreakComponent);
double[] row = new double[components.length]; double[] row = new double[components.length];
Arrays.fill(row, p); Arrays.fill(row, p);
@ -67,16 +64,45 @@ public class VanChartLineTypePane extends BasicPane {
JPanel contentPane = TableLayout4VanChartHelper.createGapTableLayoutPane(components, row, col); JPanel contentPane = TableLayout4VanChartHelper.createGapTableLayoutPane(components, row, col);
this.setLayout(new BorderLayout()); this.setLayout(new BorderLayout(0, 6));
this.add(typeAndWidthPane, BorderLayout.NORTH);
this.add(contentPane, BorderLayout.CENTER); this.add(contentPane, BorderLayout.CENTER);
} }
private JPanel createTypeAndWidthPane() { private JPanel createTypeAndWidthPane() {
//todo@shinerefactor:当前兼容工作到这边,因为finekit和移动端,暂停
JPanel panel = new JPanel(new BorderLayout(0, 6));
lineTypeComboBox = new LineTypeComboBox(new LineType[]{LineType.NONE, LineType.NORMAL, LineType.DASH});
lineWidthSpinner = new UISpinner(0.5, Integer.MAX_VALUE, 0.5, 2);
lineTypeComboBox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
checkLineWidth();
}
});
Component[][] lineTypeComps = new Component[][]{
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Line_Style")), lineTypeComboBox}
};
Component[][] lineWidthComps = new Component[][]{
new Component[]{
FRWidgetFactory.createLineWrapLabel(Toolkit.i18nText("Fine-Design_Chart_Line_Width")),
UIComponentUtils.wrapWithBorderLayoutPane(lineWidthSpinner)}
};
double p = TableLayout.PREFERRED, f = TableLayout.FILL, e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH;
double[] row = {p}, col = {f, e};
JPanel lineTypePane = TableLayout4VanChartHelper.createGapTableLayoutPane(lineTypeComps, row, col);
lineWidthPane = TableLayout4VanChartHelper.createGapTableLayoutPane(lineWidthComps, row, col);
JPanel contentPane = new JPanel(new BorderLayout(0, 6));
contentPane.add(lineTypePane, BorderLayout.CENTER);
contentPane.add(lineWidthPane, BorderLayout.SOUTH);
return panel; return contentPane;
} }
protected void createLineStyle() { protected void createLineStyle() {
@ -85,25 +111,21 @@ public class VanChartLineTypePane extends BasicPane {
lineStyle = new UIButtonGroup<LineStyle>(textArray, LineStyle.values()); lineStyle = new UIButtonGroup<LineStyle>(textArray, LineStyle.values());
} }
protected Component[][] createContentComponent(Component[] lineTypeComponent, Component[] lineWidthComponent, protected Component[][] createContentComponent(Component[] lineStyleComponent, Component[] nullValueBreakComponent) {
Component[] lineStyleComponent, Component[] nullValueBreakComponent) {
return new Component[][]{ return new Component[][]{
new Component[]{null,null},
lineTypeComponent,
lineWidthComponent,
lineStyleComponent, lineStyleComponent,
nullValueBreakComponent nullValueBreakComponent
}; };
} }
private void checkLineWidth() { private void checkLineWidth() {
if (lineWidthSpinner != null && lineTypeComboBox != null) { if (lineWidthPane != null && lineTypeComboBox != null) {
lineWidthSpinner.setVisible(!ComparatorUtils.equals(lineTypeComboBox.getSelectedItem(), LineType.NONE)); lineWidthPane.setVisible(!ComparatorUtils.equals(lineTypeComboBox.getSelectedItem(), LineType.NONE));
} }
} }
public void checkLarge(boolean large){ public void checkLarge(boolean large) {
if(large){ if (large) {
lineTypeComboBox.setSelectedItem(LineType.NONE); lineTypeComboBox.setSelectedItem(LineType.NONE);
} }
lineTypeComboBox.setEnabled(!large); lineTypeComboBox.setEnabled(!large);

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

@ -9,10 +9,8 @@ public class VanChartLineWidthPane extends VanChartLineTypePane {
private static final long serialVersionUID = 4537158946119294689L; private static final long serialVersionUID = 4537158946119294689L;
@Override @Override
protected Component[][] createContentComponent(Component[] lineTypeComponent, Component[] lineWidthComponent, Component[] lineStyleComponent, Component[] nullValueBreakComponent) { protected Component[][] createContentComponent(Component[] lineStyleComponent, Component[] nullValueBreakComponent) {
return new Component[][]{ return new Component[][]{
lineTypeComponent,
lineWidthComponent,
nullValueBreakComponent nullValueBreakComponent
}; };
} }

5
designer-chart/src/main/java/com/fr/van/chart/scatter/component/VanChartScatterLineTypePane.java

@ -21,11 +21,8 @@ public class VanChartScatterLineTypePane extends VanChartLineTypePane {
} }
@Override @Override
protected Component[][] createContentComponent(Component[] lineTypeComponent, Component[] lineWidthComponent, Component[] lineStyleComponent, Component[] nullValueBreakComponent) { protected Component[][] createContentComponent(Component[] lineStyleComponent, Component[] nullValueBreakComponent) {
return new Component[][]{ return new Component[][]{
new Component[]{null, null},
lineTypeComponent,
lineWidthComponent,
lineStyleComponent lineStyleComponent
}; };
} }

Loading…
Cancel
Save