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 javax.swing.JLabel;
39 import javax.swing.JPanel;
40 import org.openide.util.NbBundle;
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;
55 import java.util.logging.Level;
61 class IngestMessagePanel
extends JPanel implements TableModelListener {
63 private final MessageTableModel tableModel;
64 private MessageTableRenderer renderer;
65 private final IngestMessageMainPanel mainPanel;
66 private static final Color ERROR_COLOR =
new Color(255, 90, 90);
67 private volatile int lastRowSelected = -1;
68 private volatile long totalMessages = 0;
69 private static final Logger logger = Logger.getLogger(IngestMessagePanel.class.getName());
70 private static final PropertyChangeSupport messagePcs =
new PropertyChangeSupport(IngestMessagePanel.class);
71 static final String TOTAL_NUM_MESSAGES_CHANGED =
"TOTAL_NUM_MESSAGES_CHANGED";
72 static final String MESSAGES_BOX_CLEARED =
"MESSAGES_BOX_CLEARED";
73 static final String TOTAL_NUM_NEW_MESSAGES_CHANGED =
"TOTAL_NUM_NEW_MESSAGES_CHANGED";
78 public IngestMessagePanel(IngestMessageMainPanel mainPanel) {
79 this.mainPanel = mainPanel;
80 tableModel =
new MessageTableModel();
82 customizeComponents();
85 public void markAllSeen() {
86 tableModel.markAllSeen();
89 int getLastRowSelected() {
90 return this.lastRowSelected;
93 synchronized IngestMessageGroup getSelectedMessage() {
94 if (lastRowSelected < 0) {
98 return tableModel.getMessageGroup(lastRowSelected);
101 synchronized IngestMessageGroup getMessageGroup(
int rowNumber) {
102 return tableModel.getMessageGroup(rowNumber);
105 synchronized static void addPropertyChangeSupportListener(PropertyChangeListener l) {
106 messagePcs.addPropertyChangeListener(l);
114 @SuppressWarnings(
"unchecked")
116 private
void initComponents() {
118 jScrollPane1 =
new javax.swing.JScrollPane();
119 messageTable =
new javax.swing.JTable();
120 controlPanel =
new javax.swing.JPanel();
121 sortByLabel =
new javax.swing.JLabel();
122 sortByComboBox =
new javax.swing.JComboBox<>();
123 totalMessagesNameLabel =
new javax.swing.JLabel();
124 totalMessagesNameVal =
new javax.swing.JLabel();
125 totalUniqueMessagesNameLabel =
new javax.swing.JLabel();
126 totalUniqueMessagesNameVal =
new javax.swing.JLabel();
130 jScrollPane1.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
131 jScrollPane1.setOpaque(
false);
132 jScrollPane1.setPreferredSize(
new java.awt.Dimension(32767, 32767));
134 messageTable.setBackground(
new java.awt.Color(221, 221, 235));
135 messageTable.setFont(messageTable.getFont().deriveFont(messageTable.getFont().getStyle() & ~java.awt.Font.BOLD, 12));
136 messageTable.setModel(tableModel);
137 messageTable.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_OFF);
138 messageTable.setAutoscrolls(
false);
139 messageTable.setCursor(
new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
140 messageTable.setGridColor(
new java.awt.Color(204, 204, 204));
141 messageTable.setOpaque(
false);
142 messageTable.setSelectionForeground(
new java.awt.Color(0, 0, 0));
143 messageTable.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
144 messageTable.setShowHorizontalLines(
false);
145 messageTable.setShowVerticalLines(
false);
146 messageTable.getTableHeader().setReorderingAllowed(
false);
147 jScrollPane1.setViewportView(messageTable);
149 sortByLabel.setText(
org.openide.util.NbBundle.getMessage(IngestMessagePanel.class,
"IngestMessagePanel.sortByLabel.text"));
151 sortByComboBox.setFont(sortByComboBox.getFont().deriveFont(sortByComboBox.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
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.setFont(totalMessagesNameLabel.getFont().deriveFont(totalMessagesNameLabel.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
160 totalMessagesNameLabel.setText(
org.openide.util.NbBundle.getMessage(IngestMessagePanel.class,
"IngestMessagePanel.totalMessagesNameLabel.text"));
162 totalMessagesNameVal.setFont(totalMessagesNameVal.getFont().deriveFont(totalMessagesNameVal.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
163 totalMessagesNameVal.setText(
org.openide.util.NbBundle.getMessage(IngestMessagePanel.class,
"IngestMessagePanel.totalMessagesNameVal.text"));
165 totalUniqueMessagesNameLabel.setFont(totalUniqueMessagesNameLabel.getFont().deriveFont(totalUniqueMessagesNameLabel.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
166 totalUniqueMessagesNameLabel.setText(
org.openide.util.NbBundle.getMessage(IngestMessagePanel.class,
"IngestMessagePanel.totalUniqueMessagesNameLabel.text"));
168 totalUniqueMessagesNameVal.setFont(totalUniqueMessagesNameVal.getFont().deriveFont(totalUniqueMessagesNameVal.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
169 totalUniqueMessagesNameVal.setText(
org.openide.util.NbBundle.getMessage(IngestMessagePanel.class,
"IngestMessagePanel.totalUniqueMessagesNameVal.text"));
171 javax.swing.GroupLayout controlPanelLayout =
new javax.swing.GroupLayout(controlPanel);
172 controlPanel.setLayout(controlPanelLayout);
173 controlPanelLayout.setHorizontalGroup(
174 controlPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
175 .addGroup(controlPanelLayout.createSequentialGroup()
177 .addComponent(sortByLabel)
178 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
179 .addComponent(sortByComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
180 .addGap(101, 101, 101)
181 .addComponent(totalMessagesNameLabel)
182 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
183 .addComponent(totalMessagesNameVal, javax.swing.GroupLayout.DEFAULT_SIZE, 24, Short.MAX_VALUE)
185 .addComponent(totalUniqueMessagesNameLabel)
186 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
187 .addComponent(totalUniqueMessagesNameVal, javax.swing.GroupLayout.DEFAULT_SIZE, 24, Short.MAX_VALUE)
190 controlPanelLayout.setVerticalGroup(
191 controlPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
192 .addGroup(controlPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
193 .addComponent(sortByComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
194 .addComponent(sortByLabel)
195 .addComponent(totalUniqueMessagesNameLabel)
196 .addComponent(totalUniqueMessagesNameVal)
197 .addComponent(totalMessagesNameLabel)
198 .addComponent(totalMessagesNameVal))
201 javax.swing.GroupLayout layout =
new javax.swing.GroupLayout(
this);
202 this.setLayout(layout);
203 layout.setHorizontalGroup(
204 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
205 .addComponent(controlPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
206 .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 357, Short.MAX_VALUE)
208 layout.setVerticalGroup(
209 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
210 .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
211 .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 201, Short.MAX_VALUE)
213 .addComponent(controlPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
217 private void sortByComboBoxActionPerformed(java.awt.event.ActionEvent evt) {
218 synchronized (
this) {
219 if (sortByComboBox.getSelectedIndex() == 0) {
220 tableModel.reSort(
true);
222 tableModel.reSort(
false);
227 private javax.swing.JPanel controlPanel;
228 private javax.swing.JScrollPane jScrollPane1;
229 private javax.swing.JTable messageTable;
230 private javax.swing.JComboBox<String> sortByComboBox;
231 private javax.swing.JLabel sortByLabel;
232 private javax.swing.JLabel totalMessagesNameLabel;
233 private javax.swing.JLabel totalMessagesNameVal;
234 private javax.swing.JLabel totalUniqueMessagesNameLabel;
235 private javax.swing.JLabel totalUniqueMessagesNameVal;
238 private void customizeComponents() {
239 mainPanel.setOpaque(
true);
240 jScrollPane1.setOpaque(
true);
241 messageTable.setOpaque(
false);
247 sortByComboBox.setModel(
new javax.swing.DefaultComboBoxModel<String>(
new String[] {
248 NbBundle.getMessage(this.getClass(),
"IngestMessagePanel.sortByComboBox.model.time"),
249 NbBundle.getMessage(this.getClass(),
"IngestMessagePanel.sortByComboBox.model.priority")}));
251 jScrollPane1.setWheelScrollingEnabled(
true);
253 messageTable.setAutoscrolls(
false);
254 messageTable.setShowHorizontalLines(
false);
255 messageTable.setShowVerticalLines(
false);
257 messageTable.getParent().setBackground(messageTable.getBackground());
259 renderer =
new MessageTableRenderer();
260 int numCols = messageTable.getColumnCount();
263 for (
int i = 0; i < numCols; ++i) {
264 messageTable.getColumnModel().getColumn(i).setCellRenderer(renderer);
267 messageTable.setCellSelectionEnabled(
false);
268 messageTable.setColumnSelectionAllowed(
false);
269 messageTable.setRowSelectionAllowed(
true);
270 messageTable.getSelectionModel().addListSelectionListener(
new MessageVisitedSelection());
273 tableModel.addTableModelListener(
this);
277 public void paint(Graphics g) {
281 setTableSize(messageTable.getParent().getSize());
285 public void setPreferredSize(Dimension dmnsn) {
286 super.setPreferredSize(dmnsn);
287 setTableSize(messageTable.getParent().getSize());
290 void setTableSize(Dimension d) {
291 double[] columnWidths =
new double[]{0.20, 0.08, 0.08, 0.49, 0.15};
292 int numCols = messageTable.getColumnCount();
293 for (
int i = 0; i < numCols; ++i) {
294 messageTable.getColumnModel().getColumn(i).setPreferredWidth((
int) (d.width * columnWidths[i]));
298 public synchronized void addMessage(IngestMessage m) {
299 tableModel.addMessage(m);
303 final int newMsgUnreadUnique = tableModel.getNumberUnreadGroups();
306 messagePcs.firePropertyChange(TOTAL_NUM_MESSAGES_CHANGED, 0, newMsgUnreadUnique);
307 }
catch (Exception e) {
308 logger.log(Level.SEVERE,
"IngestMessagePanel listener threw exception", e);
309 MessageNotifyUtil.Notify.show(NbBundle.getMessage(
this.getClass(),
"IngestMessagePanel.moduleErr"),
310 NbBundle.getMessage(
this.getClass(),
311 "IngestMessagePanel.moduleErr.errListenUpdates.text"),
312 MessageNotifyUtil.MessageType.ERROR);
316 this.totalMessagesNameVal.setText(Long.toString(totalMessages));
317 final int totalMessagesUnique = tableModel.getNumberGroups();
318 this.totalUniqueMessagesNameVal.setText(Integer.toString(totalMessagesUnique));
321 public synchronized void clearMessages() {
322 final int origMsgGroups = tableModel.getNumberUnreadGroups();
324 tableModel.clearMessages();
325 totalMessagesNameVal.setText(
"-");
326 totalUniqueMessagesNameVal.setText(
"-");
329 messagePcs.firePropertyChange(MESSAGES_BOX_CLEARED, origMsgGroups, 0);
330 }
catch (Exception e) {
331 logger.log(Level.SEVERE,
"IngestMessagePanel listener threw exception", e);
332 MessageNotifyUtil.Notify.show(NbBundle.getMessage(
this.getClass(),
"IngestMessagePanel.moduleErr"),
333 NbBundle.getMessage(
this.getClass(),
334 "IngestMessagePanel.moduleErr.errListenUpdates.text"),
335 MessageNotifyUtil.MessageType.ERROR);
339 public synchronized int getMessagesCount() {
340 return tableModel.getNumberMessages();
343 private synchronized void setVisited(
int rowNumber) {
344 final int origMsgGroups = tableModel.getNumberUnreadGroups();
345 tableModel.setVisited(rowNumber);
346 lastRowSelected = rowNumber;
349 messagePcs.firePropertyChange(TOOL_TIP_TEXT_KEY, origMsgGroups, tableModel.getNumberUnreadGroups());
350 }
catch (Exception e) {
351 logger.log(Level.SEVERE,
"IngestMessagePanel listener threw exception", e);
352 MessageNotifyUtil.Notify.show(NbBundle.getMessage(
this.getClass(),
"IngestMessagePanel.moduleErr"),
353 NbBundle.getMessage(
this.getClass(),
354 "IngestMessagePanel.moduleErr.errListenUpdates.text"),
355 MessageNotifyUtil.MessageType.ERROR);
360 public void tableChanged(TableModelEvent e) {
361 int newMessages = tableModel.getNumberNewMessages();
364 messagePcs.firePropertyChange(
new PropertyChangeEvent(tableModel, TOTAL_NUM_NEW_MESSAGES_CHANGED, -1, newMessages));
365 }
catch (Exception ee) {
366 logger.log(Level.SEVERE,
"IngestMessagePanel listener threw exception", ee);
367 MessageNotifyUtil.Notify.show(NbBundle.getMessage(
this.getClass(),
"IngestMessagePanel.moduleErr"),
368 NbBundle.getMessage(
this.getClass(),
369 "IngestMessagePanel.moduleErr.errListenUpdates.text"),
370 MessageNotifyUtil.MessageType.ERROR);
377 NbBundle.getMessage(this.getClass(),
"IngestMessagePanel.MsgTableMod.colNames.module"),
378 NbBundle.getMessage(this.getClass(),
"IngestMessagePanel.MsgTableMod.colNames.num"),
379 NbBundle.getMessage(this.getClass(),
"IngestMessagePanel.MsgTableMod.colNames.new"),
380 NbBundle.getMessage(this.getClass(),
"IngestMessagePanel.MsgTableMod.colNames.subject"),
381 NbBundle.getMessage(this.getClass(),
"IngestMessagePanel.MsgTableMod.colNames.timestamp")};
384 private final Map<String, Map<String, List<IngestMessageGroup>>>
groupings =
new HashMap<>();
391 return columnNames.length;
400 for (TableEntry entry : messageData) {
401 entry.hasBeenSeen(
true);
403 fireTableChanged(
new TableModelEvent(
this));
408 for (TableEntry entry : messageData) {
409 if (!entry.hasBeenSeen()) {
417 return messageData.size();
422 for (TableEntry e : messageData) {
423 total += e.messageGroup.getCount();
430 for (TableEntry e : messageData) {
431 if (!e.hasBeenVisited) {
432 total += e.messageGroup.getCount();
440 for (TableEntry e : messageData) {
441 if (!e.hasBeenVisited) {
450 return columnNames[column];
454 public synchronized Object
getValueAt(
int rowIndex,
int columnIndex) {
457 int numMessages = messageData.size();
458 if (rowIndex > messageData.size() - 1
459 || columnIndex > columnNames.length - 1) {
462 logger.log(Level.WARNING,
"Requested inbox message at" + rowIndex,
", only have " + numMessages);
465 TableEntry entry = messageData.get(rowIndex);
467 switch (columnIndex) {
469 ret = entry.messageGroup.getSource();
472 ret = entry.messageGroup.getCount();
475 ret = !entry.hasBeenSeen();
478 ret = entry.messageGroup.getSubject();
481 ret = entry.messageGroup.getDatePosted();
484 logger.log(Level.SEVERE,
"Invalid table column index: {0}", columnIndex);
503 for (TableEntry e : messageData) {
504 if (e.messageGroup.getUniqueKey().equals(uniqueKey)) {
517 IngestMessageGroup messageGroup = null;
520 if (!groupings.containsKey(moduleName)) {
521 groupings.put(moduleName,
new HashMap<String, List<IngestMessageGroup>>());
523 final Map<String, List<IngestMessageGroup>> groups = groupings.get(moduleName);
526 List<IngestMessageGroup> uniqGroups = groups.get(uniqueness);
527 if (uniqGroups == null) {
529 uniqGroups =
new ArrayList<>();
530 messageGroup =
new IngestMessageGroup(m);
531 uniqGroups.add(messageGroup);
532 groups.put(uniqueness, uniqGroups);
534 final int uniqueGroupsCount = uniqGroups.size();
535 if (uniqueGroupsCount > MESSAGE_GROUP_THRESH) {
537 messageGroup = uniqGroups.get(0);
538 for (
int i = 1; i < uniqueGroupsCount; ++i) {
539 messageGroup.addAll(uniqGroups.get(i));
547 uniqGroups.add(messageGroup);
552 messageData.remove(toRemove);
554 this.fireTableRowsDeleted(toRemove, toRemove);
557 }
else if (uniqueGroupsCount == 1) {
558 IngestMessageGroup first = uniqGroups.get(0);
560 if (first.getCount() > 1) {
563 messageGroup = first;
568 messageData.remove(toRemove);
570 this.fireTableRowsDeleted(toRemove, toRemove);
576 messageGroup =
new IngestMessageGroup(m);
577 uniqGroups.add(messageGroup);
583 messageGroup =
new IngestMessageGroup(m);
584 uniqGroups.add(messageGroup);
591 messageGroup =
new IngestMessageGroup(m);
595 messageData.add(
new TableEntry(messageGroup));
596 int newRowIndex = messageData.size() - 1;
597 fireTableRowsInserted(newRowIndex, newRowIndex);
600 if (chronoSort ==
false) {
601 Collections.sort(messageData);
602 fireTableDataChanged();
609 fireTableDataChanged();
613 messageData.get(rowNumber).hasBeenVisited(
true);
615 fireTableCellUpdated(rowNumber, 2);
620 for (TableEntry e : messageData) {
621 if (!e.hasBeenVisited) {
622 e.hasBeenVisited(
true);
623 fireTableCellUpdated(row, 2);
630 if (rowNumber < messageData.size()) {
631 return messageData.get(rowNumber).hasBeenVisited();
638 if (rowNumber < messageData.size()) {
639 return messageData.get(rowNumber).messageGroup.getMessageType();
646 if (rowNumber < messageData.size()) {
647 return messageData.get(rowNumber).messageGroup;
653 public synchronized void reSort(
boolean chronoLogical) {
654 if (chronoSort == chronoLogical) {
658 chronoSort = chronoLogical;
659 Collections.sort(messageData);
660 fireTableDataChanged();
663 class TableEntry
implements Comparable<TableEntry> {
665 IngestMessageGroup messageGroup;
666 boolean hasBeenVisited =
false;
667 boolean hasBeenSeen =
false;
669 public boolean hasBeenVisited() {
670 return hasBeenVisited;
673 public void hasBeenVisited(
boolean visited) {
674 hasBeenVisited = visited;
677 public boolean hasBeenSeen() {
681 public void hasBeenSeen(
boolean seen) {
685 TableEntry(IngestMessageGroup messageGroup) {
686 this.messageGroup = messageGroup;
690 public int compareTo(TableEntry o) {
691 if (chronoSort ==
true) {
692 return this.messageGroup.getDatePosted().compareTo(o.messageGroup.getDatePosted());
694 return messageGroup.getCount() - o.messageGroup.getCount();
702 static class IngestMessageGroup {
704 static final Color VERY_HIGH_PRI_COLOR =
new Color(164, 164, 202);
705 static final Color HIGH_PRI_COLOR =
new Color(180, 180, 211);
706 static final Color MED_PRI_COLOR =
new Color(199, 199, 222);
707 static final Color LOW_PRI_COLOR =
new Color(221, 221, 235);
708 private final List<IngestMessage> messages;
710 IngestMessageGroup(IngestMessage message) {
711 messages =
new ArrayList<>();
712 messages.add(message);
715 private List<IngestMessage> getMessages() {
719 synchronized void add(IngestMessage message) {
720 messages.add(message);
724 synchronized void addAll(IngestMessageGroup group) {
725 for (IngestMessage m : group.getMessages()) {
730 synchronized int getCount() {
731 return messages.size();
734 synchronized String getDetails() {
735 StringBuilder b =
new StringBuilder(
"");
736 for (IngestMessage m : messages) {
737 String details = m.getDetails();
738 if (details == null || details.equals(
"")) {
754 synchronized Color getColor() {
755 int count = messages.size();
757 return VERY_HIGH_PRI_COLOR;
758 }
else if (count < 5) {
759 return HIGH_PRI_COLOR;
760 }
else if (count < 15) {
761 return MED_PRI_COLOR;
763 return LOW_PRI_COLOR;
772 synchronized Date getDatePosted() {
773 return messages.get(messages.size() - 1).getDatePosted();
781 synchronized String getSubject() {
782 return messages.get(0).getSubject();
788 synchronized String getUniqueKey() {
789 return messages.get(0).getUniqueKey();
795 synchronized String getSource() {
796 return messages.get(0).getSource();
802 synchronized BlackboardArtifact getData() {
803 return messages.get(0).getData();
809 synchronized IngestMessage.MessageType getMessageType() {
810 return messages.get(0).getMessageType();
832 if (value instanceof Boolean) {
833 return booleanRenderer.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
834 }
else if (value instanceof Date) {
835 return dateRenderer.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
837 return defaultRenderer.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
847 private final String
bulletChar =
new String(Character.toChars(0x2022));
852 super.setForeground(table.getSelectionForeground());
853 super.setBackground(table.getSelectionBackground());
856 if (value instanceof Boolean) {
857 boolVal = ((Boolean) value);
859 throw new RuntimeException(NbBundle.getMessage(
this.getClass(),
860 "IngestMessagePanel.BooleanRenderer.exception.nonBoolVal.msg"));
863 String aValue = boolVal ? bulletChar :
"";
865 JLabel cell = (JLabel) super.getTableCellRendererComponent(table, aValue, isSelected, hasFocus, row, column);
868 cell.setHorizontalAlignment(SwingConstants.CENTER);
871 cell.setFont(cell.getFont().deriveFont(Font.PLAIN, 16));
873 final IngestMessageGroup messageGroup = tableModel.getMessageGroup(row);
874 if (messageGroup != null) {
877 cell.setBackground(ERROR_COLOR);
879 cell.setBackground(Color.orange);
882 cell.setBackground(messageGroup.getColor());
897 JTable table, Object value,
898 boolean isSelected,
boolean hasFocus,
899 int row,
int column) {
901 Component cell = super.getTableCellRendererComponent(
902 table, value,
false,
false, row, column);
904 Font visitedFont = cell.getFont().deriveFont(Font.PLAIN, 12);
905 Font notVisitedFont = cell.getFont().deriveFont(Font.BOLD, 12);
908 String subject = (String) value;
909 setToolTipText(subject);
910 if (tableModel.isVisited(row)) {
911 cell.setFont(visitedFont);
913 cell.setFont(notVisitedFont);
917 final IngestMessageGroup messageGroup = tableModel.getMessageGroup(row);
918 if (messageGroup != null) {
921 cell.setBackground(ERROR_COLOR);
923 cell.setBackground(Color.orange);
926 cell.setBackground(messageGroup.getColor());
938 super.setForeground(table.getSelectionForeground());
939 super.setBackground(table.getSelectionBackground());
941 Object aValue = value;
942 if (value instanceof Date) {
943 Date date = (Date) value;
944 DateFormat df =
new SimpleDateFormat(
"HH:mm:ss");
945 aValue = df.format(date);
947 throw new RuntimeException(NbBundle.getMessage(
this.getClass(),
948 "IngestMessagePanel.DateRenderer.exception.nonDateVal.text"));
951 Component cell = super.getTableCellRendererComponent(table, aValue, isSelected, hasFocus, row, column);
953 final IngestMessageGroup messageGroup = tableModel.getMessageGroup(row);
954 if (messageGroup != null) {
957 cell.setBackground(ERROR_COLOR);
959 cell.setBackground(Color.orange);
962 cell.setBackground(messageGroup.getColor());
977 ListSelectionModel selModel = (ListSelectionModel) e.getSource();
978 if (selModel.isSelectionEmpty() || selModel.getValueIsAdjusting()) {
982 final int minIndex = selModel.getMinSelectionIndex();
983 final int maxIndex = selModel.getMaxSelectionIndex();
985 for (
int i = minIndex; i <= maxIndex; i++) {
986 if (selModel.isSelectedIndex(i)) {
991 selModel.clearSelection();
992 if (selected != -1) {
993 setVisited(selected);
994 messageTable.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
996 IngestMessageGroup m = getMessageGroup(selected);
998 String details = m.getDetails();
999 if (details != null && !details.equals(
"")) {
1000 mainPanel.showDetails(selected);
1003 messageTable.setCursor(null);
synchronized int getRowCount()
synchronized int getTableEntryIndex(String uniqueKey)
final TableCellRenderer defaultRenderer
synchronized IngestMessageGroup getMessageGroup(int rowNumber)
Class<?> getColumnClass(int c)
boolean isCellEditable(int rowIndex, int columnIndex)
synchronized int getNumberNewMessages()
MessageType getMessageType()
synchronized void markAllSeen()
static final int MESSAGE_GROUP_THRESH
String getColumnName(int column)
final Map< String, Map< String, List< IngestMessageGroup > > > groupings
synchronized int getNumberUnreadMessages()
final String[] columnNames
final TableCellRenderer dateRenderer
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)
final TableCellRenderer booleanRenderer
synchronized MessageType getMessageType(int rowNumber)
final List< TableEntry > messageData
synchronized Object getValueAt(int rowIndex, int columnIndex)
synchronized void setVisited(int rowNumber)
synchronized void reSort(boolean chronoLogical)