1
0
mirror of https://github.com/elisspace/autopsy.git synced 2026-09-06 02:24:30 +00:00

Cleanup, remove obsolete keyword search code.

This commit is contained in:
adam-m
2012-03-09 16:47:35 -05:00
parent 9dc500579a
commit 16ce7c8511
6 changed files with 0 additions and 750 deletions

View File

@@ -1,75 +0,0 @@
/*
* 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.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.sleuthkit.autopsy.casemodule.Case;
import org.sleuthkit.datamodel.File;
import org.sleuthkit.datamodel.FileSystem;
import org.sleuthkit.datamodel.FsContent;
import org.sleuthkit.datamodel.SleuthkitCase;
import org.sleuthkit.datamodel.TskData;
import org.sleuthkit.datamodel.TskData.FileKnown;
/**
* Visitor for getting all the files to try to index from any Content object.
* Currently gets all non-zero files.
* TODO should be moved to utility module (needs resolve cyclic deps)
*/
class GetAllFilesContentVisitor extends GetFilesContentVisitor {
private static final Logger logger = Logger.getLogger(GetAllFilesContentVisitor.class.getName());
@Override
public Collection<FsContent> visit(File file) {
return Collections.singleton((FsContent) file);
}
@Override
public Collection<FsContent> visit(FileSystem fs) {
// Files in the database have a filesystem field, so it's quick to
// get all the matching files for an entire filesystem with a query
SleuthkitCase sc = Case.getCurrentCase().getSleuthkitCase();
String query = "SELECT * FROM tsk_files WHERE fs_obj_id = " + fs.getId()
+ " AND (meta_type = " + TskData.TSK_FS_META_TYPE_ENUM.TSK_FS_META_TYPE_REG.getMetaType()
+ ") AND (known != " + FileKnown.KNOWN.toLong() + ") AND (size > 0)";
try {
ResultSet rs = sc.runQuery(query);
List<FsContent> contents = sc.resultSetToFsContents(rs);
Statement s = rs.getStatement();
rs.close();
if (s != null) {
s.close();
}
return contents;
} catch (SQLException ex) {
logger.log(Level.WARNING, "Couldn't get all files in FileSystem", ex);
return Collections.EMPTY_SET;
}
}
}

View File

@@ -1,105 +0,0 @@
/*
* 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.util.ArrayList;
import java.util.Collection;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.sleuthkit.datamodel.Content;
import org.sleuthkit.datamodel.ContentVisitor;
import org.sleuthkit.datamodel.Directory;
import org.sleuthkit.datamodel.File;
import org.sleuthkit.datamodel.FileSystem;
import org.sleuthkit.datamodel.FsContent;
import org.sleuthkit.datamodel.Image;
import org.sleuthkit.datamodel.TskException;
import org.sleuthkit.datamodel.Volume;
import org.sleuthkit.datamodel.VolumeSystem;
/**
* Abstract visitor for getting all the files from content
* TODO should be moved to utility module (needs resolve cyclic deps)
*/
public abstract class GetFilesContentVisitor implements ContentVisitor<Collection<FsContent>> {
private static final Logger logger = Logger.getLogger(GetFilesContentVisitor.class.getName());
@Override
public abstract Collection<FsContent> visit(File file);
@Override
public abstract Collection<FsContent> visit(FileSystem fs);
@Override
public Collection<FsContent> visit(Directory drctr) {
return getAllFromChildren(drctr);
}
@Override
public Collection<FsContent> visit(Image image) {
return getAllFromChildren(image);
}
@Override
public Collection<FsContent> visit(Volume volume) {
return getAllFromChildren(volume);
}
@Override
public Collection<FsContent> visit(VolumeSystem vs) {
return getAllFromChildren(vs);
}
/**
* Aggregate all the matches from visiting the children Content objects of the
* one passed
* @param parent
* @return
*/
protected Collection<FsContent> getAllFromChildren(Content parent) {
Collection<FsContent> all = new ArrayList<FsContent>();
try {
for (Content child : parent.getChildren()) {
all.addAll(child.accept(this));
}
} catch (TskException ex) {
logger.log(Level.SEVERE, "Error getting Content children", ex);
}
return all;
}
/**
* Get the part of a file name after (not including) the last '.' and
* coerced to lowercase.
* @param fileName
* @return the file extension, or an empty string if there is none
*/
protected static String getExtension(String fileName) {
int lastDot = fileName.lastIndexOf(".");
if (lastDot >= 0) {
return fileName.substring(lastDot + 1, fileName.length()).toLowerCase();
} else {
return "";
}
}
}

