{"id":28664166,"url":"https://github.com/eclipse-nattable/nattable-rap","last_synced_at":"2025-06-13T12:12:06.984Z","repository":{"id":298339835,"uuid":"999584513","full_name":"eclipse-nattable/nattable-rap","owner":"eclipse-nattable","description":"Nebula NatTable RAP Fragment","archived":false,"fork":false,"pushed_at":"2025-06-10T15:04:32.000Z","size":376,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-06-10T16:34:06.305Z","etag":null,"topics":["eclipse-rcp","java","rap","rwt","swt"],"latest_commit_sha":null,"homepage":"https://eclipse.dev/nattable/","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"epl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/eclipse-nattable.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-06-10T13:27:23.000Z","updated_at":"2025-06-10T15:14:15.000Z","dependencies_parsed_at":null,"dependency_job_id":"92964d79-1a7f-4e68-b4f5-e41ce11df757","html_url":"https://github.com/eclipse-nattable/nattable-rap","commit_stats":null,"previous_names":["eclipse-nattable/nattable-rap"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/eclipse-nattable/nattable-rap","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eclipse-nattable%2Fnattable-rap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eclipse-nattable%2Fnattable-rap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eclipse-nattable%2Fnattable-rap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eclipse-nattable%2Fnattable-rap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eclipse-nattable","download_url":"https://codeload.github.com/eclipse-nattable/nattable-rap/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eclipse-nattable%2Fnattable-rap/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259642472,"owners_count":22888999,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["eclipse-rcp","java","rap","rwt","swt"],"created_at":"2025-06-13T12:12:01.854Z","updated_at":"2025-06-13T12:12:06.974Z","avatar_url":"https://github.com/eclipse-nattable.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# NatTable RAP\n\nThis project contains an OSGi fragment for `org.eclipse.nebula.widgets.nattable.core`. Adding this fragment together with NatTable Core into a RAP application runtime, it is possible to include NatTable in RAP.\n\nThe fragment uses [Byte Buddy](https://github.com/raphw/byte-buddy) to inject the necessary RAP features to NatTable. \nThis is necessary because `NatTable` is based on `Canvas`, but we need a specialized `CanvasOperationHandler` to get everything working in NatTable. \nThis is especially necessary for the mouse interactions.\n\nAdditionally `NatTable#configure()` is extended this way to add support for scrolling and mouse interactions like mouse move and drag operations.\n\nNote that there are several modifications needed in NatTable Core, to make NatTable work in RAP. You need at least NatTable 2.6.0 to get NatTable work in a RAP environment.\n\nFurther details on the modifications in NatTable Core are documented in [Modifications to support NatTable in RAP](https://github.com/eclipse-nattable/nattable/pull/146).\n\nFurther information about NatTable itself can be found in the [NatTable main repository](https://github.com/eclipse-nattable/nattable).\n\n\n## Requirements\n\nNatTable RAP needs at least:\n\n* Java 21\n* NatTable 2.6.0\n* RAP 4.0.0\n\nThe necessary modifications in NatTable to make it work with RAP are documented in [this PR](https://github.com/eclipse-nattable/nattable/pull/146).\n\n\n## Features\n\nThe following section contains information about the features added to NatTable in RAP that would not work there although working fine in SWT.\n\n### Scrolling\n\nNatTable is a _virtual table_ and only renders what is currently visible. This is done by only painting the currently visible part in the `Canvas`.\nInternally the scrollbars are used to implement that faked scrolling behavior. In SWT this works although `Canvas` is not really scrollable.\n\nIn RAP/RWT a `Canvas` does not provide scrollbars, because it is not scrollable. This is discussed in the forum, e.g.\n- [https://www.eclipse.org/forums/index.php/t/1104906/](https://www.eclipse.org/forums/index.php/t/1104906/)\n- [https://www.eclipse.org/forums/index.php/t/239034/](https://www.eclipse.org/forums/index.php/t/239034/)\n\nThe suggestion to wrap the `Canvas`, respectively `NatTable` in a `ScrolledComposite` doesn't make sense, because it would violate the _virtual table_ concept.\n\nNatTable provides a mechanism to replace the default SWT scrollbars of the `Composite` with custom scrollbars, e.g. `Slider`.\nAn example can be found in [NatTable with custom scrollbars](https://vogella.com/blog/nattable-with-custom-scrollbars/).\n\nThe RAP fragment makes use of this mechanism, re-layouts the NatTable and adds custom scrollbars. Additionally it adds a `MouseWheel` listener to support scrolling via mouse wheel.\n\n### Re-rendering updates\n\nTo avoid that NatTable gets re-rendered too often, events that trigger a repaint are conflated. \nBut the repaint is then triggered from a background thread, which does not work in RAP without a modification. \nTo make it work a `ServerPushSession` is started automatically on `NatTable#configure()` following the documentation in [Server Push](https://eclipse.dev/rap/developers-guide/server-push.html).\n\n### Mouse Move\n\nIn order to support mouse cursor changes when hovering over the column or row header, a `MouseMove` listener is added that uses client side [Scripting](https://eclipse.dev/rap/developers-guide/scripting.html). \nThe necessary data is added in `NatTable#configure()` which is extended in `org.eclipse.nebula.widgets.nattable.RAPInitializer`.\n\n### Mouse Drag (Reorder, Resize, GroupBy)\n\nVia mouse drag operations it is possible to resize columns and rows and to reorder columns, column groups, rows and row groups. \nIt is also possible to perform a groupBy action if that feature is used. \nAs a mouse drag operation involves mouse movement, and the `MouseMove` event is by design not supported in RAP to avoid massive client-server communication, the drag operations need to be added in NatTable RAP in a different way. \nThere are new listeners for `MouseDown`, `MouseMove` and `MouseUp` that use client side [Scripting](https://eclipse.dev/rap/developers-guide/scripting.html). \nWhile `MouseDown` and `MouseMove` only operate on the client side, `MouseUp` will trigger the commands to perform the actions in charge.\n\nThe implementation might not be 100% in sync with the features supported in NatTable Core, but the should be almost equal.\n\n### Export / File Download\n\nIn SWT it is possible to open a `FileDialog` to specify the location to which a export should be generated to. \nThis is not possible with RAP, which is described in [File Upload - File Dialog](https://eclipse.dev/rap/developers-guide/file-upload.html). \nIn NatTable Core a modification was added to simply create the export file in a temporary directory when the platform is RAP. \nA user can then download the export file via the browser functionality, if a download link is provided. To do this you need to:\n\n1. Add a download `ServiceHandler` that is able to provide the export file for download\n\n```java\npublic class DownloadServiceHandler implements ServiceHandler {\n\n    @Override\n    public void service(HttpServletRequest request, HttpServletResponse response)\n            throws IOException, ServletException {\n\n        String fileUri = request.getParameter(\"fileURI\");\n\n        // Get the file content\n        URI uri = URI.create(fileUri);\n        byte[] download = Files.readAllBytes(Paths.get(uri));\n\n        // Set the file name to be downloaded\n        File file = new File(fileUri);\n        String fileName = file.getName();\n\n        // Send the file in the response\n        response.setContentType(\"application/octet-stream\");\n        response.setContentLength(download.length);\n        response.setHeader(\"Content-Disposition\", \"attachment; filename=\\\"\" + fileName + \"\\\"\");\n        response.getOutputStream().write(download);\n    }\n}\n```\n\n2. Register that download server once for your application\n\nEither via `ApplicationConfiguration`\n\n```java\nServiceHandler handler = new DownloadServiceHandler();\napplication.addServiceHandler(\"downloadServiceHandler\", handler);\n```\n\nor programmatically at runtime\n\n```java\nServiceManager manager = RWT.getServiceManager();\nServiceHandler handler = new DownloadServiceHandler();\nmanager.registerServiceHandler(\"downloadServiceHandler\", handler);\n```\n\n3. Provide a way so a user is able to download the export file, e.g. via a button\n\n```java\nButton downloadButton = new Button(buttonPanel, SWT.PUSH);\ndownloadButton.setText(\"Download\");\ndownloadButton.addSelectionListener(new SelectionAdapter() {\n    @Override\n    public void widgetSelected(SelectionEvent e) {\n        ILayerExporter exporter = natTable.getConfigRegistry().getConfigAttribute(\n                ExportConfigAttributes.EXPORTER,\n                DisplayMode.NORMAL);\n\n        if (exporter != null) {\n            if (exporter.getResult() instanceof File) {\n                File file = (File) exporter.getResult();\n                UrlLauncher launcher = RWT.getClient().getService(UrlLauncher.class);\n                StringBuilder url = new StringBuilder();\n                url.append(RWT.getServiceManager().getServiceHandlerUrl(\"downloadServiceHandler\"));\n                url.append('\u0026').append(\"fileURI\").append('=').append(file.toURI());\n                launcher.openURL(url.toString());\n            } else {\n                MessageDialog.openInformation(natTable.getShell(), \"Download Export\", \"There is no export result available.\");\n            }\n        }\n    }\n});\n```\n\nThis is also described in [Static Resources and Downloads](https://eclipse.dev/rap/developers-guide/resources.html).\n\n## Not supported\n\nAs RAP has several limitations compared to SWT, there are features in NatTable that are not supported in RAP:\n\n- Printing\n- Open an export directly\n- `NatTableContentTooltip` and subclasses like `FormulaTooltipErrorReporter` as the JFace Tooltip implementations are not available\n- NatTable scaling, which is not really necessary in RAP as scaling can be done via the browser\n- text decorations (underline, strikethrough) as the necessary `Font` API is missing\n- `BackgroundImagePainter` and `PercentageBarDecorator` as the necessary SWT classes are missing\n- Auto resizing because this uses in-memory pre-rendering of NatTable on an `Image` which is not supported in RAP\n- As of now the Nebula Extension and the E4 Extension are not usable with RAP. This is mostly due to dependency issues, e.g. there are versioned package imports that can not be satisfied by RAP/RWT or there are `Require-Bundle` dependencies on `org.eclipse.swt` which can not be resolved.\n\n\n## Downloads\n\nYou can find update site URLs and downloadable repository archives of the current release and all older releases in [NatTable Downloads](https://eclipse.dev/nattable/download.php).\n\nIf you are interested in SNAPSHOT builds, you can find the update site URLs and all downloadable resources in [NatTable RAP SNAPSHOTS](https://download.eclipse.org/nattable-rap/snapshots/) \n\n## Additional information\n\n* [Project Details](https://projects.eclipse.org/projects/technology.nebula.nattable)\n* [Contribution Guide](CONTRIBUTING.md)\n* [EPLv2 License](LICENSE.md)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feclipse-nattable%2Fnattable-rap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feclipse-nattable%2Fnattable-rap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feclipse-nattable%2Fnattable-rap/lists"}