-
1. Re: How can i do Userquestions while processing Java code..
pvito Jan 18, 2012 6:52 AM (in response to dune89)Hi, Matthias
You may using next code
<h:form>
<rich:popupPanel id="popup" domElementAttachment="form" modal="true"
onmaskclick="#{rich:component('popup')}.hide()"
resizeable="true">
<f:facet name="header">
<h:outputText value="header"/>
<f:facet name="controls">
<h:outputLink value="#"
onclick="#{rich:component('popup')}.hide(); return false;">
X
</h:outputLink>
</f:facet>
</f:facet>
<br/><br/>
<h:outputText value="You question ..."/>
<br/><br/>
<h:panelGrid columns="2">
<a4j:commandButton
actionListener="#{myBeen.doSomething}"
onclick="#{rich:component('popup')}.hide(); return true;"
value="OK"/>
<h:commandButton
onclick="#{rich:component('popup')}.hide(); return false;"
value="Cancel"/>
</h:panelGrid>
</rich:popupPanel>
</h:form>
Regards, Vitaliy
-
2. Re: How can i do Userquestions while processing Java code..
dune89 Jan 18, 2012 7:28 AM (in response to pvito)Hello Vitaliy,
thanks for the fast answer.
How can i make the Popup open out of a java method ?
Regards, Matthias
-
3. Re: How can i do Userquestions while processing Java code..
blabno Jan 18, 2012 8:54 AM (in response to dune89)YOu can't. You must write your controller (JSF backing bean) the right way.
i.e.
{code:java}public class Bean {
private Object attributeA;
//getters and setters
public String doStuff() {
if(this.attributeA==null) {
return "dataNeeded";
}
//...other checks
//final logic
}
}{code:java}
{code:xml}<rich:popupPanel id="popup" .../>
<a4j:outputPanel ajaxRendered="true">
<h:panelGroup rendered="#{empty bean.attributeA}">/**JavaScript showing panel*/</h:panelGroup>
</a4j:outputPanel>{code:xml}
-
4. Re: How can i do Userquestions while processing Java code..
dune89 Jan 18, 2012 9:36 AM (in response to blabno)hmm ok
Thats my code at the moment:
<a4j:outputPanel ajaxRendered="true" >
<h:panelGroup rendered="#{myController.showit}">
//Need a way to execute Javascript..
</h:panelGroup>
</a4j:outputPanel>
<rich:popupPanel id="popup" modal="true" resizeable="true" >
<f:facet name="controls">
<h:outputLink onclick="#{rich:component('popup')}.hide()">X</h:outputLink>
</f:facet>
TEXTEXTTEXTTEXTEXTTEXTTEXTEXTTEXT<br/>
TEXTEXTTEXTTEXTEXTTEXTTEXTEXTTEXT ?
<h:panelGrid columns="2">
<a4j:commandButton value="Ja" onclick="#{rich:component('popup')}.hide()">
<a4j:ajax event="click" listener="#{myController.doSthForYes()}"/>
</a4j:commandButton>
<a4j:commandButton value="Nein" onclick="#{rich:component('popup')}.hide()" >
<a4j:ajax event="click" listener="#{myController.doSthForNo()}"/>
</a4j:commandButton>
</h:panelGrid>
</rich:popupPanel>
How can i execute Javascript ?
is there an onrendered, that i can #{rich:component('popup')}.show() or what is the way of showing the panel ?
in the methods doSthForNo and doSthForYes i can place my logic ? and in the end set the showit to false that no more popups will come out ?
Regarts Matthias
-
5. Re: How can i do Userquestions while processing Java code..
blabno Jan 18, 2012 9:55 AM (in response to dune89)substitute "//Need a way to execute Javascript.."
with
<script>#{rich:component('popup')}.show();</script>
Yes, doSthForNo and doSthForYes are the right place for logic, and yes, change value of showit to false if you don't want to show the modal panel.
-
6. Re: How can i do Userquestions while processing Java code..
dune89 Jan 19, 2012 7:08 AM (in response to blabno)Great works thanks a lot
Best Regards Matthias.