Comments (7)
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.
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.
Ah, ok. Now I got it.
from clara.
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.
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.
Created a new branch issue-17 for experimenting around this issue.
from clara.
The "issue-17" -version does the job. Thanks Teemu!
from clara.
Related Issues (20)
- Implement Clara.findComponentById utility method
- AbsoluteLayout component positioning HOT 5
- Use field's name if an @UiField annotation doesn't have an explicit id
- Support for Vaadin 7
- Create a proper tutorial to complement the quickstart guide
- Allow embedding of HTML content HOT 1
- Investigate if the AttributeFilter concept could use SAX XMLFilters HOT 1
- Add support for setters without any parameters like setSizeFull()
- Adding MenuItem to MenuBar HOT 2
- @UiDataSource on field... HOT 1
- OSGi support
- Using clara with GoogleAppEngine
- Autogenerated XSD HOT 1
- Caption in TabSheet
- logging.properties overrides logging configuration for the whole webapp
- Binder does not bind UiFields of superclass(es) HOT 1
- Clara and Drag&DropLayouts and CanvasPlus HOT 1
- CheckBox value
- Return value of the XML parsing should be the root component
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from clara.