mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-06 21:00:22 +00:00
Merge pull request #6271 from kellykelly3/6699-add-tooltip-to-various-locations
6699 - Added tool tips to various lists and tables
This commit is contained in:
commit
d39ae93440
42
Core/src/org/sleuthkit/autopsy/guiutils/SimpleListCellRenderer.java
Executable file
42
Core/src/org/sleuthkit/autopsy/guiutils/SimpleListCellRenderer.java
Executable file
@ -0,0 +1,42 @@
|
||||
/*
|
||||
* Autopsy Forensic Browser
|
||||
*
|
||||
* Copyright 2020 Basis Technology Corp.
|
||||
* Contact: carrier <at> sleuthkit <dot> org
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.sleuthkit.autopsy.guiutils;
|
||||
|
||||
import java.awt.Component;
|
||||
import javax.swing.DefaultListCellRenderer;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JList;
|
||||
|
||||
/**
|
||||
* Simple extension of DefaultListCellRenderer that adds support for tooltips.
|
||||
* The the tooltip text will be the same as the label text.
|
||||
*/
|
||||
public class SimpleListCellRenderer extends DefaultListCellRenderer{
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
public Component getListCellRendererComponent(JList<?> list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
|
||||
JLabel label = (JLabel)super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
|
||||
label.setToolTipText(label.getText());
|
||||
|
||||
return label;
|
||||
}
|
||||
|
||||
}
|
41
Core/src/org/sleuthkit/autopsy/guiutils/SimpleTableCellRenderer.java
Executable file
41
Core/src/org/sleuthkit/autopsy/guiutils/SimpleTableCellRenderer.java
Executable file
@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Autopsy Forensic Browser
|
||||
*
|
||||
* Copyright 2020 Basis Technology Corp.
|
||||
* Contact: carrier <at> sleuthkit <dot> org
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.sleuthkit.autopsy.guiutils;
|
||||
|
||||
import java.awt.Component;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JTable;
|
||||
import javax.swing.table.DefaultTableCellRenderer;
|
||||
|
||||
/**
|
||||
* Simple Cell renderer for JTables that will set the value of the labels tooltip
|
||||
* to be the same as the label.
|
||||
*/
|
||||
public class SimpleTableCellRenderer extends DefaultTableCellRenderer{
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
|
||||
JLabel label = (JLabel) super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
|
||||
label.setToolTipText(label.getText());
|
||||
return label;
|
||||
}
|
||||
|
||||
}
|
@ -329,6 +329,7 @@
|
||||
<Property name="selectionMode" type="int" value="0"/>
|
||||
</Properties>
|
||||
<AuxValues>
|
||||
<AuxValue name="JavaCodeGenerator_AddingCodePost" type="java.lang.String" value="rulesList.setCellRenderer(new SimpleListCellRenderer());"/>
|
||||
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="<FilesSet.Rule>"/>
|
||||
</AuxValues>
|
||||
</Component>
|
||||
@ -401,9 +402,12 @@
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JList" name="setsList">
|
||||
<Properties>
|
||||
<Property name="selectionMode" type="int" value="0"/>
|
||||
<Property name="selectionMode" type="int" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
|
||||
<Connection code="javax.swing.ListSelectionModel.SINGLE_SELECTION" type="code"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<AuxValues>
|
||||
<AuxValue name="JavaCodeGenerator_AddingCodePost" type="java.lang.String" value="setsList.setCellRenderer(new SimpleListCellRenderer());"/>
|
||||
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="<FilesSet>"/>
|
||||
</AuxValues>
|
||||
</Component>
|
||||
|
@ -46,6 +46,7 @@ import org.openide.windows.WindowManager;
|
||||
import org.sleuthkit.autopsy.corecomponents.OptionsPanel;
|
||||
import org.sleuthkit.autopsy.coreutils.Logger;
|
||||
import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil;
|
||||
import org.sleuthkit.autopsy.guiutils.SimpleListCellRenderer;
|
||||
import org.sleuthkit.autopsy.ingest.IngestManager;
|
||||
import org.sleuthkit.autopsy.ingest.IngestModuleGlobalSettingsPanel;
|
||||
import org.sleuthkit.autopsy.ingest.IngestProfiles;
|
||||
@ -648,6 +649,7 @@ public final class FilesSetDefsPanel extends IngestModuleGlobalSettingsPanel imp
|
||||
|
||||
rulesList.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
|
||||
rulesListScrollPane.setViewportView(rulesList);
|
||||
rulesList.setCellRenderer(new SimpleListCellRenderer());
|
||||
|
||||
setDescScrollPanel.setMinimumSize(new java.awt.Dimension(10, 22));
|
||||
setDescScrollPanel.setPreferredSize(new java.awt.Dimension(14, 40));
|
||||
@ -676,6 +678,7 @@ public final class FilesSetDefsPanel extends IngestModuleGlobalSettingsPanel imp
|
||||
|
||||
setsList.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
|
||||
setsListScrollPane.setViewportView(setsList);
|
||||
setsList.setCellRenderer(new SimpleListCellRenderer());
|
||||
|
||||
fileNameButtonGroup.add(fileNameExtensionRadioButton);
|
||||
org.openide.awt.Mnemonics.setLocalizedText(fileNameExtensionRadioButton, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.fileNameExtensionRadioButton.text")); // NOI18N
|
||||
|
@ -207,7 +207,9 @@ class PortableCaseInterestingItemsListPanel extends javax.swing.JPanel {
|
||||
setFont(list.getFont());
|
||||
setBackground(list.getBackground());
|
||||
setForeground(list.getForeground());
|
||||
setText(value + " (" + setCounts.get(value) + ")"); // NON-NLS
|
||||
String text = value + " (" + setCounts.get(value) + ")";
|
||||
setText(text); // NON-NLS
|
||||
setToolTipText(text);
|
||||
return this;
|
||||
}
|
||||
return new JLabel();
|
||||
|
@ -203,7 +203,9 @@ class PortableCaseTagsListPanel extends javax.swing.JPanel {
|
||||
setFont(list.getFont());
|
||||
setBackground(list.getBackground());
|
||||
setForeground(list.getForeground());
|
||||
setText(value + " (" + tagCounts.get(value) + ")"); // NON-NLS
|
||||
String text = value + " (" + tagCounts.get(value) + ")";
|
||||
setText(text);
|
||||
setToolTipText(text);
|
||||
return this;
|
||||
}
|
||||
return new JLabel();
|
||||
|
@ -221,7 +221,10 @@ class SaveTaggedHashesToHashDbConfigPanel extends javax.swing.JPanel {
|
||||
setFont(list.getFont());
|
||||
setBackground(list.getBackground());
|
||||
setForeground(list.getForeground());
|
||||
setText(TagUtils.getDecoratedTagDisplayName(value));
|
||||
|
||||
String text = TagUtils.getDecoratedTagDisplayName(value);
|
||||
setText(text);
|
||||
this.setToolTipText(text);
|
||||
return this;
|
||||
}
|
||||
return new JLabel();
|
||||
|
@ -42,6 +42,7 @@ import javax.swing.table.TableColumn;
|
||||
import org.openide.util.NbBundle;
|
||||
import org.openide.util.actions.SystemAction;
|
||||
import org.sleuthkit.autopsy.coreutils.Logger;
|
||||
import org.sleuthkit.autopsy.guiutils.SimpleTableCellRenderer;
|
||||
import org.sleuthkit.autopsy.ingest.IngestManager;
|
||||
|
||||
/**
|
||||
@ -94,6 +95,7 @@ class DropdownListSearchPanel extends AdHocSearchPanel {
|
||||
column.setCellRenderer(new LeftCheckBoxRenderer());
|
||||
} else {
|
||||
column.setPreferredWidth(((int) (leftWidth * 0.89)));
|
||||
column.setCellRenderer(new SimpleTableCellRenderer());
|
||||
}
|
||||
}
|
||||
final int rightWidth = rightPane.getPreferredSize().width;
|
||||
@ -105,6 +107,7 @@ class DropdownListSearchPanel extends AdHocSearchPanel {
|
||||
column.setPreferredWidth(((int) (rightWidth * 0.38)));
|
||||
}
|
||||
}
|
||||
keywordsTable.setDefaultRenderer(String.class, new SimpleTableCellRenderer());
|
||||
|
||||
loader = XmlKeywordSearchList.getCurrent();
|
||||
listsTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
|
||||
|
@ -36,6 +36,7 @@ import org.netbeans.spi.options.OptionsPanelController;
|
||||
import org.openide.util.NbBundle;
|
||||
import org.sleuthkit.autopsy.corecomponents.OptionsPanel;
|
||||
import org.sleuthkit.autopsy.coreutils.Logger;
|
||||
import org.sleuthkit.autopsy.guiutils.SimpleTableCellRenderer;
|
||||
import org.sleuthkit.autopsy.ingest.IngestManager;
|
||||
|
||||
/**
|
||||
@ -76,6 +77,7 @@ class GlobalEditListPanel extends javax.swing.JPanel implements ListSelectionLis
|
||||
}
|
||||
keywordTable.setCellSelectionEnabled(false);
|
||||
keywordTable.setRowSelectionAllowed(true);
|
||||
keywordTable.setDefaultRenderer(String.class, new SimpleTableCellRenderer());
|
||||
|
||||
final ListSelectionModel lsm = keywordTable.getSelectionModel();
|
||||
lsm.addListSelectionListener(new ListSelectionListener() {
|
||||
|
@ -38,6 +38,7 @@ import org.openide.util.NbBundle;
|
||||
import org.sleuthkit.autopsy.corecomponents.OptionsPanel;
|
||||
import org.sleuthkit.autopsy.coreutils.ModuleSettings;
|
||||
import org.sleuthkit.autopsy.coreutils.PlatformUtil;
|
||||
import org.sleuthkit.autopsy.guiutils.SimpleTableCellRenderer;
|
||||
import org.sleuthkit.autopsy.ingest.IngestManager;
|
||||
|
||||
/**
|
||||
@ -63,6 +64,7 @@ class GlobalListsManagementPanel extends javax.swing.JPanel implements OptionsPa
|
||||
listsTable.setTableHeader(null);
|
||||
listsTable.setShowHorizontalLines(false);
|
||||
listsTable.setShowVerticalLines(false);
|
||||
listsTable.setDefaultRenderer(String.class, new SimpleTableCellRenderer());
|
||||
exportButton.setToolTipText(NbBundle.getMessage(this.getClass(), "KeywordSearchEditListPanel.customizeComponents.exportToFile"));
|
||||
copyListButton.setToolTipText(NbBundle.getMessage(this.getClass(), "KeywordSearchEditListPanel.customizeComponents.saveCurrentWIthNewNameToolTip"));
|
||||
listsTable.getParent().setBackground(listsTable.getBackground());
|
||||
|
@ -99,6 +99,9 @@
|
||||
<Property name="showHorizontalLines" type="boolean" value="false"/>
|
||||
<Property name="showVerticalLines" type="boolean" value="false"/>
|
||||
</Properties>
|
||||
<AuxValues>
|
||||
<AuxValue name="JavaCodeGenerator_AddingCodePost" type="java.lang.String" value="listsTable.setDefaultRenderer(String.class, new SimpleTableCellRenderer());"/>
|
||||
</AuxValues>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
|
@ -32,6 +32,7 @@ import javax.swing.table.AbstractTableModel;
|
||||
import javax.swing.table.DefaultTableCellRenderer;
|
||||
import javax.swing.table.TableColumn;
|
||||
import org.sleuthkit.autopsy.coreutils.StringExtract.StringExtractUnicodeTable.SCRIPT;
|
||||
import org.sleuthkit.autopsy.guiutils.SimpleTableCellRenderer;
|
||||
import org.sleuthkit.autopsy.ingest.IngestModuleIngestJobSettings;
|
||||
import org.sleuthkit.autopsy.ingest.IngestModuleIngestJobSettingsPanel;
|
||||
import org.sleuthkit.autopsy.keywordsearch.KeywordSearchIngestModule.StringsExtractOptions;
|
||||
@ -84,7 +85,6 @@ public final class KeywordSearchJobSettingsPanel extends IngestModuleIngestJobSe
|
||||
if (i == 0) {
|
||||
column.setPreferredWidth(((int) (width * 0.07)));
|
||||
} else {
|
||||
column.setCellRenderer(new KeywordTableCellRenderer());
|
||||
column.setPreferredWidth(((int) (width * 0.92)));
|
||||
}
|
||||
}
|
||||
@ -184,25 +184,6 @@ public final class KeywordSearchJobSettingsPanel extends IngestModuleIngestJobSe
|
||||
tableModel.fireTableDataChanged();
|
||||
}
|
||||
|
||||
/**
|
||||
* Simple TableCellRenderer to add tool tips to cells.
|
||||
*/
|
||||
private static final class KeywordTableCellRenderer extends DefaultTableCellRenderer{
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
public Component getTableCellRendererComponent(
|
||||
JTable table, Object value,
|
||||
boolean isSelected, boolean hasFocus,
|
||||
int row, int column) {
|
||||
JLabel label = (JLabel) super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
|
||||
label.setToolTipText(label.getText());
|
||||
return label;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private class KeywordListsTableModel extends AbstractTableModel {
|
||||
|
||||
@Override
|
||||
@ -278,6 +259,7 @@ public final class KeywordSearchJobSettingsPanel extends IngestModuleIngestJobSe
|
||||
listsTable.setShowHorizontalLines(false);
|
||||
listsTable.setShowVerticalLines(false);
|
||||
listsScrollPane.setViewportView(listsTable);
|
||||
listsTable.setDefaultRenderer(String.class, new SimpleTableCellRenderer());
|
||||
|
||||
titleLabel.setText(org.openide.util.NbBundle.getMessage(KeywordSearchJobSettingsPanel.class, "KeywordSearchJobSettingsPanel.titleLabel.text")); // NOI18N
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user