renatoathaydes / ceylonfx Goto Github PK
View Code? Open in Web Editor NEWCeylon interface for JavaFX
License: Apache License 2.0
Ceylon interface for JavaFX
License: Apache License 2.0
Currently, there is a good amount of basic components which show that CeylonFX is not only viable, but an excellent option to write JavaFX applications entirely in code (as opposed to FXML+Java).
Allowing, or encouraging users to access the underlying JavaFX classes when CeylonFX does not provide a wrapper (although necessary to start with) has proven to be confusing and even ugly (however, it currently seems to be impossible to hide them completely, which may or may not be seen as a problem).
Therefore, all relevant classes in JavaFX, but most specially Node and its sub-classes (controls, layouts, shapes, text, etc.), need to be wrapped adequately to take full benefit of Ceylon's syntax and feel.
My plan is to, in order:
VBox
)CheckBox
)Shape
s (see Rectangle
), Paint
s (see Color
), Text
etc.I believe that, given the prototypes which are already working (as of 2013/Dec/11), it's finally time to start on this.
Input from anyone interested in the future of this project is encouraged.
One of the next things we need, before we can start making use of form elements is layout panes.
EvenHandling can probably benefit from Ceylon's syntax, similarly to Bindings as on #2.
This is what I get when I try to follow the instructions in the README
git clone [email protected]:renatoathaydes/CeylonFX.git
Cloning into 'CeylonFX'...
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Hi,
I am interested in getting involved in this project as i find it a great added value for the Ceylon ecosystem. To get hand dirty, i started by implementing TextField, mimicking what was done for CheckBox.
It strikes me that the code was more verbose and complicated then it could be :
So i took option of using Ceylon properties being just 'views' over java properties. I experimented this using existing API as far as reasonable. It leads to this implementation of Checkbox :
shared class CheckBox2 (
Boolean selected = false,
String initialText = "",
Boolean allowIndeterminate = false,
Paint textFill = black)
extends CeylonFxAdapter<JCheckBox>() {
value delegate = JCheckBox(initialText);
shared ObjectProp<Boolean> selectedProperty = booleanWrappedProperty(delegate.selectedProperty(), selected);
shared ObjectProp<Boolean> allowIndeterminateProperty = booleanWrappedProperty(delegate.allowIndeterminateProperty(), allowIndeterminate);
shared ObjectProp<Paint> textFillProperty = paintWrappedProperty(delegate.textFillProperty(), textFill);
shared ObjectProp<String> textProperty = stringWrappedProperty(delegate.textProperty());
// Here method name should be getDelegate
shared actual JCheckBox createDelegate() => delegate;
}
Using WrappedProperties compilation unit like :
shared class WrappedProperty<CeylonType, JavaType>(jProperty, c2j, j2c)
satisfies Property<CeylonType>&Writable<CeylonType> {
JObjectProp<JavaType> jProperty;
TypeConverter<CeylonType, JavaType> c2j;
TypeConverter<JavaType, CeylonType> j2c;
CeylonType getValue() {
JWritableValue<JavaType> writableValue = jProperty;
return j2c.convert(writableValue.\ivalue);
}
...
}
shared alias ObjectProp<Prop> => Property<Prop>&Writable<Prop>;
shared alias JObjectProp<JavaType> => JWritableValue<JavaType>&JObservableValue<JavaType>;
shared WrappedProperty<Boolean, JBoolean> booleanWrappedProperty(JObjectProp<JBoolean> jProp, Boolean? initValue = null) {
value result = WrappedProperty(jProp, booleanC2J, booleanJ2C);
if (exists initValue) {return result.init(initValue);}
return result;
}
...
You can get complete working sample at : https://github.com/djeang/ceylonfx-proposal.git
This is just half of a proposal as to achieve right design it will require deeper reworking (i did not touch any of the existing line of code to create this working example).
I am currently working on this, so just wanted to add it here so everyone knows what I am trying to achieve.
My goal is to make properties in CeylonFX much easier to use than in JavaFX.
The current syntax I am pursuing is more or less like this:
value cb = CheckBox();
...
Scene {
fill = [ cb.selectedProperty -> (Boolean sel) => sel then white else black ]
};
If properties are of the same type, then we should be able to just do:
value cb = CheckBox();
...
Scene {
aBooleanProp = cb.selectedProperty
};
Any comments on that?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.