Bonjour,
Je désire afficher une popup lors d'un clic sur un bouton, la popup s'affiche mais disparait toute seul.
Mon environnement est le suivant : Spring Webflow, RichFaces
Voici le code de la popup est le bouton ainsi que le flow de transition :
------------------ Code ModalPanel ---------------
------------------- Code Button --------------------
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60 <ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:a4j="http://richfaces.org/a4j" xmlns:rich="http://richfaces.org/rich"> <rich:modalPanel id="popup" autosized="true"> <f:facet name="header"> <h:outputText value="Confirmation Clonage" /> </f:facet> <f:facet name="controls"> <h:panelGroup> <h:graphicImage value="/stylesheet/img/Images/Gnome-Window-Close-32.png" styleClass="hidelink" id="hidelink" height="15" width="15" /> <rich:componentControl for="popup" attachTo="hidelink" operation="hide" event="onclick" /> </h:panelGroup> </f:facet> <a4j:outputPanel id="compo"> <a4j:form id="formPopup"> <div class="clear"></div> <div class="clear"></div> <p>This entity has more documents</p> <p> Nbre of documents to clone : <h:outputText value="" styleClass="label" /> </p> <p>Want you really saved this entity and clone ?</p> <div style="margin-bottom: 30px" /> <h:panelGroup> <a4j:commandLink reRender="identityForm, formPopup" action="clone" oncomplete="if (#{facesContext.maximumSeverity==null})Richfaces.hideModalPanel('popup');"> <span class="btleft"></span> <span class="btmiddle">Save</span> <span class="btright"></span> <span class="clear"></span> </a4j:commandLink> <a4j:commandLink onclick="Richfaces.hideModalPanel('popup');" action="close"> <span class="btleft"></span> <span class="btmiddle">Cancel</span> <span class="btright"></span> <span class="clear"></span> </a4j:commandLink> </h:panelGroup> </a4j:form> </a4j:outputPanel> </rich:modalPanel> </ui:composition>
------------------------ Code Transistion -----------------
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9 <a4j:commandLink action="save" title="#{msg.btn_save}" oncomplete="Richfaces.hideModalPanel('popup');" onclick="Richfaces.showModalPanel('popup');" reRender="formPopup" immediate="true" > <span class="btleft"></span> <span class="btmiddle">#{msg.btn_save}</span> <span class="btright"></span> <span class="clear"></span> </a4j:commandLink>
-------------------- Code Java -----------------------
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14 <transition on="save" to="saved" validate="false"> <evaluate expression="entityController.saveEntity(flowScope.entity)" result="flowScope.entity"/> </transition> <subflow-state id="editEntity" subflow="entitymngt/newEntity"> <input name="entityEdit" value="flowScope.entity"/> <input name="create" value="create"/> <input name="show" value="show"/> <transition on="saved" to="editEntity"/> <transition on="quit" to="quit"/> <transition on="cloned" to="entitiesForm"/> <transition on="close" to="close"/> </subflow-state>
Le fonctionnement desirer est lors du clic sur le bouton , j'affiche la popup est apres l'affichage , si on clic sur "clone" on continue le traitement de l'entity saisie préalablement.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 public Entity saveEntity(Entity entity) { // Check if new entity creation to send notifications to UN1 and UN2 setNbTransactionCloned(10); setShowPopup(true); if (entity.getId() == null) { this.entityToSaved = entity; cloneTransactionsEntity(); } else { entityServiceFacade.saveEntity(entity); } return entity; }
Partager