- private String jsImplementation = JsImplementation.OPENLAYERS_MAP_PART.getJsClass();
- private String mapVar = "argeoMap";
-
- public SwtJSMapPart(Composite parent, int style) {
- super(parent, style);
- parent.setLayout(CmsSwtUtils.noSpaceGridLayout());
- setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
- setLayout(CmsSwtUtils.noSpaceGridLayout());
-
- browser = new Browser(this, SWT.BORDER);
- browser.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
-
- browser.setUrl("/pkg/org.argeo.app.geo.js/index.html");
- browser.addProgressListener(new ProgressListener() {
- static final long serialVersionUID = 1L;
-
- @Override
- public void completed(ProgressEvent event) {
- try {
- // create map
- browser.execute(getJsMapVar() + " = new " + jsImplementation + "();");
- pageLoaded.complete(true);
- } catch (Exception e) {
- log.error("Cannot create map in browser", e);
- pageLoaded.complete(false);
- }
- }
-
- @Override
- public void changed(ProgressEvent event) {
- }
- });