use of netscape.javascript.JSObject in project screenbird by adamhub.
the class Launch method redirectWebPage.
/**
* Redirects to screenbird homepage.
*/
private void redirectWebPage() {
try {
JSObject win = JSObject.getWindow(this);
System.out.println("Redirecting window");
win.call("redirectHome", new Object[] {});
System.out.println("Redirected window");
} catch (Exception e) {
System.err.println(e);
System.err.println("Window already closed");
}
}
use of netscape.javascript.JSObject in project L42 by ElvisResearchGroup.
the class FrameFX method loadEventHandler.
private static void loadEventHandler() {
synchronized (dumbLock) {
Platform.runLater(() -> {
Object o = NestedPrivate.webEngine.executeScript("window.event42");
assert o instanceof JSObject : o.toString();
JSObject jsobj = (JSObject) o;
FrameFX.eventCollector = new EventCollected();
jsobj.setMember("eventCollector", eventCollector);
NestedPrivate.webEngine.setOnAlert(event -> {
Alert alert = new Alert(AlertType.INFORMATION);
alert.setTitle("Information Dialog");
alert.setHeaderText(null);
alert.setContentText(event.getData());
alert.showAndWait();
});
//<a href="" onclick="java.add('bla');">here</a>
synchronized (dumbLock) {
dumbLock.notifyAll();
}
});
waitForCompletion();
}
}
use of netscape.javascript.JSObject in project azure-tools-for-java by Microsoft.
the class JobViewFxUtil method startFx.
public static Object startFx(Object composite, final String webUrl, Object jobUtils) {
try {
Class compositeClass = Class.forName("org.eclipse.swt.widgets.Composite");
Class[] paramTypes = { compositeClass, int.class };
Constructor con = FXCanvas.class.getConstructor(paramTypes);
Object[] parames = { composite, 1 << 16 };
final FXCanvas canvas = (FXCanvas) con.newInstance(parames);
Platform.setImplicitExit(false);
Platform.runLater(new Runnable() {
@Override
public void run() {
final WebView webView = new WebView();
Scene scene = new Scene(webView);
canvas.setScene(scene);
WebEngine webEngine = webView.getEngine();
webEngine.load(webUrl);
webEngine.getLoadWorker().stateProperty().addListener(new ChangeListener<Worker.State>() {
@Override
public void changed(ObservableValue<? extends Worker.State> ov, Worker.State oldState, Worker.State newState) {
if (newState == Worker.State.SUCCEEDED) {
JSObject win = (JSObject) webEngine.executeScript("window");
win.setMember("JobUtils", new JobUtilsForEclipse());
}
}
});
}
});
return canvas;
} catch (Exception e) {
return e;
}
}
use of netscape.javascript.JSObject in project processdash by dtuma.
the class NSFieldManager method initialize.
public void initialize(Repository data, String dataPath) {
debug("initializing...");
// abort if we have been terminated.
if (!isRunning)
return;
this.data = data;
this.dataPath = dataPath;
debug("get document...");
JSObject document = (JSObject) window.getMember("document");
debug("get forms...");
JSObject formList = (JSObject) document.getMember("forms");
// Build an internal list of all the elements on the form. (This
// is necessary because otherwise Netscape 6 has a nasty habit of
// reordering the list of elements in the form as we initialize
// them.)
Vector allElements = new Vector();
if (formList != null) {
debug("get forms.length...");
int numForms = intValue(formList.getMember("length"));
for (int formIdx = 0; formIdx < numForms; formIdx++) {
debug("get a form...");
JSObject form = (JSObject) formList.getSlot(formIdx);
debug("get elements...");
JSObject elementList = (JSObject) form.getMember("elements");
debug("get elements.length...");
int numElements = intValue(elementList.getMember("length"));
for (int elementIdx = 0; elementIdx < numElements; elementIdx++) {
// abort if we have been terminated
if (!isRunning)
return;
debug("add an element...");
allElements.addElement(elementList.getSlot(elementIdx));
}
}
}
// Discard any previous input listeners
for (int i = inputListeners.size(); i-- > 0; ) destroyInputListener(i);
// Now walk through our list of elements and initialize them.
for (int elemNum = 0; elemNum < allElements.size(); elemNum++) {
// abort if we have been terminated
if (!isRunning)
return;
reinititializeFormElement((JSObject) allElements.elementAt(elemNum));
}
debug("initialization complete.");
}
use of netscape.javascript.JSObject in project screenbird by adamhub.
the class Launch method closeApplet.
/**
* Using the Javascript located on the web page which opened this applet,
* we close the web page; thus closing the applet with it.
*/
public boolean closeApplet() {
try {
JSObject win = JSObject.getWindow(this);
System.out.println("Closing window");
win.call("closeRecorderForm", new Object[] {});
System.out.println("Closed window");
} catch (Exception e) {
System.err.println(e);
System.err.println("Window already closed");
}
return false;
}
Aggregations