openfin / java-example Goto Github PK
View Code? Open in Web Editor NEWExamples for OpenFin Java adapter
License: MIT License
Examples for OpenFin Java adapter
License: MIT License
I'm following the example here (FDC3Example.java) in order to set up FDC3 communication for a proof of concept. I'm encountering an issue when trying to connect to the fdc3client using fdc3Client.connect
(line 185 in the example). This never gets to either the onSuccess
or the onError
. I ran into the same issue when trying to run the example. I was later going through the docs here, and I found the following wrt JS:
Enabling FDC3 is as simple as adding it to your application manifest.
Therefore, I created a quick test JS app, and added "fdc3Api": true
to my manifest.
Now my Java app works, since the FDC3 service has been launched and my Java app is able to connect to it.
As such, I am now looking for some way to enable the FDC3 service directly in the Java app. I have found references in the .NET API to enabling FDC3 (here and here), however have been unable to find anything of the sort for the Java API.
Any help would be appreciated, thanks in advance.
The below is an excerpt of my code. Entry point is launchOpenFin
at the bottom.
private void setUpFDC3IntentListener(String intent, JTextField textField) {
fdc3Client.addIntentListener(intent, new IntentListener() {
@Override
public JSONObject onIntent(Context context) {
textField.setText(String.format("Received Intent: %s", context.toString()));
context.put("comment", "Java rules");
return context;
}
}, new AckListener() {
@Override
public void onSuccess(Ack ack) {
if (ack.isSuccessful()) {
System.out.println("Registered intent listener");
} else {
System.out.println(String.format("Failed to register intent listener %s", ack.getReason()));
}
}
@Override
public void onError(Ack ack) {
System.out.println(String.format("Failed to register intent listener %s", ack.getReason()));
}
});
}
void setUpFDC3() {
OpenFinJavaDemo.this.fdc3Client = FDC3Client.getInstance(OpenFinJavaDemo.this.desktopConnection);
OpenFinJavaDemo.this.fdc3Client.connect(new AckListener() {
@Override
public void onSuccess(Ack ack) {
System.out.println(String.format("Connected to FDC3 service"));
setUpFDC3IntentListener(TOPIC, fdc3ReceiptTextField);
}
@Override
public void onError(Ack ack) {
System.out.println(String.format("Failed to Connect to FDC3 service"));
}
});
}
void launchOpenFin() throws DesktopIOException, IOException, DesktopException {
RuntimeConfiguration runtimeConfiguration = new RuntimeConfiguration();
runtimeConfiguration.setRuntimeVersion("16.83.53.26");
runtimeConfiguration.setAdditionalRuntimeArguments("--v=1");
this.desktopConnection = new DesktopConnection("openfin-IAB-java-demo");
this.desktopConnection.connect(runtimeConfiguration, new DesktopStateListener() {
@Override
public void onReady() {
OpenFinJavaDemo.this.openFinSystem = new OpenFinRuntime(OpenFinJavaDemo.this.desktopConnection);
try {
openFinSystem.addEventListener("application-platform-api-ready", e -> {
System.out.println("application-platform-api-ready: " + e.getEventObject());
String uuid = e.getEventObject().getString("uuid");
System.out.println(uuid);
}, null);
setUpFDC3();
} catch (DesktopException e) {
e.printStackTrace();
}
SwingUtilities.invokeLater(() -> {
OpenFinJavaDemo.this.glassPane.setVisible(false);
});
}
.
.
.
.
.
});
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.