agentland.device.intelliCD
Class ButtonAgent

java.lang.Object
  |
  +--java.rmi.server.RemoteObject
        |
        +--java.rmi.server.RemoteServer
              |
              +--java.rmi.server.UnicastRemoteObject
                    |
                    +--metaglue.AgentAgent
                          |
                          +--agentland.util.GoodAgent
                                |
                                +--agentland.device.intelliCD.ButtonAgent
All Implemented Interfaces:
Agent, Button, Good, MetagluePrimitives, Remote, Serializable, Spy
Direct Known Subclasses:
LittleButtonAgent

public class ButtonAgent
extends GoodAgent
implements Button

A graphical interface to the IntelliCD agent. This allows control over playing, stopping, and other functions, and uses the Jukebox agent to sort and edit the songs.

See Also:
Serialized Form

Inner classes inherited from class metaglue.AgentAgent
AgentAgent.Attribute
 
Field Summary
protected  String curDesignation
           
protected  Song curSong
           
protected  JPanel curSongPanel
           
protected  JTextArea curSongText
           
protected  JFrame frame
           
protected  int global_status
           
protected  JButton hateButton
           
protected  ImageIcon hateIcon
           
protected static String ICON_LOCATION
           
protected  Jukebox jukebox
           
protected  ImageIcon likeIcon
           
protected  ImageIcon loveIcon
           
protected  int my_status
           
protected  ImageIcon neutralIcon
           
protected  JTextArea nextBest
           
protected  JPanel nextBestPanel
           
protected  JScrollPane nextBestScroll
           
protected  boolean nextBestShown
           
protected  JButton nextBestToggle
           
protected  JButton pauseButton
           
protected static int PAUSED
           
protected  ImageIcon pauseIcon
           
protected  int play_state
           
protected  IntelliCD player
           
protected  ImageIcon playIcon
           
protected static int PLAYING
           
protected  Song selectedSong
           
protected  ImageIcon skullIcon
           
protected  JButton songTreeToggle
           
protected  JLabel statusLabel
           
protected  JButton stopButton
           
protected  ImageIcon stopIcon
           
protected static int STOPPED
           
protected  JLabel timer
           
protected  ImageIcon treeIcon
           
protected  boolean tunerControl
           
 
Fields inherited from class agentland.util.GoodAgent
alert, notifier
 
Fields inherited from class java.rmi.server.RemoteObject
ref
 
Fields inherited from interface metaglue.Agent
ALIVE, DIED, NO_METAGLUE, NOT_RUNNING, STARTING
 
Constructor Summary
ButtonAgent()
           
 
Method Summary
protected  void buildFrame()
          The main method for creating the button interface.
protected  IntelliCD getPlayer()
          Return the player
protected  void getYucky()
           
 void inform(Secret secret)
          Handle notifications from IntelliCD.
protected  void loadIcons()
          Loads all the icons.
protected  void nextBestShow(boolean sh)
           
protected  void reactionEvent(ReactionEvent e)
          Handle an incoming event describing user reactions.
protected  void sendYucky()
           
protected  void setSongInfo(String title, String author)
          Displays information about the current song.
protected  void showNextBest(int n)
           
protected  void songEvent(Secret secret, SongChangeEvent e)
          Handle an incoming song change.
protected  void startJukebox()
          Creates the jukebox interface.
protected  void timerEvent(TimerEvent e)
          Handle an incoming event updating the time left to play a song.
 String toString()
           
protected  void updateStatus()
          Updates the information on the current song.
 
Methods inherited from class agentland.util.GoodAgent
addSpy, addSpy, alert, alertString, beep, error, getAlert, getHistory, getHistoryElement, getPersistentMap, log, notify, removeSpy, removeSpy, resetHistory, safeRely, safeRely, safeRely, setNiceLogName, tell
 
