input
stringlengths 10
828
| output
stringlengths 5
107
|
|---|---|
private void do select make sure exactly one row is selected int rows m table get selected rows if rows length 1 return object urlo m model get value at rows 0 1 if urlo null urlo instanceof url return m success true m result url urlo dispose
|
the select action
|
public void dispose m table remove status listener this m color map remove listener m color change listener if m popup menu null m popup menu dispose m popup menu null
|
clean up this component
|
public void set required seats list ids the cleanest way to do this is to iterate through the seats marking each one required or optional to do this we ll need a set of required seats set required set new hash set ids boolean changes false for iterator it m seats iterator it has next seat seat seat it next boolean required required set contains seat get id if required seat is required seat set required required changes true if changes fire status listeners required seats changed
|
set the list of required seat ids
|
public translate token get translator return m translator
|
return the translator
|
protected void set seat and mark string seatid string mark yes we use on strings here it s okay if m current seat seatid m current self mark mark return string oldseat m current seat string oldmark m current self mark m current seat seatid m current self mark mark if oldmark m current self mark fire seat mark listeners m current self mark oldseat m current seat
|
we are now in the given seat with the given mark
|
public void set player seat string jid string seatid player player get player by jid jid if player null return seat seat if seatid null seat null else seat get seat seatid if seat null return seat oldseat player get seat may be null if oldseat seat return if oldseat null oldseat remove player player if seat null seat add player player player set seat seat fire status listeners player seat changed player oldseat seat
|
react to a player changing seats
|
public void adjust player color player player seat seat color col null if seat null col get seat color seat get id m color map change override color player get jid col
|
adjust the players color map color to the seat color if necessary
|
protected void create panels assert swing utilities is event dispatch thread not in ui thread for iterator it m table get seats it has next seat seat seat it next string id seat get id boolean flag seat is required seat is occupied seat is active seat panel panel new seat panel this id flag m seat panels put id panel
|
create the seat panel objects for all the seats
|
private void build ui grid bag constraints c jbutton button int row 0 button new jbutton icon help button set focus painted false button set border painted false button set content area filled false button set pressed icon icon help press c new grid bag constraints c gridx 0 c gridy row c weightx 1 c weighty 0 c anchor grid bag constraints center add button c button add action listener new action listener public void action performed action event ev boolean val prefs dialog get game show help prefs dialog set game show help val
|
create the permanent contents of the panel only the button
|
public map get seat marks map map synchronized m seat marks lock map m seat marks return map
|
get the map of string seat ids to string mark constants
|
protected void adjust one panel player player assert swing utilities is event dispatch thread not in ui thread adjust one panel player get seat
|
rebuild one panel empty it and recreate its list of names and
|
public void dispose remove all m player null m chart null
|
clean up the object
|
protected void adjust one panel seat seat assert swing utilities is event dispatch thread not in ui thread seat panel panel if seat null panel m unseat panel panel adjust names m table get unseated players else panel seat panel m seat panels get seat get id if panel null panel adjust names seat get players
|
rebuild one panel empty it and recreate its list of names and
|
protected void request seat change string jid string seatid assert swing utilities is event dispatch thread not in ui thread seat seat player player player m table get player by jid jid if player null return if seatid null m table get referee stand player m default callback null else if seatid any seat m table get referee sit player m default callback null else seat m table get seat seatid m table get referee sit player seat m default callback null
|
send a sit or stand request to the referee
|
protected void request remove bot string jid assert swing utilities is event dispatch thread not in ui thread m table get referee remove bot jid m default callback null
|
send a remove bot request to the referee
|
private void save window state m factory table saver save state m bot table saver save state
|
store the window state preferences
|
protected void do invite player string jid assert swing utilities is event dispatch thread not in ui thread string key m table get room table window win javolin app get sole javolin app get table window by room key win do invite dialog jid false
|
put up a dialog for inviting the given jid to this table
|
public void set player readiness string jid boolean flag player player get player by jid jid if player null return if player is ready flag return player set ready flag fire status listeners player ready player flag
|
react to a player becoming ready or unready
|
private void restore window state m factory table saver restore state m bot table saver restore state
|
load the window state preferences
|
protected void save window state preferences prefs preferences user node for package get class node nodename int pos m tab pane get selected index if pos 0 prefs put int tabpaneselection key pos
|
save the state of the tab pane
|
public void display popup menu player player int xpos int ypos point pt m panel get location on screen m popup menu adjust show player m panel xpos pt x ypos pt y
|
the pop up menu shared among all the items in the chart
|
protected void restore window state preferences prefs preferences user node for package get class node nodename int pos prefs get int tabpaneselection key 0 try m tab pane set selected index pos catch index out of bounds exception ex forget it
|
restore the state of the tab pane
|
public void add seat mark listener seat mark listener listener m seat mark listeners add listener
|
add a listener for changes of the players seat mark
|
public void set all players unready for iterator it m players iterator it has next player player player it next if player is ready player set ready false fire status listeners player ready player false
|
react to all players becoming unready
|
public void remove seat mark listener seat mark listener listener m seat mark listeners remove listener
|
remove a listener for changes of the players seat mark
|
public string get factory jid return m result factory
|
return the selected factory jid
|
protected void fire seat mark listeners string mark boolean bygame for iterator iter m seat mark listeners iterator iter has next seat mark listener iter next mark changed mark bygame
|
notify listeners of a seat mark change
|
public string get bot uri return m result bot
|
return the selected bot uri
|
public iterator get seats return m seats iterator
|
return an iterator of all the seat objects
|
private string get selected factory boolean savename string selfactory null string selname null if m factory fake row 0 int rows m factory table get selected rows if rows length 1 object jido m factory model get value at rows 0 1 if jido null jido instanceof string selfactory string jido selname string m factory model get value at rows 0 0 if savename selfactory null selname null preferences prefs preferences user node for package get class node nodenamefactorynames prefs put selfactory selname return selfactory
|
return the jid of the selected factory or null
|
public seat get seat string id return seat m seats by id get id
|
get a seat by id
|
private string get selected uri string selfactory string seluri null string selname null if m bot fake row 0 int rows m bot table get selected rows if rows length 1 object jido m bot model get value at rows 0 1 if jido null jido instanceof string seluri string jido selname string m bot model get value at rows 0 0 if selfactory null seluri null selname null preferences prefs preferences user node for package get class node nodenamebotnames prefs put selfactory seluri selname return seluri
|
return the uri of the selected bot or null
|
public void dispose m parlor null if m game table null if m table status listener null m game table remove status listener m table status listener m table status listener null m game table null
|
clean up this component
|
private void add factory string jid string name if m factory model find entry 1 jid 0 add it preferences prefs preferences user node for package get class node nodenamefactorynames if name null name equals name prefs get jid bot factory else prefs put jid name object row new object name jid m factory model add row row adjust factory table now select the jid we just added or found int sel m factory model find entry 1 jid if sel 0 m factory table set row selection interval sel sel
|
throw a new jid into the factory panel if it isnt there already
|
public iterator get occupied seats return new iterator filter m seats public boolean matches object obj seat seat seat obj return seat is occupied
|
return an iterator of seats which have players in them
|
public boolean verify game fee int fee if we re not in a fee authorization mode then no if m auth type auth fee return false if the fee value doesn t match then no if fee m auth fee return false if there is no check box then no if m pay check box null return false if the check box is greyed out then no if m pay check box is enabled return false if the check box is unchecked then no if m pay check box is selected return false ok then return true
|
check whether the player is really in agreement with paying the given
|
public iterator get visible seats return new iterator filter m seats public boolean matches object obj seat seat seat obj return seat is occupied seat is required
|
return an iterator of seats which are visible i
|
private string localize string key return localize localize menu it key
|
helper method for set up app menus
|
private void build ui set opaque true
|
create the permanent contents of the panel
|
public player get self player return m self player
|
return the player object which represents this client
|
private string localize title string key return localize localize menu key
|
helper method for set up app menus
|
protected void process mouse event mouse event ev if ev get id mouse event mouse clicked ev get click count 1 platform wrapper launch urlavailable m pay url null if launch urlat ev get x ev get y return super process mouse event ev
|
customized mouse handler that knows about hyperlinks
|
public boolean is self ready if m self player null return false return m self player is ready
|
is this client marked ready
|
private void set platform mnemonic jmenu item item int key if platform wrapper is running on mac item set mnemonic key
|
helper method for set up app menus
|
public boolean is self seated if m self player null return false return m self player get seat null
|
is this client seated
|
private void set accelerator jmenu item item int key platform independent accelerator key int key mask toolkit get default toolkit get menu shortcut key mask item set accelerator key stroke get key stroke key key mask
|
helper method for set up app menus
|
public void set handler string name rpchandler handler handlers put name handler
|
set the handler for rpc requests whose method names start with
|
public void set global handler rpchandler handler global handler handler
|
set the handler for rpc requests whose method names have no prefix
|
public void clear set global handler null handlers clear
|
clear all handlers
|
public void start service add responder this
|
start listening for requests
|
public void no such method fault string method name rpcresponse handler k k respond fault 404 no such method method name
|
send a fault response because there is no global handler
|
public void stop service remove responder this
|
stop listening for requests
|
public void stop synchronized m responders m responders clear m connection remove packet listener this synchronized services services remove m connection m connection null
|
stop listening for requests
|
protected void reject packet packet packet rpcresponse handler callback callback respond fault 609 rpc not handled
|
take appropriate action when no rpcresponder accepts a packet
|
static public void apply platform menu bar javolin app win new app menu bar win
|
the main roster window calls this
|
public void authenticate string username string host string password throws ioexception build the authentication stanza encoding the authentication text string buffer stanza new string buffer stanza append auth mechanism append get name stanza append xmlns urn ietf params xml ns xmpp sasl string authentication text get authentication text username host password if authentication text null try byte bytes authentication text get bytes utf 8 stanza append string utils encode base64 bytes catch java io unsupported encoding exception uee throw new ioexception encoding error in sasl stanza append auth send the authentication to the server get saslauthentication send stanza to string
|
builds and sends the tt auth tt stanza to the server
|
protected void update state string name roster packet item type type this name name this type type
|
updates the state of the entry with the new values
|
static public void apply platform menu bar table window win new app menu bar win
|
all table windows call this
|
static public void apply platform menu bar jframe win if platform wrapper is running on mac new app menu bar win
|
all generic windows call this
|
public roster entry get entry string user if user null return null roster entries never include a resource so remove the resource if it s a part of the xmpp address user string utils parse bare address user synchronized entries for iterator i entries iterator i has next roster entry entry roster entry i next if entry get user to lower case equals user to lower case return entry return null
|
returns the roster entry associated with the given xmpp address or
|
public boolean contains string user if user null return false roster entries never include a resource so remove the resource if it s a part of the xmpp address user string utils parse bare address user synchronized entries for iterator i entries iterator i has next roster entry entry roster entry i next if entry get user to lower case equals user to lower case return true return false
|
returns true if the specified xmpp address is an entry in this group
|
protected packet next packet synchronized queue while done queue size 0 try queue wait 2000 catch interrupted exception ie if queue size 0 return packet queue remove last else return null
|
returns the next available packet from the queue for writing
|
protected void open stream throws ioexception string buffer stream new string buffer stream append stream stream stream append to append connection service name append stream append xmlns jabber client stream append xmlns stream http etherx jabber org streams if connection instanceof sslxmppconnection old ssl connections should not include indicate xmpp 1 0 compliance stream append else stream append version 1 0 writer write stream to string writer flush
|
sends to the server a new stream element
|
public presence create presence presence type type return presence factory create type
|
create a presence packet via the factory
|
protected void set available saslmethods collection mechanisms this server mechanisms mechanisms
|
sets the available sasl mechanism reported by the server
|
protected void deliver message message because the collector and listeners are expecting a thread id with a specific value set the thread id on the message even though it probably never had one message set thread thread id message collector process packet message synchronized listeners for iterator i listeners iterator i has next weak reference listener ref weak reference i next packet listener listener if listener packet listener listener ref get null listener process packet message if the reference was cleared remove it from the set else i remove
|
delivers a message directly to this chat which will add the message
|
public presence create presence presence type type string status int priority presence mode mode return presence factory create type status priority mode
|
create a presence packet via the factory
|
protected void challenge received string challenge throws ioexception current mechanism challenge received challenge
|
the server is challenging the sasl authentication we just sent
|
public iterator get muc windows return m muc windows iterator
|
return the list of muc window objects we have open
|
protected void authenticated synchronized this sasl negotiated true wake up the thread that is waiting in the authenticate method notify
|
notification message saying that sasl authentication was successful
|
protected void authentication failed synchronized this sasl failed true wake up the thread that is waiting in the authenticate method notify
|
notification message saying that sasl authentication has failed
|
public roster entry get entry string user if user null return null synchronized entries for iterator i entries iterator i has next roster entry entry roster entry i next if entry get user to lower case equals user to lower case return entry return null
|
returns the roster entry associated with the given xmpp address or
|
protected void binding required synchronized this resource binded true wake up the thread that is waiting in the authenticate method notify
|
notification message saying that the server requires the client to bind a
|
protected void sessions supported session supported true
|
notification message saying that the server supports sessions
|
public boolean contains string user if user null return false synchronized entries for iterator i entries iterator i has next roster entry entry roster entry i next if entry get user to lower case equals user to lower case return true return false
|
returns true if the specified xmpp address is an entry in the roster
|
public iterator get table windows return m table windows iterator
|
return the list of table window objects we have open
|
public void shutdown notify connection listeners of the connection closing if done hasn t already been set if done array list listeners copy synchronized connection listeners make a copy since it s possible that a listener will be removed from the list listeners copy new array list connection listeners for iterator i listeners copy iterator i has next connection listener listener connection listener i next listener connection closed done true
|
shuts the packet reader down
|
public table window get table window by room string key for iterator it m table windows iterator it has next table window win table window it next if key equals win get room return win return null
|
return the table window which corresponds to the given room name muc
|
protected void notify connection error exception e done true connection close print the stack trace to help catch the problem e print stack trace notify connection listeners of the error array list listeners copy synchronized connection listeners make a copy since it s possible that a listener will be removed from the list listeners copy new array list connection listeners for iterator i listeners copy iterator i has next connection listener listener connection listener i next listener connection closed on error e
|
sends out a notification that there was an error with the connection
|
protected void reset parser throws xml pull parser exception parser set input connection reader
|
resets the parser using the latest connections reader
|
public table window get table window by referee string key for iterator it m table windows iterator it has next table window win table window it next string value win get referee jid if value null key equals value return win return null
|
return the table window which corresponds to the given referee jid
|
protected void fire roster changed event roster listener listeners null synchronized roster listeners listeners new roster listener roster listeners size roster listeners to array listeners for int i 0 i listeners length i listeners i roster modified
|
fires roster changed event to roster listeners
|
public void close set presence to offline packet writer send packet create presence presence type unavailable packet reader shutdown packet writer shutdown wait 150 ms for processes to clean up then shutdown try thread sleep 150 catch exception e ignore close down the readers and writers if reader null try reader close catch throwable ignore ignore reader null if writer null try writer close catch throwable ignore ignore writer null try socket close catch exception e ignore authenticated false connected false
|
closes the connection by setting presence to unavailable then closing the stream to
|
protected void fire roster presence event string user roster listener listeners null synchronized roster listeners listeners new roster listener roster listeners size roster listeners to array listeners for int i 0 i listeners length i listeners i presence changed user
|
fires roster presence changed event to roster listeners
|
protected collection parse mechanisms xml pull parser parser throws exception list mechanisms new array list boolean done false while done int event type parser next if event type xml pull parser start tag string element name parser get name if element name equals mechanism mechanisms add parser next text else if event type xml pull parser end tag if parser get name equals mechanisms done true return mechanisms
|
returns a collection of stings with the mechanisms included in the mechanisms stanza
|
protected void init register the new instance and associate it with the connection instances put connection this add a listener to the connection that removes the registered instance when the connection is closed connection add connection listener new connection listener public void connection closed unregister this instance since the connection has been closed instances remove connection public void connection closed on error exception e unregister this instance since the connection has been closed instances remove connection init packet listener
|
add the instance to the static table and set up the various listeners
|
public boolean is table open return m game viewport null
|
returns whether this table window is open
|
protected node information provider get node information provider string node if node null return null return node information provider node information providers get node
|
returns the node information provider responsible for providing information
|
public void set presence factory presence factory factory presence factory factory
|
set the connections presence factory
|
public presence factory get presence factory return presence factory
|
get the connections presence factory
|
public collection get search services throws xmppexception list search services new array list service discovery manager disco manager service discovery manager get instance for con discover items items disco manager discover items con get service name for iterator it items get items it has next discover items item item discover items item it next discover info info disco manager discover info item get entity id if info contains feature jabber iq search search services add item get entity id return search services
|
returns a collection of search services found on the server
|
public void set avatar url avatar url byte bytes new byte 0 try bytes get bytes avatar url catch ioexception e e print stack trace string encoded image string utils encode base64 bytes set field photo type image jpeg type binval encoded image binval
|
set the avatar for the vcard by specifying the url to the image
|
public void set avatar byte bytes string encoded image string utils encode base64 bytes set field photo type image jpeg type binval encoded image binval
|
specify the bytes for the avatar to use
|
protected void set answer form field field object value if is submit type throw new illegal state exception cannot set an answer if the form is not of type submit field reset values field add value value to string
|
sets a new object value to a given forms field
|
public void save xmppconnection connection check authenticated connection set type iq type set set from connection get user connection send packet this
|
save this v card for the user connected by connection
|
public void test anonymous login try xmppconnection conn1 new xmppconnection get host get port xmppconnection conn2 new xmppconnection get host get port try try to login anonymously conn1 login anonymously conn2 login anonymously catch xmppexception e e print stack trace fail e get message close the connection conn1 close conn2 close catch exception e e print stack trace fail e get message
|
check that the server handles anonymous users correctly
|
protected string get username int index if index get max connections throw new illegal argument exception index out of bounds return user index
|
returns the name of the user e
|
protected void fire invitation rejection listeners string invitee string reason invitation rejection listener listeners null synchronized invitation rejection listeners listeners new invitation rejection listener invitation rejection listeners size invitation rejection listeners to array listeners for int i 0 i listeners length i listeners i invitation declined invitee reason
|
fires invitation rejection listeners
|
protected boolean is form type return type form equals data form get type
|
returns true if the form is a form to fill out
|
protected boolean is submit type return type submit equals data form get type
|
returns true if the form is a form to submit
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.