Autopsy 4.22.1
Graphical digital forensics platform for The Sleuth Kit and other tools.
ManageHostsDialog.java
Go to the documentation of this file.
1/*
2 * Autopsy Forensic Browser
3 *
4 * Copyright 2021 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 */
19package org.sleuthkit.autopsy.datamodel.hosts;
20
21import java.awt.Dialog;
22import java.util.ArrayList;
23import java.util.Collections;
24import java.util.HashMap;
25import java.util.List;
26import java.util.Map;
27import java.util.Objects;
28import java.util.Vector;
29import java.util.logging.Level;
30import java.util.stream.Collectors;
31import javax.swing.JFrame;
32import javax.swing.ListModel;
33import org.apache.commons.collections4.CollectionUtils;
34import org.openide.util.NbBundle;
35import org.openide.util.NbBundle.Messages;
36import org.sleuthkit.autopsy.casemodule.Case;
37import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException;
38import org.sleuthkit.autopsy.coreutils.Logger;
39import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil;
40import org.sleuthkit.datamodel.DataSource;
41import org.sleuthkit.datamodel.Host;
42import org.sleuthkit.datamodel.SleuthkitCase;
43import org.sleuthkit.datamodel.TskCoreException;
44
48@Messages({
49 "ManageHostsDialog_title_text=Manage Hosts"
50})
51public class ManageHostsDialog extends javax.swing.JDialog {
52
56 private static class HostListItem {
57
58 private final Host host;
59 private final List<DataSource> dataSources;
60
67 HostListItem(Host host, List<DataSource> dataSources) {
68 this.host = host;
69 this.dataSources = dataSources;
70 }
71
75 Host getHost() {
76 return host;
77 }
78
82 List<DataSource> getDataSources() {
83 return dataSources;
84 }
85
86 @Override
87 public String toString() {
88 return host == null ? "" : host.getName();
89 }
90
91 @Override
92 public int hashCode() {
93 int hash = 5;
94 hash = 89 * hash + Objects.hashCode(this.host == null ? 0 : this.host.getHostId());
95 return hash;
96 }
97
98 @Override
99 public boolean equals(Object obj) {
100 if (this == obj) {
101 return true;
102 }
103 if (obj == null) {
104 return false;
105 }
106 if (getClass() != obj.getClass()) {
107 return false;
108 }
109 final HostListItem other = (HostListItem) obj;
110 if (this.host == null || other.getHost() == null) {
111 return this.host == null && other.getHost() == null;
112 }
113
114 return this.host.getHostId() == other.getHost().getHostId();
115 }
116
117 }
118
119 private static final Logger logger = Logger.getLogger(ManageHostsDialog.class.getName());
120 private static final long serialVersionUID = 1L;
121
122 private Map<Host, List<DataSource>> hostChildrenMap = Collections.emptyMap();
123
129 public ManageHostsDialog(java.awt.Frame parent) {
130 super(parent, Bundle.ManageHostsDialog_title_text(), true);
131 init();
132 }
133
139 public ManageHostsDialog(Dialog parent) {
140 super(parent, Bundle.ManageHostsDialog_title_text(), true);
141 init();
142 }
143
147 private void init() {
149 refresh();
150
151 // refreshes UI when selection changes including button enabled state and data.
152 this.hostList.addListSelectionListener((evt) -> refreshComponents());
153 }
154
159 Host getSelectedHost() {
160 return (hostList.getSelectedValue() == null) ? null : hostList.getSelectedValue().getHost();
161 }
162
166 @NbBundle.Messages({"# {0} - hostname",
167 "ManageHostsDialog.failureToAdd.txt=Unable to add new host {0} at this time.",
168 "ManageHostsDialog.seeLog.txt= See log for more information."})
169 private void addHost() {
170 String newHostName = getAddEditDialogName(null);
171 if (newHostName != null) {
172 Long selectedId = null;
173 try {
174 Host newHost = Case.getCurrentCaseThrows().getSleuthkitCase().getHostManager().newHost(newHostName);
175 selectedId = newHost == null ? null : newHost.getHostId();
176 } catch (NoCurrentCaseException | TskCoreException e) {
177 logger.log(Level.WARNING, Bundle.ManageHostsDialog_failureToAdd_txt(newHostName), e);
178 MessageNotifyUtil.Message.warn(Bundle.ManageHostsDialog_failureToAdd_txt(newHostName) + Bundle.ManageHostsDialog_seeLog_txt());
179 }
180 refresh();
181 setSelectedHostById(selectedId);
182 }
183 }
184
190 @NbBundle.Messages({"# {0} - hostname",
191 "ManageHostsDialog.failureToDelete.txt=Unable to delete host {0} at this time."})
192 private void deleteHost(Host selectedHost) {
193 if (selectedHost != null && selectedHost.getName() != null) {
194 try {
195 Case.getCurrentCaseThrows().getSleuthkitCase().getHostManager().deleteHost(selectedHost.getName());
196 } catch (NoCurrentCaseException | TskCoreException e) {
197 logger.log(Level.WARNING, Bundle.ManageHostsDialog_failureToDelete_txt(selectedHost.getName()), e);
198 MessageNotifyUtil.Message.error(Bundle.ManageHostsDialog_failureToDelete_txt(selectedHost.getName()) + Bundle.ManageHostsDialog_seeLog_txt());
199 }
200 refresh();
201 }
202 }
203
209 private void setSelectedHostById(Long selectedId) {
210 ListModel<HostListItem> model = hostList.getModel();
211
212 if (selectedId == null) {
213 hostList.clearSelection();
214 }
215
216 for (int i = 0; i < model.getSize(); i++) {
217 Object o = model.getElementAt(i);
218 if (!(o instanceof HostListItem)) {
219 continue;
220 }
221
222 Host host = ((HostListItem) o).getHost();
223 if (host == null) {
224 continue;
225 }
226
227 if (host.getHostId() == selectedId) {
228 hostList.setSelectedIndex(i);
229 return;
230 }
231 }
232
233 hostList.clearSelection();
234 }
235
241 @NbBundle.Messages({"# {0} - hostname",
242 "# {1} - hostId",
243 "ManageHostsDialog.failureToEdit.txt=Unable to update host {0} with id: {1} at this time."})
244 private void editHost(Host selectedHost) {
245
246 if (selectedHost != null) {
247 String newHostName = getAddEditDialogName(selectedHost);
248 if (newHostName != null) {
249 try {
250 Case.getCurrentCaseThrows().getSleuthkitCase().getHostManager().updateHostName(selectedHost, newHostName);
251 } catch (NoCurrentCaseException | TskCoreException e) {
252 logger.log(Level.WARNING, Bundle.ManageHostsDialog_failureToEdit_txt(selectedHost.getName(), selectedHost.getHostId()), e);
253 MessageNotifyUtil.Message.warn(Bundle.ManageHostsDialog_failureToEdit_txt(selectedHost.getName(), selectedHost.getHostId()) + Bundle.ManageHostsDialog_seeLog_txt());
254 }
255
256 HostListItem selectedItem = hostList.getSelectedValue();
257 Long selectedId = selectedItem == null || selectedItem.getHost() == null ? null : selectedItem.getHost().getHostId();
258
259 refresh();
260
261 setSelectedHostById(selectedId);
262 }
263 }
264 }
265
274 private String getAddEditDialogName(Host origValue) {
275 JFrame parent = (this.getRootPane() != null && this.getRootPane().getParent() instanceof JFrame)
276 ? (JFrame) this.getRootPane().getParent()
277 : null;
278
279 AddEditHostDialog addEditDialog = new AddEditHostDialog(parent, hostChildrenMap.keySet(), origValue);
280 addEditDialog.setResizable(false);
281 addEditDialog.setLocationRelativeTo(parent);
282 addEditDialog.setVisible(true);
283 addEditDialog.toFront();
284
285 if (addEditDialog.isChanged()) {
286 String newHostName = addEditDialog.getValue();
287 return newHostName;
288 }
289
290 return null;
291 }
292
296 private void refresh() {
297 refreshData();
299 }
300
305 private void refreshData() {
306
308
309 Vector<HostListItem> jlistData = hostChildrenMap.entrySet().stream()
310 .sorted((a, b) -> getNameOrEmpty(a.getKey()).compareTo(getNameOrEmpty(b.getKey())))
311 .map(entry -> new HostListItem(entry.getKey(), entry.getValue()))
312 .collect(Collectors.toCollection(Vector::new));
313
314 hostList.setListData(jlistData);
315 }
316
325 private String getNameOrEmpty(Host h) {
326 return (h == null || h.getName() == null) ? "" : h.getName();
327 }
328
335 @NbBundle.Messages({"ManageHostsDialog.failureToGetHosts.txt=There was an error while fetching hosts for current case."})
336 private Map<Host, List<DataSource>> getHostListData() {
337 Map<Host, List<DataSource>> hostMapping = new HashMap<>();
338 try {
339 SleuthkitCase curCase = Case.getCurrentCaseThrows().getSleuthkitCase();
340 List<Host> hosts = curCase.getHostManager().getAllHosts();
341 List<DataSource> dataSources = curCase.getDataSources();
342
343 if (dataSources != null) {
344 for (DataSource ds : dataSources) {
345 List<DataSource> hostDataSources = hostMapping.computeIfAbsent(ds.getHost(), (d) -> new ArrayList<>());
346 hostDataSources.add(ds);
347 }
348
349 }
350
351 if (hosts != null) {
352 for (Host host : hosts) {
353 hostMapping.putIfAbsent(host, Collections.emptyList());
354 }
355 }
356
357 } catch (TskCoreException | NoCurrentCaseException ex) {
358 logger.log(Level.WARNING, Bundle.ManageHostsDialog_failureToGetHosts_txt(), ex);
359 MessageNotifyUtil.Message.warn(Bundle.ManageHostsDialog_failureToGetHosts_txt() + Bundle.ManageHostsDialog_seeLog_txt());
360 }
361
362 return hostMapping;
363 }
364
368 private void refreshComponents() {
369 HostListItem selectedItem = hostList.getSelectedValue();
370 Host selectedHost = selectedItem == null ? null : selectedItem.getHost();
371 List<DataSource> dataSources = selectedItem == null ? null : selectedItem.getDataSources();
372 this.editButton.setEnabled(selectedHost != null);
373 this.deleteButton.setEnabled(selectedHost != null && CollectionUtils.isEmpty(dataSources));
374 String nameTextFieldStr = selectedHost != null && selectedHost.getName() != null ? selectedHost.getName() : "";
375 this.hostNameTextField.setText(nameTextFieldStr);
376
377 }
378
384 @SuppressWarnings("unchecked")
385 // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
386 private void initComponents() {
387
388 javax.swing.JScrollPane manageHostsScrollPane = new javax.swing.JScrollPane();
389 javax.swing.JPanel manageHostsPanel = new javax.swing.JPanel();
390 javax.swing.JScrollPane hostListScrollPane = new javax.swing.JScrollPane();
391 hostList = new javax.swing.JList<>();
392 javax.swing.JScrollPane hostDescriptionScrollPane = new javax.swing.JScrollPane();
393 hostDescriptionTextArea = new javax.swing.JTextArea();
394 newButton = new javax.swing.JButton();
395 deleteButton = new javax.swing.JButton();
396 closeButton = new javax.swing.JButton();
397 javax.swing.JLabel hostListLabel = new javax.swing.JLabel();
398 javax.swing.JSeparator jSeparator1 = new javax.swing.JSeparator();
399 javax.swing.JLabel hostNameLabel = new javax.swing.JLabel();
400 hostNameTextField = new javax.swing.JTextField();
401 editButton = new javax.swing.JButton();
402 javax.swing.JLabel hostDetailsLabel = new javax.swing.JLabel();
403
404 setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
405 setMinimumSize(new java.awt.Dimension(600, 450));
406
407 manageHostsScrollPane.setMinimumSize(new java.awt.Dimension(600, 450));
408 manageHostsScrollPane.setPreferredSize(new java.awt.Dimension(600, 450));
409
410 manageHostsPanel.setPreferredSize(new java.awt.Dimension(527, 407));
411
412 hostList.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
413 hostListScrollPane.setViewportView(hostList);
414
415 hostDescriptionTextArea.setEditable(false);
416 hostDescriptionTextArea.setBackground(new java.awt.Color(240, 240, 240));
417 hostDescriptionTextArea.setColumns(20);
418 hostDescriptionTextArea.setLineWrap(true);
419 hostDescriptionTextArea.setRows(3);
420 hostDescriptionTextArea.setText(org.openide.util.NbBundle.getMessage(ManageHostsDialog.class, "ManageHostsDialog.hostDescriptionTextArea.text")); // NOI18N
421 hostDescriptionTextArea.setWrapStyleWord(true);
422 hostDescriptionScrollPane.setViewportView(hostDescriptionTextArea);
423
424 newButton.setText(org.openide.util.NbBundle.getMessage(ManageHostsDialog.class, "ManageHostsDialog.newButton.text")); // NOI18N
425 newButton.setMargin(new java.awt.Insets(2, 6, 2, 6));
426 newButton.setMaximumSize(new java.awt.Dimension(70, 23));
427 newButton.setMinimumSize(new java.awt.Dimension(70, 23));
428 newButton.setPreferredSize(new java.awt.Dimension(70, 23));
429 newButton.addActionListener(new java.awt.event.ActionListener() {
430 public void actionPerformed(java.awt.event.ActionEvent evt) {
431 newButtonActionPerformed(evt);
432 }
433 });
434
435 deleteButton.setText(org.openide.util.NbBundle.getMessage(ManageHostsDialog.class, "ManageHostsDialog.deleteButton.text")); // NOI18N
436 deleteButton.setMargin(new java.awt.Insets(2, 6, 2, 6));
437 deleteButton.setMaximumSize(new java.awt.Dimension(70, 23));
438 deleteButton.setMinimumSize(new java.awt.Dimension(70, 23));
439 deleteButton.setPreferredSize(new java.awt.Dimension(70, 23));
440 deleteButton.addActionListener(new java.awt.event.ActionListener() {
441 public void actionPerformed(java.awt.event.ActionEvent evt) {
442 deleteButtonActionPerformed(evt);
443 }
444 });
445
446 closeButton.setText(org.openide.util.NbBundle.getMessage(ManageHostsDialog.class, "ManageHostsDialog.closeButton.text")); // NOI18N
447 closeButton.addActionListener(new java.awt.event.ActionListener() {
448 public void actionPerformed(java.awt.event.ActionEvent evt) {
449 closeButtonActionPerformed(evt);
450 }
451 });
452
453 hostListLabel.setText(org.openide.util.NbBundle.getMessage(ManageHostsDialog.class, "ManageHostsDialog.hostListLabel.text")); // NOI18N
454
455 jSeparator1.setOrientation(javax.swing.SwingConstants.VERTICAL);
456
457 hostNameLabel.setText(org.openide.util.NbBundle.getMessage(ManageHostsDialog.class, "ManageHostsDialog.hostNameLabel.text")); // NOI18N
458
459 hostNameTextField.setEditable(false);
460
461 editButton.setText(org.openide.util.NbBundle.getMessage(ManageHostsDialog.class, "ManageHostsDialog.editButton.text")); // NOI18N
462 editButton.setMaximumSize(new java.awt.Dimension(70, 23));
463 editButton.setMinimumSize(new java.awt.Dimension(70, 23));
464 editButton.setPreferredSize(new java.awt.Dimension(70, 23));
465 editButton.addActionListener(new java.awt.event.ActionListener() {
466 public void actionPerformed(java.awt.event.ActionEvent evt) {
467 editButtonActionPerformed(evt);
468 }
469 });
470
471 hostDetailsLabel.setText(org.openide.util.NbBundle.getMessage(ManageHostsDialog.class, "ManageHostsDialog.hostDetailsLabel.text")); // NOI18N
472
473 javax.swing.GroupLayout manageHostsPanelLayout = new javax.swing.GroupLayout(manageHostsPanel);
474 manageHostsPanel.setLayout(manageHostsPanelLayout);
475 manageHostsPanelLayout.setHorizontalGroup(
476 manageHostsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
477 .addGroup(manageHostsPanelLayout.createSequentialGroup()
478 .addContainerGap()
479 .addGroup(manageHostsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
480 .addComponent(hostDescriptionScrollPane, javax.swing.GroupLayout.PREFERRED_SIZE, 225, javax.swing.GroupLayout.PREFERRED_SIZE)
481 .addComponent(hostListLabel)
482 .addGroup(manageHostsPanelLayout.createSequentialGroup()
483 .addComponent(newButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
484 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
485 .addComponent(editButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
486 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
487 .addComponent(deleteButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
488 .addComponent(hostListScrollPane, javax.swing.GroupLayout.PREFERRED_SIZE, 224, javax.swing.GroupLayout.PREFERRED_SIZE))
489 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
490 .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
491 .addGroup(manageHostsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
492 .addGroup(manageHostsPanelLayout.createSequentialGroup()
493 .addGroup(manageHostsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
494 .addGroup(manageHostsPanelLayout.createSequentialGroup()
495 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
496 .addComponent(closeButton))
497 .addGroup(manageHostsPanelLayout.createSequentialGroup()
498 .addGap(29, 29, 29)
499 .addComponent(hostNameLabel)
500 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
501 .addComponent(hostNameTextField, javax.swing.GroupLayout.DEFAULT_SIZE, 79, Short.MAX_VALUE)))
502 .addContainerGap())
503 .addGroup(manageHostsPanelLayout.createSequentialGroup()
504 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
505 .addComponent(hostDetailsLabel)
506 .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
507 );
508 manageHostsPanelLayout.setVerticalGroup(
509 manageHostsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
510 .addGroup(manageHostsPanelLayout.createSequentialGroup()
511 .addContainerGap()
512 .addGroup(manageHostsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
513 .addGroup(manageHostsPanelLayout.createSequentialGroup()
514 .addComponent(hostDetailsLabel)
515 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
516 .addGroup(manageHostsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
517 .addComponent(hostNameLabel)
518 .addComponent(hostNameTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
519 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
520 .addComponent(closeButton))
521 .addComponent(jSeparator1)
522 .addGroup(manageHostsPanelLayout.createSequentialGroup()
523 .addComponent(hostDescriptionScrollPane, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
524 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
525 .addComponent(hostListLabel)
526 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
527 .addComponent(hostListScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 325, Short.MAX_VALUE)
528 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
529 .addGroup(manageHostsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
530 .addComponent(newButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
531 .addComponent(deleteButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
532 .addComponent(editButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
533 .addContainerGap())
534 );
535
536 java.util.ResourceBundle bundle = java.util.ResourceBundle.getBundle("org/sleuthkit/autopsy/datamodel/hosts/Bundle"); // NOI18N
537 newButton.getAccessibleContext().setAccessibleName(bundle.getString("ManageHostsDialog.newButton.text")); // NOI18N
538 deleteButton.getAccessibleContext().setAccessibleName(bundle.getString("ManageHostsDialog.deleteButton.text")); // NOI18N
539 closeButton.getAccessibleContext().setAccessibleName(bundle.getString("ManageHostsDialog.closeButton.text")); // NOI18N
540 hostListLabel.getAccessibleContext().setAccessibleName(bundle.getString("ManageHostsDialog.hostListLabel.text")); // NOI18N
541 hostNameLabel.getAccessibleContext().setAccessibleName(bundle.getString("ManageHostsDialog.hostNameLabel.text")); // NOI18N
542 editButton.getAccessibleContext().setAccessibleName(bundle.getString("ManageHostsDialog.editButton.text")); // NOI18N
543 hostDetailsLabel.getAccessibleContext().setAccessibleName(bundle.getString("ManageHostsDialog.hostDetailsLabel.text")); // NOI18N
544
545 manageHostsScrollPane.setViewportView(manageHostsPanel);
546
547 javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
548 getContentPane().setLayout(layout);
549 layout.setHorizontalGroup(
550 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
551 .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
552 .addGap(0, 0, 0)
553 .addComponent(manageHostsScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
554 );
555 layout.setVerticalGroup(
556 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
557 .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
558 .addGap(0, 0, 0)
559 .addComponent(manageHostsScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
560 );
561
562 pack();
563 }// </editor-fold>//GEN-END:initComponents
564
565 private void newButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_newButtonActionPerformed
566 addHost();
567 }//GEN-LAST:event_newButtonActionPerformed
568
569 private void deleteButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_deleteButtonActionPerformed
570 HostListItem listItem = this.hostList.getSelectedValue();
571 if (listItem != null && listItem.getHost() != null) {
572 deleteHost(listItem.getHost());
573 }
574 }//GEN-LAST:event_deleteButtonActionPerformed
575
576 private void closeButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_closeButtonActionPerformed
577 dispose();
578 }//GEN-LAST:event_closeButtonActionPerformed
579
580 private void editButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_editButtonActionPerformed
581 HostListItem listItem = this.hostList.getSelectedValue();
582 if (listItem != null && listItem.getHost() != null) {
583 editHost(listItem.getHost());
584 }
585 }//GEN-LAST:event_editButtonActionPerformed
586
587 // Variables declaration - do not modify//GEN-BEGIN:variables
588 private javax.swing.JButton closeButton;
589 private javax.swing.JButton deleteButton;
590 private javax.swing.JButton editButton;
591 private javax.swing.JTextArea hostDescriptionTextArea;
592 private javax.swing.JList<org.sleuthkit.autopsy.datamodel.hosts.ManageHostsDialog.HostListItem> hostList;
593 private javax.swing.JTextField hostNameTextField;
594 private javax.swing.JButton newButton;
595 // End of variables declaration//GEN-END:variables
596}
synchronized static Logger getLogger(String name)
Definition Logger.java:124
void editButtonActionPerformed(java.awt.event.ActionEvent evt)
void newButtonActionPerformed(java.awt.event.ActionEvent evt)
javax.swing.JList< org.sleuthkit.autopsy.datamodel.hosts.ManageHostsDialog.HostListItem > hostList
void deleteButtonActionPerformed(java.awt.event.ActionEvent evt)
void closeButtonActionPerformed(java.awt.event.ActionEvent evt)

Copyright © 2012-2024 Sleuth Kit Labs. Generated on:
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.