Methods inherited from class metaglue.AgentAgent
addMonitor, alive, defrost, defrostAll, defrostBoolean, defrostInt, defrostString, fixAttribute, fixAttribute, freeze, freeze, freeze, freezeAll, freezeVar, getAgentID, getAttribute, getCatalog, getCatalogID, getDesignation, getFrozenVariables, getLogLevel, getMetaglueAgent, getMetaglueAgentID, getOccupation, getProperties, getSociety, log, log, lookupClass, obtainMetaglueAgent, obtainMetaglueAgent, obtainMetaglueAgentByName, reliesOn, reliesOn, reliesOn, reliesOnSynch, removeFrozen, replaceExceptionHandler, setFreezeName, setLogLevel, setLogName, shutdown, startAgent, startAgentOn, startAgentOn, startup, status, tiedTo, tiedTo, tiedTo, tiedTo, tieToDesignation, whereAreYou
 
Methods inherited from class java.rmi.server.UnicastRemoteObject
clone, exportObject, exportObject, exportObject, unexportObject
 
Methods inherited from class java.rmi.server.RemoteServer
getClientHost, getLog, setLog
 
Methods inherited from class java.rmi.server.RemoteObject
equals, getRef, hashCode, toStub
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface agentland.util.Good
getHistory, getHistoryElement, resetHistory
 
Methods inherited from interface metaglue.Agent
addMonitor, alive, getAgentID, getMetaglueAgentID, shutdown, startup, whereAreYou
 
Methods inherited from interface agentland.util.Spy
tell
 

Field Detail

ICON_LOCATION

protected static String ICON_LOCATION

frame

protected JFrame frame

player

protected IntelliCD player

curSongText

protected JTextArea curSongText

curSong

protected Song curSong

curSongPanel

protected JPanel curSongPanel

timer

protected JLabel timer

nextBest

protected JTextArea nextBest

nextBestScroll

protected JScrollPane nextBestScroll

nextBestToggle

protected JButton nextBestToggle

nextBestPanel

protected JPanel nextBestPanel

nextBestShown

protected boolean nextBestShown

songTreeToggle

protected JButton songTreeToggle

neutralIcon

protected ImageIcon neutralIcon

likeIcon

protected ImageIcon likeIcon

loveIcon

protected ImageIcon loveIcon

hateIcon

protected ImageIcon hateIcon

statusLabel

protected JLabel statusLabel

my_status

protected int my_status

global_status

protected int global_status

jukebox

protected Jukebox jukebox

curDesignation

protected String curDesignation

tunerControl

protected boolean tunerControl

selectedSong

protected Song selectedSong

STOPPED

protected static final int STOPPED

PLAYING

protected static final int PLAYING

PAUSED

protected static final int PAUSED

play_state

protected int play_state

pauseButton

protected JButton pauseButton

stopButton

protected JButton stopButton

hateButton

protected JButton hateButton

pauseIcon

protected ImageIcon pauseIcon

playIcon

protected ImageIcon playIcon

stopIcon

protected ImageIcon stopIcon

treeIcon

protected ImageIcon treeIcon

skullIcon

protected ImageIcon skullIcon
Constructor Detail

ButtonAgent

public ButtonAgent()
            throws RemoteException
Method Detail

loadIcons

protected void loadIcons()
Loads all the icons. The icons are loaded from a portable prefix, and the exact location can be tuned via the ICON_LOCATION parameter.

buildFrame

protected void buildFrame()
The main method for creating the button interface. This will assemble all the components into a JPanel and make it visible.

updateStatus

protected void updateStatus()
Updates the information on the current song.

setSongInfo

protected void setSongInfo(String title,
                           String author)
Displays information about the current song. In this agent, this does nothing, but subclasses might choose to override it.

sendYucky

protected void sendYucky()

getYucky

protected void getYucky()

getPlayer

protected IntelliCD getPlayer()
Return the player

startJukebox

protected void startJukebox()
                     throws RemoteException
Creates the jukebox interface. This is actually a separate agent, documented elsewhere.
See Also:
Jukebox

nextBestShow

protected void nextBestShow(boolean sh)

inform

public void inform(Secret secret)
            throws RemoteException
Handle notifications from IntelliCD.
Specified by:
inform in interface Button

songEvent

protected void songEvent(Secret secret,
                         SongChangeEvent e)
Handle an incoming song change.

reactionEvent

protected void reactionEvent(ReactionEvent e)
Handle an incoming event describing user reactions.

timerEvent

protected void timerEvent(TimerEvent e)
Handle an incoming event updating the time left to play a song.

showNextBest

protected void showNextBest(int n)

toString

public String toString()
Overrides:
toString in class RemoteObject