cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
nihar1983
Level 5

Custom code

Hi

I wrote one custom code to validate one existing directory.It will be like below.

import com.zerog.ia.api.pub.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.ButtonGroup;
import javax.swing.JLabel;
import javax.swing.JRadioButton;

/**
*
* @author nkhuntia
*/
public class DirectoryValidation extends CustomCodePanel implements ActionListener {
private boolean inited = false;
private JLabel label, label1, label2, label3;
JRadioButton yesButton;
JRadioButton noButton;
GUIAccess gui;
boolean approve = false;


//@Override


public boolean setupUI(CustomCodePanelProxy customCodePanelProxy)
{

String def = customCodePanelProxy.substitute("$USER_INSTALL_DIR$");

label= new JLabel("Confirm directory removal.");
label1 = new JLabel("The directory " + def + " and all its contents will be deleted.");
label2 = new JLabel("NOTE: This step will not delete the Repository.");
label3 = new JLabel("Are you sure you want to continue?");
// Use a boolean flag here to prevent duplicate GUI elements.




if (inited == true)
return true;
inited = true;
setLayout (new GridLayout(10, 1, 5, 3));
label.setPreferredSize(new Dimension(15, 20));
add(label);
add(new Label());
add(label1);
add(new Label());
add(label2);
add(label3);
ButtonGroup group = new ButtonGroup();
yesButton = new JRadioButton("Approve" , false);
noButton = new JRadioButton("DisApprove" , true);
add(new Label());
add(yesButton);
add(noButton);
group.add(yesButton);
group.add(noButton);

return inited;
}



So here I am getting some issue....

SO once this is getting initialized I am not able to reinitialized the "def" variable.

If I removed the return "init" variable then while I am going back and returning back whole things getting messed up. So could u plz tell me how to resolve this issue.

Thanks
Nihar
Labels (1)
0 Kudos
(1) Reply
pv7721
Level 20

So basically you want to remove a folder based on a certain condition? Maybe it's easier to do it with native IA methods?
0 Kudos