input
stringlengths
10
828
output
stringlengths
5
107
public void object removed shared object client event evt try object obj client get object evt get id if obj instanceof notebook model boolean found false for enumeration e notebooks elements e has more elements found notebook record r notebook record e next element if r id equals evt get id notebooks remove element r notebook table revalidate notebook table repaint found true catch exception ex ex print stack trace
if a notebook is removed from the server remove it from our
public object get identifier return user get name host id
returns an object that uniquely identifies this user
public int get client id return id
returns a unique client id for the rare case where more than
public long get client id return id
returns a unique client id for the rare case where more than
private void check output writer calendar now calendar get instance if now get calendar year current year now get calendar week of year current week if out null try out flush out close catch ioexception ioe number format nf new decimal format nf set minimum integer digits 2 current year now get calendar year current week now get calendar week of year file log file new file directory server log current year nf format current week txt try out new buffered writer new file writer log file get absolute path true catch ioexception ioe ioe print stack trace
checks the name of the output stream against the current date time
public void flush logs log handler flush
flushes the server logs
public void flush inactive objects throws remote exception try server flush inactive objects catch exception e throw new remote exception e
flushes all inactive objects currently in memory
public void write throws remote exception try server write catch exception e throw new remote exception e
writes all modified objects in the cache
public int get active object count return server get active object count
returns the number of active unflushed objects in the cache
public int get modified object count return server get modified object count
returns the number of modified but unwritten objects in the cache
public void shutdown throws remote exception try flush inactive objects write flush logs catch exception e throw new remote exception e system out println not shutting down in server admin object shutdown new date system exit 0
shuts down the server after flushing and writing all objects
public long get idle millis return system current time millis log handler get last
returns the number of millisecs since the last object update
public int get client count return server get client count
returns the number of active clients that the server thinks it has
public void set status string status this status status if status null set internal status status
sets the status of all local users to the given string
public class get content type return bibliography entry list class
returns the class of content type that this factory supports
public string get content type name return name
returns the name of the content type in a form suitable for
public object id get new content object replicated object client client object id id null try object obj client get new object bibliography entry list class null id client get object id obj catch exception e e print stack trace return id
returns the object id of a new shared instance of the content type
public string get default section name return bibliography
returns a default name for a newly created section
public int get default location int current section int section count return section count 1
returns a default location within the section container for a new
private void reset title string buffer sb new string buffer model get name string config name config get name if config name null config name length 0 sb append sb append config get name sb append set title sb to string
reset the title to include the notebook name and the configuration
public list cell renderer get renderer properties entry boolean numberon boolean expandon compose pnumberon numberon compose pexpandon expandon renderer compose return renderer
return a component for rendering the entry e
public string get entry type return other
returns the name of this entry type e
public string get sort key properties entry return entry get property citation property
returns a key for sorting the given entry object
public string get title properties entry string title entry get property citation property empty if title length 15 title title substring 0 12 return title
returns a human readable short ish title for the entry suitable
public entry editor get form properties entry return new freeform entry panel entry
returns a component which implements a form for editing or creating
public string get html properties entry return entry get property citation property
returns html code for rendering the entry in a web page
public string get name return bibliography
returns a displayable name for this section
public void set icon icon icon
sets the icon for the type state of the section
public boolean is renamable return false
returns true if the section can be renamed
public boolean is access editable return false
returns true if the access permissions can be edited
public boolean is collapsed return false
should return true if the section is currently in a collapsed state
public component get view return bib
returns a component that the section container can use to display the
public void autosave not sure that we need to do anything here
tells the section to auto save without disturbing the user if
public list cell renderer get renderer properties entry boolean numberon boolean expandon compose wnumberon numberon compose wexpandon expandon renderer compose return renderer
return a component for rendering the entry e
public entry editor get form properties entry return new webpage entry panel entry
return a component which implements aform for editing or creating
public string get html properties entry string addr entry get property address property string title entry get property title property return a href addr title a
returns html code for rendering the entry in a web page
public properties get entry properties list item p new properties list item p put freeform entry ui citation property get citation p put freeform entry ui notes property get notes p put bibliography panel type property other return p
returns a properties object representing the entry as it currently
public notebook model get notebook model int row notebook model nm null try nm notebook model client get object get id row catch exception e return nm
returns the notebook model at the given row in the table
public class get content type return shared white board state class
returns the class of content type that this factory supports
public string get content type name return white board
returns the name of the content type in a form suitable for
public section get section return new white board section
returns an instance of a section implementation suitable for this
public string get default section name return white board
returns a default name for a newly created section
public int get default location int current section int section count return current section 1
returns a default location within the section container for a new
public void add property change listener property change listener listener content add property change listener listener
adds a java beans style property change listener
private void add modification notice n string owner n set type notebook modifications n set icon path edu vt cs linc vs demo notebook16 gif notice generator get instance owner add notice n
sets type and icon path then uses notice generator to add the notice
public void remove property change listener property change listener listener content remove property change listener listener
removes a java beans style property change listener
public void add save notice section s object id id notebook nb notebook map get s if nb null permissions p nb get permissions if p null p instanceof group notebook permissions notice n new notice n set text user registry get instance get real name edited section s get name in nb get model get name n set action class edu vt cs linc notice notebook notice action n set action parameter nb get model id notebook notice action delimiter id group g group group notebook permissions p get owner add modification n g get group id
adds a notice that the given section was changed
public string get name return content get name
returns a displayable name for this section
public void show object id content id if content id null int idx 1 for int i 0 i sections size idx 1 i section wrapper sw section wrapper sections element at i if sw get notebook entry get id equals content id idx i if idx 1 tabbed pane set selected index idx super show
shows the frame
public void set name string name content set name name
sets the name of this section
public void add remove section notice section s object id id notebook nb notebook map get s if nb null permissions p nb get permissions if p null p instanceof group notebook permissions notice n new notice n set text user registry get instance get real name removed section s get name in nb get model get name n set type notebook section removals n set icon path edu vt cs linc vs demo notebook16 gif group g group group notebook permissions p get owner notice generator get instance g get group id add notice n
adds a notice that the given section was added
public void set icon icon icon no oping this for now
sets the icon for the type state of the section
public void set cut action action a cut set delegate a
set the action for cutting
public void set copy action action a copy set delegate a
set the action for copying
public void set paste action action a paste set delegate a
set the action for pasting
public boolean is access editable this will likely need to be revisited return true
returns true if the access permissions can be edited
public void set clear action action a
set the action for clearing
public void set select all action action a
set the action for select all
public void set save action action a
set the action for save
public void collapse whiteboardpanel disconnect collapsed true
called when the section container needs to free resources
public void set revert action action a
set the action for revert if supported and appropriate
public void close for enumeration e sections elements e has more elements section wrapper e next element get section close set visible false
closes the notebook but leaves it in a state where the frame can
public void undoable edit happened undoable edit event e
adds an undoable edit to the containers undo manager
public void discard all edits
clears all edits from the containers undo manager
public void activate if collapsed reset content
called before the sections component as returned by get view is
public void autosave this is a no op for this page type
tells the section to auto save without disturbing the user if
public component get view return wrapper
returns a component that the section container can use to display the
public class get content type return shared plain document class
returns the class of content type that this factory supports
protected void update content shared value sv shared plain document spd shared plain document sv get value if spd null spd new shared plain document spd set document get text component get document sv set value spd set name untitled else if spd get document null get text component set document spd get document
updates the content of the text pane based on the object wrapped by
public string get content type name return plain text
returns the name of the content type in a form suitable for
public object id get new content object replicated object client client object id id null just create the shared value wrapper for now the section itself will be responsible for initializing it if necessary try plain text shared value obj plain text shared value client get new object plain text shared value class null id client get object id obj catch exception e e print stack trace return id
returns the object id of a new shared instance of the content type
public section get section return new plain text section
returns an instance of a section implementation suitable for this
public string get default section name return
returns a default name for a newly created section
public void object removed replicated object client event evt try object obj client get object evt get id int idx 1 for int i 0 i configs size idx 1 i if configs element at i equals evt get id idx i if idx 1 configs remove element at idx config table revalidate config table repaint catch exception ex ex print stack trace
need to handle config deletion here
public notebook entry get notebook entry return ne
returns the sections content object id
public void reset tab re calc this in case we ve moved int idx tabbed pane index of component section get view if idx 1 tabbed pane set icon at idx section get icon tabbed pane set title at idx section get name tabbed pane revalidate tabbed pane repaint
resets this sections tab label and icon
protected void save content shared value sv document doc get text component get document shared plain document shpd shared plain document sv get value shpd set document doc shpd update version sv update value shpd
saves content to the given shared value
public void show tell the section that it s active try section activate catch throwable t t print stack trace
should be called when the wrapper is made visible
protected void save content save content sv
saves content to the sections shared value
public void autosave if sv get owner null sv get owner equals client get user if has changed since autosave document doc get text component get document shared plain document shpd shared plain document sv get value shpd set document doc shpd update version sv update value shpd has changed since autosave false doc add document listener change listener
tells the section to auto save without disturbing the user if
private void attempt to lock string owner user registry get instance get real name fall back to the principal s name if we don t have a usable real name if owner null owner length 0 owner client get user get name sv set owner name owner sv set owner client get user new thread public void run if get text component null document doc get text component get document last document deep copy utility copy doc start
called to attempt to lock the section
private void unlock principal owner sv get owner if owner null owner equals client get user only save if something has actually changed if has changed save content sv notebook notice helper get instance add save notice this id if get text component null document doc get text component get document doc remove document listener change listener sv set owner null sv set owner name null container discard all edits
called to unlock the document updating the shared copy of the content
public string get name return sv get name
returns a displayable name for this section
public void set name string name object old sv get name sv set name name listeners fire property change name null name
sets the name of this section
public void set icon icon icon object old this icon this icon icon listeners fire property change icon old icon if old icon boolean locked new boolean icon green lock icon boolean old locked new boolean icon green lock icon listeners fire property change renamable old locked locked listeners fire property change deletable old locked locked
sets the icon for the type state of the section
public boolean is renamable return icon green lock icon
returns true if the section can be renamed
public void set copy action action a copy wrapper set action a
set the action for copying
public boolean is deletable return icon green lock icon
returns true if the section can be deleted
public boolean is access editable try permissions perms client get permissions id return perms instanceof section permissions section permissions perms get creator equals user registry get instance get primary user catch exception e return false
returns true if the access permissions can be edited
public vimage get icon string name vimage img vimage image cache get name if img null string file jp kyasu editor icons name gif img new vimage embedded htmleditor class get resource file image cache put name img return img awtresources get icon reads the image into a byte array further complicating matters return jp kyasu awt awtresources get icon get class file
overiding text editor
public void set paste action action a paste wrapper set action a
set the action for pasting
public void collapse if get text component null get text component get document remove undoable edit listener container
called when the section container needs to free resources
public void set clear action action a clear wrapper set action a
set the action for clearing
public void set select all action action a select all wrapper set action a
set the action for select all
public component get view return this
returns a component that the section container can use to display the
public void set save action action a save wrapper set action a
set the action for save
public void set revert action action a revert wrapper set action a
set the action for revert
protected component get editor component if pane container null pane container new jscroll pane public void set enabled boolean b super set enabled b get text component set enabled b get viewport add get text component return pane container
returns a component to be embedded in the section above the lock
protected jtext component get text component if pane null pane new jeditor pane return pane
returns the instance of jeditor pane that actually holds this
protected action get cut action if cut action null cut action make cut action return cut action
returns the action object for cut