View File

@@ -1,101 +0,0 @@
/*
* 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.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.sleuthkit.autopsy.casemodule.Case;
import org.sleuthkit.datamodel.File;
import org.sleuthkit.datamodel.FileSystem;
import org.sleuthkit.datamodel.FsContent;
import org.sleuthkit.datamodel.SleuthkitCase;
import org.sleuthkit.datamodel.TskData.FileKnown;
import org.sleuthkit.datamodel.TskData;
/**
* Visitor for getting all the files to try to index from any Content object.
* Currently gets all the non-zero sized files with a file extensions that match a list of
* document types that Tika/Solr-Cell supports.
*/
class GetIngestableFilesContentVisitor extends GetFilesContentVisitor {
private static final Logger logger = Logger.getLogger(GetIngestableFilesContentVisitor.class.getName());
private static final String[] supportedExtensions = KeywordSearchIngestService.ingestibleExtensions;
// the full predicate of a SQLite statement to match supported extensions
private static final String extensionsLikePredicate;
static {
// build the query fragment for matching file extensions
StringBuilder likes = new StringBuilder("0");
for (String ext : supportedExtensions) {
likes.append(" OR (name LIKE '%.");
likes.append(ext);
likes.append("')");
}
extensionsLikePredicate = likes.toString();
}
@Override
public Collection<FsContent> visit(File file) {
String extension = getExtension(file.getName());
if (Arrays.asList(supportedExtensions).contains(extension)) {
return Collections.singleton((FsContent) file);
} else {
return Collections.EMPTY_LIST;
}
}
@Override
public Collection<FsContent> visit(FileSystem fs) {
// Files in the database have a filesystem field, so it's quick to
// get all the matching files for an entire filesystem with a query
SleuthkitCase sc = Case.getCurrentCase().getSleuthkitCase();
String query = "SELECT * FROM tsk_files WHERE fs_obj_id = " + fs.getId()
+ " AND (" + extensionsLikePredicate + ")"
+ " AND (known != " + FileKnown.KNOWN.toLong() + ")"
+ " AND (meta_type = " + TskData.TSK_FS_META_TYPE_ENUM.TSK_FS_META_TYPE_REG.getMetaType() + ")"
+ " AND (size > 0)";
try {
ResultSet rs = sc.runQuery(query);
List<FsContent> contents = sc.resultSetToFsContents(rs);
final Statement s = rs.getStatement();
rs.close();
if (s != null) {
s.close();
}
return contents;
} catch (SQLException ex) {
logger.log(Level.WARNING, "Couldn't get all files in FileSystem", ex);
return Collections.EMPTY_SET;
}
}
}

View File

