Coder Social home page Coder Social logo

Comments (7)

tehapo avatar tehapo commented on September 27, 2024

Interesting, I haven't really thought about this kind of use case before.

I wonder how would the place of your TestComponent be defined in the component hierarchy? Would the binding process replace an existing "placeholder" component with id="test-component" or did you have something other in mind?

from clara.

tomivirkki avatar tomivirkki commented on September 27, 2024

Well I think the xml structure is fine just as it is. I can currently try to define the place of my TestComponent like so:

<?xml version="1.0" encoding="UTF-8"?>
<VerticalLayout xmlns="urn:package:com.vaadin.ui"
    xmlns:l="urn:vaadin:layout" xmlns:test="org.vaadin.virkki.test">

    <test:TestComponent id="test-component" l:componentAlignment="MIDDLE_CENTER" />
    <Button id="test-button" caption="Click me!" />
</VerticalLayout>

But now Clara tries to make a new instance of it and replace the existing one in my controller object with it. Before instantiating a new TestComponent, Clara could just check if one already exists and use it instead.
The rest of the inflate process (applying the attributes and so on) wouldn't really need to change at all I think.

from clara.

tehapo avatar tehapo commented on September 27, 2024

Ah, ok. Now I got it. 😃

from clara.

nfrankel avatar nfrankel commented on September 27, 2024

I would go further: what's the point of bridging from Clara to Java? I can get any component and customize it at will with Clara.findComponentById(). What I would like though, is to create components in the Java world and set them during the inflating process.

Alternatively, you could provide callbacks to enhance Clara-created components after inflating, just like you provide Filters to change XML before inflating. In order to be consistent, I would change the API from Filter to Processor (very generic) and have PreProcessor & PostProcessor.

Just my 2 cents... and great work by the way!

from clara.

tehapo avatar tehapo commented on September 27, 2024

You're right, Clara.findComponentById() method does the same thing as @UiField annotation. Basically the only reason for this annotation is to save some typing.

I will definitely think what could be done to this feature before the 1.0 release.

from clara.

tehapo avatar tehapo commented on September 27, 2024

Created a new branch issue-17 for experimenting around this issue.

from clara.

tomivirkki avatar tomivirkki commented on September 27, 2024

The "issue-17" -version does the job. Thanks Teemu!

from clara.

Related Issues (20)

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.