input
stringlengths
10
828
output
stringlengths
5
107
public void remove info message info infos remove info
remove message from infors
public void add warnings list message warnings add all messages warnings this warnings
add all mesasges in parameter into warnings
public void add infos list message infos add all messages infos this infos
add all mesasges in parameter into infos
public void add all messages messages added messages errors add all added messages get errors warnings add all added messages get warnings infos add all added messages get infos
add all messages in parameter to this messages
public boolean is public holiday date date if date null return false string date str date format format date if holidays null load holidays for item item holidays get items for term term item get terms string find date term get date if find date equals date str try date valid from valid format parse term get valid from date valid to valid format parse term get valid to if date after valid from date before valid to return true catch parse exception e return false return false
return list of values according to code
protected void do before cancel action model model request context request context object command bind exception errors return
overide this method in child when need to do some action before cancel
private void put bind errors to messages bind exception errors request context context for iterator it errors get all errors iterator it has next object error error object error it next context add error new message error get code error get arguments error get default message
put errors from binding spring into our messages on request
private void load list of values for string file name lov files resource resource get application context get resource file name try to load from xml try jaxbcontext jc jaxbcontext new instance cz softinel uaf lovs unmarshaller u jc create unmarshaller lovs loaded lovs lovs u unmarshal resource get file lovs add lovs loaded lovs get lovs catch jaxbexception e logger warn couldn t load list of values file file name e catch ioexception e logger warn couldn t load list of values file file name e lovs in map create lov map lovs
load all list of values
private void prepare map list string fields fields map new hash map string string for string key fields fields map put key null
prepare map according to list of fields
public detach composite add nullable detach detach if detach nothing detach null return this boolean detach now synchronized get lock detach now is ended if detach now if my single detach null my single detach detach else list detach detaches my detaches if detaches null my detaches detaches collections15 array list 4 detaches add detach if detach now assert check detach detach detach detach return this
adds another detach to this instance
public boolean cycle start boolean changed false synchronized this if my disposed changed my started my started true return changed
start the cycle
public void pre detach detach single object multiple synchronized get lock if my detach signalled return my detach signalled true single my single detach list detach detaches my detaches multiple detaches null null detaches to array if single null try single pre detach catch exception e on exception e if multiple null for object detachable multiple try detach detachable pre detach catch exception e on exception e
pass notification to all child detaches only once
public boolean is ended synchronized get lock return is detach started my detach signalled
checks if this instance has been detached or signalled to detach
public boolean cycle end return cycle end impl null
stops the cycle and ends last lifespan
public void dispose synchronized this my disposed true cycle end
disposes this lifecycle
public boolean is cycle started synchronized this return my started
checks if the lifecycle is in cycle started state
public boolean is disposed synchronized this return my disposed
checks if the lifecycle is disposed
public void pre detach
notifies this instance that detach is about to start
protected void on exception not null exception e if e instanceof interrupted exception throw new runtime interrupted exception interrupted exception e else log error e
handles exception that occured while calling
public detach get current cycle detach boolean restart synchronized this if my disposed my started return detach nothing else if my current lifespan null my current lifespan new detach composite return new current cycle detach this my current lifespan restart
creates an instance of detach that will stop currently running cycle
public boolean is detached synchronized get lock return my detached
checks if detach has been completed
public boolean is detach started synchronized get lock return my detached my detaching thread null
checks if detach has ever started
public detach get dispose detach synchronized this return my disposed detach nothing new dispose detach this
creates an instance of detach that will dispose this lifecycle
public void coordinate update coordinate coord send message out coord add route get route id coord get y coord get x coord get date string log new coordinate sent to client
sends newly recieved coordinate to map client
private connection connect connection link null try logging on to the my sql database server class for name properties get string my sql db driver string url jdbc mysql server database link driver manager get connection url properties get string my sql db username properties get string my sql db password catch class not found exception e e print stack trace catch sqlexception e e print stack trace return link
connect to the my sql database
public void stop logging gpshandler gps handler send message out realtime false gps handler get route if handler null handler remove coord listener this todo implement method
will stop the logging of a tracker
public void start logging gpshandler gps handler send message out realtime true gps handler get route if handler null handler remove coord listener this todo implement method
signals that tracking will start
protected void get users list user users db get user list string builder user string new string builder for user user users make msg delimiter user string user get user id user get username log sending user list user string to string send message out users get user string to string
sends a list of users to client
protected void set log file string file log file file
set the filename where log messages should be written
protected string get log file return log file
returns the file where log messages are written
public void store coordinate coordinate coord lagre koordinat i database coordinate update coord system out println route route coord coord db store coordinate route get route id coord
publish a coordinate to all coordinate listeners and then lets the
public void coordinate update coordinate coord for coord listener listener coord listeners listener coordinate update coord
notifies all listeners and send them the coordinate
public void coordinate buffer update string coords for coord listener listener coord listeners listener coordinate buffer update coords
notifies all listeners and send them the buffered coordinates
private void send client handler throws ioexception gpshandler handler new gpshandler server socket user server add gpshandler handler handler start handler
creates a new gps client handler and starts the gps handler thread
private void map client handler throws ioexception map handler handler new map handler server socket user server add map handler handler handler start handler
creates a new map client handler and starts the map handler thread
protected void log string message server log username message
for broadcasting messages to logfile
public void add coord listener coord listener listener coord listeners add listener
map handlers can add themselves to the listener list and recieve updates
public void remove coord listener coord listener listener coord listeners remove listener
map handlers can add themselves to the listener list and recieve updates
protected void start handler reader thread start
start the socket data reader thread
protected void message loop throws ioexception string message while true message in read line log message message if message null break else if message handler message break
checks for messages recieved from the server and pass them to the
public void add btn listener action listener listener track button add action listener listener new button add action listener listener cancel button add action listener listener
register a listener on the login button
protected void view routes string username list route routes db get routes username if routes size 0 send message view routes return build output route string string builder route string new string builder for route route routes make msg delimiter route string route get route id route get user id route get description route is active route get last update string route get visible gzipoutput stream zip out stream new gzipoutput stream output zip out stream write route string to string get bytes send message view routes route string log routes for user username has been sent
get all routes from a specific user send them to the reciever
protected void send message output stream out object message try send out message catch ioexception e log problem sending message to client e e print stack trace
uses method in protocol to send message to client
protected void send message object message send message out message
sends a message to the client
protected void send zip message output stream out object message todo implement zip compression method
sends compressed data to client
protected void log string message server log user get username message
this method is used for logging messages on the server
protected route get active route return route
returns the currently active route for this client handler
public void add menu listener action listener listener log on item add action listener listener log off item add action listener listener exit item add action listener listener general item add action listener listener show routes item add action listener listener
adds the menulisteners
public void set route box list route routes route box remove all items for route route routes route box add item route
adds route elements to route box
public void register form form forms add form main panel add form get form component form get name if current form null current form form
registers a form
public route get route return route route box get selected item
returns selected element in route box
public void add btn listener action listener listener save button add action listener listener cancel button add action listener listener
register a listener on the login button
public void show form form form current form update model model current form form current form refresh view card layout show main panel form get name
shows the given form
public void set status msg string msg view set status msg msg
sets the status msg
public void add gpsbtn listener action listener listener gps button add action listener listener
register a listener on the gps button
public boolean show log off dialog int confirm joption pane show confirm dialog this do you want to log off log off joption pane yes no option return confirm 0
shows dialog to log off user have to confirm
public boolean transfer buffered dialog object options continiue buffering transfer buffered int n joption pane show option dialog null buffered coordinates exists what would you like to do buffered coordinates exists joption pane yes no cancel option joption pane question message null options options 1 return n 0
dialog created to ask if transfer buffered coordinates
public void show error dialog string heading string warning joption pane show message dialog null warning heading joption pane error message
shows a warning dialog
public void show info dialog string head string info view show info dialog head info
creates an info dialog with the give heading and info
public void show info dialog string head string info joption pane show message dialog null info head joption pane information message
shows a info dialog
public string get new route desc return new desc get text
gets the description of the new route created
public void add spinner listener change listener listener interval spinner add change listener listener
adds an changelistener for the intervalspinner
public void set status msg string msg status bar set text utils date to string calendar get instance get time hh mm ss msg
set the text of the status bar
public boolean get compression return compress box is selected
checks if the compressbox is selected
public route get new route return new route
gets the new route
public string get port return string port box get selected item
gets the selected port
public void show login form show form login
shows the login form
public boolean get auto transfer return auto transfer box is selected
checks if the autotransfer box is selected
public void choose default port if model get port null model get com ports iterator has next model set port model get com ports iterator next
set a default port should be called in the constructor of
public void add timer listener action listener listener timer add action listener listener
adds an actionlistener for the timer
public void show settings form show form settings
shows the settings form
public void show routes view show routes form
show the route form
public void add btn listener action listener listener login button add action listener listener cancel button add action listener listener
register a listener on the login button
public void show main form show form main
shows the main form
public jcomponent get form component return main panel
gets the form component
public void show routes form show form routes
shows the route form
public void add server btn listener action listener listener server button add action listener listener
register a listener on the server button
public void enable route item boolean enable show routes item set enabled enable
enables disables the route item in the menubar
public void enable log off item boolean enable log off item set enabled enable
enables disables the log off item in the menubar
public void enable log on item boolean enable log on item set enabled enable
enables disables the log on item in the menubar
public form get current form return current form
gets the current form
public int get port return integer parse int port field get text
get the active port
public form get login form return login
gets the form registered as login form
public string get hostname return host field get text
get the hostname value
public void show error dialog string heading string error image icon icon joption pane show message dialog null error heading joption pane information message icon
generates and shows an error dialog
public void show main view show main form
shows the main form
public void store tmp coords coordinate coord throws ioexception string message make msg coord get y coord get x coord get date string creates the buffer file if it doesent exist if output file exists output file create new file stores the message to bufferfile print writer tmp out new print writer new file writer output file true tmp out print message tmp out flush
stores temporary coordinates while without internet connection
private void show error dialog string heading string error image icon icon view show error dialog heading error icon
shows an error dialog
public void open file string file throws file not found exception out w new output stream writer new file output stream nmeaout txt
opens the given file
public void logon string user string pass throws ioexception logon sendclient user pass
logon a user of the type
public void send coord coordinate coord send message coord add coord get y coord get x coord get date string
sends coordinates to server
public void write gpsdata string data throws ioexception write all data from device to file out w write data n
write data from gps reciever to a file
public int get interval int interval integer parse int string interval spinner get value string builder msg new string builder msg append interval changed to if interval 60 0 msg append interval 60 if interval 60 1 msg append minutes else msg append minute else msg append interval secounds set status msg msg to string return interval
gets the interval to get data from the gps unit
public void lock route int route send message route lock route
for locking route when it is finnished
public void logon string user string pass throws ioexception socket logon user pass
logs on to the server
public void set status msg string status view set status msg status
set the status message on the status bar
public boolean has signal if the time is specified the gps unit has enough data to get a fixed possition if nmea get field 1 length 6 return true else return false
checks wheter the gps has connection to the satellites
protected void route created int route id for gpssocket listener listener listeners try listener route created route id catch runtime exception e broken listener listener e
publish a route created message event to all listeners
public void add gpslistener gpslistener listener gps add listener listener
register a listener for gps device events
public void increase recieved field num coords field set text num recieved coordinates
increases the number of recieved coordinates