Browse Source

Pull request #8794: REPORT-70446 交互效果

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

* commit '1e6ca906338431088e744f7a14baca4ce6452d73':
  REPORT-70446 交互效果
feature/x
Hades 3 years ago
parent
commit
6b0bc4f575
  1. 4
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/AlphaFineConstants.java
  2. 3
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineFrame.java
  3. 3
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineList.java
  4. 13
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/ProductNewsContentCellRender.java
  5. 32
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/ProductNewsList.java
  6. 2
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/ProductNewsSearchResultPane.java
  7. 2
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/DefaultProductNewsPane.java
  8. 2
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/HelpDocumentNoResultPane.java

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

@ -202,4 +202,8 @@ public class AlphaFineConstants {
public static final String LOADING = "loading"; public static final String LOADING = "loading";
public static final String NETWORK_ERROR = "network error"; public static final String NETWORK_ERROR = "network error";
public static final String TITLE = "AlphaFine";
public static final int DEFAULT_CLICK_COUNT = 1;
} }

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

@ -151,6 +151,7 @@ public class AlphaFineFrame extends JFrame {
private ProductNewsSearchWorkerManager productNewsSearchWorkerManager; private ProductNewsSearchWorkerManager productNewsSearchWorkerManager;
public AlphaFineFrame() { public AlphaFineFrame() {
this.setTitle(AlphaFineConstants.TITLE);
setUndecorated(true); setUndecorated(true);
setSize(AlphaFineConstants.FIELD_SIZE); setSize(AlphaFineConstants.FIELD_SIZE);
initComponents(); initComponents();
@ -228,7 +229,7 @@ public class AlphaFineFrame extends JFrame {
topPane.setBackground(Color.WHITE); topPane.setBackground(Color.WHITE);
JPanel topLeftPane = new JPanel(new FlowLayout(FlowLayout.LEFT)); JPanel topLeftPane = new JPanel(new FlowLayout(FlowLayout.LEFT));
topLeftPane.setBackground(Color.WHITE); topLeftPane.setBackground(Color.WHITE);
UILabel alphaFineLabel = new UILabel("AlphaFine"); UILabel alphaFineLabel = new UILabel(AlphaFineConstants.TITLE);
alphaFineLabel.setFont(new Font("Arial Black", Font.PLAIN, 20)); alphaFineLabel.setFont(new Font("Arial Black", Font.PLAIN, 20));
alphaFineLabel.setForeground(UIConstants.FLESH_BLUE); alphaFineLabel.setForeground(UIConstants.FLESH_BLUE);
topLeftPane.add(alphaFineLabel); topLeftPane.add(alphaFineLabel);

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.AlphaFineConstants;
import com.fr.design.mainframe.alphafine.AlphaFineHelper; 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;
@ -23,7 +24,7 @@ public class AlphaFineList extends JList<AlphaCellModel> {
@Override @Override
public void mouseClicked(MouseEvent e) { public void mouseClicked(MouseEvent e) {
AlphaCellModel selectedValue = getSelectedValue(); AlphaCellModel selectedValue = getSelectedValue();
if (e.getClickCount() == 2 && selectedValue.hasAction()) { if (e.getClickCount() == AlphaFineConstants.DEFAULT_CLICK_COUNT && selectedValue.hasAction()) {
// 点击搜索结果 主页面移动到后面 // 点击搜索结果 主页面移动到后面
AlphaFineHelper.getAlphaFineDialog().toBack(); AlphaFineHelper.getAlphaFineDialog().toBack();
dealWithSearchResult(); dealWithSearchResult();

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

@ -1,5 +1,6 @@
package com.fr.design.mainframe.alphafine.component; package com.fr.design.mainframe.alphafine.component;
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;
@ -44,12 +45,15 @@ public class ProductNewsContentCellRender implements ListCellRenderer<Object> {
private String[] segmentationResult; private String[] segmentationResult;
public ProductNewsContentCellRender(String[] segmentationResult) { private ProductNewsList productNewsList;
public ProductNewsContentCellRender(String[] segmentationResult, ProductNewsList productNewsList) {
this.segmentationResult = segmentationResult; this.segmentationResult = segmentationResult;
this.productNewsList = productNewsList;
} }
public ProductNewsContentCellRender() { public ProductNewsContentCellRender(ProductNewsList productNewsList) {
this(null); this(null, productNewsList);
} }
@Override @Override
@ -65,6 +69,9 @@ public class ProductNewsContentCellRender implements ListCellRenderer<Object> {
textPane.setBorder(BorderFactory.createEmptyBorder(0, 10, 10, 0)); textPane.setBorder(BorderFactory.createEmptyBorder(0, 10, 10, 0));
UILabel titleLabel = new UILabel(AlphaFineUtil.highLightModelName(productNews.getTitle(), segmentationResult)); UILabel titleLabel = new UILabel(AlphaFineUtil.highLightModelName(productNews.getTitle(), segmentationResult));
titleLabel.setFont(DesignUtils.getDefaultGUIFont().applySize(20)); titleLabel.setFont(DesignUtils.getDefaultGUIFont().applySize(20));
if (productNewsList.getHoverIndex() == index) {
titleLabel.setForeground(UIConstants.FLESH_BLUE);
}
textPane.add(titleLabel, BorderLayout.NORTH); textPane.add(titleLabel, BorderLayout.NORTH);
JPanel infoPane = new JPanel(new BorderLayout()); JPanel infoPane = new JPanel(new BorderLayout());

32
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/ProductNewsList.java

@ -1,12 +1,17 @@
package com.fr.design.mainframe.alphafine.component; package com.fr.design.mainframe.alphafine.component;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.mainframe.alphafine.AlphaFineConstants;
import com.fr.design.mainframe.alphafine.AlphaFineHelper; import com.fr.design.mainframe.alphafine.AlphaFineHelper;
import com.fr.design.mainframe.alphafine.model.ProductNews; import com.fr.design.mainframe.alphafine.model.ProductNews;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import java.awt.Cursor;
import java.awt.Desktop; import java.awt.Desktop;
import java.awt.Point;
import java.awt.event.MouseAdapter; import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.awt.event.MouseMotionAdapter;
import java.net.URI; import java.net.URI;
import javax.swing.DefaultListModel; import javax.swing.DefaultListModel;
import javax.swing.JList; import javax.swing.JList;
@ -19,15 +24,36 @@ import javax.swing.ListModel;
*/ */
public class ProductNewsList extends JList<ProductNews> { public class ProductNewsList extends JList<ProductNews> {
private int hoverIndex = -1;
public ProductNewsList(ListModel<ProductNews> dataModel) { public ProductNewsList(ListModel<ProductNews> dataModel) {
super(dataModel); super(dataModel);
addMouseListener(new MouseAdapter() { addMouseListener(new MouseAdapter() {
@Override @Override
public void mouseClicked(MouseEvent e) { public void mouseClicked(MouseEvent e) {
if (e.getClickCount() == 2) { if (e.getClickCount() == AlphaFineConstants.DEFAULT_CLICK_COUNT) {
dealWithClick(); dealWithClick();
} }
} }
@Override
public void mouseExited(MouseEvent e) {
hoverIndex = -1;
ProductNewsList.this.repaint();
}
});
addMouseMotionListener(new MouseMotionAdapter() {
@Override
public void mouseMoved(MouseEvent e) {
Point p = new Point(e.getX(), e.getY());
int index = ProductNewsList.this.locationToIndex(p);
setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
if (index != hoverIndex) {
hoverIndex = index;
ProductNewsList.this.repaint();
}
}
}); });
} }
@ -45,4 +71,8 @@ public class ProductNewsList extends JList<ProductNews> {
DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().getReadSet().add(productNews.getId()); DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().getReadSet().add(productNews.getId());
AlphaFineHelper.getAlphaFineDialog().repaint(); AlphaFineHelper.getAlphaFineDialog().repaint();
} }
public int getHoverIndex() {
return hoverIndex;
}
} }

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

@ -24,7 +24,7 @@ public class ProductNewsSearchResultPane extends JPanel {
UIScrollPane scrollPane = new UIScrollPane(productNewsList); UIScrollPane scrollPane = new UIScrollPane(productNewsList);
scrollPane.setBackground(Color.WHITE); scrollPane.setBackground(Color.WHITE);
scrollPane.setBorder(BorderFactory.createEmptyBorder(10, 20, 0, 20)); scrollPane.setBorder(BorderFactory.createEmptyBorder(10, 20, 0, 20));
productNewsList.setCellRenderer(new ProductNewsContentCellRender(segmentationResult)); productNewsList.setCellRenderer(new ProductNewsContentCellRender(segmentationResult, productNewsList));
this.setLayout(new BorderLayout()); this.setLayout(new BorderLayout());
this.setBackground(Color.WHITE); this.setBackground(Color.WHITE);
this.add(scrollPane); this.add(scrollPane);

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

@ -111,7 +111,7 @@ public class DefaultProductNewsPane extends JPanel {
} }
ProductNewsList productNewsJList = new ProductNewsList(productNewsDefaultListModel); ProductNewsList productNewsJList = new ProductNewsList(productNewsDefaultListModel);
productNewsJList.setBackground(Color.WHITE); productNewsJList.setBackground(Color.WHITE);
productNewsJList.setCellRenderer(new ProductNewsContentCellRender()); productNewsJList.setCellRenderer(new ProductNewsContentCellRender(productNewsJList));
UIScrollPane scrollPane = new UIScrollPane(productNewsJList); UIScrollPane scrollPane = new UIScrollPane(productNewsJList);
scrollPane.setBackground(Color.WHITE); scrollPane.setBackground(Color.WHITE);
scrollPane.setBorder(BorderFactory.createEmptyBorder(10, 20, 0, 20)); scrollPane.setBorder(BorderFactory.createEmptyBorder(10, 20, 0, 20));

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

@ -15,6 +15,7 @@ import com.fr.log.FineLoggerFactory;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Color; import java.awt.Color;
import java.awt.Cursor;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.GridLayout; import java.awt.GridLayout;
import java.awt.event.MouseAdapter; import java.awt.event.MouseAdapter;
@ -139,6 +140,7 @@ public class HelpDocumentNoResultPane extends JPanel {
responseClick(link); responseClick(link);
} }
}); });
listLabel.setCursor(new Cursor(Cursor.HAND_CURSOR));
JPanel listPane = new JPanel(new BorderLayout()); JPanel listPane = new JPanel(new BorderLayout());
listPane.setBackground(Color.WHITE); listPane.setBackground(Color.WHITE);

Loading…
Cancel
Save