You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Martin Piekorz <pi...@primion.de> on 2008/05/02 09:13:14 UTC

[TRINIDAD] PPR don't work in panelFromLayout (Tomcat)

Hi all,
I want to get a validFrom and validTo date. I want to limit the validTo date with help of PPR and the validateDateTimeRange tag like shown below.
This works fine when it is not inside a panelFormLayout!
If I put it inside a panelFromLayout  it don't work. I get also this warning:
No PPR-capable 'id' found for elements of CoreInputText[UIXEditableFacesBeanImpl, id=validFromLabel]. This component has not written-out an 'id' attribute.

<tr:form>
...
<tr:panelFormLayout rows="8">
<tr:inputDate id="validFromInput" label="validFrom" autoSubmit="true" value="#{person.validFrom}" required="true">
                                               <tr:convertDateTime pattern="yyyy-MM-dd HH:mm:ss.S"/>
            </tr:inputDate>
            <tr:inputDate id="validToInput" partialTriggers="validFromInput" label="ValidTo" value="#{person.validTo}">
                                               <tr:validateDateTimeRange minimum="#{person.validFrom}"/>
</tr:inputDate>
...
</tr:from>

What is the problem here? Could I layout this by an other way?

Thank you a lot of.
Kind regards
Martin

Re: [TRINIDAD] PPR don't work in panelFromLayout (Tomcat)

Posted by Matt Cooper <ma...@gmail.com>.
Hi Martin,

I'm not sure if this is exactly the problem you are running into but
one thought might be to wrap the input component that you want to PPR
inside of a panelLabelAndMessage (and setting simple="true" on the
input component).  This way the input becomes stand-alone and PPR-able
whereas without this change, you'd have to PPR the panelFormLayout.

Regards,
Matt

On Fri, May 2, 2008 at 1:13 AM, Martin Piekorz <pi...@primion.de> wrote:
>
>
>
>
> Hi all,
>
> I want to get a validFrom and validTo date. I want to limit the validTo date
> with help of PPR and the validateDateTimeRange tag like shown below.
>
> This works fine when it is not inside a panelFormLayout!
>
> If I put it inside a panelFromLayout  it don't work. I get also this
> warning:
>
> No PPR-capable 'id' found for elements of
> CoreInputText[UIXEditableFacesBeanImpl, id=validFromLabel]. This component
> has not written-out an 'id' attribute.
>
>
>
> <tr:form>
>
> …
>
> <tr:panelFormLayout rows="8">
>
> <tr:inputDate id="validFromInput" label="validFrom" autoSubmit="true"
> value="#{person.validFrom}" required="true">
>
>                                                <tr:convertDateTime
> pattern="yyyy-MM-dd HH:mm:ss.S"/>
>
>             </tr:inputDate>
>
>             <tr:inputDate id="validToInput" partialTriggers="validFromInput"
> label="ValidTo" value="#{person.validTo}">
>
>                                                <tr:validateDateTimeRange
> minimum="#{person.validFrom}"/>
>
> </tr:inputDate>
>
> …
>
> </tr:from>
>
>
>
> What is the problem here? Could I layout this by an other way?
>
>
>
> Thank you a lot of.
>
> Kind regards
>
> Martin

Re: Feasible without much effort to use panelPopup to recreate the JS confirm window?

Posted by Richard Yee <ri...@gmail.com>.
Wolfgang,
I would suggest using the trinidad dialog framework. To do this you would
need to do the following:

1) create a page for your dialog. this would be like something like this:

<?xml version="1.0" encoding="iso-8859-1" standalone="yes" ?>
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="1.2"
          xmlns:f="http://java.sun.com/jsf/core"
          xmlns:tr="http://myfaces.apache.org/trinidad">
  <jsp:directive.page contentType="text/html;charset=utf-8"/>
  <f:view>
    <tr:document title="Save Dialog">
 <f:loadBundle basename="com.somecompany.project.view.resources.messages"
                    var="bundle"/>
      <tr:form>
        <tr:panelPage>
          <f:facet name="branding">
            <tr:outputLabel value="Save Dialog"/>
          </f:facet>
          <tr:panelFormLayout rows="3" >
            <tr:panelBox inlineStyle="width:500px;">
                <tr:outputText value="#{bundle.save_msg}"/>
            </tr:panelBox>
            <tr:panelHorizontalLayout>
              <tr:commandButton text="Ok"

action="#{saveDialogBacking.handleDialogOkButton}"/>
              <tr:commandButton text="Cancel" immediate="true"

action="#{saveDialogBacking.handleDialogCancelButton}"/>
            </tr:panelHorizontalLayout>
          </tr:panelFormLayout>
        </tr:panelPage>
      </tr:form>
    </tr:document>
  </f:view>
</jsp:root>

