mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-06 21:00:22 +00:00
fine tuning of resizing
This commit is contained in:
parent
2614255fe2
commit
20281bbf00
@ -27,10 +27,10 @@
|
||||
</NonVisualComponents>
|
||||
<Properties>
|
||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[5, 5]"/>
|
||||
<Dimension value="[250, 5]"/>
|
||||
</Property>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[100, 58]"/>
|
||||
<Dimension value="[250, 58]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<AuxValues>
|
||||
@ -43,6 +43,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,-99,0,0,3,83"/>
|
||||
</AuxValues>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
|
||||
@ -76,10 +77,13 @@
|
||||
<ResourceString bundle="org/sleuthkit/autopsy/contentviewers/textcontentviewer/Bundle.properties" key="StringsContentPanel.pageLabel.text_1" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
</Property>
|
||||
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[33, 14]"/>
|
||||
<Dimension value="[33, 25]"/>
|
||||
</Property>
|
||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[33, 14]"/>
|
||||
<Dimension value="[33, 25]"/>
|
||||
</Property>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[32, 25]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
@ -100,10 +104,13 @@
|
||||
<ResourceString bundle="org/sleuthkit/autopsy/contentviewers/textcontentviewer/Bundle.properties" key="StringsContentPanel.currentPageLabel.text_1" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
</Property>
|
||||
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[18, 14]"/>
|
||||
<Dimension value="[18, 25]"/>
|
||||
</Property>
|
||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[7, 25]"/>
|
||||
</Property>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[18, 14]"/>
|
||||
<Dimension value="[18, 25]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
@ -123,6 +130,15 @@
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="org/sleuthkit/autopsy/contentviewers/textcontentviewer/Bundle.properties" key="StringsContentPanel.ofLabel.text_1" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
</Property>
|
||||
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[11, 25]"/>
|
||||
</Property>
|
||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[11, 25]"/>
|
||||
</Property>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[11, 25]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JSeparator" name="jSepMed3">
|
||||
@ -141,6 +157,15 @@
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="org/sleuthkit/autopsy/contentviewers/textcontentviewer/Bundle.properties" key="StringsContentPanel.totalPageLabel.text_1" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
</Property>
|
||||
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[21, 25]"/>
|
||||
</Property>
|
||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[21, 25]"/>
|
||||
</Property>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[21, 25]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JSeparator" name="jSepMed4">
|
||||
@ -174,10 +199,13 @@
|
||||
<ResourceString bundle="org/sleuthkit/autopsy/contentviewers/textcontentviewer/Bundle.properties" key="StringsContentPanel.pageLabel2.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
</Property>
|
||||
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[29, 14]"/>
|
||||
<Dimension value="[29, 25]"/>
|
||||
</Property>
|
||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[29, 14]"/>
|
||||
<Dimension value="[29, 25]"/>
|
||||
</Property>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[29, 25]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
@ -209,13 +237,13 @@
|
||||
<Insets value="[2, 0, 2, 0]"/>
|
||||
</Property>
|
||||
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[20, 20]"/>
|
||||
<Dimension value="[25, 25]"/>
|
||||
</Property>
|
||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[20, 20]"/>
|
||||
<Dimension value="[20, 25]"/>
|
||||
</Property>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[20, 20]"/>
|
||||
<Dimension value="[25, 25]"/>
|
||||
</Property>
|
||||
<Property name="rolloverIcon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
|
||||
<Image iconType="3" name="/org/sleuthkit/autopsy/corecomponents/btn_step_back_hover.png"/>
|
||||
@ -225,20 +253,6 @@
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="prevPageButtonActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JSeparator" name="jSepXs1">
|
||||
<Properties>
|
||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[1, 0]"/>
|
||||
</Property>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[1, 0]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<AuxValues>
|
||||
<AuxValue name="JavaCodeGenerator_VariableLocal" type="java.lang.Boolean" value="true"/>
|
||||
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="0"/>
|
||||
</AuxValues>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="nextPageButton">
|
||||
<Properties>
|
||||
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
|
||||
@ -256,13 +270,13 @@
|
||||
<Insets value="[2, 0, 2, 0]"/>
|
||||
</Property>
|
||||
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[20, 20]"/>
|
||||
<Dimension value="[25, 25]"/>
|
||||
</Property>
|
||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[20, 20]"/>
|
||||
<Dimension value="[20, 25]"/>
|
||||
</Property>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[20, 20]"/>
|
||||
<Dimension value="[25, 25]"/>
|
||||
</Property>
|
||||
<Property name="rolloverIcon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
|
||||
<Image iconType="3" name="/org/sleuthkit/autopsy/corecomponents/btn_step_forward_hover.png"/>
|
||||
@ -326,7 +340,7 @@
|
||||
<Dimension value="[50, 25]"/>
|
||||
</Property>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[100, 25]"/>
|
||||
<Dimension value="[70, 25]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Events>
|
||||
@ -402,11 +416,6 @@
|
||||
</SubComponents>
|
||||
</Container>
|
||||
<Container class="javax.swing.JScrollPane" name="outputScrollPane">
|
||||
<Properties>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[640, 402]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
|
||||
<BorderConstraints direction="Center"/>
|
||||
@ -422,7 +431,7 @@
|
||||
<Font name="Courier New" size="11" style="0"/>
|
||||
</Property>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[100, 40]"/>
|
||||
<Dimension value="null"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
|
@ -21,6 +21,7 @@ package org.sleuthkit.autopsy.contentviewers.textcontentviewer;
|
||||
import java.awt.Cursor;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
import org.openide.util.NbBundle;
|
||||
@ -32,6 +33,7 @@ import org.sleuthkit.autopsy.coreutils.StringExtract;
|
||||
import org.sleuthkit.autopsy.coreutils.StringExtract.StringExtractResult;
|
||||
import org.sleuthkit.autopsy.coreutils.StringExtract.StringExtractUnicodeTable.SCRIPT;
|
||||
import org.sleuthkit.autopsy.datamodel.StringContent;
|
||||
import org.sleuthkit.autopsy.guiutils.WrapLayout;
|
||||
import org.sleuthkit.datamodel.Content;
|
||||
import org.sleuthkit.datamodel.TskCoreException;
|
||||
|
||||
@ -78,6 +80,11 @@ public class StringsContentPanel extends javax.swing.JPanel {
|
||||
languageCombo.addItem(s);
|
||||
});
|
||||
|
||||
// use wrap layout for better component wrapping
|
||||
WrapLayout layout = new WrapLayout(0,5);
|
||||
layout.setOppositeAligned(Arrays.asList(panelScriptSelect));
|
||||
controlPanel.setLayout(layout);
|
||||
|
||||
}
|
||||
|
||||
final void resetDisplay() {
|
||||
@ -119,7 +126,6 @@ public class StringsContentPanel extends javax.swing.JPanel {
|
||||
pageLabel2 = new javax.swing.JLabel();
|
||||
javax.swing.JSeparator jSepMed5 = new javax.swing.JSeparator();
|
||||
prevPageButton = new javax.swing.JButton();
|
||||
javax.swing.JSeparator jSepXs1 = new javax.swing.JSeparator();
|
||||
nextPageButton = new javax.swing.JButton();
|
||||
javax.swing.JSeparator jSepMed6 = new javax.swing.JSeparator();
|
||||
javax.swing.JPanel panelGoToPage = new javax.swing.JPanel();
|
||||
@ -140,8 +146,8 @@ public class StringsContentPanel extends javax.swing.JPanel {
|
||||
selectAllMenuItem.setText(org.openide.util.NbBundle.getMessage(StringsContentPanel.class, "StringsContentPanel.selectAllMenuItem.text")); // NOI18N
|
||||
rightClickMenu.add(selectAllMenuItem);
|
||||
|
||||
setMinimumSize(new java.awt.Dimension(5, 5));
|
||||
setPreferredSize(new java.awt.Dimension(100, 58));
|
||||
setMinimumSize(new java.awt.Dimension(250, 5));
|
||||
setPreferredSize(new java.awt.Dimension(250, 58));
|
||||
setLayout(new java.awt.BorderLayout());
|
||||
|
||||
controlPanel.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT, 5, 0));
|
||||
@ -149,28 +155,36 @@ public class StringsContentPanel extends javax.swing.JPanel {
|
||||
panelPageOfCount.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.CENTER, 0, 0));
|
||||
|
||||
pageLabel.setText(org.openide.util.NbBundle.getMessage(StringsContentPanel.class, "StringsContentPanel.pageLabel.text_1")); // NOI18N
|
||||
pageLabel.setMaximumSize(new java.awt.Dimension(33, 14));
|
||||
pageLabel.setMinimumSize(new java.awt.Dimension(33, 14));
|
||||
pageLabel.setMaximumSize(new java.awt.Dimension(33, 25));
|
||||
pageLabel.setMinimumSize(new java.awt.Dimension(33, 25));
|
||||
pageLabel.setPreferredSize(new java.awt.Dimension(32, 25));
|
||||
panelPageOfCount.add(pageLabel);
|
||||
|
||||
jSepMed1.setPreferredSize(new java.awt.Dimension(5, 0));
|
||||
panelPageOfCount.add(jSepMed1);
|
||||
|
||||
currentPageLabel.setText(org.openide.util.NbBundle.getMessage(StringsContentPanel.class, "StringsContentPanel.currentPageLabel.text_1")); // NOI18N
|
||||
currentPageLabel.setMaximumSize(new java.awt.Dimension(18, 14));
|
||||
currentPageLabel.setPreferredSize(new java.awt.Dimension(18, 14));
|
||||
currentPageLabel.setMaximumSize(new java.awt.Dimension(18, 25));
|
||||
currentPageLabel.setMinimumSize(new java.awt.Dimension(7, 25));
|
||||
currentPageLabel.setPreferredSize(new java.awt.Dimension(18, 25));
|
||||
panelPageOfCount.add(currentPageLabel);
|
||||
|
||||
jSepMed2.setPreferredSize(new java.awt.Dimension(5, 0));
|
||||
panelPageOfCount.add(jSepMed2);
|
||||
|
||||
ofLabel.setText(org.openide.util.NbBundle.getMessage(StringsContentPanel.class, "StringsContentPanel.ofLabel.text_1")); // NOI18N
|
||||
ofLabel.setMaximumSize(new java.awt.Dimension(11, 25));
|
||||
ofLabel.setMinimumSize(new java.awt.Dimension(11, 25));
|
||||
ofLabel.setPreferredSize(new java.awt.Dimension(11, 25));
|
||||
panelPageOfCount.add(ofLabel);
|
||||
|
||||
jSepMed3.setPreferredSize(new java.awt.Dimension(5, 0));
|
||||
panelPageOfCount.add(jSepMed3);
|
||||
|
||||
totalPageLabel.setText(org.openide.util.NbBundle.getMessage(StringsContentPanel.class, "StringsContentPanel.totalPageLabel.text_1")); // NOI18N
|
||||
totalPageLabel.setMaximumSize(new java.awt.Dimension(21, 25));
|
||||
totalPageLabel.setMinimumSize(new java.awt.Dimension(21, 25));
|
||||
totalPageLabel.setPreferredSize(new java.awt.Dimension(21, 25));
|
||||
panelPageOfCount.add(totalPageLabel);
|
||||
|
||||
jSepMed4.setPreferredSize(new java.awt.Dimension(5, 0));
|
||||
@ -181,8 +195,9 @@ public class StringsContentPanel extends javax.swing.JPanel {
|
||||
panelPageNextPrevButton.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT, 0, 0));
|
||||
|
||||
pageLabel2.setText(org.openide.util.NbBundle.getMessage(StringsContentPanel.class, "StringsContentPanel.pageLabel2.text")); // NOI18N
|
||||
pageLabel2.setMaximumSize(new java.awt.Dimension(29, 14));
|
||||
pageLabel2.setMinimumSize(new java.awt.Dimension(29, 14));
|
||||
pageLabel2.setMaximumSize(new java.awt.Dimension(29, 25));
|
||||
pageLabel2.setMinimumSize(new java.awt.Dimension(29, 25));
|
||||
pageLabel2.setPreferredSize(new java.awt.Dimension(29, 25));
|
||||
panelPageNextPrevButton.add(pageLabel2);
|
||||
|
||||
jSepMed5.setPreferredSize(new java.awt.Dimension(5, 0));
|
||||
@ -194,9 +209,9 @@ public class StringsContentPanel extends javax.swing.JPanel {
|
||||
prevPageButton.setContentAreaFilled(false);
|
||||
prevPageButton.setDisabledIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/corecomponents/btn_step_back_disabled.png"))); // NOI18N
|
||||
prevPageButton.setMargin(new java.awt.Insets(2, 0, 2, 0));
|
||||
prevPageButton.setMaximumSize(new java.awt.Dimension(20, 20));
|
||||
prevPageButton.setMinimumSize(new java.awt.Dimension(20, 20));
|
||||
prevPageButton.setPreferredSize(new java.awt.Dimension(20, 20));
|
||||
prevPageButton.setMaximumSize(new java.awt.Dimension(25, 25));
|
||||
prevPageButton.setMinimumSize(new java.awt.Dimension(20, 25));
|
||||
prevPageButton.setPreferredSize(new java.awt.Dimension(25, 25));
|
||||
prevPageButton.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/corecomponents/btn_step_back_hover.png"))); // NOI18N
|
||||
prevPageButton.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
@ -205,19 +220,15 @@ public class StringsContentPanel extends javax.swing.JPanel {
|
||||
});
|
||||
panelPageNextPrevButton.add(prevPageButton);
|
||||
|
||||
jSepXs1.setMinimumSize(new java.awt.Dimension(1, 0));
|
||||
jSepXs1.setPreferredSize(new java.awt.Dimension(1, 0));
|
||||
panelPageNextPrevButton.add(jSepXs1);
|
||||
|
||||
nextPageButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/corecomponents/btn_step_forward.png"))); // NOI18N
|
||||
nextPageButton.setText(org.openide.util.NbBundle.getMessage(StringsContentPanel.class, "StringsContentPanel.nextPageButton.text")); // NOI18N
|
||||
nextPageButton.setBorderPainted(false);
|
||||
nextPageButton.setContentAreaFilled(false);
|
||||
nextPageButton.setDisabledIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/corecomponents/btn_step_forward_disabled.png"))); // NOI18N
|
||||
nextPageButton.setMargin(new java.awt.Insets(2, 0, 2, 0));
|
||||
nextPageButton.setMaximumSize(new java.awt.Dimension(20, 20));
|
||||
nextPageButton.setMinimumSize(new java.awt.Dimension(20, 20));
|
||||
nextPageButton.setPreferredSize(new java.awt.Dimension(20, 20));
|
||||
nextPageButton.setMaximumSize(new java.awt.Dimension(25, 25));
|
||||
nextPageButton.setMinimumSize(new java.awt.Dimension(20, 25));
|
||||
nextPageButton.setPreferredSize(new java.awt.Dimension(25, 25));
|
||||
nextPageButton.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/corecomponents/btn_step_forward_hover.png"))); // NOI18N
|
||||
nextPageButton.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
@ -242,7 +253,7 @@ public class StringsContentPanel extends javax.swing.JPanel {
|
||||
goToPageTextField.setText(org.openide.util.NbBundle.getMessage(StringsContentPanel.class, "StringsContentPanel.goToPageTextField.text")); // NOI18N
|
||||
goToPageTextField.setMaximumSize(new java.awt.Dimension(2147483647, 25));
|
||||
goToPageTextField.setMinimumSize(new java.awt.Dimension(50, 25));
|
||||
goToPageTextField.setPreferredSize(new java.awt.Dimension(100, 25));
|
||||
goToPageTextField.setPreferredSize(new java.awt.Dimension(70, 25));
|
||||
goToPageTextField.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
goToPageTextFieldActionPerformed(evt);
|
||||
@ -278,11 +289,9 @@ public class StringsContentPanel extends javax.swing.JPanel {
|
||||
|
||||
add(controlPanel, java.awt.BorderLayout.NORTH);
|
||||
|
||||
outputScrollPane.setPreferredSize(new java.awt.Dimension(640, 402));
|
||||
|
||||
outputViewPane.setEditable(false);
|
||||
outputViewPane.setFont(new java.awt.Font("Courier New", 0, 11)); // NOI18N
|
||||
outputViewPane.setPreferredSize(new java.awt.Dimension(100, 40));
|
||||
outputViewPane.setPreferredSize(null);
|
||||
outputScrollPane.setViewportView(outputViewPane);
|
||||
|
||||
add(outputScrollPane, java.awt.BorderLayout.CENTER);
|
||||
|
@ -4,3 +4,4 @@ TranslationContentPanel.ocrLabel.text=OCR:
|
||||
TranslationOptionsPanelController.moduleErr=Module Error
|
||||
TranslationOptionsPanelController.moduleErr.msg=A module caused an error listening to TranslationSettingsPanelController updates. See log to determine which module. Some data could be incomplete.
|
||||
TranslationContentPanel.showLabel.text=Show:
|
||||
TranslationContentPanel.jSepLarge1.AccessibleContext.accessibleName=
|
||||
|
@ -6,11 +6,11 @@
|
||||
<Dimension value="[2000, 2000]"/>
|
||||
</Property>
|
||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[2, 2]"/>
|
||||
<Dimension value="[250, 2]"/>
|
||||
</Property>
|
||||
<Property name="name" type="java.lang.String" value="" noResource="true"/>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[100, 58]"/>
|
||||
<Dimension value="[250, 58]"/>
|
||||
</Property>
|
||||
<Property name="verifyInputWhenFocusTarget" type="boolean" value="false"/>
|
||||
</Properties>
|
||||
@ -24,28 +24,20 @@
|
||||
<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,-116,0,0,2,-11"/>
|
||||
<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,-116,0,0,3,-77"/>
|
||||
</AuxValues>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
|
||||
<SubComponents>
|
||||
<Container class="javax.swing.JPanel" name="jPanel1">
|
||||
<Container class="javax.swing.JPanel" name="controlPanel">
|
||||
<Properties>
|
||||
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
|
||||
<Border info="org.netbeans.modules.form.compat2.border.EtchedBorderInfo">
|
||||
<EtchetBorder/>
|
||||
</Border>
|
||||
</Property>
|
||||
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[182, 25]"/>
|
||||
<Dimension value="[20000, 20000]"/>
|
||||
</Property>
|
||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[254, 25]"/>
|
||||
<Dimension value="[2, 25]"/>
|
||||
</Property>
|
||||
<Property name="name" type="java.lang.String" value="" noResource="true"/>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[182, 25]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
|
||||
@ -58,28 +50,66 @@
|
||||
<Property name="verticalGap" type="int" value="0"/>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JLabel" name="warningLabel">
|
||||
<Container class="javax.swing.JPanel" name="warningLabelPanel">
|
||||
<Properties>
|
||||
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
|
||||
<Image iconType="3" name="/org/sleuthkit/autopsy/images/warning16.png"/>
|
||||
</Property>
|
||||
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[250, 25]"/>
|
||||
<Dimension value="[32767, 25]"/>
|
||||
</Property>
|
||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[150, 25]"/>
|
||||
</Property>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[250, 25]"/>
|
||||
<Dimension value="[2, 25]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Container class="javax.swing.JPanel" name="showPanel">
|
||||
<AuxValues>
|
||||
<AuxValue name="JavaCodeGenerator_VariableLocal" type="java.lang.Boolean" value="true"/>
|
||||
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="0"/>
|
||||
</AuxValues>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignFlowLayout">
|
||||
<Property name="horizontalGap" type="int" value="0"/>
|
||||
<Property name="verticalGap" type="int" value="0"/>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JLabel" name="warningLabel">
|
||||
<Properties>
|
||||
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
|
||||
<Image iconType="3" name="/org/sleuthkit/autopsy/images/warning16.png"/>
|
||||
</Property>
|
||||
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[250, 25]"/>
|
||||
</Property>
|
||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[150, 25]"/>
|
||||
</Property>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="null"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JSeparator" name="jSeparator1">
|
||||
<Properties>
|
||||
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[1, 25]"/>
|
||||
</Property>
|
||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[1, 25]"/>
|
||||
</Property>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[1, 25]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
<Container class="javax.swing.JPanel" name="showPanel">
|
||||
<Properties>
|
||||
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[32767, 25]"/>
|
||||
</Property>
|
||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[0, 25]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignFlowLayout">
|
||||
<Property name="horizontalGap" type="int" value="0"/>
|
||||
<Property name="verticalGap" type="int" value="0"/>
|
||||
@ -97,10 +127,21 @@
|
||||
<Dimension value="[42, 25]"/>
|
||||
</Property>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[42, 25]"/>
|
||||
<Dimension value="null"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JSeparator" name="jSepMed1">
|
||||
<Properties>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[5, 0]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<AuxValues>
|
||||
<AuxValue name="JavaCodeGenerator_VariableLocal" type="java.lang.Boolean" value="true"/>
|
||||
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="0"/>
|
||||
</AuxValues>
|
||||
</Component>
|
||||
<Component class="javax.swing.JComboBox" name="displayTextComboBox">
|
||||
<Properties>
|
||||
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
|
||||
@ -123,16 +164,36 @@
|
||||
</SubComponents>
|
||||
</Container>
|
||||
<Container class="javax.swing.JPanel" name="ocrPanel">
|
||||
<AuxValues>
|
||||
<AuxValue name="JavaCodeGenerator_VariableLocal" type="java.lang.Boolean" value="true"/>
|
||||
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="0"/>
|
||||
</AuxValues>
|
||||
<Properties>
|
||||
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[32767, 25]"/>
|
||||
</Property>
|
||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[0, 25]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignFlowLayout">
|
||||
<Property name="horizontalGap" type="int" value="0"/>
|
||||
<Property name="verticalGap" type="int" value="0"/>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JSeparator" name="jSepLarge1">
|
||||
<Properties>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[10, 0]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<AccessibilityProperties>
|
||||
<Property name="AccessibleContext.accessibleName" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="org/sleuthkit/autopsy/texttranslation/ui/Bundle.properties" key="TranslationContentPanel.jSepLarge1.AccessibleContext.accessibleName" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
</Property>
|
||||
</AccessibilityProperties>
|
||||
<AuxValues>
|
||||
<AuxValue name="JavaCodeGenerator_VariableLocal" type="java.lang.Boolean" value="true"/>
|
||||
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="0"/>
|
||||
</AuxValues>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="ocrLabel">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
@ -146,10 +207,21 @@
|
||||
<Dimension value="[25, 16]"/>
|
||||
</Property>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[40, 25]"/>
|
||||
<Dimension value="null"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JSeparator" name="jSepMed2">
|
||||
<Properties>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[5, 0]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<AuxValues>
|
||||
<AuxValue name="JavaCodeGenerator_VariableLocal" type="java.lang.Boolean" value="true"/>
|
||||
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="0"/>
|
||||
</AuxValues>
|
||||
</Component>
|
||||
<Component class="javax.swing.JComboBox" name="ocrDropdown">
|
||||
<Properties>
|
||||
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
|
||||
@ -183,8 +255,11 @@
|
||||
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[20000, 20000]"/>
|
||||
</Property>
|
||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[20, 20]"/>
|
||||
</Property>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[640, 250]"/>
|
||||
<Dimension value="[20, 20]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Constraints>
|
||||
|
@ -25,11 +25,13 @@ import java.awt.Font;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import javax.swing.JComboBox;
|
||||
import org.openide.util.NbBundle;
|
||||
import org.openide.util.NbBundle.Messages;
|
||||
import org.sleuthkit.autopsy.corecomponents.AutoWrappingJTextPane;
|
||||
import org.sleuthkit.autopsy.guiutils.WrapLayout;
|
||||
|
||||
/**
|
||||
* A JPanel used by TranslatedContentViewer to display machine translation of
|
||||
@ -49,6 +51,7 @@ public class TranslationContentPanel extends javax.swing.JPanel {
|
||||
*/
|
||||
public TranslationContentPanel() {
|
||||
initComponents();
|
||||
additionalInitComponents();
|
||||
|
||||
DISPLAY_PANE = new AutoWrappingJTextPane();
|
||||
DISPLAY_PANE.setEditable(false);
|
||||
@ -255,6 +258,13 @@ public class TranslationContentPanel extends javax.swing.JPanel {
|
||||
LANGUAGE_NAMES = createLanguageBiMap();
|
||||
}
|
||||
|
||||
private void additionalInitComponents() {
|
||||
// use wrap layout for better component wrapping
|
||||
WrapLayout layout = new WrapLayout(0,5);
|
||||
layout.setOppositeAligned(Arrays.asList(showPanel, ocrPanel));
|
||||
controlPanel.setLayout(layout);
|
||||
}
|
||||
|
||||
/**
|
||||
* Selection choices to be displayed in the combobox dropdown.
|
||||
*/
|
||||
@ -285,60 +295,88 @@ public class TranslationContentPanel extends javax.swing.JPanel {
|
||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||
private void initComponents() {
|
||||
|
||||
jPanel1 = new javax.swing.JPanel();
|
||||
controlPanel = new javax.swing.JPanel();
|
||||
javax.swing.JPanel warningLabelPanel = new javax.swing.JPanel();
|
||||
warningLabel = new javax.swing.JLabel();
|
||||
javax.swing.JPanel showPanel = new javax.swing.JPanel();
|
||||
jSeparator1 = new javax.swing.JSeparator();
|
||||
showPanel = new javax.swing.JPanel();
|
||||
showLabel = new javax.swing.JLabel();
|
||||
javax.swing.JSeparator jSepMed1 = new javax.swing.JSeparator();
|
||||
displayTextComboBox = new javax.swing.JComboBox<>();
|
||||
javax.swing.JPanel ocrPanel = new javax.swing.JPanel();
|
||||
ocrPanel = new javax.swing.JPanel();
|
||||
javax.swing.JSeparator jSepLarge1 = new javax.swing.JSeparator();
|
||||
ocrLabel = new javax.swing.JLabel();
|
||||
javax.swing.JSeparator jSepMed2 = new javax.swing.JSeparator();
|
||||
ocrDropdown = new javax.swing.JComboBox<>();
|
||||
textScrollPane = new javax.swing.JScrollPane();
|
||||
|
||||
setMaximumSize(new java.awt.Dimension(2000, 2000));
|
||||
setMinimumSize(new java.awt.Dimension(2, 2));
|
||||
setMinimumSize(new java.awt.Dimension(250, 2));
|
||||
setName(""); // NOI18N
|
||||
setPreferredSize(new java.awt.Dimension(100, 58));
|
||||
setPreferredSize(new java.awt.Dimension(250, 58));
|
||||
setVerifyInputWhenFocusTarget(false);
|
||||
setLayout(new java.awt.BorderLayout());
|
||||
|
||||
jPanel1.setBorder(javax.swing.BorderFactory.createEtchedBorder());
|
||||
jPanel1.setMaximumSize(new java.awt.Dimension(182, 25));
|
||||
jPanel1.setMinimumSize(new java.awt.Dimension(254, 25));
|
||||
jPanel1.setName(""); // NOI18N
|
||||
jPanel1.setPreferredSize(new java.awt.Dimension(182, 25));
|
||||
jPanel1.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT, 5, 0));
|
||||
controlPanel.setMaximumSize(new java.awt.Dimension(20000, 20000));
|
||||
controlPanel.setMinimumSize(new java.awt.Dimension(2, 25));
|
||||
controlPanel.setName(""); // NOI18N
|
||||
controlPanel.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT, 5, 0));
|
||||
|
||||
warningLabelPanel.setMaximumSize(new java.awt.Dimension(32767, 25));
|
||||
warningLabelPanel.setMinimumSize(new java.awt.Dimension(2, 25));
|
||||
warningLabelPanel.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.CENTER, 0, 0));
|
||||
|
||||
warningLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/images/warning16.png"))); // NOI18N
|
||||
warningLabel.setMaximumSize(new java.awt.Dimension(250, 25));
|
||||
warningLabel.setMinimumSize(new java.awt.Dimension(150, 25));
|
||||
warningLabel.setPreferredSize(new java.awt.Dimension(250, 25));
|
||||
jPanel1.add(warningLabel);
|
||||
warningLabel.setPreferredSize(null);
|
||||
warningLabelPanel.add(warningLabel);
|
||||
|
||||
jSeparator1.setMaximumSize(new java.awt.Dimension(1, 25));
|
||||
jSeparator1.setMinimumSize(new java.awt.Dimension(1, 25));
|
||||
jSeparator1.setPreferredSize(new java.awt.Dimension(1, 25));
|
||||
warningLabelPanel.add(jSeparator1);
|
||||
|
||||
controlPanel.add(warningLabelPanel);
|
||||
|
||||
showPanel.setMaximumSize(new java.awt.Dimension(32767, 25));
|
||||
showPanel.setMinimumSize(new java.awt.Dimension(0, 25));
|
||||
showPanel.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.CENTER, 0, 0));
|
||||
|
||||
org.openide.awt.Mnemonics.setLocalizedText(showLabel, org.openide.util.NbBundle.getMessage(TranslationContentPanel.class, "TranslationContentPanel.showLabel.text")); // NOI18N
|
||||
showLabel.setMaximumSize(new java.awt.Dimension(42, 25));
|
||||
showLabel.setMinimumSize(new java.awt.Dimension(42, 25));
|
||||
showLabel.setPreferredSize(new java.awt.Dimension(42, 25));
|
||||
showLabel.setPreferredSize(null);
|
||||
showPanel.add(showLabel);
|
||||
|
||||
jSepMed1.setPreferredSize(new java.awt.Dimension(5, 0));
|
||||
showPanel.add(jSepMed1);
|
||||
|
||||
displayTextComboBox.setMaximumSize(new java.awt.Dimension(170, 25));
|
||||
displayTextComboBox.setMinimumSize(new java.awt.Dimension(170, 25));
|
||||
displayTextComboBox.setPreferredSize(new java.awt.Dimension(170, 25));
|
||||
showPanel.add(displayTextComboBox);
|
||||
|
||||
jPanel1.add(showPanel);
|
||||
controlPanel.add(showPanel);
|
||||
|
||||
ocrPanel.setMaximumSize(new java.awt.Dimension(32767, 25));
|
||||
ocrPanel.setMinimumSize(new java.awt.Dimension(0, 25));
|
||||
ocrPanel.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.CENTER, 0, 0));
|
||||
|
||||
jSepLarge1.setPreferredSize(new java.awt.Dimension(10, 0));
|
||||
ocrPanel.add(jSepLarge1);
|
||||
jSepLarge1.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(TranslationContentPanel.class, "TranslationContentPanel.jSepLarge1.AccessibleContext.accessibleName")); // NOI18N
|
||||
|
||||
org.openide.awt.Mnemonics.setLocalizedText(ocrLabel, org.openide.util.NbBundle.getMessage(TranslationContentPanel.class, "TranslationContentPanel.ocrLabel.text")); // NOI18N
|
||||
ocrLabel.setEnabled(false);
|
||||
ocrLabel.setMaximumSize(new java.awt.Dimension(40, 25));
|
||||
ocrLabel.setMinimumSize(new java.awt.Dimension(25, 16));
|
||||
ocrLabel.setPreferredSize(new java.awt.Dimension(40, 25));
|
||||
ocrLabel.setPreferredSize(null);
|
||||
ocrPanel.add(ocrLabel);
|
||||
|
||||
jSepMed2.setPreferredSize(new java.awt.Dimension(5, 0));
|
||||
ocrPanel.add(jSepMed2);
|
||||
|
||||
ocrDropdown.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "N/A" }));
|
||||
ocrDropdown.setEnabled(false);
|
||||
ocrDropdown.setMaximumSize(new java.awt.Dimension(170, 25));
|
||||
@ -347,22 +385,26 @@ public class TranslationContentPanel extends javax.swing.JPanel {
|
||||
ocrDropdown.setPreferredSize(new java.awt.Dimension(170, 25));
|
||||
ocrPanel.add(ocrDropdown);
|
||||
|
||||
jPanel1.add(ocrPanel);
|
||||
controlPanel.add(ocrPanel);
|
||||
|
||||
add(jPanel1, java.awt.BorderLayout.NORTH);
|
||||
add(controlPanel, java.awt.BorderLayout.NORTH);
|
||||
|
||||
textScrollPane.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
|
||||
textScrollPane.setMaximumSize(new java.awt.Dimension(20000, 20000));
|
||||
textScrollPane.setPreferredSize(new java.awt.Dimension(640, 250));
|
||||
textScrollPane.setMinimumSize(new java.awt.Dimension(20, 20));
|
||||
textScrollPane.setPreferredSize(new java.awt.Dimension(20, 20));
|
||||
add(textScrollPane, java.awt.BorderLayout.CENTER);
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JPanel controlPanel;
|
||||
private javax.swing.JComboBox<String> displayTextComboBox;
|
||||
private javax.swing.JPanel jPanel1;
|
||||
private javax.swing.JSeparator jSeparator1;
|
||||
private javax.swing.JComboBox<String> ocrDropdown;
|
||||
private javax.swing.JLabel ocrLabel;
|
||||
private javax.swing.JPanel ocrPanel;
|
||||
private javax.swing.JLabel showLabel;
|
||||
private javax.swing.JPanel showPanel;
|
||||
private javax.swing.JScrollPane textScrollPane;
|
||||
private javax.swing.JLabel warningLabel;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
|
@ -27,10 +27,10 @@
|
||||
</NonVisualComponents>
|
||||
<Properties>
|
||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[100, 0]"/>
|
||||
<Dimension value="[250, 0]"/>
|
||||
</Property>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[100, 58]"/>
|
||||
<Dimension value="[250, 58]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<AuxValues>
|
||||
@ -571,10 +571,10 @@
|
||||
<Dimension value="[150, 32767]"/>
|
||||
</Property>
|
||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[150, 20]"/>
|
||||
<Dimension value="[150, 25]"/>
|
||||
</Property>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[150, 20]"/>
|
||||
<Dimension value="[150, 25]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<AuxValues>
|
||||
|
@ -47,6 +47,7 @@ import org.openide.util.NbBundle;
|
||||
import org.sleuthkit.autopsy.coreutils.EscapeUtil;
|
||||
import org.sleuthkit.autopsy.coreutils.Logger;
|
||||
import org.sleuthkit.autopsy.coreutils.TextUtil;
|
||||
import org.sleuthkit.autopsy.guiutils.WrapLayout;
|
||||
|
||||
/**
|
||||
* Panel displays HTML content sent to ExtractedContentViewer, and provides a
|
||||
@ -187,8 +188,7 @@ class ExtractedContentPanel extends javax.swing.JPanel implements ResizableTextP
|
||||
|
||||
private void additionalInit() {
|
||||
// use wrap layout for better component wrapping
|
||||
WrapLayout layout = new WrapLayout();
|
||||
layout.setHgap(5);
|
||||
WrapLayout layout = new WrapLayout(0,5);
|
||||
layout.setOppositeAligned(Arrays.asList(textSourcePanel));
|
||||
controlPanel.setLayout(layout);
|
||||
}
|
||||
@ -209,13 +209,13 @@ class ExtractedContentPanel extends javax.swing.JPanel implements ResizableTextP
|
||||
controlPanel = new javax.swing.JPanel();
|
||||
javax.swing.JPanel pagePanel = new javax.swing.JPanel();
|
||||
pagesLabel = new javax.swing.JLabel();
|
||||
fillerSmall1 = new javax.swing.Box.Filler(new java.awt.Dimension(5, 0), new java.awt.Dimension(5, 0), new java.awt.Dimension(5, 32767));
|
||||
javax.swing.Box.Filler fillerSmall1 = new javax.swing.Box.Filler(new java.awt.Dimension(5, 0), new java.awt.Dimension(5, 0), new java.awt.Dimension(5, 32767));
|
||||
pageCurLabel = new javax.swing.JLabel();
|
||||
fillerSmall2 = new javax.swing.Box.Filler(new java.awt.Dimension(5, 0), new java.awt.Dimension(5, 0), new java.awt.Dimension(5, 32767));
|
||||
javax.swing.Box.Filler fillerSmall2 = new javax.swing.Box.Filler(new java.awt.Dimension(5, 0), new java.awt.Dimension(5, 0), new java.awt.Dimension(5, 32767));
|
||||
pageOfLabel = new javax.swing.JLabel();
|
||||
fillerSmall3 = new javax.swing.Box.Filler(new java.awt.Dimension(5, 0), new java.awt.Dimension(5, 0), new java.awt.Dimension(5, 32767));
|
||||
javax.swing.Box.Filler fillerSmall3 = new javax.swing.Box.Filler(new java.awt.Dimension(5, 0), new java.awt.Dimension(5, 0), new java.awt.Dimension(5, 32767));
|
||||
pageTotalLabel = new javax.swing.JLabel();
|
||||
fillerSmall4 = new javax.swing.Box.Filler(new java.awt.Dimension(5, 0), new java.awt.Dimension(5, 0), new java.awt.Dimension(5, 32767));
|
||||
javax.swing.Box.Filler fillerSmall4 = new javax.swing.Box.Filler(new java.awt.Dimension(5, 0), new java.awt.Dimension(5, 0), new java.awt.Dimension(5, 32767));
|
||||
pageButtonsLabel = new javax.swing.JLabel();
|
||||
javax.swing.Box.Filler fillerMed1 = new javax.swing.Box.Filler(new java.awt.Dimension(10, 0), new java.awt.Dimension(10, 0), new java.awt.Dimension(10, 32767));
|
||||
pagePreviousButton = new javax.swing.JButton();
|
||||
@ -250,8 +250,8 @@ class ExtractedContentPanel extends javax.swing.JPanel implements ResizableTextP
|
||||
selectAllMenuItem.setText(org.openide.util.NbBundle.getMessage(ExtractedContentPanel.class, "ExtractedContentPanel.selectAllMenuItem.text")); // NOI18N
|
||||
rightClickMenu.add(selectAllMenuItem);
|
||||
|
||||
setMinimumSize(new java.awt.Dimension(100, 0));
|
||||
setPreferredSize(new java.awt.Dimension(100, 58));
|
||||
setMinimumSize(new java.awt.Dimension(250, 0));
|
||||
setPreferredSize(new java.awt.Dimension(250, 58));
|
||||
setLayout(new java.awt.BorderLayout());
|
||||
|
||||
controlPanel.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT, 0, 0));
|
||||
@ -393,8 +393,8 @@ class ExtractedContentPanel extends javax.swing.JPanel implements ResizableTextP
|
||||
|
||||
sourceComboBox.setModel(new javax.swing.DefaultComboBoxModel<org.sleuthkit.autopsy.keywordsearch.IndexedText>());
|
||||
sourceComboBox.setMaximumSize(new java.awt.Dimension(150, 32767));
|
||||
sourceComboBox.setMinimumSize(new java.awt.Dimension(150, 20));
|
||||
sourceComboBox.setPreferredSize(new java.awt.Dimension(150, 20));
|
||||
sourceComboBox.setMinimumSize(new java.awt.Dimension(150, 25));
|
||||
sourceComboBox.setPreferredSize(new java.awt.Dimension(150, 25));
|
||||
textSourcePanel.add(sourceComboBox);
|
||||
|
||||
controlPanel.add(textSourcePanel);
|
||||
@ -418,10 +418,6 @@ class ExtractedContentPanel extends javax.swing.JPanel implements ResizableTextP
|
||||
private javax.swing.JMenuItem copyMenuItem;
|
||||
private javax.swing.JScrollPane extractedScrollPane;
|
||||
private javax.swing.JTextPane extractedTextPane;
|
||||
private javax.swing.Box.Filler fillerSmall1;
|
||||
private javax.swing.Box.Filler fillerSmall2;
|
||||
private javax.swing.Box.Filler fillerSmall3;
|
||||
private javax.swing.Box.Filler fillerSmall4;
|
||||
private javax.swing.JLabel hitButtonsLabel;
|
||||
private javax.swing.JLabel hitCountLabel;
|
||||
private javax.swing.JLabel hitLabel;
|
||||
|
@ -1,495 +0,0 @@
|
||||
/*
|
||||
* Autopsy Forensic Browser
|
||||
*
|
||||
* Copyright 2019 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.keywordsearch;
|
||||
|
||||
import java.awt.Component;
|
||||
import java.awt.Container;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Insets;
|
||||
import java.awt.LayoutManager;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.SwingUtilities;
|
||||
|
||||
/**
|
||||
* FlowLayout subclass that fully supports wrapping of components.
|
||||
*
|
||||
* Originally written by Rob Camick
|
||||
* https://tips4java.wordpress.com/2008/11/06/wrap-layout/
|
||||
*/
|
||||
class WrapLayout implements LayoutManager, java.io.Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
/**
|
||||
* The flow layout manager allows a seperation of
|
||||
* components with gaps. The horizontal gap will
|
||||
* specify the space between components and between
|
||||
* the components and the borders of the
|
||||
* <code>Container</code>.
|
||||
*
|
||||
* @serial
|
||||
* @see #getHgap()
|
||||
* @see #setHgap(int)
|
||||
*/
|
||||
private int hgap;
|
||||
|
||||
/**
|
||||
* The flow layout manager allows a seperation of
|
||||
* components with gaps. The vertical gap will
|
||||
* specify the space between rows and between the
|
||||
* the rows and the borders of the <code>Container</code>.
|
||||
*
|
||||
* @serial
|
||||
* @see #getHgap()
|
||||
* @see #setHgap(int)
|
||||
*/
|
||||
private int vgap;
|
||||
|
||||
/**
|
||||
* If true, components will be aligned on their baseline.
|
||||
*/
|
||||
private boolean alignOnBaseline;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private final Set<Component> oppositeAlignedItems = new HashSet<>();
|
||||
|
||||
/**
|
||||
* Constructs a new <code>WrapLayout</code> with a left alignment and a
|
||||
* default 5-unit horizontal and vertical gap.
|
||||
*/
|
||||
WrapLayout() {
|
||||
super();
|
||||
}
|
||||
|
||||
|
||||
void setOppositeAligned(Collection<Component> rightAlignedComponents) {
|
||||
synchronized (this.oppositeAlignedItems) {
|
||||
this.oppositeAlignedItems.clear();
|
||||
this.oppositeAlignedItems.addAll(rightAlignedComponents);
|
||||
}
|
||||
}
|
||||
|
||||
Set<Component> getOppositeAlignedItems() {
|
||||
return oppositeAlignedItems;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the horizontal gap between components
|
||||
* and between the components and the borders
|
||||
* of the <code>Container</code>
|
||||
*
|
||||
* @return the horizontal gap between components
|
||||
* and between the components and the borders
|
||||
* of the <code>Container</code>
|
||||
* @see java.awt.FlowLayout#setHgap
|
||||
* @since JDK1.1
|
||||
*/
|
||||
int getHgap() {
|
||||
return hgap;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the horizontal gap between components and
|
||||
* between the components and the borders of the
|
||||
* <code>Container</code>.
|
||||
*
|
||||
* @param hgap the horizontal gap between components
|
||||
* and between the components and the borders
|
||||
* of the <code>Container</code>
|
||||
* @see java.awt.FlowLayout#getHgap
|
||||
* @since JDK1.1
|
||||
*/
|
||||
void setHgap(int hgap) {
|
||||
this.hgap = hgap;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the vertical gap between components and
|
||||
* between the components and the borders of the
|
||||
* <code>Container</code>.
|
||||
*
|
||||
* @return the vertical gap between components
|
||||
* and between the components and the borders
|
||||
* of the <code>Container</code>
|
||||
* @see java.awt.FlowLayout#setVgap
|
||||
* @since JDK1.1
|
||||
*/
|
||||
int getVgap() {
|
||||
return vgap;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the vertical gap between components and between
|
||||
* the components and the borders of the <code>Container</code>.
|
||||
*
|
||||
* @param vgap the vertical gap between components
|
||||
* and between the components and the borders
|
||||
* of the <code>Container</code>
|
||||
* @see java.awt.FlowLayout#getVgap
|
||||
* @since JDK1.1
|
||||
*/
|
||||
void setVgap(int vgap) {
|
||||
this.vgap = vgap;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets whether or not components should be vertically aligned along their
|
||||
* baseline. Components that do not have a baseline will be centered.
|
||||
* The default is false.
|
||||
*
|
||||
* @param alignOnBaseline whether or not components should be
|
||||
* vertically aligned on their baseline
|
||||
* @since 1.6
|
||||
*/
|
||||
void setAlignOnBaseline(boolean alignOnBaseline) {
|
||||
this.alignOnBaseline = alignOnBaseline;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if components are to be vertically aligned along
|
||||
* their baseline. The default is false.
|
||||
*
|
||||
* @return true if components are to be vertically aligned along
|
||||
* their baseline
|
||||
* @since 1.6
|
||||
*/
|
||||
boolean getAlignOnBaseline() {
|
||||
return alignOnBaseline;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the specified component to the layout.
|
||||
* Not used by this class.
|
||||
* @param name the name of the component
|
||||
* @param comp the component to be added
|
||||
*/
|
||||
@Override
|
||||
public void addLayoutComponent(String name, Component comp) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the specified component from the layout.
|
||||
* Not used by this class.
|
||||
* @param comp the component to remove
|
||||
* @see java.awt.Container#removeAll
|
||||
*/
|
||||
@Override
|
||||
public void removeLayoutComponent(Component comp) {
|
||||
}
|
||||
|
||||
|
||||
|
||||
private int getComponentY(int rowY, boolean alignBaseline, int rowHeight, int itemHeight) {
|
||||
return alignBaseline ?
|
||||
rowY + rowHeight - itemHeight :
|
||||
rowY;
|
||||
}
|
||||
|
||||
private int getComponentX(int leftX, int rightX, boolean ltr, int xPos, int componentWidth) {
|
||||
return ltr ? leftX + xPos : rightX - xPos - componentWidth;
|
||||
}
|
||||
|
||||
private int setComponentDims(Component comp, boolean alignBaseline, boolean ltr, int rowY, int rowHeight, int leftX, int rightX, int xPos) {
|
||||
Dimension d = comp.getPreferredSize();
|
||||
comp.setSize(d);
|
||||
|
||||
int x = getComponentX(leftX, rightX, ltr, xPos, d.width);
|
||||
int y = getComponentY(rowY, alignBaseline, rowHeight, d.height);
|
||||
comp.setLocation(x, y);
|
||||
|
||||
return d.width;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Lays out the container. This method lets each
|
||||
* <i>visible</i> component take its preferred size by reshaping the
|
||||
* components in the target container in order to satisfy the alignment of
|
||||
* this <code>FlowLayout</code> object. Taken from
|
||||
* https://raw.githubusercontent.com/mynawang/Java8-Source-Code/master/src/main/jdk8/java/awt/FlowLayout.java.
|
||||
*
|
||||
* @param target the specified component being laid out
|
||||
*
|
||||
* @see Container
|
||||
* @see java.awt.Container#doLayout
|
||||
*/
|
||||
@Override
|
||||
public void layoutContainer(Container target) {
|
||||
synchronized (target.getTreeLock()) {
|
||||
synchronized (this.oppositeAlignedItems) {
|
||||
ParentDimensions targetDims = getTargetDimensions(target);
|
||||
List<Component> components = Arrays.asList(target.getComponents());
|
||||
List<Row> rows = getAllRows(components, true, targetDims.innerWidth);
|
||||
|
||||
boolean ltr = target.getComponentOrientation().isLeftToRight();
|
||||
boolean useBaseline = getAlignOnBaseline();
|
||||
|
||||
int rowY = targetDims.insets.top + getVgap();
|
||||
int leftX = targetDims.insets.left + getHgap();
|
||||
int rightX = targetDims.outerWidth - targetDims.insets.right - getHgap();
|
||||
|
||||
for (Row row : rows) {
|
||||
int rowHeight = row.height;
|
||||
|
||||
int curX = 0;
|
||||
if (row.components != null) {
|
||||
for (Component origComp : row.components)
|
||||
curX += setComponentDims(origComp, useBaseline, ltr, rowY, rowHeight, leftX, rightX, curX) + getHgap();
|
||||
}
|
||||
|
||||
if (row.oppositeAligned != null) {
|
||||
curX = 0;
|
||||
// reverse opposite aligned for layout purposes since flipping ltr
|
||||
Collections.reverse(row.oppositeAligned);
|
||||
for (Component oppAlignedComp : row.oppositeAligned)
|
||||
curX += setComponentDims(oppAlignedComp, useBaseline, !ltr, rowY, rowHeight, leftX, rightX, curX) + getHgap();
|
||||
}
|
||||
|
||||
rowY += rowHeight + getVgap();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the preferred dimensions for this layout given the
|
||||
* <i>visible</i> components in the specified target container.
|
||||
*
|
||||
* @param target the component which needs to be laid out
|
||||
*
|
||||
* @return the preferred dimensions to lay out the subcomponents of the
|
||||
* specified container
|
||||
*/
|
||||
@Override
|
||||
public Dimension preferredLayoutSize(Container target) {
|
||||
return layoutSize(target, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the minimum dimensions needed to layout the <i>visible</i>
|
||||
* components contained in the specified target container.
|
||||
*
|
||||
* @param target the component which needs to be laid out
|
||||
*
|
||||
* @return the minimum dimensions to lay out the subcomponents of the
|
||||
* specified container
|
||||
*/
|
||||
@Override
|
||||
public Dimension minimumLayoutSize(Container target) {
|
||||
Dimension minimum = layoutSize(target, false);
|
||||
minimum.width -= (getHgap() + 1);
|
||||
return minimum;
|
||||
}
|
||||
|
||||
private static class ParentDimensions {
|
||||
|
||||
final int outerWidth;
|
||||
final int innerWidth;
|
||||
final Insets insets;
|
||||
|
||||
ParentDimensions(int outerWidth, int innerWidth, Insets insets) {
|
||||
this.outerWidth = outerWidth;
|
||||
this.innerWidth = innerWidth;
|
||||
this.insets = insets;
|
||||
}
|
||||
}
|
||||
|
||||
private ParentDimensions getTargetDimensions(Container target) {
|
||||
// Each row must fit with the width allocated to the containter.
|
||||
// When the container width = 0, the preferred width of the container
|
||||
// has not yet been calculated so lets ask for the maximum.
|
||||
|
||||
int targetWidth = target.getSize().width;
|
||||
Container container = target;
|
||||
|
||||
while (container.getSize().width == 0 && container.getParent() != null) {
|
||||
container = container.getParent();
|
||||
}
|
||||
|
||||
targetWidth = container.getSize().width;
|
||||
|
||||
if (targetWidth == 0) {
|
||||
targetWidth = Integer.MAX_VALUE;
|
||||
}
|
||||
|
||||
int hgap = getHgap();
|
||||
|
||||
Insets insets = target.getInsets();
|
||||
int horizontalInsetsAndGap = insets.left + insets.right + (hgap * 2);
|
||||
int maxWidth = targetWidth - horizontalInsetsAndGap;
|
||||
|
||||
return new ParentDimensions(targetWidth, maxWidth, insets);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the minimum or preferred dimension needed to layout the target
|
||||
* container.
|
||||
*
|
||||
* @param target target to get layout size for
|
||||
* @param preferred should preferred size be calculated
|
||||
*
|
||||
* @return the dimension to layout the target container
|
||||
*/
|
||||
private Dimension layoutSize(Container target, boolean preferred) {
|
||||
synchronized (target.getTreeLock()) {
|
||||
synchronized (this.oppositeAlignedItems) {
|
||||
ParentDimensions targetDims = getTargetDimensions(target);
|
||||
List<Component> components = Arrays.asList(target.getComponents());
|
||||
List<Row> rows = getAllRows(components, preferred, targetDims.innerWidth);
|
||||
|
||||
Integer containerHeight = rows.stream().map((r) -> r.height).reduce(0, Integer::sum);
|
||||
// add in vertical gap between rows
|
||||
if (rows.size() > 1) {
|
||||
containerHeight += (rows.size() - 1) * getVgap();
|
||||
}
|
||||
|
||||
containerHeight += targetDims.insets.top + targetDims.insets.bottom;
|
||||
|
||||
Integer containerWidth = rows.stream().map((r) -> r.width).reduce(0, Math::max);
|
||||
containerWidth += targetDims.insets.left + targetDims.insets.right + (getHgap() * 2);
|
||||
|
||||
// When using a scroll pane or the DecoratedLookAndFeel we need to
|
||||
// make sure the preferred size is less than the size of the
|
||||
// target containter so shrinking the container size works
|
||||
// correctly. Removing the horizontal gap is an easy way to do this.
|
||||
Container scrollPane = SwingUtilities.getAncestorOfClass(JScrollPane.class, target);
|
||||
|
||||
if (scrollPane != null && target.isValid()) {
|
||||
containerWidth -= (getHgap() + 1);
|
||||
}
|
||||
|
||||
return new Dimension(containerWidth, containerHeight);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class Row {
|
||||
|
||||
final List<Component> components;
|
||||
final List<Component> oppositeAligned;
|
||||
final int height;
|
||||
final int width;
|
||||
|
||||
public Row(List<Component> components, List<Component> oppositeAligned, int height, int width) {
|
||||
this.components = components;
|
||||
this.oppositeAligned = oppositeAligned;
|
||||
this.height = height;
|
||||
this.width = width;
|
||||
}
|
||||
}
|
||||
|
||||
private List<Row> getAllRows(List<Component> components, boolean preferred, int maxWidth) {
|
||||
List<Component> originalComp
|
||||
= components
|
||||
.stream()
|
||||
.filter((comp) -> !this.oppositeAlignedItems.contains(comp))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
List<Row> originalRowSet = getRowSet(originalComp, preferred, maxWidth);
|
||||
|
||||
List<Component> oppositeAlignedComp
|
||||
= components
|
||||
.stream()
|
||||
.filter((comp) -> this.oppositeAlignedItems.contains(comp))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// go in reverse order and then revert so we can use same getRowSet method
|
||||
Collections.reverse(oppositeAlignedComp);
|
||||
List<Row> oppositeRowSet = getRowSet(oppositeAlignedComp, preferred, maxWidth)
|
||||
.stream()
|
||||
.map((Row row) -> {
|
||||
Collections.reverse(row.components);
|
||||
return new Row(null, row.components, row.height, row.width);
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
Collections.reverse(oppositeRowSet);
|
||||
|
||||
List<Row> toReturn = new ArrayList<>();
|
||||
|
||||
if (originalRowSet.size() > 0 && oppositeRowSet.size() > 0) {
|
||||
Row lastOrig = originalRowSet.get(originalRowSet.size() - 1);
|
||||
Row firstOpp = oppositeRowSet.get(0);
|
||||
|
||||
int proposedRowWidth = lastOrig.width + firstOpp.width + getHgap();
|
||||
if (proposedRowWidth <= maxWidth) {
|
||||
Row middleRow = new Row(lastOrig.components, firstOpp.oppositeAligned,
|
||||
Math.max(lastOrig.height, firstOpp.height), proposedRowWidth);
|
||||
|
||||
toReturn.addAll(originalRowSet.subList(0, originalRowSet.size() - 1));
|
||||
toReturn.add(middleRow);
|
||||
toReturn.addAll(oppositeRowSet.subList(1, oppositeRowSet.size()));
|
||||
return toReturn;
|
||||
}
|
||||
}
|
||||
|
||||
toReturn.addAll(originalRowSet);
|
||||
toReturn.addAll(oppositeRowSet);
|
||||
return toReturn;
|
||||
}
|
||||
|
||||
private List<Row> getRowSet(List<Component> components, boolean preferred, int maxWidth) {
|
||||
List<Row> rows = new ArrayList<>();
|
||||
|
||||
List<Component> rowComponents = new ArrayList<>();
|
||||
int rowWidth = 0;
|
||||
int rowHeight = 0;
|
||||
|
||||
for (Component m : components) {
|
||||
if (m.isVisible()) {
|
||||
Dimension d = preferred ? m.getPreferredSize() : m.getMinimumSize();
|
||||
|
||||
// Can't add the component to current row. Start a new row.
|
||||
if (rowWidth + d.width > maxWidth) {
|
||||
rows.add(new Row(rowComponents, null, rowHeight, rowWidth));
|
||||
rowComponents = new ArrayList<>();
|
||||
rowWidth = 0;
|
||||
rowHeight = 0;
|
||||
}
|
||||
|
||||
// Add a horizontal gap for all components after the first
|
||||
if (rowWidth != 0) {
|
||||
rowWidth += getHgap();
|
||||
}
|
||||
|
||||
rowComponents.add(m);
|
||||
rowWidth += d.width;
|
||||
rowHeight = Math.max(rowHeight, d.height);
|
||||
}
|
||||
}
|
||||
|
||||
if (rowComponents.size() > 0) {
|
||||
rows.add(new Row(rowComponents, null, rowHeight, rowWidth));
|
||||
}
|
||||
|
||||
return rows;
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user