input stringlengths 10 828 | output stringlengths 5 107 |
|---|---|
public int check pending change change pending change new change int result throttled change broadcaster merge pending change should also throttle text size changes if pending instanceof figure edited change if figure edited change pending get figure id figure edited change new change get figure id result throttled change broadcaster discard pending change return result | returns discard pending change if the figure ids are the same or |
protected jmenu create arrow menu command menu menu new command menu arrow menu add new change attribute command none arrow mode new integer poly line figure arrow tip none view menu add new change attribute command at start arrow mode new integer poly line figure arrow tip start view menu add new change attribute command at end arrow mode new integer poly line figure arrow tip end view menu add new change attribute command at both arrow mode new integer poly line figure arrow tip both view return menu | creates the arrows menu |
public change merge changes change pending change new change composite change cc null if pending instanceof composite change cc composite change pending else cc new composite change cc add change pending this could be a little smarter and look for a change to the same figure cc add change new change return cc | called after check pending change |
public drawing drawing return shared drawing | attempting to use the replicated shared drawing object as the model |
public void set arc int width int height super set arc width height arc changed | sets the arcs witdh and height |
protected jmenu create font menu command menu menu new command menu font string fonts toolkit get default toolkit get font list check these string fonts serif sans serif dialog monospaced for int i 0 i fonts length i menu add new change attribute command fonts i font name fonts i view return menu | creates the fonts menus |
public void set point at point p int i super set point at p i polygon figure changed p i | changes the position of a node |
public void deactivate super deactivate standard drawing sd standard drawing drawing sd figure added created figure | when tool deactivates the tool is done interacting |
public void mouse up mouse event e int x int y figure f created figure created figure if f created figure is empty drawing remove f created figure f created figure null editor tool done | checks if the created figure is empty |
public rectangle get content bounds figure fig component content rectangle r fig display box dimension pref content get preferred size point ins get intersection r width r height rectangle bounds new rectangle ins x ins y math max 20 r width 2 ins x math max pref height r height 2 ins y system err println p get intersection r width r height r r if pref width bounds width int diff bounds width pref width bounds width pref width bounds x diff 2 return bounds | returns the preferred bounds for the given content with this decoration |
public void mouse down mouse event e int x int y figure pressed figure drawing find figure inside x y super mouse down e x y text holder text holder get typing target if f connected pressed figure null text holder null pressed figure text holder text holder connect pressed figure f connected true | if the pressed figure is a text holder it can be edited otherwise |
public void activate f connected false | if the pressed figure is a text holder it can be edited otherwise |
public void create overlay container container font font container add f edit widget 0 if font null workaround for bad font problem under 1 4 on osx problem is serialization if general text figure is mac font new font font get family font get style font get size f edit widget set font font f container container | creates the overlay for the given container using a |
public void add action listener action listener listener if f edit widget instanceof jtext field jtext field f edit widget add action listener listener | adds an action listener |
public void remove action listener action listener listener if f edit widget instanceof jtext field jtext field f edit widget remove action listener listener | remove an action listener |
public void set bounds rectangle r string text f edit widget set text text f edit widget set bounds r x r y r width r height if text length 20 f edit widget instanceof jtext field jtext field f edit widget set columns text length f edit widget set visible true f edit widget select all f edit widget request focus | positions the overlay |
protected jmenu create font style menu command menu menu new command menu font style menu add new change attribute command plain font style new integer font plain view menu add new change attribute command italic font style new integer font italic view menu add new change attribute command bold font style new integer font bold view return menu | creates the font style menu with entries plain italic bold |
public dimension get preferred size text holder figure rectangle r figure figure display box dimension pref f edit widget get preferred size font f figure get font r height math max r height pref height string txt figure get text if f edit widget instanceof jtext pane txt null txt length 0 r width 120 r height 60 if f null r height math max r height f get size 2 r width math max r width pref width return new dimension r width r height return f edit widget get preferred size | gets the preferred size of the overlay |
protected tool create handle tracker drawing view view handle handle return new constrained handle tracker view handle | factory method to create a handle tracker |
public void end overlay f container request focus if f edit widget null return f edit widget set visible false f edit widget remove key listener this f container remove f edit widget rectangle bounds f edit widget get bounds f container repaint bounds x bounds y bounds width bounds height | removes the overlay |
public class no op tool implements tool public void activate public void deactivate public void mouse down mouse event e int x int y public void mouse drag mouse event e int x int y public void mouse up mouse event e int x int y public void mouse move mouse event e int x int y public void key down key event evt int key | tool implementation that does nothing |
public void activate tool activate | activates the tool for the given view |
public void deactivate tool deactivate | deactivates the tool |
public void mouse down mouse event e int x int y last new point x y tool mouse down e x y | handles mouse down events in the drawing view |
public void set font font new font sanity check on font size if new font get size 4 super set font new font text figure changed new font | sets the font |
protected jmenu create font size menu command menu menu new command menu font size int sizes 9 10 12 14 18 24 36 48 72 for int i 0 i sizes length i menu add new change attribute command integer to string sizes i font size new integer sizes i view return menu | creates the font size menu |
public void mouse drag mouse event e int x int y if e is shift down point p get constrained point x y last line mode x p x y p y e new mouse event component e get source e get id e get when e get modifiers x y e get click count e is popup trigger tool mouse drag e x y | handles mouse drag events in the drawing view |
public void set text string new text super set text new text text figure content changed new text rectangle r text display box ratio double get font get size 1 0 r width r height | sets the text |
public void mouse up mouse event e int x int y tool mouse up e x y | handles mouse up in the drawing view |
public void mouse move mouse event e int x int y tool mouse move e x y | handles mouse moves if the mouse button is up |
public void key down key event evt int key tool key down evt key | handles key down events in the drawing view |
public void basic display box point origin point corner rectangle current super display box basic move by origin x current x origin y current y | implementing display box changes using basic move by |
public drawing view view if drawing view null create drawing view return drawing view | gets the editors drawing view |
public void set point at point p int i super set point at p i poly line figure point changed p i | changes the position of a node |
public void tool done super tool done standard drawing sd standard drawing drawing system err println ignoring sd figure added in figures general mdi we have to know the figure that was created sd figure added | overrides the tool done method of draw application |
public void set point at point p int i super set point at p i poly line figure point changed p i xs null ys null | changes the position of a node |
protected void update locator location if locator null point p locator locate observed figure rectangle b display box p x size width 2 b x p y size height 2 b y if p x 0 p y 0 will change basic move by p x p y figure display box changed | updates the location relative to the connected figure |
public object get attribute string name if f attributes null if f attributes has defined name return f attributes get name return null | returns the named attribute or null if a |
public void disconnect observed figure remove figure change listener this observed figure null locator null set attribute connected figure attribute null | disconnects the text figure |
protected void decorate graphics g if get start decoration null point p1 point f points element at 0 point p2 point f points element at 1 get start decoration draw g p1 x p1 y p2 x p2 y if get end decoration null point p3 point f points element at f points size 2 point p4 point f points element at f points size 1 get end decoration draw g p4 x p4 y p3 x p3 y | this is private in our superclass |
public drawing drawing return drawing object | gets the editors drawing |
public void mouse drag mouse event e int x int y point p new point e get x e get y if f connection null track connectors e x y if f connector target null p geom center f connector target display box f connection end point p x p y else if f edited connection null point pp new point x y f edited connection set point at pp f split point | adjust the created connection or split segment |
public void mouse up mouse event e int x int y figure c null if f start connector null c find target e get x e get y drawing if c null f end connector find connector e get x e get y c if f end connector null f connection connect start f start connector f connection connect end f end connector f connection update connection shared drawing drawing figure added f connection else if f connection null view remove f connection f connection null f start connector f end connector null editor tool done | connects the figures if the mouse is released over another |
public void deactivate super deactivate end edit fire figure added | terminates the editing of a text figure |
protected void fire figure added tell our drawing that a figure was added but only if it actually had text otherwise we end up with blanks that only exist remotely and not locally text holder tf text holder created figure if tf null tf get text null tf get text length 0 standard drawing sd standard drawing drawing sd figure added created figure | fires an event telling the drawing that a figure was added |
protected connection figure create connection connection figure f connection figure f prototype clone if attrs null f set attribute frame color attrs get default attribute frame color f set attribute fill color attrs get default attribute fill color f set attribute shared drawing stroke attribute attrs get default attribute shared drawing stroke attribute return f | creates the connection figure |
public void set attribute string name object value if f attributes null f attributes new figure attributes f attributes set name value super set attribute name value changed attribute changed name value | sets the named attribute to the new value |
public tool tool tool button tb drawing palette get selected tool button if tb null tb drawing palette get default tool button return tb tool | gets the editors current tool |
protected connection figure created figure return f connection | gets the currently created figure |
public void tool done drawing palette tool done | informs the editor that a tool has done its interaction |
public boolean start sharing object obj replicated object client client return start sharing client get object id obj client | looks up a replicator for the given object and invokes start sharing |
public void show status string string if status line null status line set text string | shows a status message in the editors user interface |
public boolean stop sharing object obj replicated object client client return stop sharing client get object id obj client | looks up a replicator for the given object and invokes stop sharing |
public void stop sharing all replicated object client client hashtable replicators hashtable clients get client if replicators null for enumeration e replicators keys e has more elements object id id object id e next element try object obj client get object id if obj null replicator record rec replicator record replicators get id rec replicator stop sharing obj client catch exception ex replicators clear clients remove client | stops sharing and drops references to all objects held by the given |
public component get thumbnail if thumbnail null thumbnail new thumbnail return thumbnail | returns a thumbnail view of the drawing |
public void set replicator class class object class class replicator class replicator classes put object class replicator class | sets a replicator class for a given class |
protected boolean is guest allowed http servlet request request boolean allowed false for int i 0 allowed i prefixes length i allowed request get request uri starts with prefixes i return allowed | returns true if guest access should be allowed on this request |
protected string get guest id http servlet request request return id | returns a guest user id |
protected string get guest password http servlet request request return password | returns a guest password |
public string get encrypted password string user return string ids to passwords get user | pull the encrypted password out of the hashtable |
public void activate if status line null boolean writable is writable cut set enabled cut is enabled writable copy set enabled copy is enabled writable paste set enabled paste is enabled writable select all set enabled true if drawing palette null set drawing palette get drawing palette on activate is writable view set drawing drawing | attempting to disable on activation |
public int get account count int sz 0 if ids to passwords null sz ids to passwords size return sz | returns the number of acccounts that the authenticator knows about |
public void property change property change event evt if table null table repaint | listen for property changes on one of the beans |
public void reset output writer calendar now calendar get instance if out null try out flush out close catch ioexception ioe current year now get calendar year int start date now get calendar date int start hour now get calendar hour of day int start minute now get calendar minute int am pm now get calendar am pm file log file new file directory server log current year start date start hour start minute txt try out new buffered writer new file writer log file get absolute path true catch ioexception ioe ioe print stack trace | closes current output stream and opens a new one with a file labeled |
public string get property string prop string result null if props null result string props get prop return result | returns a property set on authentication or null if the property |
public string to external form string buffer sb new string buffer sb append key sb append sb append host sb append sb append id return sb to string | returns a string that can be passed to from external form to recreate |
public void from external form string external form int idx1 external form index of int idx2 external form index of idx1 key long parse long external form substring 0 idx1 host external form substring idx1 1 idx2 id external form substring idx2 1 | initializes a new instance from the string returned by to external form |
public string to string return get class get name id host key | the string value of the principal contains the key value |
public void add server listener server listener listener listeners add server listener listener | adds a server listener |
public void remove server listener server listener listener listeners remove server listener listener | removes a server listener |
public void add outgoing edu vt cs collab cork impl http http server out synchronized out lock outgoing add element out out lock notify | adds an output stream to write a message to |
public void set shutdown action runnable shutdown action this shutdown action shutdown action | registers a handler to be called on shutdown |
protected object add client string user object pass object obj super add client user pass if obj instanceof basic principal basic principal bp basic principal obj if bp null bp get host null bp get host equals replicated object user unknown host not sure exactly what we want here to string will generally give us both the name and the ip so we ll start with that bp set host this host http return obj | overriding this to add host information since we have it from the |
public void release object object id id long client id no security checks are needed long cid new long client id client queue cq client queue clients get cid if cq null cq remove id id cid | removes the given object id from the clients queue so that no |
public boolean is client alive long client id for now we optimize for the local case i think this should always be safe boolean alive client id unique id if alive try alive server is client alive client id catch exception e e print stack trace return alive | returns true if the client with the given id is alive |
public void remove server listener server listener listener listeners remove element listener | removes a server listener |
public long get client id return unique id | returns the id of this client |
public permissions get permissions object id id return obj registry get permissions id | returns a shared objects permission object |
public void release object object id id throws ioexception we may need to explicitly clear the object s permissions too registry remove by id id server release object id unique id | drops the object with the given id from the local cache and tells |
public void check get principal p throws security exception | throws an exception if the given principal is not allowed to |
public void check delete principal p throws security exception | throws an exception if the given principal is not allowed to |
public void check change principal p change ch throws security exception | throws an exception if the given principal is not allowed to |
public authentication result check password string user object password authentication result result new authentication result authenticator auth failure user for enumeration e delegates elements e has more elements result get result authenticator auth failure return bad password result get result authenticator auth bad password result authenticator e next element check password user password return result | verify the users password |
public void set authenticator authenticator a if a null a new null authenticator this authenticator a | sets the authenticator that the server should use to check passwords |
public string get encrypted password string user string pass try attributes attrs context get attributes uid user password attr array attribute pattr attrs get password attr name if pattr null pass new string byte pattr get if pass starts with crypt pass pass substring 7 else pass catch exception e e print stack trace return pass | retrieves an ecrypted password from the server |
public authentication result check password string user object password return new authentication result authenticator auth success user | always returns true |
public authentication result check password string user object pass int result authenticator auth failure string enc get encrypted password user if enc null enc length 2 if enc equals crypt pass to string enc substring 0 2 result authenticator auth success else if return bad password result authenticator auth bad password return new authentication result result user | checks the users password |
public void check get principal p throws security exception permissions perms get delegate permissions if perms null perms check get p else check p | throws an exception if the given principal is not allowed to |
public void check delete principal p throws security exception permissions perms get delegate permissions if perms null perms check delete p else check p | throws an exception if the given principal is not allowed to |
public void check get principal p throws security exception if check prefix read prefix p super check get p else throw new security exception p get name cannot read this object | throws an exception if the given principal is not allowed to |
public class no op change implements change public void apply change object target | a change implementation that does nothing |
public void check delete principal p throws security exception if check prefix delete prefix p super check delete p else throw new security exception p get name cannot delete this object | throws an exception if the given principal is not allowed to |
public authentication result check password string user object password int result auth failure if user null object p map get user if p null if p to string equals password to string result auth success else result auth bad password return new authentication result result user | verify the users password |
public void check change principal p change ch throws security exception permissions perms get delegate permissions if perms null perms check change p ch else check p | throws an exception if the given principal is not allowed to |
public void check get principal p throws security exception check p | throws an exception if the given principal is not allowed to |
public void apply permissions replacement permissions perms object id id replace our local cached copy if we have one cache object record cor cache object record objects get id if cor null cor perms perms this ordering is less fair than that used by server impl hash map h hash map clients clone for iterator i h values iterator i has next client queue cq client queue i next try cq enqueue permissions replacement perms id catch throwable t t print stack trace | propagates a permissions change to downstream clients |
public void check change principal p change ch throws security exception if check prefix write prefix p super check change p ch else throw new security exception p get name cannot write to this object | throws an exception if the given principal is not allowed to |
public void check delete principal p throws security exception check p | throws an exception if the given principal is not allowed to |
public void check change principal p change ch throws security exception check p | throws an exception if the given principal is not allowed to |
public object id get id return id | returns the identifier of the changed object |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.