PackageResourceReference and Doctype in Markup file

2011-10-10 Thread Dirk Forchel
What is the prefered way to replace removed HeaderContributors in Wicket 1.5?
The migration guide says:

Wicket 1.4:
public class MyPage extends WebPage {
  public MyPage() {
add(HeaderContributor.forCss(AbstractCalendar.class,
assets/skins/sam/calendar.css));
  }
}

becomes in Wicket 1.5:

public class MyPage extends WebPage {
  public MyPage() {
  }
  public void renderHead(IHeaderResponse response) {
response.renderCSSReference(new
PackageResourceReference(AbstractCalendar.class,
  assets/skins/sam/calendar.css));
  }
}

So I did in my classes.

My working class in Wicket 1.4 looks like:

public class DoctypeTestPage extends WebPage
{
public static final ResourceReference TEST_CSS = new
ResourceReference(DoctypeTestPage.class, test.css);

public DoctypeTestPage( final PageParameters parameters )
{
super( parameters );
add(CSSPackageResource.getHeaderContribution( TEST_CSS ) );
...
}
}

The same class in Wicket 1.5 looks like:

public class DoctypeTestPage extends WebPage
{
public static final ResourceReference TEST_CSS = new
PackageResourceReference(DoctypeTestPage.class, test.css);

public DoctypeTestPage( final PageParameters parameters )
{
super( parameters );
}
   @Override
public void renderHead(final IHeaderResponse response)
{
response.renderCSSReference( TEST_CSS );
}
}

I've noticed with Tamper Data, that with Wicket 1.5 the content type of the
css-Resource is text/html instead of  text/css with Wicket 1.4!!! This
causes the browser to switch into quirks mode in order to render the request
properly. The used markup header-tag is:

html
xmlns:wicket=http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd;

If I add the following Doctype declaration to the markup file, the browser
would never change into quirks mode, but also the CSS resource is not found
anymore. 

lt;!DOCTYPE html PUBLIC quot;-//W3C//DTD XHTML 1.0 Strict//ENquot;
quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtdquot;gt;
 html xmlns=http://www.w3.org/1999/xhtml;  
 
xmlns:wicket=http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd;  
  xml:lang=en  
  lang=en

Do I miss something? Or is this a bug with Wicket 1.5?




--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/PackageResourceReference-and-Doctype-in-Markup-file-tp3889467p3889467.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: PackageResourceReference and Doctype in Markup file

2011-10-10 Thread Martin Grigorov
Looks like a bug.
Please create a quickstart and attach it to ticket in Jira.
Thanks!

On Mon, Oct 10, 2011 at 11:02 AM, Dirk Forchel dirk.forc...@exedio.com wrote:
 What is the prefered way to replace removed HeaderContributors in Wicket 1.5?
 The migration guide says:

 Wicket 1.4:
 public class MyPage extends WebPage {
  public MyPage() {
    add(HeaderContributor.forCss(AbstractCalendar.class,
 assets/skins/sam/calendar.css));
  }
 }

 becomes in Wicket 1.5:

 public class MyPage extends WebPage {
  public MyPage() {
  }
  public void renderHead(IHeaderResponse response) {
    response.renderCSSReference(new
 PackageResourceReference(AbstractCalendar.class,
      assets/skins/sam/calendar.css));
  }
 }

 So I did in my classes.

 My working class in Wicket 1.4 looks like:

 public class DoctypeTestPage extends WebPage
 {
 public static final ResourceReference TEST_CSS = new
 ResourceReference(DoctypeTestPage.class, test.css);

        public DoctypeTestPage( final PageParameters parameters )
        {
                super( parameters );
                add(CSSPackageResource.getHeaderContribution( TEST_CSS ) );
                ...
        }
 }

 The same class in Wicket 1.5 looks like:

 public class DoctypeTestPage extends WebPage
 {
        public static final ResourceReference TEST_CSS = new
 PackageResourceReference(DoctypeTestPage.class, test.css);

        public DoctypeTestPage( final PageParameters parameters )
        {
                super( parameters );
        }
       @Override
        public void renderHead(final IHeaderResponse response)
        {
                response.renderCSSReference( TEST_CSS );
        }
 }

 I've noticed with Tamper Data, that with Wicket 1.5 the content type of the
 css-Resource is text/html instead of  text/css with Wicket 1.4!!! This
 causes the browser to switch into quirks mode in order to render the request
 properly. The used markup header-tag is:

 html
 xmlns:wicket=http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd;

 If I add the following Doctype declaration to the markup file, the browser
 would never change into quirks mode, but also the CSS resource is not found
 anymore.

 lt;!DOCTYPE html PUBLIC quot;-//W3C//DTD XHTML 1.0 Strict//ENquot;
 quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtdquot;gt;
  html xmlns=http://www.w3.org/1999/xhtml;

 xmlns:wicket=http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd;
      xml:lang=en
      lang=en

 Do I miss something? Or is this a bug with Wicket 1.5?




 --
 View this message in context: 
 http://apache-wicket.1842946.n4.nabble.com/PackageResourceReference-and-Doctype-in-Markup-file-tp3889467p3889467.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





