
cz.abclinuxu.datoveschranky.AttachmentTableModel Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of message-viewer Show documentation
Show all versions of message-viewer Show documentation
Desktop application for viewing *.zfo messages.
The newest version!
package cz.abclinuxu.datoveschranky;
import cz.abclinuxu.datoveschranky.common.entities.Attachment;
import java.util.Collections;
import java.util.List;
import javax.swing.table.AbstractTableModel;
public class AttachmentTableModel extends AbstractTableModel {
private final List attachments;
public AttachmentTableModel() {
this.attachments = Collections.emptyList();
}
public AttachmentTableModel(List atts) {
this.attachments = atts;
}
public int getColumnCount() {
return 2;
}
public int getRowCount() {
return attachments.size();
}
@Override
public String getColumnName(int col) {
switch (col) {
case 0:
return "MIME typ";
case 1:
return "jméno";
default:
throw new AssertionError("table has only two columns");
}
}
public Object getValueAt(int row, int col) {
Attachment attachment = attachments.get(row);
switch (col) {
case 0:
return attachment.getMimeType();
case 1:
return attachment.getDescription();
default:
throw new AssertionError("table has only two columns");
}
}
public List getData() {
return attachments;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy