Clara - Declarative UI and Bindings for Vaadin Framework

Hi,

Thanks for the very good work. It was quite easy for me to switch to Clara for some existing test components. I prefer the clear XML structure of the component tree.

Perhaps you can even improve the Clara experience:
Since there is no XSD, yet, I had some typing errors for the XML attribute names and sometimes I did not know, if there exists a matching setter in Java (e.g. clickShortcut=“ENTER” does not call setClickShortcut(int keyCode, int… modifiers) because the parameter count is not 0 or 1).

These errors are not signalled by Clara and I had to manually verify the result in the browser (AttributeHandler.assignAttributes simply ignores attributes when no setter is found). Is there a way to set be more strict, when attributes are assigned? (An XSD would be even more helpful, of course.)

Best regards,
Winfried

Hi,

I have created a maven plugin to generate xml schemas for clara.

https://github.com/kumm/claraxsd-maven-plugin

Feedback is welcome.

Awesome! This sounds really good. I will definitely give this plugin a try.

Many Thanks! It worked for me in Eclipse.

To add the generated ‘catalog.xml’:
Preferences > XML > XML Catalog > User Specified Entries > Add > Next Catalog

To make schema validation work in my XML files, I had to replace “clara:” with “file:”. E.g.
xsi:schemaLocation=“urn:import:com.vaadin.ui file://myproject/com.vaadin.ui.xsd”

Thanks for the eclipse info.
Eclipse maybe check the protocol in the url. And well… “clara://” is not valid. yet :wink:
Can you try with “http://”?
For example generate with: ‘-D baseSystemId=“http://myproject/clara/”’
I think it would be less confusing than “file://”.
If it works, I will change the default protocol in systemID to http.

Yes, “http://” works.

In my “catalog.xml” the attribute “xml:base” has an absolute URL (starting with “file:///C:/”). Since I want to check-in this file (my schema will not change to often), it won’t work for others. Eclipse still works fine, if I remove this attribute completely. Does this work in Netbeans, too?

Yes, it works in Netbeans too.
As i understand no xml:base property means all filenames given in uri are relative to catalog.xml. I think I can remove it safely, just giving a quick try to IntelliJ IDEA.

Can I set the icon of a component with Clara?

My current workaround is:
Clara.findComponentById(getCompositionRoot(), “newButton”).setIcon(new ThemeResource(“img/Create.png”));

Better would be (or something similar):

Clara 1.1.0 release is now available in the Vaadin Directory and of course also through the Maven repository. This release includes following bugfixes.

  • Fixed captions for TabSheet (issue #25).
  • Removed logging.properties from the package (issue #26)
  • Fixed @UiField binding of superclass fields (issue #27).

Big thanks for all the feedback and contributions! In case you find some issues with the new release, please let me know.

Thanks for the very good work.
We prefer a clear xml structure for defining a user interface rather than programming it.
Now I want to define an entire table based on Clara.
The table itself can be declared using <Table id=”tbl_product” newItemAllowed…./>
I addition to that I would like to describe the column within that table in a similar way.
Maybe I have overlooked something in the examples / documentation or xsd.
How can I declare the columns within a table using clara?

Thanks Birte

is it possible to use html in vaadin clara?? because i want to design the double header table etc

Unfortunately no, in the current version you cannot mix Vaadin components with HTML tags. This could be a nice feature in future versions.

Hi, great work for start :).

Have you ever considered implementing some mechanism which would generate the Java UiHandlers from the XML file and keep them in sync. In most cases we dont use clara because we have to copy the same thing in two files (java and XML). And is there any plans to define table components (columns) within clara.

Keep up the good work.

How to use the custom component in clara.Since i used customComponent tag but its not supporting.suppose if my custom table is “FreezeTable”, in java I will use that as FreezeTable ft=new FreezeTable() but using clara how can I?

You need to define a namespace to import your component and then use the class name as an element in your XML. Something like this should work:

<VerticalLayout xmlns:m="urn:import:com.yourcompany.app">
    <m:FreezeTable />
</VerticalLayout>

Thanks teemu.Its working. But i have another doubt.Currently we are accessing the xml file from src/main/resources. Does the xml file will work from src/main/java folder.I want to make it access from src/main/java. i tried but i got this exception only java.net.MalformedURLException.Please resolve my issue.thanks in advance

Hi,

I assume you are using Maven, so you need to configure your build to look for resource files also from the
src/main/java
directory. Something like the following might work when added inside the

section of your
pom.xml
(did not test this though).

<resources>
    <resource>
        <directory>src/main/java</directory>
        <includes>
            <include>**/*.xml</include>
        </includes>
    </resource>
    <resource>
        <directory>src/main/resources</directory>
    </resource>
</resources>

Hi,

I’m trying to use Clara for my new Vaadin application. It looks nice and xml layouting saves me a lot of code. But I have a problem. I didn’t get the AttributeFilter for my Clara using application running. Could you help me?

The problem is, that the implemented method filter did not get called at all. Localization resources are saved as plain property files.
I’m using Vaadin 7.3.6 and Clara 1.1.0

Best regards!

How to disable the listner for optionGroup. For ex: Im using “optionGroup.select” for 1st time to select the default value but its calling the value change listner and performing the value change event… Since i dont want to do any value change event, i just want to select some default value initially while screen loading… So how to diable value change listner during 1st time…

Same problem here. How to disable listener while screen load ?