Browse Source

Pull request #8702: REPORT-70456 无封面图的运营文档获取报错 && REPORT-70458 tab的悬浮状态不正确 && REPORT-70449 alphafine面板缩小后,悬浮按钮显示问题 && REPORT-70472 alphafine中打开插件管理,弹窗的层级不正确

Merge in DESIGN/design from ~HADES/design:feature/x to feature/x

* commit '008f12c151c86399fade5a266e28e1f4773d04c2':
  REPORT-70472 alphafine中打开插件管理,弹窗的层级不正确
  REPORT-70458 补上颜色常量
  REPORT-70449 alphafine面板缩小后,悬浮按钮显示问题
  REPORT-70458 tab的悬浮状态不正确
  REPORT-70456 日志输出下url
  REPORT-70456 无封面图的运营文档获取报错
feature/x
Hades 2 years ago
parent
commit
2ebbe028bd
  1. 2
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/AlphaFineConstants.java
  2. 9
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/AlphaFineHelper.java
  3. 14
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineFrame.java
  4. 3
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineList.java
  5. 20
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/ProductNewsContentCellRender.java
  6. 20
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/ProductNewsImagePanel.java
  7. 20
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/SelectedLabel.java
  8. 16
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/ProductNewsSearchManager.java

2
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/AlphaFineConstants.java

