-
1. creating popupPanel by reflection in RichFaces4.0
ilya40umov Jan 27, 2011 6:14 AM (in response to sumanjara)Take a look at these links:
I guess it should be one of these options(I'm not pretty sure because I've never tried this approach)
component-type
:org.richfaces.popupPanel
component-class
:org.richfaces.component.html.HtmlpopupPanel
-
2. creating popupPanel by reflection in RichFaces4.0
sumanjara Jan 27, 2011 6:21 AM (in response to ilya40umov)Hi, Iam using application.createComponent("org.richfaces.popupPanel");
The following exception i got.
Is this the right way to use?
SEVERE: javax.faces.FacesException: Expression Error: Named Object: org.richfaces.popupPanel not found.
at com.sun.faces.application.ApplicationImpl.createComponentApplyAnnotations(ApplicationImpl.java:1858)
at com.sun.faces.application.ApplicationImpl.createComponent(ApplicationImpl.java:911)
at com.usit.mes.web.bean.Tabs.createTabs(Tabs.java:43)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.el.parser.AstValue.invoke(AstValue.java:172)
at org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:105)
at javax.faces.event.MethodExpressionActionListener.processAction(MethodExpressionActionListener.java:148)
at javax.faces.event.ActionEvent.processListener(ActionEvent.java:88)
at javax.faces.component.UIComponentBase.broadcast(UIComponentBase.java:777)
at javax.faces.component.UICommand.broadcast(UICommand.java:300)
at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:787)
at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1252)
at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:81)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:312)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)
at java.lang.Thread.run(Unknown Source)
-
3. creating popupPanel by reflection in RichFaces4.0
ilya40umov Jan 27, 2011 7:16 AM (in response to sumanjara)Please, could you try org.richfaces.component.html.HtmlpopupPanel?
-
4. creating popupPanel by reflection in RichFaces4.0
ilya40umov Jan 27, 2011 7:37 AM (in response to ilya40umov)Raja,
I'm sorry if I will disappoint you but it looks like there is no such capability in RF 4.0 M5 and probably in the latest snapshot too. I downloaded the sources of RF a minute ago and I haven't find these classes. So may be I' mistaken but it seems that this functionality is not implemented at the moment. Let's wait for the answer from RF team.
-
5. creating popupPanel by reflection in RichFaces4.0
ilya40umov Jan 27, 2011 7:54 AM (in response to ilya40umov)My apologizes about my previouse message. I think you should better ignore it. I definitely must learn more about RF CDK. Because if something is not present in sources from SVN it does not mean that it doesn't exist. RF CDK generates a lot of classes automatically. So I was and am absolutely incompetent in this question.
Finally I've found this class in full sources from release package:
org.richfaces.component.UIPopupPanel
and this it contains the following line:
public static final String COMPONENT_TYPE="org.richfaces.PopupPanel";
I think that you should try UIPopupPanel.COMPONENT_TYPE.
-
6. creating popupPanel by reflection in RichFaces4.0
sumanjara Jan 27, 2011 11:57 PM (in response to ilya40umov)Hi,
Thanks Ilya Sorokoumov for your answer.
Can you help in doing this: When i click on command a popupPanel should open through reflection.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:a4j="http://richfaces.org/a4j"
xmlns:rich="http://richfaces.org/rich">
<h:head />
<h:body id="sd">
<f:view>
<h:form>
<rich:panel>
<h:panelGrid columns="1">
<h:outputText value="How many tabs would you like?" />
<h:panelGroup>
<h:inputText value="2" />
<a4j:commandButton value="Create"
actionListener="#{tabsBean.createTabs}" reRender="tabs" />
</h:panelGroup>
</h:panelGrid>
<h:panelGrid id="tabs" binding="#{tabsBean.panelGrid}" />
</rich:panel>
</h:form>
</f:view>
</h:body>
</html>
package com.usit.mes.web.bean;
import javax.faces.application.Application;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import javax.faces.component.UIComponent;
import javax.faces.component.html.HtmlMessage;
import javax.faces.component.html.HtmlOutputText;
import javax.faces.component.html.HtmlPanelGrid;
import javax.faces.context.FacesContext;
import javax.faces.event.ActionEvent;
import org.richfaces.component.UIPopupPanel;
import org.richfaces.component.html.HtmlTab;
import org.richfaces.component.html.HtmlTabPanel;
@ManagedBean(name = "tabsBean")
@SessionScoped
public class Tabs {
private HtmlPanelGrid panelGrid;
private Integer numOfTabs;
public Integer getNumOfTabs() {
return numOfTabs;
}
public void setNumOfTabs(Integer numOfTabs) {
this.numOfTabs = numOfTabs;
}
public Tabs() {
}
public HtmlPanelGrid getPanelGrid() {
return panelGrid;
}
public void setPanelGrid(HtmlPanelGrid panelGrid) {
this.panelGrid = panelGrid;
}
public void createTabs(ActionEvent event) {
FacesContext context = FacesContext.getCurrentInstance();
Application application = context.getApplication();
HtmlTabPanel tabPanel = (HtmlTabPanel) application
.createComponent(HtmlTabPanel.COMPONENT_TYPE);
// tabPanel.setSwitchType("ajax");
for (int i = 0; i < 1; i++) {
UIPopupPanel popupPanel = (UIPopupPanel) application
.createComponent(UIPopupPanel.COMPONENT_TYPE);
// tab.setLabel("Nice Tab # "+(i+1));
// tab.setName(i);
popupPanel.setHeight(100);
popupPanel.setId("ID");
popupPanel.setHeader("fdasf");
tabPanel.getChildren().add(popupPanel);
}
panelGrid.getChildren().clear();
panelGrid.getChildren().add(tabPanel);
}
}
-
7. creating popupPanel by reflection in RichFaces4.0
ilya40umov Jan 28, 2011 1:24 AM (in response to sumanjara)Do you want to create tabs or popup Panels? Please could you describe what are expecting to get? Because it's not clear now.
-
8. creating popupPanel by reflection in RichFaces4.0
sumanjara Jan 28, 2011 4:23 AM (in response to ilya40umov)Hi,
I want to create popups...
Code below.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:a4j="http://richfaces.org/a4j"
xmlns:rich="http://richfaces.org/rich">
<h:head />
<h:body id="sd">
<f:view>
<h:form>
<rich:panel>
<h:panelGrid columns="1">
<h:panelGroup>
<a4j:commandButton value="Create"
actionListener="#{popupPanelBean.createPopupPanel}"
reRender="popupPanelContainer" />
</h:panelGroup>
</h:panelGrid>
<h:panelGrid id="popupPanelContainer"
binding="#{popupPanelBean.panelGrid}" style="background-color:red;" />
</rich:panel>
</h:form>
</f:view>
</h:body>
</html>
package com.usit.mes.web.bean;
import javax.faces.application.Application;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import javax.faces.component.UIPanel;
import javax.faces.component.html.HtmlPanelGrid;
import javax.faces.context.FacesContext;
import javax.faces.event.ActionEvent;
import org.richfaces.component.UIPopupPanel;
@ManagedBean(name = "popupPanelBean")
@SessionScoped
public class PopupPanelBean {
private HtmlPanelGrid panelGrid;
public HtmlPanelGrid getPanelGrid() {
return panelGrid;
}
public void setPanelGrid(HtmlPanelGrid panelGrid) {
this.panelGrid = panelGrid;
}
public void createPopupPanel(ActionEvent event) {
FacesContext context = FacesContext.getCurrentInstance();
Application application = context.getApplication();
UIPanel panel = (UIPanel) application
.createComponent(UIPanel.COMPONENT_TYPE);
panel.setId("Tet");
// tabPanel.setSwitchType("ajax");
for (int i = 0; i < 1; i++) {
UIPopupPanel popupPanel = (UIPopupPanel) application
.createComponent(UIPopupPanel.COMPONENT_TYPE);
popupPanel.setHeight(100);
popupPanel.setShow(true);
popupPanel.setHeader("fdasf");
panel.getChildren().add(popupPanel);
}
panelGrid.getChildren().add(panel);
}
}
-
9. creating popupPanel by reflection in RichFaces4.0
ilya40umov Jan 28, 2011 7:28 AM (in response to sumanjara)Don't put UIPopupPanel inside h:form tag.
-
10. creating popupPanel by reflection in RichFaces4.0
sumanjara Jan 28, 2011 8:40 AM (in response to ilya40umov)Hi,
I tried...It doesnt works...
Kindly provide the solution.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:a4j="http://richfaces.org/a4j"
xmlns:rich="http://richfaces.org/rich">
<h:head />
<h:body id="sd">
<f:view>
<h:form>
<h:panelGrid columns="1">
<a4j:commandButton value="Create"
actionListener="#{popupPanelBean.createPopupPanel}"
reRender="popupPanelContainer" />
</h:panelGrid>
</h:form>
<h:panelGrid id="popupPanelContainer"
binding="#{popupPanelBean.panelGrid}" style="background-color:red;" />
</f:view>
</h:body>
</html>
package com.usit.mes.web.bean;
import javax.faces.application.Application;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import javax.faces.component.html.HtmlPanelGrid;
import javax.faces.context.FacesContext;
import javax.faces.event.ActionEvent;
import org.richfaces.component.UIPopupPanel;
@ManagedBean(name = "popupPanelBean")
@SessionScoped
public class PopupPanelBean {
private HtmlPanelGrid panelGrid;
public HtmlPanelGrid getPanelGrid() {
return panelGrid;}
public void setPanelGrid(HtmlPanelGrid panelGrid) {
this.panelGrid = panelGrid;
}
public void createPopupPanel(ActionEvent event) {
FacesContext context = FacesContext.getCurrentInstance();
Application application = context.getApplication();
UIPopupPanel popupPanel = (UIPopupPanel) application
.createComponent(UIPopupPanel.COMPONENT_TYPE);
popupPanel.setHeight(200);
popupPanel.setShow(true);
popupPanel.setHeader("POPUPPANEL TEST");
panelGrid.getChildren().add(popupPanel);
}
}
-
11. creating popupPanel by reflection in RichFaces4.0
ilya40umov Jan 28, 2011 8:47 AM (in response to sumanjara)1) a4j:commandButton in RF 4.0 does not have reRender attribute it has render instead.
2) (If the first advice won't fix your problem) Try to put h:panelGrid into a wrapper and use render="wrapper" in your a4j:commadButton
-
12. creating popupPanel by reflection in RichFaces4.0
sumanjara Jan 28, 2011 8:59 AM (in response to ilya40umov)Hi,
Still problems..
Code below:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:a4j="http://richfaces.org/a4j"
xmlns:rich="http://richfaces.org/rich">
<h:head />
<h:body id="sd">
<f:view>
<h:form>
<h:panelGrid columns="1">
<a4j:commandButton value="Create"
actionListener="#{popupPanelBean.createPopupPanel}"
render="wrapper" />
</h:panelGrid>
</h:form>
<rich:panel id="wrapper">
<h:panelGrid id="popupPanelContainer"
binding="#{popupPanelBean.panelGrid}" style="background-color:red;" />
</rich:panel>
</f:view>
</h:body>
</html>
package com.usit.mes.web.bean;
import javax.faces.application.Application;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import javax.faces.component.html.HtmlPanelGrid;
import javax.faces.context.FacesContext;
import javax.faces.event.ActionEvent;
import org.richfaces.component.UIPopupPanel;
@ManagedBean(name = "popupPanelBean")
@SessionScoped
public class PopupPanelBean {
private HtmlPanelGrid panelGrid;
public HtmlPanelGrid getPanelGrid() {
return panelGrid;}
public void setPanelGrid(HtmlPanelGrid panelGrid) {
this.panelGrid = panelGrid;
}
public void createPopupPanel(ActionEvent event) {
FacesContext context = FacesContext.getCurrentInstance();
Application application = context.getApplication();
UIPopupPanel popupPanel = (UIPopupPanel) application
.createComponent(UIPopupPanel.COMPONENT_TYPE);
popupPanel.setHeight(600);
popupPanel.setShow(true);
popupPanel.setHeader("POPUPPANEL TEST");
panelGrid.getChildren().add(popupPanel);
}
}
-
13. creating popupPanel by reflection in RichFaces4.0
ilya40umov Jan 28, 2011 9:06 AM (in response to sumanjara)1) Try to replace wrapp rich:panel with h:panelGroup
2) Use action instead of actionListener
I think I can't tell you much so it won't work please wait for the answer from RF team.
-
14. creating popupPanel by reflection in RichFaces4.0
sumanjara Jan 31, 2011 7:00 AM (in response to ilya40umov)Hi,
OK..I will wait for RF team response.