-
Notifications
You must be signed in to change notification settings - Fork 1
AddonDevelopment
VANTED is an extendible software. Additional functionality can be provided by Add-ons. These are libraries that can be added during runtime to provide new algorithms, user-interfaces and visual network components.
Add-ons can use the provided APIs to easily access and change attributes, setup and call algorithms, etc.
To start development it is a good idea to download the example-addon code from here.
The following explains the most important parts of the directory structure, necessary files and some method calls of the VANTED API.
-
It is, as the VANTED project itself, already an eclipse project. After you have unzipped the file, copy the directory to the workspace directory, where the VANTED source resides.
-
Import the Add-on example project into the VANTED workspace.
- Get the
vantedandvanted-lib-repositoryrepos (as of Oct. 2020, they can be found on GitHub) - Create a new IntelliJ project
- Go to File → Project Structure, remove the default module that was created with the project
- Set up a module for Vanted: Click
+→ Import Module, pick thevanteddirectory- If asked to use existing Eclipse project information, do that. Proceed with defaults.
- Set up a module for the libraries
- Go to the Libraries tab (left sidebar)
- Click
+→ Java, pick thevanted-lib-repositorydirectory - In Modules → vanted → Dependencies, make sure that
-
vanted-lib-repositoryis listed and - that "Export" is checked
-
Notes:
- Tests can be included likewise
- On MacOS with SDK version 11, the class
PanScrollZoomDemohad to be excluded from compilation because a required dependency could not be found (probably Windows-specific?) — In build error dialog, right-click and chose "Exclude from compile" - After setup, the run configuration that is created automatically when launching a
mainmethod via the right-click menu should work. There might be issues with some packages but the auto-suggested fix (—add-exports) should work. This will modify.idea/compiler.xml. - Any instance of Vanted (particularly these invoked through an IDE) will look for addon jars in
%appdata%\Roaming\VANTED\addonsand use these — don't get confused.
- Plugins can be included as modules, like above (even multiple ones) — In Project Structure → Modules → [Addon Module] → Dependencies, add the
vantedmodule to be a dependency for your plugin. Set the scope of the depency (rightmost column) to "Provided".
-
Create a new module (e.g. "dev-utilities").
-
Add the modules of your plugins as depencies of this new module (as described above).
-
Copy/link the addon xml files to the
resourcesdirectory. -
Put the below code snippet somewhere
import de.ipk_gatersleben.ag_nw.graffiti.plugins.gui.webstart.Main; public class StartWithBothAddons { public static void main(String[] args) { Main.startVantedExt(args, new String[] { "first-add-on.xml", "second-add-on.xml" }); } }
Right-click into the method and select "Run..."
Likewise, you can create a
mainmethod that runs VANTED with no addons (e.g. for testing your packaged JARs).import de.ipk_gatersleben.ag_nw.graffiti.plugins.gui.webstart.Main; public class StartWithNoAddons { public static void main(String[] args) { Main.startVantedExt(args, new String[0]); } }
The way to go is
- Project Structure
- Artifacts
- Plus icon (
+) - Jar
- From Module with Dependencies. You can leave everything to defaults. You do not need to set a Main Class in the subsequent dialog.
Take care that the name of the resulting jar file is the same as that of the plugin XML file. You can change the name of the resulting jar by right-clicking on the corresponding entry in the tab "Output layout".
To install the plugin, you can drag&drop it into the VANTED main window. This will copy the jar file to %appdata%\Roaming\VANTED\addons and then load that file. Don't get confused about which is used.