Crux Framework - Doubt when creating my own component

Asked

Viewed 163 times

0

I’ve been following the documentation present on the Crux Framework website and tried to do that basic example component that is presented there. It’s a simple example but honestly I’m starting yet and had trouble creating it. I get this example of the tutorial implemented and running to be able to analyze via code and possibly identify what I may have forgotten/wrong?

  • Welcome to SOPT. Add the question your attempt, to make it easier for them to help you.

  • Thank you Diego. I made a new attempt, now following the implementation of an existing component (Topmenudisposal) in Crux-widgets. A Topmenudisposal interface, its controllers (Small/Large) and XML .xdevice.xml. Annotations are the same as the component. In fact, a copy to see an existing component working from a package of my project. Generate Schemas.Launch has been executed and a new file . xsd is generated. But when running Start Codeserver.Launch, it throws exception.

  • When running Start Codeserver.Aunch generates the exception: Error Parsing cross device file: [topMenuDisposalLarge], for Deviceadaptive interface [br.com.Crux.client.reuse.widget.menudisposal.Topmenudisposal]. java.lang.Illegalargumentexception: Inputstream cannot be null. If you know or have any suggestions, I appreciate your attention. Thank you Diego. Abçs.

1 answer

0


There are several components in libraries Crux-widgets and Crux-smart-faces which can serve as an example to help you mount your own. These components are available on github.

A good example, similar to the one shown in the tutorial, is the Menutabsdisposal component. Here you can see the implementation of the component interfaces and Here you can see the files with the visual declaration of the components.

Note that they must be contained in the same package. In this case, I am sending two links because this is a Maven project and the java classes are under the src/main/java structure and the screen files are under src/main/Resources, but note that the files are all within the same package.

If these examples are not enough, please post the code you are trying to assemble, which I can help you identify where the error is.


EDIT

About this error pointed out in the comment, it seems to me that Crux is not finding the component view file (in this case, topMenuDisposalLarge.xdevice.xml).

Make sure it is in the same package as the component interface (in this case, Topmenudisposal).

If the project is using a structure where sources are separate from Resources (such as a Maven project, where we have src/main/java and src/main/Resources), check that the folder where the view file is located (.xdevice.xml) is in the classpath of the executed Launcher.


EDIT 2

Yesterday (15/12/2015) a new version of Crux was released (5.4.0). Along with this version, a Crux plugin for Maven was created (Crux-Maven-plugin).

If you are working with Maven, I suggest upgrading to the new version and trying to use the plugin. It makes it very easy to set up your pom and I believe it can help solve problems like the one you reported (classpath configuration when running codeserver, devmode etc).

Documentation for this new version is here: http://files.cruxframework.org/crux54/index.html


EDIT 3

About the generation of Xsds... Along with Crux 5.4, a plugin of Crux for the Maven (Crux-Maven-plugin) has been released. Schemas are now generated by the plugin. Take a look at the 5.4 version manual that describes how to use:

http://files.cruxframework.org/crux54/index.html#sec_tools_schcema

Basically, just set up the new plugin in pom.xml and call mvn Crux:generate-xsds

Abcs.

Thiago

  • Thank you very much for the considerations Thiago and I apologize for the delay in responding. I preferred to try a few times during that week but I couldn’t. I added an interface of the desired component as covered in the documentation and its respective controller from an .xdevice.xml interface. I placed the necessary annotations and ran Generate Schemas.launch. This generates an xsd file from the desired library containing the component to be used and visible in the IDE. For me, this is what it takes to have the component, right? Thanks Thiago

  • Finally, I risked COPY + PASTE the Topmenudisposal component present in the Crux-widgets library. An attempt to make a ready-to-run component from my project packages and see if it would work. It didn’t run anyway. I’m interpreting something wrong, following the wrong path and forgetting something essential. When running Start Codeserver.Launch generates the exception: Error Parsing cross device file: [topMenuDisposalLarge], for Deviceadaptive interface [br.com.Crux.client.reuse.widget.menudisposal.Topmenudisposal]. java.lang.Illegalargumentexception: Inputstream cannot be null

  • I added an issue about this bug. Please see if this helps

  • I did as you suggested. I have now created a new application with the new version still working with Maven. I followed Quickstart from the site and checked the settings in the new documentation. In conf. manual could track which codes were automatically generated. In the previous version errors appeared when trying to use the created . xsd. There used to be a Generate Schemas.launch file. It no longer exists. But the . xsd`s are no longer generated in the /target/xsd folder when I create a Factory for a desired component. pom came automatically configured. Do I have to enable this? I couldn’t find it in the documentation. Obg!

  • I realized that when saving a file the page does not compile in the background. Now I change, save and update the page in the browser. The files are as follows: http://s4.postimg.org/ki52pwf99/crux_hello_app.png http://s30.postimg.org/8nvw01f8h/crux_hello_app2png http://s11.postimg.org/crvh6ljf7/crux_hello_app3.png

  • Hi Thales, sorry for the delay to reply. I broke my hand in December and I was away from work... About the generation of Xsds, I added a comment to my reply. Already about the compilation it really changed in 5.4. Recompiling automatically for each change was slow for large projects and the GWT compiler used in version 5.3 did not allow incremental compilation. That’s why we did the compilation in the background. In Crux 5.4, we upgraded to the latest version of GWT that is already able to compile on its own at the time of refresh if there is a change.

Show 1 more comment

Browser other questions tagged

You are not signed in. Login or sign up in order to post.