Browse Source

CHART-9435 仪表盘字符大小自动处理

feature/big-screen
Qinghui.Liu 5 years ago
parent
commit
625dcd8f58
  1. 3
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrNoColorPane.java
  2. 3
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrNoFontSizePane.java
  3. 66
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPane.java
  4. 88
      designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeCateOrPercentLabelDetailPane.java
  5. 58
      designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeLabelDetailPane.java
  6. 44
      designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeValueLabelDetailPane.java
  7. 5
      designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartPlotLabelDetailPane.java

3
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrNoColorPane.java

@ -32,9 +32,10 @@ public class ChartTextAttrNoColorPane extends ChartTextAttrPane{
} }
protected void initComponents() { protected void initComponents() {
initFontSizes();
fontColor = new UIColorButton(); fontColor = new UIColorButton();
fontNameComboBox = new UIComboBox(Utils.getAvailableFontFamilyNames4Report()); fontNameComboBox = new UIComboBox(Utils.getAvailableFontFamilyNames4Report());
fontSizeComboBox = new UIComboBox(Font_Sizes); fontSizeComboBox = new UIComboBox(getFontSizes());
bold = new UIToggleButton(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/bold.png")); bold = new UIToggleButton(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/bold.png"));
italic = new UIToggleButton(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/italic.png")); italic = new UIToggleButton(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/italic.png"));

3
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrNoFontSizePane.java

@ -31,9 +31,10 @@ public class ChartTextAttrNoFontSizePane extends ChartTextAttrPane {
} }
protected void initComponents() { protected void initComponents() {
initFontSizes();
fontNameComboBox = new UIComboBox(Utils.getAvailableFontFamilyNames4Report()); fontNameComboBox = new UIComboBox(Utils.getAvailableFontFamilyNames4Report());
fontColor = new UIColorButton(); fontColor = new UIColorButton();
fontSizeComboBox = new UIComboBox(Font_Sizes); fontSizeComboBox = new UIComboBox(getFontSizes());
bold = new UIToggleButton(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/bold.png")); bold = new UIToggleButton(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/bold.png"));
italic = new UIToggleButton(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/italic.png")); italic = new UIToggleButton(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/italic.png"));

66
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPane.java

