use of jakarta.faces.component.html.HtmlPanelGroup in project guide-jpa-intro by OpenLiberty.
the class EventBean method addErrorMessage.
/**
* Adds "Choose a valid time" message after selectOptions in user interface.
*/
private void addErrorMessage(ComponentSystemEvent event, String errorMessage) {
FacesContext context = FacesContext.getCurrentInstance();
FacesMessage message = new FacesMessage(errorMessage);
HtmlPanelGroup divEventTime = (HtmlPanelGroup) event.getComponent().findComponent("eventform:eventTime");
context.addMessage(divEventTime.getClientId(context), message);
}
use of jakarta.faces.component.html.HtmlPanelGroup in project myfaces by apache.
the class HtmlGroupRendererTest method setUp.
public void setUp() throws Exception {
super.setUp();
servletContext.addInitParameter(MyfacesConfig.RENDER_CLIENTBEHAVIOR_SCRIPTS_AS_STRING, "true");
panelGroup = new HtmlPanelGroup();
HtmlOutputText panelChildOutputText = new HtmlOutputText();
panelChildOutputText.setValue(PANEL_CHILD_TEXT);
panelGroup.getChildren().add(panelChildOutputText);
writer = new MockResponseWriter(new StringWriter(), null, null);
facesContext.setResponseWriter(writer);
facesContext.getViewRoot().setRenderKitId(MockRenderKitFactory.HTML_BASIC_RENDER_KIT);
facesContext.getRenderKit().addRenderer(panelGroup.getFamily(), panelGroup.getRendererType(), new HtmlGroupRenderer());
facesContext.getRenderKit().addRenderer(panelChildOutputText.getFamily(), panelChildOutputText.getRendererType(), new HtmlTextRenderer());
facesContext.getRenderKit().addClientBehaviorRenderer(AjaxBehavior.BEHAVIOR_ID, new HtmlAjaxBehaviorRenderer());
facesContext.getAttributes().put("org.apache.myfaces.RENDERED_FACES_JS", Boolean.TRUE);
}
use of jakarta.faces.component.html.HtmlPanelGroup in project myfaces by apache.
the class SimpleRequestBean method getPanel3.
/**
* @return the panel3
*/
public HtmlPanelGroup getPanel3() {
if (panel3 == null) {
FacesContext facesContext = FacesContext.getCurrentInstance();
ViewDeclarationLanguage vdl = facesContext.getApplication().getViewHandler().getViewDeclarationLanguage(facesContext, facesContext.getViewRoot().getViewId());
panel3 = new HtmlPanelGroup();
Map<String, Object> attributes = new HashMap<String, Object>();
attributes.put("src", "/staticPageBinding3_1.xhtml");
UIComponent component = vdl.createComponent(facesContext, "http://java.sun.com/jsf/facelets", "include", attributes);
panel3.getChildren().add(component);
}
return panel3;
}
use of jakarta.faces.component.html.HtmlPanelGroup in project myfaces by apache.
the class SimpleRequestBean method getPanel4.
/**
* @return the panel4
*/
public HtmlPanelGroup getPanel4() {
if (panel4 == null) {
FacesContext facesContext = FacesContext.getCurrentInstance();
ViewDeclarationLanguage vdl = facesContext.getApplication().getViewHandler().getViewDeclarationLanguage(facesContext, facesContext.getViewRoot().getViewId());
panel4 = new HtmlPanelGroup();
Map<String, Object> attributes = new HashMap<String, Object>();
UIComponent cc = vdl.createComponent(facesContext, "http://java.sun.com/jsf/composite/testComposite", "dynComp_1", attributes);
UIOutput text = (UIOutput) facesContext.getApplication().createComponent(UIOutput.COMPONENT_TYPE);
text.setValue("Dynamically added header");
cc.getFacets().put("header", text);
panel4.getChildren().add(cc);
}
return panel4;
}
use of jakarta.faces.component.html.HtmlPanelGroup in project myfaces by apache.
the class ComponentBindingVDLBean2 method getPanel.
public UIPanel getPanel() {
if (panel == null) {
panel = new HtmlPanelGroup();
FacesContext facesContext = FacesContext.getCurrentInstance();
if (facesContext.isPostback()) {
// Just try to mess the binding. In theory this does
// not have effect, because the binding with children
// or facets should be restored fully.
UIOutput out2 = new UIOutput();
out2.setValue("hello2");
panel.getChildren().add(out2);
}
UIOutput out = new UIOutput();
out.setValue("hello1");
panel.getChildren().add(out);
ViewDeclarationLanguage vdl = facesContext.getApplication().getViewHandler().getViewDeclarationLanguage(facesContext, facesContext.getViewRoot().getViewId());
Map<String, Object> attributes = new HashMap<String, Object>();
UIComponent cc = vdl.createComponent(facesContext, "http://java.sun.com/jsf/composite/testComposite", "dynComp_1", attributes);
cc.setId("ccpanel");
Map<String, Object> attributes2 = new HashMap<String, Object>();
UIComponent text = (UIComponent) vdl.createComponent(facesContext, "http://java.sun.com/jsf/composite/testComposite", "dynComp_2", attributes2);
text.setId("component");
cc.getFacets().put("header", text);
panel.getChildren().add(cc);
if (!facesContext.isPostback()) {
// Store something into the state
panel.getAttributes().put("attr1", "value1");
panel.getChildren().get(0).getAttributes().put("attr2", "value2");
} else {
// Try to mess the state, in theory it should not have effect
panel.getAttributes().remove("attr1");
panel.getChildren().get(0).getAttributes().remove("attr2");
}
}
return panel;
}
Aggregations