Browse Source
* commit 'b5ba2a1324681fd34b2ef52bf81d5d7845a2fabe': CHART-20565 图表渐变色更新 REPORT-58713 加些注释 REPORT-58503 【主题切换】预览区ui改版 REPORT-58800 【主题切换】优化主题选择界面 应用主题的交互 REPORT-58389 【FR11二轮回归】设计器-frm模板撤销/切换主题,设计画布都会变小 REPORT-58586 FR11-二轮回归-单元格属性-样式-切换成跟随主题后,鼠标无法上滑至顶部 REPORT-58713 决策报表中公式模拟计算的参数编辑窗口会出现“闪屏”现象 代码修改 REPORT-58543【主题切换】字符颜色的主题色控件中的色块没有选中状态 REPORT-57881 10.0.19一轮冒烟-断网时打开设计器内置帮助文档,日志中没有离线提示 REPORT-58520 FR11-二轮回归-模板-纸张背景-背景设置显示不全 REPORT-58539 【主题切换】悬浮元素-样式窗口ui优化 CHART-20536 图表预定义配色,升级兼容后,主题配色面板内容固定不变 REPORT-58667 【主题切换】修改模板主题管理的tab名称、窗口名称 REPORT-58655 复用组件的在线搜索需要在筛选条件下搜索 REPORT-58395【主题切换】frm主题配置组件标题图案以后,左侧预览图不生效 CHART-20476 报表块内图表-超链悬浮窗设置项没了research/11.0
superman
3 years ago
30 changed files with 309 additions and 314 deletions
@ -0,0 +1,82 @@
|
||||
package com.fr.design.cell; |
||||
|
||||
import com.fr.base.NameStyle; |
||||
import com.fr.base.ScreenResolution; |
||||
import com.fr.base.Style; |
||||
import com.fr.design.mainframe.theme.TemplateThemeBlock; |
||||
import com.fr.general.IOUtils; |
||||
|
||||
import javax.swing.Icon; |
||||
import javax.swing.JComponent; |
||||
import javax.swing.JPanel; |
||||
import java.awt.Dimension; |
||||
import java.awt.Graphics; |
||||
import java.awt.Graphics2D; |
||||
import java.awt.Image; |
||||
import java.awt.Toolkit; |
||||
|
||||
/** |
||||
* @author Starryi |
||||
* @version 1.0 |
||||
* Created by Starryi on 2021/9/3 |
||||
*/ |
||||
public class CellStylePreviewPane extends JPanel { |
||||
|
||||
private static final Image transparentBackgroundImage = Toolkit.getDefaultToolkit().createImage(CellStylePreviewPane.class.getResource("/com/fr/design/images/transparent_background.png")); |
||||
private final float transparentBackgroundWidth; |
||||
private final float transparentBackgroundHeight; |
||||
private final float transparentBackgroundAspect; |
||||
private String paintText = "Report"; |
||||
private Style style = Style.DEFAULT_STYLE; |
||||
|
||||
public CellStylePreviewPane() { |
||||
transparentBackgroundWidth = transparentBackgroundImage.getWidth(null); |
||||
transparentBackgroundHeight = transparentBackgroundImage.getHeight(null); |
||||
transparentBackgroundAspect = 1.0F * transparentBackgroundImage.getWidth(null) / transparentBackgroundImage.getHeight(null); |
||||
} |
||||
|
||||
public void setStyle(Style style) { |
||||
this.style = style; |
||||
if (style instanceof NameStyle) { |
||||
paintText = ((NameStyle) style).getName(); |
||||
} |
||||
repaint(); |
||||
} |
||||
|
||||
@Override |
||||
public void paintComponent(Graphics g) { |
||||
Graphics2D g2d = (Graphics2D) g; |
||||
int resolution = ScreenResolution.getScreenResolution(); |
||||
|
||||
int width = getWidth(); |
||||
int height = getHeight(); |
||||
|
||||
float scaleWidth = 1.0F * getWidth() / transparentBackgroundWidth; |
||||
float scaleHeight = 1.0F * getHeight() / transparentBackgroundHeight; |
||||
float maxScale = Math.max(scaleWidth, scaleHeight); |
||||
|
||||
if (maxScale <= 1) { |
||||
scaleWidth = scaleHeight = 1; |
||||
} else { |
||||
scaleHeight = scaleWidth = maxScale; |
||||
} |
||||
g2d.drawImage(transparentBackgroundImage, 0, 0, (int) (transparentBackgroundWidth * scaleWidth), (int) (transparentBackgroundHeight * scaleHeight), null); |
||||
|
||||
if (style == Style.DEFAULT_STYLE) { |
||||
// 如果是默认的style,就只写"Report"上去
|
||||
Style.paintContent(g2d, paintText, style, width, height, resolution); |
||||
return; |
||||
} |
||||
|
||||
Style.paintBackground(g2d, style, width, height); |
||||
|
||||
Style.paintContent(g2d, paintText, style, width, height, resolution); |
||||
|
||||
Style.paintBorder(g2d, style, getWidth() - 3, getHeight() - 3); |
||||
} |
||||
|
||||
@Override |
||||
public Dimension getMinimumSize() { |
||||
return getPreferredSize(); |
||||
} |
||||
} |
After Width: | Height: | Size: 24 KiB |
Loading…
Reference in new issue