mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-13 21:55:01 +07:00
CVS: generify
This commit is contained in:
+28
-31
@@ -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<WatcherInfo> myModel = new ListTableModel<WatcherInfo>(COLUMNS);
|
||||
private final TableView<WatcherInfo> myTable = new TableView<WatcherInfo>(myModel);
|
||||
|
||||
private final static ColumnInfo<WatcherInfo, String> USER = new ColumnInfo<WatcherInfo, String>(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<WatcherInfo> getComparator() {
|
||||
return new Comparator<WatcherInfo>(){
|
||||
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<WatcherInfo, String> ACTIONS = new ColumnInfo<WatcherInfo, String>(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<WatcherInfo> getComparator() {
|
||||
return new Comparator<WatcherInfo>(){
|
||||
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<WatcherInfo, String> FILE = new ColumnInfo<WatcherInfo, String>(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<WatcherInfo> getComparator() {
|
||||
return new Comparator<WatcherInfo>(){
|
||||
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<WatcherInfo> watchers) {
|
||||
public WatchersPanel(List<WatcherInfo> watchers) {
|
||||
super(new BorderLayout());
|
||||
myModel.setItems(watchers);
|
||||
add(ScrollPaneFactory.createScrollPane(myTable), BorderLayout.CENTER);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user