Browse Source

消除一波插件警告

feature/x
obo 12 months ago
parent
commit
835936bd23
  1. 21
      designer-base/src/main/java/com/fr/widgettheme/theme/panel/ImageUtils.java
  2. 51
      designer-base/src/main/java/com/fr/widgettheme/theme/panel/WidgetDisplayFormThemePreviewPane.java
  3. 39
      designer-base/src/main/java/com/fr/widgettheme/theme/panel/WidgetDisplayReportThemePreviewPane.java
  4. 54
      designer-base/src/main/java/com/fr/widgettheme/util/ThemePreviewPaneInitHelper.java

21
designer-base/src/main/java/com/fr/widgettheme/theme/panel/ImageUtils.java

@ -30,24 +30,9 @@ public class ImageUtils {
for (int xx = 0; xx < width; xx++) {
for (int yy = 0; yy < height; yy++) {
int[] pixels = raster.getPixel(xx, yy, (int[]) null);
if (pixels[0] > 0 && pixels[0] < 255) {
pixels[0] = color.getRed();
} else {
pixels[0] = 255;
}
if (pixels[1] > 0 && pixels[1] < 255) {
pixels[1] = color.getGreen();
} else {
pixels[1] = 255;
}
if (pixels[2] > 0 && pixels[2] < 255) {
pixels[2] = color.getBlue();
} else {
pixels[2] = 255;
}
pixels[0] = pixels[0] > 0 && pixels[0] < 255 ? color.getRed() : 255;
pixels[1] = pixels[1] > 0 && pixels[1] < 255 ? color.getGreen() : 255;
pixels[2] = pixels[2] > 0 && pixels[2] < 255 ? color.getBlue() : 255;
raster.setPixel(xx, yy, pixels);
}
}

51
designer-base/src/main/java/com/fr/widgettheme/theme/panel/WidgetDisplayFormThemePreviewPane.java

@ -36,6 +36,7 @@ import java.awt.Graphics2D;
import java.awt.geom.Rectangle2D;
import static com.fr.design.i18n.Toolkit.i18nText;
import static com.fr.widgettheme.util.ThemePreviewPaneInitHelper.*;
/**
* 主题界面预览控frm界面,就是主jar里的那个界面做了简单的修改
@ -129,7 +130,13 @@ public class WidgetDisplayFormThemePreviewPane extends TemplateThemePreviewPane<
private ChartCollection initColumnChart() {
try {
VanChart chart = (VanChart) ChartTypeManager.getInstance().getCharts(VanChartColumnPlot.VAN_CHART_COLUMN_PLOT_ID)[0].clone();
initChart(chart);
chart.getTitle().setTitleVisible(false);
initVanChartsTools(chart.getVanChartTools());
VanChartColumnPlot plot = chart.getPlot();
//Form中独有的setPosition,和Report中不同,先单独放在这里,不写在initPlot中
plot.getLegend().setPosition(Constants.TOP);
initPlot(plot);
initVanChartYAxis(plot.getDefaultYAxis());
Object[] category = {
Toolkit.i18nText("Fine-Design_Chart_Category") + "1",
Toolkit.i18nText("Fine-Design_Chart_Category") + "2",
@ -153,48 +160,6 @@ public class WidgetDisplayFormThemePreviewPane extends TemplateThemePreviewPane<
}
return null;
}
private void initChart(VanChart chart) {
chart.getTitle().setTitleVisible(false);
initVanChartsTools(chart.getVanChartTools());
VanChartColumnPlot plot = chart.getPlot();
AttrLabel defaultAttrLabel = plot.getDefaultAttrLabel();
initDefaultAttrLabel(defaultAttrLabel);
initPlot(plot);
plot.getConditionCollection().getDefaultAttr().addDataSeriesCondition(defaultAttrLabel);
VanChartAxis defaultYAxis = plot.getDefaultYAxis();
Title title = new Title();
title.setTextObject(Toolkit.i18nText("Fine-Design_Chart_Axis_Title"));
title.getTextAttr().setRotation(-90);
title.getTextAttr().setThemed(true);
defaultYAxis.setTitle(title);
defaultYAxis.setShowAxisTitle(true);
defaultYAxis.setCustomMaxValue(true);
defaultYAxis.setCustomMinValue(true);
defaultYAxis.setCustomMainUnit(true);
defaultYAxis.setMaxValue(BaseFormula.createFormulaBuilder().build("=600"));
defaultYAxis.setMinValue(BaseFormula.createFormulaBuilder().build("=0"));
defaultYAxis.setMainUnit(BaseFormula.createFormulaBuilder().build("=200"));
}
private void initVanChartsTools(VanChartTools vanChartTools) {
vanChartTools.setSort(false);
vanChartTools.setExport(false);
vanChartTools.setFullScreen(false);
}
private void initDefaultAttrLabel(AttrLabel defaultAttrLabel) {
defaultAttrLabel.setEnable(true);
defaultAttrLabel.getAttrLabelDetail().getBorder().setBorderStyle(0);
defaultAttrLabel.getAttrLabelDetail().getBackground().setBackground(null);
}
private void initPlot(VanChartColumnPlot plot) {
plot.getLegend().setPosition(Constants.TOP);
plot.getGradientStyle().setGradientType(GradientType.NONE);
plot.setSeriesOverlapPercent(30);
plot.setCategoryIntervalPercent(30);
}
/**
* 初始化饼图
*

39
designer-base/src/main/java/com/fr/widgettheme/theme/panel/WidgetDisplayReportThemePreviewPane.java

@ -1,10 +1,8 @@
package com.fr.widgettheme.theme.panel;
import com.fr.base.BaseFormula;
import com.fr.base.background.ColorBackground;
import com.fr.base.theme.ReportTheme;
import com.fr.chart.chartattr.ChartCollection;
import com.fr.chart.chartattr.Title;
import com.fr.chart.chartdata.NormalChartData;
import com.fr.chart.charttypes.ChartTypeManager;
import com.fr.design.i18n.Toolkit;
@ -13,11 +11,7 @@ import com.fr.design.mainframe.theme.TemplateThemePreviewPane;
import com.fr.design.mainframe.theme.preview.ChartPreviewPane;
import com.fr.general.Background;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.chart.attr.axis.VanChartAxis;
import com.fr.plugin.chart.base.AttrLabel;
import com.fr.plugin.chart.base.VanChartTools;
import com.fr.plugin.chart.column.VanChartColumnPlot;
import com.fr.plugin.chart.type.GradientType;
import com.fr.plugin.chart.vanchart.VanChart;
import java.awt.BorderLayout;
@ -26,6 +20,8 @@ import java.awt.Dimension;
import java.awt.Graphics2D;
import java.awt.geom.Rectangle2D;
import static com.fr.widgettheme.util.ThemePreviewPaneInitHelper.*;
/**
* 主题界面预览控cpt界面,就是主jar里的那个界面做了简单的修改
*
@ -85,35 +81,10 @@ public class WidgetDisplayReportThemePreviewPane extends TemplateThemePreviewPan
private ChartCollection initColumnChart() {
try {
VanChart chart = (VanChart) ChartTypeManager.getInstance().getCharts(VanChartColumnPlot.VAN_CHART_COLUMN_PLOT_ID)[0].clone();
VanChartTools vanChartTools = chart.getVanChartTools();
vanChartTools.setSort(false);
vanChartTools.setExport(false);
vanChartTools.setFullScreen(false);
initVanChartsTools(chart.getVanChartTools());
VanChartColumnPlot plot = chart.getPlot();
AttrLabel defaultAttrLabel = plot.getDefaultAttrLabel();
defaultAttrLabel.setEnable(true);
defaultAttrLabel.getAttrLabelDetail().getBorder().setBorderStyle(0);
defaultAttrLabel.getAttrLabelDetail().getBackground().setBackground(null);
plot.getConditionCollection().getDefaultAttr().addDataSeriesCondition(defaultAttrLabel);
plot.getGradientStyle().setGradientType(GradientType.NONE);
plot.setSeriesOverlapPercent(30);
plot.setCategoryIntervalPercent(30);
VanChartAxis defaultYAxis = plot.getDefaultYAxis();
Title title = new Title();
title.setTextObject(Toolkit.i18nText("Fine-Design_Chart_Axis_Title"));
title.getTextAttr().setRotation(-90);
title.getTextAttr().setThemed(true);
defaultYAxis.setTitle(title);
defaultYAxis.setShowAxisTitle(true);
defaultYAxis.setCustomMaxValue(true);
defaultYAxis.setCustomMinValue(true);
defaultYAxis.setCustomMainUnit(true);
defaultYAxis.setMaxValue(BaseFormula.createFormulaBuilder().build("=600"));
defaultYAxis.setMinValue(BaseFormula.createFormulaBuilder().build("=0"));
defaultYAxis.setMainUnit(BaseFormula.createFormulaBuilder().build("=200"));
initPlot(plot);
initVanChartYAxis(plot.getDefaultYAxis());
Object[] category = {
Toolkit.i18nText("Fine-Design_Chart_Category") + "1",

54
designer-base/src/main/java/com/fr/widgettheme/util/ThemePreviewPaneInitHelper.java

@ -0,0 +1,54 @@
package com.fr.widgettheme.util;
import com.fr.base.BaseFormula;
import com.fr.chart.chartattr.Title;
import com.fr.design.i18n.Toolkit;
import com.fr.plugin.chart.attr.axis.VanChartAxis;
import com.fr.plugin.chart.base.AttrLabel;
import com.fr.plugin.chart.base.VanChartTools;
import com.fr.plugin.chart.column.VanChartColumnPlot;
import com.fr.plugin.chart.type.GradientType;
/**
* 辅助report和form的控件显示主题预览窗口做初始化工作
* 没有其他的用途不要用在其他的地方只是抽一些方法出来降低复杂度
*
* @author obo
* @since 11.0
* Created on 2023/11/14
*/
public class ThemePreviewPaneInitHelper {
private ThemePreviewPaneInitHelper() {
}
public static void initVanChartsTools(VanChartTools vanChartTools) {
vanChartTools.setSort(false);
vanChartTools.setExport(false);
vanChartTools.setFullScreen(false);
}
public static void initPlot(VanChartColumnPlot plot) {
AttrLabel defaultAttrLabel = plot.getDefaultAttrLabel();
defaultAttrLabel.setEnable(true);
defaultAttrLabel.getAttrLabelDetail().getBorder().setBorderStyle(0);
defaultAttrLabel.getAttrLabelDetail().getBackground().setBackground(null);
plot.getConditionCollection().getDefaultAttr().addDataSeriesCondition(defaultAttrLabel);
plot.getGradientStyle().setGradientType(GradientType.NONE);
plot.setSeriesOverlapPercent(30);
plot.setCategoryIntervalPercent(30);
}
public static void initVanChartYAxis(VanChartAxis yAxis) {
Title title = new Title();
title.setTextObject(Toolkit.i18nText("Fine-Design_Chart_Axis_Title"));
title.getTextAttr().setRotation(-90);
title.getTextAttr().setThemed(true);
yAxis.setTitle(title);
yAxis.setShowAxisTitle(true);
yAxis.setCustomMaxValue(true);
yAxis.setCustomMinValue(true);
yAxis.setCustomMainUnit(true);
yAxis.setMaxValue(BaseFormula.createFormulaBuilder().build("=600"));
yAxis.setMinValue(BaseFormula.createFormulaBuilder().build("=0"));
yAxis.setMainUnit(BaseFormula.createFormulaBuilder().build("=200"));
}
}
Loading…
Cancel
Save