@@ -1,307 +0,0 @@
/*
* 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.Component;
import java.awt.Dimension;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ExecutionException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.AbstractAction;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.SwingWorker;
import org.apache.solr.client.solrj.SolrServerException;
import org.openide.util.lookup.ServiceProvider;
import org.sleuthkit.autopsy.casemodule.AddImageAction;
import org.sleuthkit.autopsy.keywordsearch.Ingester.IngesterException;
import org.sleuthkit.datamodel.Content;
import org.sleuthkit.datamodel.FsContent;
import org.sleuthkit.datamodel.Image;
import org.sleuthkit.datamodel.TskException;
/**
* Action adds all supported files from the given Content object and its
* children to the Solr index.
*/
public class IndexContentFilesAction extends AbstractAction {
private static final Logger logger = Logger.getLogger(IndexContentFilesAction.class.getName());
private static final int MAX_STRING_EXTRACT_SIZE = 10 * (1 << 10) * (1 << 10);
private Content c;
private String name;
private Server.Core solrCore;
public enum IngestStatus {
NOT_INGESTED, INGESTED, EXTRACTED_INGESTED, SKIPPED_EXTRACTION,};
//keep track of ingest status for various types of content
//could also be useful for reporting
private Map<Long, IngestStatus> ingestStatus;
private int problemFilesCount;
/**
* New action
* @param c source Content object to get files from
* @param name name to refer to the source by when displaying progress
*/
public IndexContentFilesAction(Content c, String name) {
this(c, name, KeywordSearch.getServer().getCore());
}
IndexContentFilesAction(Content c, String name, Server.Core solrCore) {
super("Index files...");
this.c = c;
this.name = name;
this.solrCore = solrCore;
ingestStatus = new HashMap<Long, IngestStatus>();
}
@Override
public void actionPerformed(ActionEvent e) {
// create the popUp window to display progress
String title = "Indexing files in " + name;
final JFrame frame = new JFrame(title);
final JDialog popUpWindow = new JDialog(frame, title, true); // to make the popUp Window modal
// initialize panel
final IndexProgressPanel panel = new IndexProgressPanel();
final SwingWorker task = new SwingWorker<Integer, String>() {
@Override
protected Integer doInBackground() throws Exception {
Ingester ingester = solrCore.getIngester();
this.publish("Categorizing files to index. ");
GetFilesContentVisitor ingestableV = new GetIngestableFilesContentVisitor();
GetFilesContentVisitor allV = new GetAllFilesContentVisitor();
Collection<FsContent> ingestableFiles = c.accept(ingestableV);
Collection<FsContent> allFiles = c.accept(allV);
//calculate non ingestable Collection (complement of allFiles / ingestableFiles
//TODO implement a facility that selects different categories of FsContent
Collection<FsContent> nonIngestibleFiles = new LinkedHashSet<FsContent>();
for (FsContent fs : allFiles) {
if (! ingestableFiles.contains(fs) ) {
nonIngestibleFiles.add(fs);
}
}
// track number complete or with errors
problemFilesCount = 0;
ingestStatus.clear();
//work on known files first
Collection<FsContent> ingestFailedFiles = processIngestible(ingester, ingestableFiles);
nonIngestibleFiles.addAll(ingestFailedFiles);
//work on unknown files
//TODO should be an option somewhere in GUI (known vs unknown files)
processNonIngestible(ingester, nonIngestibleFiles);
ingester.commit();
//signal a potential change in number of indexed files
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 to check number of indexed files: ", se);
}
return problemFilesCount;
}
private Collection<FsContent> processIngestible(Ingester ingester, Collection<FsContent> fscc) {
Collection<FsContent> ingestFailedCol = new ArrayList<FsContent>();
setProgress(0);
int finishedFiles = 0;
final int totalFilesCount = fscc.size();
for (FsContent f : fscc) {
if (isCancelled()) {
return ingestFailedCol;
}
this.publish("Indexing " + (finishedFiles + 1) + "/" + totalFilesCount + ": " + f.getName());
try {
ingester.ingest(f);
ingestStatus.put(f.getId(), IngestStatus.INGESTED);
} catch (IngesterException ex) {
ingestFailedCol.add(f);
ingestStatus.put(f.getId(), IngestStatus.NOT_INGESTED);
logger.log(Level.INFO, "Ingester failed with file '" + f.getName() + "' (id: " + f.getId() + ").", ex);
}
setProgress(++finishedFiles * 100 / totalFilesCount);
}
return ingestFailedCol;
}
private void processNonIngestible(Ingester ingester, Collection<FsContent> fscc) {
setProgress(0);
int finishedFiles = 0;
final int totalFilesCount = fscc.size();
for (FsContent f : fscc) {
if (isCancelled()) {
return;
}
this.publish("String extracting/Indexing " + (finishedFiles + 1) + "/" + totalFilesCount + ": " + f.getName());
if (f.getSize() < MAX_STRING_EXTRACT_SIZE) {
if (!extractAndIngest(ingester, f)) {
ingestStatus.put(f.getId(), IngestStatus.NOT_INGESTED);
problemFilesCount++;
logger.log(Level.INFO, "Failed to extract strings and ingest, file '" + f.getName() + "' (id: " + f.getId() + ").");
} else {
ingestStatus.put(f.getId(), IngestStatus.EXTRACTED_INGESTED);
}
} else {
ingestStatus.put(f.getId(), IngestStatus.SKIPPED_EXTRACTION);
}
setProgress(++finishedFiles * 100 / totalFilesCount);
}
}
@Override
protected void done() {
int problemFiles = 0;
try {
if (!this.isCancelled()) {
problemFiles = get();
}
} catch (InterruptedException ex) {
// shouldn't be interrupted except by cancel
throw new RuntimeException(ex);
} catch (ExecutionException ex) {
logger.log(Level.SEVERE, "Fatal error during ingest.", ex);
} finally {
popUpWindow.setVisible(false);
popUpWindow.dispose();
// notify user if there were problem files
if (problemFiles > 0) {
displayProblemFilesDialog(problemFiles);
}
}
}
@Override
protected void process(List<String> messages) {
// display the latest message
if (!messages.isEmpty()) {
panel.setStatusText(messages.get(messages.size() - 1));
}
panel.setProgressBar(getProgress());
}
};
panel.addCancelButtonActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
task.cancel(true);
}
});
popUpWindow.add(panel);
popUpWindow.pack();
popUpWindow.setResizable(false);
// set the location of the popUp Window on the center of the screen
Dimension screenDimension = Toolkit.getDefaultToolkit().getScreenSize();
double w = popUpWindow.getSize().getWidth();
double h = popUpWindow.getSize().getHeight();
popUpWindow.setLocation((int) ((screenDimension.getWidth() - w) / 2), (int) ((screenDimension.getHeight() - h) / 2));
popUpWindow.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {
// deal with being Xed out of
if (!task.isDone()) {
task.cancel(true);
}
}
});
task.execute();
// display the window
popUpWindow.setVisible(true);
}
private boolean extractAndIngest(Ingester ingester, FsContent f) {
boolean success = false;
FsContentStringStream fscs = new FsContentStringStream(f, FsContentStringStream.Encoding.ASCII);
try {
fscs.convert();
ingester.ingest(fscs);
success = true;
} catch (TskException tskEx) {
logger.log(Level.INFO, "Problem extracting string from file: '" + f.getName() + "' (id: " + f.getId() + ").", tskEx);
} catch (IngesterException ingEx) {
logger.log(Level.INFO, "Ingester had a problem with extracted strings from file '" + f.getName() + "' (id: " + f.getId() + ").", ingEx);
}
return success;
}
private void displayProblemFilesDialog(int problemFiles) {
final Component parentComponent = null; // Use default window frame.
final String message = "Had trouble indexing " + problemFiles + " of the files. See the log for details.";
final String title = "Problem indexing some files";
final int messageType = JOptionPane.WARNING_MESSAGE;
JOptionPane.showMessageDialog(
parentComponent,
message,
title,
messageType);
}
@ServiceProvider(service = AddImageAction.IndexImageTask.class)
public static class IndexImageTask implements AddImageAction.IndexImageTask {
@Override
public void runTask(Image newImage) {
(new IndexContentFilesAction(newImage, "new image")).actionPerformed(null);
}
}
}

