Browse Source

消除一波插件警告

feature/x
obo 1 year 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 xx = 0; xx < width; xx++) {
for (int yy = 0; yy < height; yy++) { for (int yy = 0; yy < height; yy++) {
int[] pixels = raster.getPixel(xx, yy, (int[]) null); int[] pixels = raster.getPixel(xx, yy, (int[]) null);
pixels[0] = pixels[0] > 0 && pixels[0] < 255 ? color.getRed() : 255;
if (pixels[0] > 0 && pixels[0] < 255) { pixels[1] = pixels[1] > 0 && pixels[1] < 255 ? color.getGreen() : 255;
pixels[0] = color.getRed(); pixels[2] = pixels[2] > 0 && pixels[2] < 255 ? color.getBlue() : 255;
} 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;
}
raster.setPixel(xx, yy, pixels); 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 java.awt.geom.Rectangle2D;
import static com.fr.design.i18n.Toolkit.i18nText; import static com.fr.design.i18n.Toolkit.i18nText;
import static com.fr.widgettheme.util.ThemePreviewPaneInitHelper.*;
/** /**
* 主题界面预览控frm界面,就是主jar里的那个界面做了简单的修改 * 主题界面预览控frm界面,就是主jar里的那个界面做了简单的修改
@ -129,7 +130,13 @@ public class WidgetDisplayFormThemePreviewPane extends TemplateThemePreviewPane<
private ChartCollection initColumnChart() { private ChartCollection initColumnChart() {
try { try {
VanChart chart = (VanChart) ChartTypeManager.getInstance().getCharts(VanChartColumnPlot.VAN_CHART_COLUMN_PLOT_ID)[0].clone(); 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 = { Object[] category = {
Toolkit.i18nText("Fine-Design_Chart_Category") + "1", Toolkit.i18nText("Fine-Design_Chart_Category") + "1",
Toolkit.i18nText("Fine-Design_Chart_Category") + "2", Toolkit.i18nText("Fine-Design_Chart_Category") + "2",
@ -153,48 +160,6 @@ public class WidgetDisplayFormThemePreviewPane extends TemplateThemePreviewPane<
} }
return null; 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; package com.fr.widgettheme.theme.panel;
import com.fr.base.BaseFormula;
import com.fr.base.background.ColorBackground; import com.fr.base.background.ColorBackground;
import com.fr.base.theme.ReportTheme; import com.fr.base.theme.ReportTheme;
import com.fr.chart.chartattr.ChartCollection; import com.fr.chart.chartattr.ChartCollection;
import com.fr.chart.chartattr.Title;
import com.fr.chart.chartdata.NormalChartData; import com.fr.chart.chartdata.NormalChartData;
import com.fr.chart.charttypes.ChartTypeManager; import com.fr.chart.charttypes.ChartTypeManager;
import com.fr.design.i18n.Toolkit; 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.design.mainframe.theme.preview.ChartPreviewPane;
import com.fr.general.Background; import com.fr.general.Background;
import com.fr.log.FineLoggerFactory; 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.column.VanChartColumnPlot;
import com.fr.plugin.chart.type.GradientType;
import com.fr.plugin.chart.vanchart.VanChart; import com.fr.plugin.chart.vanchart.VanChart;
import java.awt.BorderLayout; import java.awt.BorderLayout;
@ -26,6 +20,8 @@ import java.awt.Dimension;
import java.awt.Graphics2D; import java.awt.Graphics2D;
import java.awt.geom.Rectangle2D; import java.awt.geom.Rectangle2D;
import static com.fr.widgettheme.util.ThemePreviewPaneInitHelper.*;
/** /**
* 主题界面预览控cpt界面,就是主jar里的那个界面做了简单的修改 * 主题界面预览控cpt界面,就是主jar里的那个界面做了简单的修改
* *
@ -85,35 +81,10 @@ public class WidgetDisplayReportThemePreviewPane extends TemplateThemePreviewPan
private ChartCollection initColumnChart() { private ChartCollection initColumnChart() {
try { try {
VanChart chart = (VanChart) ChartTypeManager.getInstance().getCharts(VanChartColumnPlot.VAN_CHART_COLUMN_PLOT_ID)[0].clone(); VanChart chart = (VanChart) ChartTypeManager.getInstance().getCharts(VanChartColumnPlot.VAN_CHART_COLUMN_PLOT_ID)[0].clone();
VanChartTools vanChartTools = chart.getVanChartTools(); initVanChartsTools(chart.getVanChartTools());
vanChartTools.setSort(false);
vanChartTools.setExport(false);
vanChartTools.setFullScreen(false);
VanChartColumnPlot plot = chart.getPlot(); VanChartColumnPlot plot = chart.getPlot();
AttrLabel defaultAttrLabel = plot.getDefaultAttrLabel(); initPlot(plot);
defaultAttrLabel.setEnable(true); initVanChartYAxis(plot.getDefaultYAxis());
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"));
Object[] category = { Object[] category = {
Toolkit.i18nText("Fine-Design_Chart_Category") + "1", 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