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" ?>
|
||||
|
||||
<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>
|
||||
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/>
|
||||
<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_variablesLocal" type="java.lang.Boolean" value="false"/>
|
||||
<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>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
|
||||
@ -35,9 +31,6 @@
|
||||
<SubComponents>
|
||||
<Container class="javax.swing.JPanel" name="contentPanel">
|
||||
<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">
|
||||
<Dimension value="[625, 150]"/>
|
||||
</Property>
|
||||
@ -60,9 +53,6 @@
|
||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[16, 16]"/>
|
||||
</Property>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="null"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<AuxValues>
|
||||
<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">
|
||||
<TableColumnModel selectionModel="1"/>
|
||||
</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">
|
||||
<TableHeader reorderingAllowed="false" resizingAllowed="true"/>
|
||||
</Property>
|
||||
@ -157,6 +150,9 @@
|
||||
<Property name="columnModel" type="javax.swing.table.TableColumnModel" editor="org.netbeans.modules.form.editors2.TableColumnModelEditor">
|
||||
<TableColumnModel selectionModel="0"/>
|
||||
</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">
|
||||
<TableHeader reorderingAllowed="true" resizingAllowed="true"/>
|
||||
</Property>
|
||||
|
@ -267,19 +267,17 @@ public final class IngestJobInfoPanel extends javax.swing.JPanel {
|
||||
javax.swing.JScrollPane ingestModulesScrollPane = new javax.swing.JScrollPane();
|
||||
ingestModuleTable = new javax.swing.JTable();
|
||||
|
||||
setMaximumSize(new java.awt.Dimension(32767, 32767));
|
||||
setLayout(new java.awt.BorderLayout());
|
||||
|
||||
contentPanel.setMaximumSize(new java.awt.Dimension(32767, 32767));
|
||||
contentPanel.setMinimumSize(new java.awt.Dimension(625, 150));
|
||||
contentPanel.setPreferredSize(new java.awt.Dimension(625, 150));
|
||||
contentPanel.setLayout(new java.awt.GridBagLayout());
|
||||
|
||||
ingestJobsScrollPane.setBorder(null);
|
||||
ingestJobsScrollPane.setMinimumSize(new java.awt.Dimension(16, 16));
|
||||
ingestJobsScrollPane.setPreferredSize(null);
|
||||
|
||||
ingestJobTable.setModel(ingestJobTableModel);
|
||||
ingestJobTable.setGridColor(javax.swing.UIManager.getDefaults().getColor("InternalFrame.borderColor"));
|
||||
ingestJobTable.getTableHeader().setReorderingAllowed(false);
|
||||
ingestJobsScrollPane.setViewportView(ingestJobTable);
|
||||
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));
|
||||
|
||||
ingestModuleTable.setModel(ingestModuleTableModel);
|
||||
ingestModuleTable.setGridColor(javax.swing.UIManager.getDefaults().getColor("InternalFrame.borderColor"));
|
||||
ingestModulesScrollPane.setViewportView(ingestModuleTable);
|
||||
|
||||
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_tags_header(), Bundle.DataSourceSummaryNode_column_tags_header());
|
||||
outline = outlineView.getOutline();
|
||||
|
||||
outline.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
|
||||
|
||||
dataSourceSummaryList = getDataSourceSummaryList(usageMap, fileCountsMap);
|
||||
|
@ -26,7 +26,6 @@ import javax.swing.JLabel;
|
||||
* painting a JLabel using a java.awt.Graphics object.
|
||||
*/
|
||||
public class BaseMessageOverlay {
|
||||
|
||||
private final JLabel label;
|
||||
private boolean visible = false;
|
||||
|
||||
|
@ -19,7 +19,6 @@
|
||||
package org.sleuthkit.autopsy.datasourcesummary.uiutils;
|
||||
|
||||
import java.awt.Component;
|
||||
import java.awt.Insets;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.util.List;
|
||||
import javax.swing.BorderFactory;
|
||||
@ -30,7 +29,6 @@ import javax.swing.JTable;
|
||||
import javax.swing.border.Border;
|
||||
import javax.swing.table.DefaultTableCellRenderer;
|
||||
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.JTablePanel.CellMouseEvent;
|
||||
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 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
|
||||
public Component getTableCellRendererComponent(JTable table, Object value,
|
||||
@ -68,37 +66,15 @@ public class CellModelTableCellRenderer extends DefaultTableCellRenderer {
|
||||
* @return The provided defaultCell.
|
||||
*/
|
||||
protected Component getTableCellRendererComponent(JLabel defaultCell, GuiCellModel cellModel) {
|
||||
// sets the text for the cell or null if not present.
|
||||
String text = cellModel.getText();
|
||||
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);
|
||||
}
|
||||
|
||||
defaultCell.setText(cellModel.getText());
|
||||
defaultCell.setToolTipText(cellModel.getTooltip());
|
||||
// sets the JLabel alignment (left, center, right) or default alignment
|
||||
// if no alignment is specified
|
||||
int alignment = (cellModel.getHorizontalAlignment() == null)
|
||||
? DEFAULT_ALIGNMENT
|
||||
: cellModel.getHorizontalAlignment().getJLabelAlignment();
|
||||
defaultCell.setHorizontalAlignment(alignment);
|
||||
|
||||
defaultCell.setBorder(DEFAULT_BORDER);
|
||||
return defaultCell;
|
||||
}
|
||||
|
||||
|
@ -18,27 +18,24 @@
|
||||
*/
|
||||
package org.sleuthkit.autopsy.datasourcesummary.uiutils;
|
||||
|
||||
import java.awt.Insets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Supplier;
|
||||
import org.sleuthkit.autopsy.datasourcesummary.uiutils.ExcelCellModel;
|
||||
|
||||
/**
|
||||
* The default cell model.
|
||||
*/
|
||||
public class DefaultCellModel<T> implements GuiCellModel, ExcelCellModel {
|
||||
|
||||
final T data;
|
||||
final Function<T, String> stringConverter;
|
||||
String tooltip;
|
||||
CellModel.HorizontalAlign horizontalAlignment;
|
||||
Insets insets;
|
||||
List<MenuItem> popupMenu;
|
||||
Supplier<List<MenuItem>> menuItemSupplier;
|
||||
final String excelFormatString;
|
||||
private final T data;
|
||||
private final String text;
|
||||
private String tooltip;
|
||||
private CellModel.HorizontalAlign horizontalAlignment;
|
||||
private List<MenuItem> popupMenu;
|
||||
private Supplier<List<MenuItem>> menuItemSupplier;
|
||||
private final String excelFormatString;
|
||||
|
||||
/**
|
||||
* Main constructor.
|
||||
@ -74,9 +71,14 @@ public class DefaultCellModel<T> implements GuiCellModel, ExcelCellModel {
|
||||
*/
|
||||
public DefaultCellModel(T data, Function<T, String> stringConverter, String excelFormatString) {
|
||||
this.data = data;
|
||||
this.stringConverter = stringConverter;
|
||||
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
|
||||
@ -91,11 +93,7 @@ public class DefaultCellModel<T> implements GuiCellModel, ExcelCellModel {
|
||||
|
||||
@Override
|
||||
public String getText() {
|
||||
if (this.stringConverter == null) {
|
||||
return this.data == null ? "" : this.data.toString();
|
||||
} else {
|
||||
return this.stringConverter.apply(this.data);
|
||||
}
|
||||
return text;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -132,33 +130,14 @@ public class DefaultCellModel<T> implements GuiCellModel, ExcelCellModel {
|
||||
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
|
||||
public List<MenuItem> getPopupMenu() {
|
||||
if (popupMenu != null) {
|
||||
return Collections.unmodifiableList(popupMenu);
|
||||
}
|
||||
|
||||
if (menuItemSupplier != null) {
|
||||
return this.menuItemSupplier.get();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -166,6 +145,7 @@ public class DefaultCellModel<T> implements GuiCellModel, ExcelCellModel {
|
||||
* Sets a function to lazy load the popup menu items.
|
||||
*
|
||||
* @param menuItemSupplier The lazy load function for popup items.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
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
|
||||
*
|
||||
* @param popupMenu
|
||||
*
|
||||
* @return As a utility, returns this.
|
||||
*/
|
||||
public DefaultCellModel<T> setPopupMenu(List<MenuItem> popupMenu) {
|
||||
|
@ -18,7 +18,6 @@
|
||||
*/
|
||||
package org.sleuthkit.autopsy.datasourcesummary.uiutils;
|
||||
|
||||
import java.awt.Insets;
|
||||
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
|
||||
* should be shown for this cell.
|
||||
|
@ -41,6 +41,8 @@ import javax.swing.table.TableColumnModel;
|
||||
*/
|
||||
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
|
||||
* table cell.
|
||||
@ -121,9 +123,8 @@ public class JTablePanel<T> extends AbstractLoadableComponent<List<T>> {
|
||||
}
|
||||
|
||||
/**
|
||||
* JTables don't allow displaying messages. So this LayerUI is used to
|
||||
* display the contents of a child JLabel. Inspired by TableWaitLayerTest
|
||||
* (Animating a Busy Indicator):
|
||||
* This LayerUI is used to display the contents of a child JLabel. Inspired
|
||||
* by TableWaitLayerTest (Animating a Busy Indicator):
|
||||
* https://docs.oracle.com/javase/tutorial/uiswing/misc/jlayer.html.
|
||||
*/
|
||||
private static class Overlay extends LayerUI<JComponent> {
|
||||
@ -205,7 +206,7 @@ public class JTablePanel<T> extends AbstractLoadableComponent<List<T>> {
|
||||
.map((colModel) -> colModel.getCellRenderer())
|
||||
.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;
|
||||
}
|
||||
|
||||
|
||||
private JScrollPane tableScrollPane;
|
||||
private Overlay overlayLayer;
|
||||
private ListTableModel<T> tableModel;
|
||||
@ -241,6 +241,7 @@ public class JTablePanel<T> extends AbstractLoadableComponent<List<T>> {
|
||||
public JTablePanel(ListTableModel<T> tableModel) {
|
||||
this();
|
||||
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"));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -301,6 +303,7 @@ public class JTablePanel<T> extends AbstractLoadableComponent<List<T>> {
|
||||
*
|
||||
* @param cellListener The event listener that will receive these events
|
||||
* with cell and table context.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
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
|
||||
* 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() {
|
||||
return keyFunction;
|
||||
@ -354,6 +358,7 @@ public class JTablePanel<T> extends AbstractLoadableComponent<List<T>> {
|
||||
|
||||
/**
|
||||
* Returns 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() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user