You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by "Sengupta, Saikat - OCI" <Sa...@oci.state.wi.us> on 2007/08/03 23:56:28 UTC
ReturnListener not calling on Dialog Framework
Hello,
Sorry, I sent this earlier as part of some other thread. !!!!
I am trying to use the TRINIDAD Dialog Framework and I am using the same
Demo application, somehow when I am returning from the Dialog to the
Main page , it's not calling the ReturnListener method. Any body who can
help on this , I will appreciate.
I am enclosed the code whhich copied from the Developers Guide . Am I
missing something ????
Thanks
Sen
LaunchDialog.jsp
----------------
<%@ taglib uri="http://myfaces.apache.org/trinidad" prefix="tr" %>
<%@ taglib uri="http://myfaces.apache.org/trinidad/html" prefix="trh" %>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t" %>
<jsp:directive.page contentType="text/html;charset=utf-8"/>
<f:view>
<tr:document title="Dialog Demo" >
<tr:form>
<!-- The field for the value; we point partialTriggers
at the button to ensure it gets redrawn when we return -->
<tr:inputText label="Pick a number:" value="(Empty)"
partialTriggers="buttonId"
binding="#{launchDialog.input}"/>
<!-- The button for launching the dialog: we've also
configured the width and height of that window -->
<tr:commandButton text="Add" id="buttonId"
windowWidth="300" windowHeight="200"
partialSubmit="true" useWindow="true"
returnListener="#{launchDialog.returned}"
action="dialog:chooseInteger"/>
<h:commandButton action="chooseInteger"
id="buttonJSF" value="JSF"/>
</tr:form>
</tr:document>
</f:view>
ChooseInteger.jsp
------------------
<%@ taglib uri="http://myfaces.apache.org/trinidad" prefix="tr" %>
<%@ taglib uri="http://myfaces.apache.org/trinidad/html" prefix="trh" %>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t" %>
<jsp:directive.page contentType="text/html;charset=utf-8"/>
<f:view>
<trh:body>
<tr:document title="Add dialog">
<tr:form>
<!-- Two input fields -->
<h:panelGrid >
<tr:inputText label="Number 1:"
value="#{chooseInteger.value1}"
required="true" />
<tr:inputText label="Number 2:"
value="#{chooseInteger.value2}"
required="true" />
</h:panelGrid>
<!-- Two buttons -->
<h:panelGroup>
<tr:commandButton text="Submit"
action="#{chooseInteger.select}"/>
<tr:commandButton text="Cancel" immediate="true"
action="#{chooseInteger.cancel}"/>
</h:panelGroup>
</tr:form>
</tr:document>
</trh:body>
</f:view>
ChooseIntegerBean.java
----------------------
package org.apache.myfaces.trindaddemo;
import org.apache.myfaces.trinidad.context.RequestContext;
public class ChooseIntegerBean
{
public Integer getValue1()
{
return _value1;
}
public void setValue1(Integer value1)
{
_value1 = value1;
}
public Integer getValue2()
{
return _value2;
}
public void setValue2(Integer value2)
{
_value2 = value2;
}
public String cancel()
{
RequestContext.getCurrentInstance().returnFromDialog(null, null);
return null;
}
public String select()
{
Integer value = new Integer(getValue1().intValue() +
getValue2().intValue());
RequestContext.getCurrentInstance().returnFromDialog(value, null);
return null;
}
private Integer _value1=new Integer(10);
private Integer _value2=new Integer(10);
}
LaunchDialogBean.java
----------------------
package org.apache.myfaces.trindaddemo.dialog;
import org.apache.myfaces.trinidad.component.UIXInput;
import org.apache.myfaces.trinidad.event.ReturnEvent;
public class LaunchDialogBean
{
public UIXInput getInput()
{
return _input;
}
public void setInput(UIXInput input)
{
_input = input;
}
public void returned(ReturnEvent event)
{
System.out.println("Hello1");
if (event.getReturnValue() != null)
{
getInput().setSubmittedValue(null);
System.out.println("Hello");
getInput().setValue(event.getReturnValue());
}
}
public String showDialog()
{
System.out.println("Calling showDialog Method !");
return "dialog:chooseInteger";
}
private UIXInput _input;
}
Faces-Config.xml
----------------
<?xml version="1.0"?>
<!DOCTYPE faces-config PUBLIC "-//Sun Microsystems, Inc.//DTD JavaServer
Faces Config 1.0//EN"
"http://java.sun.com/dtd/web-facesconfig_1_0.dtd">
<faces-config>
<managed-bean>
<managed-bean-name>chooseInteger</managed-bean-name>
<managed-bean-class>org.apache.myfaces.trindaddemo.ChooseIntegerBean</ma
naged-bean-class>
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>
<managed-bean>
<managed-bean-name>launchDialog</managed-bean-name>
<managed-bean-class>org.apache.myfaces.trindaddemo.dialog.LaunchDialogBe
an</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>
<navigation-rule>
<from-view-id>/LaunchDialog.jsp</from-view-id>
<navigation-case>
<from-outcome>dialog:chooseInteger</from-outcome>
<to-view-id>/chooseInteger.jsp</to-view-id>
</navigation-case>
<navigation-case>
<from-outcome>chooseInteger</from-outcome>
<to-view-id>/faces/chooseInteger.jsp</to-view-id>
</navigation-case>
</navigation-rule>
<application>
<!-- Use the Trinidad RenderKit -->
<default-render-kit-id>org.apache.myfaces.trinidad.core</default-render-
kit-id>
<!-- DEFAULT/SUPPORTED LOCALE/S FOR THE DEMO -->
<locale-config>
<default-locale>en</default-locale>
<supported-locale>ru</supported-locale>
</locale-config>
</application>
</faces-config>
Web.xml
---------
<?xml version="1.0"?>
<!--
* Copyright 2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied.
* See the License for the specific language governing permissions and
* limitations under the License.
-->
<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<display-name>JSF Testing</display-name>
<context-param>
<description>State saving method: "client" or "server" (= default)
See JSF Specification 2.5.2</description>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>server</param-value>
</context-param>
<context-param>
<description>This parameter tells MyFaces if javascript code should be
allowed in the
rendered HTML output.
If javascript is allowed, command_link anchors will have
javascript code
that submits the corresponding form.
If javascript is not allowed, the state saving info and
nested parameters
will be added as url parameters.
Default: "true"</description>
<param-name>org.apache.myfaces.ALLOW_JAVASCRIPT</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<description>This parameter tells MyFaces if javascript code should be
allowed in the
rendered HTML output.
If javascript is allowed, command_link anchors will have
javascript code
that submits the corresponding form.
If javascript is not allowed, the state saving info and
nested parameters
will be added as url parameters.
Default: "false"
Setting this param to true should be combined with
STATE_SAVING_METHOD "server" for
best results.
This is an EXPERIMENTAL feature. You also have to enable the
detector filter/filter mapping below to get
JavaScript detection working.</description>
<param-name>org.apache.myfaces.DETECT_JAVASCRIPT</param-name>
<param-value>false</param-value>
</context-param>
<context-param>
<description>If true, rendered HTML code will be formatted, so that it
is "human readable".
i.e. additional line separators and whitespace will be
written, that do not
influence the HTML code.
Default: "true"</description>
<param-name>org.apache.myfaces.PRETTY_HTML</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<description>If true, a javascript function will be rendered that is
able to restore the
former vertical scroll on every request. Convenient feature
if you have pages
with long lists and you do not want the browser page to
always jump to the top
if you trigger a link or button action that stays on the
same page.
Default: "false"</description>
<param-name>org.apache.myfaces.AUTO_SCROLL</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>org.apache.myfaces.trinidad.USE_APPLICATION_VIEW_CACHE</para
m-name>
<param-value>false</param-value>
</context-param>
<context-param>
<param-name>org.apache.myfaces.trinidad.ALTERNATE_VIEW_HANDLER</param-na
me>
<param-value>com.sun.facelets.FaceletViewHandler</param-value>
</context-param>
<context-param>
<param-name>org.apache.myfaces.trinidadinternal.DISABLE_CONTENT_COMPRESS
ION</param-name>
<param-value>true</param-value>
</context-param>
<!-- WelcomeFile Filter
<filter>
<filter-name>WelcomeFile Filter</filter-name>
<filter-class>org.apache.myfaces.webapp.filter.WelcomeFileFilter</filter
-class>
<description>
Due to the manner in which the JSP / servlet lifecycle
functions, it is not currently possible to specify default
welcome files for a web application and map them to the
MyFacesServlet. Normally they will be mapped to the
default servlet for the JSP container. To offset this
shortcoming, we utilize a servlet Filter which examines
the URI of all incoming requests.
</description>
</filter>
JavaScriptDetector Filter
<filter>
<filter-name>javascriptDetector</filter-name>
<filter-class>org.apache.myfaces.webapp.filter.JavaScriptDetectorFilter<
/filter-class>
</filter>
Extensions Filter -->
<filter>
<filter-name>extensionsFilter</filter-name>
<filter-class>org.apache.myfaces.component.html.util.ExtensionsFilter</f
ilter-class>
<init-param>
<description>Set the size limit for uploaded files.
Format: 10 - 10 bytes
10k - 10 KB
10m - 10 MB
1g - 1 GB</description>
<param-name>uploadMaxFileSize</param-name>
<param-value>100m</param-value>
</init-param>
<init-param>
<description>Set the threshold size - files
below this limit are stored in memory, files above
this limit are stored on disk.
Format: 10 - 10 bytes
10k - 10 KB
10m - 10 MB
1g - 1 GB</description>
<param-name>uploadThresholdSize</param-name>
<param-value>100k</param-value>
</init-param>
<!-- <init-param>
<param-name>uploadRepositoryPath</param-name>
<param-value>/temp</param-value>
<description>Set the path where the intermediary files will
be stored.
</description>
</init-param>-->
</filter>
<filter>
<filter-name>trinidad</filter-name>
<filter-class>org.apache.myfaces.trinidad.webapp.TrinidadFilter</filter-
class>
</filter>
<filter>
<filter-name>MyFacesExtensionsFilter</filter-name>
<filter-class>org.apache.myfaces.webapp.filter.ExtensionsFilter</filter-
class>
<init-param>
<param-name>maxFileSize</param-name>
<param-value>20m</param-value>
</init-param>
</filter>
<filter>
<display-name>Ajax4jsf Filter</display-name>
<filter-name>ajax4jsf</filter-name>
<filter-class>org.ajax4jsf.Filter</filter-class>
</filter>
<!-- Filter Mappings
see MyFaces Filter above for a description
<filter-mapping>
<filter-name>WelcomeFile Filter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>javascriptDetector</filter-name>
<url-pattern>/_javascriptDetector_</url-pattern>
</filter-mapping>-->
<filter-mapping>
<filter-name>extensionsFilter</filter-name>
<url-pattern>/faces/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>trinidad</filter-name>
<servlet-name>faces</servlet-name>
</filter-mapping>
<filter-mapping>
<filter-name>MyFacesExtensionsFilter</filter-name>
<servlet-name>Faces Servlet</servlet-name>
</filter-mapping>
<filter-mapping>
<filter-name>MyFacesExtensionsFilter</filter-name>
<url-pattern>/faces/myFacesExtensionResource/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>MyFacesExtensionsFilter</filter-name>
<url-pattern>/faces/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>ajax4jsf</filter-name>
<servlet-name>Faces Servlet</servlet-name>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
<dispatcher>INCLUDE</dispatcher>
</filter-mapping>
<!-- Listener, that does all the startup work (configuration, init).
-->
<listener>
<listener-class>org.apache.myfaces.webapp.StartupServletContextListener<
/listener-class>
</listener>
<!-- Faces Servlet -->
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet>
<servlet-name>resources</servlet-name>
<servlet-class>org.apache.myfaces.trinidad.webapp.ResourceServlet</servl
et-class>
</servlet>
<!-- Faces Servlet Mapping
virtual path mapping
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>/faces/*</url-pattern>
</servlet-mapping>
extension mapping -->
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>/faces/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>resources</servlet-name>
<url-pattern>/adf/*</url-pattern>
</servlet-mapping>
<login-config>
<auth-method>BASIC</auth-method>
</login-config>
</web-app>
[Trinidad] skinning panelSideBar problem
Posted by "Perkins, Nate-P63196" <Na...@gdc4s.com>.
I am trying to skin the tr:panelSideBar
I'm trying to get a rounded bottom edge and have used the appropriate
tags (i believe) in the skin, namely, af|panelSideBar::bottom-end-icon,
etc
>From inspecting the output it does not seem like the panel sidebar is
generating border positions and these skin tags are never being
used....I looked at the renderer for the component but did not see an
obvious reason why this would be happening?
Can i skin the border for panelSideBar in the same way as I can for
panelBox??
Nate Perkins
480-441-3667
nate.perkins@gdc4s.com
This email message is for the sole use of the intended recipient(s) and
may contain GDC4S
confidential or privileged information. Any unauthorized review, use,
disclosure or distribution
is prohibited. If you are not an intended recipient, please contact the
sender by reply email and
destroy all copies of the original message.