Browse Source

消除一波插件警告

feature/x
obo 1 year ago
parent
commit
76a586fdf7
  1. 14
      designer-base/src/main/java/com/fr/widgettheme/theme/panel/ImageUtils.java
  2. 31
      designer-base/src/main/java/com/fr/widgettheme/theme/panel/WidgetDisplayFormThemePreviewPane.java
  3. 17
      designer-base/src/main/java/com/fr/widgettheme/theme/panel/WidgetDisplayReportThemePreviewPane.java
  4. 18
      designer-base/src/main/java/com/fr/widgettheme/util/ThemePreviewPaneInitHelper.java

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

@ -29,16 +29,20 @@ 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);
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);
dealRasterPixels(raster, xx, yy, color);
}
}
return image;
}
private static void dealRasterPixels(WritableRaster raster, int x, int y, Color color) {
int[] pixels = raster.getPixel(x, y, (int[]) null);
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(x, y, pixels);
}
/**
* ImageIcon转换为BufferImage
*

31
designer-base/src/main/java/com/fr/widgettheme/theme/panel/WidgetDisplayFormThemePreviewPane.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.FormTheme;
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;
@ -16,8 +14,6 @@ import com.fr.general.Background;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.chart.PiePlot4VanChart;
import com.fr.plugin.chart.attr.VanChartLegend;
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;
@ -36,7 +32,9 @@ import java.awt.Graphics2D;
import java.awt.geom.Rectangle2D;
import static com.fr.design.i18n.Toolkit.i18nText;
import static com.fr.widgettheme.util.ThemePreviewPaneInitHelper.*;
import static com.fr.widgettheme.util.ThemePreviewPaneInitHelper.initColumnPlot;
import static com.fr.widgettheme.util.ThemePreviewPaneInitHelper.initVanChartYAxis;
import static com.fr.widgettheme.util.ThemePreviewPaneInitHelper.initVanChartsTools;
/**
* 主题界面预览控frm界面,就是主jar里的那个界面做了简单的修改
@ -77,7 +75,7 @@ public class WidgetDisplayFormThemePreviewPane extends TemplateThemePreviewPane<
}
};
columnChartPanel.setLayout(new BorderLayout());
columnChartPreviewPane = createChartPreviewPane(initColumnChart(), i18nText("Fine-Design_Basic_Template_Theme_Profile_Pane_Comp_Title1"));
columnChartPreviewPane = createChartPreviewPane(initColumnChart(), i18nText("Fine-Design_Basic_Template_Theme_Profile_Pane_Comp_Title1"));
columnChartPanel.add(columnChartPreviewPane, BorderLayout.CENTER);
JPanel pieChartPanel = new UINoOpaquePanel() {
@ -86,7 +84,7 @@ public class WidgetDisplayFormThemePreviewPane extends TemplateThemePreviewPane<
}
};
pieChartPanel.setLayout(new BorderLayout());
pieChartPreviewPane = createChartPreviewPane(initPieChart(), i18nText("Fine-Design_Basic_Template_Theme_Profile_Pane_Comp_Title2"));
pieChartPreviewPane = createChartPreviewPane(initPieChart(), i18nText("Fine-Design_Basic_Template_Theme_Profile_Pane_Comp_Title2"));
pieChartPanel.add(pieChartPreviewPane, BorderLayout.CENTER);
chartContent.add(columnChartPanel, BorderLayout.CENTER);
chartContent.add(pieChartPanel, BorderLayout.EAST);
@ -130,13 +128,7 @@ public class WidgetDisplayFormThemePreviewPane extends TemplateThemePreviewPane<
private ChartCollection initColumnChart() {
try {
VanChart chart = (VanChart) ChartTypeManager.getInstance().getCharts(VanChartColumnPlot.VAN_CHART_COLUMN_PLOT_ID)[0].clone();
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());
initColumnChartDetail(chart);
Object[] category = {
Toolkit.i18nText("Fine-Design_Chart_Category") + "1",
Toolkit.i18nText("Fine-Design_Chart_Category") + "2",
@ -160,6 +152,17 @@ public class WidgetDisplayFormThemePreviewPane extends TemplateThemePreviewPane<
}
return null;
}
private void initColumnChartDetail(VanChart chart) {
chart.getTitle().setTitleVisible(false);
initVanChartsTools(chart.getVanChartTools());
VanChartColumnPlot plot = chart.getPlot();
//Form中独有的setPosition,和Report中不同,先单独放在这里,不写在initPlot中
plot.getLegend().setPosition(Constants.TOP);
initColumnPlot(plot);
initVanChartYAxis(plot.getDefaultYAxis());
}
/**
* 初始化饼图
*

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

@ -20,7 +20,9 @@ import java.awt.Dimension;
import java.awt.Graphics2D;
import java.awt.geom.Rectangle2D;
import static com.fr.widgettheme.util.ThemePreviewPaneInitHelper.*;
import static com.fr.widgettheme.util.ThemePreviewPaneInitHelper.initColumnPlot;
import static com.fr.widgettheme.util.ThemePreviewPaneInitHelper.initVanChartYAxis;
import static com.fr.widgettheme.util.ThemePreviewPaneInitHelper.initVanChartsTools;
/**
* 主题界面预览控cpt界面,就是主jar里的那个界面做了简单的修改
@ -81,11 +83,7 @@ public class WidgetDisplayReportThemePreviewPane extends TemplateThemePreviewPan
private ChartCollection initColumnChart() {
try {
VanChart chart = (VanChart) ChartTypeManager.getInstance().getCharts(VanChartColumnPlot.VAN_CHART_COLUMN_PLOT_ID)[0].clone();
initVanChartsTools(chart.getVanChartTools());
VanChartColumnPlot plot = chart.getPlot();
initPlot(plot);
initVanChartYAxis(plot.getDefaultYAxis());
initColumnChartDetail(chart);
Object[] category = {
Toolkit.i18nText("Fine-Design_Chart_Category") + "1",
Toolkit.i18nText("Fine-Design_Chart_Category") + "2",
@ -111,4 +109,11 @@ public class WidgetDisplayReportThemePreviewPane extends TemplateThemePreviewPan
}
return null;
}
private void initColumnChartDetail(VanChart chart) {
initVanChartsTools(chart.getVanChartTools());
VanChartColumnPlot plot = chart.getPlot();
initColumnPlot(plot);
initVanChartYAxis(plot.getDefaultYAxis());
}
}

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

@ -21,13 +21,23 @@ public class ThemePreviewPaneInitHelper {
private ThemePreviewPaneInitHelper() {
}
/**
* 初始化图表工具
*
* @param vanChartTools 图表工具
*/
public static void initVanChartsTools(VanChartTools vanChartTools) {
vanChartTools.setSort(false);
vanChartTools.setExport(false);
vanChartTools.setFullScreen(false);
}
public static void initPlot(VanChartColumnPlot plot) {
/**
* 初始化柱形图绘图区
*
* @param plot 绘图区
*/
public static void initColumnPlot(VanChartColumnPlot plot) {
AttrLabel defaultAttrLabel = plot.getDefaultAttrLabel();
defaultAttrLabel.setEnable(true);
defaultAttrLabel.getAttrLabelDetail().getBorder().setBorderStyle(0);
@ -37,6 +47,12 @@ public class ThemePreviewPaneInitHelper {
plot.setSeriesOverlapPercent(30);
plot.setCategoryIntervalPercent(30);
}
/**
* 初始化图表Y轴
*
* @param yAxis
*/
public static void initVanChartYAxis(VanChartAxis yAxis) {
Title title = new Title();
title.setTextObject(Toolkit.i18nText("Fine-Design_Chart_Axis_Title"));

Loading…
Cancel
Save