|
|
|
@ -3,11 +3,7 @@ package com.fr.design.mainframe.alphafine.component;
|
|
|
|
|
import com.fr.base.GraphHelper; |
|
|
|
|
import com.fr.base.svg.SVGLoader; |
|
|
|
|
import com.fr.design.DesignerEnvManager; |
|
|
|
|
import com.fr.design.constants.UIConstants; |
|
|
|
|
import com.fr.design.mainframe.alphafine.model.ProductNews; |
|
|
|
|
import com.fr.general.IOUtils; |
|
|
|
|
import com.fr.log.FineLoggerFactory; |
|
|
|
|
import java.awt.AlphaComposite; |
|
|
|
|
import java.awt.Color; |
|
|
|
|
import java.awt.Dimension; |
|
|
|
|
import java.awt.Graphics; |
|
|
|
@ -15,7 +11,6 @@ import java.awt.Graphics2D;
|
|
|
|
|
import java.awt.Image; |
|
|
|
|
|
|
|
|
|
import java.awt.RenderingHints; |
|
|
|
|
import java.awt.geom.RoundRectangle2D; |
|
|
|
|
import java.util.Set; |
|
|
|
|
import javax.swing.JPanel; |
|
|
|
|
|
|
|
|
@ -32,6 +27,8 @@ public class ProductNewsImagePanel extends JPanel {
|
|
|
|
|
|
|
|
|
|
private static final Color BACKGROUND_COLOR = new Color(116, 181, 249); |
|
|
|
|
|
|
|
|
|
private static final Color COVER_COLOR = new Color(116, 181, 249, 26); |
|
|
|
|
|
|
|
|
|
private ProductNews productNews; |
|
|
|
|
|
|
|
|
|
private int width = 200; |
|
|
|
@ -48,17 +45,20 @@ public class ProductNewsImagePanel extends JPanel {
|
|
|
|
|
Graphics2D g2 = (Graphics2D) g; |
|
|
|
|
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); |
|
|
|
|
g2.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR); |
|
|
|
|
// g2.setComposite(AlphaComposite.Src);
|
|
|
|
|
// g2.fill(new RoundRectangle2D.Float(0, 0, getWidth(), getHeight(), 5, 5));
|
|
|
|
|
// g2.setComposite(AlphaComposite.SrcAtop);
|
|
|
|
|
Color defaultColor = g2.getColor(); |
|
|
|
|
|
|
|
|
|
g2.drawImage(productNews.getImage(), 0, 0, getWidth(), getHeight(), this); |
|
|
|
|
Image image = productNews.getImage(); |
|
|
|
|
if (image != null) { |
|
|
|
|
g2.drawImage(productNews.getImage(), 0, 0, getWidth(), getHeight(), this); |
|
|
|
|
} else { |
|
|
|
|
g2.setColor(COVER_COLOR); |
|
|
|
|
g2.fillRect(0, 0, getWidth(), getHeight()); |
|
|
|
|
} |
|
|
|
|
Set<Long> readSet = DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().getReadSet(); |
|
|
|
|
if (!readSet.contains(productNews.getId())) { |
|
|
|
|
g2.drawImage(NEW_TIP_IMAGE, 0, 0, this); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Color defaultColor = g2.getColor(); |
|
|
|
|
g2.setColor(BACKGROUND_COLOR); |
|
|
|
|
g2.fillRect(0, getHeight() - BACKGROUND_HEIGHT, getWidth(), BACKGROUND_HEIGHT); |
|
|
|
|
g2.setColor(Color.WHITE); |
|
|
|
|