Browse Source

REPORT-78625【运营产品化二期】交互问题集合

1、改了点ui
2、加了点异常处理
feature/x
Link.Zhao 2 years ago
parent
commit
bce59769e9
  1. 6
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineFrame.java
  2. 5
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/model/TemplateResourceDetail.java
  3. 40
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/TemplateResourceDetailPane.java
  4. 35
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/TemplateShopPane.java
  5. 16
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/ProductNewsSearchManager.java

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

@ -252,7 +252,7 @@ public class AlphaFineFrame extends JFrame {
new LoadingRightSearchResultPane()
);
this.templateResourceSearchWorkerManager = new TemplateResourceSearchWorkerManager(
templateResourceSearchWorkerManager = new TemplateResourceSearchWorkerManager(
CellType.TEMPLATE_SHOP,
searchTextBean -> {
return TemplateResourceSearchManager.getInstance().getSearchResult(searchTextBean.getSearchText());
@ -658,6 +658,8 @@ public class AlphaFineFrame extends JFrame {
boolean networkError;
if (selectedTab.getCellType() == CellType.PRODUCT_NEWS) {
networkError = productNewsSearchWorkerManager.isNetWorkError();
} else if (selectedTab.getCellType() == CellType.TEMPLATE_SHOP) {
networkError = templateResourceSearchWorkerManager.isNetWorkError();
} else {
networkError = currentSearchWorkerManager.isNetWorkError();
}
@ -669,6 +671,8 @@ public class AlphaFineFrame extends JFrame {
boolean searchOver;
if (selectedTab.getCellType() == CellType.PRODUCT_NEWS) {
searchOver = productNewsSearchWorkerManager.isSearchOver();
} else if (selectedTab.getCellType() == CellType.TEMPLATE_SHOP) {
searchOver = templateResourceSearchWorkerManager.isSearchOver();
} else {
searchOver = currentSearchWorkerManager.isSearchOver();
}

5
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/model/TemplateResourceDetail.java

@ -27,7 +27,7 @@ public class TemplateResourceDetail {
private String[] tagsId;
private List<String> tagsName;
private double price;
private String parentPkgName;
private String parentPkgName = "";
private String resourceUrl;
public static final String ID = "id";
@ -176,11 +176,12 @@ public class TemplateResourceDetail {
// 3请求标签信息
detail.setTagsName(helper.getTemplateTagsByTemplateTagIds(detail.getTagsId()));
return detail;
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e, e.getMessage());
}
return detail;
return null;
}
/**

40
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/TemplateResourceDetailPane.java

@ -1,20 +1,25 @@
package com.fr.design.mainframe.alphafine.preview;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.constants.UIConstants;
import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.alphafine.AlphaFineConstants;
import com.fr.design.mainframe.alphafine.action.StartUseAction;
import com.fr.design.mainframe.alphafine.component.TemplateResourceImagePanel;
import com.fr.design.mainframe.alphafine.model.TemplateResourceDetail;
import com.fr.design.utils.BrowseUtils;
import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.RenderingHints;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.List;
@ -33,13 +38,15 @@ public class TemplateResourceDetailPane extends JPanel {
private static final int IMAGE_HEIGHT = 170;
private static final int IMAGE_WIDTH= 310;
private static final int SCROLL_PANE_WIDTH = 320;
private static final int SCROLL_PANE_HEIGHT = 150;
private static final int SCROLL_PANE_WIDTH = 315;
private static final int SCROLL_PANE_HEIGHT = 135;
private static final int CONTENT_PANE_WIDTH = 320;
private static final int CONTENT_PANE_HEIGHT = 180;
private static final int DETAIL_PANE_HEIGHT = 110;
private static final int TEXT_SCROLL_PANE_HEIGHT = 500;
private static final int PANE_WIDTH = 640;
private static final int PANE_WIDTH = 635;
private static final int BUTTON_WIDTH = 68;
private static final int BUTTON_HEIGHT = 20;
private static final String GOTO_DETAIL = Toolkit.i18nText("Fine-Design_Report_AlphaFine_Template_Detail_GOTO_DETAIL");
private static final String START_USE = Toolkit.i18nText("Fine-Design_Report_AlphaFine_Template_Detail_START_USE");
@ -55,6 +62,7 @@ public class TemplateResourceDetailPane extends JPanel {
private static final Color INFO_PANE_BACKGROUND = new Color(0xf9f9f9);
private static final Color INFO_PANE_FOREGROUND = new Color(0x5b5b5c);
private static final Color MORE_INFO_LINK = new Color(0x419bf9);
public TemplateResourceDetailPane(TemplateResourceDetail detail) {
@ -93,7 +101,7 @@ public class TemplateResourceDetailPane extends JPanel {
operatePane = new JPanel(new FlowLayout(FlowLayout.LEFT));
JLabel emptyLabel = new JLabel();
emptyLabel.setPreferredSize(new Dimension(140, 25));
emptyLabel.setPreferredSize(new Dimension(145, 25));
JLabel priceLabel = new JLabel();
priceLabel.setForeground(Color.RED);
if (data.getPrice() == 0) {
@ -113,7 +121,7 @@ public class TemplateResourceDetailPane extends JPanel {
JLabel createLinkLabel() {
JLabel linkLabel = new JLabel(GOTO_DETAIL);
linkLabel.setBackground(Color.WHITE);
linkLabel.setForeground(Color.BLUE);
linkLabel.setForeground(MORE_INFO_LINK);
linkLabel.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
@ -129,9 +137,23 @@ public class TemplateResourceDetailPane extends JPanel {
BrowseUtils.browser(url);
}
UIButton createStartUseButton() {
UIButton starUseButton = new UIButton(START_USE);
JButton createStartUseButton() {
JButton starUseButton = new JButton(START_USE) {
@Override
public void paintComponent(Graphics g) {
Graphics2D g2d = (Graphics2D) g;
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g2d.setColor(UIConstants.FLESH_BLUE);
g2d.fillRoundRect(0, 0, getWidth(), getHeight(), 4, 4);
super.paintComponent(g2d);
}
};
starUseButton.setBorder(BorderFactory.createEmptyBorder(0,0,0,0));
starUseButton.setForeground(Color.WHITE);
starUseButton.setFont(AlphaFineConstants.MEDIUM_FONT);
starUseButton.addActionListener(new StartUseAction(data));
starUseButton.setPreferredSize(new Dimension(BUTTON_WIDTH, BUTTON_HEIGHT));
starUseButton.setContentAreaFilled(false);
return starUseButton;
}
@ -160,7 +182,7 @@ public class TemplateResourceDetailPane extends JPanel {
content.setForeground(INFO_PANE_FOREGROUND);
content.setPreferredSize(new Dimension(SCROLL_PANE_WIDTH - 10, TEXT_SCROLL_PANE_HEIGHT));
infoScrollPane = new UIScrollPane(content);
infoScrollPane.setPreferredSize(new Dimension(SCROLL_PANE_WIDTH, SCROLL_PANE_HEIGHT - 25));
infoScrollPane.setPreferredSize(new Dimension(SCROLL_PANE_WIDTH, SCROLL_PANE_HEIGHT));
infoScrollPane.setBorder(BorderFactory.createEmptyBorder(0,0,0,0));
}

35
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/TemplateShopPane.java

@ -29,6 +29,7 @@ public class TemplateShopPane extends JPanel {
public static final String PAGE_PANEL = "pagePane";
public static final String DETAIL_PANEL = "detailPane";
public static final String LOADING_PANEL = "loadingPane";
public static final String FAILED_PANEL = "failedPane";
private String currentCard = Strings.EMPTY;
private static final String SLASH = "/";
@ -37,6 +38,7 @@ public class TemplateShopPane extends JPanel {
private JPanel pagePane;
private JPanel detailPane;
private JPanel loadingPane;
private JPanel failedPane;
private TemplateShopPane() {
setLayout(cardLayout);
@ -96,12 +98,20 @@ public class TemplateShopPane extends JPanel {
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e, e.getMessage());
}
// detailpane初始化
detailPane = new TemplateResourceDetailPane(detail);
// 切换
INSTANCE.add(detailPane, DETAIL_PANEL);
switchCard(DETAIL_PANEL);
if (detail == null) {
setRetryAction(resource);
switchCard(FAILED_PANEL);
} else {
// detailpane初始化
detailPane = new TemplateResourceDetailPane(detail);
// 切换
INSTANCE.add(detailPane, DETAIL_PANEL);
switchCard(DETAIL_PANEL);
}
}
}.execute();
}
@ -119,6 +129,9 @@ public class TemplateShopPane extends JPanel {
UILabel resourceLabel = new UILabel(resourceName);
resourceLabel.setForeground(AlphaFineConstants.LABEL_SELECTED);
labelNamePane.removeAll();
labelNamePane.add(tabLabel);
labelNamePane.add(slash);
labelNamePane.add(resourceLabel);
@ -153,6 +166,18 @@ public class TemplateShopPane extends JPanel {
return new SearchLoadingPane();
}
private void setRetryAction(TemplateResource resource) {
if (failedPane != null) {
INSTANCE.remove(failedPane);
}
failedPane = createFailedPane(resource);
INSTANCE.add(failedPane, FAILED_PANEL);
}
private JPanel createFailedPane(TemplateResource resource) {
return new NetWorkFailedPane(()->{this.searchAndShowDetailPane(resource);});
}
}

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

@ -20,7 +20,6 @@ import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import java.util.concurrent.Executors;
@ -104,7 +103,7 @@ public class ProductNewsSearchManager {
}
}
filterByDesignerId(productNewsList);
productNewsList = filterByDesignerId(productNewsList);
return productNewsList;
}
@ -120,9 +119,9 @@ public class ProductNewsSearchManager {
HashMap<String, Set<String>> userGroupInfoCache = new HashMap<>();
//遍历资源,获取target下的所有用户组信息,检查是否包含设计器id
Iterator<ProductNews> iterator = list.iterator();
while (iterator.hasNext()) {
List<String> targets = iterator.next().getTarget();
List<ProductNews> newsList = new ArrayList<>();
for (ProductNews productNews : list) {
List<String> targets = productNews.getTarget();
boolean targetsContainDesignerId = false;
@ -140,12 +139,11 @@ public class ProductNewsSearchManager {
}
}
if (!targetsContainDesignerId) {
iterator.remove();
if (targetsContainDesignerId) {
newsList.add(productNews);
}
}
return list;
return newsList;
}
/**

Loading…
Cancel
Save