public void mousePressed(MouseEvent e) {
if(SwingUtilities.isRightMouseButton(e)) {
if(allGroupList.getSelectedValue() != null) {
// GuiUtils.showError("show group popup");
//TODO select value under mouse
GroupPopupMenu popup = new GroupPopupMenu();
popup.setLocation(e.getPoint());
popup.show((Component) e.getSource(), e.getX(), e.getY());
}
// else {
// GuiUtils.showError("no selection!");
// }
}
}
});
groupTabs.addTab("All", new JScrollPane(allGroupList));
newGroupList = new JList(newgroupmodel);
newGroupList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
newGroupList.setCellRenderer(new GroupCellRenderer());
newGroupList.addListSelectionListener(new ListSelectionListener() {
public void valueChanged(ListSelectionEvent e) {
if(e.getValueIsAdjusting()) return;
Group g = (Group) newGroupList.getSelectedValue();
if(g == null) return;
displayArticles(g.getId());
}});
newGroupList.addMouseListener(new MouseAdapter() {
public void mousePressed(MouseEvent e) {
if(SwingUtilities.isRightMouseButton(e)) {
if(newGroupList.getSelectedValue() != null) {
// GuiUtils.showError("show group popup");
//TODO select value under mouse
GroupPopupMenu popup = new GroupPopupMenu();
popup.setLocation(e.getPoint());
popup.show((Component) e.getSource(), e.getX(), e.getY());
}
// else {
// GuiUtils.showError("no selection!");
// }
}
}
});
groupTabs.addTab("New", new JScrollPane(newGroupList));
subscribedGroupList = new JList(subscribedgroupmodel);
subscribedGroupList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
subscribedGroupList.setCellRenderer(new GroupCellRenderer());
subscribedGroupList.addListSelectionListener(new ListSelectionListener() {
public void valueChanged(ListSelectionEvent e) {
if(e.getValueIsAdjusting()) return;
final Group g = (Group) subscribedGroupList.getSelectedValue();
if(g == null) return;
displayArticles(g.getId());
}});
subscribedGroupList.addMouseListener(new MouseAdapter() {
public void mousePressed(MouseEvent e) {
if(SwingUtilities.isRightMouseButton(e)) {
if(subscribedGroupList.getSelectedValue() != null) {
// GuiUtils.showError("show group popup");
//TODO select value under mouse
GroupPopupMenu popup = new GroupPopupMenu();
popup.setLocation(e.getPoint());
popup.show((Component) e.getSource(), e.getX(), e.getY());
}
// else {
// GuiUtils.showError("no selection!");
// }
}