constructing a Dialog in java bean

UI Components for JSF
Post Reply
orkun
Posts: 4
Joined: 02 Sep 2011, 20:57

04 Nov 2011, 10:29

hello

I want to construct a Dialog in java bean programmatically.

If it is possible, could you give me hint ?

kind regards

Ahmet Temiz

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

04 Nov 2011, 10:30

Application.createComponent(Dialog.COMPONENT_TYPE);

....

User avatar
andyba
Expert Member
Posts: 2473
Joined: 31 Mar 2011, 16:27
Location: Steinfeld, near Bremen/Osnabrück, DE
Contact:

04 Nov 2011, 11:56

Don't forget to call the addChild method of the Component you want to add the newly created instance to.

Hint: with the binding attribute, standard to all jsf components including PrimeFaces, you can set the parent Component instance you need in your Bean.
PF 4.x (Elite versions), PF 5, Pf 5.1, PF 6.0
Glassfish 4.1, Mojarra 2.x, Java 8, Payara 4.1.1.
If you haven't read the forum rules read them now

orkun
Posts: 4
Joined: 02 Sep 2011, 20:57

05 Nov 2011, 12:26

hello
again

I tried this but it failed.

Application application = FacesContext.getCurrentInstance().getApplication();
Dialog dialog = (Dialog) application.createComponent(Dialog.COMPONENT_TYPE);
HtmlOutputText text = new HtmlOutputText();

HtmlPanelGrid panel_grid = (HtmlPanelGrid) application.createComponent(HtmlPanelGrid.COMPONENT_TYPE);

List pangrid_children = panel_grid.getChildren();

pangrid_children.clear();

panel_grid.setColumns(1);

panel_grid.setId("Panelgrid");

pangrid_children.add(text);
dialog.getChildren().add(panel_grid);

what did I do wrong

kind regards

robert.m
Posts: 226
Joined: 07 Dec 2010, 22:52
Location: Salzburg/Austria

05 Nov 2011, 13:03

as andyba already mentioned:
Don't forget to call the addChild method of the Component you want to add the newly created instance to.
Which means, you have to have a container in your page and you need to add the dialog as a child of this container inside of your bean

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 2 guests