@ -156,6 +156,8 @@ public class AlphaFineConstants {
public static final Icon NO_RESULT_ICON = IOUtils.readIcon(AlphaFineConstants.IMAGE_URL + "noresult.png"); public static final Icon NO_RESULT_ICON = IOUtils.readIcon(AlphaFineConstants.IMAGE_URL + "noresult.png");
public static final Color SUSPENDED_COLOR = new Color(84, 165, 249);
public static final Color FOREGROUND_COLOR = new Color(51, 51, 52); public static final Color FOREGROUND_COLOR = new Color(51, 51, 52);
/** /**

9
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/AlphaFineHelper.java

@ -24,6 +24,7 @@ import com.fr.json.JSONFactory;
import com.fr.json.JSONObject; import com.fr.json.JSONObject;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import java.awt.Frame;
import java.util.List; import java.util.List;
/** /**
@ -66,7 +67,13 @@ public class AlphaFineHelper {
final AlphaFineConfigManager manager = DesignerEnvManager.getEnvManager().getAlphaFineConfigManager(); final AlphaFineConfigManager manager = DesignerEnvManager.getEnvManager().getAlphaFineConfigManager();
manager.setNeedRemind(false); manager.setNeedRemind(false);
} else { } else {
alphaFineDialog.setVisible(!alphaFineDialog.isVisible()); alphaFineDialog.setVisible(true);
// check 如果最小化 点击悬浮按钮后 恢复
if ((alphaFineDialog.getExtendedState() & Frame.ICONIFIED) != 0) {
// 从最小化恢复
alphaFineDialog.setExtendedState(Frame.NORMAL);
}
alphaFineDialog.toFront();
} }

14
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineFrame.java

@ -360,6 +360,7 @@ public class AlphaFineFrame extends JFrame {
public void mousePressed(MouseEvent e) { public void mousePressed(MouseEvent e) {
for (SelectedLabel label : selectedLabelList) { for (SelectedLabel label : selectedLabelList) {
label.setSelected(false); label.setSelected(false);
label.setForeground(AlphaFineConstants.FOREGROUND_COLOR_8);
} }
selectedLabel.setSelected(true); selectedLabel.setSelected(true);
tabLabel.setText(selectedLabel.getText()); tabLabel.setText(selectedLabel.getText());
@ -394,6 +395,19 @@ public class AlphaFineFrame extends JFrame {
} }
} }
} }
private Color defaultColor;
@Override
public void mouseEntered(MouseEvent e) {
defaultColor = selectedLabel.getForeground();
selectedLabel.setForeground(AlphaFineConstants.SUSPENDED_COLOR);
}
@Override
public void mouseExited(MouseEvent e) {
selectedLabel.setForeground(defaultColor);
}
}); });
tabPane.add(selectedLabel); tabPane.add(selectedLabel);
} }

3
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineList.java

@ -1,5 +1,6 @@
package com.fr.design.mainframe.alphafine.component; package com.fr.design.mainframe.alphafine.component;
import com.fr.design.mainframe.alphafine.AlphaFineHelper;
import com.fr.design.mainframe.alphafine.cell.model.AlphaCellModel; import com.fr.design.mainframe.alphafine.cell.model.AlphaCellModel;
import com.fr.design.mainframe.alphafine.preview.ResultShowPane; import com.fr.design.mainframe.alphafine.preview.ResultShowPane;
import java.awt.event.KeyAdapter; import java.awt.event.KeyAdapter;
@ -25,6 +26,8 @@ public class AlphaFineList extends JList<AlphaCellModel> {
if (e.getClickCount() == 2 && selectedValue.hasAction()) { if (e.getClickCount() == 2 && selectedValue.hasAction()) {
dealWithSearchResult(); dealWithSearchResult();
} }
// 点击搜索结果 主页面移动到后面
AlphaFineHelper.getAlphaFineDialog().toBack();
} }
}); });

20
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/ProductNewsContentCellRender.java

@ -1,6 +1,5 @@
package com.fr.design.mainframe.alphafine.component; package com.fr.design.mainframe.alphafine.component;
import com.fr.design.DesignerEnvManager;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.mainframe.alphafine.AlphaFineConstants; import com.fr.design.mainframe.alphafine.AlphaFineConstants;
import com.fr.design.mainframe.alphafine.AlphaFineUtil; import com.fr.design.mainframe.alphafine.AlphaFineUtil;
@ -28,6 +27,21 @@ public class ProductNewsContentCellRender implements ListCellRenderer<Object> {
private static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yyyy/MM/dd"); private static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yyyy/MM/dd");
/**
* 透明灰色背景 Y方向偏移
*/
private static final int GRAY_BACKGROUND_Y_GAP = 39;
/**
* 透明灰色背景 高度
*/
private static final int GRAY_BACKGROUND_HEIGHT = 23;
/**
* 单行产品动态的高度与宽度尺寸
*/
private static final Dimension DEFAULT_DIMENSION = new Dimension(500, 100);
private String[] segmentationResult; private String[] segmentationResult;
public ProductNewsContentCellRender(String[] segmentationResult) { public ProductNewsContentCellRender(String[] segmentationResult) {
@ -58,7 +72,7 @@ public class ProductNewsContentCellRender implements ListCellRenderer<Object> {
@Override @Override
protected void paintComponent(Graphics g) { protected void paintComponent(Graphics g) {
g.setColor(AlphaFineConstants.BACKGROUND_COLOR); g.setColor(AlphaFineConstants.BACKGROUND_COLOR);
g.fillRect(0, getHeight() - 27, getWidth(), 23); g.fillRect(0, getHeight() - GRAY_BACKGROUND_Y_GAP, getWidth(), GRAY_BACKGROUND_HEIGHT);
super.paintComponent(g); super.paintComponent(g);
} }
}; };
@ -73,7 +87,7 @@ public class ProductNewsContentCellRender implements ListCellRenderer<Object> {
textPane.setBackground(Color.WHITE); textPane.setBackground(Color.WHITE);
textPane.add(infoPane, BorderLayout.CENTER); textPane.add(infoPane, BorderLayout.CENTER);
panel.add(textPane, BorderLayout.CENTER); panel.add(textPane, BorderLayout.CENTER);
panel.setPreferredSize(new Dimension(500, 80)); panel.setPreferredSize(DEFAULT_DIMENSION);
return panel; return panel;
} }
} }

20
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/ProductNewsImagePanel.java

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

20
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/SelectedLabel.java

