SuperMap iDesktopX product package provides an extension development sample template project, located in the installation directory /templates/SampleCode folder. Open the template project by IDEA->File->Open->Select SuperMap iDesktopX product package\templates\SampleCode directory.
The SampleCode template project contains two modules: SampleCode Module and Develop Module. The sample template project (SampleCode project) uses Develop Module as the development module.
SampleCode Module
SampleCode Module mainly manages remote repository addresses through its pomfile and all submodules (customized plugins), without implementing specific functionalities. For details, refer to the pom.xml file in SampleCode. Note: The generated jar path should not be modified.
Develop Module
Develop Module is the extension development sample module containing three main classes: MyStartUp, DevelopPlugin, and CtrlActionSampleCode.
MyStartUp
MyStartUp is the entry point for secondary development startup.
DevelopePlugin
DevelopePlugin is the mandatory "plugin class" that must follow the naming convention [module name]+"Plugin", and inherit the AbstractPlugin class. Otherwise, all functions in Develop Module will be unavailable. For implementation details, refer to the DevelopePlugin class.
CtrlActionSampleCode
CtrlActionSampleCode is the sample development class containing content to execute when UI control events are triggered. This control-binding class must inherit from CtrlAction class. For implementation details, refer to the CtrlActionSampleCode class.
public class MyStartUp {
public static void main(String[] args) {
// user.dir must be the directory where iDesktop.jar is located
System.setProperty("user.dir", System.getProperty("user.dir").replace(File.separator + "templates" +
File.separator + "SampleCode", ""));
// to do your things
Application.setActiveApplication(new Application());
if (!Application.getActiveApplication().initialize()) {
System.exit(0);
}
}
}
Note: user.dir must point to the idesktop.jar directory (installation directory). The custom startup module should only start iDesktopX without executing other functionalities. Starting iDesktopX through custom startup doesn't require manual execution of maven clean/install/package.
Related Topics