My goal for this post is to create a custom “view” screen that displays an instance of an entity in a custom layout and doesn’t require the use of uneditable form elements. (By the way, I think this would be a very useful addition to the framework.) I’m halfway there, but I first want to know if what I’ve done so far could be done better, and second, want to figure out how to properly display variable elements in this screen.
So I created an entity and standard browse/edit screens. In my case, this is a simple “knowledgebase” type of collection. After I set this up with some simple show/hide logic on the edit screen, I began the custom “view” screen by adding a blank screen. I finally got this screen opening correctly by changing the controller class to extend StandardEditor instead of Screen and adding the @EditedEntityContainer annotation. This finally got me to the point where the screen is opening and sending in the instance’s ID. So, if any of that is being done incorrectly, please let me know.
I have initially set this “view” descriptor to include an htmlBox, and tried to send my data in that way from the controller file. It worked fine until I tried sending in variable content from the instance, which is when I got a “missing layout file” error. So now, I’m trying to figure out the right way to do this. My goals aren’t complicated on the surface. The “view” screen will just display the contents of the instance fields in text format.
I’ve been searching the manual and forum most of the day, without finding what I need (unless, of course, I simply didn’t make the connection that something I’ve seen is what I need to do.) I’ve attached a simple project sample for you to look at, if you need it.
Correct. It just looks forced/lazy being uneditable form fields, which is why I’m trying to get it to look like a normal web page with proper formatting.
what I did in the past with similar requirements was to adjust the appearance using CSS and stylename attribute of the form component. Probably it is easier than building up a dedicated new screen. But this is obviously up to you to decide
No, this is totally possible. It is just a little bit bit more manual programming involved, depending on how you are planning to do it.
You can start with the label component e.g Label - CUBA Platform. Developer’s Manual. You can use setValue or alternatively also use the databinding against a data container.