• How do I use UIDialog? I get an error incompatible with PopupContent

    By Patrick Chaumeil 1 decade ago

    Hello,

    I want to use a dialog box but I have an error or an empty box. Why?

    My code is as follows:
    ...
    UIPanel div = new UIPanel();
    div.setId("divHelper_"+this.getFieldName());
    UIDialog dialog = new UIDialog();
    TypedUtil.getChildren(div).add(dialog);
    dialog.setStyleClass("dlgUserPref");
    dialog.setTitle(avanteam.kernel.net.HtmlEscape.escapeTags("Aide à la saisie de " + this.getLabel()));
    dialog.setId("helper_"+this.fieldName);
    UIPanel div2 = new UIPanel();// incompatible with PopupContent
    TypedUtil.getChildren(dialog).add(div2);
    UIPassThroughText textComp = new UIPassThroughText();
    TypedUtil.getChildren(div2).add(textComp);
    textComp.setText(this.fieldName);
    XspCommandButton xspCommandButton = new XspCommandButton();
    xspCommandButton.setId(this.getFieldName() + "_a");
    xspCommandButton.setIcon("/helper-select.gif");
    xspCommandButton.setStyleClass("fieldHelperSelect btnImg");
    String script = "XSP.openDialog(\"#{id:helper_"+this.fieldName+"}\")";
    xspCommandButton.setValueBinding("onclick", FacesContextEx.getCurrentInstance().getApplicationEx().createValueBinding(script));
    div.getChildren().add(xspCommandButton);
    ...

    It is used by my custom control ""
    Class :
     avanteam.kernel.document package;
     public class Form extends UIComponentBase {...}

    I get the following error:
     Erreur d'exécution inattendue
     Une erreur inattendue s'est produite lors de l'exécution.
     Source de l'erreur
     Nom de page :/Welcome.xsp

     Exception
     javax.faces.component.UIPanel incompatible with com.ibm.xsp.extlib.component.dialog.UIDialog$PopupContent

     ► Trace de pile
     java.lang.ClassCastException: javax.faces.component.UIPanel incompatible with com.ibm.xsp.extlib.component.dialog.UIDialog$PopupContent
        com.ibm.xsp.extlib.component.dialog.UIDialog.getPopupContent(UIDialog.java:370)
        com.ibm.xsp.extlib.component.dialog.UIDialog.isDialogRequest(UIDialog.java:430)
        com.ibm.xsp.extlib.component.dialog.UIDialog.getRendersChildren(UIDialog.java:495)
        com.ibm.xsp.util.FacesUtil.renderComponent(FacesUtil.java:841)
        ...

    If I replace the line
     UIPanel div2 = new UIPanel();// incompatible with PopupContent
    to the line
     PopupContent div2 = new PopupContent();// import com.ibm.xsp.extlib.component.dialog.UIDialog.PopupContent
    Then the dialog opens but it is empty.

    I have a server 8.5.3 with the last download Extension library : 853.20120605-0921.

    Cordialement,
    Patrick