input
stringlengths
10
828
output
stringlengths
5
107
protected void reset script doing this from the awt thread is a bad idea if swing utilities is event dispatch thread runner run new runnable public void run do reset script else do reset script
called when the script need to be re set
public void set property string name string value java scriptable object object set property name value
utility method for setting a property in the scriptable object
public string get property string name return java scriptable object object get property name
utility method for returning a property in the scriptable object
public component view panel tempget component view panel string path string component view panel cvp null embedded object path p path copy replicated object client client context get replicated object client if embedded object path parse path p path string client cvp new component view panel context get component view source cvp set embedded object path p return cvp
a temporary method for returning a component view panel for a given
public void mouse entered mouse event evt object c evt get source if c instanceof jinternal frame try jinternal frame c set selected true catch property veto exception pve pve print stack trace
mouse listener methods for focus control
public void set script path string path object old this script path this script path path fire property change script path old script path
sets the path to the script that defines the objects behavior
public string get script path return script path
returns the path to the script that defines our behavior
public void set property string name string value super put new string map item name new string map item value
utility method that sets an arbitrary property using string map item
public void attach object obj call method add action listener action listener class obj call method add mouse listener mouse listener class obj call method add mouse motion listener mouse motion listener class obj
attaches the listener in as many ways as possible
public string get property string name string val null shared map item result get new string map item name if result null val result to string return val
utility method that returns an arbitrary property
private void call method string name class arg type object obj try method m obj get class get method name new class arg type m invoke obj new object this catch exception e
attempts to call the specified method on this object with this as
public raise formula left formula right super left right this left left this right right
creates a raise with the supplied left and right sub formlas
public bracket formula content super content this content content
creates a bracket containing the supplied formula
public big sthing formula bottom formula top formula right super bottom right top this bottom bottom this right right this top top
creates a big sthing with the supplied top bottom and right sub formulas
private formula builder
this class cannot be instantiated
public big vthing formula content super content this content content
creates a big vthing containing the supplied formula
public concatenation formula left formula right super left right parts new formula 2 parts 0 left parts 1 right
creates a concatenation of the two supplied formulas
public concatenation formula a formula b formula c super a b c parts new formula 3 parts 0 a parts 1 b parts 2 c
creates a concatenation of the three supplied formulas
public concatenation formula a formula b formula c formula d super a b c d parts new formula 4 parts 0 a parts 1 b parts 2 c parts 3 d
creates a concatenation of the four supplied formulas
public pile formula top formula bottom super top bottom this top top this bottom bottom
creates a pile with the supplied top and bottom sub formlas
public sideways mthing formula bottom formula top formula right super bottom right top this bottom bottom this right right this top top
creates a sideways mthing with the supplied top bottom and right sub formulas
protected formula formula a formula b formula c formula d if a null a set parent this if b null b set parent this if c null c set parent this if d null d set parent this
creates a formula with the parts a b c d
protected formula formula a formula b formula c this a b c null
creates a formula with the parts a b c
protected formula formula a formula b this a b null
creates a formula with the parts a b
protected formula formula a this a null
creates a formula with the part a
protected formula this null
creates a formula with no parts
private void set parent formula f the parent f
sets the parent of this formula
public formula get parent return the parent
returns the parent of this formula the formula that immediately contains this formula
private void init parser string initial expression my parser new graph parser allow implicit multiplication my parser set implicit mul true load the standard functions my parser add standard functions load the standard constants and complex variables functions my parser add standard constants my parser add complex add and initialize x to 0 my parser add variable x 0 set the string to the initial value set expression string initial expression
initializes the parser
public void set expression string string new string parse the new expression system out println new string new string exp my parser parse expression new string find out whether there was an error in the expression has error my parser has error if has error expr field set foreground color red else expr field set foreground color black changed function true
sets a new string to be used as function
public boolean get has error return has error
returns true if an error was encountered in parsing the expression
public void paint component graphics g dimensions get size paint white g paint axes g if has error paint curve g changed function false
draws the graph to the graphics object
public void set graph scale int s s math max 1 s scale x s scale y s
sets the scale both x and y
public jcombo box add form choice item string label jcombo box cb new jcombo box add form item create form item label cb return cb
adds a new jcombo box to this form group with the specified label
public jlabel add form label item string label text jlabel label new jlabel label text add form item create form item label return label
adds a new jlabel to this form group with the specified label
public jlabel add form centered label item string label text jlabel label new jlabel label text add form item create centered form item label return label
adds a new jlabel to this form group with the specified label
public jtext component add form text area item string label jtext area ta new jtext area add form item create form item label ta box layout y axis return ta
adds a new jtext area to this form group with the specified label
public void add button jbutton button add button add create glue
add the given jbutton to the box with needed spacing
public jtext component add form text field item string label jtext field tf new jtext field add form item create form item label tf return tf
adds a new jtext field to this form group with the specified label
public void write data to file byte data string file synchronized lock queue add element new data record data file lock notify all
writes the given block of data to the given file
private void purge streams hashtable w hashtable streams clone for enumeration e w keys e has more elements string file string e next element stream record sr stream record w get file if sr is idle try sr close streams remove file catch exception ioe ioe print stack trace
closes any streams that have been open and idle for more than
public void client login server event evt replicated object user user evt get user if users contains user users add element user
called when a client logs in
public void client logout server event evt replicated object user user evt get user users remove element user
called when a client logs out
public string get application name return pop3
returns the name of the application protocol that this handler
public string get application name return imap
returns the name of the application protocol that this handler
public comment get new comment return new comment client annotations
generates a new comment
public boolean equals object obj boolean result false if obj instanceof my poly line figure my poly line figure figure my poly line figure obj if figure f points size f points size result true for int i 0 i f points size i coordinate c1 coordinate figure f points element at i coordinate c2 coordinate f points element at i if c1 equals c2 result false return result
tests for equality of two figures
public void remove try discussion remove replication manager get instance stop sharing map client client delete object client get object id map catch exception e e print stack trace
deletes the shared data stored in our manufactured thing
public void link comments discussion comments comments this comments comments figure enumeration fe annotations figures figure figure null while fe has more elements figure null figure fe next figure system out println da figure retrieved figure for enumeration e table elements e has more elements system out println e next element for enumeration e table keys e has more elements system out println e next element annotation annotation annotation table get figure if annotation null system out println annotation null if comments null system out println comments null annotation link comments comments
initializes the comment list for each annotation
public void add point coordinate c f points add element c
adds a node to the list of points
public void property change property change event pce if pce get property name equals name frame null frame set title get name
if someone changes the name of this object
public figure find figure int x int y basic map view model view model system out println my shared drawing find figure called figure enumeration k figures reverse while k has more elements figure figure k next figure system out println my shared drawing figure instanceof my poly line figure if my standard drawing figure contains this point x y view model return figure return null
finds a top level figure
public void add comment string text comment c new comment client c set text text generic character get local character string list item sli new string list item c get object id to string table put sli c comments add item sli
adds a comment
public void mouse entered text area set background color light gray if link null link set background color light gray set background color light gray set border new line border color black 1 revalidate repaint
called by discussion comments view during linking process
public void add figure figure figure object id figure set attribute figure attribute id super add figure figure id
adds a figure and stores its object id with the figure
public annotation get new annotation return new annotation client
generates a new annotation
public void remove figure figure figure object figure id figure get attribute figure attribute system out println my shared drawing figureid to remove figure id super remove figure figure id remove figure figure enumeration fe figures figure removed figure null while fe has more elements removed figure null removed figure fe next figure if figure equals removed figure figure fig reference remove removed figure object fig id removed figure get attribute figure attribute drawing removed figure id break
removes a figure using a reference to the figure
public void add comment comment c string list item sli new string list item c get object id to string table put sli c comments add item sli
adds a comment
public vector draw translation graphics g system out println my shared drawing graphics color set vector drawn figures new vector figure enumeration k figures while k has more elements figure f k next figure g set color color f get attribute color system out println my shared drawing graphics color set color f get attribute color if f instanceof my standard drawing if my standard drawing f draw g drawn figures add element f system out println my shared drawing of drawn figures drawn figures size return drawn figures
overrides the draw routine in composite figure to handle
public object id get object id return client get object id comments
method to return the object id of the shared data object
public void invalidate basic map view model view model if listener null rectangle r display box view model r grow handle handlesize handle handlesize listener figure invalidated new figure change event this r
uses the view model to determine the figures current display box as it
public int get size return annotations get size
method to return the number of comments
public void mouse exited text area set background color white if link null link set background color white set background color white set border new line border color light gray 1 revalidate repaint
called by discussion comments view during linking process
public int get size return comments get size
method to return the number of comments
public annotation get item at int index string list item sli string list item annotations get item at index annotation a annotation table get sli return a
returns the annotation at the specified index
public void action performed action event evt if evt get action command equals attach parent start link comment this click location else if evt get action command equals create parent create new annotation comment
registers clicking on a popup menu with the appropriate action
public comment get item at int index string list item sli string list item comments get item at index comment c comment table get sli return c
returns the comment at the specified index
public figure add figure figure system out println my standard drawing view add called return drawing add figure
adds a figure to the drawing
public void remove try for int i 0 i comments get size i string list item sli string list item comments get item at i comment c comment table get sli c remove replication manager get instance stop sharing comments client client delete object client get object id comments catch exception e e print stack trace
deletes all the shared data
public void draw drawing graphics g system out println my standard drawing view draw drawing called drawn figures remove all elements translation graphics my graphics new translation graphics g view model if drawing instanceof my standard drawing my standard drawing drawing draw my graphics if drawing instanceof my shared drawing drawn figures my shared drawing drawing draw my graphics
overrides the way figures are drawn so that a translation graphics
public void draw all graphics g boolean is printing g instanceof print graphics if is printing draw handles g draw background g draw drawing g
overrides the drawing sequence so that highlighting occurs first
private void add comment comment c previous comment view c view new previous comment view c this c add dependent c view c get annotations add dependent c view vector add element c view comment display add c view revalidate repaint
creates a comment view and adds the view to the comment display
public void draw handles graphics g system out println my standard drawing view draw handles called translation graphics my graphics new translation graphics g view model for int i 0 i f selection size i my standard drawing d my standard drawing f selection element at i d highlight my graphics
highlights the current selection overriding the draw handles method
public void mouse up mouse event e int x int y view unfreeze view if f child null jdk1 1 doesn t guarantee mouse down mouse drag mouse up f child mouse up e x y f child null
handles mouse up events
public point translate point comment view comment view point comment view point point p new point p x comment view point x if vector contains comment view jviewport view port o scroll pane get viewport int height 0 for int i 0 i vector index of comment view i comment view c view comment view vector element at i height height c view get height p y comment view point y height view port get view position y else p y comment view point y o scroll pane get height return p
translates a point in a comment view to a point in
public void set drawing drawing d if drawing null clear selection drawing remove drawing change listener this drawing d if drawing null drawing add drawing change listener this check minimum size repaint
sets and installs another drawing in the view using overridden
public void display all annotations comment c parent display all annotations c
passes display all annotations command up to discussion view which
public vector get drawn figures return drawn figures
returns a list of currently drawn figures
public void erase links parent erase links
passes erase links command up to discussion view
public figure enumeration selection elements system out println my standard drawing view of selection elements f selection size return new figure enumerator f selection
gets an enumeration over the currently selected figures
public void create new annotation comment comment parent create new annotation comment
passes create new annotation command up to discussion view
public void set link tool link tool link tool this link tool link tool
sets the current link tool
public void update model model object data if model instanceof discussion comments if data instanceof comment add comment comment data
called when a comment is added
public void add to selection figure figure system out println my standard drawing view add to selection called if f selection contains figure f selection add element figure f selection handles null if figure instanceof my standard drawing my standard drawing figure invalidate view model else figure invalidate selection changed
adds a figure to the current selection
public void action performed action event evt temp comment set text temp comment view get text comments add comment temp comment temp comment null temp comment comments get new comment temp comment view new comment view temp comment this temp comment add dependent temp comment view n scroll pane set viewport view temp comment view revalidate repaint
called when submit button is pressed
public void remove from selection figure figure if f selection contains figure f selection remove element figure f selection handles null if figure instanceof my poly line figure my poly line figure figure invalidate view model else figure invalidate selection changed
removes a figure from the selection
public basic map view get map view return basic map view
method to return the basic map view
public zoom control get zoom control return zoom control
method to return the zoom control tool
public tool tip get tool tip return tool tip
method to return the tool tip area
public basic map view model get view model return basic map view model
method to return the view model
public void clear selection super clear selection figure figure figure enumeration k selection elements while k has more elements figure null figure k next figure if figure instanceof my standard drawing my standard drawing figure invalidate view model else if figure instanceof my poly line figure my poly line figure figure invalidate view model else figure invalidate f selection new vector f selection handles null selection changed
clears the current selection
public void state changed change event evt double zoom view model get min zoom view model get max zoom view model get min zoom slider get value 100 0 view model set zoom zoom last zoom value value
method to handle a slider change by dragging
public void load extras basic map data load road labels basic map data load grocery icons
method to load road labels and grocery icons
public void draw arc shape arc arc graphics graphics int arc index int point count double box arc get bounds int offsets new int arc get num parts offsets arc get part offsets for int i 0 i arc get num parts i if i 1 arc get num parts point count offsets i 1 offsets i else point count arc get num points offsets i shape point points arc get part points i if draw connections graphics points point count box if i 0 shapes drawn shapes drawn count arc index shapes drawn count
iterate through all of the parts drawing them if they intersect
public integer tool tip test coordinate p double threshold integer tool tip index null for int i 0 i shapes drawn count i if intersection p shapefile get shape shapes drawn i threshold tool tip index new integer shapes drawn i system out println road tool tip shapes drawn i i shapes drawn count return tool tip index
test to see if a tool tip goes with this data set
public layer tool get layer tool return layer tool
method to return the checkbox tool
private enumeration selection handles if f selection handles null f selection handles new vector figure enumeration k selection elements while k has more elements figure figure k next figure enumeration kk my standard drawing figure handles view model elements while kk has more elements f selection handles add element kk next element system out println my standard drawing view handles f selection handles size return f selection handles elements
gets an enumeration of the currently active handles
public void set point at point p int i will change f points set element at p i changed poly line point changed p i system out println set point at called
changes the position of a node
public string get attribute string int record string attributes null try attributes dbffile get string col column record record 1 catch exception e system err println caught exception reading data record e return attributes 0
method to read the attribute for one shape
public void start link figure f point p discussion annotations view editor start link f p
passes start link command from my selection tool up to