-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

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



Re: PackageResourceReference and Doctype in Markup file

2011-10-10 Thread Dirk Forchel
After creating a quickstart I've noticed that this might not be a bug but
rather a problem with my application settings. I've got no problems with the
quickstart application and the test page running on Jetty. I let you know
what causes the problem.

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/PackageResourceReference-and-Doctype-in-Markup-file-tp3889467p3889587.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: PackageResourceReference and Doctype in Markup file

2011-10-10 Thread Dirk Forchel
I've figured out, that this might be a problem with autodetecting the content
type of a FileResourceStream. If our application uses the development mode,
we use our own ResourceStreamLocator for loading resources from the source
path rather than the class path. This was working in Wicket 1.4 without
problems. The used FileResourceStreams returned null as content type. 

In the FileResourceStream class you can find this ...

@Override
public String getContentType()
{
// Let ResourceStreamRequestTarget handle content-type automatically
return null;
}

Where in Wicket 1.4 the Response class has an appropriate method to detect
the content type automatically ...

public void detectContentType(RequestCycle requestCycle, String uri)
{
   ...
}

But in Wicket 1.5. this might be handled in another way. The returned
content type is always unknown for css-files or image files. In addition
with our own WicketFilter implementation, where by default the content type
for all requests handled by this filter is set to text/html, this results
in the problem described above.
Of course could our own ResourceStreamLocator handle the correct content
type, but the problem with auto-detecting the correct content type for
FileResourceStreams should be fixed anyway.


--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/PackageResourceReference-and-Doctype-in-Markup-file-tp3889467p3890212.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



W 1.5: templates added to head on ajax reload ...

2011-10-10 Thread armandoxxx
Hey guys. 

I've got a little question regarding templates. 

I'm creating a javascript chart and a chart needs a container to be drawn
in. To tell my javascript chart library what container to draw a chart in I
use a template. 

my template:


my markup file: 
div wicket:id=chart/div
wicket:container wicket:id=javascriptTemplate/wicket:container

now to the problem ... on ajax reload this template is added to head of the
page. 

and since JS code is executed before my container exists on a page, I get an
error that container is not found. 

any workaround for this ? 

Regards

Armando


--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/W-1-5-templates-added-to-head-on-ajax-reload-tp3890648p3890648.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



SelectOption and DropDownChoice

2011-10-10 Thread Daniele Dellafiore
Hi.

I need to add an attribute to an option inside a dropdown. I'd
rather have a DropDownChoice and the ability to add an
AttributeModifier to every option but I can't find a way to acccess
the single options of the drop down.

Instead I've read about solutions that involve SelectOption but I
can't get how SelectOptions and DropDownChoice are related, it seems
in no way. I do not clearly understand SelectOption.
I'd rather keep using a DropDownChoice which have a clear interface to
add options (just pass a list of elements in the constructor) and in
the selection model, which I do not find at all in the SelectOptions.

-- 
Daniele Dellafiore
http://danieledellafiore.net

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



Mounting external pages to root

2011-10-10 Thread Daniele Dellafiore
Hi.
I have now mounted some internal pages and then all the external are
mounted like:

getRootRequestMapperAsCompound().add(new MountedMapper(cms/${page},
ExternalPage.class) );

What I'd like is that ALL the URL that are not mounted with an
explicit mapper are automatically redirected to ExternalPage.class,
also keeping the ${page} parameter that I use internally in that page.

There's a nice way to do that?

Thanks.

-- 
Daniele Dellafiore
http://danieledellafiore.net

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



Re: W 1.5: templates added to head on ajax reload ...

2011-10-10 Thread Bas Gooren

Override Component#renderHeader(IHeaderResponse response)

and call response.renderOnDomReadyJavascript()

The above assumes wicket 1.5, although this is also possible in 1.4.

OnDomReady javascript code is handled properly for both regular and ajax 
requests.


