GT-2698 refactor UI elements to lock down HTML rendering

This commit is contained in:
dev747368 2019-04-11 15:55:56 -04:00
parent a03c96d37b
commit e0c25b0590
360 changed files with 3895 additions and 4563 deletions

View file

@ -22,6 +22,7 @@ import java.util.List;
import javax.swing.*;
import docking.DockingUtils;
import docking.widgets.table.GTable;
import docking.widgets.textfield.IntegerTextField;
import ghidra.bitpatterns.info.FileBitPatternInfoReader;
@ -68,7 +69,7 @@ public class AlignmentPanelBuilder extends ContextRegisterFilterablePanelBuilder
JPanel modulusPanel = new JPanel();
PairLayout modulusLayout = new PairLayout();
modulusPanel.setLayout(modulusLayout);
modulusPanel.add(new JLabel(MODULUS_FIELD_TEXT));
modulusPanel.add(DockingUtils.createNonHtmlLabel(MODULUS_FIELD_TEXT));
modulusField = new IntegerTextField();
modulusField.setValue(DEFAULT_MODULUS);
modulusPanel.add(modulusField.getComponent());

View file

@ -15,9 +15,9 @@
*/
package ghidra.bitpatterns.gui;
import javax.swing.JLabel;
import javax.swing.JPanel;
import docking.DockingUtils;
import docking.DockingWindowManager;
import docking.widgets.textfield.IntegerTextField;
import ghidra.util.HelpLocation;
@ -60,12 +60,12 @@ public class BitsInputDialogComponentProvider extends InputDialogComponentProvid
PairLayout pairLayout = new PairLayout();
mainPanel.setLayout(pairLayout);
mainPanel.add(new JLabel(TOTAL_BITS_LABEL));
mainPanel.add(DockingUtils.createNonHtmlLabel(TOTAL_BITS_LABEL));
totalBitsBox = new IntegerTextField();
totalBitsBox.setValue(DEFAULT_TOTAL_BITS);
mainPanel.add(totalBitsBox.getComponent());
mainPanel.add(new JLabel(POST_BITS_LABEL));
mainPanel.add(DockingUtils.createNonHtmlLabel(POST_BITS_LABEL));
preBitsBox = new IntegerTextField();
preBitsBox.setValue(DEFAULT_POST_BITS);
mainPanel.add(preBitsBox.getComponent());

View file

@ -17,9 +17,9 @@ package ghidra.bitpatterns.gui;
import java.awt.Component;
import javax.swing.JLabel;
import javax.swing.JPanel;
import docking.DockingUtils;
import docking.DockingWindowManager;
import docking.widgets.textfield.IntegerTextField;
import ghidra.bitpatterns.info.ByteSequenceLengthFilter;
@ -65,10 +65,10 @@ public class ByteSequenceLengthFilterInputDialog extends InputDialogComponentPro
JPanel mainPanel = new JPanel();
PairLayout pairLayout = new PairLayout();
mainPanel.setLayout(pairLayout);
mainPanel.add(new JLabel(INDEX_BOX_TITLE_TEXT));
mainPanel.add(DockingUtils.createNonHtmlLabel(INDEX_BOX_TITLE_TEXT));
indexBox = new IntegerTextField();
mainPanel.add(indexBox.getComponent());
mainPanel.add(new JLabel(LENGTH_BOX_TITLE_TEXT));
mainPanel.add(DockingUtils.createNonHtmlLabel(LENGTH_BOX_TITLE_TEXT));
minLengthBox = new IntegerTextField();
mainPanel.add(minLengthBox.getComponent());
return mainPanel;

View file

@ -22,6 +22,7 @@ import java.util.List;
import javax.swing.*;
import docking.DockingUtils;
import docking.widgets.table.GFilterTable;
import ghidra.bitpatterns.info.*;
import ghidra.util.layout.PairLayout;
@ -112,7 +113,7 @@ public class ByteSequencePanelBuilder extends ContextRegisterFilterablePanelBuil
JPanel numSeqsPanel = new JPanel();
PairLayout numSeqsLayout = new PairLayout();
numSeqsPanel.setLayout(numSeqsLayout);
numSeqsPanel.add(new JLabel(NUM_SEQS_LABEL_TEXT));
numSeqsPanel.add(DockingUtils.createNonHtmlLabel(NUM_SEQS_LABEL_TEXT));
numSeqsField = new JTextField(25);
numSeqsField.setEditable(false);
numSeqsPanel.add(numSeqsField);

