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

report widget action cleanup and resize improvement

This commit is contained in:
adam-m
2012-11-07 17:23:36 -05:00
parent 4572a12971
commit b23180b1bc
3 changed files with 15 additions and 56 deletions

View File

@@ -63,25 +63,13 @@ public final class ReportAction extends CallableSystemAction implements Presente
public ReportAction() {
setEnabled(false);
Case.addPropertyChangeListener(new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
if (evt.getPropertyName().equals(Case.CASE_CURRENT_CASE)) {
setEnabled(evt.getNewValue() != null);
}
}
});
//attempt to create a report folder if a case is active
Case.addPropertyChangeListener(new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
String changed = evt.getPropertyName();
//case has been changed
if (changed.equals(Case.CASE_CURRENT_CASE)) {
Case newCase = (Case) evt.getNewValue();
setEnabled(newCase != null);
//attempt to create a report folder if a case is active
if (newCase != null) {
boolean exists = (new File(newCase.getCaseDirectory() + File.separator + "Reports")).exists();
if (exists) {
@@ -100,7 +88,6 @@ public final class ReportAction extends CallableSystemAction implements Presente
// set action of the toolbar button
toolbarButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
ReportAction.this.actionPerformed(e);
@@ -109,8 +96,6 @@ public final class ReportAction extends CallableSystemAction implements Presente
}
private class configListener implements ItemListener {
@Override
@@ -134,30 +119,6 @@ public final class ReportAction extends CallableSystemAction implements Presente
}
};
private class previewListener implements ItemListener {
@Override
public void itemStateChanged(ItemEvent e) {
Object source = e.getItem();
JCheckBox comp = (JCheckBox) source;
String name = comp.getName();
JCheckBox buttan = new JCheckBox();
Component[] comps = comp.getParent().getComponents();
for (Component c : comps) {
if (c.getName().equals(name)) {
buttan = (JCheckBox) c;
}
}
String temp = buttan.getName();
temp = temp.substring(0, temp.length() - 1);
if (e.getStateChange() == ItemEvent.SELECTED) {
preview.add(temp);
}
if(e.getStateChange() == ItemEvent.DESELECTED && preview.contains(temp)){
preview.remove(temp);
}
}
};
@Override
public void actionPerformed(ActionEvent e) {
@@ -170,7 +131,6 @@ public final class ReportAction extends CallableSystemAction implements Presente
// initialize panel with loaded settings
final ReportFilter panel = new ReportFilter();
panel.setjButton2ActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
popUpWindow.dispose();
@@ -184,7 +144,6 @@ public final class ReportAction extends CallableSystemAction implements Presente
final JPanel filterpanel = new JPanel(new GridLayout(rows, 2, 5, 5));
final JPanel artpanel = new JPanel(new GridLayout(0, 3, 0, 0));
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
@@ -194,7 +153,7 @@ public final class ReportAction extends CallableSystemAction implements Presente
filterpanel.setAlignmentY(Component.TOP_ALIGNMENT);
filterpanel.setAlignmentX(Component.LEFT_ALIGNMENT);
filterpanel.setSize(300, 200);
for (ReportModule m : Lookup.getDefault().lookupAll(ReportModule.class)) {
String name = m.getName();
String desc = m.getReportTypeDescription();
@@ -235,7 +194,7 @@ public final class ReportAction extends CallableSystemAction implements Presente
popUpWindow.setResizable(false);
// Modules need extra room for text to properly show
popUpWindow.setSize(popUpWindow.getWidth(),
popUpWindow.getHeight()+50);
popUpWindow.getHeight() + 50);
// set the location of the popUp Window on the center of the screen
Dimension screenDimension = Toolkit.getDefaultToolkit().getScreenSize();

View File

@@ -1,4 +1,4 @@
<?xml version="1.1" encoding="UTF-8" ?>
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.5" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<NonVisualComponents>
@@ -18,7 +18,7 @@
</NonVisualComponents>
<Properties>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[325, 75]"/>
<Dimension value="[500, 75]"/>
</Property>
</Properties>
<AuxValues>
@@ -42,10 +42,10 @@
<Group type="102" attributes="0">
<Component id="jButton1" min="-2" max="-2" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="updateLabel" pref="160" max="32767" attributes="0"/>
<Component id="updateLabel" pref="272" max="32767" attributes="0"/>
</Group>
<Group type="102" attributes="0">
<Component id="progBar" pref="220" max="32767" attributes="0"/>
<Component id="progBar" pref="332" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="cancelButton" min="-2" max="-2" attributes="0"/>
</Group>
@@ -60,14 +60,14 @@
<EmptySpace min="-2" pref="19" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jButton1" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="updateLabel" alignment="3" pref="23" max="32767" attributes="0"/>
<Component id="updateLabel" alignment="3" pref="51" max="32767" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" max="-2" attributes="0">
<Component id="cancelButton" max="32767" attributes="0"/>
<Component id="progBar" min="-2" pref="23" max="-2" attributes="0"/>
</Group>
<EmptySpace max="32767" attributes="0"/>
<EmptySpace pref="39" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>

View File

@@ -81,7 +81,7 @@ public class ReportFilter extends javax.swing.JPanel {
jButton2.setActionCommand(org.openide.util.NbBundle.getMessage(ReportFilter.class, "ReportFilter.jButton2.actionCommand")); // NOI18N
jButton2.setLabel(org.openide.util.NbBundle.getMessage(ReportFilter.class, "ReportFilter.jButton2.label")); // NOI18N
setPreferredSize(new java.awt.Dimension(325, 75));
setPreferredSize(new java.awt.Dimension(500, 75));
progBar.setDoubleBuffered(true);
progBar.setEnabled(false);
@@ -124,9 +124,9 @@ public class ReportFilter extends javax.swing.JPanel {
.addGroup(layout.createSequentialGroup()
.addComponent(jButton1)
.addGap(18, 18, 18)
.addComponent(updateLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 160, Short.MAX_VALUE))
.addComponent(updateLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 272, Short.MAX_VALUE))
.addGroup(layout.createSequentialGroup()
.addComponent(progBar, javax.swing.GroupLayout.DEFAULT_SIZE, 220, Short.MAX_VALUE)
.addComponent(progBar, javax.swing.GroupLayout.DEFAULT_SIZE, 332, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(cancelButton)))
.addGap(24, 24, 24))
@@ -137,12 +137,12 @@ public class ReportFilter extends javax.swing.JPanel {
.addGap(19, 19, 19)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jButton1)
.addComponent(updateLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 23, Short.MAX_VALUE))
.addComponent(updateLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 51, Short.MAX_VALUE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(cancelButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(progBar, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap(39, Short.MAX_VALUE))
);
}// </editor-fold>//GEN-END:initComponents