mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-15 09:17:42 +00:00
Only allow one report to be generated at a time.
This commit is contained in:
parent
4893fb3356
commit
1f153727db
@ -24,10 +24,10 @@
|
|||||||
<Group type="102" attributes="0">
|
<Group type="102" attributes="0">
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
<Component id="reportModulesLabel" alignment="0" min="-2" max="-2" attributes="0"/>
|
<Component id="reportModulesLabel" min="-2" max="-2" attributes="0"/>
|
||||||
<Component id="modulesScrollPane" alignment="0" min="-2" pref="186" max="-2" attributes="0"/>
|
<Component id="modulesScrollPane" min="-2" pref="190" max="-2" attributes="0"/>
|
||||||
</Group>
|
</Group>
|
||||||
<EmptySpace min="-2" pref="10" max="-2" attributes="0"/>
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
<Component id="configurationPanel" max="32767" attributes="0"/>
|
<Component id="configurationPanel" max="32767" attributes="0"/>
|
||||||
<Component id="descriptionScrollPane" max="32767" attributes="0"/>
|
<Component id="descriptionScrollPane" max="32767" attributes="0"/>
|
||||||
@ -43,12 +43,12 @@
|
|||||||
<Component id="reportModulesLabel" min="-2" max="-2" attributes="0"/>
|
<Component id="reportModulesLabel" min="-2" max="-2" attributes="0"/>
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
<Component id="modulesScrollPane" pref="208" max="32767" attributes="0"/>
|
|
||||||
<Group type="102" attributes="0">
|
<Group type="102" attributes="0">
|
||||||
<Component id="configurationPanel" max="32767" attributes="0"/>
|
<Component id="configurationPanel" max="32767" attributes="0"/>
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
<Component id="descriptionScrollPane" min="-2" pref="32" max="-2" attributes="0"/>
|
<Component id="descriptionScrollPane" min="-2" pref="32" max="-2" attributes="0"/>
|
||||||
</Group>
|
</Group>
|
||||||
|
<Component id="modulesScrollPane" max="32767" attributes="0"/>
|
||||||
</Group>
|
</Group>
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
</Group>
|
</Group>
|
||||||
@ -56,30 +56,6 @@
|
|||||||
</DimensionLayout>
|
</DimensionLayout>
|
||||||
</Layout>
|
</Layout>
|
||||||
<SubComponents>
|
<SubComponents>
|
||||||
<Container class="javax.swing.JScrollPane" name="modulesScrollPane">
|
|
||||||
<AuxValues>
|
|
||||||
<AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
|
|
||||||
</AuxValues>
|
|
||||||
|
|
||||||
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
|
|
||||||
<SubComponents>
|
|
||||||
<Component class="javax.swing.JTable" name="modulesTable">
|
|
||||||
<Properties>
|
|
||||||
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
|
|
||||||
<Color blue="f0" green="f0" red="f0" type="rgb"/>
|
|
||||||
</Property>
|
|
||||||
<Property name="model" type="javax.swing.table.TableModel" editor="org.netbeans.modules.form.editors2.TableModelEditor">
|
|
||||||
<Table columnCount="0" rowCount="0"/>
|
|
||||||
</Property>
|
|
||||||
<Property name="showHorizontalLines" type="boolean" value="false"/>
|
|
||||||
<Property name="showVerticalLines" type="boolean" value="false"/>
|
|
||||||
<Property name="tableHeader" type="javax.swing.table.JTableHeader" editor="org.netbeans.modules.form.editors2.JTableHeaderEditor">
|
|
||||||
<TableHeader reorderingAllowed="true" resizingAllowed="true"/>
|
|
||||||
</Property>
|
|
||||||
</Properties>
|
|
||||||
</Component>
|
|
||||||
</SubComponents>
|
|
||||||
</Container>
|
|
||||||
<Component class="javax.swing.JLabel" name="reportModulesLabel">
|
<Component class="javax.swing.JLabel" name="reportModulesLabel">
|
||||||
<Properties>
|
<Properties>
|
||||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||||
@ -101,12 +77,12 @@
|
|||||||
<Layout>
|
<Layout>
|
||||||
<DimensionLayout dim="0">
|
<DimensionLayout dim="0">
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
<EmptySpace min="0" pref="440" max="32767" attributes="0"/>
|
<EmptySpace min="0" pref="432" max="32767" attributes="0"/>
|
||||||
</Group>
|
</Group>
|
||||||
</DimensionLayout>
|
</DimensionLayout>
|
||||||
<DimensionLayout dim="1">
|
<DimensionLayout dim="1">
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
<EmptySpace min="0" pref="176" max="32767" attributes="0"/>
|
<EmptySpace min="0" pref="168" max="32767" attributes="0"/>
|
||||||
</Group>
|
</Group>
|
||||||
</DimensionLayout>
|
</DimensionLayout>
|
||||||
</Layout>
|
</Layout>
|
||||||
@ -135,5 +111,30 @@
|
|||||||
</Component>
|
</Component>
|
||||||
</SubComponents>
|
</SubComponents>
|
||||||
</Container>
|
</Container>
|
||||||
|
<Container class="javax.swing.JScrollPane" name="modulesScrollPane">
|
||||||
|
<AuxValues>
|
||||||
|
<AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
|
||||||
|
</AuxValues>
|
||||||
|
|
||||||
|
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
|
||||||
|
<SubComponents>
|
||||||
|
<Component class="javax.swing.JList" name="modulesJList">
|
||||||
|
<Properties>
|
||||||
|
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
|
||||||
|
<Color blue="f0" green="f0" red="f0" type="rgb"/>
|
||||||
|
</Property>
|
||||||
|
<Property name="model" type="javax.swing.ListModel" editor="org.netbeans.modules.form.editors2.ListModelEditor">
|
||||||
|
<StringArray count="5">
|
||||||
|
<StringItem index="0" value="Item 1"/>
|
||||||
|
<StringItem index="1" value="Item 2"/>
|
||||||
|
<StringItem index="2" value="Item 3"/>
|
||||||
|
<StringItem index="3" value="Item 4"/>
|
||||||
|
<StringItem index="4" value="Item 5"/>
|
||||||
|
</StringArray>
|
||||||
|
</Property>
|
||||||
|
</Properties>
|
||||||
|
</Component>
|
||||||
|
</SubComponents>
|
||||||
|
</Container>
|
||||||
</SubComponents>
|
</SubComponents>
|
||||||
</Form>
|
</Form>
|
||||||
|
@ -19,89 +19,72 @@
|
|||||||
package org.sleuthkit.autopsy.report;
|
package org.sleuthkit.autopsy.report;
|
||||||
|
|
||||||
import java.awt.BorderLayout;
|
import java.awt.BorderLayout;
|
||||||
|
import java.awt.Component;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import javax.swing.JList;
|
||||||
import javax.swing.JPanel;
|
import javax.swing.JPanel;
|
||||||
|
import javax.swing.JRadioButton;
|
||||||
|
import javax.swing.ListCellRenderer;
|
||||||
import javax.swing.ListSelectionModel;
|
import javax.swing.ListSelectionModel;
|
||||||
import javax.swing.event.ListSelectionEvent;
|
import javax.swing.event.ListSelectionEvent;
|
||||||
import javax.swing.event.ListSelectionListener;
|
import javax.swing.event.ListSelectionListener;
|
||||||
import javax.swing.table.AbstractTableModel;
|
|
||||||
import javax.swing.table.TableColumn;
|
|
||||||
import org.openide.util.Lookup;
|
import org.openide.util.Lookup;
|
||||||
import org.sleuthkit.autopsy.coreutils.Logger;
|
import org.sleuthkit.autopsy.coreutils.Logger;
|
||||||
|
|
||||||
public final class ReportVisualPanel1 extends JPanel {
|
public final class ReportVisualPanel1 extends JPanel implements ListSelectionListener {
|
||||||
private static final Logger logger = Logger.getLogger(ReportVisualPanel1.class.getName());
|
private static final Logger logger = Logger.getLogger(ReportVisualPanel1.class.getName());
|
||||||
private ReportWizardPanel1 wizPanel;
|
private ReportWizardPanel1 wizPanel;
|
||||||
|
|
||||||
private Map<GeneralReportModule, Boolean> generalModuleStates = new LinkedHashMap<GeneralReportModule, Boolean>();
|
|
||||||
private Map<FileReportModule, Boolean> fileListModuleStates = new LinkedHashMap<FileReportModule, Boolean>();
|
|
||||||
private List<ReportModule> modules = new ArrayList<>();
|
private List<ReportModule> modules = new ArrayList<>();
|
||||||
private Map<ReportModule, Boolean> moduleStates;
|
private List<GeneralReportModule> generalModules = new ArrayList<>();
|
||||||
|
private List<TableReportModule> tableModules = new ArrayList<>();
|
||||||
private ModulesTableModel modulesModel;
|
private List<FileReportModule> fileModules = new ArrayList<>();
|
||||||
private ModuleSelectionListener modulesListener;
|
private Integer selectedIndex;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates new form ReportVisualPanel1
|
* Creates new form ReportVisualPanel1
|
||||||
*/
|
*/
|
||||||
public ReportVisualPanel1(ReportWizardPanel1 wizPanel) {
|
public ReportVisualPanel1(ReportWizardPanel1 wizPanel) {
|
||||||
moduleStates = new LinkedHashMap<>();
|
|
||||||
initComponents();
|
|
||||||
initModules();
|
|
||||||
this.wizPanel = wizPanel;
|
this.wizPanel = wizPanel;
|
||||||
|
initComponents();
|
||||||
configurationPanel.setLayout(new BorderLayout());
|
configurationPanel.setLayout(new BorderLayout());
|
||||||
descriptionTextPane.setEditable(false);
|
descriptionTextPane.setEditable(false);
|
||||||
modulesTable.setRowSelectionInterval(0, 0);
|
initModules();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initialize the list of ReportModules
|
// Initialize the list of ReportModules
|
||||||
private void initModules() {
|
private void initModules() {
|
||||||
for (ReportModule module : Lookup.getDefault().lookupAll(TableReportModule.class)) {
|
for (TableReportModule module : Lookup.getDefault().lookupAll(TableReportModule.class)) {
|
||||||
if (module.getName().equals("Results - HTML")) {
|
tableModules.add(module);
|
||||||
moduleStates.put(module, Boolean.TRUE);
|
modules.add(module);
|
||||||
} else {
|
}
|
||||||
moduleStates.put(module, Boolean.FALSE);
|
|
||||||
}
|
for (GeneralReportModule module : Lookup.getDefault().lookupAll(GeneralReportModule.class)) {
|
||||||
}
|
generalModules.add(module);
|
||||||
for (ReportModule module : Lookup.getDefault().lookupAll(GeneralReportModule.class)) {
|
modules.add(module);
|
||||||
moduleStates.put(module, Boolean.FALSE);
|
}
|
||||||
}
|
|
||||||
for (ReportModule module : Lookup.getDefault().lookupAll(FileReportModule.class)) {
|
for (FileReportModule module : Lookup.getDefault().lookupAll(FileReportModule.class)) {
|
||||||
moduleStates.put(module, Boolean.FALSE);
|
fileModules.add(module);
|
||||||
|
modules.add(module);
|
||||||
}
|
}
|
||||||
|
|
||||||
modules.addAll(moduleStates.keySet());
|
|
||||||
Collections.sort(modules, new Comparator<ReportModule>() {
|
Collections.sort(modules, new Comparator<ReportModule>() {
|
||||||
@Override
|
@Override
|
||||||
public int compare(ReportModule rm1, ReportModule rm2) {
|
public int compare(ReportModule rm1, ReportModule rm2) {
|
||||||
return rm1.getName().compareTo(rm2.getName());
|
return rm1.getName().compareTo(rm2.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
modulesModel = new ModulesTableModel();
|
modulesJList.getSelectionModel().addListSelectionListener(this);
|
||||||
modulesListener = new ModuleSelectionListener();
|
modulesJList.setCellRenderer(new ModuleCellRenderer());
|
||||||
modulesTable.setModel(modulesModel);
|
modulesJList.setListData(modules.toArray());
|
||||||
modulesTable.getSelectionModel().addListSelectionListener(modulesListener);
|
selectedIndex = 0;
|
||||||
modulesTable.setTableHeader(null);
|
modulesJList.setSelectedIndex(selectedIndex);
|
||||||
modulesTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
|
|
||||||
modulesTable.setRowHeight(modulesTable.getRowHeight() + 5);
|
|
||||||
|
|
||||||
int width = modulesScrollPane.getPreferredSize().width;
|
|
||||||
for (int i = 0; i < modulesTable.getColumnCount(); i++) {
|
|
||||||
TableColumn column = modulesTable.getColumnModel().getColumn(i);
|
|
||||||
if (i == 0) {
|
|
||||||
column.setPreferredWidth(((int) (width * 0.15)));
|
|
||||||
} else {
|
|
||||||
column.setPreferredWidth(((int) (width * 0.84)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -109,43 +92,50 @@ public final class ReportVisualPanel1 extends JPanel {
|
|||||||
return "Select and Configure Report Modules";
|
return "Select and Configure Report Modules";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ReportModule getSelectedModule() {
|
||||||
|
return modules.get(selectedIndex);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the enabled/disabled states of all TableReportModules
|
* Get the Selection status of the TableModules.
|
||||||
|
*
|
||||||
|
* @return
|
||||||
*/
|
*/
|
||||||
Map<TableReportModule, Boolean> getTableModuleStates() {
|
Map<TableReportModule, Boolean> getTableModuleStates() {
|
||||||
Map<TableReportModule, Boolean> tableModuleStates = new LinkedHashMap<>();
|
Map<TableReportModule, Boolean> reportModuleStates = new LinkedHashMap<>();
|
||||||
for (Entry<ReportModule, Boolean> module : moduleStates.entrySet()) {
|
ReportModule mod = getSelectedModule();
|
||||||
if (module.getKey() instanceof TableReportModule) {
|
if (tableModules.contains(mod)) {
|
||||||
tableModuleStates.put((TableReportModule) module.getKey(), module.getValue());
|
reportModuleStates.put((TableReportModule) mod, Boolean.TRUE);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return tableModuleStates;
|
return reportModuleStates;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the enabled/disabled states of all GeneralReportModules
|
* Get the selection status of the GeneralReportModules.
|
||||||
|
*
|
||||||
|
* @return
|
||||||
*/
|
*/
|
||||||
Map<GeneralReportModule, Boolean> getGeneralModuleStates() {
|
Map<GeneralReportModule, Boolean> getGeneralModuleStates() {
|
||||||
Map<GeneralReportModule, Boolean> generalModuleStates = new LinkedHashMap<>();
|
Map<GeneralReportModule, Boolean> reportModuleStates = new LinkedHashMap<>();
|
||||||
for (Entry<ReportModule, Boolean> module : moduleStates.entrySet()) {
|
ReportModule mod = getSelectedModule();
|
||||||
if (module.getKey() instanceof GeneralReportModule) {
|
if (generalModules.contains(mod)) {
|
||||||
generalModuleStates.put((GeneralReportModule) module.getKey(), module.getValue());
|
reportModuleStates.put((GeneralReportModule) mod, Boolean.TRUE);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return generalModuleStates;
|
return reportModuleStates;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the enabled/disabled states of all FileListReportModules
|
* Get the selection status of the FileReportModules.
|
||||||
|
*
|
||||||
|
* @return
|
||||||
*/
|
*/
|
||||||
Map<FileReportModule, Boolean> getFileListModuleStates() {
|
Map<FileReportModule, Boolean> getFileModuleStates() {
|
||||||
Map<FileReportModule, Boolean> fileModuleStates = new LinkedHashMap<>();
|
Map<FileReportModule, Boolean> reportModuleStates = new LinkedHashMap<>();
|
||||||
for (Entry<ReportModule, Boolean> module : moduleStates.entrySet()) {
|
ReportModule mod = getSelectedModule();
|
||||||
if (module.getKey() instanceof FileReportModule) {
|
if (fileModules.contains(mod)) {
|
||||||
fileModuleStates.put((FileReportModule) module.getKey(), module.getValue());
|
reportModuleStates.put((FileReportModule) mod, Boolean.TRUE);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return fileModuleStates;
|
return reportModuleStates;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -156,28 +146,15 @@ public final class ReportVisualPanel1 extends JPanel {
|
|||||||
// <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() {
|
||||||
|
|
||||||
modulesScrollPane = new javax.swing.JScrollPane();
|
|
||||||
modulesTable = new javax.swing.JTable();
|
|
||||||
reportModulesLabel = new javax.swing.JLabel();
|
reportModulesLabel = new javax.swing.JLabel();
|
||||||
configurationPanel = new javax.swing.JPanel();
|
configurationPanel = new javax.swing.JPanel();
|
||||||
descriptionScrollPane = new javax.swing.JScrollPane();
|
descriptionScrollPane = new javax.swing.JScrollPane();
|
||||||
descriptionTextPane = new javax.swing.JTextPane();
|
descriptionTextPane = new javax.swing.JTextPane();
|
||||||
|
modulesScrollPane = new javax.swing.JScrollPane();
|
||||||
|
modulesJList = new javax.swing.JList();
|
||||||
|
|
||||||
setPreferredSize(new java.awt.Dimension(650, 250));
|
setPreferredSize(new java.awt.Dimension(650, 250));
|
||||||
|
|
||||||
modulesTable.setBackground(new java.awt.Color(240, 240, 240));
|
|
||||||
modulesTable.setModel(new javax.swing.table.DefaultTableModel(
|
|
||||||
new Object [][] {
|
|
||||||
|
|
||||||
},
|
|
||||||
new String [] {
|
|
||||||
|
|
||||||
}
|
|
||||||
));
|
|
||||||
modulesTable.setShowHorizontalLines(false);
|
|
||||||
modulesTable.setShowVerticalLines(false);
|
|
||||||
modulesScrollPane.setViewportView(modulesTable);
|
|
||||||
|
|
||||||
org.openide.awt.Mnemonics.setLocalizedText(reportModulesLabel, org.openide.util.NbBundle.getMessage(ReportVisualPanel1.class, "ReportVisualPanel1.reportModulesLabel.text")); // NOI18N
|
org.openide.awt.Mnemonics.setLocalizedText(reportModulesLabel, org.openide.util.NbBundle.getMessage(ReportVisualPanel1.class, "ReportVisualPanel1.reportModulesLabel.text")); // NOI18N
|
||||||
|
|
||||||
configurationPanel.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(125, 125, 125)));
|
configurationPanel.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(125, 125, 125)));
|
||||||
@ -190,7 +167,7 @@ public final class ReportVisualPanel1 extends JPanel {
|
|||||||
);
|
);
|
||||||
configurationPanelLayout.setVerticalGroup(
|
configurationPanelLayout.setVerticalGroup(
|
||||||
configurationPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
configurationPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
.addGap(0, 0, Short.MAX_VALUE)
|
.addGap(0, 168, Short.MAX_VALUE)
|
||||||
);
|
);
|
||||||
|
|
||||||
descriptionScrollPane.setBorder(null);
|
descriptionScrollPane.setBorder(null);
|
||||||
@ -199,6 +176,14 @@ public final class ReportVisualPanel1 extends JPanel {
|
|||||||
descriptionTextPane.setBorder(null);
|
descriptionTextPane.setBorder(null);
|
||||||
descriptionScrollPane.setViewportView(descriptionTextPane);
|
descriptionScrollPane.setViewportView(descriptionTextPane);
|
||||||
|
|
||||||
|
modulesJList.setBackground(new java.awt.Color(240, 240, 240));
|
||||||
|
modulesJList.setModel(new javax.swing.AbstractListModel() {
|
||||||
|
String[] strings = { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5" };
|
||||||
|
public int getSize() { return strings.length; }
|
||||||
|
public Object getElementAt(int i) { return strings[i]; }
|
||||||
|
});
|
||||||
|
modulesScrollPane.setViewportView(modulesJList);
|
||||||
|
|
||||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
||||||
this.setLayout(layout);
|
this.setLayout(layout);
|
||||||
layout.setHorizontalGroup(
|
layout.setHorizontalGroup(
|
||||||
@ -207,8 +192,8 @@ public final class ReportVisualPanel1 extends JPanel {
|
|||||||
.addContainerGap()
|
.addContainerGap()
|
||||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
.addComponent(reportModulesLabel)
|
.addComponent(reportModulesLabel)
|
||||||
.addComponent(modulesScrollPane, javax.swing.GroupLayout.PREFERRED_SIZE, 186, javax.swing.GroupLayout.PREFERRED_SIZE))
|
.addComponent(modulesScrollPane, javax.swing.GroupLayout.PREFERRED_SIZE, 190, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||||
.addGap(10, 10, 10)
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
.addComponent(configurationPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
.addComponent(configurationPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||||
.addComponent(descriptionScrollPane))
|
.addComponent(descriptionScrollPane))
|
||||||
@ -221,11 +206,11 @@ public final class ReportVisualPanel1 extends JPanel {
|
|||||||
.addComponent(reportModulesLabel)
|
.addComponent(reportModulesLabel)
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
.addComponent(modulesScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 208, Short.MAX_VALUE)
|
|
||||||
.addGroup(layout.createSequentialGroup()
|
.addGroup(layout.createSequentialGroup()
|
||||||
.addComponent(configurationPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
.addComponent(configurationPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||||
.addComponent(descriptionScrollPane, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE)))
|
.addComponent(descriptionScrollPane, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||||
|
.addComponent(modulesScrollPane))
|
||||||
.addContainerGap())
|
.addContainerGap())
|
||||||
);
|
);
|
||||||
}// </editor-fold>//GEN-END:initComponents
|
}// </editor-fold>//GEN-END:initComponents
|
||||||
@ -233,99 +218,47 @@ public final class ReportVisualPanel1 extends JPanel {
|
|||||||
private javax.swing.JPanel configurationPanel;
|
private javax.swing.JPanel configurationPanel;
|
||||||
private javax.swing.JScrollPane descriptionScrollPane;
|
private javax.swing.JScrollPane descriptionScrollPane;
|
||||||
private javax.swing.JTextPane descriptionTextPane;
|
private javax.swing.JTextPane descriptionTextPane;
|
||||||
|
private javax.swing.JList modulesJList;
|
||||||
private javax.swing.JScrollPane modulesScrollPane;
|
private javax.swing.JScrollPane modulesScrollPane;
|
||||||
private javax.swing.JTable modulesTable;
|
|
||||||
private javax.swing.JLabel reportModulesLabel;
|
private javax.swing.JLabel reportModulesLabel;
|
||||||
// End of variables declaration//GEN-END:variables
|
// End of variables declaration//GEN-END:variables
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void valueChanged(ListSelectionEvent e) {
|
||||||
|
if (e.getValueIsAdjusting()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
configurationPanel.removeAll();
|
||||||
|
ListSelectionModel m = (ListSelectionModel) e.getSource();
|
||||||
|
// single selection, so max selection index is the only one selected.
|
||||||
|
selectedIndex = m.getMaxSelectionIndex();
|
||||||
|
|
||||||
private class ModulesTableModel extends AbstractTableModel {
|
JPanel panel = new DefaultReportConfigurationPanel();
|
||||||
|
ReportModule module = modules.get(selectedIndex);
|
||||||
@Override
|
boolean generalModuleSelected = false;
|
||||||
public int getRowCount() {
|
if (module instanceof GeneralReportModule) {
|
||||||
return moduleStates.size();
|
JPanel generalPanel = ((GeneralReportModule) module).getConfigurationPanel();
|
||||||
|
panel = (generalPanel == null) ? new JPanel() : panel;
|
||||||
|
generalModuleSelected = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
descriptionTextPane.setText(module.getDescription());
|
||||||
public int getColumnCount() {
|
configurationPanel.add(panel, BorderLayout.CENTER);
|
||||||
return 2;
|
configurationPanel.revalidate();
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
wizPanel.setNext(!generalModuleSelected);
|
||||||
public Object getValueAt(int rowIndex, int columnIndex) {
|
wizPanel.setFinish(generalModuleSelected);
|
||||||
if (rowIndex >= moduleStates.size()) {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
if (columnIndex == 0) {
|
|
||||||
// selection status
|
|
||||||
return moduleStates.get(modules.get(rowIndex));
|
|
||||||
} else {
|
|
||||||
// module name
|
|
||||||
return modules.get(rowIndex).getName();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isCellEditable(int rowIndex, int columnIndex) {
|
|
||||||
return columnIndex == 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setValueAt(Object aValue, int rowIndex, int columnIndex) {
|
|
||||||
if (columnIndex == 0) {
|
|
||||||
moduleStates.put(modules.get(rowIndex), (Boolean) aValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check if there are any TableReportModules enabled
|
|
||||||
boolean moduleEnabled = false;
|
|
||||||
boolean moreConfig = false;
|
|
||||||
for (Entry<ReportModule, Boolean> module : moduleStates.entrySet()) {
|
|
||||||
if (module.getValue()) {
|
|
||||||
if (module.getKey() instanceof TableReportModule
|
|
||||||
|| module.getKey() instanceof FileReportModule) {
|
|
||||||
moreConfig = true;
|
|
||||||
}
|
|
||||||
moduleEnabled = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(moreConfig) {
|
|
||||||
wizPanel.setNext(true);
|
|
||||||
wizPanel.setFinish(false);
|
|
||||||
} else if (moduleEnabled) {
|
|
||||||
wizPanel.setFinish(true);
|
|
||||||
wizPanel.setNext(false);
|
|
||||||
} else {
|
|
||||||
wizPanel.setFinish(false);
|
|
||||||
wizPanel.setNext(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Class<?> getColumnClass(int c) {
|
|
||||||
return getValueAt(0, c).getClass();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private class ModuleSelectionListener implements ListSelectionListener {
|
private class ModuleCellRenderer extends JRadioButton implements ListCellRenderer<ReportModule> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void valueChanged(ListSelectionEvent e) {
|
public Component getListCellRendererComponent(JList list, ReportModule value, int index, boolean isSelected, boolean cellHasFocus) {
|
||||||
configurationPanel.removeAll();
|
this.setText(value.getName());
|
||||||
int rowIndex = modulesTable.getSelectedRow();
|
this.setEnabled(true);
|
||||||
|
this.setSelected(isSelected);
|
||||||
JPanel panel = new DefaultReportConfigurationPanel();
|
return this;
|
||||||
ReportModule module = modules.get(rowIndex);
|
|
||||||
if (module instanceof GeneralReportModule) {
|
|
||||||
JPanel generalPanel = ((GeneralReportModule) module).getConfigurationPanel();
|
|
||||||
panel = (generalPanel == null) ? panel : generalPanel;
|
|
||||||
}
|
|
||||||
|
|
||||||
descriptionTextPane.setText(module.getDescription());
|
|
||||||
configurationPanel.add(panel, BorderLayout.CENTER);
|
|
||||||
configurationPanel.revalidate();
|
|
||||||
configurationPanel.repaint();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -66,11 +66,11 @@ public final class ReportWizardAction extends CallableSystemAction implements P
|
|||||||
public static void doReportWizard() {
|
public static void doReportWizard() {
|
||||||
WizardDescriptor wiz = new WizardDescriptor(new ReportWizardIterator());
|
WizardDescriptor wiz = new WizardDescriptor(new ReportWizardIterator());
|
||||||
wiz.setTitleFormat(new MessageFormat("{0} {1}"));
|
wiz.setTitleFormat(new MessageFormat("{0} {1}"));
|
||||||
wiz.setTitle("Generate Report");
|
wiz.setTitle("Generate Report");
|
||||||
if (DialogDisplayer.getDefault().notify(wiz) == WizardDescriptor.FINISH_OPTION) {
|
if (DialogDisplayer.getDefault().notify(wiz) == WizardDescriptor.FINISH_OPTION) {
|
||||||
ReportGenerator generator = new ReportGenerator((Map<TableReportModule, Boolean>)wiz.getProperty("tableModuleStates"),
|
ReportGenerator generator = new ReportGenerator((Map<TableReportModule, Boolean>)wiz.getProperty("tableModuleStates"),
|
||||||
(Map<GeneralReportModule, Boolean>)wiz.getProperty("generalModuleStates"),
|
(Map<GeneralReportModule, Boolean>)wiz.getProperty("generalModuleStates"),
|
||||||
(Map<FileReportModule, Boolean>)wiz.getProperty("fileListModuleStates"));
|
(Map<FileReportModule, Boolean>)wiz.getProperty("fileModuleStates"));
|
||||||
generator.generateArtifactTableReports((Map<ARTIFACT_TYPE, Boolean>)wiz.getProperty("artifactStates"), (Map<String, Boolean>)wiz.getProperty("tagStates"));
|
generator.generateArtifactTableReports((Map<ARTIFACT_TYPE, Boolean>)wiz.getProperty("artifactStates"), (Map<String, Boolean>)wiz.getProperty("tagStates"));
|
||||||
generator.generateFileListReports((Map<FileReportDataTypes, Boolean>)wiz.getProperty("fileReportOptions"));
|
generator.generateFileListReports((Map<FileReportDataTypes, Boolean>)wiz.getProperty("fileReportOptions"));
|
||||||
generator.generateGeneralReports();
|
generator.generateGeneralReports();
|
||||||
|
@ -86,19 +86,19 @@ public final class ReportWizardIterator implements WizardDescriptor.Iterator<Wiz
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Change which panels will be shown based on the selection of reporting modules.
|
* Change which panels will be shown based on the selection of reporting modules.
|
||||||
* @param tableConfig true if a TableReportModule was selected
|
* @param moreConfig true if a GeneralReportModule was selected
|
||||||
* @param fileConfig true if a FileReportModule was selected
|
* @param tableConfig true if a TReportModule was selected
|
||||||
*/
|
*/
|
||||||
private void enableConfigPanels(boolean tableConfig, boolean fileConfig) {
|
private void enableConfigPanels(boolean generalModule, boolean tableModule) {
|
||||||
if (tableConfig && fileConfig) {
|
if (generalModule) {
|
||||||
panels = Arrays.asList(allConfigPanels);
|
// General Module selected, no additional panels
|
||||||
} else if (tableConfig) {
|
} else if (tableModule) {
|
||||||
// Only TableReport Modules need configuration
|
// Table Module selected, need Artifact Configuration Panel
|
||||||
|
// (ReportWizardPanel2)
|
||||||
panels = Arrays.asList(tableConfigPanels);
|
panels = Arrays.asList(tableConfigPanels);
|
||||||
} else {
|
} else {
|
||||||
// Only FileReport Modules need configuration.
|
// File Module selected, need File Report Configuration Panel
|
||||||
// If no modules need configuration, finish button will be pressed
|
// (ReportWizardFileOptionsPanel)
|
||||||
// and we won't get to this function.
|
|
||||||
panels = Arrays.asList(fileConfigPanels);
|
panels = Arrays.asList(fileConfigPanels);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -131,11 +131,11 @@ public final class ReportWizardIterator implements WizardDescriptor.Iterator<Wiz
|
|||||||
|
|
||||||
if(index == 0) {
|
if(index == 0) {
|
||||||
// Update path through configuration panels
|
// Update path through configuration panels
|
||||||
boolean tableConfig, fileConfig;
|
boolean generalModule, tableModule;
|
||||||
// These preferences are set in ReportWizardPanel1.storeSettings()
|
// These preferences are set in ReportWizardPanel1.storeSettings()
|
||||||
tableConfig = NbPreferences.forModule(ReportWizardPanel1.class).getBoolean("tableConfig", true);
|
generalModule = NbPreferences.forModule(ReportWizardPanel1.class).getBoolean("generalModule", true);
|
||||||
fileConfig = NbPreferences.forModule(ReportWizardPanel1.class).getBoolean("fileConfig", true);
|
tableModule = NbPreferences.forModule(ReportWizardPanel1.class).getBoolean("tableModule", true);
|
||||||
enableConfigPanels(tableConfig, fileConfig);
|
enableConfigPanels(generalModule, tableModule);
|
||||||
}
|
}
|
||||||
|
|
||||||
index++;
|
index++;
|
||||||
|
@ -107,16 +107,16 @@ public class ReportWizardPanel1 implements WizardDescriptor.FinishablePanel<Wiza
|
|||||||
@Override
|
@Override
|
||||||
public void storeSettings(WizardDescriptor wiz) {
|
public void storeSettings(WizardDescriptor wiz) {
|
||||||
Map<TableReportModule, Boolean> tables = getComponent().getTableModuleStates();
|
Map<TableReportModule, Boolean> tables = getComponent().getTableModuleStates();
|
||||||
Map<FileReportModule, Boolean> files = getComponent().getFileListModuleStates();
|
Map<GeneralReportModule, Boolean> generals = getComponent().getGeneralModuleStates();
|
||||||
wiz.putProperty("tableModuleStates", tables);
|
wiz.putProperty("tableModuleStates", tables);
|
||||||
wiz.putProperty("generalModuleStates", getComponent().getGeneralModuleStates());
|
wiz.putProperty("generalModuleStates", generals);
|
||||||
wiz.putProperty("fileListModuleStates", files);
|
wiz.putProperty("fileListModuleStates", getComponent().getFileModuleStates());
|
||||||
|
|
||||||
// Store preferences that WizardIterator will use to determine what
|
// Store preferences that WizardIterator will use to determine what
|
||||||
// panels need to be shown
|
// panels need to be shown
|
||||||
Preferences prefs = NbPreferences.forModule(ReportWizardPanel1.class);
|
Preferences prefs = NbPreferences.forModule(ReportWizardPanel1.class);
|
||||||
prefs.putBoolean("tableConfig", any(tables.values()));
|
prefs.putBoolean("tableModule", any(tables.values()));
|
||||||
prefs.putBoolean("fileConfig", any(files.values()));
|
prefs.putBoolean("generalModule", any(generals.values()));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -80,15 +80,8 @@ public class ReportWizardPanel2 implements WizardDescriptor.Panel<WizardDescript
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setFinish(boolean enabled) {
|
public void setFinish(boolean enabled) {
|
||||||
// If FileReportModules need to be configured, disable the Finish button
|
nextButton.setEnabled(false);
|
||||||
// and enable the next button.
|
finishButton.setEnabled(enabled);
|
||||||
if (NbPreferences.forModule(ReportWizardPanel1.class).getBoolean("fileConfig", false)) {
|
|
||||||
finishButton.setEnabled(false);
|
|
||||||
nextButton.setEnabled(enabled);
|
|
||||||
} else {
|
|
||||||
nextButton.setEnabled(false);
|
|
||||||
finishButton.setEnabled(enabled);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
x
Reference in New Issue
Block a user