View file

@ -17,8 +17,10 @@ package ghidra.bitpatterns.gui;
import java.awt.Component;
import javax.swing.*;
import javax.swing.JPanel;
import javax.swing.JTextField;
import docking.DockingUtils;
import docking.DockingWindowManager;
import docking.widgets.textfield.IntegerTextField;
import ghidra.bitpatterns.info.DataGatheringParams;
@ -82,37 +84,37 @@ public class DataGatheringParamsDialog extends InputDialogComponentProvider {
PairLayout pairLayout = new PairLayout();
mainPanel.setLayout(pairLayout);
mainPanel.add(new JLabel(FIRST_BYTES_TEXT));
mainPanel.add(DockingUtils.createNonHtmlLabel(FIRST_BYTES_TEXT));
firstBytesField = new IntegerTextField();
firstBytesField.setValue(DEFAULT_FIRST_BYTES);
mainPanel.add(firstBytesField.getComponent());
mainPanel.add(new JLabel(PRE_BYTES_TEXT));
mainPanel.add(DockingUtils.createNonHtmlLabel(PRE_BYTES_TEXT));
preBytesField = new IntegerTextField();
preBytesField.setValue(DEFAULT_PRE_BYTES);
mainPanel.add(preBytesField.getComponent());
mainPanel.add(new JLabel(RETURN_BYTES_TEXT));
mainPanel.add(DockingUtils.createNonHtmlLabel(RETURN_BYTES_TEXT));
returnBytesField = new IntegerTextField();
returnBytesField.setValue(DEFAULT_RETURN_BYTES);
mainPanel.add(returnBytesField.getComponent());
mainPanel.add(new JLabel(FIRST_INSTRUCTIONS_TEXT));
mainPanel.add(DockingUtils.createNonHtmlLabel(FIRST_INSTRUCTIONS_TEXT));
firstInstructionsField = new IntegerTextField();
firstInstructionsField.setValue(DEFAULT_FIRST_INSTRUCTIONS);
mainPanel.add(firstInstructionsField.getComponent());
mainPanel.add(new JLabel(PRE_INSTRUCTIONS_TEXT));
mainPanel.add(DockingUtils.createNonHtmlLabel(PRE_INSTRUCTIONS_TEXT));
preInstructionsField = new IntegerTextField();
preInstructionsField.setValue(DEFAULT_PRE_INSTRUCTIONS);
mainPanel.add(preInstructionsField.getComponent());
mainPanel.add(new JLabel(RETURN_INSTRUCTIONS_TEXT));
mainPanel.add(DockingUtils.createNonHtmlLabel(RETURN_INSTRUCTIONS_TEXT));
returnInstructionsField = new IntegerTextField();
returnInstructionsField.setValue(DEFAULT_RETURN_INSTRUCTIONS);
mainPanel.add(returnInstructionsField.getComponent());
mainPanel.add(new JLabel(CONTEXT_REGISTER_TEXT));
mainPanel.add(DockingUtils.createNonHtmlLabel(CONTEXT_REGISTER_TEXT));
contextRegistersField = new JTextField(DEFAULT_CONTEXT_REGISTERS);
mainPanel.add(contextRegistersField);

View file

@ -24,6 +24,7 @@ import javax.swing.*;
import javax.swing.tree.TreePath;
import docking.ActionContext;
import docking.DockingUtils;
import docking.action.DockingAction;
import docking.action.MenuData;
import docking.widgets.filechooser.GhidraFileChooser;
@ -281,17 +282,17 @@ public class FunctionBitPatternsMainProvider extends ComponentProviderAdapter
PairLayout pairLayout = new PairLayout();
dataInfoPanel.setLayout(pairLayout);
dataInfoPanel.add(new JLabel(DATA_SOURCE_FIELD_LABEL));
dataInfoPanel.add(DockingUtils.createNonHtmlLabel(DATA_SOURCE_FIELD_LABEL));
dataSourceField = new JTextField(70);
dataSourceField.setEditable(false);
dataInfoPanel.add(dataSourceField);
dataInfoPanel.add(new JLabel(NUM_FUNCS_FIELD_LABEL));
dataInfoPanel.add(DockingUtils.createNonHtmlLabel(NUM_FUNCS_FIELD_LABEL));
numFunctionsField = new JTextField(10);
numFunctionsField.setEditable(false);
dataInfoPanel.add(numFunctionsField);
dataInfoPanel.add(new JLabel(NUM_FILES_FIELD_LABEL));
dataInfoPanel.add(DockingUtils.createNonHtmlLabel(NUM_FILES_FIELD_LABEL));
numFilesField = new JTextField(10);
numFilesField.setEditable(false);
dataInfoPanel.add(numFilesField);
@ -300,17 +301,17 @@ public class FunctionBitPatternsMainProvider extends ComponentProviderAdapter
PairLayout instructionLayout = new PairLayout();
instructionInfoPanel.setLayout(instructionLayout);
instructionInfoPanel.add(new JLabel(FIRST_INSTRUCTIONS_LABEL));
instructionInfoPanel.add(DockingUtils.createNonHtmlLabel(FIRST_INSTRUCTIONS_LABEL));
firstInstructionsField = new JTextField(10);
firstInstructionsField.setEditable(false);
instructionInfoPanel.add(firstInstructionsField);
instructionInfoPanel.add(new JLabel(PRE_INSTRUCTIONS_LABEL));
instructionInfoPanel.add(DockingUtils.createNonHtmlLabel(PRE_INSTRUCTIONS_LABEL));
preInstructionsField = new JTextField(10);
preInstructionsField.setEditable(false);
instructionInfoPanel.add(preInstructionsField);
instructionInfoPanel.add(new JLabel(RETURN_INSTRUCTIONS_LABEL));
instructionInfoPanel.add(DockingUtils.createNonHtmlLabel(RETURN_INSTRUCTIONS_LABEL));
returnInstructionsField = new JTextField(10);
returnInstructionsField.setEditable(false);
instructionInfoPanel.add(returnInstructionsField);
@ -319,17 +320,17 @@ public class FunctionBitPatternsMainProvider extends ComponentProviderAdapter
PairLayout bytesLayout = new PairLayout();
bytesInfoPanel.setLayout(bytesLayout);
bytesInfoPanel.add(new JLabel(FIRST_BYTES_LABEL));
bytesInfoPanel.add(DockingUtils.createNonHtmlLabel(FIRST_BYTES_LABEL));
firstBytesField = new JTextField(10);
firstBytesField.setEditable(false);
bytesInfoPanel.add(firstBytesField);
bytesInfoPanel.add(new JLabel(PRE_BYTES_LABEL));
bytesInfoPanel.add(DockingUtils.createNonHtmlLabel(PRE_BYTES_LABEL));
preBytesField = new JTextField(10);
preBytesField.setEditable(false);
bytesInfoPanel.add(preBytesField);
bytesInfoPanel.add(new JLabel(RETURN_BYTES_LABEL));
bytesInfoPanel.add(DockingUtils.createNonHtmlLabel(RETURN_BYTES_LABEL));
returnBytesField = new JTextField(10);
returnBytesField.setEditable(false);
bytesInfoPanel.add(returnBytesField);

View file

@ -24,6 +24,7 @@ import javax.swing.*;
import javax.swing.tree.TreePath;
import javax.swing.tree.TreeSelectionModel;
import docking.DockingUtils;
import docking.widgets.dialogs.NumberInputDialog;
import docking.widgets.tree.GTree;
import ghidra.bitpatterns.info.*;
@ -119,7 +120,7 @@ public class InstructionSequenceTreePanelBuilder extends ContextRegisterFilterab
countPanel = new JPanel();
PairLayout countLayout = new PairLayout();
countPanel.setLayout(countLayout);
JLabel countLabel = new JLabel(COUNT_FIELD_LABEL);
JLabel countLabel = DockingUtils.createNonHtmlLabel(COUNT_FIELD_LABEL);
countPanel.add(countLabel);
countField = new JTextField(25);
countField.setEditable(false);

View file

@ -19,6 +19,7 @@ import java.awt.*;
import javax.swing.*;
import docking.DockingUtils;
import docking.WindowPosition;
import ghidra.app.services.GoToService;
import ghidra.bitpatterns.info.*;
@ -109,16 +110,17 @@ public class PatternEvalTableProvider extends ComponentProviderAdapter {
private JPanel buildInfoPanel(PatternEvaluationStats stats) {
JPanel evalPanel = new JPanel(new GridLayout(2, 8));
evalPanel.add(new JLabel("Match Type"));
evalPanel.add(new JLabel(PatternMatchType.TRUE_POSITIVE.name()));
evalPanel.add(new JLabel(PatternMatchType.FP_WRONG_FLOW.name()));
evalPanel.add(new JLabel(PatternMatchType.FP_MISALIGNED.name()));
evalPanel.add(new JLabel(PatternMatchType.FP_DATA.name()));
evalPanel.add(new JLabel(PatternMatchType.POSSIBLE_START_CODE.name()));
evalPanel.add(new JLabel(PatternMatchType.POSSIBLE_START_UNDEFINED.name()));
evalPanel.add(new JLabel(PatternMatchType.CONTEXT_CONFLICT.name()));
evalPanel.add(new JLabel(PatternMatchType.PRE_PATTERN_HIT.name()));
evalPanel.add(new JLabel("Number"));
evalPanel.add(DockingUtils.createNonHtmlLabel("Match Type"));
evalPanel.add(DockingUtils.createNonHtmlLabel(PatternMatchType.TRUE_POSITIVE.name()));
evalPanel.add(DockingUtils.createNonHtmlLabel(PatternMatchType.FP_WRONG_FLOW.name()));
evalPanel.add(DockingUtils.createNonHtmlLabel(PatternMatchType.FP_MISALIGNED.name()));
evalPanel.add(DockingUtils.createNonHtmlLabel(PatternMatchType.FP_DATA.name()));
evalPanel.add(DockingUtils.createNonHtmlLabel(PatternMatchType.POSSIBLE_START_CODE.name()));
evalPanel.add(
DockingUtils.createNonHtmlLabel(PatternMatchType.POSSIBLE_START_UNDEFINED.name()));
evalPanel.add(DockingUtils.createNonHtmlLabel(PatternMatchType.CONTEXT_CONFLICT.name()));
evalPanel.add(DockingUtils.createNonHtmlLabel(PatternMatchType.PRE_PATTERN_HIT.name()));
evalPanel.add(DockingUtils.createNonHtmlLabel("Number"));
JTextField truePositivesField = new JTextField(8);
truePositivesField.setEditable(false);
truePositivesField.setText(Integer.toString(stats.getNumTruePositives()));

View file

@ -19,6 +19,7 @@ import java.awt.Component;
import javax.swing.*;
import docking.DockingUtils;
import docking.DockingWindowManager;
import docking.widgets.textfield.IntegerTextField;
import ghidra.closedpatternmining.SequenceMiningParams;
@ -79,7 +80,7 @@ public class SequenceMiningParamsInputDialog extends InputDialogComponentProvide
PairLayout mainLayout = new PairLayout();
mainPanel.setLayout(mainLayout);
mainPanel.add(new JLabel(PERCENTAGE_BOX_TEXT));
mainPanel.add(DockingUtils.createNonHtmlLabel(PERCENTAGE_BOX_TEXT));
percentageBox = new JTextField(16);
double percentage =
Double.parseDouble(Preferences.getProperty(PERCENTAGE_PROPERTY, DEFAULT_PERCENTAGE));
@ -87,7 +88,7 @@ public class SequenceMiningParamsInputDialog extends InputDialogComponentProvide
percentageBox.setEditable(true);
mainPanel.add(percentageBox);
mainPanel.add(new JLabel(MIN_FIXED_BITS_BOX_TEXT));
mainPanel.add(DockingUtils.createNonHtmlLabel(MIN_FIXED_BITS_BOX_TEXT));
minFixedBitsBox = new IntegerTextField();
int minFixBits = Integer.parseInt(
Preferences.getProperty(MIN_FIXED_BITS_PROPERTY, DEFAULT_MIN_FIXED_BITS));