aboutsummaryrefslogtreecommitdiff
path: root/src/main/ui/widgets/LogTableModel.java
diff options
context:
space:
mode:
authorYuuta Liang <yuutaw@student.cs.ubc.ca>2023-11-28 18:19:39 -0800
committerYuuta Liang <yuutaw@student.cs.ubc.ca>2023-11-28 18:19:39 -0800
commit1073af21305360bd33903c533cdac57e9f936294 (patch)
tree2c2d9c343ffe2577286fb53e016f06f6cdc53cbf /src/main/ui/widgets/LogTableModel.java
parente13adbb9a9146dd5ece890449e3cad958a502f86 (diff)
downloadjca-1073af21305360bd33903c533cdac57e9f936294.tar
jca-1073af21305360bd33903c533cdac57e9f936294.tar.gz
jca-1073af21305360bd33903c533cdac57e9f936294.tar.bz2
jca-1073af21305360bd33903c533cdac57e9f936294.zip
Move TUI and GUI into separate packages
Signed-off-by: Yuuta Liang <yuutaw@student.cs.ubc.ca>
Diffstat (limited to 'src/main/ui/widgets/LogTableModel.java')
-rw-r--r--src/main/ui/widgets/LogTableModel.java79
1 files changed, 0 insertions, 79 deletions
diff --git a/src/main/ui/widgets/LogTableModel.java b/src/main/ui/widgets/LogTableModel.java
deleted file mode 100644
index dc7dcbd..0000000
--- a/src/main/ui/widgets/LogTableModel.java
+++ /dev/null
@@ -1,79 +0,0 @@
-package ui.widgets;
-
-import model.ca.AuditLogEntry;
-import model.ca.CertificationAuthority;
-
-import javax.swing.table.AbstractTableModel;
-import java.time.format.DateTimeFormatter;
-import java.util.List;
-
-/**
- * Table model that displays audit logs.
- */
-public class LogTableModel extends AbstractTableModel {
- /**
- * Columns
- */
- private static final String[] COLS = new String[] {
- "Time",
- "Operator",
- "Action"
- };
-
- /**
- * Pointer to the {@link CertificationAuthority#getLogs()}.
- */
- private List<AuditLogEntry> ptrData;
-
- /**
- * EFFECTS: Set the pointer to templates
- * MODIFIES: this
- */
- public void setPtrData(List<AuditLogEntry> ptrData) {
- this.ptrData = ptrData;
- }
-
- /**
- * EFFECT: Return number of rows.
- */
- @Override
- public int getRowCount() {
- return ptrData == null ? 0 : ptrData.size();
- }
-
- /**
- * EFFECT: Return number of columns.
- */
- @Override
- public int getColumnCount() {
- return COLS.length;
- }
-
- /**
- * EFFECTS: Get column name.
- * REQUIRES: column in [9, getColumnCount())
- */
- @Override
- public String getColumnName(int column) {
- return COLS[column];
- }
-
- /**
- * EFFECTS: Return the value for a cell:
- * String (Time)
- * String (Operator)
- * String (Action)
- * Throws {@link IllegalArgumentException} if columnIndex is not in 0 ~ 2
- * REQUIRES: rowIndex must in range.
- */
- @Override
- public Object getValueAt(int rowIndex, int columnIndex) {
- final AuditLogEntry e = ptrData.get(rowIndex);
- switch (columnIndex) {
- case 0: return e.getTime().format(DateTimeFormatter.ISO_LOCAL_DATE_TIME);
- case 1: return e.getUser();
- case 2: return e.getAction();
- default: throw new IllegalArgumentException();
- }
- }
-}