package caida.otter; import java.awt.*; /***************************************************************************** * File: NameSearch.java Class: NameSearch * Goal: To provide a method for searching for machine that * contain a given string. * * Written: Bradley Huffaker (01/08/97) * * For: Cooperative Association for Internet Data Analysis ****************************************************************************** ****************************************************************************** * By accessing this software, NAMESEARCH, you are duly informed of * and agree to be bound by the conditions described below in * this notice: * * This software product, NAMESEARCH, is developed by Bradley Huffaker, and * copyrighted(C) 1998 by the University of California, San Diego (UCSD), * with all rights reserved. UCSD administers the NSF grant to CAIDA, * number NCR-9711092, under which this code was developed. * * NAMESEARCH is a free software. You can redistribute it and/or modify it * under the terms of the GNU Public License v.2 as * published by UCSD and is incorporated by reference herein. NAMESEARCH is * distributed WITHOUT ANY WARRANTY, IMPLIED OR EXPRESS, OF MERCHANTABILITY * OR FITNESS FOR A PARTICULAR PURPOSE or that the use of it will not * infringe on any third party's intellectual property rights. * * You should have received a copy of the CAIDA General Public * License v.1 along with the NAMESEARCH program. If for any reason you * have not received a copy, please write to * * University of California, San Diego * SDSC/CAIDA * 9500 Gilman Dr., MS-0505 * La Jolla, CA 92093 - 0505 USA * * Or contact INFO@CAIDA.ORG *****************************************************************************/ public class NameSearch extends Frame { // The display that contains the nodes to highlight Display display; // The text for search on TextField text; // The controling buttons Button Search; Button Cancel; public NameSearch(Display display_input) { super("Select by Name"); display = display_input; text = new TextField(); Search = new Button("Search"); Cancel = new Button("Cancel"); Label top_label = new Label("Will match all nodes that contain"); Label middle_label = new Label("string:"); // Formating Panel middle_panel = new Panel(); middle_panel.setLayout( new BorderLayout()); middle_panel.add("West",middle_label); middle_panel.add("Center",text); Panel bottom_panel = new Panel(); //bottom_panel.setLayout(new BorderLayout()); bottom_panel.setLayout(new FlowLayout()); bottom_panel.add(Search); bottom_panel.add(Cancel); setLayout(new BorderLayout()); add("North",top_label); add("Center",middle_panel); add("South",bottom_panel); pack(); } public boolean handleEvent(Event event) { if (event.id == Event.ACTION_EVENT) { if (event.target == Cancel) this.hide(); else if (event.target == Search || event.target == text) display.selectByName(text.getText()); } return super.handleEvent(event); } }