{"id":15056310,"url":"https://github.com/arnobl/malai","last_synced_at":"2025-10-04T16:30:53.749Z","repository":{"id":2967320,"uuid":"3982208","full_name":"arnobl/Malai","owner":"arnobl","description":null,"archived":true,"fork":false,"pushed_at":"2019-07-01T16:58:11.000Z","size":18453,"stargazers_count":1,"open_issues_count":2,"forks_count":8,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-12-30T11:35:18.220Z","etag":null,"topics":["event-processing","java","javafx","typescript","undo-redo","user-interaction","user-interface"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/arnobl.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-04-10T12:57:43.000Z","updated_at":"2023-01-28T17:27:38.000Z","dependencies_parsed_at":"2022-08-25T21:11:05.468Z","dependency_job_id":null,"html_url":"https://github.com/arnobl/Malai","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arnobl%2FMalai","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arnobl%2FMalai/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arnobl%2FMalai/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arnobl%2FMalai/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/arnobl","download_url":"https://codeload.github.com/arnobl/Malai/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":235274276,"owners_count":18963887,"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":["event-processing","java","javafx","typescript","undo-redo","user-interaction","user-interface"],"created_at":"2024-09-24T21:49:51.092Z","updated_at":"2025-10-04T16:30:47.813Z","avatar_url":"https://github.com/arnobl.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://ci.inria.fr/malai/job/malai_core/badge/icon)](https://ci.inria.fr/malai/job/malai_core/) [![Build Status](https://ci.inria.fr/malai/job/malai_javafx/badge/icon)](https://ci.inria.fr/malai/job/malai_javafx/)\u003cbr/\u003e\n\n## Examples\n\nThe following Java code defines an undoable action that changes the unit system used in a drawing editor.\n\n```java\npublic class SetUnit extends ActionImpl implements Undoable {\n\tprivate Unit unit;\n\tprivate Unit oldUnit;\n\n\t@Override\n\tpublic boolean canDo() { // Checks whether the action can be executed\n\t\treturn unit != null;\n\t}\n\t\n\t@Override\n\tprotected void doActionBody() { // Execution of the action.\n\t\toldUnit = ScaleRuler.getUnit();\n\t\tredo();\n\t}\n\t\n\t@Override\n\tpublic void undo() { // Undoes the action\n\t\tScaleRuler.setUnit(oldUnit);\n\t}\n\n\t@Override\n\tpublic void redo() { // Redoes the action\n\t\tScaleRuler.setUnit(unit);\n\t}\n\n\t@Override\n\tpublic String getUndoName() { // Provides a short textual description of this undoable action.\n\t\treturn \"Changing the unit\";\n\t}\n    //...\n}\n```\n\nThis action can be then used in an instrument to be binded to a predefined user interaction and widgets.\n\n```java\n// An instrument is a controller/presenter/viewModel/component/etc: \n// it gather events produced by widgets as user interactions into actions that modify the system.\npublic class PreferencesSetter extends JfxInstrument implements Initializable {\n    @FXML private ComboBox\u003cString\u003e unitChoice;\n    //...\n\n    @Override\n    protected void configureBindings() throws IllegalAccessException, InstantiationException {\n        //...\n        // Defines an widget binding that binds a combobox to the action SetUnit\n        bindComboBox(SetUnit.class,  // The type of the action to produce\n            action -\u003e action.setUnit(Unit.getUnit(unitChoice.getSelectionModel().getSelectedItem())), // The initialisation of the action\n            unitChoice); // The source widget to listen\n    }\n}\n```\n\n\n# Implementations\n\n\nMalai fully supports **Java Swing** and **JavaFX**. A **TypeScript/Javascript** version is in progress.\n\n# How to use\n\nAs Maven libraries. In your POM file, adds the Malai repositories:\n\n```xml\n    \u003crepositories\u003e\n        \u003crepository\u003e\n            \u003cid\u003emavenInriaSnapshot\u003c/id\u003e\n            \u003cname\u003ehttp://maven.inria.fr-snapshots\u003c/name\u003e\n            \u003curl\u003ehttp://maven.inria.fr/artifactory/malai-public-snapshot\u003c/url\u003e\n        \u003c/repository\u003e\n        \u003crepository\u003e\n            \u003cid\u003emavenInriaRelease\u003c/id\u003e\n            \u003cname\u003ehttp://maven.inria.fr-releases\u003c/name\u003e\n            \u003curl\u003ehttp://maven.inria.fr/artifactory/malai-public-release\u003c/url\u003e\n        \u003c/repository\u003e\n    \u003c/repositories\u003e\n```\n\nAnd adds the dependencies:\n\n```xml\n        \u003cdependency\u003e\n            \u003cgroupId\u003eorg.malai\u003c/groupId\u003e\n            \u003cartifactId\u003emalai.core\u003c/artifactId\u003e\n            \u003cversion\u003e3.0-SNAPSHOT\u003c/version\u003e\n        \u003c/dependency\u003e\n        \u003cdependency\u003e\n            \u003cgroupId\u003eorg.malai\u003c/groupId\u003e\n            \u003cartifactId\u003emalai.javafx\u003c/artifactId\u003e\n            \u003cversion\u003e3.0-SNAPSHOT\u003c/version\u003e\n        \u003c/dependency\u003e\n```\n\n\n# Who uses Malai?\n\n\n[Latexdraw](https://github.com/arnobl/latexdraw) is a vector drawing editors for LaTeX. It is developed on the top of Malai JavaFX.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farnobl%2Fmalai","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farnobl%2Fmalai","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farnobl%2Fmalai/lists"}