View File

@@ -1,62 +0,0 @@
<?xml version="1.1" encoding="UTF-8" ?>
<Form version="1.5" 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="false"/>
<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">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="statusText" min="-2" max="-2" attributes="0"/>
<Component id="progressBar" alignment="0" pref="420" max="32767" attributes="0"/>
<Component id="cancelButton" alignment="1" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="statusText" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="progressBar" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="cancelButton" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JProgressBar" name="progressBar">
</Component>
<Component class="javax.swing.JLabel" name="statusText">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/keywordsearch/Bundle.properties" key="IndexProgressPanel.statusText.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JButton" name="cancelButton">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/keywordsearch/Bundle.properties" key="IndexProgressPanel.cancelButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
</SubComponents>
</Form>

View File

@@ -1,100 +0,0 @@
/*
* 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;
/**
* Displays progress as files are indexed
*/
class IndexProgressPanel extends javax.swing.JPanel {
/** Creates new form IndexProgressPanel */
IndexProgressPanel() {
initComponents();
progressBar.setMinimum(0);
progressBar.setMaximum(100);
progressBar.setIndeterminate(true);
statusText.setText("Starting...");
}
/** 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.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
progressBar = new javax.swing.JProgressBar();
statusText = new javax.swing.JLabel();
cancelButton = new javax.swing.JButton();
statusText.setText(org.openide.util.NbBundle.getMessage(IndexProgressPanel.class, "IndexProgressPanel.statusText.text")); // NOI18N
cancelButton.setText(org.openide.util.NbBundle.getMessage(IndexProgressPanel.class, "IndexProgressPanel.cancelButton.text")); // NOI18N
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(statusText)
.addComponent(progressBar, javax.swing.GroupLayout.DEFAULT_SIZE, 420, Short.MAX_VALUE)
.addComponent(cancelButton, javax.swing.GroupLayout.Alignment.TRAILING))
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(statusText)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(progressBar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(cancelButton)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
}// </editor-fold>//GEN-END:initComponents
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton cancelButton;
private javax.swing.JProgressBar progressBar;
private javax.swing.JLabel statusText;
// End of variables declaration//GEN-END:variables
/**
* Sets a listener for the Cancel button
* @param e The action listener
*/
void addCancelButtonActionListener(ActionListener e) {
this.cancelButton.addActionListener(e);
}
void setProgressBar(int percent) {
progressBar.setIndeterminate(false);
progressBar.setValue(percent);
}
void setStatusText(String text) {
statusText.setText(text);
}
}