19 package org.sleuthkit.autopsy.ingest;
21 import java.awt.Color;
22 import java.awt.Component;
23 import java.awt.Cursor;
24 import java.awt.Dimension;
26 import java.awt.Graphics;
27 import java.beans.PropertyChangeEvent;
28 import java.beans.PropertyChangeListener;
29 import java.beans.PropertyChangeSupport;
30 import java.text.DateFormat;
31 import java.text.SimpleDateFormat;
32 import java.util.ArrayList;
33 import java.util.Collections;
34 import java.util.Date;
35 import java.util.HashMap;
36 import java.util.List;
38 import java.util.logging.Level;
39 import javax.swing.DefaultComboBoxModel;
40 import javax.swing.JLabel;
41 import javax.swing.JPanel;
42 import javax.swing.JTable;
43 import javax.swing.ListSelectionModel;
44 import javax.swing.SwingConstants;
45 import javax.swing.event.ListSelectionEvent;
46 import javax.swing.event.ListSelectionListener;
47 import javax.swing.event.TableModelEvent;
48 import javax.swing.event.TableModelListener;
49 import javax.swing.table.AbstractTableModel;
50 import javax.swing.table.DefaultTableCellRenderer;
51 import javax.swing.table.TableCellRenderer;
52 import org.openide.util.NbBundle;
61 @SuppressWarnings(
"PMD.SingularField")
62 class IngestMessagePanel extends JPanel implements TableModelListener {
64 private final MessageTableModel tableModel;
65 private MessageTableRenderer renderer;
66 private final IngestMessageMainPanel mainPanel;
67 private static final Color ERROR_COLOR =
new Color(255, 90, 90);
68 private volatile int lastRowSelected = -1;
69 private volatile long totalMessages = 0;
70 private static final Logger logger = Logger.getLogger(IngestMessagePanel.class.getName());
71 private static final PropertyChangeSupport messagePcs =
new PropertyChangeSupport(IngestMessagePanel.class);
72 static final String TOTAL_NUM_MESSAGES_CHANGED =
"TOTAL_NUM_MESSAGES_CHANGED";
73 static final String MESSAGES_BOX_CLEARED =
"MESSAGES_BOX_CLEARED";
74 static final String TOTAL_NUM_NEW_MESSAGES_CHANGED =
"TOTAL_NUM_NEW_MESSAGES_CHANGED";
79 public IngestMessagePanel(IngestMessageMainPanel mainPanel) {
80 this.mainPanel = mainPanel;
81 tableModel =
new MessageTableModel();
83 customizeComponents();
86 public void markAllSeen() {
87 tableModel.markAllSeen();
90 int getLastRowSelected() {
91 return this.lastRowSelected;
94 synchronized IngestMessageGroup getSelectedMessage() {
95 if (lastRowSelected < 0) {
99 return tableModel.getMessageGroup(lastRowSelected);
102 synchronized IngestMessageGroup getMessageGroup(
int rowNumber) {
103 return tableModel.getMessageGroup(rowNumber);
106 synchronized static void addPropertyChangeSupportListener(PropertyChangeListener l) {
107 messagePcs.addPropertyChangeListener(l);
115 @SuppressWarnings(
"unchecked")
117 private
void initComponents() {
119 jScrollPane1 =
new javax.swing.JScrollPane();
120 messageTable =
new javax.swing.JTable();
121 controlPanel =
new javax.swing.JPanel();
122 sortByLabel =
new javax.swing.JLabel();
123 sortByComboBox =
new javax.swing.JComboBox<>();
124 totalMessagesNameLabel =
new javax.swing.JLabel();
125 totalMessagesNameVal =
new javax.swing.JLabel();
126 totalUniqueMessagesNameLabel =
new javax.swing.JLabel();
127 totalUniqueMessagesNameVal =
new javax.swing.JLabel();
131 jScrollPane1.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
132 jScrollPane1.setOpaque(
false);
133 jScrollPane1.setPreferredSize(
new java.awt.Dimension(32767, 32767));
135 messageTable.setBackground(
new java.awt.Color(221, 221, 235));
136 messageTable.setFont(messageTable.getFont().deriveFont(messageTable.getFont().getSize()+1f));
137 messageTable.setModel(tableModel);
138 messageTable.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_OFF);
139 messageTable.setAutoscrolls(
false);
140 messageTable.setCursor(
new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
141 messageTable.setGridColor(
new java.awt.Color(204, 204, 204));
142 messageTable.setOpaque(
false);
143 messageTable.setSelectionForeground(
new java.awt.Color(0, 0, 0));
144 messageTable.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
145 messageTable.setShowHorizontalLines(
false);
146 messageTable.setShowVerticalLines(
false);
147 messageTable.getTableHeader().setReorderingAllowed(
false);
148 jScrollPane1.setViewportView(messageTable);
150 sortByLabel.setText(
org.openide.util.NbBundle.getMessage(IngestMessagePanel.class,
"IngestMessagePanel.sortByLabel.text"));
152 sortByComboBox.setToolTipText(
org.openide.util.NbBundle.getMessage(IngestMessagePanel.class,
"IngestMessagePanel.sortByComboBox.toolTipText"));
153 sortByComboBox.addActionListener(
new java.awt.event.ActionListener() {
154 public void actionPerformed(java.awt.event.ActionEvent evt) {
155 sortByComboBoxActionPerformed(evt);
159 totalMessagesNameLabel.setText(
org.openide.util.NbBundle.getMessage(IngestMessagePanel.class,
"IngestMessagePanel.totalMessagesNameLabel.text"));
161 totalMessagesNameVal.setText(
org.openide.util.NbBundle.getMessage(IngestMessagePanel.class,
"IngestMessagePanel.totalMessagesNameVal.text"));
163 totalUniqueMessagesNameLabel.setText(
org.openide.util.NbBundle.getMessage(IngestMessagePanel.class,
"IngestMessagePanel.totalUniqueMessagesNameLabel.text"));
165 totalUniqueMessagesNameVal.setText(
org.openide.util.NbBundle.getMessage(IngestMessagePanel.class,
"IngestMessagePanel.totalUniqueMessagesNameVal.text"));
167 javax.swing.GroupLayout controlPanelLayout =
new javax.swing.GroupLayout(controlPanel);
168 controlPanel.setLayout(controlPanelLayout);
169 controlPanelLayout.setHorizontalGroup(
170 controlPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
171 .addGroup(controlPanelLayout.createSequentialGroup()
173 .addComponent(sortByLabel)
174 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
175 .addComponent(sortByComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
176 .addGap(101, 101, 101)
177 .addComponent(totalMessagesNameLabel)
178 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
179 .addComponent(totalMessagesNameVal, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
181 .addComponent(totalUniqueMessagesNameLabel)
182 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
183 .addComponent(totalUniqueMessagesNameVal, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
186 controlPanelLayout.setVerticalGroup(
187 controlPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
188 .addGroup(controlPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
189 .addComponent(sortByComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
190 .addComponent(sortByLabel)
191 .addComponent(totalUniqueMessagesNameLabel)
192 .addComponent(totalUniqueMessagesNameVal)
193 .addComponent(totalMessagesNameLabel)
194 .addComponent(totalMessagesNameVal))
197 javax.swing.GroupLayout layout =
new javax.swing.GroupLayout(
this);
198 this.setLayout(layout);
199 layout.setHorizontalGroup(
200 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
201 .addComponent(controlPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
202 .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 376, Short.MAX_VALUE)
204 layout.setVerticalGroup(
205 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
206 .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
207 .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 201, Short.MAX_VALUE)
209 .addComponent(controlPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
213 private void sortByComboBoxActionPerformed(java.awt.event.ActionEvent evt) {
214 synchronized (
this) {
215 if (sortByComboBox.getSelectedIndex() == 0) {
216 tableModel.reSort(
true);
218 tableModel.reSort(
false);
223 private javax.swing.JPanel controlPanel;
224 private javax.swing.JScrollPane jScrollPane1;
225 private javax.swing.JTable messageTable;
226 private javax.swing.JComboBox<String> sortByComboBox;
227 private javax.swing.JLabel sortByLabel;
228 private javax.swing.JLabel totalMessagesNameLabel;
229 private javax.swing.JLabel totalMessagesNameVal;
230 private javax.swing.JLabel totalUniqueMessagesNameLabel;
231 private javax.swing.JLabel totalUniqueMessagesNameVal;
234 private void customizeComponents() {
235 mainPanel.setOpaque(
true);
236 jScrollPane1.setOpaque(
true);
237 messageTable.setOpaque(
false);
243 sortByComboBox.setModel(
new DefaultComboBoxModel<>(
new String[] {
244 NbBundle.getMessage(this.getClass(),
"IngestMessagePanel.sortByComboBox.model.time"),
245 NbBundle.getMessage(this.getClass(),
"IngestMessagePanel.sortByComboBox.model.priority")}));
247 jScrollPane1.setWheelScrollingEnabled(
true);
249 messageTable.setAutoscrolls(
false);
250 messageTable.setShowHorizontalLines(
false);
251 messageTable.setShowVerticalLines(
false);
253 messageTable.getParent().setBackground(messageTable.getBackground());
255 renderer =
new MessageTableRenderer();
256 int numCols = messageTable.getColumnCount();
259 for (
int i = 0; i < numCols; ++i) {
260 messageTable.getColumnModel().getColumn(i).setCellRenderer(renderer);
263 messageTable.setCellSelectionEnabled(
false);
264 messageTable.setColumnSelectionAllowed(
false);
265 messageTable.setRowSelectionAllowed(
true);
266 messageTable.getSelectionModel().addListSelectionListener(
new MessageVisitedSelection());
269 tableModel.addTableModelListener(
this);
273 public void paint(Graphics g) {
277 setTableSize(messageTable.getParent().getSize());
281 public void setPreferredSize(Dimension dmnsn) {
282 super.setPreferredSize(dmnsn);
283 setTableSize(messageTable.getParent().getSize());
286 void setTableSize(Dimension d) {
287 double[] columnWidths =
new double[]{0.20, 0.08, 0.08, 0.49, 0.15};
288 int numCols = messageTable.getColumnCount();
289 for (
int i = 0; i < numCols; ++i) {
290 messageTable.getColumnModel().getColumn(i).setPreferredWidth((
int) (d.width * columnWidths[i]));
294 public synchronized void addMessage(IngestMessage m) {
295 tableModel.addMessage(m);
299 final int newMsgUnreadUnique = tableModel.getNumberUnreadGroups();
302 messagePcs.firePropertyChange(TOTAL_NUM_MESSAGES_CHANGED, 0, newMsgUnreadUnique);
303 }
catch (Exception e) {
304 logger.log(Level.SEVERE,
"IngestMessagePanel listener threw exception", e);
305 MessageNotifyUtil.Notify.show(NbBundle.getMessage(
this.getClass(),
"IngestMessagePanel.moduleErr"),
306 NbBundle.getMessage(
this.getClass(),
307 "IngestMessagePanel.moduleErr.errListenUpdates.text"),
308 MessageNotifyUtil.MessageType.ERROR);
312 this.totalMessagesNameVal.setText(Long.toString(totalMessages));
313 final int totalMessagesUnique = tableModel.getNumberGroups();
314 this.totalUniqueMessagesNameVal.setText(Integer.toString(totalMessagesUnique));
317 public synchronized void clearMessages() {
318 final int origMsgGroups = tableModel.getNumberUnreadGroups();
320 tableModel.clearMessages();
321 totalMessagesNameVal.setText(
"-");
322 totalUniqueMessagesNameVal.setText(
"-");
325 messagePcs.firePropertyChange(MESSAGES_BOX_CLEARED, origMsgGroups, 0);
326 }
catch (Exception e) {
327 logger.log(Level.SEVERE,
"IngestMessagePanel listener threw exception", e);
328 MessageNotifyUtil.Notify.show(NbBundle.getMessage(
this.getClass(),
"IngestMessagePanel.moduleErr"),
329 NbBundle.getMessage(
this.getClass(),
330 "IngestMessagePanel.moduleErr.errListenUpdates.text"),
331 MessageNotifyUtil.MessageType.ERROR);
335 public synchronized int getMessagesCount() {
336 return tableModel.getNumberMessages();
339 private synchronized void setVisited(
int rowNumber) {
340 final int origMsgGroups = tableModel.getNumberUnreadGroups();
341 tableModel.setVisited(rowNumber);
342 lastRowSelected = rowNumber;
345 messagePcs.firePropertyChange(TOOL_TIP_TEXT_KEY, origMsgGroups, tableModel.getNumberUnreadGroups());
346 }
catch (Exception e) {
347 logger.log(Level.SEVERE,
"IngestMessagePanel listener threw exception", e);
348 MessageNotifyUtil.Notify.show(NbBundle.getMessage(
this.getClass(),
"IngestMessagePanel.moduleErr"),
349 NbBundle.getMessage(
this.getClass(),
350 "IngestMessagePanel.moduleErr.errListenUpdates.text"),
351 MessageNotifyUtil.MessageType.ERROR);
356 public void tableChanged(TableModelEvent e) {
357 int newMessages = tableModel.getNumberNewMessages();
360 messagePcs.firePropertyChange(
new PropertyChangeEvent(tableModel, TOTAL_NUM_NEW_MESSAGES_CHANGED, -1, newMessages));
361 }
catch (Exception ee) {
362 logger.log(Level.SEVERE,
"IngestMessagePanel listener threw exception", ee);
363 MessageNotifyUtil.Notify.show(NbBundle.getMessage(
this.getClass(),
"IngestMessagePanel.moduleErr"),
364 NbBundle.getMessage(
this.getClass(),
365 "IngestMessagePanel.moduleErr.errListenUpdates.text"),
366 MessageNotifyUtil.MessageType.ERROR);
372 private final String[] columnNames =
new String[]{
373 NbBundle.getMessage(this.getClass(),
"IngestMessagePanel.MsgTableMod.colNames.module"),
374 NbBundle.getMessage(this.getClass(),
"IngestMessagePanel.MsgTableMod.colNames.num"),
375 NbBundle.getMessage(this.getClass(),
"IngestMessagePanel.MsgTableMod.colNames.new"),
376 NbBundle.getMessage(this.getClass(),
"IngestMessagePanel.MsgTableMod.colNames.subject"),
377 NbBundle.getMessage(this.getClass(),
"IngestMessagePanel.MsgTableMod.colNames.timestamp")};
378 private final List<TableEntry> messageData =
new ArrayList<>();
380 private final Map<String, Map<String, List<IngestMessageGroup>>> groupings =
new HashMap<>();
381 private boolean chronoSort =
true;
382 private static final int MESSAGE_GROUP_THRESH = 3;
387 return columnNames.length;
392 return getNumberGroups();
396 for (TableEntry entry : messageData) {
397 entry.hasBeenSeen(
true);
399 fireTableChanged(
new TableModelEvent(
this));
404 for (TableEntry entry : messageData) {
405 if (!entry.hasBeenSeen()) {
413 return messageData.size();
418 for (TableEntry e : messageData) {
419 total += e.messageGroup.getCount();
426 for (TableEntry e : messageData) {
427 if (!e.hasBeenVisited) {
428 total += e.messageGroup.getCount();
436 for (TableEntry e : messageData) {
437 if (!e.hasBeenVisited) {
446 return columnNames[column];
450 public synchronized Object
getValueAt(
int rowIndex,
int columnIndex) {
453 int numMessages = messageData.size();
454 if (rowIndex > messageData.size() - 1
455 || columnIndex > columnNames.length - 1) {
458 logger.log(Level.WARNING,
"Requested inbox message at" + rowIndex,
", only have " + numMessages);
461 TableEntry entry = messageData.get(rowIndex);
463 switch (columnIndex) {
465 ret = entry.messageGroup.getSource();
468 ret = entry.messageGroup.getCount();
471 ret = !entry.hasBeenSeen();
474 ret = entry.messageGroup.getSubject();
477 ret = entry.messageGroup.getDatePosted();
480 logger.log(Level.SEVERE,
"Invalid table column index: {0}", columnIndex);
493 return getValueAt(0, c).getClass();
499 for (TableEntry e : messageData) {
500 if (e.messageGroup.getUniqueKey().equals(uniqueKey)) {
513 IngestMessageGroup messageGroup = null;
516 if (!groupings.containsKey(moduleName)) {
517 groupings.put(moduleName,
new HashMap<>());
519 final Map<String, List<IngestMessageGroup>> groups = groupings.get(moduleName);
522 List<IngestMessageGroup> uniqGroups = groups.get(uniqueness);
523 if (uniqGroups == null) {
525 uniqGroups =
new ArrayList<>();
526 messageGroup =
new IngestMessageGroup(m);
527 uniqGroups.add(messageGroup);
528 groups.put(uniqueness, uniqGroups);
530 final int uniqueGroupsCount = uniqGroups.size();
531 if (uniqueGroupsCount > MESSAGE_GROUP_THRESH) {
533 messageGroup = uniqGroups.get(0);
534 for (
int i = 1; i < uniqueGroupsCount; ++i) {
535 messageGroup.addAll(uniqGroups.get(i));
543 uniqGroups.add(messageGroup);
547 while ((toRemove = getTableEntryIndex(uniqueness)) != -1) {
548 messageData.remove(toRemove);
550 this.fireTableRowsDeleted(toRemove, toRemove);
553 }
else if (uniqueGroupsCount == 1) {
554 IngestMessageGroup first = uniqGroups.get(0);
556 if (first.getCount() > 1) {
559 messageGroup = first;
563 while ((toRemove = getTableEntryIndex(uniqueness)) != -1) {
564 messageData.remove(toRemove);
566 this.fireTableRowsDeleted(toRemove, toRemove);
572 messageGroup =
new IngestMessageGroup(m);
573 uniqGroups.add(messageGroup);
579 messageGroup =
new IngestMessageGroup(m);
580 uniqGroups.add(messageGroup);
587 messageGroup =
new IngestMessageGroup(m);
591 messageData.add(
new TableEntry(messageGroup));
592 int newRowIndex = messageData.size() - 1;
593 fireTableRowsInserted(newRowIndex, newRowIndex);
596 if (chronoSort ==
false) {
597 Collections.sort(messageData);
598 fireTableDataChanged();
605 fireTableDataChanged();
609 messageData.get(rowNumber).hasBeenVisited(
true);
611 fireTableCellUpdated(rowNumber, 2);
616 for (TableEntry e : messageData) {
617 if (!e.hasBeenVisited) {
618 e.hasBeenVisited(
true);
619 fireTableCellUpdated(row, 2);
626 if (rowNumber < messageData.size()) {
627 return messageData.get(rowNumber).hasBeenVisited();
634 if (rowNumber < messageData.size()) {
635 return messageData.get(rowNumber).messageGroup.getMessageType();
642 if (rowNumber < messageData.size()) {
643 return messageData.get(rowNumber).messageGroup;
649 public synchronized void reSort(
boolean chronoLogical) {
650 if (chronoSort == chronoLogical) {
654 chronoSort = chronoLogical;
655 Collections.sort(messageData);
656 fireTableDataChanged();
659 class TableEntry
implements Comparable<TableEntry> {
661 IngestMessageGroup messageGroup;
662 boolean hasBeenVisited =
false;
663 boolean hasBeenSeen =
false;
665 public boolean hasBeenVisited() {
666 return hasBeenVisited;
669 public void hasBeenVisited(
boolean visited) {
670 hasBeenVisited = visited;
673 public boolean hasBeenSeen() {
677 public void hasBeenSeen(
boolean seen) {
681 TableEntry(IngestMessageGroup messageGroup) {
682 this.messageGroup = messageGroup;
686 public int compareTo(TableEntry o) {
687 if (chronoSort ==
true) {
688 return this.messageGroup.getDatePosted().compareTo(o.messageGroup.getDatePosted());
690 return messageGroup.getCount() - o.messageGroup.getCount();
698 static class IngestMessageGroup {
700 static final Color VERY_HIGH_PRI_COLOR =
new Color(164, 164, 202);
701 static final Color HIGH_PRI_COLOR =
new Color(180, 180, 211);
702 static final Color MED_PRI_COLOR =
new Color(199, 199, 222);
703 static final Color LOW_PRI_COLOR =
new Color(221, 221, 235);
704 private final List<IngestMessage> messages;
706 IngestMessageGroup(IngestMessage message) {
707 messages =
new ArrayList<>();
708 messages.add(message);
711 private List<IngestMessage> getMessages() {
715 synchronized void add(IngestMessage message) {
716 messages.add(message);
720 synchronized void addAll(IngestMessageGroup group) {
721 for (IngestMessage m : group.getMessages()) {
726 synchronized int getCount() {
727 return messages.size();
730 synchronized String getDetails() {
731 StringBuilder b =
new StringBuilder(
"");
732 for (IngestMessage m : messages) {
733 String details = m.getDetails();
734 if (details == null || details.equals(
"")) {
750 synchronized Color getColor() {
751 int count = messages.size();
753 return VERY_HIGH_PRI_COLOR;
754 }
else if (count < 5) {
755 return HIGH_PRI_COLOR;
756 }
else if (count < 15) {
757 return MED_PRI_COLOR;
759 return LOW_PRI_COLOR;
768 synchronized Date getDatePosted() {
769 return messages.get(messages.size() - 1).getDatePosted();
777 synchronized String getSubject() {
778 return messages.get(0).getSubject();
784 synchronized String getUniqueKey() {
785 return messages.get(0).getUniqueKey();
791 synchronized String getSource() {
792 return messages.get(0).getSource();
798 synchronized BlackboardArtifact getData() {
799 return messages.get(0).getData();
805 synchronized IngestMessage.MessageType getMessageType() {
806 return messages.get(0).getMessageType();
823 this.rowSelected = rowSelected;
828 if (value instanceof Boolean) {
829 return booleanRenderer.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
830 }
else if (value instanceof Date) {
831 return dateRenderer.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
833 return defaultRenderer.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
843 private final String bulletChar =
new String(Character.toChars(0x2022));
848 super.setForeground(table.getSelectionForeground());
849 super.setBackground(table.getSelectionBackground());
852 if (value instanceof Boolean) {
853 boolVal = ((Boolean) value);
855 throw new RuntimeException(NbBundle.getMessage(
this.getClass(),
856 "IngestMessagePanel.BooleanRenderer.exception.nonBoolVal.msg"));
859 String aValue = boolVal ? bulletChar :
"";
861 JLabel cell = (JLabel) super.getTableCellRendererComponent(table, aValue, isSelected, hasFocus, row, column);
864 cell.setHorizontalAlignment(SwingConstants.CENTER);
867 cell.setFont(cell.getFont().deriveFont(Font.PLAIN, cell.getFont().getSize()+5));
869 final IngestMessageGroup messageGroup = tableModel.getMessageGroup(row);
870 if (messageGroup != null) {
873 cell.setBackground(ERROR_COLOR);
875 cell.setBackground(Color.orange);
878 cell.setBackground(messageGroup.getColor());
893 JTable table, Object value,
894 boolean isSelected,
boolean hasFocus,
895 int row,
int column) {
897 Component cell = super.getTableCellRendererComponent(
898 table, value,
false,
false, row, column);
900 Font visitedFont = cell.getFont().deriveFont(Font.PLAIN, cell.getFont().getSize()+1);
901 Font notVisitedFont = cell.getFont().deriveFont(Font.BOLD, cell.getFont().getSize()+1);
904 String subject = (String) value;
905 setToolTipText(subject);
906 if (tableModel.isVisited(row)) {
907 cell.setFont(visitedFont);
909 cell.setFont(notVisitedFont);
913 final IngestMessageGroup messageGroup = tableModel.getMessageGroup(row);
914 if (messageGroup != null) {
917 cell.setBackground(ERROR_COLOR);
919 cell.setBackground(Color.orange);
922 cell.setBackground(messageGroup.getColor());
934 super.setForeground(table.getSelectionForeground());
935 super.setBackground(table.getSelectionBackground());
937 Object aValue = value;
938 if (value instanceof Date) {
939 Date date = (Date) value;
940 DateFormat df =
new SimpleDateFormat(
"yyyy/MM/dd HH:mm:ss");
941 aValue = df.format(date);
943 throw new RuntimeException(NbBundle.getMessage(
this.getClass(),
944 "IngestMessagePanel.DateRenderer.exception.nonDateVal.text"));
947 Component cell = super.getTableCellRendererComponent(table, aValue, isSelected, hasFocus, row, column);
949 final IngestMessageGroup messageGroup = tableModel.getMessageGroup(row);
950 if (messageGroup != null) {
953 cell.setBackground(ERROR_COLOR);
955 cell.setBackground(Color.orange);
958 cell.setBackground(messageGroup.getColor());
973 ListSelectionModel selModel = (ListSelectionModel) e.getSource();
974 if (selModel.isSelectionEmpty() || selModel.getValueIsAdjusting()) {
978 final int minIndex = selModel.getMinSelectionIndex();
979 final int maxIndex = selModel.getMaxSelectionIndex();
981 for (
int i = minIndex; i <= maxIndex; i++) {
982 if (selModel.isSelectedIndex(i)) {
987 selModel.clearSelection();
988 if (selected != -1) {
989 setVisited(selected);
990 messageTable.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
992 IngestMessageGroup m = getMessageGroup(selected);
994 String details = m.getDetails();
995 if (details != null && !details.equals(
"")) {
996 mainPanel.showDetails(selected);
999 messageTable.setCursor(null);
synchronized int getRowCount()
synchronized int getTableEntryIndex(String uniqueKey)
synchronized IngestMessageGroup getMessageGroup(int rowNumber)
Class<?> getColumnClass(int c)
boolean isCellEditable(int rowIndex, int columnIndex)
synchronized int getNumberNewMessages()
MessageType getMessageType()
synchronized void markAllSeen()
String getColumnName(int column)
synchronized int getNumberUnreadMessages()
synchronized int getNumberUnreadGroups()
Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column)
void valueChanged(ListSelectionEvent e)
Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column)
synchronized int getNumberGroups()
Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column)
synchronized void setVisitedAll()
void setRowSelected(int rowSelected)
synchronized void addMessage(IngestMessage m)
Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column)
synchronized void clearMessages()
synchronized int getNumberMessages()
synchronized static Logger getLogger(String name)
synchronized boolean isVisited(int rowNumber)
synchronized MessageType getMessageType(int rowNumber)
synchronized Object getValueAt(int rowIndex, int columnIndex)
synchronized void setVisited(int rowNumber)
synchronized void reSort(boolean chronoLogical)