package com.zaranux.os.client.programs;
import com.zaranux.client.api.AsyncCallback;
import com.zaranux.client.app.core.Proxy;
import com.zaranux.client.app.core.ZaranuxProxy;
import com.zaranux.os.client.core.Program;
import com.openmashupos.core.client.Mashlet;
public class NativeWebViewer extends Program {
private String path;
// paths
public NativeWebViewer(String[] args)
{
this.args = args;
setTitle("Viewer");
}
// default constructor for deserialization
public NativeWebViewer()
{
this(null);
}
//@Override
public void main(String[] args)
{
if(args.length <= 0)
{
//callback.onFailure(new Exception("Wrong parameters: path expected!"));
return;
}
path = args[0];
systemcall.delegate(null, "zaranux.com", null, -1, new AsyncCallback<String>()
{
public void onSuccess(String token)
{
String url = (path.startsWith("@") || path.startsWith("/@")) ? path : ("@" + path); // + "?" +"identity=" + systemcall.userid() + "&identityAssertion=" + token;
String identity = systemcall.userid();
if(identity != null && !identity.equals(""))
{
url += "?" +"identity=" + systemcall.userid() + "&identityAssertion=" + token;
}
setWidget(new Mashlet(url),750,480);
}
public void onFailure(Throwable caught)
{
setStatus("" + caught);
}
}
);
}
}