[ovirt-devel] popup dialog

力波 王 wlbleaboy at 126.com
Tue Aug 12 05:57:24 UTC 2014


Hi, everyone:
I add a button, named backup in the Template Tab,
And the click event is ok.
Now I want add a dialog after clicked the button,
So, I add a model , but the dialog didn’t display at all.

So, I want to know is there some necessary class need
To modify or add?

The model code is like this:
TemplateBackupModel.java
========================================================
public class TemplateBackupModel extends Model {

    private EntityModel privatePassword;

    public EntityModel getPassword()
    {
        return privatePassword;
    }

    public void setPassword(EntityModel value)
    {
        privatePassword = value;
    }

    public TemplateBackupModel(){

        setPassword(new EntityModel());

        AsyncQuery _asyncQuery = new AsyncQuery();
        _asyncQuery.setModel(this);
        _asyncQuery.asyncCallback = new INewAsyncCallback() {
            @Override
            public void onSuccess(Object model, Object result)
            {

            }
        };

    }

    @Override
    public void eventRaised(Event ev, Object sender, EventArgs args) {
        super.eventRaised(ev, sender, args);
    }

    public boolean validate(){
        return true;
    }
}
========================================================

And created a model in the backup button click callback like this:
========================================================
public void backup()
    {

        if (getWindow() != null)
        {
            return;
        }

        TemplateBackupModel model = new TemplateBackupModel();
        setWindow(model);
        model.setTitle("TemplateBackup");//$NON-NLS-1$
        model.setHashName("TemplateBackup");//$NON-NLS-1$


        UICommand tempVar = new UICommand("OnBackup", this); //$NON-NLS-1$
        
tempVar.setTitle(ConstantsManager.getInstance().getConstants().ok());
        tempVar.setIsDefault(true);
        model.getCommands().add(tempVar);
        UICommand tempVar2 = new UICommand("Cancel", this); //$NON-NLS-1$
        
tempVar2.setTitle(ConstantsManager.getInstance().getConstants().cancel());
        tempVar2.setIsCancel(true);
        model.getCommands().add(tempVar2);

    }
========================================================


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ovirt.org/pipermail/devel/attachments/20140812/a8bae38a/attachment-0001.html>


More information about the Devel mailing list