input
stringlengths
10
828
output
stringlengths
5
107
public void start sharing object obj replicated object client client super start sharing obj client obj id client get object id obj hash map spreadsheet model obj add table model listener this
attach listeners necessary to replicate the object
public double of double d int num param return math atan2 d 0 d 1
returns the value of the angle between d 0 and d 1
protected void add jtable jtable table add new jscroll pane table border layout center
may be overriden to add the jtable somewhere other than
public void action performed action event e string action e get action command if action equals copy do copy else if action equals paste do paste
selections comprising non adjacent cells result in invalid selection and
public void set table name string table name object old this table name this table name table name if listeners null listeners fire property change table name old table name
sets the name of the table object from which we take data
public void set table id string table id object old this table id this table id table id if listeners null listeners fire property change table id old table id
sets the unique id of the table object from which we take data
public string get column name int col string l get column label col if l null l length 0 l super get column name col return l
returns the column name
public object get value at int row int col java util hash map seen cells if model instanceof spreadsheet model col 0 return spreadsheet model model get value at row col 1 seen cells return get value at row col
returns the evaluated value of the cell throwing an illegal argument
public void add property change listener property change listener l if listeners null listeners new property change support this listeners add property change listener l
adds a property change listener
public object get raw value at int row int col if model instanceof spreadsheet model col 0 return spreadsheet model model get raw value at row col 1 return get value at row col
returns the raw un evaluated contents of the cell
public void remove property change listener property change listener l if listeners null listeners remove property change listener l
removes a property change listener
protected figure create figure component view rectangle figure f new component view rectangle figure last f return f
creates a new figure by prompting for selection of a sibling object
public void mouse up mouse event e int x int y if last null last is empty show dialog last super mouse up e x y
show the dialog on mouseup
protected figure create figure component view rectangle figure f null try replicated object client client context get replicated object client need to provide perms object obj client get new object cl null object id id client get object id obj thread dump stack disabled pending re design f new component view rectangle figure id catch exception e e print stack trace return f
creates a new figure by making a replicated object retrieving
public string get last modification time return get property last mod time attribute
returns the last known modification time of the object
public void set last modification time string last set property last mod time attribute last
sets the modification time for the object
public string get last modification user return get property last mod user attribute
returns the id of the last user who modified the object
public void set last modification user string user set property last mod user attribute user
sets the id of the last user who modified the object
public void set default page string default page object old this default page this default page default page fire property change default page old default page
sets the name of the default page for the site
public void set url info web site urlinfo url info if url info this url info object old this url info this url info url info fire property change url info old url info
sets the urlinfo object for the site
public web site urlinfo get url info return url info
returns the url info object for the site describing the url under
public void set template name string template object old this template this template template fire property change template name old template
sets the name of the template object
public string get template name return template
returns the stored name of the template
public string get template string temp name template if temp name null for int i 0 i get size temp name null i embedded object descriptor desc embedded object descriptor get item at i object id id desc get object id this is bad if id get classname index of template 1 temp name desc get name else if temp name equals none temp name null return temp name
returns the name of the sites template or null if no template
public void set extra jars string extra jar urls if extra jar urls this extra jars object old this extra jars this extra jars extra jar urls fire property change extra jars old extra jars
sets a comma delimited list of urls for extra jars required by
public string get extra jars return extra jars
returns a comma delimited list of urls for extra jars required by
public void set listing disabled boolean disable listing if disable listing this disable listing this disable listing disable listing fire property change listing disabled new boolean disable listing new boolean disable listing
set to true to disable directory listing
public boolean get listing disabled return disable listing
true if directory listing is disabled
public void set column count int column count int old this column count this column count column count fire property change column count old column count
sets the number of thumbnail columns in the album view
public void set thumbnail width int thumbnail width int old this thumbnail width this thumbnail width thumbnail width fire property change thumbnail width old thumbnail width
sets the width of thumbnails in pixels or 0 for automatic
public int get available object mode return available object mode
returns one of the set constants indicating how the set of
public void activate if active for figure enumeration fe drawing figures fe has more elements add figure fe next figure set active true
activates all cvs on the drawing
public void set available object mode int available object mode int old this available object mode this available object mode available object mode fire property change available object mode old available object mode
sets the available object mode indicating how the set of
public void deactivate if view null active component kids container view get components for int i 0 i kids length i if kids i instanceof component figure wrapper component figure wrapper kids i detach set active false
de activates all cvs on the drawing
public void action performed action event evt string com evt get action command int col idx com index of int slash idx com index of string m if col idx 0 col idx slash idx m com substring 0 col idx com com substring col idx 1 see if we ve switched from conf to full if mode equals conf m equals conf mode exp show show user frame open com m
handles opening a second client
protected void open string p open p mode
opens the object with the given path in the appropriate kind of
public void value changed list selection event evt if table get selected row count 0 renderer set background selection color renderer light color reset menu items
handle table selections
protected void open string p string mode if mode equals conf exp select path p embedded object path path exp get selected path conference frame cf new conference frame context path true true osd true dimension esz exp get size dimension csz cf get size cf set size new dimension math max csz width esz width math max csz height esz height cf show cf to front else exp open p
opens the object with the given path in the kind of
public void set selection mode int selection mode int old this selection mode this selection mode selection mode fire property change selection mode old selection mode
sets the selection mode used to pick an object from the set
public string get image tag parameters return image tag parameters
returns extra parameters e
public void set image tag parameters string image tag parameters object old this image tag parameters this image tag parameters image tag parameters fire property change image tag parameters old image tag parameters
sets extra parameters e
public void set link images boolean link images if link images this link images this link images link images fire property change link images new boolean link images new boolean link images
set to true if images should be embedded in a link to the
public void set template path embedded object path template path no op for this kind of template
tells the template object what its own path is
public void activate boolean writable is writable if is loaded footer null title prefix set enabled writable left sb set enabled writable right sb set enabled writable header set enabled writable footer set enabled writable
enable disable based on writability on activation
public int get footer mode return 0
returns an integer describing the items to be excluded from the
public void activate boolean writable is writable if is loaded footer null title prefix set enabled writable sb set enabled writable header set enabled writable footer set enabled writable
enable disable based on writability on activation
public void open final string path swing utilities invoke later new runnable public void run if select path path open selected object
selects and opens the given path in the awts thread
protected void add text pane jtext pane pane add new jscroll pane pane border layout center
may be overriden to add the text pane at an appropriate location
public void set template path embedded object path template path this template path template path
tells the template object what its own path is
protected component get event source component return get text pane
subclasses may override this to return another component to which
public void activate pane set editable is writable save set enabled save is enabled pane is editable revert set enabled save is enabled pane is editable
enable or disable the text pane on activation based on writability
public string filter for storage string content return filter content false
converts the text in the given string from presentation form
public string filter for presentation string content return filter content true
converts the text in the given string from storage form
public void set title string title object old this title this title title if listeners null listeners fire property change title old title
sets the title for the text block
public void set text string text object old this text this text text if listeners null listeners fire property change text old text
sets the text overwriting the current value
public string get text string result super get text content shared document doc get shared document if doc null try result doc get text 0 doc get length catch bad location exception ble ble print stack trace return result
returns the current text
private boolean is single tag line tag t string line boolean result false if t prefix starts with line line trim starts and ends like a tag if line ends with result line index of line length 1 return result
returns true if the line appears to consist of a single html tag
protected image get image object record rec drag gesture event evt component r table renderer get table cell renderer component table rec true true table get selected rows 0 0 return get image r
may be overriden by subclasses to return an image to show when
protected component get event source component return super get event source component
subclasses may override this to return another component to which
public void init shared drawing component view cv button new tool button this default drawing palette images borddec name tool cv show status name
initializes the palette with the given component view
public component get toolbar return null
returns the toolbar for the palette or null if no toolbar should be
public void init shared drawing component view cv this cv cv
initializes the palette with the given component view
public string get title return get state title
returns the title for the text block
public tool button get default tool button return button
returns the tool button for the default tool
public tool button get selected tool button return button
returns the tool button for the current selected tool
public void tool done ignore this
called when the tool says that it is done
public void palette user over palette button button boolean inside
the user moved the mouse over the palette entry
public void activate super activate boolean writable is writable if pane null pane set editable writable pane add key listener this if title item null title item set enabled writable this turns out to be really annoying when more than one of these is visible at any given time if pane null pane is editable pane get caret set visible true synchronous text data std synchronous text data object std add property change listener this if writable std set last editor name
overriding to call super
public void palette user selected palette button button
the user selected a palette entry
public component get toolbar jtool bar tb new jtool bar create tools tb cv create attribute tools tb tb set floatable toolbar floatable return tb
returns the toolbar for the palette or null if no toolbar should be
public void set title string title object old get state title state title title if listeners null listeners fire property change title old title
sets the title for the text block
protected tool button create selection tools jtool bar palette tool tool new constrained selection tool view tool button tb create tool button images sel selection tool tool palette add tb return tb
should return the default tool button
protected void add last editor label jlabel last editor add last editor border layout north
may be overriden by subclasses to attach the label with the last
public void render object obj graphics g viewpoint view figure obj draw g
renders the given object to a graphics object for the view
public class get type return figure class
returns the type of objects that renderable sets created by this
protected void remove last editor label jlabel last editor remove last editor
may be overriden by subclasses to dettach the label with the last
public string get last editor name return get state last
returns the name of the last user who edited this text
public tool button get default tool button return default tool
returns the tool button for the default tool
public tool button get selected tool button return selected tool
returns the tool button for the current selected tool
public void palette user over palette button button boolean inside if button instanceof tool button tool button tool button tool button button if inside cv show status tool button name else if selected tool null cv show status selected tool name else cv show status
the user moved the mouse over the palette entry
public void set last editor name string last object old get state last state last last if listeners null listeners fire property change last editor name old last
sets the name of the last user who edited this text
public figure get figure for id object figure id figure result null if figure id equals drawing figure id result this else figure enumeration fe figures while fe has more elements result null figure f fe next figure if figure id equals f get attribute figure id attribute result f return result
returns a reference to the figure with the given id
public void palette user selected palette button button set selected tool button button
the user selected a palette entry
public void add figure figure fig object id figure f fig figure enumeration fe figures boolean figure already exists false while fe has more elements figure already exists figure clone fe next figure figure already exists id equals clone get attribute figure id attribute if figure already exists if f instanceof general line connection general line connection glc general line connection f fix general line connection glc else if f instanceof general text figure fix connected text general text figure f add f figure added f dump after add
called when a figure is added
public void fix general line connection general line connection glc mutable chop box connector c mutable chop box connector glc start if c null c get owner null c get owner id null c set owner get figure for id c get owner id glc connect start c c mutable chop box connector glc end if c null c get owner null c get owner id null c set owner get figure for id c get owner id glc connect end c
called to reset the endpoints of a connection
public void fix connected text general text figure gtf string cid string gtf get attribute general text figure connected figure attribute if cid null figure f get figure for id cid if f null gtf connect f false
called to reset the connected figure of a connected text object
public void tool done go back to the default tool unless the current tool is stuck if default tool null selected tool null selected tool instanceof sticky tool button sticky tool button selected tool is stuck set selected default tool else selected tool tool deactivate selected tool tool activate
called when the tool says that it is done
public void border figure object figure id figure replacement figure enumeration fe figures while fe has more elements figure rep fig fe next figure if figure id equals rep fig get attribute figure id attribute replace rep fig replacement break
called when a figure is bordered
public void set drawing drawing d if d null d new standard drawing detach from the old one drawing current drawing if current null current instanceof shared drawing shared drawing current remove drawing container change listener this super set drawing d attach to the new one if d null d instanceof shared drawing shared drawing d add drawing container change listener this
attach ourselves as a drawing container change listener
public void group figures vector group add all group vector group of figures new vector string ids for int i 0 i group size i integer id integer group element at i figure enumeration fe figures figure f null while fe has more elements f null f fe next figure if id equals f get attribute figure id attribute group of figures add element figure f ids ids id break group figure g new group figure g add all group of figures g set attribute group figure ids figure reference add g figure added g
called when the group changes
public void figure added drawing container change event e repaint
repaint the view when a figure is added
public void figure removed drawing container change event e repaint
repaint the view when a figure is removed
public void drawing invalidated drawing change event e super drawing invalidated e it would be nice if we could find out whether or not this is really necessary a thread check would be a start repair damage
always repaint repair damage when the drawing is invalidated
public void dump string tag system err println tag for figure enumeration fe figures fe has more elements figure f fe next figure system err println f get attribute figure id attribute hash f hash code system err println system err println
utility method for dumping out the contents of the drawing in
public void repaint int x int y int w int h repainting the entire visible region would be the safest thing to do but this can be quite expensive rectangle vis get visible rect super repaint vis x vis y vis width vis height so i m just padding the repaint area a little super repaint x 75 y 75 w 150 h 150
overriding this version of repaint
public void draw background graphics g if is opaque super draw background g
draws the background
public object get default attribute string name object obj null if name equals text color name equals frame color obj pen color get color if obj null obj pen color none else if name equals fill color obj fill color get color if obj null obj fill color none else if name equals shared drawing stroke attribute basic stroke bs line style get stroke if bs equals shared drawing default stroke obj new stroke record bs return obj
returns an attribute value for a new figure
public object read object input stream in throws ioexception storable input si new storable input in shared drawing d shared drawing si read storable d read si return d
reads the object from the given stream
public void start sharing object obj replicated object client client if listener null listener new shared drawing listener client client get object id obj shared drawing obj add drawing container change listener listener shared drawing obj add figure change listener listener for figure enumeration e shared drawing obj figures e has more elements e next figure add figure change listener listener
attach listeners necessary to replicate the object
public void stop sharing object obj replicated object client client if listener null shared drawing obj remove figure change listener listener shared drawing obj remove drawing container change listener listener for figure enumeration e shared drawing obj figures e has more elements e next figure remove figure change listener listener listener null
detach any listeners attached in code start sharing code