mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-14 17:06:16 +00:00
updates to fix translation panel gui rough edges
This commit is contained in:
parent
e6c3fda9c5
commit
db90af5d5a
@ -20,6 +20,7 @@ package org.sleuthkit.autopsy.contentviewers;
|
|||||||
|
|
||||||
import org.sleuthkit.autopsy.datamodel.AttachmentNode;
|
import org.sleuthkit.autopsy.datamodel.AttachmentNode;
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
|
import java.awt.BorderLayout;
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
import java.awt.Component;
|
import java.awt.Component;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
@ -131,6 +132,7 @@ public class MessageContentViewer extends javax.swing.JPanel implements DataCont
|
|||||||
drp = DataResultPanel.createInstanceUninitialized(Bundle.MessageContentViewer_AtrachmentsPanel_title(), "", new TableFilterNode(Node.EMPTY, false), 0, null);
|
drp = DataResultPanel.createInstanceUninitialized(Bundle.MessageContentViewer_AtrachmentsPanel_title(), "", new TableFilterNode(Node.EMPTY, false), 0, null);
|
||||||
attachmentsScrollPane.setViewportView(drp);
|
attachmentsScrollPane.setViewportView(drp);
|
||||||
|
|
||||||
|
//textPanel.setLayout(new BorderLayout());
|
||||||
msgbodyTabbedPane.insertTab(
|
msgbodyTabbedPane.insertTab(
|
||||||
NbBundle.getMessage(MessageContentViewer.class, "MessageContentViewer.textbodyScrollPane.TabConstraints.tabTitle"),
|
NbBundle.getMessage(MessageContentViewer.class, "MessageContentViewer.textbodyScrollPane.TabConstraints.tabTitle"),
|
||||||
null,
|
null,
|
||||||
|
@ -47,9 +47,11 @@ final class TextTranslatableComponent implements TranslatablePanel.TranslatableC
|
|||||||
textComponent.setLineWrap(true);
|
textComponent.setLineWrap(true);
|
||||||
textComponent.setRows(5);
|
textComponent.setRows(5);
|
||||||
textComponent.setWrapStyleWord(true);
|
textComponent.setWrapStyleWord(true);
|
||||||
|
|
||||||
JScrollPane parentComponent = new JScrollPane();
|
JScrollPane parentComponent = new JScrollPane();
|
||||||
parentComponent.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
|
parentComponent.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
|
||||||
parentComponent.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
|
parentComponent.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
|
||||||
|
//parentComponent.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
|
||||||
parentComponent.setViewportView(textComponent);
|
parentComponent.setViewportView(textComponent);
|
||||||
this.parentComponent = parentComponent;
|
this.parentComponent = parentComponent;
|
||||||
this.textComponent = textComponent;
|
this.textComponent = textComponent;
|
||||||
@ -77,6 +79,7 @@ final class TextTranslatableComponent implements TranslatablePanel.TranslatableC
|
|||||||
private boolean setPanelContent(String content) {
|
private boolean setPanelContent(String content) {
|
||||||
try {
|
try {
|
||||||
textComponent.setText(content == null ? "" : content);
|
textComponent.setText(content == null ? "" : content);
|
||||||
|
textComponent.setCaretPosition(0);
|
||||||
return true;
|
return true;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LOGGER.log(Level.WARNING, "There was an error in setting up the text for MessageContentViewer text panel", e);
|
LOGGER.log(Level.WARNING, "There was an error in setting up the text for MessageContentViewer text panel", e);
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
|
|
||||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
|
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
|
||||||
<SubComponents>
|
<SubComponents>
|
||||||
<Container class="javax.swing.JPanel" name="jPanel1">
|
<Container class="javax.swing.JPanel" name="translationBar">
|
||||||
<Properties>
|
<Properties>
|
||||||
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
|
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
|
||||||
<Border info="org.netbeans.modules.form.compat2.border.EtchedBorderInfo">
|
<Border info="org.netbeans.modules.form.compat2.border.EtchedBorderInfo">
|
||||||
@ -49,18 +49,22 @@
|
|||||||
</Constraint>
|
</Constraint>
|
||||||
</Constraints>
|
</Constraints>
|
||||||
|
|
||||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout"/>
|
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
|
||||||
<SubComponents>
|
<SubComponents>
|
||||||
<Component class="javax.swing.JComboBox" name="translateComboBox">
|
<Component class="javax.swing.JComboBox" name="translateComboBox">
|
||||||
<Properties>
|
<Properties>
|
||||||
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
|
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
|
||||||
<StringArray count="0"/>
|
<StringArray count="0"/>
|
||||||
</Property>
|
</Property>
|
||||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||||
<Dimension value="[43, 20]"/>
|
<Dimension value="[200, 20]"/>
|
||||||
</Property>
|
</Property>
|
||||||
|
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||||
|
<Dimension value="[200, 20]"/>
|
||||||
|
</Property>
|
||||||
|
<Property name="name" type="java.lang.String" value="" noResource="true"/>
|
||||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||||
<Dimension value="[43, 20]"/>
|
<Dimension value="[200, 20]"/>
|
||||||
</Property>
|
</Property>
|
||||||
</Properties>
|
</Properties>
|
||||||
<Events>
|
<Events>
|
||||||
@ -70,20 +74,20 @@
|
|||||||
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="<TranslateOption>"/>
|
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="<TranslateOption>"/>
|
||||||
</AuxValues>
|
</AuxValues>
|
||||||
<Constraints>
|
<Constraints>
|
||||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
|
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
|
||||||
<GridBagConstraints gridX="3" gridY="0" gridWidth="1" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="5" insetsBottom="0" insetsRight="0" anchor="13" weightX="0.1" weightY="0.0"/>
|
<BorderConstraints direction="After"/>
|
||||||
</Constraint>
|
</Constraint>
|
||||||
</Constraints>
|
</Constraints>
|
||||||
</Component>
|
</Component>
|
||||||
<Component class="javax.swing.JLabel" name="warningLabel">
|
<Component class="javax.swing.JLabel" name="warningLabel">
|
||||||
<Properties>
|
<Properties>
|
||||||
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
|
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||||
<Image iconType="3" name="/org/sleuthkit/autopsy/images/warning16.png"/>
|
<Dimension value="[32767, 32767]"/>
|
||||||
</Property>
|
</Property>
|
||||||
</Properties>
|
</Properties>
|
||||||
<Constraints>
|
<Constraints>
|
||||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
|
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
|
||||||
<GridBagConstraints gridX="0" gridY="0" gridWidth="1" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="17" weightX="0.25" weightY="0.0"/>
|
<BorderConstraints direction="Center"/>
|
||||||
</Constraint>
|
</Constraint>
|
||||||
</Constraints>
|
</Constraints>
|
||||||
</Component>
|
</Component>
|
||||||
|
@ -19,15 +19,19 @@
|
|||||||
package org.sleuthkit.autopsy.contentviewers;
|
package org.sleuthkit.autopsy.contentviewers;
|
||||||
|
|
||||||
import java.awt.Component;
|
import java.awt.Component;
|
||||||
|
import javax.swing.ImageIcon;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import javax.swing.JPanel;
|
import javax.swing.JPanel;
|
||||||
import javax.swing.SwingUtilities;
|
import javax.swing.SwingUtilities;
|
||||||
import org.openide.util.NbBundle.Messages;
|
import org.openide.util.NbBundle.Messages;
|
||||||
|
import org.sleuthkit.autopsy.texttranslation.TextTranslationService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A panel for translation with a subcomponent that allows for translation
|
* A panel for translation with a subcomponent that allows for translation
|
||||||
*/
|
*/
|
||||||
final class TranslatablePanel extends JPanel {
|
final class TranslatablePanel extends JPanel {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* an option in drop down of whether or not to translate
|
* an option in drop down of whether or not to translate
|
||||||
*/
|
*/
|
||||||
@ -86,11 +90,12 @@ final class TranslatablePanel extends JPanel {
|
|||||||
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
private final ImageIcon warningIcon = new ImageIcon(TranslatablePanel.class.getResource("/org/sleuthkit/autopsy/images/warning16.png"));
|
||||||
|
|
||||||
private final TranslatableComponent subcomponent;
|
private final TranslatableComponent subcomponent;
|
||||||
private final String origOptionText;
|
private final String origOptionText;
|
||||||
private final String translatedOptionText;
|
private final String translatedOptionText;
|
||||||
|
private final TextTranslationService translationService;
|
||||||
|
|
||||||
@Messages({"TranslatablePanel.comboBoxOption.originalText=Original Text",
|
@Messages({"TranslatablePanel.comboBoxOption.originalText=Original Text",
|
||||||
"TranslatablePanel.comboBoxOption.translatedText=Translated Text"})
|
"TranslatablePanel.comboBoxOption.translatedText=Translated Text"})
|
||||||
@ -99,29 +104,40 @@ final class TranslatablePanel extends JPanel {
|
|||||||
subcomponent,
|
subcomponent,
|
||||||
Bundle.TranslatablePanel_comboBoxOption_originalText(),
|
Bundle.TranslatablePanel_comboBoxOption_originalText(),
|
||||||
Bundle.TranslatablePanel_comboBoxOption_translatedText(),
|
Bundle.TranslatablePanel_comboBoxOption_translatedText(),
|
||||||
null);
|
null,
|
||||||
|
TextTranslationService.getInstance());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates new form TranslatedContentPanel
|
* Creates new form TranslatedContentPanel
|
||||||
*/
|
*/
|
||||||
TranslatablePanel(TranslatableComponent subcomponent, String origOptionText, String translatedOptionText, String origContent) {
|
TranslatablePanel(TranslatableComponent subcomponent, String origOptionText, String translatedOptionText, String origContent,
|
||||||
|
TextTranslationService translationService) {
|
||||||
this.subcomponent = subcomponent;
|
this.subcomponent = subcomponent;
|
||||||
this.origOptionText = origOptionText;
|
this.origOptionText = origOptionText;
|
||||||
this.translatedOptionText = translatedOptionText;
|
this.translatedOptionText = translatedOptionText;
|
||||||
|
this.translationService = translationService;
|
||||||
|
|
||||||
initComponents();
|
initComponents();
|
||||||
additionalInit(origContent);
|
additionalInit();
|
||||||
|
setTranslationBarVisible();
|
||||||
|
setContent(origContent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void setWarningLabelMsg(String msg) {
|
private void setWarningLabelMsg(String msg) {
|
||||||
warningLabel.setText(msg);
|
boolean hasWarning = !StringUtils.isEmpty(msg);
|
||||||
warningLabel.setVisible(StringUtils.isEmpty(msg));
|
warningLabel.setText(hasWarning ? msg : "");
|
||||||
|
warningLabel.setIcon(hasWarning ? warningIcon : null);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setTranslationBarVisible() {
|
||||||
|
translationBar.setVisible(this.translationService.hasProvider());
|
||||||
}
|
}
|
||||||
|
|
||||||
void reset() {
|
void reset() {
|
||||||
|
setTranslationBarVisible();
|
||||||
setContent(null);
|
setContent(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -135,13 +151,12 @@ final class TranslatablePanel extends JPanel {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void additionalInit(String origContent) {
|
private void additionalInit() {
|
||||||
add(this.subcomponent.getComponent(), java.awt.BorderLayout.CENTER);
|
add(this.subcomponent.getComponent(), java.awt.BorderLayout.CENTER);
|
||||||
setWarningLabelMsg(null);
|
setWarningLabelMsg(null);
|
||||||
translateComboBox.removeAllItems();
|
translateComboBox.removeAllItems();
|
||||||
translateComboBox.addItem(new TranslateOption(this.origOptionText, false));
|
translateComboBox.addItem(new TranslateOption(this.origOptionText, false));
|
||||||
translateComboBox.addItem(new TranslateOption(this.translatedOptionText, true));
|
translateComboBox.addItem(new TranslateOption(this.translatedOptionText, true));
|
||||||
this.subcomponent.setContent(origContent);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleComboBoxChange(TranslateOption translateOption) {
|
private void handleComboBoxChange(TranslateOption translateOption) {
|
||||||
@ -160,9 +175,8 @@ final class TranslatablePanel extends JPanel {
|
|||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||||
private void initComponents() {
|
private void initComponents() {
|
||||||
java.awt.GridBagConstraints gridBagConstraints;
|
|
||||||
|
|
||||||
jPanel1 = new javax.swing.JPanel();
|
translationBar = new javax.swing.JPanel();
|
||||||
translateComboBox = new javax.swing.JComboBox<>();
|
translateComboBox = new javax.swing.JComboBox<>();
|
||||||
warningLabel = new javax.swing.JLabel();
|
warningLabel = new javax.swing.JLabel();
|
||||||
|
|
||||||
@ -173,37 +187,26 @@ final class TranslatablePanel extends JPanel {
|
|||||||
setVerifyInputWhenFocusTarget(false);
|
setVerifyInputWhenFocusTarget(false);
|
||||||
setLayout(new java.awt.BorderLayout());
|
setLayout(new java.awt.BorderLayout());
|
||||||
|
|
||||||
jPanel1.setBorder(javax.swing.BorderFactory.createEtchedBorder());
|
translationBar.setBorder(javax.swing.BorderFactory.createEtchedBorder());
|
||||||
jPanel1.setMaximumSize(new java.awt.Dimension(182, 24));
|
translationBar.setMaximumSize(new java.awt.Dimension(182, 24));
|
||||||
jPanel1.setPreferredSize(new java.awt.Dimension(182, 24));
|
translationBar.setPreferredSize(new java.awt.Dimension(182, 24));
|
||||||
jPanel1.setLayout(new java.awt.GridBagLayout());
|
translationBar.setLayout(new java.awt.BorderLayout());
|
||||||
|
|
||||||
translateComboBox.setMinimumSize(new java.awt.Dimension(43, 20));
|
translateComboBox.setMaximumSize(new java.awt.Dimension(200, 20));
|
||||||
translateComboBox.setPreferredSize(new java.awt.Dimension(43, 20));
|
translateComboBox.setMinimumSize(new java.awt.Dimension(200, 20));
|
||||||
|
translateComboBox.setName(""); // NOI18N
|
||||||
|
translateComboBox.setPreferredSize(new java.awt.Dimension(200, 20));
|
||||||
translateComboBox.addActionListener(new java.awt.event.ActionListener() {
|
translateComboBox.addActionListener(new java.awt.event.ActionListener() {
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||||
translateComboBoxActionPerformed(evt);
|
translateComboBoxActionPerformed(evt);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
gridBagConstraints = new java.awt.GridBagConstraints();
|
translationBar.add(translateComboBox, java.awt.BorderLayout.LINE_END);
|
||||||
gridBagConstraints.gridx = 3;
|
|
||||||
gridBagConstraints.gridy = 0;
|
|
||||||
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
|
|
||||||
gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
|
|
||||||
gridBagConstraints.weightx = 0.1;
|
|
||||||
gridBagConstraints.insets = new java.awt.Insets(0, 5, 0, 0);
|
|
||||||
jPanel1.add(translateComboBox, gridBagConstraints);
|
|
||||||
|
|
||||||
warningLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/images/warning16.png"))); // NOI18N
|
warningLabel.setMaximumSize(new java.awt.Dimension(32767, 32767));
|
||||||
gridBagConstraints = new java.awt.GridBagConstraints();
|
translationBar.add(warningLabel, java.awt.BorderLayout.CENTER);
|
||||||
gridBagConstraints.gridx = 0;
|
|
||||||
gridBagConstraints.gridy = 0;
|
|
||||||
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
|
|
||||||
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
|
|
||||||
gridBagConstraints.weightx = 0.25;
|
|
||||||
jPanel1.add(warningLabel, gridBagConstraints);
|
|
||||||
|
|
||||||
add(jPanel1, java.awt.BorderLayout.NORTH);
|
add(translationBar, java.awt.BorderLayout.NORTH);
|
||||||
}// </editor-fold>//GEN-END:initComponents
|
}// </editor-fold>//GEN-END:initComponents
|
||||||
|
|
||||||
private void translateComboBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_translateComboBoxActionPerformed
|
private void translateComboBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_translateComboBoxActionPerformed
|
||||||
@ -211,8 +214,8 @@ final class TranslatablePanel extends JPanel {
|
|||||||
}//GEN-LAST:event_translateComboBoxActionPerformed
|
}//GEN-LAST:event_translateComboBoxActionPerformed
|
||||||
|
|
||||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||||
private javax.swing.JPanel jPanel1;
|
|
||||||
private javax.swing.JComboBox<TranslateOption> translateComboBox;
|
private javax.swing.JComboBox<TranslateOption> translateComboBox;
|
||||||
|
private javax.swing.JPanel translationBar;
|
||||||
private javax.swing.JLabel warningLabel;
|
private javax.swing.JLabel warningLabel;
|
||||||
// End of variables declaration//GEN-END:variables
|
// End of variables declaration//GEN-END:variables
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user