2) in faces config put a navigation case in for the dialog that has a
from-outcome that starts with "dialog:
    <navigation-case>
      <from-outcome>dialog:saveDialog</from-outcome>
      <to-view-id>/dialogs/common/saveDialog.jspx</to-view-id>
    </navigation-case>

3) add the useWindow="true" and the  returnListener attributes to the
commandButton tag.

4) add this to your web.xml to enable lightweight dialogs
  <context-param>

<param-name>org.apache.myfaces.trinidad.ENABLE_LIGHTWEIGHT_DIALOGS</param-name>
    <param-value>true</param-value>
  </context-param>

5) add an action attribute with a method binding to an action handler
method. This method is going to return dialog:saveDialog" if the user has
made any changes or the next view id if they haven't.

6)  Add a dialog return listener to your backing bean
  /**
   * cancelDialogListener - a returnListener for the save changes
   * dialog.
   *
   * @param evt The ReturnEvent from the dialog.
   */
  public void cancelDialogListener(ReturnEvent evt) {
    String returnedValue = (String)evt.getReturnValue();

    if ("Ok".equals(returnedValue)) {

      saveChanges();

    }

      /* navigate user to new viewId */
      FacesContext context = FacesContext.getCurrentInstance();

context.getApplication().getNavigationHandler().handleNavigation(context,

null,

"the_next_view_id");

  }

7) The SaveDialogBacking class just needs these two methods:

  /**
   * handleDialogOkButton - controls page navigation from dialog
   * when user click OK button.
   * @return null
   */
  public String handleDialogOkButton() {
    RequestContext.getCurrentInstance().returnFromDialog("Ok", null);
    return null;
  }

  /**
   * handleDialogCancelButton - controls page navigation from dialog
   * when user clicks CANCEL button
   * @return null
   */
  public String handleDialogCancelButton() {
    RequestContext.getCurrentInstance().returnFromDialog("Cancel", null);
    return null;
  }
 I think this is all you need to do. Let me know if you have any questions.

-Richard


On 5/2/08, wolfgang.toepfer@pta.de <wo...@pta.de> wrote:
>
>
> Hi,
>
> Wondering if sth. like
>
> <tr:commandButton
>                         rendered="#{identity.hasPrivilegeUpdate()}"
>                         id="vehicleSpeichern"
>                         actionListener="#{TC1302.exit}"
>                         onclick="return
> confirm('#{messages['ask_if_really_save']}')" />
>
> would be possible with panelPopup. I mean, just to get better looks as the
> JS confirm really does not have  much appeal.. ;)
>
> So in theory I would think of
>
> onclick="TrPanelPopup.show(..):.."
>
> but my knowledge on the Trinidad JS seems somewhat limited any links to
> further doc much appreciated.. ;)
>
> Already done it? Or any other suggestions?
>
> Thanks
> Wolfgang
>
>

Re: Feasible without much effort to use panelPopup to recreate the JS confirm window?

Posted by Andrew Robinson <an...@gmail.com>.
I can't recommend a way to do it at the moment, but I can tell you to
never use return from a component JavaScript. Use "if
(!confirm('blah')) return false;". That way renderer injected JS that
appends to the event is still run when true.

On Fri, May 2, 2008 at 9:52 AM,  <wo...@pta.de> wrote:
>
> Hi,
>
> Wondering if sth. like
>
> <tr:commandButton
>                         rendered="#{identity.hasPrivilegeUpdate()}"
>                         id="vehicleSpeichern"
>                         actionListener="#{TC1302.exit}"
>                         onclick="return
> confirm('#{messages['ask_if_really_save']}')" />
>
> would be possible with panelPopup. I mean, just to get better looks as the
> JS confirm really does not have  much appeal.. ;)
>
> So in theory I would think of
>
> onclick="TrPanelPopup.show(..):.."
>
> but my knowledge on the Trinidad JS seems somewhat limited any links to
> further doc much appreciated.. ;)
>
> Already done it? Or any other suggestions?
>
> Thanks
> Wolfgang
>
>

Feasible without much effort to use panelPopup to recreate the JS confirm window?

Posted by wo...@pta.de.
Hi,

Wondering if sth. like

<tr:commandButton
                        rendered="#{identity.hasPrivilegeUpdate()}"
                        id="vehicleSpeichern"
                        actionListener="#{TC1302.exit}"
                        onclick="return 
confirm('#{messages['ask_if_really_save']}')" />

would be possible with panelPopup. I mean, just to get better looks as the 
JS confirm really does not have  much appeal.. ;)

So in theory I would think of

onclick="TrPanelPopup.show(..):.."

but my knowledge on the Trinidad JS seems somewhat limited any links to 
further doc much appreciated.. ;)

Already done it? Or any other suggestions?

Thanks
Wolfgang