Package com.groovesquid.model

Examples of com.groovesquid.model.Track


       
    }
   
    public DownloadTableModel(List<Song> songs) {
        for (Song song : songs) {
            Track track = Services.getDownloadService().download(song);
            songDownloads.add(track);
            fireTableDataChanged();
        }
    }
View Full Code Here


    public String getColumnName(int col) {
        return columnNames[col];
    }

    public Object getValueAt(int rowIndex, int columnIndex) {
        Track track = songDownloads.get(rowIndex);
        switch (columnIndex) {
            case 0: return track.getSong().getName();
            case 1: return track.getSong().getArtist().getName();
            case 2: return track.getSong().getAlbum().getName();
            case 3: return track.getPath();
            case 4: return track.getDate();
            case 5: return track.getProgress();
        }
        return null;
    }
View Full Code Here

        return true;
    }

    public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
        String text = "";
        Track track = ((DownloadTableModel)table.getModel()).getSongDownloads().get(row);
       
        if(track != null) {
            Double downloadRate = track.getDownloadRate();
            if(track.getStatus() != null) {
                switch (track.getStatus()) {
                    case INITIALIZING:
                        text = "initializing...";
                        break;
                    case QUEUED:
                        text = "waiting...";
                        break;
                    case DOWNLOADING:
                        if (downloadRate != null) {
                            text = String.format("%1.0f%%, %d of %d kB, %1.0f kB/s",
                                    track.getProgress() * 1.0,
                                    track.getDownloadedBytes() / 1024,
                                    track.getTotalBytes() / 1024,
                                    downloadRate / 1024);
                        } else {
                            text = String.format("%1.0f%%, %d kB",
                                    track.getProgress() * 1.0,
                                    track.getTotalBytes() / 1024);
                        }
                        break;
                    case FINISHED:
                        downloadRate = track.getDownloadRate();
                        if (downloadRate != null) {
                            text = String.format("%d kB, %1.0f kB/s",
                                    track.getDownloadedBytes() / 1024,
                                    downloadRate / 1024);
                        } else {
                            text = String.format("%d kB",
                                    track.getDownloadedBytes() / 1024);
                        }
                        break;
                    case CANCELLED:
                        text = "cancelled";
                        break;
View Full Code Here

TOP

Related Classes of com.groovesquid.model.Track

Copyright © 2018 www.massapicom. 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.