diff --git a/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/cvsoperations/cvsWatch/ui/WatchersPanel.java b/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/cvsoperations/cvsWatch/ui/WatchersPanel.java index 8fbaee772fe0..35f5b5673fa1 100644 --- a/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/cvsoperations/cvsWatch/ui/WatchersPanel.java +++ b/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/cvsoperations/cvsWatch/ui/WatchersPanel.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,64 +15,63 @@ */ package com.intellij.cvsSupport2.cvsoperations.cvsWatch.ui; +import com.intellij.CvsBundle; import com.intellij.cvsSupport2.cvsoperations.cvsWatch.WatcherInfo; import com.intellij.ui.ScrollPaneFactory; import com.intellij.ui.table.TableView; import com.intellij.util.ui.ColumnInfo; import com.intellij.util.ui.ListTableModel; -import com.intellij.CvsBundle; import javax.swing.*; import java.awt.*; import java.util.Comparator; +import java.util.List; /** * author: lesya */ public class WatchersPanel extends JPanel{ - private final ListTableModel myModel = new ListTableModel(COLUMNS); - private final TableView myTable = new TableView(myModel); - private final static ColumnInfo USER = new ColumnInfo(CvsBundle.message("view.watchers.user.column.name")){ - public Object valueOf(Object object) { - return ((WatcherInfo)object).getUser(); + private final ListTableModel myModel = new ListTableModel(COLUMNS); + private final TableView myTable = new TableView(myModel); + + private final static ColumnInfo USER = new ColumnInfo(CvsBundle.message("view.watchers.user.column.name")){ + public String valueOf(WatcherInfo object) { + return object.getUser(); } - public Comparator getComparator() { - return new Comparator(){ - public int compare(Object o, Object o1) { - return ((WatcherInfo)o).getUser(). - compareTo(((WatcherInfo)o1).getUser()); + public Comparator getComparator() { + return new Comparator(){ + public int compare(WatcherInfo o, WatcherInfo o1) { + return o.getUser().compareTo(o1.getUser()); } }; } }; - private final static ColumnInfo ACTIONS = new ColumnInfo(CvsBundle.message("view.watchers.actions.column.name")){ - public Object valueOf(Object object) { - return ((WatcherInfo)object).getActions(); + private final static ColumnInfo ACTIONS = new ColumnInfo(CvsBundle.message("view.watchers.actions.column.name")){ + public String valueOf(WatcherInfo object) { + return object.getActions(); } - public Comparator getComparator() { - return new Comparator(){ - public int compare(Object o, Object o1) { - return ((WatcherInfo)o).getActions(). - compareTo(((WatcherInfo)o1).getActions()); + public Comparator getComparator() { + return new Comparator(){ + public int compare(WatcherInfo o, WatcherInfo o1) { + return o.getActions().compareTo(o1.getActions()); } }; } }; - private final static ColumnInfo FILE = new ColumnInfo(CvsBundle.message("view.watchers.file.column.name")){ - public Object valueOf(Object object) { - return ((WatcherInfo)object).getFile(); + private final static ColumnInfo FILE = new ColumnInfo(CvsBundle.message("view.watchers.file.column.name")){ + public String valueOf(WatcherInfo object) { + return object.getFile(); } - public Comparator getComparator() { - return new Comparator(){ - public int compare(Object o, Object o1) { - return ((WatcherInfo)o).getFile(). - compareTo(((WatcherInfo)o1).getFile()); + public Comparator getComparator() { + return new Comparator(){ + public int compare(WatcherInfo o, WatcherInfo o1) { + return o.getFile().compareTo(o1.getFile()); } }; } @@ -82,11 +81,9 @@ public class WatchersPanel extends JPanel{ FILE, USER, ACTIONS }; - - public WatchersPanel(java.util.List watchers) { + public WatchersPanel(List watchers) { super(new BorderLayout()); myModel.setItems(watchers); add(ScrollPaneFactory.createScrollPane(myTable), BorderLayout.CENTER); } - }