Coder Social home page Coder Social logo

ceylonfx's People

Contributors

gavinking avatar renatoathaydes avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

sgalles

ceylonfx's Issues

Ensure CeylonFX class hierarchy mirrors JavaFX's starting with Node

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:

  • implement Node (which will require the implementation of several minor 'config' parameters)
  • Implement most layouts (based on the current VBox)
  • Implement most controls (based on CheckBox)
  • Implement most other things, like Shapes (see Rectangle), Paints (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.

Issue when cloning repository

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.

Properties Design

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 :

  • One have to write glue code to bind Ceylon Property
  • IMO, Node objects need not to be instantiated lazily (only adding nodes to scene must be executed in JavaFX thread)
  • Glue code between Java properties and Ceylon properties leads in an extra listener/observable step at runtime (a change in the Java property triggers a change in the Ceylon property which in turn trigger its listeners).

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).

Bindings in CeylonFX

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?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.