@ -3,6 +3,7 @@ package com.fr.design.mainframe.chart.gui.style;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.Utils; import com.fr.base.Utils;
import com.fr.chart.base.TextAttr; import com.fr.chart.base.TextAttr;
import com.fr.design.i18n.Toolkit;
import com.fr.design.constants.LayoutConstants; import com.fr.design.constants.LayoutConstants;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.design.event.UIObserverListener; import com.fr.design.event.UIObserverListener;
@ -12,6 +13,7 @@ import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.ComparatorUtils;
import com.fr.general.FRFont; import com.fr.general.FRFont;
import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.TableLayout4VanChartHelper;
@ -27,23 +29,49 @@ public class ChartTextAttrPane extends BasicPane {
private static final long serialVersionUID = 6731679928019436869L; private static final long serialVersionUID = 6731679928019436869L;
private static final int FONT_START = 6; private static final int FONT_START = 6;
private static final int FONT_END = 72; private static final int FONT_END = 72;
private static final String auto = Toolkit.i18nText("Fine-Design_Basic_ChartF_Auto");
private static final int autoSizeInt = 0;
private String[] fontSizes;
private boolean isFontSizeAuto;
protected UIComboBox fontNameComboBox; protected UIComboBox fontNameComboBox;
protected UIComboBox fontSizeComboBox; protected UIComboBox fontSizeComboBox;
protected UIToggleButton bold; protected UIToggleButton bold;
protected UIToggleButton italic; protected UIToggleButton italic;
protected UIColorButton fontColor; protected UIColorButton fontColor;
public static Integer[] Font_Sizes = new Integer[FONT_END-FONT_START+1];
static{
for(int i = FONT_START; i <= FONT_END; i++){
Font_Sizes [i - FONT_START] = new Integer(i);
}
}
public ChartTextAttrPane() { public ChartTextAttrPane() {
this.isFontSizeAuto = false;
initComponents(); initComponents();
} }
/** public ChartTextAttrPane(boolean isFontSizeAuto) {
* 标题 this.isFontSizeAuto = isFontSizeAuto;
initComponents();
}
public String[] getFontSizes() {
return fontSizes;
}
protected void initFontSizes() {
if (isFontSizeAuto) {
fontSizes = new String[FONT_END - FONT_START + 2];
fontSizes[0] = auto;
for (int i = 1; i < fontSizes.length; i++) {
fontSizes[i] = Utils.objectToString(i + FONT_START);
}
} else {
fontSizes = new String[FONT_END - FONT_START + 1];
for (int i = 0; i < fontSizes.length; i++) {
fontSizes[i] = Utils.objectToString(i + FONT_START);
}
}
}
/* 标题
* @return 标题 * @return 标题
*/ */
public String title4PopupWindow() { public String title4PopupWindow() {
@ -84,8 +112,12 @@ public class ChartTextAttrPane extends BasicPane {
fontNameComboBox.setSelectedItem(frFont.getFamily()); fontNameComboBox.setSelectedItem(frFont.getFamily());
bold.setSelected(frFont.isBold()); bold.setSelected(frFont.isBold());
italic.setSelected(frFont.isItalic()); italic.setSelected(frFont.isItalic());
if(fontSizeComboBox != null) { if (fontSizeComboBox != null) {
fontSizeComboBox.setSelectedItem(frFont.getSize()); if (frFont.getSize() == autoSizeInt) {
fontSizeComboBox.setSelectedItem(auto);
} else {
fontSizeComboBox.setSelectedItem(frFont.getSize() + "");
}
} }
if (fontColor != null) { if (fontColor != null) {
fontColor.setColor(frFont.getForeground()); fontColor.setColor(frFont.getForeground());
@ -108,10 +140,12 @@ public class ChartTextAttrPane extends BasicPane {
/** /**
* 更新字 * 更新字
*
* @return 更新字 * @return 更新字
*/ */
public FRFont updateFRFont() { public FRFont updateFRFont() {
int style = Font.PLAIN; int style = Font.PLAIN;
float size;
if (bold.isSelected() && !italic.isSelected()) { if (bold.isSelected() && !italic.isSelected()) {
style = Font.BOLD; style = Font.BOLD;
} else if (!bold.isSelected() && italic.isSelected()) { } else if (!bold.isSelected() && italic.isSelected()) {
@ -119,8 +153,13 @@ public class ChartTextAttrPane extends BasicPane {
} else if (bold.isSelected() && italic.isSelected()) { } else if (bold.isSelected() && italic.isSelected()) {
style = 3; style = 3;
} }
return FRFont.getInstance(Utils.objectToString(fontNameComboBox.getSelectedItem()), style, if (ComparatorUtils.equals(fontSizeComboBox.getSelectedItem(), auto)) {
Float.valueOf(Utils.objectToString(fontSizeComboBox.getSelectedItem())), fontColor.getColor()); size = Float.parseFloat(Utils.objectToString(autoSizeInt));
} else {
size = Float.parseFloat(Utils.objectToString(fontSizeComboBox.getSelectedItem()));
}
return FRFont.getInstance(Utils.objectToString(fontNameComboBox.getSelectedItem()), style, size, fontColor.getColor());
} }
public void setEnabled(boolean enabled) { public void setEnabled(boolean enabled) {
@ -132,8 +171,9 @@ public class ChartTextAttrPane extends BasicPane {
} }
protected void initComponents() { protected void initComponents() {
initFontSizes();
fontNameComboBox = new UIComboBox(Utils.getAvailableFontFamilyNames4Report()); fontNameComboBox = new UIComboBox(Utils.getAvailableFontFamilyNames4Report());
fontSizeComboBox = new UIComboBox(Font_Sizes); fontSizeComboBox = new UIComboBox(fontSizes);
fontColor = new UIColorButton(); fontColor = new UIColorButton();
bold = new UIToggleButton(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/bold.png")); bold = new UIToggleButton(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/bold.png"));
italic = new UIToggleButton(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/italic.png")); italic = new UIToggleButton(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/italic.png"));

88
designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeCateOrPercentLabelDetailPane.java

@ -1,9 +1,7 @@
package com.fr.van.chart.designer.style.label; package com.fr.van.chart.designer.style.label;
import com.fr.chart.chartattr.Plot; import com.fr.chart.chartattr.Plot;
import com.fr.design.gui.ilable.UILabel; import com.fr.general.ComparatorUtils;
import com.fr.design.layout.TableLayout;
import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane;
import com.fr.plugin.chart.type.GaugeStyle; import com.fr.plugin.chart.type.GaugeStyle;
import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import com.fr.van.chart.designer.component.label.LabelContentPaneWithCate; import com.fr.van.chart.designer.component.label.LabelContentPaneWithCate;
@ -11,14 +9,12 @@ import com.fr.van.chart.designer.component.label.LabelContentPaneWithPercent;
import com.fr.van.chart.designer.style.VanChartStylePane; import com.fr.van.chart.designer.style.VanChartStylePane;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.SwingConstants;
import java.awt.Component; import java.awt.Component;
/** /**
* 仪表盘的分类多指针时或者百分比标签 * 仪表盘的分类多指针时或者百分比标签
*/ */
public class VanChartGaugeCateOrPercentLabelDetailPane extends VanChartGaugeLabelDetailPane { public class VanChartGaugeCateOrPercentLabelDetailPane extends VanChartGaugeLabelDetailPane {
//todo 重新整理这个面板
private static final long serialVersionUID = 5176535960949074945L; private static final long serialVersionUID = 5176535960949074945L;
@ -27,15 +23,20 @@ public class VanChartGaugeCateOrPercentLabelDetailPane extends VanChartGaugeLabe
} }
protected double[] getLabelPaneRowSize(Plot plot, double p) { protected double[] getLabelPaneRowSize(Plot plot, double p) {
return hasLabelPosition(plot) ? new double[]{p,p,p} : new double[]{p,p}; if (hasLabelAlign(plot)) {
return new double[]{p, p, p, p};
}
if (hasLabelPosition(plot)) {
return new double[]{p, p, p};
}
return new double[]{p, p};
} }
protected void initToolTipContentPane(Plot plot) { protected void initToolTipContentPane(Plot plot) {
initGaugeStyle(plot); switch (getGaugeStyle()) {
switch (gaugeStyle){
case POINTER: case POINTER:
dataLabelContentPane = new LabelContentPaneWithCate(parent, VanChartGaugeCateOrPercentLabelDetailPane.this);
break;
case POINTER_SEMI: case POINTER_SEMI:
dataLabelContentPane = new LabelContentPaneWithCate(parent, VanChartGaugeCateOrPercentLabelDetailPane.this); dataLabelContentPane = new LabelContentPaneWithCate(parent, VanChartGaugeCateOrPercentLabelDetailPane.this);
break; break;
@ -45,13 +46,13 @@ public class VanChartGaugeCateOrPercentLabelDetailPane extends VanChartGaugeLabe
} }
} }
protected boolean getFontSizeAuto() {
return ComparatorUtils.equals(getGaugeStyle(), GaugeStyle.RING) || ComparatorUtils.equals(getGaugeStyle(), GaugeStyle.SLOT);
}
protected boolean hasLabelPosition(Plot plot) { protected boolean hasLabelPosition(Plot plot) {
initGaugeStyle(plot); switch (getGaugeStyle()) {
switch (gaugeStyle){
case RING: case RING:
return false;
case SLOT: case SLOT:
return false; return false;
default: default:
@ -60,67 +61,10 @@ public class VanChartGaugeCateOrPercentLabelDetailPane extends VanChartGaugeLabe
} }
protected double[] getLabelStyleRowSize(double p) { protected double[] getLabelStyleRowSize(double p) {
switch (gaugeStyle){ return new double[]{p, p};
case RING:
return new double[] {p, p};
case SLOT:
return new double[] {p, p};
default:
return new double[] {p};
}
} }
protected JPanel createTableLayoutPaneWithTitle(String title, Component component) { protected JPanel createTableLayoutPaneWithTitle(String title, Component component) {
return TableLayout4VanChartHelper.createTableLayoutPaneWithSmallTitle(title, component); return TableLayout4VanChartHelper.createTableLayoutPaneWithSmallTitle(title, component);
} }
protected Component[][] getLabelStyleComponents(Plot plot) {
initGaugeStyle(plot);
if (gaugeStyle == GaugeStyle.RING || gaugeStyle == GaugeStyle.SLOT) {
UILabel text = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Character"), SwingConstants.LEFT);
return new Component[][]{
new Component[]{text,style},
new Component[]{textFontPane,null},
};
} else {
return new Component[][]{
new Component[]{textFontPane, null},
};
}
}
protected ChartTextAttrPane initTextFontPane () {
//todo 需要再整理下
if (gaugeStyle == GaugeStyle.RING || gaugeStyle == GaugeStyle.SLOT){
return new ChartTextAttrPane(){
protected double[] getRowSize () {
double p = TableLayout.PREFERRED;
return new double[]{p, p};
}
protected Component[][] getComponents(JPanel buttonPane) {
return new Component[][]{
new Component[]{null, fontNameComboBox},
new Component[]{null, buttonPane}
};
}
};
} else {
return new ChartTextAttrPane(){
protected double[] getRowSize () {
double p = TableLayout.PREFERRED;
return new double[]{p, p};
}
protected Component[][] getComponents(JPanel buttonPane) {
UILabel text = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Character"), SwingConstants.LEFT);
return new Component[][]{
new Component[]{text, fontNameComboBox},
new Component[]{null, buttonPane}
};
}
};
}
}
} }

58
designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeLabelDetailPane.java

@ -21,25 +21,33 @@ import javax.swing.JPanel;
import javax.swing.SwingConstants; import javax.swing.SwingConstants;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Component; import java.awt.Component;
import java.awt.Dimension;
/** /**
* Created by mengao on 2017/8/13. * Created by mengao on 2017/8/13.
*/ */
public class VanChartGaugeLabelDetailPane extends VanChartPlotLabelDetailPane { public class VanChartGaugeLabelDetailPane extends VanChartPlotLabelDetailPane {
protected GaugeStyle gaugeStyle; private GaugeStyle gaugeStyle;
protected UIButtonGroup<Integer> align; private UIButtonGroup<Integer> align;
private JPanel alignPane; private JPanel alignPane;
protected Integer[] oldAlignValues; private Integer[] oldAlignValues;
public VanChartGaugeLabelDetailPane(Plot plot, VanChartStylePane parent) { public VanChartGaugeLabelDetailPane(Plot plot, VanChartStylePane parent) {
super(plot, parent); super(plot, parent);
} }
protected void initGaugeStyle(Plot plot) { protected void initLabelDetailPane(Plot plot) {
if (gaugeStyle == null) { setGaugeStyle(((VanChartGaugePlot) plot).getGaugeStyle());
gaugeStyle = ((VanChartGaugePlot) plot).getGaugeStyle(); super.initLabelDetailPane(plot);
} }
public GaugeStyle getGaugeStyle() {
return gaugeStyle;
}
public void setGaugeStyle(GaugeStyle gaugeStyle) {
this.gaugeStyle = gaugeStyle;
} }
protected JPanel createLabelStylePane(double[] row, double[] col, Plot plot) { protected JPanel createLabelStylePane(double[] row, double[] col, Plot plot) {
@ -52,8 +60,26 @@ public class VanChartGaugeLabelDetailPane extends VanChartPlotLabelDetailPane {
return TableLayoutHelper.createTableLayoutPane(getLabelStyleComponents(plot), row, col); return TableLayoutHelper.createTableLayoutPane(getLabelStyleComponents(plot), row, col);
} }
protected boolean getFontSizeAuto() {
return false;
}
protected ChartTextAttrPane initTextFontPane() { protected ChartTextAttrPane initTextFontPane() {
return new ChartTextAttrPane();
return new ChartTextAttrPane(getFontSizeAuto()) {
protected double[] getRowSize() {
double p = TableLayout.PREFERRED;
return new double[]{p, p};
}
protected Component[][] getComponents(JPanel buttonPane) {
UILabel text = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Character"), SwingConstants.LEFT);
return new Component[][]{
new Component[]{text, fontNameComboBox},
new Component[]{null, buttonPane}
};
}
};
} }
protected JPanel getLabelPositionPane(Component[][] comps, double[] row, double[] col) { protected JPanel getLabelPositionPane(Component[][] comps, double[] row, double[] col) {
@ -74,6 +100,7 @@ public class VanChartGaugeLabelDetailPane extends VanChartPlotLabelDetailPane {
new Component[]{createLabelStylePane(getLabelStyleRowSize(p), columnSize, plot), null}, new Component[]{createLabelStylePane(getLabelStyleRowSize(p), columnSize, plot), null},
}; };
} else { } else {
return super.getLabelPaneComponents(plot, p, columnSize); return super.getLabelPaneComponents(plot, p, columnSize);
} }
} }
@ -136,6 +163,12 @@ public class VanChartGaugeLabelDetailPane extends VanChartPlotLabelDetailPane {
return new TwoTuple<>(names, values); return new TwoTuple<>(names, values);
} }
protected Component[][] getLabelStyleComponents(Plot plot) {
return new Component[][]{
new Component[]{textFontPane, null},
};
}
protected void checkPane() { protected void checkPane() {
String verticalTitle = hasLabelAlign(getPlot()) String verticalTitle = hasLabelAlign(getPlot())
? Toolkit.i18nText("Fine-Design_Chart_Layout_Vertical") ? Toolkit.i18nText("Fine-Design_Chart_Layout_Vertical")
@ -145,13 +178,19 @@ public class VanChartGaugeLabelDetailPane extends VanChartPlotLabelDetailPane {
checkAlignPane(Toolkit.i18nText("Fine-Design_Chart_Layout_Horizontal")); checkAlignPane(Toolkit.i18nText("Fine-Design_Chart_Layout_Horizontal"));
} }
private boolean hasLabelAlign(Plot plot) { protected void checkStyleUse() {
textFontPane.setVisible(true);
textFontPane.setPreferredSize(new Dimension(0, 60));
}
protected boolean hasLabelAlign(Plot plot) {
return ComparatorUtils.equals(gaugeStyle, GaugeStyle.THERMOMETER) && !((VanChartGaugePlot) plot).getGaugeDetailStyle().isHorizontalLayout(); return ComparatorUtils.equals(gaugeStyle, GaugeStyle.THERMOMETER) && !((VanChartGaugePlot) plot).getGaugeDetailStyle().isHorizontalLayout();
} }
public void populate(AttrLabelDetail detail) { public void populate(AttrLabelDetail detail) {
super.populate(detail); super.populate(detail);
style.setSelectedIndex(1);
if (hasLabelAlign(this.getPlot()) && align != null) { if (hasLabelAlign(this.getPlot()) && align != null) {
align.setSelectedItem(detail.getAlign()); align.setSelectedItem(detail.getAlign());
} }
@ -160,6 +199,7 @@ public class VanChartGaugeLabelDetailPane extends VanChartPlotLabelDetailPane {
public void update(AttrLabelDetail detail) { public void update(AttrLabelDetail detail) {
super.update(detail); super.update(detail);
detail.setCustom(true);
if (align != null && align.getSelectedItem() != null) { if (align != null && align.getSelectedItem() != null) {
detail.setAlign(align.getSelectedItem()); detail.setAlign(align.getSelectedItem());
} else if (align != null) { } else if (align != null) {

44
designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeValueLabelDetailPane.java

@ -1,6 +1,8 @@
package com.fr.van.chart.designer.style.label; package com.fr.van.chart.designer.style.label;
import com.fr.chart.chartattr.Plot; import com.fr.chart.chartattr.Plot;
import com.fr.general.ComparatorUtils;
import com.fr.plugin.chart.type.GaugeStyle;
import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import com.fr.van.chart.designer.component.label.LabelContentPaneWithCateValue; import com.fr.van.chart.designer.component.label.LabelContentPaneWithCateValue;
import com.fr.van.chart.designer.component.label.LabelContentPaneWithOutCate; import com.fr.van.chart.designer.component.label.LabelContentPaneWithOutCate;
@ -20,11 +22,8 @@ public class VanChartGaugeValueLabelDetailPane extends VanChartGaugeLabelDetailP
} }
protected void initToolTipContentPane(Plot plot) { protected void initToolTipContentPane(Plot plot) {
initGaugeStyle(plot); switch (getGaugeStyle()) {
switch (gaugeStyle){
case POINTER: case POINTER:
dataLabelContentPane = new LabelContentPaneWithOutCate(parent, VanChartGaugeValueLabelDetailPane.this);
break;
case POINTER_SEMI: case POINTER_SEMI:
dataLabelContentPane = new LabelContentPaneWithOutCate(parent, VanChartGaugeValueLabelDetailPane.this); dataLabelContentPane = new LabelContentPaneWithOutCate(parent, VanChartGaugeValueLabelDetailPane.this);
break; break;
@ -35,10 +34,8 @@ public class VanChartGaugeValueLabelDetailPane extends VanChartGaugeLabelDetailP
} }
protected Component[][] getLabelPaneComponents(Plot plot, double p, double[] columnSize) { protected Component[][] getLabelPaneComponents(Plot plot, double p, double[] columnSize) {
initGaugeStyle(plot); switch (getGaugeStyle()) {
switch (gaugeStyle){
case POINTER: case POINTER:
return getLabelPaneComponentsWithBackground(plot, p, columnSize);
case POINTER_SEMI: case POINTER_SEMI:
return getLabelPaneComponentsWithBackground(plot, p, columnSize); return getLabelPaneComponentsWithBackground(plot, p, columnSize);
default: default:
@ -47,43 +44,32 @@ public class VanChartGaugeValueLabelDetailPane extends VanChartGaugeLabelDetailP
} }
private Component[][] getLabelPaneComponentsWithBackground(Plot plot, double p, double[] columnSize) { private Component[][] getLabelPaneComponentsWithBackground(Plot plot, double p, double[] columnSize) {
return new Component[][]{ return new Component[][]{
new Component[]{dataLabelContentPane,null}, new Component[]{dataLabelContentPane, null},
new Component[]{createLabelStylePane(new double[]{p}, columnSize, plot),null}, new Component[]{createLabelStylePane(new double[]{p}, columnSize, plot), null},
new Component[]{createBackgroundColorPane(),null}, new Component[]{createBackgroundColorPane(), null},
}; };
} }
protected double[] getLabelPaneRowSize(Plot plot, double p) { protected double[] getLabelPaneRowSize(Plot plot, double p) {
initGaugeStyle(plot); switch (getGaugeStyle()) {
switch (gaugeStyle){
case POINTER: case POINTER:
return new double[]{p,p,p,p,p};
case POINTER_SEMI: case POINTER_SEMI:
return new double[]{p,p,p,p,p}; return new double[]{p, p, p, p, p};
default: default:
return super.getLabelPaneRowSize(plot, p); return super.getLabelPaneRowSize(plot, p);
} }
} }
protected boolean getFontSizeAuto() {
return !ComparatorUtils.equals(getGaugeStyle(), GaugeStyle.THERMOMETER);
}
protected boolean hasLabelPosition(Plot plot) { protected boolean hasLabelPosition(Plot plot) {
initGaugeStyle(plot); return getGaugeStyle() == GaugeStyle.THERMOMETER;
switch (gaugeStyle){
case THERMOMETER:
return true;
default:
return false;
}
} }
protected JPanel createTableLayoutPaneWithTitle(String title, Component component) { protected JPanel createTableLayoutPaneWithTitle(String title, Component component) {
return TableLayout4VanChartHelper.createTableLayoutPaneWithSmallTitle(title, component); return TableLayout4VanChartHelper.createTableLayoutPaneWithSmallTitle(title, component);
} }
protected Component[][] getLabelStyleComponents(Plot plot) {
return new Component[][]{
new Component[]{textFontPane,null},
};
}
} }

5
designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartPlotLabelDetailPane.java

@ -59,7 +59,10 @@ public class VanChartPlotLabelDetailPane extends BasicPane {
public VanChartPlotLabelDetailPane(Plot plot, VanChartStylePane parent) { public VanChartPlotLabelDetailPane(Plot plot, VanChartStylePane parent) {
this.parent = parent; this.parent = parent;
this.plot = plot; this.plot = plot;
initLabelDetailPane(plot);
}
protected void initLabelDetailPane (Plot plot) {
this.setLayout(new BorderLayout()); this.setLayout(new BorderLayout());
initToolTipContentPane(plot); initToolTipContentPane(plot);
JPanel contentPane = createLabelPane(plot); JPanel contentPane = createLabelPane(plot);
@ -269,7 +272,7 @@ public class VanChartPlotLabelDetailPane extends BasicPane {
checkPositionEnabled(); checkPositionEnabled();
} }
private void checkStyleUse() { protected void checkStyleUse() {
textFontPane.setVisible(style.getSelectedIndex() == 1); textFontPane.setVisible(style.getSelectedIndex() == 1);
textFontPane.setPreferredSize(style.getSelectedIndex() == 1 ? new Dimension(0, 60) : new Dimension(0, 0)); textFontPane.setPreferredSize(style.getSelectedIndex() == 1 ? new Dimension(0, 60) : new Dimension(0, 0));
} }

Loading…
Cancel
Save