input
stringlengths
10
828
output
stringlengths
5
107
public void add window window w w add window listener this add component null w
adds a window and all of its current and future subcomponents to
public void encode image img output stream out jpeg encoder encoder new jpeg encoder img 100 out encoder compress the encoder subclasses frame so we have to make sure it gets cleaned up properly encoder set size 0 0 encoder set location 1000 1000 encoder set visible true encoder set visible false encoder dispose
encodes the given image to the given output stream
public void init string host get parameter host if host null host get code base get host int port 8050 string port string get parameter port if port string null port integer parse int port string init host port
pull host and port from applet parms
public void render component component c graphics g unfortunately print behavior is only delegated to peers of heavy weight components in print all not in print hence to get reasonable default behavior we have to check for this explicitly if is lightweight c c print g else c print all g
renders the component to the graphics object
public string get content type would image jfif be more appropriate return image jpeg
returns the mime type for this encoder image jpeg
public void remove window window w w remove window listener this remove component null w
removes a window and all of its current subcomponents from the tree
protected boolean is lightweight component c boolean result false class cl c get class class parent cl get superclass while parent null parent component class parent container class cl parent parent cl get superclass if cl null result cl get name starts with java awt return result
returns true if the component is lightweight
public void add user string user name string str create the user object user user new user user user name user name users add user str user user name label add str make the string length 70 for int i user user name length i 70 i str str label add str list set list data label total count total set text total total count
add the user to the list of online users
public string get description return an action that can be performed on an object
returns a description of the verb
public thing get parent return null
returns the parent of this verb
public void set icon object id icon object old this icon this icon icon listeners fire property change icon old icon
sets the object id for a shared file containing an icon for the
public void stop sharing object shared object replicated object client client space space space shared object space remove landmark list listener listener replication manager mgr replication manager get instance object id landmarks space get landmarks for int i 0 i landmarks length i try mgr stop sharing client get object landmarks i client catch exception e e print stack trace super stop sharing shared object client
detach any listeners attached in code start sharing code
public component get view return null
returns a component for viewing this thing or null if no view is
public object id get icon return icon
sets the object id for a shared file containing an icon for the
public float point get coordinates return null
returns the coordinates for this thing at its current location
public url get icon url url u null if icon null try u new url shared file get download url icon catch exception e e print stack trace return u
returns a url for downloading the landmarks icon or null if no
public void set coordinates float point coords no op d
sets the coordinates for this thing at its current location
public void set content object id content object old this content this content content listeners fire property change content old content
sets the content object id for the landmark
public boolean show url string url return show url url blank
attempts to show the url in a new browser window
public boolean show url string url string target boolean result false try url u new url url if is applet system out println context show url url applet context ac applet get applet context ac show document u target result true else new icebrowser loader url system out println context show url url not yet supported in applications catch exception e e print stack trace return result
attempts to show the url in a window or frame identified by the
public object id get content return content
returns the content of the landmark
public string get servlet root return edu vt cs collab cork models file shared file get file server root url
returns the root of the servlet engines urls
public float point get coordinates return coordinates
returns the coordinates for this landmark
public void set coordinates float point coordinates object old this coordinates this coordinates coordinates listeners fire property change coordinates old coordinates
sets the coordinates for this landmark
public object id get space id return space id
returns the space id for this landmark
public void set space id object id space id object old this space id this space id space id listeners fire property change space id old space id
sets the space id for this landmark
public void action performed action event evt tree path paths tree get selection model get selection paths for int i 0 i paths length i component comp component default mutable tree node paths i get last path component get user object image img image grabber grab comp capture frame cf new capture frame img
called when the capture button is pressed
protected chat message list get new chat message list return new chat
can be overriden by subclasses
public void value changed tree selection event evt capture set enabled tree get selection model get selection count 0
called when the tree selection changes
public void set description string description object old this description this description description listeners fire property change description old description
sets the human readable description of this landmark
public boolean get show label return false
dont show a label under the text box
public string get user identifier return id
return the user id
public float point get coordinates if coords null coords new float point return coords
returns the coordinates for this thing at its current location
public void set coordinates float point coords object old this coords this coords coords listeners fire property change coordinates old coords
sets the coordinates for this thing at its current location
public void set owner string owner id if owner null only let this happen once object old this owner this owner owner id listeners fire property change owner old owner
sets the owner id of this landmark
public boolean is recursive menu attachment allowed return false
returns true if the container can attach mouse listeners to show
public void set user identifier string id object old this id this id id fire property change user identifier old id
sets the user id
public boolean is dragging allowed return true
returns true if the component should be draggable
public void init string host get parameter host if host null host get code base get host int port 8050 string port string get parameter port if port string null port integer parse int port string init host port message set font input get font
pull host and port from applet parms
public void value changed javax swing event list selection event evt jlist list jlist evt get source int i 0 selected user no list get selected index system out println i selected user string label element at i system out println ea selected user selected user substring 0 8 system out println eb
this function is invoked if the selection is changed in the list
public object id get avatar id return avatar id
return the avatar id
public int get character count int character count 0 if character count 1 character count 0 thing things get things for int i 0 i things length i thing t things i if t instanceof generic character t instanceof shared thing shared thing t get object id get classname index of generic character 1 character count return character count
returns the number of users at this landmark
public void remove notify super remove notify
throw away the component when it is removed e
public abstract shared thing get abstract shared thing return clientside
returns the abstract shared thing used to manipulate this thing
public void set avatar id object id id object old this avatar id this avatar id id fire property change avatar id old id
sets the avatar id
public void init abstract shared thing if clientside null get machine setup manufactured thing this
forces the client side abstract shared thing classes to be loaded
public void set character count int character count int old this character count this character count math max character count 0 listeners fire property change character count new integer old new integer character count
sets the number of users at this landmark
public string to external form string buffer buf new string buffer if destination null buf append destination to string buf append delimiter if name null name door buf append name buf append delimiter if verbname null buf append verbname return buf to string
returns a string that can be parsed by code from external form code
protected machine get machine if machine null try object id machine id get machine id if machine id null machine machine generic thing container get replicated object client get object machine id else string machine classname get machine classname machine machine class for name machine classname new instance catch exception e e print stack trace return machine
returns the current machine retrieving it if necessary
public void from external form string external form if external form null int idx external form index of delimiter see if we have a destination id if idx 0 destination object id from string external form substring 0 idx see if we have a name int secondidx external form index of delimiter idx 1 if secondidx 1 secondidx external form length name external form substring idx 1 secondidx and a verb name if secondidx external form length 1 verbname external form substring secondidx 1
parses the string to initialize the item
public object id get preferences id return preferences id
returns the preferences id
public string get name string n super get name if n null n equals defined in object client null try thing t thing client get object id if t null n corrupted object else n t get name accessible true catch security exception se system out println security exception in shared thing get name se get message n permission denied accessible false catch exception e e print stack trace if n null n unnamed thing return n
return the human readable name of this thing
public float point get coordinates if coords null string x str string adapter get x coord id string y str string adapter get y coord id if x str null y str null coords new float point float value of x str float value float value of y str float value return coords
returns the coordinates for this thing at its current location
public void set coordinates float point coords object old this coords this coords coords fire property change coordinates old coords if coords null adapter put x coord id float to string coords x adapter put y coord id float to string coords y
sets the coordinates for this thing at its current location
public void set preferences id object id id object old this preferences id this preferences id id fire property change preferences id old id
sets the preferences id
public void set location generic thing container location object old this location this location location listeners fire property change location old location
sets our current location
public string get description string result machine m get machine if m null result m get product description return result
returns the human readable description of this manufactured thing
public generic thing container get location return location
returns our current location
public string get description string desc super get description if client null try thing t thing client get object id desc t get description accessible true catch security exception se accessible false catch exception e e print stack trace return desc
return the human readable description of this thing
protected generic character get local character return generic character get local character
returns the current local user i
public void start sharing object shared object replicated object client client super start sharing shared object client the superclass replicator handles prop changes now prop listener new property support client client get object id shared object generic character shared object add property change listener prop listener
attach listeners necessary to replicate the object
public void stop sharing object shared object replicated object client client the superclass replicator handles prop changes now generic character shared object remove property change listener prop listener super stop sharing shared object client
detach any listeners attached in code start sharing code
protected replicated object client get replicated object client this isn t the ideal place to get this but subclass constructors could need the replicated object client so we can t wait util verb invocation to get one return generic thing container get replicated object client
returns a replicated object client that can be used to access replicated
public void set name string name if this name null this name equals defined in object super set name name else object old get name object obj get object if obj null try property descriptor pd new property descriptor name obj get class object args name pd get write method invoke obj args catch exception e fire property change name old name
sets the human readable name of this thing
public void stop sharing object shared object replicated object client client thing things generic thing container shared object get things replication manager mgr replication manager get instance for int i 0 i things length i if replicating contents mgr stop sharing things i client things i remove property change listener thing replicator generic thing container shared object remove thing list listener listener super stop sharing shared object client
detach any listeners attached in code start sharing code
public void set property string key string value if value null thing get properties adapter remove key else thing get properties adapter put key value
sets the given property
public boolean is instance of class cl boolean result false if id null result id get classname equals cl get name return result
returns true if the shared thing points at an object of the given
public string get property string key return string thing get properties adapter get key
returns the given property or null if undefined
public enumeration get property keys enumeration e thing get properties adapter keys vector v new vector while e has more elements string key string e next element if key starts with thing system prefix v add element key return v elements
returns an enumeration of all known property keys
public object get object if obj null client null try obj client get object id accessible true catch exception e system out println warning no object for id in shared thing get object e to string e print stack trace accessible false return obj
returns the shared object retrieving it if necessary
public void clear property string key set property key null
clears the value associated with the given key
public string get last verb result return last verb result
returns the result of the last verb execution
public void set name string name thing set name name
gets the name of this object
public void start thread new thread this thread set name interact users thread start
this function starts the thread
public void rename string name string joption pane show input dialog null enter a new name rename joption pane question message null null get name if name null set name name
helper method for prompting the user to rename the component
public void remove generic thing container location get location if location null object id my id null try my id get replicated object client get object id thing catch exception e e print stack trace for int i 0 my id null i location get size i thing t location get thing at i if t null object id id get replicated object client get object id t if id equals my id remove remove new remove remove execute t location get replicated object client null deleted remove get last removed null return
remove this object from its current location
public void set last verb result string result object old last verb result this last verb result result fire property change last verb result old last verb result
sets the result of the last verb execution
public string get name if name null name equals unnamed thing return unnamed machine else return name
return the human readable name of this machine
public void run long chat lag system current time millis last chat time if chat lag 10000 bubble text set text timer remove runnable this else go gray gracefully color cur bubble text get foreground int val cur get red if val 0 val 8 val math min 255 val 2 we ve gone to white so we may as well stop if val 255 bubble text set text timer remove runnable this else cur new color val val val bubble text set foreground cur text panel repaint
called by the timer
public string get last chat string return last chat string
returns the last string entered into chat
public void set last chat string string ch object old last chat string this last chat string ch if last chat string null last chat string length 100 last chat string last chat string substring 0 96 fire property change last chat string old last chat string
sets the last character entered into chat
public void set product name string product name object old this product name this product name product name listeners fire property change product name old product name
sets the name of the kind of thing that this machine produces
public object id get landmark return landmark id
returns the object id of the landmark that the character is currently
public string get product class name return product class name
returns the name of the client side class that manipulates the product
public void set landmark object id landmark id object old this landmark id this landmark id landmark id fire property change landmark old landmark id
sets the object id of the landmark that the character is currently
public void run update idle status
called by idle timer to update our idle time
public void set product class name string product class name object old this product class name this product class name product class name listeners fire property change product class name old product class name
sets the name of the client side class that manipulates the product
public boolean is idle return idle time null
returns true if the user is currently idle
public string get product codebase return product codebase
returns the url of the codebase for client side classes that
public void set idle boolean idle boolean old is idle if old idle if idle this idle time new date else this idle time null fire property change idle new boolean old new boolean idle
sets the users idle state
public void set product codebase string product codebase object old this product codebase this product codebase product codebase listeners fire property change product codebase old product codebase
sets the url of the codebase for client side classes that
public string get name remove this return room chat name
return the human readable name of this thing
public string get description return list of chat messages
returns a human readable description of this thing
public string get machine icon path return machine icon
returns the path of the icon for this machine
public float point get coordinates return new float point 1 0f 1 0f
returns the coordinates for this thing at its current location
public void set coordinates float point coords no op d we don t actually have a position
sets the coordinates for this thing at its current location
public object read object input stream in throws ioexception manufactured thing mf new manufactured thing let the superclass do the rest of the work return read object in mf
overridden to create a manufactured thing rather than a shared map
public void set machine icon path string machine icon object old this machine icon this machine icon machine icon listeners fire property change machine icon path old machine icon
sets the path to the icon for this machine
public object read object input stream in throws ioexception preferences prefs new preferences let the superclass do the rest of the work return read object in prefs
overridden to create a preferences rather than a shared map
public void set last login date last login object old this last login this last login last login fire property change last login old last login
sets the timestamp of the users last login