Autopsy  3.1
Graphical digital forensics platform for The Sleuth Kit and other tools.
FilterArea.java
Go to the documentation of this file.
1 /*
2  * Autopsy Forensic Browser
3  *
4  * Copyright 2011 Basis Technology Corp.
5  * Contact: carrier <at> sleuthkit <dot> org
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  */
19 package org.sleuthkit.autopsy.filesearch;
20 
21 import java.awt.Component;
22 import java.util.Collections;
23 import java.util.List;
24 import javax.swing.BoxLayout;
25 import javax.swing.JComponent;
26 import javax.swing.JPanel;
27 import javax.swing.border.EmptyBorder;
28 
34 class FilterArea extends JPanel {
35 
36 // private JButton toggleButton;
37 // private boolean collapsed;
38  private final String title;
39  private List<FileSearchFilter> filters;
40  private JPanel filtersPanel;
41 
47  FilterArea(String title, FileSearchFilter filter) {
48  this(title, Collections.singletonList(filter));
49  }
50 
56  FilterArea(String title, List<FileSearchFilter> filters) {
57  this.title = title;
58  this.filters = filters;
59 // this.collapsed = false;
60  this.init();
61  this.refresh();
62  }
63 
68  List<FileSearchFilter> getFilters() {
69  return filters;
70  }
71 
72  private void init() {
73 
74 
75 
76  // Commmented-out code is for collapable filter areas
77 // this.dateFiltersButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/filesearch/arrow_down.gif"))); // NOI18N
78 
79 // toggleButton = new JButton();
80 // toggleButton.setAlignmentX(Component.CENTER_ALIGNMENT);
81 // toggleButton.addActionListener(new ActionListener() {
82 //
83 // @Override
84 // public void actionPerformed(ActionEvent e) {
85 // FilterArea.this.toggle();
86 // FilterArea.this.refresh();
87 // }
88 // });
89 //
90 // this.add(toggleButton);
91 
92  filtersPanel = new JPanel();
93  filtersPanel.setAlignmentX(Component.LEFT_ALIGNMENT);
94 
95  BoxLayout filtersPanelLayout = new BoxLayout(filtersPanel, BoxLayout.Y_AXIS);
96  filtersPanel.setLayout(filtersPanelLayout);
97 
98  for (FileSearchFilter f : filters) {
99  JComponent filterComponent = f.getComponent();
100  filterComponent.setAlignmentX(Component.LEFT_ALIGNMENT);
101  filterComponent.setBorder(new EmptyBorder(0, 0, 20, 0));
102  filtersPanel.add(filterComponent);
103  }
104 
105  this.add(filtersPanel);
106 
107  BoxLayout layout = new BoxLayout(this, BoxLayout.Y_AXIS);
108  this.setLayout(layout);
109  }
110 
111  private void refresh() {
112 // int height = toggleButton.getHeight();
113 // toggleButton.setMaximumSize(new Dimension(Integer.MAX_VALUE, height));
114 //
115 // filtersPanel.setVisible(!collapsed);
116 // toggleButton.setText(title);
117 //
118 // filtersPanel.setMaximumSize(new Dimension(Integer.MAX_VALUE, filtersPanel.getHeight()));
119 //
120 // this.setPreferredSize(this.getPreferredSize());
121 //
122 // this.revalidate();
123 // this.repaint();
124  }
125 // private void toggle() {
126 // collapsed = !collapsed;
127 // }
128 }

Copyright © 2012-2015 Basis Technology. Generated on: Mon Oct 19 2015
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.