19 package org.sleuthkit.autopsy.datasourcesummary.uiutils;
21 import java.awt.Component;
22 import java.awt.event.MouseEvent;
23 import java.util.List;
24 import javax.swing.BorderFactory;
25 import javax.swing.JLabel;
26 import javax.swing.JMenuItem;
27 import javax.swing.JPopupMenu;
28 import javax.swing.JTable;
29 import javax.swing.border.Border;
30 import javax.swing.table.DefaultTableCellRenderer;
31 import org.apache.commons.collections.CollectionUtils;
44 private static final Border
DEFAULT_BORDER = BorderFactory.createEmptyBorder(2, 4, 2, 4);
48 boolean isSelected,
boolean hasFocus,
int row,
int column) {
50 JLabel c = (JLabel) super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
69 defaultCell.setText(cellModel.
getText());
70 defaultCell.setToolTipText(cellModel.
getTooltip());
76 defaultCell.setHorizontalAlignment(alignment);
77 defaultCell.setBorder(DEFAULT_BORDER);
96 if (CollectionUtils.isNotEmpty(menuItems)) {
97 final JPopupMenu popupMenu =
new JPopupMenu();
99 JMenuItem jMenuItem =
new JMenuItem(mItem.getTitle());
100 if (mItem.getAction() != null) {
101 jMenuItem.addActionListener((evt) -> mItem.getAction().run());
103 popupMenu.add(jMenuItem);
List< MenuItem > getPopupMenu()
Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column)
static final CellMouseListener DEFAULT_CELL_MOUSE_LISTENER
static final Border DEFAULT_BORDER
static final int DEFAULT_ALIGNMENT
MouseEvent getMouseEvent()
Component getTableCellRendererComponent(JLabel defaultCell, GuiCellModel cellModel)
static final long serialVersionUID
static CellMouseListener getMouseListener()
HorizontalAlign getHorizontalAlignment()