package caida.otter;
import caida.tools.GridPanel;
import java.awt.*;
import java.util.Date;
/**************************************************************************
* File: Animator.java Name: Animator
* Goal: Used to control animation threads.
*
* Written: Bradley Huffaker
* For: Cooperative Association for Internet Data Anlalysis
***************************************************************************
***************************************************************************
By accessing this software, ANIMATOR, you are duly informed of and
agree to be bound by the conditions described below in this notice:
This software product, ANIMATOR, 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.
There is no charge for ANIMATOR software. You can redistribute it and/or
modify it under the terms of the GNU General Public License, v. 2 dated
June 1991 which is incorporated by reference herein. ANIMATOR 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 GNU GPL along with the ANIMATOR
program. Copies can also be obtained from
http://www.gnu.org/copyleft/gpl.html or by writing 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 Animator extends Frame implements FileInterface
, IOInterface, FormatInterface, DisplayInterface
{
// This will display the messages
TextField message = new TextField("Try loading two and three first"
+ " to test delay.");
// Lists the files to animate
List list = new List();
// Controling buttons
Button Choose = new Button("Select Files");
Button Load = new Button("Load Files");
Button Remove = new Button("Remove file");
Button Animate = new Button("Animate Files");
Button Stop = new Button("Stop");
Button Cancel = new Button("Cancel");
// What to color by
Choice Parameters = new Choice();
final String PARAM_DEFAULT = "Default";
// The input text fields for the animation delay and repeats
TextField delayField = new TextField("1000");
TextField timesField = new TextField("1");
// Keeps track of where it is a applet or not
boolean isApplet = false;
// Keeps track of weather the files have been loaded
boolean files_loaded =false;
// URL for a applet
// or
// directory for a standalone
String where;
// The thread that does the animation
Thread animationThread = null;
Thread loadThread;
// Selects the files to animate
FilesSelect filesSelect;
// The object which will display the animation
Display display;
// The assotiontive list
int num_left_to_load =0;
DList[] dlists;
Date[] dates;
// The list of AnimatorNodes
int largest_num_aNodes = 0;
int num_aNodes =0;
//??? fail to find declaration of AnimatorNode
// AnimatorNode[] aNodes;
Node[] aNodes;
Format format;
public Animator(Frame parent, Display display_input
,boolean isApplet_input, String where_input)
{
super("Animator");
display = display_input;
isApplet = isApplet_input;
where = where_input;
Parameters.addItem(PARAM_DEFAULT);
GridPanel buttons = new GridPanel();
buttons.add(Choose,0,0);
buttons.add(Load,1,0);
buttons.add(new Label(" ---Animation--- "),0,1,2,1
,GridPanel.BOTH, GridPanel.CENTER);
//------- For now animate is out
//buttons.add(Animate,0,2);
buttons.add(Stop,1,2);
buttons.add(new Label("Num. Times:"),0,3);
buttons.add(timesField,1,3);
buttons.add(new Label("Delay (millisec)"),0,4);
buttons.add(delayField,1,4);
buttons.add(Cancel,0,5,2,1,GridPanel.BOTH,GridPanel.CENTER);
setLayout(new BorderLayout());
add("North",new Label("Select files to animate"));
add("Center",list);
add("West",buttons.getContainer());
add("South",message);
pack();
/*
Dimension dim = getSize();
if (dim.width < 3*dim.height)
{
dim.width = 3*dim.height;
resize(dim.width,dim.height);
}
*/
}
public boolean handleEvent(Event event)
{
if (event.id == Event.ACTION_EVENT)
{
if (event.target == Choose)
Choose();
if (event.target == Load)
Load();
if (event.target == Stop)
Stop();
if (event.target == Animate)
Animate();
else if (event.target == Cancel)
{
Stop();
setFiles(new String[0]);
if (filesSelect != null)
filesSelect.hide();
hide();
}
}
else if (event.id == Event.LIST_SELECT)
{
int fileIndex = list.getSelectedIndex();
display.setFileIndex(fileIndex);
}
return super.handleEvent(event);
}
synchronized public void Choose()
{
largest_num_aNodes = 0;
aNodes = null;
if (filesSelect == null)
filesSelect = new FilesSelect(this,where);
files_loaded= false;
filesSelect.Show();
files_loaded = false;
}
synchronized public void Load()
{
if (list.countItems() <= 0)
{
message.setText("You must first select files to load.");
return;
}
// If it is not null then it is current loading something
if (loadThread != null)
return;
if (filesSelect == null)
return;
num_left_to_load = list.countItems();
dlists = new DList[num_left_to_load];
dates = new Date[num_left_to_load];
String dir = filesSelect.getPath();
String fullAddress = filesSelect.getFullAddress();
printMessage("Loading files .. ");
IOHandler ioHandler = new IOHandler(this);
loadThread = ioHandler;
String[] files = new String[num_left_to_load];
String[] dirs = new String[num_left_to_load];
for(int index=0; index < num_left_to_load; index++)
{
String file = list.getItem(index);
if (isApplet)
files[index] = fullAddress +"/" + file;
else
{
files[index] = file;
dirs[index] = dir;
}
}
if (isApplet)
ioHandler.Load(files);
else
ioHandler.Load(files,dirs);
}
synchronized public void Animate()
{
if (!files_loaded)
Load();
if (!files_loaded)
return;
int times = 1;
long delay = 1000;
boolean allOk = true;
try {
times = Integer.parseInt(timesField.getText());
} catch (NumberFormatException exc) {
message.setText("Time must be set to a long.");
return;
}
try {
delay = Long.parseLong(delayField.getText());
} catch (NumberFormatException exc) {
message.setText("Delay must be set to a integer.");
return;
}
if (animationThread != null)
animationThread.stop();
animationThread = new Thread(display);
display.setThread(animationThread);
display.setAnimator(this);
display.setSleep(delay);
display.setTimes(times);
animationThread.start();
}
public void Stop()
{
if (loadThread != null)
{
loadThread.stop();
loadThread = null;
}
if (animationThread != null)
{
animationThread.stop();
animationThread = null;
}
message.setText("Aborted");
}
// ------------------------- Runnable Stuff
public void setFileIndex(int fileIndex)
{
list.select(fileIndex);
}
// ------------------------- Format Stuff
public void finished()
{
printMessage("Finished Loading");
display.printMessage("Finished Loading");
display.repaintNodes();
files_loaded = true;
loadThread = null;
}
// ------------------------ IoInterface Stuff
synchronized public void FinishedLoading(DList dlist, ValuesGroup[] groups,
int file_format, Date[] dates_input)
{
dates = dates_input;
display.setListNoPaint(dlist);
display.setNumFiles(list.countItems());
display.setFileIndex(0);
list.select(0);
Format format = new Format(display);
loadThread = format;
format.setParent(this);
if (file_format == IOHandler.FIXED)
{
DList mylist = dlist.DList();
mylist.reset();
while(!mylist.end())
{
DisplayObject object = mylist.next();
if (object instanceof Node)
((Node)object).setXY();
}
}
else
{
if (file_format == IOHandler.GEO)
format.setMode(Format.SITE1);
else
format.setMode(Format.ROOT);
format.start();
}
display.setMap(false);
display.setResNoPaint(Display.LOW);
display.setShowMap(false);
display.setViewGeo(false);
files_loaded = true;
}
// Never implemented
synchronized public void FinishedSaving() {}
// Calls display.printmessage()
synchronized public void printMessage(String msg)
{
message.setText(msg);
}
//------------------------ FileInterface stuff
// Not ever used by this class
public void setFile(String string)
{
}
// Used by FilesSelect to pass back files
public void setFiles(String[] strings)
{
if (list.countItems() > 0)
list.clear();
for (int index=0;index < strings.length;index++)
list.addItem(strings[index]);
}
// Used by FilesSelect to get isApplet value
public boolean isApplet() { return isApplet; }
//-----------------------------------------------
public String[] getStrings()
{
String[] answer = new String[list.countItems()];
for(int i=0;i < answer.length;i++)
answer[i] = list.getItem(i);
return answer;
}
}
There was peace and harmony in the home of the Reverend Taylor. An air of neatness and prosperity was about his four-room adobe house. The mocking-bird that hung in a willow cage against the white wall, by the door, whistled sweet mimicry of the cheep of the little chickens in the back yard, and hopped to and fro and up and down on his perches, pecking at the red chili between the bars. From the corner of his eyes he could peek into the window, and it was bright with potted geraniums, white as the wall, or red as the chili, or pink as the little crumpled palm that patted against the glass to him. It was the first scene of the closing act of the tragic comedy of the Geronimo campaign. That wily old devil, weary temporarily of the bloodshed he had continued with more or less regularity for many years, had[Pg 297] sent word to the officers that he would meet them without their commands, in the Ca?on de los Embudos, across the border line, to discuss the terms of surrender. The officers had forthwith come, Crook yet hopeful that something might be accomplished by honesty and plain dealing; the others, for the most part, doubting. The two rival Ministers of England became every day more embittered against each other; and Bolingbroke grew more daring in his advances towards the Pretender, and towards measures only befitting a Stuart's reign. In order to please the High Church, whilst he was taking the surest measures to ruin it by introducing a popish prince, he consulted with Atterbury, and they agreed to bring in a Bill which should prevent Dissenters from educating their own children. This measure was sure to please the Hanoverian Tories, who were as averse from the Dissenters as the Whigs. Thus it would conciliate them and obtain their support at the[19] very moment that the chief authors of it were planning the ruin of their party. This Bill was called the Schism Bill, and enjoined that no person in Great Britain should keep any school, or act as tutor, who had not first subscribed the declaration to conform to the Church of England, and obtained a licence of the diocesan. Upon failure of so doing, the party might be committed to prison without bail; and no such licence was to be granted before the party produced a certificate of his having received the Sacrament according to the communion of the English Church within the last year, and of his having also subscribed the oaths of Allegiance and Supremacy. The earliest martial event of the year 1760 was the landing of Thurot, the French admiral, at Carrickfergus, on the 28th of February. He had been beating about between Scandinavia and Ireland till he had only three ships left, and but six hundred soldiers. But Carrickfergus being negligently garrisoned, Thurot made his way into the town and plundered it, but was soon obliged to abandon it. He was overtaken by Captain Elliot and three frigates before he had got out to sea, his ships were taken, he himself was killed, and his men were carried prisoners to Ramsey, in the Isle of Man. "I see you've got a cow here," said a large man wearing a dingy blue coat with a Captain's faded shoulder-straps. "I'm a Commissary, and it's my duty to take her." Suddenly they heard little Pete's voice calling: "Stop your ranting and tell me how the hogs got you." "Hold, Lord de Boteler," interrupted Father John, calmly; "the threat need not pass thy lips: I go; but before I depart I shall say, in spite of mortal tongue or mortal hand, that honor and true knighthood no longer preside in this hall, where four generations upheld them unsullied." HoME小明看看台湾视频发布
ENTER NUMBET 0017
i-gov.org.cn
www.nafa9.net.cn
www.lgcoin.com.cn
lama5.com.cn
duxu6.com.cn
huoxi6.com.cn
sijue6.net.cn
wujia4.com.cn
ad-sonic.com.cn
www.5chain.com.cn