[ 
https://issues.apache.org/jira/browse/WICKET-2345?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12724445#action_12724445
 ] 

Marcin Palka edited comment on WICKET-2345 at 6/26/09 2:27 AM:
---------------------------------------------------------------

I attached a patch file that fixes the issue. 

The problem is in getWindowOpenJavascript method that was changed a couple of 
months ago (April or so).

At some point the getWindowOpenJavascript method takes the booleand value of 
sResizable() method and converts to String.
appendAssignment(buffer, "settings.resizable", Boolean.toString(isResizable()));
Then it calls the appendAssignment method that actually appends a String value 
to the output javascript code.
The problem is that the appendAssignment quotes Strings.
This makes the generated javascript code line look like the following:
settings.resizable="false"
Which I believie is not a boolean value in Javascript.

I created another appendAssignment method that takes a boolean as a value 
parameter and puts it into the script in unquoted form:
private void appendAssignment(final AppendingStringBuffer buffer, final 
CharSequence key,
final boolean value)
{
buffer.append(key).append("=");
buffer.append(Boolean.toString(value));
buffer.append(";\n");
}
Then I replaced a line in the getWindowOpenJavascript to call my method instead 
of the one that takes String value.
From:
appendAssignment(buffer, "settings.resizable", Boolean.toString(isResizable()));
to:
appendAssignment(buffer, "settings.resizable", isResizable());



      was (Author: mpalka):
    A patch file that fixes the issue. The problem is in 
getWindowOpenJavascript method that has been changed a couple of months ago 
(April or so).

It converts the boolean value of sResizable() method to String.
appendAssignment(buffer, "settings.resizable", Boolean.toString(isResizable()));
Then it calls the appendAssignment method that actually appends a String value 
to the output javascript code.
The problem is that the appendAssignment quotes Strings.
This makes the generated javascript code line look like the following:
settings.resizable="false"
Which I believie is not a boolean value in Javascript.

I created another appendAssignment method that takes a boolean as a value 
parameter and puts it into the script in unquoted form:
private void appendAssignment(final AppendingStringBuffer buffer, final 
CharSequence key,
final boolean value)
{
buffer.append(key).append("=");
buffer.append(Boolean.toString(value));
buffer.append(";\n");
}
Then I replaced a line in the getWindowOpenJavascript to call my method instead 
of the one that takes String value.
From:
appendAssignment(buffer, "settings.resizable", Boolean.toString(isResizable()));
to:
appendAssignment(buffer, "settings.resizable", isResizable());


  
> ModalWindow.setResizable(false) does not work after 1.4-rc4
> -----------------------------------------------------------
>
>                 Key: WICKET-2345
>                 URL: https://issues.apache.org/jira/browse/WICKET-2345
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket-extensions
>    Affects Versions: 1.4-RC4
>         Environment: Windows Vista 64-bit, Tomcat 6.0.18, JDK 16u14
>            Reporter: Marcin Palka
>            Priority: Minor
>         Attachments: ModalWindow.java.patch, quickstart.zip
>
>
> I haven't been able to make a fixed size modal window since I migrated my 
> application to Wicket 1.4-rc5. The same problem exists while using Wicket 
> 1.4-rc4. On the other hand everything works just fine with the 1.4rc-2. I 
> will attach a quickstart that allows to reproduce the problem.
> It's looks like that there were some modification made to the ModalWindow 
> component between rc2 and rc4 because my application crashes when switching 
> between those two versions. It crashes with an exception as follows:
> java.lang.NoSuchMethodError: 
> nl.stuq.SelectModalWindow.setInitialWidth(I)Lorg/apache/wicket/extensions/ajax/markup/html/modal/ModalWindow.
>  
> A clean and build makes the trick to make it work again.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to