Bug in wicket tiny mce 1.4.18

2011-12-10 Thread Philipp

Dear Folks,

I think I found a bug in the Wicket Tiny MCE implementation version 1.4.18.

In class TinyMCESettings.java there's the following method:

public static void lazyLoadTinyMCEResource(IHeaderResponse response) {

String url = 
RequestCycle.get().urlFor(TinyMCESettings.javaScriptReference()).toString();
String base = url.substring(0, 
url.lastIndexOf(File.separatorChar));
response.renderJavascript(window.tinyMCEPreInit = {base : ' + 
base + ', suffix : '', query : ''};, tinyMceHackPreload);

response.renderJavascriptReference(TinyMCESettings.javaScriptReference());
response.renderJavascript(window.tinymce.dom.Event.domLoaded = 
true;, tinyMceHackPostload);

}


The first line returns a URL.  In the second line an attempt is made to 
extract a substring using the index of File.separatorChar. However, 
File.separatorChar on a Windows systems is \\. This is a character 
never found in a URL (there are usually only / characters). Thus, 
always -1 is returned and the substring operation fails with an index 
ouf of bounds:


java.lang.StringIndexOutOfBoundsException: String index out of range: -1
at java.lang.String.substring(String.java:1937) ~[na:1.6.0_27]
at 
wicket.contrib.tinymce.settings.TinyMCESettings.lazyLoadTinyMCEResource(TinyMCESettings.java:971) 
~[tinymce-1.4.18.jar:1.4.18 null -mike]
at 
wicket.contrib.tinymce.TinyMceBehavior.renderHead(TinyMceBehavior.java:60) 
~[tinymce-1.4.18.jar:1.4.18 null -mike]
at org.apache.wicket.Component.renderHead(Component.java:2806) 
~[wicket-1.4.18.jar:1.4.18]


Shall I file a bug report on this?

Philipp



-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Bypass CDATA contribution on script tags

2011-12-10 Thread Serban Balamaci
Hi Martin,
Problem was, the JS dev was specific about not wanting to contribute to the
head portion the JS template.
What I've done for a quick solution is that we moved the js templates in a
separate .tmpl files which sit next to the .html
Then I use a PackageTextTemplate to provide the template string to
replaceComponentTagBody of a WebMarkupContainer.

The template file contains all the embeded in script id=template1 tags.
This way he can keep editing the tmpl file and have it cleanly separated.

Thanks.

-
http://balamaci.wordpress.com 
--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Bypass-CDATA-contribution-on-script-tags-tp4176752p4180698.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Bug in wicket tiny mce 1.4.18

2011-12-10 Thread Michal Letynski

Just get an access to wicket-stuff and fix it by yourself.

W dniu 2011-12-10 20:07, Philipp pisze:

Dear Folks,

I think I found a bug in the Wicket Tiny MCE implementation version 
1.4.18.


In class TinyMCESettings.java there's the following method:

public static void lazyLoadTinyMCEResource(IHeaderResponse 
response) {


String url = 
RequestCycle.get().urlFor(TinyMCESettings.javaScriptReference()).toString();
String base = url.substring(0, 
url.lastIndexOf(File.separatorChar));
response.renderJavascript(window.tinyMCEPreInit = {base : ' 
+ base + ', suffix : '', query : ''};, tinyMceHackPreload);

response.renderJavascriptReference(TinyMCESettings.javaScriptReference());
response.renderJavascript(window.tinymce.dom.Event.domLoaded 
= true;, tinyMceHackPostload);

}


The first line returns a URL.  In the second line an attempt is made 
to extract a substring using the index of File.separatorChar. However, 
File.separatorChar on a Windows systems is \\. This is a character 
never found in a URL (there are usually only / characters). Thus, 
always -1 is returned and the substring operation fails with an index 
ouf of bounds:


java.lang.StringIndexOutOfBoundsException: String index out of range: -1
at java.lang.String.substring(String.java:1937) ~[na:1.6.0_27]
at 
wicket.contrib.tinymce.settings.TinyMCESettings.lazyLoadTinyMCEResource(TinyMCESettings.java:971) 
~[tinymce-1.4.18.jar:1.4.18 null -mike]
at 
wicket.contrib.tinymce.TinyMceBehavior.renderHead(TinyMceBehavior.java:60) 
~[tinymce-1.4.18.jar:1.4.18 null -mike]
at org.apache.wicket.Component.renderHead(Component.java:2806) 
~[wicket-1.4.18.jar:1.4.18]


Shall I file a bug report on this?

Philipp



-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org




-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Qeustions about SortedSet and ListMultipleChoice (with and without Metagen)

2011-12-10 Thread Igor Vaynberg
quickstart attached to a jira ticket will help

-igor

On Fri, Dec 9, 2011 at 12:15 PM, Jablow, Eric R eric.jab...@mantech.com wrote:
 In my project, for business reasons, we have classes with SortedSet members. 
 The classes and their elements are all Serializable.  I'm having trouble 
 working with a SortedSetMantechControl object; when I try creating a 
 ListMultipleChoiceMantechControl object for it (and putting it into a 
 FormComponentPanelSortedSetMantechControl), I get all sorts of 
 compilation problems.  The MantechControlPanel has constructor:

   public MantechControlPanel(String id,
            IModelSortedSetMantechControl model) {
        super(id, model);
        control = new ListMultipleChoiceMantechControl(
                choices, new SetModelNonICDisseminationControl(choices),
                choiceList, new ChoiceRendererMantechControl(
                        banner));
        add(control);
        onModelChanged();
    }

 The onModelChanged() method has (after I extracted some local objects in a 
 futile attempt to fix things):

    @Override
    protected void onModelChanged() {
        super.onModelChanged();
        if (getModelObject()!= null) {
           control.setModel(getModel());
        }

 The problem is that the control.setModel() expects a Model of a Collection, 
 while getModel() returns a  Model of a SortedSet:

    The method setModel(IModelCollection MantechControl ) in the type 
 FormComponentCollection MantechControl  is not applicable for the 
 arguments (IModelSortedSet MantechControl ). I have good business reasons 
 to use a sorted set, and what I think are good reasons to use a 
 FormComponentPanel and a ListMultipleChoice. But should I do something 
 different?

 Meanwhile, I've created a wicket/metagen quickstart project and am running 
 into a similar problem  there.  I can upload the project somewhere if you 
 want more info.  Here I wrote a class ColorfulPerson that has a String name 
 and a SortedSetColor colors.  In trying to write a FormComponentPanel for 
 this, I have an obvious error at the indicated line:

 public class ColorfulPersonPanel extends FormComponentPanelColorfulPerson {
 private static final long serialVersionUID = -457616015428125432L;
 private final FormComponentString name;
 private final FormComponentCollectionColor colors;
 private ListColor colorChoices = Arrays.asList(Color.values());
 public ColorfulPersonPanel(String id, IModelColorfulPerson model) {
                super(id, model);
                name = new TextFieldString(name, new ModelString());
                add(name);
                colors = new ListMultipleChoiceColor(colors, new 
 SetModelColor(), colorChoices);
                add(colors);
                onModelChanged();
 }
 @Override
 protected void onModelChanged() {
                super.onModelChanged();
                ColorfulPerson colorfulPerson = getModelObject();
                if (colorfulPerson != null) {
                                
 name.setModel(MetaModel.of(colorfulPerson).get(ColorfulPersonMeta.name));
                                
 colors.setModel(MetaModel.of(colorfulPerson).get(ColorfulPersonMeta.colors));
                                // Error as the model is one of 
 SortedSetColor while the ListMultipleChioice expects a model of 
 CollectionColor.

                } else {
                                name.setModelObject(null);
                                colors.setModelObject(null);
                }
 }

 Could there be a MetaModel.as(Class? castingClass) method?

 Respectfully,
 Eric Jablow

 This communication, along with any attachments, is covered by federal and 
 state law governing electronic communications and may contain company 
 proprietary and legally privileged information.  If the reader of this 
 message is not the intended recipient, you are hereby notified that any 
 dissemination, distribution, use or copying of this message is strictly 
 prohibited.  If you have received this in error, please reply immediately to 
 the sender and delete this message.  Thank you.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org