mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-06 21:00:22 +00:00
move explorer components to tab, create a new TC that manages and delegates to the tab TCs
This commit is contained in:
parent
423b614a2b
commit
777ed02452
@ -4,4 +4,5 @@ OpenIDE-Module-Implementation-Version: 1
|
||||
OpenIDE-Module-Install: org/sleuthkit/autopsy/keywordsearch/Installer.class
|
||||
OpenIDE-Module-Layer: org/sleuthkit/autopsy/keywordsearch/layer.xml
|
||||
OpenIDE-Module-Localizing-Bundle: org/sleuthkit/autopsy/keywordsearch/Bundle.properties
|
||||
OpenIDE-Module-Requires: org.openide.windows.WindowManager
|
||||
|
||||
|
@ -1,10 +1,9 @@
|
||||
CTL_KeywordSearchTabsTopComponentAction=Keyword Search
|
||||
CTL_KeywordSearchTabsTopComponentTopComponent=Keyword Search
|
||||
HINT_KeywordSearchTabsTopComponentTopComponent=This is a Keyword Search window
|
||||
OpenIDE-Module-Name=KeywordSearch
|
||||
IndexProgressPanel.statusText.text=Status text
|
||||
IndexProgressPanel.cancelButton.text=Cancel
|
||||
KeywordSearchTopComponent.searchButton.text=Search
|
||||
KeywordSearchTopComponent.queryLabel.text=Query:
|
||||
KeywordSearchTopComponent.filesIndexedNameLabel.text=Files indexed:
|
||||
KeywordSearchTopComponent.filesIndexedValLabel.text=-
|
||||
KeywordSearchTopComponent.filesIndexedNameLabel.AccessibleContext.accessibleName=Files indexed:
|
||||
KeywordSearchTopComponent.filesIndexedValLabel.AccessibleContext.accessibleName=-
|
||||
ExtractedContentPanel.hitLabel.text=Match:
|
||||
@ -14,5 +13,9 @@ ExtractedContentPanel.hitTotalLabel.text=-
|
||||
ExtractedContentPanel.hitButtonsLabel.text=Match
|
||||
ExtractedContentPanel.hitPreviousButton.text=
|
||||
ExtractedContentPanel.hitNextButton.text=
|
||||
KeywordSearchTopComponent.luceneQRadioButton.text=Lucene
|
||||
KeywordSearchTopComponent.regexQRadioButton.text=RegEx
|
||||
KeywordSearchSimpleTopComponent.filesIndexedValLabel.text=-
|
||||
KeywordSearchSimpleTopComponent.filesIndexedNameLabel.text=Files indexed:
|
||||
KeywordSearchSimpleTopComponent.queryLabel.text=Query:
|
||||
KeywordSearchSimpleTopComponent.searchButton.text=Search
|
||||
KeywordSearchSimpleTopComponent.regexQRadioButton.text=RegEx
|
||||
KeywordSearchSimpleTopComponent.luceneQRadioButton.text=Lucene
|
||||
|
@ -36,13 +36,13 @@ import org.sleuthkit.autopsy.keywordsearch.KeywordSearch.QueryType;
|
||||
public class KeywordSearchDataExplorer implements DataExplorer {
|
||||
|
||||
private static KeywordSearchDataExplorer theInstance;
|
||||
private KeywordSearchTopComponent tc;
|
||||
private KeywordSearchTabsTopComponent tc;
|
||||
|
||||
public KeywordSearchDataExplorer() {
|
||||
this.setTheInstance();
|
||||
this.tc = new KeywordSearchTopComponent();
|
||||
this.tc.addSearchButtonListener(new ActionListener() {
|
||||
this.tc = new KeywordSearchTabsTopComponent();
|
||||
|
||||
this.tc.addSearchButtonListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
tc.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
|
||||
@ -62,6 +62,8 @@ public class KeywordSearchDataExplorer implements DataExplorer {
|
||||
|
||||
KeywordSearch.changeSupport.addPropertyChangeListener(KeywordSearch.NUM_FILES_CHANGE_EVT, new IndexChangeListener());
|
||||
}
|
||||
|
||||
|
||||
|
||||
private synchronized void setTheInstance() {
|
||||
if (theInstance == null) {
|
||||
|
@ -84,21 +84,21 @@
|
||||
<Component class="javax.swing.JButton" name="searchButton">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="org/sleuthkit/autopsy/keywordsearch/Bundle.properties" key="KeywordSearchTopComponent.searchButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
<ResourceString bundle="org/sleuthkit/autopsy/keywordsearch/Bundle.properties" key="KeywordSearchSimpleTopComponent.searchButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="queryLabel">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="org/sleuthkit/autopsy/keywordsearch/Bundle.properties" key="KeywordSearchTopComponent.queryLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
<ResourceString bundle="org/sleuthkit/autopsy/keywordsearch/Bundle.properties" key="KeywordSearchSimpleTopComponent.queryLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="filesIndexedNameLabel">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="org/sleuthkit/autopsy/keywordsearch/Bundle.properties" key="KeywordSearchTopComponent.filesIndexedNameLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
<ResourceString bundle="org/sleuthkit/autopsy/keywordsearch/Bundle.properties" key="KeywordSearchSimpleTopComponent.filesIndexedNameLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<AccessibilityProperties>
|
||||
@ -110,7 +110,7 @@
|
||||
<Component class="javax.swing.JLabel" name="filesIndexedValLabel">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="org/sleuthkit/autopsy/keywordsearch/Bundle.properties" key="KeywordSearchTopComponent.filesIndexedValLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
<ResourceString bundle="org/sleuthkit/autopsy/keywordsearch/Bundle.properties" key="KeywordSearchSimpleTopComponent.filesIndexedValLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<AccessibilityProperties>
|
||||
@ -123,14 +123,14 @@
|
||||
<Properties>
|
||||
<Property name="selected" type="boolean" value="true"/>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="org/sleuthkit/autopsy/keywordsearch/Bundle.properties" key="KeywordSearchTopComponent.luceneQRadioButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
<ResourceString bundle="org/sleuthkit/autopsy/keywordsearch/Bundle.properties" key="KeywordSearchSimpleTopComponent.luceneQRadioButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JRadioButton" name="regexQRadioButton">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="org/sleuthkit/autopsy/keywordsearch/Bundle.properties" key="KeywordSearchTopComponent.regexQRadioButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
<ResourceString bundle="org/sleuthkit/autopsy/keywordsearch/Bundle.properties" key="KeywordSearchSimpleTopComponent.regexQRadioButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
@ -19,31 +19,22 @@
|
||||
package org.sleuthkit.autopsy.keywordsearch;
|
||||
|
||||
import java.awt.event.ActionListener;
|
||||
import java.beans.PropertyChangeEvent;
|
||||
import java.beans.PropertyChangeListener;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import org.apache.solr.client.solrj.SolrServerException;
|
||||
import org.openide.windows.TopComponent;
|
||||
|
||||
public class KeywordSearchTopComponent extends TopComponent {
|
||||
public class KeywordSearchSimpleTopComponent extends TopComponent implements KeywordSearchTopComponentInterface {
|
||||
|
||||
private Logger logger = Logger.getLogger(KeywordSearchTopComponent.class.getName());
|
||||
private PropertyChangeListener serverChangeListener;
|
||||
private Logger logger = Logger.getLogger(KeywordSearchSimpleTopComponent.class.getName());
|
||||
|
||||
/** Creates new form KeywordSearchTopComponent */
|
||||
public KeywordSearchTopComponent() {
|
||||
/** Creates new form KeywordSearchSimpleTopComponent */
|
||||
public KeywordSearchSimpleTopComponent() {
|
||||
initComponents();
|
||||
setName("Keyword Search");
|
||||
setName("Simple");
|
||||
buttonGroup1.add(luceneQRadioButton);
|
||||
buttonGroup1.add(regexQRadioButton);
|
||||
searchButton.setEnabled(false);
|
||||
|
||||
putClientProperty(TopComponent.PROP_CLOSING_DISABLED, Boolean.TRUE);
|
||||
|
||||
//register with server Actions
|
||||
serverChangeListener = new KeywordSearchServerListener();
|
||||
KeywordSearch.getServer().addServerActionListener(serverChangeListener);
|
||||
}
|
||||
|
||||
/** This method is called from within the constructor to
|
||||
@ -69,18 +60,18 @@ public class KeywordSearchTopComponent extends TopComponent {
|
||||
queryTextArea.setRows(5);
|
||||
jScrollPane1.setViewportView(queryTextArea);
|
||||
|
||||
searchButton.setText(org.openide.util.NbBundle.getMessage(KeywordSearchTopComponent.class, "KeywordSearchTopComponent.searchButton.text")); // NOI18N
|
||||
searchButton.setText(org.openide.util.NbBundle.getMessage(KeywordSearchSimpleTopComponent.class, "KeywordSearchSimpleTopComponent.searchButton.text")); // NOI18N
|
||||
|
||||
queryLabel.setText(org.openide.util.NbBundle.getMessage(KeywordSearchTopComponent.class, "KeywordSearchTopComponent.queryLabel.text")); // NOI18N
|
||||
queryLabel.setText(org.openide.util.NbBundle.getMessage(KeywordSearchSimpleTopComponent.class, "KeywordSearchSimpleTopComponent.queryLabel.text")); // NOI18N
|
||||
|
||||
filesIndexedNameLabel.setText(org.openide.util.NbBundle.getMessage(KeywordSearchTopComponent.class, "KeywordSearchTopComponent.filesIndexedNameLabel.text")); // NOI18N
|
||||
filesIndexedNameLabel.setText(org.openide.util.NbBundle.getMessage(KeywordSearchSimpleTopComponent.class, "KeywordSearchSimpleTopComponent.filesIndexedNameLabel.text")); // NOI18N
|
||||
|
||||
filesIndexedValLabel.setText(org.openide.util.NbBundle.getMessage(KeywordSearchTopComponent.class, "KeywordSearchTopComponent.filesIndexedValLabel.text")); // NOI18N
|
||||
filesIndexedValLabel.setText(org.openide.util.NbBundle.getMessage(KeywordSearchSimpleTopComponent.class, "KeywordSearchSimpleTopComponent.filesIndexedValLabel.text")); // NOI18N
|
||||
|
||||
luceneQRadioButton.setSelected(true);
|
||||
luceneQRadioButton.setText(org.openide.util.NbBundle.getMessage(KeywordSearchTopComponent.class, "KeywordSearchTopComponent.luceneQRadioButton.text")); // NOI18N
|
||||
luceneQRadioButton.setText(org.openide.util.NbBundle.getMessage(KeywordSearchSimpleTopComponent.class, "KeywordSearchSimpleTopComponent.luceneQRadioButton.text")); // NOI18N
|
||||
|
||||
regexQRadioButton.setText(org.openide.util.NbBundle.getMessage(KeywordSearchTopComponent.class, "KeywordSearchTopComponent.regexQRadioButton.text")); // NOI18N
|
||||
regexQRadioButton.setText(org.openide.util.NbBundle.getMessage(KeywordSearchSimpleTopComponent.class, "KeywordSearchSimpleTopComponent.regexQRadioButton.text")); // NOI18N
|
||||
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
||||
this.setLayout(layout);
|
||||
@ -122,8 +113,8 @@ public class KeywordSearchTopComponent extends TopComponent {
|
||||
.addContainerGap(106, Short.MAX_VALUE))
|
||||
);
|
||||
|
||||
filesIndexedNameLabel.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(KeywordSearchTopComponent.class, "KeywordSearchTopComponent.filesIndexedNameLabel.AccessibleContext.accessibleName")); // NOI18N
|
||||
filesIndexedValLabel.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(KeywordSearchTopComponent.class, "KeywordSearchTopComponent.filesIndexedValLabel.AccessibleContext.accessibleName")); // NOI18N
|
||||
filesIndexedNameLabel.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(KeywordSearchSimpleTopComponent.class, "KeywordSearchTopComponent.filesIndexedNameLabel.AccessibleContext.accessibleName")); // NOI18N
|
||||
filesIndexedValLabel.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(KeywordSearchSimpleTopComponent.class, "KeywordSearchTopComponent.filesIndexedValLabel.AccessibleContext.accessibleName")); // NOI18N
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.ButtonGroup buttonGroup1;
|
||||
@ -143,18 +134,23 @@ public class KeywordSearchTopComponent extends TopComponent {
|
||||
// clear old search
|
||||
queryTextArea.setText("");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addSearchButtonListener(ActionListener l) {
|
||||
searchButton.addActionListener(l);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getQueryText() {
|
||||
return queryTextArea.getText();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isLuceneQuerySelected() {
|
||||
return luceneQRadioButton.isSelected();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRegexQuerySelected() {
|
||||
return regexQRadioButton.isSelected();
|
||||
}
|
||||
@ -170,6 +166,7 @@ public class KeywordSearchTopComponent extends TopComponent {
|
||||
return TopComponent.PERSISTENCE_NEVER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFilesIndexed(int filesIndexed) {
|
||||
filesIndexedValLabel.setText(Integer.toString(filesIndexed));
|
||||
if (filesIndexed == 0) {
|
||||
@ -179,29 +176,4 @@ public class KeywordSearchTopComponent extends TopComponent {
|
||||
}
|
||||
}
|
||||
|
||||
class KeywordSearchServerListener implements PropertyChangeListener {
|
||||
|
||||
@Override
|
||||
public void propertyChange(PropertyChangeEvent evt) {
|
||||
String eventType = evt.getPropertyName();
|
||||
|
||||
if (eventType.equals(Server.CORE_EVT)) {
|
||||
final Server.CORE_EVT_STATES state = (Server.CORE_EVT_STATES) evt.getNewValue();
|
||||
switch (state) {
|
||||
case STARTED:
|
||||
try {
|
||||
final int numIndexedFiles = KeywordSearch.getServer().getCore().queryNumIndexedFiles();
|
||||
KeywordSearch.changeSupport.firePropertyChange(KeywordSearch.NUM_FILES_CHANGE_EVT, null, new Integer(numIndexedFiles));
|
||||
} catch (SolrServerException se) {
|
||||
logger.log(Level.SEVERE, "Error executing Solr query, " + se.getMessage());
|
||||
}
|
||||
break;
|
||||
case STOPPED:
|
||||
break;
|
||||
default:
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
<?xml version="1.1" encoding="UTF-8" ?>
|
||||
|
||||
<Form version="1.3" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
|
||||
<AuxValues>
|
||||
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/>
|
||||
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
|
||||
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
|
||||
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="true"/>
|
||||
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
|
||||
<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"/>
|
||||
</AuxValues>
|
||||
|
||||
<Layout>
|
||||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="tabs" alignment="0" pref="400" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
<DimensionLayout dim="1">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="tabs" alignment="0" pref="300" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Container class="javax.swing.JTabbedPane" name="tabs">
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout"/>
|
||||
</Container>
|
||||
</SubComponents>
|
||||
</Form>
|
@ -0,0 +1,186 @@
|
||||
/*
|
||||
* Autopsy Forensic Browser
|
||||
*
|
||||
* Copyright 2011 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.event.ActionListener;
|
||||
import java.beans.PropertyChangeEvent;
|
||||
import java.beans.PropertyChangeListener;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import org.apache.solr.client.solrj.SolrServerException;
|
||||
import org.openide.util.NbBundle;
|
||||
import org.openide.windows.TopComponent;
|
||||
import org.netbeans.api.settings.ConvertAsProperties;
|
||||
import org.openide.awt.ActionID;
|
||||
import org.openide.awt.ActionReference;
|
||||
|
||||
/**
|
||||
* Keyword Search explorer top component, container for specific Keyword Search tabs
|
||||
*/
|
||||
@ConvertAsProperties(dtd = "-//org.sleuthkit.autopsy.keywordsearch//KeywordSearchTabsTopComponent//EN",
|
||||
autostore = false)
|
||||
@TopComponent.Description(preferredID = "KeywordSearchTabsTopComponent",
|
||||
//iconBase="SET/PATH/TO/ICON/HERE",
|
||||
persistenceType = TopComponent.PERSISTENCE_NEVER)
|
||||
@TopComponent.Registration(mode = "explorer", openAtStartup = false)
|
||||
@ActionID(category = "Window", id = "org.sleuthkit.autopsy.keywordsearch.KeywordSearchTabsTopComponentTopComponent")
|
||||
@ActionReference(path = "Menu/Window" /*, position = 333 */)
|
||||
@TopComponent.OpenActionRegistration(displayName = "#CTL_KeywordSearchTabsTopComponentAction",
|
||||
preferredID = "KeywordSearchTabsTopComponent")
|
||||
public final class KeywordSearchTabsTopComponent extends TopComponent implements KeywordSearchTopComponentInterface {
|
||||
|
||||
private Logger logger = Logger.getLogger(KeywordSearchTabsTopComponent.class.getName());
|
||||
private PropertyChangeListener serverChangeListener;
|
||||
|
||||
public KeywordSearchTabsTopComponent() {
|
||||
initComponents();
|
||||
initTabs();
|
||||
setName(NbBundle.getMessage(KeywordSearchTabsTopComponent.class, "CTL_KeywordSearchTabsTopComponentTopComponent"));
|
||||
setToolTipText(NbBundle.getMessage(KeywordSearchTabsTopComponent.class, "HINT_KeywordSearchTabsTopComponentTopComponent"));
|
||||
|
||||
|
||||
putClientProperty(TopComponent.PROP_CLOSING_DISABLED, Boolean.TRUE);
|
||||
|
||||
//register with server Actions
|
||||
serverChangeListener = new KeywordSearchServerListener();
|
||||
KeywordSearch.getServer().addServerActionListener(serverChangeListener);
|
||||
}
|
||||
|
||||
/** This method is called from within the constructor to
|
||||
* initialize the form.
|
||||
* WARNING: Do NOT modify this code. The content of this method is
|
||||
* always regenerated by the Form Editor.
|
||||
*/
|
||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||
private void initComponents() {
|
||||
|
||||
tabs = new javax.swing.JTabbedPane();
|
||||
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
||||
this.setLayout(layout);
|
||||
layout.setHorizontalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(tabs, javax.swing.GroupLayout.DEFAULT_SIZE, 400, Short.MAX_VALUE)
|
||||
);
|
||||
layout.setVerticalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(tabs, javax.swing.GroupLayout.DEFAULT_SIZE, 300, Short.MAX_VALUE)
|
||||
);
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JTabbedPane tabs;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
|
||||
private void initTabs() {
|
||||
tabs.addTab("Simple", null, new KeywordSearchSimpleTopComponent(), "Single keyword or regex search");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void componentOpened() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void componentClosed() {
|
||||
|
||||
}
|
||||
|
||||
void writeProperties(java.util.Properties p) {
|
||||
// better to version settings since initial version as advocated at
|
||||
// http://wiki.apidesign.org/wiki/PropertyFiles
|
||||
p.setProperty("version", "1.0");
|
||||
// store your settings
|
||||
}
|
||||
|
||||
void readProperties(java.util.Properties p) {
|
||||
String version = p.getProperty("version");
|
||||
// read your settings according to their version
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addSearchButtonListener(ActionListener l) {
|
||||
final int tabsCount = tabs.getTabCount();
|
||||
for (int i = 0; i < tabsCount; ++i) {
|
||||
KeywordSearchTopComponentInterface ks = (KeywordSearchTopComponentInterface) tabs.getComponentAt(i);
|
||||
ks.addSearchButtonListener(l);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getQueryText() {
|
||||
KeywordSearchTopComponentInterface selected = (KeywordSearchTopComponentInterface) tabs.getSelectedComponent();
|
||||
if (selected == null) {
|
||||
return "";
|
||||
}
|
||||
return selected.getQueryText();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isLuceneQuerySelected() {
|
||||
KeywordSearchTopComponentInterface selected = (KeywordSearchTopComponentInterface) tabs.getSelectedComponent();
|
||||
if (selected == null) {
|
||||
return false;
|
||||
}
|
||||
return selected.isLuceneQuerySelected();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRegexQuerySelected() {
|
||||
KeywordSearchTopComponentInterface selected = (KeywordSearchTopComponentInterface) tabs.getSelectedComponent();
|
||||
if (selected == null) {
|
||||
return false;
|
||||
}
|
||||
return selected.isRegexQuerySelected();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFilesIndexed(int filesIndexed) {
|
||||
final int tabsCount = tabs.getTabCount();
|
||||
for (int i = 0; i < tabsCount; ++i) {
|
||||
KeywordSearchTopComponentInterface ks = (KeywordSearchTopComponentInterface) tabs.getComponentAt(i);
|
||||
ks.setFilesIndexed(filesIndexed);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class KeywordSearchServerListener implements PropertyChangeListener {
|
||||
@Override
|
||||
public void propertyChange(PropertyChangeEvent evt) {
|
||||
String eventType = evt.getPropertyName();
|
||||
|
||||
if (eventType.equals(Server.CORE_EVT)) {
|
||||
final Server.CORE_EVT_STATES state = (Server.CORE_EVT_STATES) evt.getNewValue();
|
||||
switch (state) {
|
||||
case STARTED:
|
||||
try {
|
||||
final int numIndexedFiles = KeywordSearch.getServer().getCore().queryNumIndexedFiles();
|
||||
KeywordSearch.changeSupport.firePropertyChange(KeywordSearch.NUM_FILES_CHANGE_EVT, null, new Integer(numIndexedFiles));
|
||||
//setFilesIndexed(numIndexedFiles);
|
||||
} catch (SolrServerException se) {
|
||||
logger.log(Level.SEVERE, "Error executing Solr query, " + se.getMessage());
|
||||
}
|
||||
break;
|
||||
case STOPPED:
|
||||
break;
|
||||
default:
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Autopsy Forensic Browser
|
||||
*
|
||||
* Copyright 2011 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.event.ActionListener;
|
||||
|
||||
|
||||
/**
|
||||
* common methods for the KeywordSearch TCs / tabs
|
||||
*
|
||||
*/
|
||||
public interface KeywordSearchTopComponentInterface {
|
||||
|
||||
boolean isLuceneQuerySelected();
|
||||
boolean isRegexQuerySelected();
|
||||
String getQueryText();
|
||||
void setFilesIndexed(int filesIndexed);
|
||||
void addSearchButtonListener(ActionListener l);
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user