mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-12 16:06:15 +00:00
4978 clean up netbeans warnings
This commit is contained in:
parent
6cee5e15b6
commit
778431c45b
@ -51,6 +51,7 @@ import org.sleuthkit.autopsy.coreutils.TextUtil;
|
|||||||
class ExtractedContentPanel extends javax.swing.JPanel {
|
class ExtractedContentPanel extends javax.swing.JPanel {
|
||||||
|
|
||||||
private static final Logger logger = Logger.getLogger(ExtractedContentPanel.class.getName());
|
private static final Logger logger = Logger.getLogger(ExtractedContentPanel.class.getName());
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
private String contentName;
|
private String contentName;
|
||||||
|
|
||||||
ExtractedContentPanel() {
|
ExtractedContentPanel() {
|
||||||
@ -65,6 +66,8 @@ class ExtractedContentPanel extends javax.swing.JPanel {
|
|||||||
* http://java-sl.com/tip_html_letter_wrap.html.
|
* http://java-sl.com/tip_html_letter_wrap.html.
|
||||||
*/
|
*/
|
||||||
HTMLEditorKit editorKit = new HTMLEditorKit() {
|
HTMLEditorKit editorKit = new HTMLEditorKit() {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ViewFactory getViewFactory() {
|
public ViewFactory getViewFactory() {
|
||||||
|
|
||||||
@ -96,17 +99,18 @@ class ExtractedContentPanel extends javax.swing.JPanel {
|
|||||||
return new ParagraphView(e) {
|
return new ParagraphView(e) {
|
||||||
@Override
|
@Override
|
||||||
protected SizeRequirements calculateMinorAxisRequirements(int axis, SizeRequirements r) {
|
protected SizeRequirements calculateMinorAxisRequirements(int axis, SizeRequirements r) {
|
||||||
if (r == null) {
|
SizeRequirements requirements = r;
|
||||||
r = new SizeRequirements();
|
if (requirements == null) {
|
||||||
|
requirements = new SizeRequirements();
|
||||||
}
|
}
|
||||||
float pref = layoutPool.getPreferredSpan(axis);
|
float pref = layoutPool.getPreferredSpan(axis);
|
||||||
float min = layoutPool.getMinimumSpan(axis);
|
float min = layoutPool.getMinimumSpan(axis);
|
||||||
// Don't include insets, Box.getXXXSpan will include them.
|
// Don't include insets, Box.getXXXSpan will include them.
|
||||||
r.minimum = (int) min;
|
requirements.minimum = (int) min;
|
||||||
r.preferred = Math.max(r.minimum, (int) pref);
|
requirements.preferred = Math.max(r.minimum, (int) pref);
|
||||||
r.maximum = Integer.MAX_VALUE;
|
requirements.maximum = Integer.MAX_VALUE;
|
||||||
r.alignment = 0.5f;
|
requirements.alignment = 0.5f;
|
||||||
return r;
|
return requirements;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -399,7 +403,7 @@ class ExtractedContentPanel extends javax.swing.JPanel {
|
|||||||
* @param sources A list of IndexedText that have different 'views' of
|
* @param sources A list of IndexedText that have different 'views' of
|
||||||
* the content.
|
* the content.
|
||||||
*/
|
*/
|
||||||
void setSources(String contentName, List<IndexedText> sources) {
|
final void setSources(String contentName, List<IndexedText> sources) {
|
||||||
this.contentName = contentName;
|
this.contentName = contentName;
|
||||||
setPanelText(null, false);
|
setPanelText(null, false);
|
||||||
|
|
||||||
@ -420,16 +424,16 @@ class ExtractedContentPanel extends javax.swing.JPanel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void setPanelText(String text, boolean detectDirection) {
|
private void setPanelText(String text, boolean detectDirection) {
|
||||||
text = StringUtils.defaultString(text);
|
String safeText = StringUtils.defaultString(text);
|
||||||
|
|
||||||
if (detectDirection) {
|
if (detectDirection) {
|
||||||
//detect text direction using first 1024 chars and set it
|
//detect text direction using first 1024 chars and set it
|
||||||
//get first up to 1024 chars, strip <pre> tag and unescape html to get the string on which to detect
|
//get first up to 1024 chars, strip <pre> tag and unescape html to get the string on which to detect
|
||||||
final int len = text.length();
|
final int len = safeText.length();
|
||||||
final int prefixLen = "<pre>".length(); //NON-NLS
|
final int prefixLen = "<pre>".length(); //NON-NLS
|
||||||
if (len > prefixLen) {
|
if (len > prefixLen) {
|
||||||
final int maxOrientChars = Math.min(len, 1024);
|
final int maxOrientChars = Math.min(len, 1024);
|
||||||
final String orientDetectText = EscapeUtil.unEscapeHtml(text.substring(prefixLen, maxOrientChars));
|
final String orientDetectText = EscapeUtil.unEscapeHtml(safeText.substring(prefixLen, maxOrientChars));
|
||||||
ComponentOrientation direction = TextUtil.getTextDirection(orientDetectText);
|
ComponentOrientation direction = TextUtil.getTextDirection(orientDetectText);
|
||||||
//logger.log(Level.INFO, "ORIENTATION LEFT TO RIGHT: " + direction.isLeftToRight());
|
//logger.log(Level.INFO, "ORIENTATION LEFT TO RIGHT: " + direction.isLeftToRight());
|
||||||
extractedTextPane.applyComponentOrientation(direction);
|
extractedTextPane.applyComponentOrientation(direction);
|
||||||
@ -440,7 +444,7 @@ class ExtractedContentPanel extends javax.swing.JPanel {
|
|||||||
extractedTextPane.applyComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
|
extractedTextPane.applyComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
|
||||||
}
|
}
|
||||||
|
|
||||||
extractedTextPane.setText(text);
|
extractedTextPane.setText(safeText);
|
||||||
extractedTextPane.setCaretPosition(0);
|
extractedTextPane.setCaretPosition(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user