Op 10-10-2011 17:27, schreef armandoxxx:

Hey guys.

I've got a little question regarding templates.

I'm creating a javascript chart and a chart needs a container to be drawn
in. To tell my javascript chart library what container to draw a chart in I
use a template.

my template:


my markup file:
div wicket:id=chart/div
wicket:container wicket:id=javascriptTemplate/wicket:container

now to the problem ... on ajax reload this template is added to head of the
page.

and since JS code is executed before my container exists on a page, I get an
error that container is not found.

any workaround for this ?

Regards

Armando


--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/W-1-5-templates-added-to-head-on-ajax-reload-tp3890648p3890648.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: W 1.5: templates added to head on ajax reload ...

2011-10-10 Thread Martin Grigorov
Replace wicket:container with div.
wicket:xyz are not normal DOM nodes and later Ajax functionality
cannot find such component for replacement.

On Mon, Oct 10, 2011 at 6:27 PM, armandoxxx armando@dropchop.com wrote:
 Hey guys.

 I've got a little question regarding templates.

 I'm creating a javascript chart and a chart needs a container to be drawn
 in. To tell my javascript chart library what container to draw a chart in I
 use a template.

 my template:


 my markup file:
 div wicket:id=chart/div
 wicket:container wicket:id=javascriptTemplate/wicket:container

 now to the problem ... on ajax reload this template is added to head of the
 page.

 and since JS code is executed before my container exists on a page, I get an
 error that container is not found.

 any workaround for this ?

 Regards

 Armando


 --
 View this message in context: 
 http://apache-wicket.1842946.n4.nabble.com/W-1-5-templates-added-to-head-on-ajax-reload-tp3890648p3890648.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





-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

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



Removing jsessionid in wicket 1.5

2011-10-10 Thread Gaetan Zoritchak
Hi,

Removing the jsessionid for scrawling robots is important to avoid the
duplicate content problem.

The solution proposed in the wiki
https://cwiki.apache.org/WICKET/seo-search-engine-optimization.html is not
working anymore. Does anyone knows the new way of doing it in wicket 1.5?

Thanks in advance,

Gaetan,


Retaining TextFilter cursor position on ajax update

2011-10-10 Thread Bertrand Guay-Paquet

Hello,

I am trying to use DataTable's FilterToolbar and friends to filter a 
table's contents. One of the columns is a string so I use the TextFilter 
class. However, I can't find how to properly integrate ajax with this.


I want the text field to submit the form when its input changes which 
triggers an ajax update of the table. I used an AjaxFormSubmitBehavior 
with the onkeyup. When the ajax update happens, the textfield of the 
TextFilter is also updated and the cursor position is lost (field focus 
however is restored through some built-in FilterForm javascript). Since 
the TextFilter is in a table header, I can't exclude it from the table 
ajax update.


Is there already a way to deal with this in Wicket? I would like to 
retain the text box state on the client side when the ajax update happens.


Some possible solutions:
-The textInput could be moved outside the table, but I'd like to avoid 
that for presentation reasons
-I could write javascript that attempts to find the cursor position 
before the ajax update and restores it afterward. I don't want to 
reinvent the wheel if a solution already exists.


Thanks for any suggestions,
Bertrand

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



Settting of PageManagerProvider is overridden in debug mode

2011-10-10 Thread Chris Colman
In debug mode, setting the page manager provider like this:
 
setPageManagerProvider(new MyPageManagerProvider(this));
 
in MyApplication#init()
 
gets overridden because after the derived class init() is called
Application executes some debug behaviour if in debug mode. This
behaviour always sets the PageManagerProvider to the
DebugPageManagerProvider, overriding any setting made in the derived
class' init() method. I need a custom PageManagerProvider in both debug
and production modes.
 
Is there any way around this?
 
Yours sincerely,
 
Chris Colman
 
Pagebloom Team Leader,
Step Ahead Software

 
pagebloom - your business  your website growing together
 
Sydney: (+61 2) 9656 1278 Canberra: (+61 2) 6100 2120 
Email: chr...@stepahead.com.au mailto://chr...@stepahead.com.au 
Website:
http://www.pagebloom.com blocked::http://www.pagebloom.com/ 
http://develop.stepaheadsoftware.com
blocked::http://develop.stepaheadsoftware.com/ 
 
 


RE: Settting of PageManagerProvider is overridden in debug mode

2011-10-10 Thread Chris Colman
I have a workaround that's probably a bit of a hack but it works ;)
 
I overwrite Application#validateInit() and set it there:
 
