Package com.jetbrains.heroku.ui

Source Code of com.jetbrains.heroku.ui.GitRemotesTableModel

package com.jetbrains.heroku.ui;

import com.jetbrains.heroku.git.GitRemoteInfo;

import javax.swing.table.AbstractTableModel;
import java.util.List;

/**
* @author mh
* @since 26.12.11
*/
public class GitRemotesTableModel extends AbstractTableModel {
    private final List<GitRemoteInfo> remotes;

    public GitRemotesTableModel(List<GitRemoteInfo> remotes) {
        this.remotes = remotes;
    }

    public int getRowCount() {
        return remotes.size();
    }

    public int getColumnCount() {
        return 2;
    }

    public Object getValueAt(int row, int col) {
        final GitRemoteInfo remote = remotes.get(row);
        switch (col) {
            case 0:
                return remote.getName();
            case 1:
                return remote.getUrl();
        }
        return null;
    }

    @Override
    public String getColumnName(int col) {
        switch (col) {
            case 0:
                return "Name";
            case 1:
                return "URL";
        }
        return null;
    }
}
TOP

Related Classes of com.jetbrains.heroku.ui.GitRemotesTableModel

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.