Browse Source

REPORT-70446 交互效果

feature/x
hades 3 years ago
parent
commit
1e6ca90633
  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 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;
public AlphaFineFrame() {
this.setTitle(AlphaFineConstants.TITLE);
setUndecorated(true);
setSize(AlphaFineConstants.FIELD_SIZE);
initComponents();
@ -228,7 +229,7 @@ public class AlphaFineFrame extends JFrame {
topPane.setBackground(Color.WHITE);
JPanel topLeftPane = new JPanel(new FlowLayout(FlowLayout.LEFT));
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.setForeground(UIConstants.FLESH_BLUE);
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;
import com.fr.design.mainframe.alphafine.AlphaFineConstants;
import com.fr.design.mainframe.alphafine.AlphaFineHelper;
import com.fr.design.mainframe.alphafine.cell.model.AlphaCellModel;
import com.fr.design.mainframe.alphafine.preview.ResultShowPane;
@ -23,7 +24,7 @@ public class AlphaFineList extends JList<AlphaCellModel> {
@Override
public void mouseClicked(MouseEvent e) {
AlphaCellModel selectedValue = getSelectedValue();
if (e.getClickCount() == 2 && selectedValue.hasAction()) {
if (e.getClickCount() == AlphaFineConstants.DEFAULT_CLICK_COUNT && selectedValue.hasAction()) {
// 点击搜索结果 主页面移动到后面
AlphaFineHelper.getAlphaFineDialog().toBack();
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;
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;
@ -44,12 +45,15 @@ public class ProductNewsContentCellRender implements ListCellRenderer<Object> {
private String[] segmentationResult;
public ProductNewsContentCellRender(String[] segmentationResult) {
private ProductNewsList productNewsList;
public ProductNewsContentCellRender(String[] segmentationResult, ProductNewsList productNewsList) {
this.segmentationResult = segmentationResult;
this.productNewsList = productNewsList;
}
public ProductNewsContentCellRender() {
this(null);
public ProductNewsContentCellRender(ProductNewsList productNewsList) {
this(null, productNewsList);
}
@Override
@ -65,6 +69,9 @@ public class ProductNewsContentCellRender implements ListCellRenderer<Object> {
textPane.setBorder(BorderFactory.createEmptyBorder(0, 10, 10, 0));
UILabel titleLabel = new UILabel(AlphaFineUtil.highLightModelName(productNews.getTitle(), segmentationResult));
titleLabel.setFont(DesignUtils.getDefaultGUIFont().applySize(20));
if (productNewsList.getHoverIndex() == index) {
titleLabel.setForeground(UIConstants.FLESH_BLUE);
}
textPane.add(titleLabel, BorderLayout.NORTH);
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;
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.model.ProductNews;
import com.fr.log.FineLoggerFactory;
import java.awt.Cursor;
import java.awt.Desktop;
import java.awt.Point;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseMotionAdapter;
import java.net.URI;
import javax.swing.DefaultListModel;
import javax.swing.JList;
@ -19,15 +24,36 @@ import javax.swing.ListModel;
*/
public class ProductNewsList extends JList<ProductNews> {
private int hoverIndex = -1;
public ProductNewsList(ListModel<ProductNews> dataModel) {
super(dataModel);
addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
if (e.getClickCount() == 2) {
if (e.getClickCount() == AlphaFineConstants.DEFAULT_CLICK_COUNT) {
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());
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);
scrollPane.setBackground(Color.WHITE);
scrollPane.setBorder(BorderFactory.createEmptyBorder(10, 20, 0, 20));
productNewsList.setCellRenderer(new ProductNewsContentCellRender(segmentationResult));
productNewsList.setCellRenderer(new ProductNewsContentCellRender(segmentationResult, productNewsList));
this.setLayout(new BorderLayout());
this.setBackground(Color.WHITE);
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);
productNewsJList.setBackground(Color.WHITE);
productNewsJList.setCellRenderer(new ProductNewsContentCellRender());
productNewsJList.setCellRenderer(new ProductNewsContentCellRender(productNewsJList));
UIScrollPane scrollPane = new UIScrollPane(productNewsJList);
scrollPane.setBackground(Color.WHITE);
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.Color;
import java.awt.Cursor;
import java.awt.Dimension;
import java.awt.GridLayout;
import java.awt.event.MouseAdapter;
@ -139,6 +140,7 @@ public class HelpDocumentNoResultPane extends JPanel {
responseClick(link);
}
});
listLabel.setCursor(new Cursor(Cursor.HAND_CURSOR));
JPanel listPane = new JPanel(new BorderLayout());
listPane.setBackground(Color.WHITE);

Loading…
Cancel
Save