@ -1,22 +1,14 @@
package com.fr.design.mainframe.alphafine.component; package com.fr.design.mainframe.alphafine.component;
import com.fr.design.DesignerEnvManager;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.mainframe.alphafine.AlphaFineConstants; import com.fr.design.mainframe.alphafine.AlphaFineConstants;
import com.fr.design.mainframe.alphafine.AlphaFineUtil; import com.fr.design.mainframe.alphafine.AlphaFineUtil;
import com.fr.design.mainframe.alphafine.CellType; import com.fr.design.mainframe.alphafine.CellType;
import com.fr.design.mainframe.alphafine.model.ProductNews;
import com.fr.design.mainframe.alphafine.search.manager.impl.ProductNewsSearchManager;
import com.fr.design.menu.SnapChatUtil;
import java.awt.Color; import java.awt.Color;
import java.awt.Graphics; import java.awt.Graphics;
import java.awt.Graphics2D; import java.awt.Graphics2D;
import java.awt.Rectangle;
import java.awt.RenderingHints; import java.awt.RenderingHints;
import java.awt.geom.Ellipse2D;
import java.util.List;
import java.util.Set;
/** /**
* @author hades * @author hades
@ -30,7 +22,6 @@ public class SelectedLabel extends UILabel {
private static final int GAP = 2; private static final int GAP = 2;
private boolean selected; private boolean selected;
private boolean hasRead;
private CellType cellType; private CellType cellType;
public SelectedLabel(String text, CellType cellType, boolean selected) { public SelectedLabel(String text, CellType cellType, boolean selected) {
@ -53,11 +44,8 @@ public class SelectedLabel extends UILabel {
g2d.setColor(UIConstants.FLESH_BLUE); g2d.setColor(UIConstants.FLESH_BLUE);
setForeground(UIConstants.FLESH_BLUE); setForeground(UIConstants.FLESH_BLUE);
g2d.drawLine(0, this.getHeight() - 1, this.getWidth(), this.getHeight() - 1); g2d.drawLine(0, this.getHeight() - 1, this.getWidth(), this.getHeight() - 1);
} else {
setForeground(AlphaFineConstants.FOREGROUND_COLOR_8);
} }
if (cellType == CellType.PRODUCT_NEWS && AlphaFineUtil.unread()) { if (cellType == CellType.PRODUCT_NEWS && AlphaFineUtil.unread()) {
Color oldColor = g.getColor(); Color oldColor = g.getColor();
g2d.setColor(Color.RED); g2d.setColor(Color.RED);
@ -77,14 +65,6 @@ public class SelectedLabel extends UILabel {
this.selected = selected; this.selected = selected;
} }
public boolean isHasRead() {
return hasRead;
}
public void setHasRead(boolean hasRead) {
this.hasRead = hasRead;
}
public CellType getCellType() { public CellType getCellType() {
return cellType; return cellType;
} }

16
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/ProductNewsSearchManager.java

@ -9,6 +9,9 @@ import com.fr.json.JSONArray;
import com.fr.json.JSONFactory; import com.fr.json.JSONFactory;
import com.fr.json.JSONObject; import com.fr.json.JSONObject;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import org.jetbrains.annotations.Nullable;
import java.awt.Image;
import java.net.URL; import java.net.URL;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
@ -59,7 +62,7 @@ public class ProductNewsSearchManager {
JSONObject obj = jsonArray.getJSONObject(i); JSONObject obj = jsonArray.getJSONObject(i);
ProductNews productNews = new ProductNews(). ProductNews productNews = new ProductNews().
setId(obj.getLong("id")).setTitle(obj.getString("title")). setId(obj.getLong("id")).setTitle(obj.getString("title")).
setImage(ImageIO.read(new URL(obj.getString("pic")))). setImage(getCoverImage(obj.getString("pic"))).
setUrl(obj.getString("url")).setTag(ProductNews.Tag.parseCode(obj.getInt("tag"))). setUrl(obj.getString("url")).setTag(ProductNews.Tag.parseCode(obj.getInt("tag"))).
setStatus(ProductNews.Status.parseCode(obj.getInt("status"))).setTarget( setStatus(ProductNews.Status.parseCode(obj.getInt("status"))).setTarget(
ProductNews.Target.parseCode(obj.getInt("target"))). ProductNews.Target.parseCode(obj.getInt("target"))).
@ -72,4 +75,15 @@ public class ProductNewsSearchManager {
public List<ProductNews> getCachedProductNewsList() { public List<ProductNews> getCachedProductNewsList() {
return productNewsList; return productNewsList;
} }
@Nullable
private Image getCoverImage(String url) {
try {
return ImageIO.read(new URL(url));
} catch (Exception e) {
FineLoggerFactory.getLogger().warn("get image failed from {}", url);
FineLoggerFactory.getLogger().warn(e.getMessage(), e);
}
return null;
}
} }

Loading…
Cancel
Save