Moved some code to guiutils package for code reuse

This commit is contained in:
Eugene Livis 2018-11-06 15:27:08 -05:00
parent baeb53bf0c
commit 798f3dd75a
9 changed files with 11 additions and 88 deletions

View File

@ -58,7 +58,7 @@
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0"> <Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0"> <Group type="102" alignment="1" attributes="0">
<Component id="errorText" pref="300" max="32767" attributes="0"/> <Component id="errorText" max="32767" attributes="0"/>
<EmptySpace min="-2" pref="65" max="-2" attributes="0"/> <EmptySpace min="-2" pref="65" max="-2" attributes="0"/>
<Component id="searchButton" min="-2" max="-2" attributes="0"/> <Component id="searchButton" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
@ -77,7 +77,7 @@
<Group type="102" attributes="0"> <Group type="102" attributes="0">
<Group type="103" groupAlignment="0" attributes="0"> <Group type="103" groupAlignment="0" attributes="0">
<Group type="103" groupAlignment="1" max="-2" attributes="0"> <Group type="103" groupAlignment="1" max="-2" attributes="0">
<Component id="commonItemSearchDescription" alignment="0" max="32767" attributes="0"/> <Component id="commonItemSearchDescription" alignment="0" pref="403" max="32767" attributes="0"/>
<Group type="102" alignment="0" attributes="0"> <Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="20" max="-2" attributes="0"/> <EmptySpace min="-2" pref="20" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" max="-2" attributes="0"> <Group type="103" groupAlignment="0" max="-2" attributes="0">

View File

@ -18,6 +18,8 @@
*/ */
package org.sleuthkit.autopsy.commonfilesearch; package org.sleuthkit.autopsy.commonfilesearch;
import org.sleuthkit.autopsy.guiutils.DataSourceComboBoxModel;
import org.sleuthkit.autopsy.guiutils.DataSourceLoader;
import java.awt.Dimension; import java.awt.Dimension;
import java.sql.SQLException; import java.sql.SQLException;
import java.util.ArrayList; import java.util.ArrayList;

View File

@ -19,6 +19,7 @@
*/ */
package org.sleuthkit.autopsy.commonfilesearch; package org.sleuthkit.autopsy.commonfilesearch;
import org.sleuthkit.autopsy.guiutils.DataSourceComboBoxModel;
import java.util.Collections; import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;

View File

@ -19,6 +19,7 @@
*/ */
package org.sleuthkit.autopsy.commonfilesearch; package org.sleuthkit.autopsy.commonfilesearch;
import org.sleuthkit.autopsy.guiutils.DataSourceComboBoxModel;
import java.util.Collections; import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;

View File

@ -17,7 +17,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.sleuthkit.autopsy.commonfilesearch; package org.sleuthkit.autopsy.guiutils;
import javax.swing.AbstractListModel; import javax.swing.AbstractListModel;
import javax.swing.ComboBoxModel; import javax.swing.ComboBoxModel;
@ -44,7 +44,7 @@ public class DataSourceComboBoxModel extends AbstractListModel<String> implement
* *
* @param theDataSoureList names of data sources for user to pick from * @param theDataSoureList names of data sources for user to pick from
*/ */
DataSourceComboBoxModel(String... theDataSoureList) { public DataSourceComboBoxModel(String... theDataSoureList) {
dataSourceList = theDataSoureList.clone(); dataSourceList = theDataSoureList.clone();
} }

View File

@ -17,7 +17,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.sleuthkit.autopsy.commonfilesearch; package org.sleuthkit.autopsy.guiutils;
import java.io.File; import java.io.File;
import java.sql.ResultSet; import java.sql.ResultSet;

View File

@ -1,2 +0,0 @@
ReportCaseUcoConfigPanel.jLabelSelectDataSource.text=STIX\u30d5\u30a1\u30a4\u30eb\u307e\u305f\u306fSTIX\u30d5\u30a1\u30a4\u30eb\u306e\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3092\u9078\u629e

View File

@ -1,80 +0,0 @@
/*
*
* Autopsy Forensic Browser
*
* Copyright 2018 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.modules.case_uco;
import javax.swing.AbstractListModel;
import javax.swing.ComboBoxModel;
import javax.swing.event.ListDataListener;
/**
* Encapsulates meta data needed to populate the data source selection drop down menu
*/
class DataSourceComboBoxModel extends AbstractListModel<String> implements ComboBoxModel<String> {
private static final long serialVersionUID = 1L;
private final String[] dataSourceList;
private String selection = null;
/**
* Use this to initialize the panel
*/
DataSourceComboBoxModel() {
this.dataSourceList = new String[0];
}
/**
* Use this when we have data to display.
*
* @param theDataSoureList names of data sources for user to pick from
*/
DataSourceComboBoxModel(String... theDataSoureList) {
dataSourceList = theDataSoureList.clone();
}
@Override
public void setSelectedItem(Object anItem) {
selection = (String) anItem;
}
@Override
public Object getSelectedItem() {
return selection;
}
@Override
public int getSize() {
return dataSourceList.length;
}
@Override
public String getElementAt(int index) {
return dataSourceList[index];
}
@Override
public void addListDataListener(ListDataListener listener) {
this.listenerList.add(ListDataListener.class, listener);
}
@Override
public void removeListDataListener(ListDataListener listener) {
this.listenerList.remove(ListDataListener.class, listener);
}
}

View File

@ -26,7 +26,8 @@ import java.util.Map.Entry;
import javax.swing.ComboBoxModel; import javax.swing.ComboBoxModel;
import org.openide.util.Exceptions; import org.openide.util.Exceptions;
import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException; import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException;
import org.sleuthkit.autopsy.commonfilesearch.DataSourceLoader; import org.sleuthkit.autopsy.guiutils.DataSourceLoader;
import org.sleuthkit.autopsy.guiutils.DataSourceComboBoxModel;
import org.sleuthkit.datamodel.TskCoreException; import org.sleuthkit.datamodel.TskCoreException;
/** /**