/** * @Authors : Alexandre Correia - alexandrecorreia@celepar.pr.gov.br * Rodrigo Souza - rodsouza@celepar.pr.gov.br * @Date : 19/01/2009; * @Description : Executa JavaScript na pagina do Expresso. * */ package nu.fw.jeti.util; import netscape.javascript.*; import nu.fw.jeti.jabber.elements.Presence; public class JavaScriptServerExpresso { String [] param = new String[2]; public void cleanStatus() { param[0] = "cleanStatus"; param[1] = " "; ThreadJavascript tt = new ThreadJavascript("getArgumentsApplet", param[0], param[1]); tt.start(); } private void ExecuteJs(int Status) { param[0] = "getArgumentsApplet"; param[1] = (String)this.TypeStatus(Status); ThreadJavascript tt = new ThreadJavascript("getArgumentsApplet", param[0], param[1]); tt.start(); } public void getStatus(int Status) { this.ExecuteJs(Status); } private String TypeStatus(int Status) { String nameStatus = new String(""); switch (Status) { case Presence.AVAILABLE: nameStatus = "available"; break; case Presence.FREE_FOR_CHAT: nameStatus = "chat"; break; case Presence.AWAY: nameStatus = "away"; break; case Presence.XA: nameStatus = "xa"; break; case Presence.DND: nameStatus = "dnd"; break; case Presence.UNAVAILABLE: nameStatus = "unavailable"; break; case Presence.INVISIBLE: nameStatus = "invisible"; break; } return nameStatus; } public void writeSubStatus(int status, String message) { param[0] = "writeSubStatus"; param[1] = status + "-" + message; ThreadJavascript tt = new ThreadJavascript("getArgumentsApplet", param[0], param[1]); tt.start(); } } class ThreadJavascript extends Thread { private String name; private String[] param = new String[2]; public ThreadJavascript(String Name, String Param1, String Param2) { this.name = Name; this.param[0] = Param1; this.param[1] = Param2; } public void run() { JSObject winApplet = nu.fw.jeti.applet.Jeti.WINDOWAPPLET; winApplet.call(this.name, this.param); } }