cancel
Showing results for 
Search instead for 
Did you mean: 

How to create reusable component with view?

former_member186148
Active Participant
0 Kudos

Hello SDN!

In number of screens I should allow users to choose multiple values for some parameters. Let's imagine that we have screen1 and screen2. On screen1 we should be able to set multiple parameters for param1, and on screen2 we should be able to set multiple parameters for param2. There is a button in screen1 which calling popup screen contained table with set of param1 values and buttons such as "Add", "Delete", "OK", "Cancel" (call it HelpScreen1) . On the screen2 we have the such button which calling popup screen for parameter2 (call it HelpScreen2). The logic of these help screens is simple - each of them takes current set of respective params values, display them in table, allow user to add/edit/delete them and pass new values set back to the caller screen.

But of course create a separate help screen for every parameter is very ugly way. I want to create common help screen but I don't know how I can do it and what I should use to create it. It seems that I have to create reusable component but I'm not sure.

Can you please give me some help?

regards, Lev.

p.s.: sorry for my not-well english but I hope that my description is clear... )

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

Hope you have created Development Components, you can achieve the re usability of the View.

Create a Development Component of type WDJ, Create a View and embed it in a Window and define it as a Public Part.

Call this in your required components as a Used DC.

By passing the proper parameters, you can call that Window.

- Saravanan K

former_member186148
Active Participant
0 Kudos

Hi!

Thank you for answer. Of course I'm working with DCs

Well I've created separate DC with help screen which will be called from master screens. But this help screen should be called like popup, i.e. in separate window. How I can tell to master screen that user press "close" button and help screen should be closed?

Former Member
0 Kudos

Hi,

As I said earlier, you just embed the View to the Window and if you use this DC as a Used DC in your Master DC, you will get this Window. You can call this Window as normally as

IWDWindowInfo windowInfo = (IWDWindowInfo)wdComponentAPI.getComponentInfo().findInWindows("Window Name");

IWDWindow window = wdComponentAPI.getWindowManager().createWindow( windowInfo, true);

window.open();

< Pass the required paremeters and Window Instance>

< Execute the Interface method> ;

You can have the close and other required buttons in the common View itself. Close the Window by destroying the Window instance.

- Saravanan K

Former Member
0 Kudos

Hi,

For your requirement, Please check below if this helps.

I dont think you need to create a seperate DC unless your parameter screen 1 and 2 are in different DCs.

1st Scenario:

If Parameter Screen 1 and 2 are in the same DC and in the same WD component.

Create a Window - 'Help Screen'

Create a view and embed into the Window.

How to design single Help screen for both the Param screen.

I suggest you to create seperate nodes and corresponding table ui elements for both the Parameter screens in the Help screen.

And hide the second table everytime when user opens the Help screen based on the Parameter screen.

If user clicks on Open button in Pram screen 1 then hide the second table in the Help screen and show only the first table.

(Or)

Create a table UI Element.

Bind to a generic value node (This node is not specific to Param screen 1 or screen 2).

Maintain seperate source value nodes for Param screen1 and screen2.

When user clicks Open btton to open Help screen to add/modify/delete the params on screen1 or on screen2, open the Help screen window and at the same time populate the data from Param screen1 source node to Help screen generic node.

When user clicks on close button to close Help screen , update the data in source node according to the user changes in generic node and invalidate the generic node.

How to open the window:

IWDWindowInfo windowInfo = (IWDWindowInfo)wdComponentAPI.getComponentInfo().findInWindows("Window Name");

IWDWindow window = wdComponentAPI.getWindowManager().createWindow( windowInfo, true);

window.open();

How to close the window:

There are different ways to close the window:

Easiest way to do: You can pass the window instance from Master window to child window through context sharing.

For example, Create one context attribtue as 'HelpScreenWindowInst' of type (IWDWindow) and share this context attribute to both the views (Param screen and Help screen). Now store the window instance in that context attribute immediately after the window open code.

wdContext.currentContextElement().setHelpScreenWindowInst(window);

And when user clicks on Close button in Help screen then destroy the window instance as below.

wdContext.currentContextElement().getHelpScreenWindowInst().destroyInstance();

Regards,

Charan