mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-14 17:06:16 +00:00
7660 make tables have uniform look and feel
This commit is contained in:
parent
f21657f50c
commit
ef741d60d0
@ -1,11 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" ?>
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
|
||||||
<Form version="1.5" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
|
<Form version="1.5" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
|
||||||
<Properties>
|
|
||||||
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
|
||||||
<Dimension value="[32767, 32767]"/>
|
|
||||||
</Property>
|
|
||||||
</Properties>
|
|
||||||
<AuxValues>
|
<AuxValues>
|
||||||
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/>
|
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/>
|
||||||
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
|
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
|
||||||
@ -16,6 +11,7 @@
|
|||||||
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
|
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
|
||||||
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
|
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
|
||||||
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
|
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
|
||||||
|
<AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,1,44,0,0,1,-112"/>
|
||||||
</AuxValues>
|
</AuxValues>
|
||||||
|
|
||||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
|
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
|
||||||
@ -35,9 +31,6 @@
|
|||||||
<SubComponents>
|
<SubComponents>
|
||||||
<Container class="javax.swing.JPanel" name="contentPanel">
|
<Container class="javax.swing.JPanel" name="contentPanel">
|
||||||
<Properties>
|
<Properties>
|
||||||
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
|
||||||
<Dimension value="[32767, 32767]"/>
|
|
||||||
</Property>
|
|
||||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||||
<Dimension value="[625, 150]"/>
|
<Dimension value="[625, 150]"/>
|
||||||
</Property>
|
</Property>
|
||||||
@ -60,9 +53,6 @@
|
|||||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||||
<Dimension value="[16, 16]"/>
|
<Dimension value="[16, 16]"/>
|
||||||
</Property>
|
</Property>
|
||||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
|
||||||
<Dimension value="null"/>
|
|
||||||
</Property>
|
|
||||||
</Properties>
|
</Properties>
|
||||||
<AuxValues>
|
<AuxValues>
|
||||||
<AuxValue name="JavaCodeGenerator_VariableLocal" type="java.lang.Boolean" value="true"/>
|
<AuxValue name="JavaCodeGenerator_VariableLocal" type="java.lang.Boolean" value="true"/>
|
||||||
@ -85,6 +75,9 @@
|
|||||||
<Property name="columnModel" type="javax.swing.table.TableColumnModel" editor="org.netbeans.modules.form.editors2.TableColumnModelEditor">
|
<Property name="columnModel" type="javax.swing.table.TableColumnModel" editor="org.netbeans.modules.form.editors2.TableColumnModelEditor">
|
||||||
<TableColumnModel selectionModel="1"/>
|
<TableColumnModel selectionModel="1"/>
|
||||||
</Property>
|
</Property>
|
||||||
|
<Property name="gridColor" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
|
||||||
|
<Color blue="f0" green="f0" id="InternalFrame.borderColor" palette="3" red="f0" type="palette"/>
|
||||||
|
</Property>
|
||||||
<Property name="tableHeader" type="javax.swing.table.JTableHeader" editor="org.netbeans.modules.form.editors2.JTableHeaderEditor">
|
<Property name="tableHeader" type="javax.swing.table.JTableHeader" editor="org.netbeans.modules.form.editors2.JTableHeaderEditor">
|
||||||
<TableHeader reorderingAllowed="false" resizingAllowed="true"/>
|
<TableHeader reorderingAllowed="false" resizingAllowed="true"/>
|
||||||
</Property>
|
</Property>
|
||||||
@ -157,6 +150,9 @@
|
|||||||
<Property name="columnModel" type="javax.swing.table.TableColumnModel" editor="org.netbeans.modules.form.editors2.TableColumnModelEditor">
|
<Property name="columnModel" type="javax.swing.table.TableColumnModel" editor="org.netbeans.modules.form.editors2.TableColumnModelEditor">
|
||||||
<TableColumnModel selectionModel="0"/>
|
<TableColumnModel selectionModel="0"/>
|
||||||
</Property>
|
</Property>
|
||||||
|
<Property name="gridColor" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
|
||||||
|
<Color blue="f0" green="f0" id="InternalFrame.borderColor" palette="3" red="f0" type="palette"/>
|
||||||
|
</Property>
|
||||||
<Property name="tableHeader" type="javax.swing.table.JTableHeader" editor="org.netbeans.modules.form.editors2.JTableHeaderEditor">
|
<Property name="tableHeader" type="javax.swing.table.JTableHeader" editor="org.netbeans.modules.form.editors2.JTableHeaderEditor">
|
||||||
<TableHeader reorderingAllowed="true" resizingAllowed="true"/>
|
<TableHeader reorderingAllowed="true" resizingAllowed="true"/>
|
||||||
</Property>
|
</Property>
|
||||||
|
@ -267,19 +267,17 @@ public final class IngestJobInfoPanel extends javax.swing.JPanel {
|
|||||||
javax.swing.JScrollPane ingestModulesScrollPane = new javax.swing.JScrollPane();
|
javax.swing.JScrollPane ingestModulesScrollPane = new javax.swing.JScrollPane();
|
||||||
ingestModuleTable = new javax.swing.JTable();
|
ingestModuleTable = new javax.swing.JTable();
|
||||||
|
|
||||||
setMaximumSize(new java.awt.Dimension(32767, 32767));
|
|
||||||
setLayout(new java.awt.BorderLayout());
|
setLayout(new java.awt.BorderLayout());
|
||||||
|
|
||||||
contentPanel.setMaximumSize(new java.awt.Dimension(32767, 32767));
|
|
||||||
contentPanel.setMinimumSize(new java.awt.Dimension(625, 150));
|
contentPanel.setMinimumSize(new java.awt.Dimension(625, 150));
|
||||||
contentPanel.setPreferredSize(new java.awt.Dimension(625, 150));
|
contentPanel.setPreferredSize(new java.awt.Dimension(625, 150));
|
||||||
contentPanel.setLayout(new java.awt.GridBagLayout());
|
contentPanel.setLayout(new java.awt.GridBagLayout());
|
||||||
|
|
||||||
ingestJobsScrollPane.setBorder(null);
|
ingestJobsScrollPane.setBorder(null);
|
||||||
ingestJobsScrollPane.setMinimumSize(new java.awt.Dimension(16, 16));
|
ingestJobsScrollPane.setMinimumSize(new java.awt.Dimension(16, 16));
|
||||||
ingestJobsScrollPane.setPreferredSize(null);
|
|
||||||
|
|
||||||
ingestJobTable.setModel(ingestJobTableModel);
|
ingestJobTable.setModel(ingestJobTableModel);
|
||||||
|
ingestJobTable.setGridColor(javax.swing.UIManager.getDefaults().getColor("InternalFrame.borderColor"));
|
||||||
ingestJobTable.getTableHeader().setReorderingAllowed(false);
|
ingestJobTable.getTableHeader().setReorderingAllowed(false);
|
||||||
ingestJobsScrollPane.setViewportView(ingestJobTable);
|
ingestJobsScrollPane.setViewportView(ingestJobTable);
|
||||||
ingestJobTable.getColumnModel().getSelectionModel().setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
|
ingestJobTable.getColumnModel().getSelectionModel().setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
|
||||||
@ -315,6 +313,7 @@ public final class IngestJobInfoPanel extends javax.swing.JPanel {
|
|||||||
ingestModulesScrollPane.setPreferredSize(new java.awt.Dimension(254, 16));
|
ingestModulesScrollPane.setPreferredSize(new java.awt.Dimension(254, 16));
|
||||||
|
|
||||||
ingestModuleTable.setModel(ingestModuleTableModel);
|
ingestModuleTable.setModel(ingestModuleTableModel);
|
||||||
|
ingestModuleTable.setGridColor(javax.swing.UIManager.getDefaults().getColor("InternalFrame.borderColor"));
|
||||||
ingestModulesScrollPane.setViewportView(ingestModuleTable);
|
ingestModulesScrollPane.setViewportView(ingestModuleTable);
|
||||||
|
|
||||||
gridBagConstraints = new java.awt.GridBagConstraints();
|
gridBagConstraints = new java.awt.GridBagConstraints();
|
||||||
|
@ -80,7 +80,6 @@ final class DataSourceBrowser extends javax.swing.JPanel implements ExplorerMana
|
|||||||
Bundle.DataSourceSummaryNode_column_results_header(), Bundle.DataSourceSummaryNode_column_results_header(),
|
Bundle.DataSourceSummaryNode_column_results_header(), Bundle.DataSourceSummaryNode_column_results_header(),
|
||||||
Bundle.DataSourceSummaryNode_column_tags_header(), Bundle.DataSourceSummaryNode_column_tags_header());
|
Bundle.DataSourceSummaryNode_column_tags_header(), Bundle.DataSourceSummaryNode_column_tags_header());
|
||||||
outline = outlineView.getOutline();
|
outline = outlineView.getOutline();
|
||||||
|
|
||||||
outline.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
|
outline.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
|
||||||
|
|
||||||
dataSourceSummaryList = getDataSourceSummaryList(usageMap, fileCountsMap);
|
dataSourceSummaryList = getDataSourceSummaryList(usageMap, fileCountsMap);
|
||||||
|
@ -26,7 +26,6 @@ import javax.swing.JLabel;
|
|||||||
* painting a JLabel using a java.awt.Graphics object.
|
* painting a JLabel using a java.awt.Graphics object.
|
||||||
*/
|
*/
|
||||||
public class BaseMessageOverlay {
|
public class BaseMessageOverlay {
|
||||||
|
|
||||||
private final JLabel label;
|
private final JLabel label;
|
||||||
private boolean visible = false;
|
private boolean visible = false;
|
||||||
|
|
||||||
|
@ -19,7 +19,6 @@
|
|||||||
package org.sleuthkit.autopsy.datasourcesummary.uiutils;
|
package org.sleuthkit.autopsy.datasourcesummary.uiutils;
|
||||||
|
|
||||||
import java.awt.Component;
|
import java.awt.Component;
|
||||||
import java.awt.Insets;
|
|
||||||
import java.awt.event.MouseEvent;
|
import java.awt.event.MouseEvent;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import javax.swing.BorderFactory;
|
import javax.swing.BorderFactory;
|
||||||
@ -30,7 +29,6 @@ import javax.swing.JTable;
|
|||||||
import javax.swing.border.Border;
|
import javax.swing.border.Border;
|
||||||
import javax.swing.table.DefaultTableCellRenderer;
|
import javax.swing.table.DefaultTableCellRenderer;
|
||||||
import org.apache.commons.collections.CollectionUtils;
|
import org.apache.commons.collections.CollectionUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
import org.sleuthkit.autopsy.datasourcesummary.uiutils.GuiCellModel.MenuItem;
|
import org.sleuthkit.autopsy.datasourcesummary.uiutils.GuiCellModel.MenuItem;
|
||||||
import org.sleuthkit.autopsy.datasourcesummary.uiutils.JTablePanel.CellMouseEvent;
|
import org.sleuthkit.autopsy.datasourcesummary.uiutils.JTablePanel.CellMouseEvent;
|
||||||
import org.sleuthkit.autopsy.datasourcesummary.uiutils.JTablePanel.CellMouseListener;
|
import org.sleuthkit.autopsy.datasourcesummary.uiutils.JTablePanel.CellMouseListener;
|
||||||
@ -43,7 +41,7 @@ public class CellModelTableCellRenderer extends DefaultTableCellRenderer {
|
|||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
private static final int DEFAULT_ALIGNMENT = JLabel.LEFT;
|
private static final int DEFAULT_ALIGNMENT = JLabel.LEFT;
|
||||||
private static final Border DEFAULT_BORDER = BorderFactory.createEmptyBorder(1, 5, 1, 5);
|
private static final Border DEFAULT_BORDER = BorderFactory.createEmptyBorder(2, 4, 2, 4);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Component getTableCellRendererComponent(JTable table, Object value,
|
public Component getTableCellRendererComponent(JTable table, Object value,
|
||||||
@ -62,43 +60,21 @@ public class CellModelTableCellRenderer extends DefaultTableCellRenderer {
|
|||||||
* Customizes the jlabel to match the column model and cell model provided.
|
* Customizes the jlabel to match the column model and cell model provided.
|
||||||
*
|
*
|
||||||
* @param defaultCell The cell to customize that will be displayed in the
|
* @param defaultCell The cell to customize that will be displayed in the
|
||||||
* jtable.
|
* jtable.
|
||||||
* @param cellModel The cell model for this cell.
|
* @param cellModel The cell model for this cell.
|
||||||
*
|
*
|
||||||
* @return The provided defaultCell.
|
* @return The provided defaultCell.
|
||||||
*/
|
*/
|
||||||
protected Component getTableCellRendererComponent(JLabel defaultCell, GuiCellModel cellModel) {
|
protected Component getTableCellRendererComponent(JLabel defaultCell, GuiCellModel cellModel) {
|
||||||
// sets the text for the cell or null if not present.
|
defaultCell.setText(cellModel.getText());
|
||||||
String text = cellModel.getText();
|
defaultCell.setToolTipText(cellModel.getTooltip());
|
||||||
if (StringUtils.isNotBlank(text)) {
|
|
||||||
defaultCell.setText(text);
|
|
||||||
} else {
|
|
||||||
defaultCell.setText(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
// sets the tooltip for the cell if present.
|
|
||||||
String tooltip = cellModel.getTooltip();
|
|
||||||
if (StringUtils.isNotBlank(tooltip)) {
|
|
||||||
defaultCell.setToolTipText(tooltip);
|
|
||||||
} else {
|
|
||||||
defaultCell.setToolTipText(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
// sets the padding for cell text within the cell.
|
|
||||||
Insets insets = cellModel.getInsets();
|
|
||||||
if (insets != null) {
|
|
||||||
defaultCell.setBorder(BorderFactory.createEmptyBorder(insets.top, insets.left, insets.bottom, insets.right));
|
|
||||||
} else {
|
|
||||||
defaultCell.setBorder(DEFAULT_BORDER);
|
|
||||||
}
|
|
||||||
|
|
||||||
// sets the JLabel alignment (left, center, right) or default alignment
|
// sets the JLabel alignment (left, center, right) or default alignment
|
||||||
// if no alignment is specified
|
// if no alignment is specified
|
||||||
int alignment = (cellModel.getHorizontalAlignment() == null)
|
int alignment = (cellModel.getHorizontalAlignment() == null)
|
||||||
? DEFAULT_ALIGNMENT
|
? DEFAULT_ALIGNMENT
|
||||||
: cellModel.getHorizontalAlignment().getJLabelAlignment();
|
: cellModel.getHorizontalAlignment().getJLabelAlignment();
|
||||||
defaultCell.setHorizontalAlignment(alignment);
|
defaultCell.setHorizontalAlignment(alignment);
|
||||||
|
defaultCell.setBorder(DEFAULT_BORDER);
|
||||||
return defaultCell;
|
return defaultCell;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -134,7 +110,7 @@ public class CellModelTableCellRenderer extends DefaultTableCellRenderer {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @return The default cell mouse listener that triggers popups for
|
* @return The default cell mouse listener that triggers popups for
|
||||||
* non-primary button events.
|
* non-primary button events.
|
||||||
*/
|
*/
|
||||||
public static CellMouseListener getMouseListener() {
|
public static CellMouseListener getMouseListener() {
|
||||||
return DEFAULT_CELL_MOUSE_LISTENER;
|
return DEFAULT_CELL_MOUSE_LISTENER;
|
||||||
|
@ -18,27 +18,24 @@
|
|||||||
*/
|
*/
|
||||||
package org.sleuthkit.autopsy.datasourcesummary.uiutils;
|
package org.sleuthkit.autopsy.datasourcesummary.uiutils;
|
||||||
|
|
||||||
import java.awt.Insets;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
import org.sleuthkit.autopsy.datasourcesummary.uiutils.ExcelCellModel;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The default cell model.
|
* The default cell model.
|
||||||
*/
|
*/
|
||||||
public class DefaultCellModel<T> implements GuiCellModel, ExcelCellModel {
|
public class DefaultCellModel<T> implements GuiCellModel, ExcelCellModel {
|
||||||
|
|
||||||
final T data;
|
private final T data;
|
||||||
final Function<T, String> stringConverter;
|
private final String text;
|
||||||
String tooltip;
|
private String tooltip;
|
||||||
CellModel.HorizontalAlign horizontalAlignment;
|
private CellModel.HorizontalAlign horizontalAlignment;
|
||||||
Insets insets;
|
private List<MenuItem> popupMenu;
|
||||||
List<MenuItem> popupMenu;
|
private Supplier<List<MenuItem>> menuItemSupplier;
|
||||||
Supplier<List<MenuItem>> menuItemSupplier;
|
private final String excelFormatString;
|
||||||
final String excelFormatString;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Main constructor.
|
* Main constructor.
|
||||||
@ -52,9 +49,9 @@ public class DefaultCellModel<T> implements GuiCellModel, ExcelCellModel {
|
|||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
*
|
*
|
||||||
* @param data The data to be displayed in the cell.
|
* @param data The data to be displayed in the cell.
|
||||||
* @param stringConverter The means of converting that data to a string or
|
* @param stringConverter The means of converting that data to a string or
|
||||||
* null to use .toString method on object.
|
* null to use .toString method on object.
|
||||||
*/
|
*/
|
||||||
public DefaultCellModel(T data, Function<T, String> stringConverter) {
|
public DefaultCellModel(T data, Function<T, String> stringConverter) {
|
||||||
this(data, stringConverter, null);
|
this(data, stringConverter, null);
|
||||||
@ -63,20 +60,25 @@ public class DefaultCellModel<T> implements GuiCellModel, ExcelCellModel {
|
|||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
*
|
*
|
||||||
* @param data The data to be displayed in the cell.
|
* @param data The data to be displayed in the cell.
|
||||||
* @param stringConverter The means of converting that data to a string or
|
* @param stringConverter The means of converting that data to a string or
|
||||||
* null to use .toString method on object.
|
* null to use .toString method on object.
|
||||||
* @param excelFormatString The apache poi excel format string to use with
|
* @param excelFormatString The apache poi excel format string to use with
|
||||||
* the data.
|
* the data.
|
||||||
*
|
*
|
||||||
* NOTE: Only certain data types can be exported. See
|
* NOTE: Only certain data types can be exported. See
|
||||||
* ExcelTableExport.createCell() for types.
|
* ExcelTableExport.createCell() for types.
|
||||||
*/
|
*/
|
||||||
public DefaultCellModel(T data, Function<T, String> stringConverter, String excelFormatString) {
|
public DefaultCellModel(T data, Function<T, String> stringConverter, String excelFormatString) {
|
||||||
this.data = data;
|
this.data = data;
|
||||||
this.stringConverter = stringConverter;
|
|
||||||
this.excelFormatString = excelFormatString;
|
this.excelFormatString = excelFormatString;
|
||||||
this.tooltip = getText();
|
|
||||||
|
if (stringConverter == null) {
|
||||||
|
text = this.data == null ? "" : this.data.toString();
|
||||||
|
} else {
|
||||||
|
text = stringConverter.apply(this.data);
|
||||||
|
}
|
||||||
|
this.tooltip = text;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -91,11 +93,7 @@ public class DefaultCellModel<T> implements GuiCellModel, ExcelCellModel {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getText() {
|
public String getText() {
|
||||||
if (this.stringConverter == null) {
|
return text;
|
||||||
return this.data == null ? "" : this.data.toString();
|
|
||||||
} else {
|
|
||||||
return this.stringConverter.apply(this.data);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -132,33 +130,14 @@ public class DefaultCellModel<T> implements GuiCellModel, ExcelCellModel {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Insets getInsets() {
|
|
||||||
return insets;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the insets for the text within the cell
|
|
||||||
*
|
|
||||||
* @param insets The insets.
|
|
||||||
*
|
|
||||||
* @return As a utility, returns this.
|
|
||||||
*/
|
|
||||||
public DefaultCellModel<T> setInsets(Insets insets) {
|
|
||||||
this.insets = insets;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<MenuItem> getPopupMenu() {
|
public List<MenuItem> getPopupMenu() {
|
||||||
if (popupMenu != null) {
|
if (popupMenu != null) {
|
||||||
return Collections.unmodifiableList(popupMenu);
|
return Collections.unmodifiableList(popupMenu);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (menuItemSupplier != null) {
|
if (menuItemSupplier != null) {
|
||||||
return this.menuItemSupplier.get();
|
return this.menuItemSupplier.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -166,6 +145,7 @@ public class DefaultCellModel<T> implements GuiCellModel, ExcelCellModel {
|
|||||||
* Sets a function to lazy load the popup menu items.
|
* Sets a function to lazy load the popup menu items.
|
||||||
*
|
*
|
||||||
* @param menuItemSupplier The lazy load function for popup items.
|
* @param menuItemSupplier The lazy load function for popup items.
|
||||||
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public DefaultCellModel<T> setPopupMenuRetriever(Supplier<List<MenuItem>> menuItemSupplier) {
|
public DefaultCellModel<T> setPopupMenuRetriever(Supplier<List<MenuItem>> menuItemSupplier) {
|
||||||
@ -177,6 +157,7 @@ public class DefaultCellModel<T> implements GuiCellModel, ExcelCellModel {
|
|||||||
* Sets the list of items for a popup menu
|
* Sets the list of items for a popup menu
|
||||||
*
|
*
|
||||||
* @param popupMenu
|
* @param popupMenu
|
||||||
|
*
|
||||||
* @return As a utility, returns this.
|
* @return As a utility, returns this.
|
||||||
*/
|
*/
|
||||||
public DefaultCellModel<T> setPopupMenu(List<MenuItem> popupMenu) {
|
public DefaultCellModel<T> setPopupMenu(List<MenuItem> popupMenu) {
|
||||||
|
@ -18,7 +18,6 @@
|
|||||||
*/
|
*/
|
||||||
package org.sleuthkit.autopsy.datasourcesummary.uiutils;
|
package org.sleuthkit.autopsy.datasourcesummary.uiutils;
|
||||||
|
|
||||||
import java.awt.Insets;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -72,11 +71,6 @@ public interface GuiCellModel extends CellModel {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return The insets for the cell text.
|
|
||||||
*/
|
|
||||||
Insets getInsets();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return The popup menu associated with this cell or null if no popup menu
|
* @return The popup menu associated with this cell or null if no popup menu
|
||||||
* should be shown for this cell.
|
* should be shown for this cell.
|
||||||
|
@ -41,6 +41,8 @@ import javax.swing.table.TableColumnModel;
|
|||||||
*/
|
*/
|
||||||
public class JTablePanel<T> extends AbstractLoadableComponent<List<T>> {
|
public class JTablePanel<T> extends AbstractLoadableComponent<List<T>> {
|
||||||
|
|
||||||
|
private static final int EXTRA_ROW_HEIGHT = 4;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An event that wraps a swing MouseEvent also providing context within the
|
* An event that wraps a swing MouseEvent also providing context within the
|
||||||
* table cell.
|
* table cell.
|
||||||
@ -56,10 +58,10 @@ public class JTablePanel<T> extends AbstractLoadableComponent<List<T>> {
|
|||||||
/**
|
/**
|
||||||
* Main constructor.
|
* Main constructor.
|
||||||
*
|
*
|
||||||
* @param e The underlying mouse event.
|
* @param e The underlying mouse event.
|
||||||
* @param table The table that was the target of the mouse event.
|
* @param table The table that was the target of the mouse event.
|
||||||
* @param row The row within the table that the event occurs.
|
* @param row The row within the table that the event occurs.
|
||||||
* @param col The column within the table that the event occurs.
|
* @param col The column within the table that the event occurs.
|
||||||
* @param cellValue The value within the cell.
|
* @param cellValue The value within the cell.
|
||||||
*/
|
*/
|
||||||
public CellMouseEvent(MouseEvent e, JTable table, int row, int col, Object cellValue) {
|
public CellMouseEvent(MouseEvent e, JTable table, int row, int col, Object cellValue) {
|
||||||
@ -115,15 +117,14 @@ public class JTablePanel<T> extends AbstractLoadableComponent<List<T>> {
|
|||||||
* Handles mouse events at a cell level for the table.
|
* Handles mouse events at a cell level for the table.
|
||||||
*
|
*
|
||||||
* @param e The event containing information about the cell, the mouse
|
* @param e The event containing information about the cell, the mouse
|
||||||
* event, and the table.
|
* event, and the table.
|
||||||
*/
|
*/
|
||||||
void mouseClicked(CellMouseEvent e);
|
void mouseClicked(CellMouseEvent e);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* JTables don't allow displaying messages. So this LayerUI is used to
|
* This LayerUI is used to display the contents of a child JLabel. Inspired
|
||||||
* display the contents of a child JLabel. Inspired by TableWaitLayerTest
|
* by TableWaitLayerTest (Animating a Busy Indicator):
|
||||||
* (Animating a Busy Indicator):
|
|
||||||
* https://docs.oracle.com/javase/tutorial/uiswing/misc/jlayer.html.
|
* https://docs.oracle.com/javase/tutorial/uiswing/misc/jlayer.html.
|
||||||
*/
|
*/
|
||||||
private static class Overlay extends LayerUI<JComponent> {
|
private static class Overlay extends LayerUI<JComponent> {
|
||||||
@ -205,7 +206,7 @@ public class JTablePanel<T> extends AbstractLoadableComponent<List<T>> {
|
|||||||
.map((colModel) -> colModel.getCellRenderer())
|
.map((colModel) -> colModel.getCellRenderer())
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
return new DefaultListTableModel<T>(columnRenderers);
|
return new DefaultListTableModel<>(columnRenderers);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -225,7 +226,6 @@ public class JTablePanel<T> extends AbstractLoadableComponent<List<T>> {
|
|||||||
return resultTable;
|
return resultTable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private JScrollPane tableScrollPane;
|
private JScrollPane tableScrollPane;
|
||||||
private Overlay overlayLayer;
|
private Overlay overlayLayer;
|
||||||
private ListTableModel<T> tableModel;
|
private ListTableModel<T> tableModel;
|
||||||
@ -241,6 +241,7 @@ public class JTablePanel<T> extends AbstractLoadableComponent<List<T>> {
|
|||||||
public JTablePanel(ListTableModel<T> tableModel) {
|
public JTablePanel(ListTableModel<T> tableModel) {
|
||||||
this();
|
this();
|
||||||
setModel(tableModel);
|
setModel(tableModel);
|
||||||
|
table.setRowHeight(table.getRowHeight() + EXTRA_ROW_HEIGHT);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -268,6 +269,7 @@ public class JTablePanel<T> extends AbstractLoadableComponent<List<T>> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
table.setGridColor(javax.swing.UIManager.getDefaults().getColor("InternalFrame.borderColor"));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -290,7 +292,7 @@ public class JTablePanel<T> extends AbstractLoadableComponent<List<T>> {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @return The current listener for mouse events. The events provided to
|
* @return The current listener for mouse events. The events provided to
|
||||||
* this listener will have cell and table context.
|
* this listener will have cell and table context.
|
||||||
*/
|
*/
|
||||||
public CellMouseListener getCellListener() {
|
public CellMouseListener getCellListener() {
|
||||||
return cellListener;
|
return cellListener;
|
||||||
@ -300,7 +302,8 @@ public class JTablePanel<T> extends AbstractLoadableComponent<List<T>> {
|
|||||||
* Sets the current listener for mouse events.
|
* Sets the current listener for mouse events.
|
||||||
*
|
*
|
||||||
* @param cellListener The event listener that will receive these events
|
* @param cellListener The event listener that will receive these events
|
||||||
* with cell and table context.
|
* with cell and table context.
|
||||||
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public JTablePanel<T> setCellListener(CellMouseListener cellListener) {
|
public JTablePanel<T> setCellListener(CellMouseListener cellListener) {
|
||||||
@ -329,7 +332,8 @@ public class JTablePanel<T> extends AbstractLoadableComponent<List<T>> {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @return The function for determining the key for a data row. This key is
|
* @return The function for determining the key for a data row. This key is
|
||||||
* used to maintain current selection in the table despite changing rows.
|
* used to maintain current selection in the table despite changing
|
||||||
|
* rows.
|
||||||
*/
|
*/
|
||||||
public Function<T, ? extends Object> getKeyFunction() {
|
public Function<T, ? extends Object> getKeyFunction() {
|
||||||
return keyFunction;
|
return keyFunction;
|
||||||
@ -351,9 +355,10 @@ public class JTablePanel<T> extends AbstractLoadableComponent<List<T>> {
|
|||||||
this.keyFunction = keyFunction;
|
this.keyFunction = keyFunction;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the selected items or null if no item is selected.
|
* Returns the selected items or null if no item is selected.
|
||||||
|
*
|
||||||
* @return The selected items or null if no item is selected.
|
* @return The selected items or null if no item is selected.
|
||||||
*/
|
*/
|
||||||
public List<T> getSelectedItems() {
|
public List<T> getSelectedItems() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user