[cooja] dialogs/MessageList: Added @Override annotations

This commit is contained in:
Enrico Joerns 2014-10-02 02:05:14 +02:00
parent 40f54a8e26
commit 927d9a3153

View file

@ -130,6 +130,7 @@ public class MessageList extends JList {
final BufferedReader stringInput = new BufferedReader(new InputStreamReader(input)); final BufferedReader stringInput = new BufferedReader(new InputStreamReader(input));
Thread readThread = new Thread(new Runnable() { Thread readThread = new Thread(new Runnable() {
@Override
public void run() { public void run() {
String readLine; String readLine;
try { try {
@ -184,6 +185,7 @@ public class MessageList extends JList {
messages.add(msg); messages.add(msg);
java.awt.EventQueue.invokeLater(new Runnable() { java.awt.EventQueue.invokeLater(new Runnable() {
@Override
public void run() { public void run() {
updateModel(); updateModel();
} }
@ -195,6 +197,7 @@ public class MessageList extends JList {
((DefaultListModel) getModel()).clear(); ((DefaultListModel) getModel()).clear();
} }
@Override
public void setModel(ListModel model) { public void setModel(ListModel model) {
throw new IllegalArgumentException("changing model not permitted"); throw new IllegalArgumentException("changing model not permitted");
} }
@ -203,16 +206,19 @@ public class MessageList extends JList {
if (popup == null) { if (popup == null) {
popup = new JPopupMenu(); popup = new JPopupMenu();
addMouseListener(new MouseAdapter() { addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) { public void mouseClicked(MouseEvent e) {
if (e.isPopupTrigger()) { if (e.isPopupTrigger()) {
popup.show(MessageList.this, e.getX(), e.getY()); popup.show(MessageList.this, e.getX(), e.getY());
} }
} }
@Override
public void mousePressed(MouseEvent e) { public void mousePressed(MouseEvent e) {
if (e.isPopupTrigger()) { if (e.isPopupTrigger()) {
popup.show(MessageList.this, e.getX(), e.getY()); popup.show(MessageList.this, e.getX(), e.getY());
} }
} }
@Override
public void mouseReleased(MouseEvent e) { public void mouseReleased(MouseEvent e) {
if (e.isPopupTrigger()) { if (e.isPopupTrigger()) {
popup.show(MessageList.this, e.getX(), e.getY()); popup.show(MessageList.this, e.getX(), e.getY());
@ -230,6 +236,7 @@ public class MessageList extends JList {
final JMenuItem hideNormalMenuItem = new JCheckBoxMenuItem("Hide normal output"); final JMenuItem hideNormalMenuItem = new JCheckBoxMenuItem("Hide normal output");
hideNormalMenuItem.setEnabled(true); hideNormalMenuItem.setEnabled(true);
hideNormalMenuItem.addActionListener(new ActionListener() { hideNormalMenuItem.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
MessageList.this.hideNormal = hideNormalMenuItem.isSelected(); MessageList.this.hideNormal = hideNormalMenuItem.isSelected();
((MessageModel)getModel()).updateList(); ((MessageModel)getModel()).updateList();
@ -240,6 +247,7 @@ public class MessageList extends JList {
JMenuItem consoleOutputMenuItem = new JMenuItem("Output to console"); JMenuItem consoleOutputMenuItem = new JMenuItem("Output to console");
consoleOutputMenuItem.setEnabled(true); consoleOutputMenuItem.setEnabled(true);
consoleOutputMenuItem.addActionListener(new ActionListener() { consoleOutputMenuItem.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
MessageContainer[] messages = getMessages(); MessageContainer[] messages = getMessages();
System.out.println("\nCOMPILATION OUTPUT:\n"); System.out.println("\nCOMPILATION OUTPUT:\n");
@ -257,6 +265,7 @@ public class MessageList extends JList {
JMenuItem clipboardMenuItem = new JMenuItem("Copy to clipboard"); JMenuItem clipboardMenuItem = new JMenuItem("Copy to clipboard");
clipboardMenuItem.setEnabled(true); clipboardMenuItem.setEnabled(true);
clipboardMenuItem.addActionListener(new ActionListener() { clipboardMenuItem.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
@ -299,6 +308,7 @@ public class MessageList extends JList {
this.type = type; this.type = type;
} }
@Override
public String toString() { public String toString() {
return message; return message;
} }
@ -318,6 +328,7 @@ public class MessageList extends JList {
private class MessageRenderer extends DefaultListCellRenderer { private class MessageRenderer extends DefaultListCellRenderer {
private Dimension nullDimension = new Dimension(0,0); private Dimension nullDimension = new Dimension(0,0);
@Override
public Component getListCellRendererComponent( public Component getListCellRendererComponent(
JList list, JList list,
Object value, Object value,