Browse Source

CHART-15010

feature/big-screen
白岳 4 years ago
parent
commit
5340b0f3b5
  1. 98
      designer-chart/src/main/java/com/fr/van/chart/gauge/VanChartGaugeSeriesPane.java
  2. 3
      designer-chart/src/main/java/com/fr/van/chart/map/VanChartMapSeriesPane.java

98
designer-chart/src/main/java/com/fr/van/chart/gauge/VanChartGaugeSeriesPane.java

@ -21,6 +21,7 @@ import com.fr.plugin.chart.gauge.VanChartGaugePlot;
import com.fr.plugin.chart.type.GaugeStyle;
import com.fr.stable.Constants;
import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import com.fr.van.chart.designer.component.VanChartBeautyPane;
import com.fr.van.chart.designer.style.series.VanChartAbstractPlotSeriesPane;
import javax.swing.JPanel;
@ -61,22 +62,16 @@ public class VanChartGaugeSeriesPane extends VanChartAbstractPlotSeriesPane {
double f = TableLayout.FILL;
double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH;
double[] columnSize = {f};
double[] rowSize = {p, p, p, p, p, p};
double[] rowSize = {p,p,p,p,p,p};
Component[][] components = new Component[][]{
new Component[]{createGaugeLayoutPane()},
new Component[]{createGaugeStylePane(rowSize, new double[]{f, e})},
new Component[]{createGaugeStylePane(rowSize, new double[]{f,e})},
new Component[]{createGaugeBandsPane()}
};
return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
}
//获取颜色面板
protected JPanel getColorPane() {
JPanel panel = new JPanel(new BorderLayout());
return panel;
}
private JPanel createGaugeLayoutPane() {
gaugeLayout = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_Direction_Horizontal"), Toolkit.i18nText("Fine-Design_Chart_Direction_Vertical")});
@ -101,20 +96,20 @@ public class VanChartGaugeSeriesPane extends VanChartAbstractPlotSeriesPane {
}
private void changeLabelPosition() {
if (plot instanceof VanChartGaugePlot) {
VanChartGaugePlot gaugePlot = (VanChartGaugePlot) plot;
if (ComparatorUtils.equals(gaugePlot.getGaugeStyle(), GaugeStyle.THERMOMETER)) {
if(plot instanceof VanChartGaugePlot){
VanChartGaugePlot gaugePlot = (VanChartGaugePlot)plot;
if (ComparatorUtils.equals(gaugePlot.getGaugeStyle(), GaugeStyle.THERMOMETER)){
ConditionAttr attrList = gaugePlot.getConditionCollection().getDefaultAttr();
AttrLabel attrLabel = (AttrLabel) attrList.getExisted(AttrLabel.class);
if (attrLabel == null) {
AttrLabel attrLabel = (AttrLabel)attrList.getExisted(AttrLabel.class);
if(attrLabel == null){
return;
}
AttrLabelDetail attrLabelDetail = attrLabel.getAttrLabelDetail();
if (attrLabelDetail == null || attrLabelDetail.getTextAttr() == null) {
if(attrLabelDetail == null || attrLabelDetail.getTextAttr() == null){
return;
}
attrLabelDetail.getTextAttr().setFRFont(VanChartGaugePlot.THERMOMETER_LABEL_FONT);
if (gaugeLayout.getSelectedIndex() == 0) {
if(gaugeLayout.getSelectedIndex() == 0){
attrLabel.getAttrLabelDetail().setPosition(Constants.LEFT);
attrLabel.getGaugeValueLabelDetail().setPosition(Constants.LEFT);
} else {
@ -129,7 +124,7 @@ public class VanChartGaugeSeriesPane extends VanChartAbstractPlotSeriesPane {
JPanel panel = new JPanel(new BorderLayout(0, 6));
JPanel centerPanel = TableLayoutHelper.createTableLayoutPane(getDiffComponentsWithGaugeStyle(), row, col);
panel.add(centerPanel, BorderLayout.CENTER);
if (rotate != null) {
if(rotate != null){
JPanel panel1 = TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Rotation_Direction"), rotate);
panel.add(panel1, BorderLayout.NORTH);
}
@ -137,7 +132,7 @@ public class VanChartGaugeSeriesPane extends VanChartAbstractPlotSeriesPane {
}
private Component[][] getDiffComponentsWithGaugeStyle() {
GaugeStyle style = plot == null ? GaugeStyle.POINTER : ((VanChartGaugePlot) plot).getGaugeStyle();
GaugeStyle style = plot == null ? GaugeStyle.POINTER : ((VanChartGaugePlot)plot).getGaugeStyle();
switch (style) {
case RING:
initRotate();
@ -178,37 +173,37 @@ public class VanChartGaugeSeriesPane extends VanChartAbstractPlotSeriesPane {
private Component[] getHingeColor() {
hingeColor = new ColorSelectBox(120);
return new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Hinge")), hingeColor};
return new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Hinge")),hingeColor};
}
private Component[] getHingeBackgroundColor() {
hingeBackgroundColor = new ColorSelectBox(120);
return new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Hinge_Background")), hingeBackgroundColor};
return new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Hinge_Background")),hingeBackgroundColor};
}
private Component[] getNeedleColor() {
needleColor = new ColorSelectBox(120);
return new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Needle")), needleColor};
return new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Needle")),needleColor};
}
private Component[] getPaneBackgroundColor() {
paneBackgroundColor = new ColorSelectBox(120);
return new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Pane_Background")), paneBackgroundColor};
return new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Pane_Background")),paneBackgroundColor};
}
private Component[] getSlotBackgroundColor() {
slotBackgroundColor = new ColorSelectBox(120);
return new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Slot_Background")), slotBackgroundColor};
return new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Slot_Background")),slotBackgroundColor};
}
private Component[] getThermometerWidth() {
thermometerWidth = new UISpinner(0, Double.MAX_VALUE, 0.1, 10);
return new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Thermometer_Width")), thermometerWidth};
return new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Thermometer_Width")),thermometerWidth};
}
private Component[] getChutePercent() {
chutePercent = new UINumberDragPane(0, 100, 1);
return new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Chute_Percent")), chutePercent};
return new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Chute_Percent")),chutePercent};
}
private void initRotate() {
@ -217,7 +212,7 @@ public class VanChartGaugeSeriesPane extends VanChartAbstractPlotSeriesPane {
private Component[] getInnerPaneBackgroundColor() {
innerPaneBackgroundColor = new ColorSelectBox(120);
return new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Inner_Pane_Background")), innerPaneBackgroundColor};
return new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Inner_Pane_Background")),innerPaneBackgroundColor};
}
private JPanel createGaugeBandsPane() {
@ -227,40 +222,40 @@ public class VanChartGaugeSeriesPane extends VanChartAbstractPlotSeriesPane {
public void populateBean(Plot plot) {
if (plot == null) {
if(plot == null) {
return;
}
super.populateBean(plot);
if (plot instanceof VanChartGaugePlot) {
VanChartGaugePlot gaugePlot = (VanChartGaugePlot) plot;
if(plot instanceof VanChartGaugePlot){
VanChartGaugePlot gaugePlot = (VanChartGaugePlot)plot;
GaugeDetailStyle detailStyle = gaugePlot.getGaugeDetailStyle();
gaugeLayout.setSelectedIndex(detailStyle.isHorizontalLayout() ? 0 : 1);
if (hingeColor != null) {
if(hingeColor != null){
hingeColor.setSelectObject(detailStyle.getHingeColor());
}
if (hingeBackgroundColor != null) {
if(hingeBackgroundColor != null){
hingeBackgroundColor.setSelectObject(detailStyle.getHingeBackgroundColor());
}
if (needleColor != null) {
if(needleColor != null){
needleColor.setSelectObject(detailStyle.getNeedleColor());
}
if (paneBackgroundColor != null) {
if(paneBackgroundColor != null){
paneBackgroundColor.setSelectObject(detailStyle.getPaneBackgroundColor());
}
if (slotBackgroundColor != null) {
if(slotBackgroundColor != null){
slotBackgroundColor.setSelectObject(detailStyle.getSlotBackgroundColor());
}
if (rotate != null) {
if(rotate != null){
rotate.setSelectedIndex(detailStyle.isAntiClockWise() ? 0 : 1);
}
if (innerPaneBackgroundColor != null) {
if(innerPaneBackgroundColor != null){
innerPaneBackgroundColor.setSelectObject(detailStyle.getInnerPaneBackgroundColor());
}
if (thermometerWidth != null) {
if(thermometerWidth != null){
thermometerWidth.setValue(detailStyle.getThermometerWidth());
}
if (chutePercent != null) {
if(chutePercent != null){
chutePercent.populateBean(detailStyle.getChutePercent());
}
@ -270,45 +265,50 @@ public class VanChartGaugeSeriesPane extends VanChartAbstractPlotSeriesPane {
@Override
public void updateBean(Plot plot) {
if (plot == null) {
if(plot == null){
return;
}
super.updateBean(plot);
if (plot instanceof VanChartGaugePlot) {
VanChartGaugePlot gaugePlot = (VanChartGaugePlot) plot;
if(plot instanceof VanChartGaugePlot){
VanChartGaugePlot gaugePlot = (VanChartGaugePlot)plot;
GaugeDetailStyle detailStyle = gaugePlot.getGaugeDetailStyle();
detailStyle.setHorizontalLayout(gaugeLayout.getSelectedIndex() == 0);
if (hingeColor != null) {
if(hingeColor != null){
detailStyle.setHingeColor(hingeColor.getSelectObject());
}
if (hingeBackgroundColor != null) {
if(hingeBackgroundColor != null){
detailStyle.setHingeBackgroundColor(hingeBackgroundColor.getSelectObject());
}
if (needleColor != null) {
if(needleColor != null){
detailStyle.setNeedleColor(needleColor.getSelectObject());
}
if (paneBackgroundColor != null) {
if(paneBackgroundColor != null){
detailStyle.setPaneBackgroundColor(paneBackgroundColor.getSelectObject());
}
if (slotBackgroundColor != null) {
if(slotBackgroundColor != null){
detailStyle.setSlotBackgroundColor(slotBackgroundColor.getSelectObject());
}
if (rotate != null) {
if(rotate != null){
detailStyle.setAntiClockWise(rotate.getSelectedIndex() == 0);
}
if (innerPaneBackgroundColor != null) {
if(innerPaneBackgroundColor != null){
detailStyle.setInnerPaneBackgroundColor(innerPaneBackgroundColor.getSelectObject());
}
if (thermometerWidth != null) {
if(thermometerWidth != null){
detailStyle.setThermometerWidth(thermometerWidth.getValue());
}
if (chutePercent != null) {
if(chutePercent != null){
detailStyle.setChutePercent(chutePercent.updateBean());
}
colorPickerPane.updateBean(detailStyle.getHotAreaColor());
}
}
@Override
protected VanChartBeautyPane createStylePane() {
return null;
}
}

3
designer-chart/src/main/java/com/fr/van/chart/map/VanChartMapSeriesPane.java

@ -158,7 +158,7 @@ public class VanChartMapSeriesPane extends VanChartColorValueSeriesPane {
markerTypeCom.setModel(new DefaultComboBoxModel(largeModel ? LARGE_MARKER_TYPES : MARKER_TYPES));
if (ComparatorUtils.equals(MapMarkerType.IMAGE.toLocalString(), selectedItem) && largeModel) {
markerTypeCom.setSelectedItem(MapMarkerType.COMMON.toLocalString());
}else{
} else {
markerTypeCom.setSelectedItem(selectedItem);
}
}
@ -380,6 +380,7 @@ public class VanChartMapSeriesPane extends VanChartColorValueSeriesPane {
} else {
panel = createMapCustomGroupPane(areaPane, pointPane, linePane);
}
panel.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 0));
return panel;
}

Loading…
Cancel
Save