Looking for Advice on reusing screens


I have some screens that I would like to reuse in different situations but the initial data is slightly different.

Let me try to explain with an example.

Lets say we have a system with Customers and Orders. There is a Browse and Edit screen for Orders so it is possible to view all the orders and create a new order. If you edit a Customer there is also a Fram that hosts the Order Browse Screen and then you should be able to create a new Order from within that customer and have the Customer link set automatically.

So in the situation with the embedded Order within the Edit screen I have the following.
Customer Edit Screen
A tab with a Frame that is setup to show the Order browse screen.

In this setup the Order Screen appears to have a WindowParam of ITEM set to be the Customer Entity. This seems to be done automatically so that is great. I grab this ITEM param and use if the set the setInitialValues of the Create Action in the Order Browse actions so that the new Order is linked to the current Customer.

Click Create and Save then all is super…The new order is created and linked to the current Customer.

Now I go to the main menu and open the Order Browse screen. This needs a tweak as the WindowParams do not include the automatic ITEM param. So I skip the setInitialValues of the Create Action. Click Create and no Customer is linked as I would expect.

The difference between the different ways of showing the Order Edit screen means I would like to show and hide the Customer lookup field as it isn’t needed when being set automatically.

Basically I’d like to know if this process seems logical to reuse a screen


in order to programmatically show / hide certain attributes, you can do the following in your OrderEdit.java:

public class OrderEdit extends AbstractEditor<Order> {

    LookupField customerLookupField

    protected void initNewItem(Order item) {
        customerLookupField.setVisible(item.customer == null)

It will hide / show the field depending on if there is a customer already associated to this order (which is the case when calling the OrderEdit from the CustomerEdit screen and false for the case of coming from the CustomerBrowse screen.

I hope this helps.


hi John,

as a side note: I picked that topic up for the rtcab-ordermanagement videos and have created an video that shows how to solve this problem:

The code can be found here:


Thanks Mario. Looks like I was going down the right track.

Keep up the good work on the videos too. They are very useful