protected void validateInit()
{
super.validateInit();

setPageManagerProvider(new MyPageManagerProvider());
}
 
 
 


From: Chris Colman [mailto:chr...@stepaheadsoftware.com] 
Sent: Tuesday, 11 October 2011 8:24 AM
To: users@wicket.apache.org
Subject: Settting of PageManagerProvider is overridden in debug mode
 
In debug mode, setting the page manager provider like this:
 
  setPageManagerProvider(new MyPageManagerProvider(this));
 
in MyApplication#init()
 
gets overridden because after the derived class init() is called
Application executes some debug behaviour if in debug mode. This
behaviour always sets the PageManagerProvider to the
DebugPageManagerProvider, overriding any setting made in the derived
class' init() method. I need a custom PageManagerProvider in both debug
and production modes.
 
Is there any way around this?
 
Yours sincerely,
 
Chris Colman
 
Pagebloom Team Leader,
Step Ahead Software


pagebloom - your business  your website growing together
 
Sydney:   (+61 2) 9656 1278 Canberra: (+61 2) 6100 2120 
Email: chr...@stepahead.com.au mailto://chr...@stepahead.com.au 
Website:
http://www.pagebloom.com blocked::http://www.pagebloom.com/ 
http://develop.stepaheadsoftware.com
blocked::http://develop.stepaheadsoftware.com/ 
 
 


Re: SelectOption and DropDownChoice

2011-10-10 Thread Andrea Del Bene

Hi,

you can take a look at method AbstractChoice.appendOptionHtml. You can 
manipulate HTML overriding it. But I think there's no way to access to 
single options. I solved a similar problem using some JavaScript...

Hi.

I need to add an attribute to anoption  inside a dropdown. I'd
rather have a DropDownChoice and the ability to add an
AttributeModifier to every option but I can't find a way to acccess
the single options of the drop down.

Instead I've read about solutions that involve SelectOption but I
can't get how SelectOptions and DropDownChoice are related, it seems
in no way. I do not clearly understand SelectOption.
I'd rather keep using a DropDownChoice which have a clear interface to
add options (just pass a list of elements in the constructor) and in
the selection model, which I do not find at all in the SelectOptions.




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



RE: Is it possible to turn off page serialization in 1.5?

2011-10-10 Thread Chris Colman
I just turned off serializing using:

private class NullPageManagerProvider implements IPageManagerProvider
{
public IPageManager get(IPageManagerContext context)
{
return new NullPageManager(context);
}
}

But now the back button goes back one page only.

Is it possible to turn of serialization of the page but still keep a
'history' of pages visited so that back works correctly?

In 1.4.* I was not serializing pages but back/history still worked fine.

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



Re: Ajax : Modifying CallBackUrl in OnEvent()

2011-10-10 Thread Arjun Dhar
Hi,
I wound a solution/decent work-around to my problem.

So to re-explain it based on what Andrea says:
Yes, its true its too late and there is no pure API way. But there is a work
around.

Problem::
Modify the CallBackUrl for an event based on some condition that may occur
in the event.
Technically speaking, once the callback URL is defined you cannot change it
via the code (official Wicket API imo)


Solution Concepts::
At the end of it, its all JavaScript running, so if we can find a way of
updating the JavaScript on the target we have achieved our goal. The issue
is you dont really want to type all that javascript or hard code it, neither
do you want to create code in bits and pieces that are patched.

Solution Adopted:: (And anyone can fee free to provide a better solution)
Create a new Behavior of the same Class that created the original CallBack.
(Typically this extends AbstractDefaultAjaxBehavior  since you are working
with onEvent() you also implement AjaxEventBehavior). 

Step 1:
Now, In the onEvent(); you create the Behavior based on latest/new
conditions. This Behavior is also capable of giving you the new updated
Javascript without you having to write any JavAscript code.
Like my Behavior that extends AbstractDefaultAjaxBehavior
.getCallbackUrl();

Step 2: In the onEvent() add a String updatedCallbackScript = User
JavaScript or JQuery to modify the event attribute of the element and
replace with new function() {+newCallbackScript+};
(The one line is standard J.Script so its a bit hacky but I guess passable 
standard)

Step 3: In the onEvent() ... add:
target.appendJavascript(updatedCallbackScript);


...and it works!





-
Software documentation is like sex: when it is good, it is very, very good; and 
when it is bad, it is still better than nothing!
--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Ajax-Modifying-CallBackUrl-in-OnEvent-tp3863397p3892859.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