Autopsy  4.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 
35 class FilterArea extends JPanel {
36 
37 // private JButton toggleButton;
38 // private boolean collapsed;
39  private final String title;
40  private List<FileSearchFilter> filters;
41  private JPanel filtersPanel;
42 
49  FilterArea(String title, FileSearchFilter filter) {
50  this(title, Collections.singletonList(filter));
51  }
52 
59  FilterArea(String title, List<FileSearchFilter> filters) {
60  this.title = title;
61  this.filters = filters;
62 // this.collapsed = false;
63  this.init();
64  this.refresh();
65  }
66 
72  List<FileSearchFilter> getFilters() {
73  return filters;
74  }
75 
76  private void init() {
77 
78  // Commmented-out code is for collapable filter areas
79 // this.dateFiltersButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/filesearch/arrow_down.gif"))); // NOI18N
80 // toggleButton = new JButton();
81 // toggleButton.setAlignmentX(Component.CENTER_ALIGNMENT);
82 // toggleButton.addActionListener(new ActionListener() {
83 //
84 // @Override
85 // public void actionPerformed(ActionEvent e) {
86 // FilterArea.this.toggle();
87 // FilterArea.this.refresh();
88 // }
89 // });
90 //
91 // this.add(toggleButton);
92  filtersPanel = new JPanel();
93  filtersPanel.setAlignmentX(Component.LEFT_ALIGNMENT);
94 
95  BoxLayout filtersPanelLayout = new BoxLayout(this, BoxLayout.Y_AXIS);
96  this.setLayout(filtersPanelLayout);
97 
98  for (int i = 0; i < filters.size(); i++) {
99  FileSearchFilter f = filters.get(i);
100  JComponent filterComponent = f.getComponent();
101  filterComponent.setAlignmentX(Component.LEFT_ALIGNMENT);
102  if (i != filters.size() - 1) {
103  filterComponent.setBorder(new EmptyBorder(0, 0, 15, 0));
104  }
105  else {
106  filterComponent.setBorder(new EmptyBorder(0, 0, 18, 0));
107  }
108  this.add(filterComponent);
109  }
110  this.setAlignmentX(Component.LEFT_ALIGNMENT);
111  }
112 
113  private void refresh() {
114 // int height = toggleButton.getHeight();
115 // toggleButton.setMaximumSize(new Dimension(Integer.MAX_VALUE, height));
116 //
117 // filtersPanel.setVisible(!collapsed);
118 // toggleButton.setText(title);
119 //
120 // filtersPanel.setMaximumSize(new Dimension(Integer.MAX_VALUE, filtersPanel.getHeight()));
121 //
122 // this.setPreferredSize(this.getPreferredSize());
123 //
124 // this.revalidate();
125 // this.repaint();
126  }
127 // private void toggle() {
128 // collapsed = !collapsed;
129 // }
130 }

Copyright © 2012-2016 Basis Technology. Generated on: Mon Jan 2 2017
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.