/** * @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.JSObject; import nu.fw.jeti.jabber.elements.Presence; public class JavaScriptServerExpresso { public void cleanStatus() { final String[] param = new String[2]; param[0] = "cleanStatus"; param[1] = " "; Thread cleanSt = new Thread() { public void run() { try { if( nu.fw.jeti.applet.Jeti.WINDOWAPPLET != null ) { JSObject winApplet = nu.fw.jeti.applet.Jeti.WINDOWAPPLET; winApplet.call("getArgumentsApplet", param); } } catch(Exception e){} } }; cleanSt.start(); } private void ExecuteJs(int Status) { final String[] param = new String[2]; param[0] = "getArgumentsApplet"; param[1] = (String)this.TypeStatus(Status); Thread ExeJs = new Thread() { public void run() { try { if( nu.fw.jeti.applet.Jeti.WINDOWAPPLET != null ) { JSObject winApplet = nu.fw.jeti.applet.Jeti.WINDOWAPPLET; winApplet.call("getArgumentsApplet", param); } } catch(Exception e){} } }; ExeJs.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; } }