diff options
author | Simon Rettberg | 2018-12-07 16:27:40 +0100 |
---|---|---|
committer | Simon Rettberg | 2018-12-07 16:27:40 +0100 |
commit | fef487dd73af3c79e354f6a06ff479a83e0047a0 (patch) | |
tree | 04946e6b7bb224df3276ffea973e590c9d5ceabb | |
parent | [server] Fix query (diff) | |
download | tutor-module-fef487dd73af3c79e354f6a06ff479a83e0047a0.tar.gz tutor-module-fef487dd73af3c79e354f6a06ff479a83e0047a0.tar.xz tutor-module-fef487dd73af3c79e354f6a06ff479a83e0047a0.zip |
[client] Show total size and version count in image table
-rw-r--r-- | dozentenmodul/src/main/java/org/openslx/dozmod/gui/control/table/ImageTable.java | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/control/table/ImageTable.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/control/table/ImageTable.java index 9bb2f677..8829876c 100644 --- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/control/table/ImageTable.java +++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/control/table/ImageTable.java @@ -23,6 +23,8 @@ public class ImageTable extends ListTable<ImageSummaryRead> { public static final ListTableColumn COL_OS = new ListTableColumn("OS", Integer.class, Sorters.osNameById); public static final ListTableColumn COL_NAME = new ListTableColumn("Name"); public static final ListTableColumn COL_HYPERVISOR = new ListTableColumn("", Icon.class); + public static final ListTableColumn COL_VERSIONCOUNT = new ListTableColumn("Versionen", Integer.class); + public static final ListTableColumn COL_TOTALSIZE = new ListTableColumn("Gesamtgröße", Long.class); public ImageTable() { super(new Comparator<ImageSummaryRead>() { @@ -36,7 +38,8 @@ public class ImageTable extends ListTable<ImageSummaryRead> { return -1; return o1.imageBaseId.compareTo(o2.imageBaseId); } - }, COL_NAME, COL_OS, COL_OWNER, COL_LASTCHANGE, COL_EXPIRING, COL_SIZE, COL_USABLE, COL_TEMPLATE, COL_HYPERVISOR); + }, COL_NAME, COL_OS, COL_OWNER, COL_LASTCHANGE, COL_EXPIRING, COL_SIZE, COL_USABLE, COL_TEMPLATE, COL_HYPERVISOR, + COL_VERSIONCOUNT, COL_TOTALSIZE); } // return the right value of our image (row) depending on given column @@ -55,17 +58,21 @@ public class ImageTable extends ListTable<ImageSummaryRead> { if (column == COL_SIZE) return row.getFileSize(); if (column == COL_USABLE) - return row.isValid; + return row.isIsValid(); if (column == COL_TEMPLATE) - return row.isTemplate; + return row.isIsTemplate(); if (column == COL_HYPERVISOR) - return row.virtId; + return row.getVirtId(); + if (column == COL_VERSIONCOUNT) + return row.getVersionCount(); + if (column == COL_TOTALSIZE) + return row.getFileSizeSum(); throw new IndexOutOfBoundsException(); } @Override public Object modelValueToDisplayFormat(Object value, ListTableColumn column) { - if (column == COL_NAME || column == COL_USABLE || column == COL_TEMPLATE) + if (column == COL_NAME || column == COL_USABLE || column == COL_TEMPLATE || column == COL_VERSIONCOUNT) return value; if (column == COL_OS) return FormatHelper.osName(MetaDataCache.getOsById((int) value, true)); @@ -73,7 +80,7 @@ public class ImageTable extends ListTable<ImageSummaryRead> { return FormatHelper.userName(UserCache.find((String) value)); if (column == COL_LASTCHANGE || column == COL_EXPIRING) return FormatHelper.shortDate((long) value); - if (column == COL_SIZE) + if (column == COL_SIZE || column == COL_TOTALSIZE) return FormatHelper.bytes((long) value, false); if (column == COL_HYPERVISOR) return Gui.getScaledIconResource("/img/" + value + "-icon.png", "Virtualizer Icon", getRowHeight(), this); |