Re: T4.1.4-SNAPSHOT issue migrating from 4.0.2 with PopupLinkSubmit

2007-11-07 Thread Jesse Kuhnert
I think you need to pass in this to your script execute call,  the
current method you are executing is deprecated.

For the javascript calls you can refer to

http://tapestry.apache.org/tapestry4.1/javascript/index.html
and
http://tapestry.apache.org/tapestry4.1/jsdoc/index.html

where you should find the new function tapestry.form.submit(form)
(with some other additional documented optional arguments )

On Nov 6, 2007 7:36 PM, Dom Couldwell [EMAIL PROTECTED] wrote:

 We have a link on a page that does a submit and pops up a new window once the
 form has been submitted.

 The code is based on the PopupLinkSubmit example here:
 http://wiki.apache.org/tapestry/PopupLinkSubmit

 This all works fine on 4.0.2 but under 4.1.4-SNAPSHOT we get the following
 error when the page opens up:

 2007-11-06 18:35:10,197, ERROR,
 [org.apache.tapestry.services.impl.HiveMindExpressionCompiler], line 227,
 Error generating OGNL statements for expression class with root
 {href=javascript:submitPopupLink('editorForm',
 'PopupLinkSubmit','/GQ/Waiting.page');,
 [EMAIL PROTECTED]/editor.editorForm], class=action,
 popupLink=/GQ/Waiting.page, name=PopupLinkSubmit}
 org.apache.hivemind.ApplicationRuntimeException: Unable to add method void
 set(ognl.OgnlContext, java.lang.Object, java.lang.Object) to class
 $ASTProperty_116174fa4f8: [source error]
 put(java.lang.String,java.lang.Object) not found in java.lang.Object
   at
 org.apache.tapestry.enhance.ClassFabImpl.addMethod(ClassFabImpl.java:278)
   at
 org.apache.tapestry.services.impl.HiveMindExpressionCompiler.compileExpression(HiveMindExpressionCompiler.java:217)
   at ognl.OgnlRuntime.compileExpression(OgnlRuntime.java:523)
   at ognl.Ognl.compileExpression(Ognl.java:141)
 ...
 Caused by: javassist.CannotCompileException: [source error]
 put(java.lang.String,java.lang.Object) not found in java.lang.Object
   at javassist.CtBehavior.setBody(CtBehavior.java:347)
   at javassist.CtBehavior.setBody(CtBehavior.java:316)
   at
 org.apache.tapestry.enhance.ClassFabImpl.addMethod(ClassFabImpl.java:272)
   ... 137 more
 Caused by: compile error: put(java.lang.String,java.lang.Object) not found in
 java.lang.Object
   at javassist.compiler.TypeChecker.atMethodCallCore(TypeChecker.java:716)
   at javassist.compiler.TypeChecker.atCallExpr(TypeChecker.java:681)
   at
 javassist.compiler.JvstTypeChecker.atCallExpr(JvstTypeChecker.java:156)
   at javassist.compiler.ast.CallExpr.accept(CallExpr.java:45)
   at javassist.compiler.CodeGen.doTypeCheck(CodeGen.java:235)
   at javassist.compiler.CodeGen.atStmnt(CodeGen.java:323)
   at javassist.compiler.ast.Stmnt.accept(Stmnt.java:49)
   at javassist.compiler.CodeGen.atStmnt(CodeGen.java:344)
   at javassist.compiler.ast.Stmnt.accept(Stmnt.java:49)
   at javassist.compiler.CodeGen.atMethodBody(CodeGen.java:285)
   at javassist.compiler.Javac.compileBody(Javac.java:212)
   at javassist.CtBehavior.setBody(CtBehavior.java:341)
   ... 139 more

 Here's what's on the page:

   a href=#
  jwcid=@PopupLinkSubmit
  listener=listener:openEditorGraph
  popuppage=Waiting
  styleClass=action
  windowWidth=840
  windowHeight=550
 Generate Plot
   /a


 Here's PopupLinkSubmit.script

 ?xml version=1.0?
 !DOCTYPE script PUBLIC
 -//Apache Software Foundation//Tapestry Script Specification 3.0//EN
 http://jakarta.apache.org/tapestry/dtd/Script_3_0.dtd;
 script

 input-symbol key=name class=java.lang.String required=yes/
 input-symbol key=popupLink class=java.lang.String required=yes/
 input-symbol key=form class=org.apache.tapestry.IForm required=yes/
 input-symbol key=class class=java.lang.String required=no/

 let key=href
   javascript:submitPopupLink('${form.name}', '${name}','${popupLink}');
 /let

 let key=class
   ${class}
 /let

 /script

 Which comes out as:

   a href=javascript:submitPopupLink('editorForm',
 'PopupLinkSubmit','/GQ/Waiting.page'); class=action
 Generate Plot
   /a

 The Javascript we're rendering in PopupLinkSubmit.java comes out as:

 function submitPopupLink(form, elementId, url)
 {
   var windowName = 'RDQGraphPopup';
   var randomNumber = Math.floor(Math.random()*1000);
   windowName = windowName+randomNumber;
   aWindow = window.open(url, windowName, 'width=840, height=800,
 scrollbars=yes,resizable=yes', false);
   aWindow.focus();
   var form = document.getElementById(form);
   form.target=windowName;
   form.events.submit(elementId);
   form.target='';
 }

 I can supply the rest of the source if required but it's basically following
 the example I mentioned at the top.

 The rendered versions of the link and the Javascript are the same as under
 4.0.2 but we get the above error in the back end and the link does not work.
 We get a Javascript error stating that 'events' is null or not an object.
 This is referring to this line:
   

Re: T4.1.4-SNAPSHOT issue migrating from 4.0.2 with PopupLinkSubmit

2007-11-07 Thread Dom Couldwell
OK we updated the generated Javascript with the new version of the Javascript
function

function submitPopupLink(form, elementId, url)
{
  var windowName = 'RDQGraphPopup';
  var randomNumber = Math.floor(Math.random()*1000);
  windowName = windowName+randomNumber;
  aWindow = window.open(url, windowName, 'width=840, height=550,
scrollbars=yes,resizable=yes', false);
  aWindow.focus();
  var form = document.getElementById(form);
  form.target=windowName;
  tapestry.form.submit(form, elementId);
  form.target='';
}

this seems to allow the popup link to work but we're still getting the errors
in the back end.
They don't seem to have any ill effect but they are generated each time the
page serves.

For script generation we are using the version of the call passing this:

getScript().execute(this, cycle, pageRenderSupport, symbols);

(If this is the call Jessie meant)

Any ideas as to what is causing the error? Even though it does not seem to be
causing any problems I've a feeling it's gonna bite us in the ass at some
point...

Here's PopupLinkSubmit.java if it's any help. As I mentioned before it's
mostly copied from the online example I cited before.

public abstract class PopupLinkSubmit extends CustomSubmit {

/**
 * The name of an [EMAIL PROTECTED] 
org.apache.tapestry.IRequestCycle}attribute in
which
 * the current submit link is stored. LinkSubmits do not nest.
 */
public static final String ATTRIBUTE_NAME =
actualis.web.tapestry.PopupLinkSubmit;

public static final String ATTRIBUTE_NAME_SCRIPT =
actualis.web.tapestry.PopupLinkSubmitScript;

/**
 * The name of an [EMAIL PROTECTED] 
org.apache.tapestry.IRequestCycle}attribute in
which
 * the link submit component that generates the javascript function is
stored.
 * The function is only required once per page (containing a form with a
 * non-disabled LinkSubmit)
 */
public static final String ATTRIBUTE_FUNCTION_NAME =
actualis.web.tapestry.PopupLinkSubmit_function;

@InjectObject(engine-service:external)
public abstract IEngineService getExternalService();

@Parameter(required=false)
public abstract String getStyleClass();
@Parameter(defaultValue=900, required=false)
public abstract String getWindowHeight();
@Parameter(defaultValue=600, required=false)
public abstract String getWindowWidth();

/**
 * Checks the submit name ([EMAIL PROTECTED] 
FormConstants#SUBMIT_NAME_PARAMETER}) to
 * see if it matches this LinkSubmit's assigned element name.
 */
@Override
protected boolean isClicked(IRequestCycle cycle, String name) {
  String value = cycle.getParameter(FormConstants.SUBMIT_NAME_PARAMETER);

  return name.equals(value);
}

/**
 *
 * @param cycle
 * @return
 */
public ILink getLink(IRequestCycle cycle) {
  Object[] pageParameters =
  DirectLink.constructServiceParameters(getPopupParameters());
  ExternalServiceParameter esp =
  new ExternalServiceParameter(
  getPopupPage(),
  pageParameters);

  return getExternalService().getLink(false, esp);
}

public abstract Object getPopupParameters();

public abstract String getPopupPage();

/**
 * @see
org.apache.tapestry.form.AbstractFormComponent#renderFormComponent(org.apache.tapestry.IMarkupWriter,
 *  org.apache.tapestry.IRequestCycle)
 */
@Override
@SuppressWarnings(unchecked)
protected void renderFormComponent(IMarkupWriter writer, IRequestCycle
cycle) {
  boolean disabled = isDisabled();

  if (!disabled) {
PageRenderSupport pageRenderSupport =
TapestryUtils.getPageRenderSupport(cycle,this);

if (cycle.getAttribute(ATTRIBUTE_NAME_SCRIPT) == null) {

  BodyBuilder builder = new BodyBuilder();

  builder.addln();
  builder.addln(function {0}(form, elementId, url),
submitPopupLink);
  builder.begin();
  builder.addln(var windowName = 'RDQGraphPopup';);
  builder.addln(var randomNumber = Math.floor(Math.random()*1000););
  builder.addln(windowName = windowName+randomNumber;);
  builder.addln(aWindow = window.open(url, windowName, 
  + 'width=+getWindowWidth()+, height=+getWindowHeight()
  + , scrollbars=yes,resizable=yes'
  + , false););
  builder.addln(aWindow.focus(););
  builder.addln(var form = document.getElementById(form););
  builder.addln(form.target=windowName;);
  builder.addln(tapestry.form.submit(form, elementId););
  builder.addln(form.target='';);
  builder.end();

  pageRenderSupport.addBodyScript(
  this,
  builder.toString());
  cycle.setAttribute(ATTRIBUTE_NAME_SCRIPT, this);
}

IForm form = getForm();

String slink = getLink(cycle).getURL(null, true);
Map symbols = 

Re: T4.1.4-SNAPSHOT issue migrating from 4.0.2 with PopupLinkSubmit

2007-11-07 Thread Dom Couldwell
FYI, if we remove the PopupLinkSubmit component we don't get the errors
appearing in the logs so it's definitely related to something in that
component

Dom

---

This e-mail may contain confidential and/or privileged information. If you
are not the intended recipient (or have received this e-mail in error)
please notify the sender immediately and destroy this e-mail. Any
unauthorized copying, disclosure or distribution of the material in this
e-mail is strictly forbidden.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: T4.1.4-SNAPSHOT issue migrating from 4.0.2 with PopupLinkSubmit

2007-11-07 Thread Andreas Andreou
On 11/7/07, Jesse Kuhnert [EMAIL PROTECTED] wrote:
 I think you need to pass in this to your script execute call,  the
 current method you are executing is deprecated.

In fact, I removed it in 4.1.4-SNAPSHOT... it was deprecated since 4.1.1



 For the javascript calls you can refer to

 http://tapestry.apache.org/tapestry4.1/javascript/index.html
 and
 http://tapestry.apache.org/tapestry4.1/jsdoc/index.html

 where you should find the new function tapestry.form.submit(form)
 (with some other additional documented optional arguments )

 On Nov 6, 2007 7:36 PM, Dom Couldwell [EMAIL PROTECTED] wrote:
 
  We have a link on a page that does a submit and pops up a new window once 
  the
  form has been submitted.
 
  The code is based on the PopupLinkSubmit example here:
  http://wiki.apache.org/tapestry/PopupLinkSubmit
 
  This all works fine on 4.0.2 but under 4.1.4-SNAPSHOT we get the following
  error when the page opens up:
 
  2007-11-06 18:35:10,197, ERROR,
  [org.apache.tapestry.services.impl.HiveMindExpressionCompiler], line 227,
  Error generating OGNL statements for expression class with root
  {href=javascript:submitPopupLink('editorForm',
  'PopupLinkSubmit','/GQ/Waiting.page');,
  [EMAIL PROTECTED]/editor.editorForm], class=action,
  popupLink=/GQ/Waiting.page, name=PopupLinkSubmit}
  org.apache.hivemind.ApplicationRuntimeException: Unable to add method void
  set(ognl.OgnlContext, java.lang.Object, java.lang.Object) to class
  $ASTProperty_116174fa4f8: [source error]
  put(java.lang.String,java.lang.Object) not found in java.lang.Object
at
  org.apache.tapestry.enhance.ClassFabImpl.addMethod(ClassFabImpl.java:278)
at
  org.apache.tapestry.services.impl.HiveMindExpressionCompiler.compileExpression(HiveMindExpressionCompiler.java:217)
at ognl.OgnlRuntime.compileExpression(OgnlRuntime.java:523)
at ognl.Ognl.compileExpression(Ognl.java:141)
  ...
  Caused by: javassist.CannotCompileException: [source error]
  put(java.lang.String,java.lang.Object) not found in java.lang.Object
at javassist.CtBehavior.setBody(CtBehavior.java:347)
at javassist.CtBehavior.setBody(CtBehavior.java:316)
at
  org.apache.tapestry.enhance.ClassFabImpl.addMethod(ClassFabImpl.java:272)
... 137 more
  Caused by: compile error: put(java.lang.String,java.lang.Object) not found 
  in
  java.lang.Object
at 
  javassist.compiler.TypeChecker.atMethodCallCore(TypeChecker.java:716)
at javassist.compiler.TypeChecker.atCallExpr(TypeChecker.java:681)
at
  javassist.compiler.JvstTypeChecker.atCallExpr(JvstTypeChecker.java:156)
at javassist.compiler.ast.CallExpr.accept(CallExpr.java:45)
at javassist.compiler.CodeGen.doTypeCheck(CodeGen.java:235)
at javassist.compiler.CodeGen.atStmnt(CodeGen.java:323)
at javassist.compiler.ast.Stmnt.accept(Stmnt.java:49)
at javassist.compiler.CodeGen.atStmnt(CodeGen.java:344)
at javassist.compiler.ast.Stmnt.accept(Stmnt.java:49)
at javassist.compiler.CodeGen.atMethodBody(CodeGen.java:285)
at javassist.compiler.Javac.compileBody(Javac.java:212)
at javassist.CtBehavior.setBody(CtBehavior.java:341)
... 139 more
 
  Here's what's on the page:
 
a href=#
   jwcid=@PopupLinkSubmit
   listener=listener:openEditorGraph
   popuppage=Waiting
   styleClass=action
   windowWidth=840
   windowHeight=550
  Generate Plot
/a
 
 
  Here's PopupLinkSubmit.script
 
  ?xml version=1.0?
  !DOCTYPE script PUBLIC
  -//Apache Software Foundation//Tapestry Script Specification 
  3.0//EN
  http://jakarta.apache.org/tapestry/dtd/Script_3_0.dtd;
  script
 
  input-symbol key=name class=java.lang.String required=yes/
  input-symbol key=popupLink class=java.lang.String required=yes/
  input-symbol key=form class=org.apache.tapestry.IForm required=yes/
  input-symbol key=class class=java.lang.String required=no/
 
  let key=href
javascript:submitPopupLink('${form.name}', '${name}','${popupLink}');
  /let
 
  let key=class
${class}
  /let
 
  /script
 
  Which comes out as:
 
a href=javascript:submitPopupLink('editorForm',
  'PopupLinkSubmit','/GQ/Waiting.page'); class=action
  Generate Plot
/a
 
  The Javascript we're rendering in PopupLinkSubmit.java comes out as:
 
  function submitPopupLink(form, elementId, url)
  {
var windowName = 'RDQGraphPopup';
var randomNumber = Math.floor(Math.random()*1000);
windowName = windowName+randomNumber;
aWindow = window.open(url, windowName, 'width=840, height=800,
  scrollbars=yes,resizable=yes', false);
aWindow.focus();
var form = document.getElementById(form);
form.target=windowName;
form.events.submit(elementId);
form.target='';
  }
 
  I can supply the rest of the source if required but it's basically following
  the example I mentioned at the top.
 
  The rendered versions of 

Re: T4.1.4-SNAPSHOT issue migrating from 4.0.2 with PopupLinkSubmit

2007-11-07 Thread Jesse Kuhnert
No ideas are coming to mind right away,  other than it looks like it's
trying to do Map related functions without casting to map first.   It
is not a critical bug but it could potentially cause problems for you.
  Or at least be annoying to see during development and not as fast as
it could be in production.

I'll play around with this popuplinksubmit component later (maybe add
it to contrib) and see what I can find.

On Nov 7, 2007 2:26 PM, Dom Couldwell [EMAIL PROTECTED] wrote:
snipped
 Any ideas as to what is causing the error? Even though it does not seem to be
 causing any problems I've a feeling it's gonna bite us in the ass at some
 point...

/snipped


-- 
Jesse Kuhnert
Tapestry/Dojo team member/developer

Open source based consulting work centered around
dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]