cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

GUI for custom action block

Former Member
0 Likes
371

Is there any example/User guild for creating GUI for Custom Action Block and their usage?

What I ultimately want to do is create a button in the "Action Properties" when Configure Object is clicked. That button would allow me to connect to another system and retrieve some information from the other system. (similar to the build in SQL Query Action block).

Thank you.

Accepted Solutions (0)

Answers (3)

Answers (3)

salvatore_castro
Product and Topic Expert
Product and Topic Expert
0 Likes

Tim,

Just as a side note the configuration dialog is made up of the standard Java AWT/Swing components, action listeners and panes. There are plenty of Java GUI examples that can be found via a Google search; unfortunately without the code in front of me its tough to help out more than this.

If you have more specific questions and code snippets this will be beneficial.

Sam

Former Member
0 Likes

Hi Tim,

This blog of Rupesh may be able to give you some information.

/people/rupesh.bajaj/blog/2007/12/04/beginners-guide-to-create-custom-action-block

Hope that helps,

Regards,

Musarrat

Former Member
0 Likes

Tim/Musarrat

I have not mentioned how to develop the Custom Configuration Dialog in the mentioned Blog

regards

salvatore_castro
Product and Topic Expert
Product and Topic Expert
0 Likes

Rupesh,

I took at look at your custom action blog and just as a suggestion since you do not have a configuration dialog for your action you should have the following in your code:

public boolean isConfigurable() {

return false;

}

This way when the user right-clicks on the action the "Configure" option will be disabled, otherwise if they select this option they will get a null pointer exception.

Hope this helps.

Sam

Former Member
0 Likes

Sam,

Thanks for the correction,

I will take care of that.

regards

Former Member
0 Likes

Hi Tim,

To use the customized Configuration Dialog you need to do the following.

1. Create one class in the same package of your Custom Action Block and with the same name appended with "Dialog", for Example, if your custom Action block class name is "ABC.java" then this class name should be "ABCDialog.java"

2. This class should extend com.lighthammer.xacute.actions.shared.AbstractActionDialog class and implements java.awt.event.ActionListener class

3. You need to put 2 Constructors with signature's

ABCDialog (JFrame jframe, Object obj, Transaction transaction, Step step)

ABCDialog (JDialog jdialog, Object obj, Transaction transaction, Step step), and these will simply call the super.() with same arguments.

4. Next put protected void prepareDialog() method where you will setTitle for your Dialog and setSize().

5.put protected void createLayoutObjects() method where you initialize the Dialog objects, in your requirement a JButton, dont forget addActionListener to this Button.

5. In the implemented actionPerformed() method, check for the source of action and put your code there.

Hope this helps

regards

Former Member
0 Likes

I am familar with AWT and Swing, so I guess I am alright with that part.

There are couple methods that have to be implemented when declaring the constructor ABCDialog (JFrame jframe, Object obj, Transaction transaction, Step step) and ABCDialog (JDialog jdialog, Object obj, Transaction transaction, Step step). They are:

prepareDialog(), createLayoutObjects(), layoutMainPanel(), setAction(Object), and performOK().

Even with your explaination, I don't quite know what exactly goes inside each function. Would it be too much trouble for someone to post up some working code for me that uses those function? Thank you.

salvatore_castro
Product and Topic Expert
Product and Topic Expert
0 Likes

Tim,

While I am weary of releasing an entire class for public consumption I can however describe what goes on in each method and when they are called....(inherited from AbstractActionDialog):

prepareDialog(): Setting the title and config dialog size

createLayoutObject(): define your JGui objects (textboxes, labels, etc...)

layoutMainPanel(): Define your JPanel and JGui objects here...

setAction(): Call action getters to set defaults in JGui objects

performOK(): Call action setter to store configured values

May want to try some of these and post specific issues you have. Hope this helps....and Good Luck.

Sam