|
|
@ -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; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|