Browse Source

Merge branch 'feature/x' of ssh://cloud.finedevelop.com:7999/~lanlan/design into feature/x

feature/x
Lanlan 3 years ago
parent
commit
af3e275294
  1. 6
      designer-base/src/main/java/com/fr/design/formula/FunctionConstants.java
  2. 2
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/AlphaFineConstants.java
  3. 9
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/AlphaFineHelper.java
  4. 14
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineFrame.java
  5. 3
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineList.java
  6. 20
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/ProductNewsContentCellRender.java
  7. 18
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/ProductNewsImagePanel.java
  8. 20
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/SelectedLabel.java
  9. 16
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/ProductNewsSearchManager.java

6
designer-base/src/main/java/com/fr/design/formula/FunctionConstants.java

@ -58,7 +58,6 @@ public final class FunctionConstants {
public static FunctionGroup ALL = getAllFunctionGroup();
public static List<String> abandonFormulas = Arrays.asList("CIRCULAR", "CROSSLAYERTOTAL", "HIERARCHY", "LAYERTOTAL");
public static NameAndFunctionList NEW = getNewFunctionList();
private static List<String> shieldedFormulas = Arrays.asList("ENBYSTRNUM","TEXTGETNUM" ,"GETCHARNUM","GCD", "LCM");
static {
loadEmbededFunctions();
@ -103,7 +102,7 @@ public final class FunctionConstants {
if (StableUtils.classInstanceOf(cls, iface)) {
Function inst;
inst = (Function) cls.newInstance();
if (abandonFormulas.contains(inst.getClass().getSimpleName()) || shieldedFormulas.contains(inst.getClass().getSimpleName())) {
if (abandonFormulas.contains(inst.getClass().getSimpleName())) {
continue;
}
for (NameAndTypeAndFunctionList EMBFUNCTION : EMBFUNCTIONS) {
@ -289,7 +288,8 @@ public final class FunctionConstants {
private static NameAndFunctionList getNewFunctionList() {
return new NameAndFunctionList(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_New"), new Function[]{
new ENDOFMONTH(), new NUMTOZH(), new MIDCHAR(), new ISWORKDAY()
new ENDOFMONTH(), new NUMTOZH(), new MIDCHAR(), new ISWORKDAY(),new ENBYSTRNUM(), new TEXTGETNUM(),
new GETCHARNUM(), new GCD(), new LCM()
});
}

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 Color SUSPENDED_COLOR = new Color(84, 165, 249);
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.stable.StringUtils;
import java.awt.Frame;
import java.util.List;
/**
@ -66,7 +67,13 @@ public class AlphaFineHelper {
final AlphaFineConfigManager manager = DesignerEnvManager.getEnvManager().getAlphaFineConfigManager();
manager.setNeedRemind(false);
} 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) {
for (SelectedLabel label : selectedLabelList) {
label.setSelected(false);
label.setForeground(AlphaFineConstants.FOREGROUND_COLOR_8);
}
selectedLabel.setSelected(true);
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);
}

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;
import com.fr.design.mainframe.alphafine.AlphaFineHelper;
import com.fr.design.mainframe.alphafine.cell.model.AlphaCellModel;
import com.fr.design.mainframe.alphafine.preview.ResultShowPane;
import java.awt.event.KeyAdapter;
@ -25,6 +26,8 @@ public class AlphaFineList extends JList<AlphaCellModel> {
if (e.getClickCount() == 2 && selectedValue.hasAction()) {
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;
import com.fr.design.DesignerEnvManager;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.mainframe.alphafine.AlphaFineConstants;
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");
/**
* 透明灰色背景 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;
public ProductNewsContentCellRender(String[] segmentationResult) {
@ -58,7 +72,7 @@ public class ProductNewsContentCellRender implements ListCellRenderer<Object> {
@Override
protected void paintComponent(Graphics g) {
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);
}
};
@ -73,7 +87,7 @@ public class ProductNewsContentCellRender implements ListCellRenderer<Object> {
textPane.setBackground(Color.WHITE);
textPane.add(infoPane, BorderLayout.CENTER);
panel.add(textPane, BorderLayout.CENTER);
panel.setPreferredSize(new Dimension(500, 80));
panel.setPreferredSize(DEFAULT_DIMENSION);
return panel;
}
}

18
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.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();
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);

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;
import com.fr.design.DesignerEnvManager;
import com.fr.design.constants.UIConstants;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.mainframe.alphafine.AlphaFineConstants;
import com.fr.design.mainframe.alphafine.AlphaFineUtil;
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.Graphics;
import java.awt.Graphics2D;
import java.awt.Rectangle;
import java.awt.RenderingHints;
import java.awt.geom.Ellipse2D;
import java.util.List;
import java.util.Set;
/**
* @author hades
@ -30,7 +22,6 @@ public class SelectedLabel extends UILabel {
private static final int GAP = 2;
private boolean selected;
private boolean hasRead;
private CellType cellType;
public SelectedLabel(String text, CellType cellType, boolean selected) {
@ -53,11 +44,8 @@ public class SelectedLabel extends UILabel {
g2d.setColor(UIConstants.FLESH_BLUE);
setForeground(UIConstants.FLESH_BLUE);
g2d.drawLine(0, this.getHeight() - 1, this.getWidth(), this.getHeight() - 1);
} else {
setForeground(AlphaFineConstants.FOREGROUND_COLOR_8);
}
if (cellType == CellType.PRODUCT_NEWS && AlphaFineUtil.unread()) {
Color oldColor = g.getColor();
g2d.setColor(Color.RED);
@ -77,14 +65,6 @@ public class SelectedLabel extends UILabel {
this.selected = selected;
}
public boolean isHasRead() {
return hasRead;
}
public void setHasRead(boolean hasRead) {
this.hasRead = hasRead;
}
public CellType getCellType() {
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.JSONObject;
import com.fr.log.FineLoggerFactory;
import org.jetbrains.annotations.Nullable;
import java.awt.Image;
import java.net.URL;
import java.util.ArrayList;
import java.util.Date;
@ -59,7 +62,7 @@ public class ProductNewsSearchManager {
JSONObject obj = jsonArray.getJSONObject(i);
ProductNews productNews = new ProductNews().
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"))).
setStatus(ProductNews.Status.parseCode(obj.getInt("status"))).setTarget(
ProductNews.Target.parseCode(obj.getInt("target"))).
@ -72,4 +75,15 @@ public class ProductNewsSearchManager {
public List<ProductNews> getCachedProductNewsList() {
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