diff --git a/pom.xml b/pom.xml index c3746d75..ff4b08ce 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.rarchives.ripme ripme jar - 1.1.1 + 1.1.2 ripme http://rip.rarchives.com diff --git a/src/main/java/com/rarchives/ripme/ui/HistoryMenuMouseListener.java b/src/main/java/com/rarchives/ripme/ui/HistoryMenuMouseListener.java new file mode 100644 index 00000000..4b73b13b --- /dev/null +++ b/src/main/java/com/rarchives/ripme/ui/HistoryMenuMouseListener.java @@ -0,0 +1,84 @@ +package com.rarchives.ripme.ui; + +import java.awt.event.ActionEvent; +import java.awt.event.InputEvent; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; + +import javax.swing.AbstractAction; +import javax.swing.Action; +import javax.swing.JPopupMenu; +import javax.swing.JTable; + +public class HistoryMenuMouseListener extends MouseAdapter { + private JPopupMenu popup = new JPopupMenu(); + private Action checkAllAction, + uncheckAllAction, + checkSelected, + uncheckSelected; + private JTable tableComponent; + + @SuppressWarnings("serial") + public HistoryMenuMouseListener() { + checkAllAction = new AbstractAction("Check All") { + @Override + public void actionPerformed(ActionEvent ae) { + for (int row = 0; row < tableComponent.getRowCount(); row++) { + tableComponent.setValueAt(new Boolean(true), row, 4); + } + } + }; + popup.add(checkAllAction); + + uncheckAllAction = new AbstractAction("Check None") { + @Override + public void actionPerformed(ActionEvent ae) { + for (int row = 0; row < tableComponent.getRowCount(); row++) { + tableComponent.setValueAt(new Boolean(false), row, 4); + } + } + }; + popup.add(uncheckAllAction); + + popup.addSeparator(); + + checkSelected = new AbstractAction("Check Selected") { + @Override + public void actionPerformed(ActionEvent ae) { + for (int row : tableComponent.getSelectedRows()) { + tableComponent.setValueAt(new Boolean(false), row, 4); + } + } + }; + popup.add(checkSelected); + + uncheckSelected = new AbstractAction("Uncheck Selected") { + @Override + public void actionPerformed(ActionEvent ae) { + for (int row : tableComponent.getSelectedRows()) { + tableComponent.setValueAt(new Boolean(false), row, 4); + } + } + }; + popup.add(uncheckSelected); + } + + @Override + public void mouseClicked(MouseEvent e) { + if (e.getModifiers() == InputEvent.BUTTON3_MASK) { + if (!(e.getSource() instanceof JTable)) { + return; + } + + tableComponent = (JTable) e.getSource(); + tableComponent.requestFocus(); + + int nx = e.getX(); + + if (nx > 500) { + nx = nx - popup.getSize().width; + } + popup.show(e.getComponent(), nx, e.getY() - popup.getSize().height); + } + } +} diff --git a/src/main/java/com/rarchives/ripme/ui/MainWindow.java b/src/main/java/com/rarchives/ripme/ui/MainWindow.java index 70ee8f2d..3297f663 100644 --- a/src/main/java/com/rarchives/ripme/ui/MainWindow.java +++ b/src/main/java/com/rarchives/ripme/ui/MainWindow.java @@ -344,6 +344,7 @@ public class MainWindow implements Runnable, RipStatusHandler { } }; historyTable = new JTable(historyTableModel); + historyTable.addMouseListener(new HistoryMenuMouseListener()); historyTable.setAutoCreateRowSorter(true); for (int i = 0; i < historyTable.getColumnModel().getColumnCount(); i++) { int width = 130; // Default @@ -625,7 +626,7 @@ public class MainWindow implements Runnable, RipStatusHandler { if (added == 0) { JOptionPane.showMessageDialog(null, "No history entries have been 'Checked'\n" + - "Check an entry by clicking the checkbox to the right of the URL", + "Check an entry by clicking the checkbox to the right of the URL or Right-click a URL to check/uncheck all items", "RipMe Error", JOptionPane.ERROR_MESSAGE); return; diff --git a/src/main/java/com/rarchives/ripme/ui/UpdateUtils.java b/src/main/java/com/rarchives/ripme/ui/UpdateUtils.java index 89f7d46f..d434dba1 100644 --- a/src/main/java/com/rarchives/ripme/ui/UpdateUtils.java +++ b/src/main/java/com/rarchives/ripme/ui/UpdateUtils.java @@ -21,7 +21,7 @@ import com.rarchives.ripme.utils.Utils; public class UpdateUtils { private static final Logger logger = Logger.getLogger(UpdateUtils.class); - private static final String DEFAULT_VERSION = "1.1.1"; + private static final String DEFAULT_VERSION = "1.1.2"; private static final String updateJsonURL = "http://rarchives.com/ripme.json"; private static final String updateJarURL = "http://rarchives.com/ripme.jar"; private static final String mainFileName = "ripme.jar";