{"id":19015340,"url":"https://github.com/hansolo/properties","last_synced_at":"2025-04-23T01:48:05.842Z","repository":{"id":57737254,"uuid":"108214917","full_name":"HanSolo/properties","owner":"HanSolo","description":"JavaFX like properties","archived":false,"fork":false,"pushed_at":"2021-12-21T11:48:52.000Z","size":165,"stargazers_count":24,"open_issues_count":0,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-23T01:47:58.363Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/HanSolo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"license.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-10-25T03:27:20.000Z","updated_at":"2024-04-01T14:38:55.000Z","dependencies_parsed_at":"2022-08-24T14:59:40.786Z","dependency_job_id":null,"html_url":"https://github.com/HanSolo/properties","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HanSolo%2Fproperties","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HanSolo%2Fproperties/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HanSolo%2Fproperties/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HanSolo%2Fproperties/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/HanSolo","download_url":"https://codeload.github.com/HanSolo/properties/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250354293,"owners_count":21416751,"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":[],"created_at":"2024-11-08T19:36:51.017Z","updated_at":"2025-04-23T01:48:05.820Z","avatar_url":"https://github.com/HanSolo.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Properties \n\n\u003cbr\u003e\nA Java library containing JavaFX like properties but \nwithout the dependencies on the JavaFX packages.\n\nSometimes it can be very useful to have JavaFX like properties in environments\nwhere you don't have JavaFX available (e.g. Android).\n\nIf you would like to use it on Android just checkout the android branch. This branch\ncontains the exact same code as the master branch but without using the Java 8 features.\n\nThere the following properties available:\n- ByteProperty\n- ReadOnlyByteProperty\n- ShortProperty\n- ReadOnlyShortProperty\n- LongProperty\n- ReadOnlyLongProperty\n- IntegerProperty\n- ReadOnlyIntegerProperty\n- FloatProperty\n- ReadOnlyFloatProperty\n- DoubleProperty\n- ReadOnlyDoubleProperty\n- StringProperty\n- ReadOnlyStringProperty\n- CharProperty\n- ReadOnlyCharProperty\n- ObjectProperty\n- ReadOnlyObjectProperty\n\nOn each property you can add remove event listeners as follows:\n```Java\n// define a change listener\nChangeEventListener doubleChangeListener = e -\u003e System.out.println(e.getOldValue() + \" -\u003e \" + e.getValue());\n\n// define a property\nDoubleProperty doubleProperty = new DoubleProperty() {\n    @Override protected void willChange(final Double oldValue, final Double newValue) {\n        System.out.println(\"DoubleProperty will change from \" + oldValue + \" to \" + newValue);\n    }\n    @Override protected void didChange(final Double oldValue, final Double newValue) {\n        System.out.println(\"DoubleProperty changed from \" + oldValue + \" to \" + newValue);\n    }\n};\n\n// adds given listener\ndoubleProperty.setOnPropertyChanged(doubleChangeListener);\n\n// removes given listener\ndoubleProperty.removeListener(doubleChangeListener);\n\n// removes all listeners\ndoubleProperty.removeAllListeners();\n\n\n\n\n#\u003e DoubleProperty will change from 0.0 to 20.0\n#\u003e 0.0 -\u003e 20.0\n#\u003e DoubleProperty changed from 0.0 to 20.0\n```\n\nYou can also bind properties to other properties. Unidirectional and bidirectional\nbindings are supported. \nHere are some examples that you can also find in the Demo.java class.\n\n````java\n// Bindings unidirectional\nSystem.out.println(\"\\n\\n---------- Unidirectional Binding ------------\");\nDoubleProperty propertyA = new DoubleProperty(5);\nDoubleProperty propertyB = new DoubleProperty(10);\n\nSystem.out.println(\"Property A: \" + propertyA.get() + \" is bound: \" + propertyA.isBound());\nSystem.out.println(\"Property B: \" + propertyB.get() + \" is bound: \" + propertyB.isBound());\n\nSystem.out.println(\"\\npropertyA.bind(propertyB)\");\npropertyA.bind(propertyB);\n\nSystem.out.println(\"\\nProperty A: \" + propertyA.get() + \" is bound: \" + propertyA.isBound());\nSystem.out.println(\"Property B: \" + propertyB.get() + \" is bound: \" + propertyB.isBound());\n\nSystem.out.println(\"\\npropertyB.set(5)\");\npropertyB.set(5);\n\nSystem.out.println(\"\\npropertyB = \" + propertyB.get());\nSystem.out.println(\"propertyA = \" + propertyA.get());\n\nSystem.out.println(\"\\npropertyA.set(20)\");\ntry {\n    propertyA.set(20);\n} catch (IllegalArgumentException e) {\n    System.out.println(\"Error, a bound value cannot be set.\");\n}\n\nSystem.out.println(\"\\npropertyA.unbind()\");\npropertyA.unbind();\n\nSystem.out.println(\"\\nProperty A: \" + propertyA.get() + \" is bound: \" + propertyA.isBound());\nSystem.out.println(\"Property B: \" + propertyB.get() + \" is bound: \" + propertyB.isBound());\n\nSystem.out.println(\"\\npropertyB.set(15)\");\npropertyB.set(15);\n\nSystem.out.println(\"\\nProperty A: \" + propertyA.get() + \" is bound: \" + propertyA.isBound());\nSystem.out.println(\"Property B: \" + propertyB.get() + \" is bound: \" + propertyB.isBound());\n\n// Bindings bidirectional\nSystem.out.println(\"\\n\\n---------- Bidirectional Binding ------------\");\nDoubleProperty propertyC = new DoubleProperty(0);\nDoubleProperty propertyD = new DoubleProperty(25);\n\nSystem.out.println(\"Property C: \" + propertyC.get() + \" is bound bidirectional: \" + propertyC.isBoundBidirectional());\nSystem.out.println(\"Property D: \" + propertyD.get() + \" is bound bidirectional: \" + propertyD.isBoundBidirectional());\nSystem.out.println(\"\\npropertyC.bindBidirectional(propertyD)\");\npropertyC.bindBidirectional(propertyD);\nSystem.out.println(\"\\nProperty C: \" + propertyC.get() + \" is bound bidirectional: \" + propertyC.isBoundBidirectional());\nSystem.out.println(\"Property D: \" + propertyD.get() + \" is bound bidirectional: \" + propertyD.isBoundBidirectional());\nSystem.out.println(\"\\npropertyD.set(5)\");\npropertyD.set(5);\nSystem.out.println(\"\\npropertyC = \" + propertyC.get());\nSystem.out.println(\"propertyD = \" + propertyD.get());\nSystem.out.println(\"\\npropertyC.set(20)\");\npropertyC.set(20);\nSystem.out.println(\"\\npropertyC = \" + propertyC.get());\nSystem.out.println(\"propertyD = \" + propertyD.get());\nSystem.out.println(\"\\npropertyD.unbind()\");\npropertyD.unbind();\nSystem.out.println(\"\\nProperty C: \" + propertyC.get() + \" is bound bidirectional: \" + propertyC.isBoundBidirectional());\nSystem.out.println(\"Property D: \" + propertyD.get() + \" is bound bidirectional: \" + propertyD.isBoundBidirectional());\nSystem.out.println(\"\\npropertyD.set(5)\");\npropertyD.set(5);\nSystem.out.println(\"\\nProperty C: \" + propertyC.get() + \" is bound bidirectional: \" + propertyC.isBoundBidirectional());\nSystem.out.println(\"Property D: \" + propertyD.get() + \" is bound bidirectional: \" + propertyD.isBoundBidirectional());\nSystem.out.println(\"\\npropertyC.set(10)\");\npropertyC.set(10);\nSystem.out.println(\"\\nProperty C: \" + propertyC.get() + \" is bound bidirectional: \" + propertyC.isBoundBidirectional());\nSystem.out.println(\"Property D: \" + propertyD.get() + \" is bound bidirectional: \" + propertyD.isBoundBidirectional());\n````\n\nThe output on the console of the above code looks like follows...\n\n```\n---------- Unidirectional Binding ------------\nProperty A: 5.0 is bound: false\nProperty B: 10.0 is bound: false\n\npropertyA.bind(propertyB)\n\nProperty A: 10.0 is bound: true\nProperty B: 10.0 is bound: false\n\npropertyB.set(5)\n\npropertyB = 5.0\npropertyA = 5.0\n\npropertyA.set(20)\nError, a bound value cannot be set.\n\npropertyA.unbind()\n\nProperty A: 5.0 is bound: false\nProperty B: 5.0 is bound: false\n\npropertyB.set(15)\n\nProperty A: 5.0 is bound: false\nProperty B: 15.0 is bound: false\n\n\n---------- Bidirectional Binding ------------\nProperty C: 0.0 is bound bidirectional: false\nProperty D: 25.0 is bound bidirectional: false\n\npropertyC.bindBidirectional(propertyD)\n\nProperty C: 25.0 is bound bidirectional: true\nProperty D: 25.0 is bound bidirectional: true\n\npropertyD.set(5)\n\npropertyC = 5.0\npropertyD = 5.0\n\npropertyC.set(20)\n\npropertyC = 20.0\npropertyD = 20.0\n\npropertyD.unbind()\n\nProperty C: 20.0 is bound bidirectional: false\nProperty D: 20.0 is bound bidirectional: false\n\npropertyD.set(5)\n\nProperty C: 20.0 is bound bidirectional: false\nProperty D: 5.0 is bound bidirectional: false\n\npropertyC.set(10)\n\nProperty C: 10.0 is bound bidirectional: false\nProperty D: 5.0 is bound bidirectional: false\n\nProcess finished with exit code 0\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhansolo%2Fproperties","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhansolo%2Fproperties","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhansolo%2Fproperties/lists"}