RE: Writing to header causes 'not yet working' code to be executed

2012-04-02 Thread Chris Colman
The strange thing is - I do have a  in my markup!

And it appears to render to the head section ok most of the time even
though it displays the message.

It really only fails, in a functional way, when I call
response.renderString twice within the renderHead method:

void renderHead
{
super.renderHead(response);

// Canonical URL
String canonicalUrl = getCanonicalUrl();
if ( !StringUtils.isEmpty(canonicalUrl) )
response.renderString("");  // If this line is not executed then head
render works but still displays message.

// GoogleTrackingCode
WebsiteMgr websiteMgr = getWebsiteMgr();

if (websiteMgr != null)
{
String trackingHeadCode = websiteMgr.getEndBodyCode();

if ( !StringUtils.isEmpty(trackingHeadCode))
response.renderString(trackingHeadCode);
}
}

>-Original Message-
>From: Martin Grigorov [mailto:mgrigo...@apache.org]
>Sent: Monday, 2 April 2012 4:58 PM
>To: users@wicket.apache.org
>Subject: Re: Writing to header causes 'not yet working' code to be
executed
>
>Hi,
>
>Can you create a quickstart ?
>There is a special IMarkupFilter that creates  automatically if
you
>don't have one in your page markup. For some reason it seems it didn't
>work.
>
>On Sun, Apr 1, 2012 at 11:16 PM, Chris Colman
>wrote:
>
>> ** **
>>
>> I've overridden renderHead to write to the header of the page but I
get a
>> strange error message that I have not been able to work out. It
executes
>> some code that has a 'not implemented' comment:
>>
>> ** **
>>
>> The code is in WebPage:
>>
>> ** **
>>
>> /**
>>
>>  * Validate that each component which wanted to
contribute to
>> the header section actually was
>>
>>  * able to do so.
>>
>>  */
>>
>> private void validateHeaders()
>>
>> {
>>
>> // search for HtmlHeaderContainer in the
first
>> level of children or deeper
>>
>> // if there are transparent resolvers
used
>>
>> HtmlHeaderContainer header =
visitChildren(new
>> IVisitor()
>>
>> {
>>
>> public void component(final
Component
>> component, final IVisit visit)
>>
>> {
>>
>> if (component
instanceof
>> HtmlHeaderContainer)
>>
>> {
>>
>>
visit.stop((
>> HtmlHeaderContainer)component);
>>
>> }
>>
>> else if (component
>> instanceof TransparentWebMarkupContainer == false)
>>
>> {
>>
>>
>> visit.dontGoDeeper();
>>
>> }
>>
>> }
>>
>> });
>>
>> ** **
>>
>> if (header == null)
>>
>> {
>>
>> // the markup must at least
contain a
>>  tag for wicket to automatically
>>
>> // create a HtmlHeaderContainer.
Log
>> an error if no header container
>>
>> // was created but any of the
>> components or behaviors want to contribute
>>
>> // something to the header.
>>
>> header = new HtmlHeaderContainer(
>> HtmlHeaderSectionHandler.HEADER_ID);
>>
>> add(header);
>>
>> ** **
>>
>> Response orgResponse =
>getRequestCycle
>> ().getResponse();
>>
>> try
>>
>> {
>>
>> final
>StringResponseresponse = new
>> StringResponse();
>>
>> getRequestCycle().
>> setResponse(response);
>>
>> ** **
>>
>> // Render all header
>> sections of all components on the page
>>
>>
>> AbstractHeaderRenderStrategy.get().renderHeader(header,
getPage());
>>
>> response.close();
>>
>> ** **
>>
>> if
>(response.getBuffer().length()
>> > 0)
>>
>> {
>>
>> // @TODO
it
>> is not yet working properly. JDo to fix it
>>
>>
log.error(
>>
>"^^

>^^^");
>> 
>>
>>
>log.error("You
>> probably forgot to add a  or  ta

NumberValidator.MinimumValidator

2012-04-02 Thread SudeepShakya
I am reading Enjoying Web Programming with wicket(1st edition). And I found
out that there is no such thing in wicket 1.5.x. So how to implement these
type of function in wicket 1.5.x ?

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/NumberValidator-MinimumValidator-tp4525647p4525647.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: NumberValidator.MinimumValidator

2012-04-02 Thread James Carman
http://wicket.apache.org/apidocs/1.5/org/apache/wicket/validation/validator/MinimumValidator.html

On Mon, Apr 2, 2012 at 6:12 AM, SudeepShakya  wrote:
> I am reading Enjoying Web Programming with wicket(1st edition). And I found
> out that there is no such thing in wicket 1.5.x. So how to implement these
> type of function in wicket 1.5.x ?
>
> --
> View this message in context: 
> http://apache-wicket.1842946.n4.nabble.com/NumberValidator-MinimumValidator-tp4525647p4525647.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
>

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



Re: NumberValidator.MinimumValidator

2012-04-02 Thread Luca Provenzani

Hi,
try:

Class MinimumValidator & 
java.io.Serializable>


Bye
Luca

Il 02/04/2012 12:12, SudeepShakya ha scritto:

I am reading Enjoying Web Programming with wicket(1st edition). And I found
out that there is no such thing in wicket 1.5.x. So how to implement these
type of function in wicket 1.5.x ?

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/NumberValidator-MinimumValidator-tp4525647p4525647.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




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



Re: NumberValidator.MinimumValidator

2012-04-02 Thread SudeepShakya
Thanx !!

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/NumberValidator-MinimumValidator-tp4525647p4525707.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



mapping / mounting of PIE.htc for IE

2012-04-02 Thread Bert
Hi list,

in a current project I need to support IE <9. For this, the designer
have decided to use pie.htc (http://css3pie.com/) which adds CSS3
support via IE behaviours.

This pie.htc file is referenced from css. Unfortunately, IE is not
looking for the file relative to the css, but relative to the html
file is is used in.
This makes it rather hard to mount the pie.htc file in a wicket application.

My idea was to write an IRequestMapper implementation that decides if
a request is for the pie.htc and if so returns an IRequestHandler to
serve that file.

Is that a possible way to go? Can I 'reuse' a ResourceRequestHandler
for the actual delivery?

Thanks in advance for any hints

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



RadioGroup selections after validation failure problem

2012-04-02 Thread Matt Stevenson
Hi All,

My company has just started evaluating Wicket on an app that allows users to 
select and merge multiple PowerPoint presentations. 

We’ve hit a bit of a problem though, basically at the moment we have one long 
form containing a number of section panels. 

The section panels are either ‘multi select’ (a Panel containing a CheckGroup 
that contains Check objects representing the PowerPoint presentations in that 
section) or ‘single select’ (a Panel containing a RadioGroup that contains 
Radio objects).

The problem happens when a validation failure occurs. Basically the checkboxes 
that the user selected prior to the validation failure are remembered and 
repopulated when the user is bounced back to the page but the radio buttons 
that the user selected aren’t remembered.

Any help would be gratefully received, I’ve snipped out what I think are the 
relevant bits of code below...

Thanks
Matt


FORM CODE:
__

public class PresentationSelectionForm extends 
Form implements Serializable
{
private static final long serialVersionUID = 5962930827736414107L;

final DownloadLinkPanel dlPanel = 
DownloadLinkPanel.getEmptyLink("downloadLinkPanel");
final HiddenField messageIndicator = new 
HiddenField("messageIndicator", new Model("0"));

private List selectors = new 
ArrayList();

@SpringBean
private AssetBankService assetBankService;



public PresentationSelectionForm(String name, List sections, final 
PageParameters parameters)
{
super(name, new 
CompoundPropertyModel(new 
PresentationSelectionFormModel()));

add(new FeedbackPanel("feedback"));
add(dlPanel);
add(messageIndicator);

HiddenField mandatorySections = new 
HiddenField("requiredSections", new 
Model(getIdListFromMandatorySections(sections)));
add(mandatorySections);

ListView sectionList = new ListView("sections", 
sections)
{
private static final long serialVersionUID = 7480938703389583883L;

protected void populateItem(ListItem sectionItem)
{
sectionItem.add(new Label("sectionTitle", 
sectionItem.getModelObject().getTitle()));
PresentationMultiSelectPanel multi = new 
PresentationMultiSelectPanel("presentationMultiSelectPanel", sectionItem);
PresentationSingleSelectPanel single = new 
PresentationSingleSelectPanel("presentationSingleSelectPanel", sectionItem);
selectors.add(multi);
selectors.add(single);
sectionItem.add(multi);
sectionItem.add(single);
}
};

sectionList.setReuseItems(true);
add(sectionList);
}



@Override 
public void onSubmit()
{
//create the list of asset bank ids to merge from the panel input...
List assetBankAssetIds = new ArrayList();

for (PresentationSelector selector : selectors)
{
assetBankAssetIds.addAll(selector.getSelectedAssetBankAssetIds());
}

if (assetBankAssetIds.size() == 0)
{
error("Unable to complete merge, no presentations were selected. 
Please select from the list then try again");
} 
else if (!allMandatorySectionsAreCompleted())
{
error("Unable to complete merge, not all mandatory sections were 
completed. Please complete all mandatory sections and try again");
} 
else
{
try
{
File mergedPresentations = 
assetBankService.getMergedPresentations(assetBankAssetIds);

addOrReplace(DownloadLinkPanel.getLinkToResourceFile("downloadLinkPanel", 
mergedPresentations, "Download your file: "+mergedPresentations.getName()));
}
catch (IOException e)
{
throw new RuntimeException("Error merging presentations", e);
}
}

addOrReplace(new HiddenField("messageIndicator", new 
Model("1")));
}
}



SINGLE SELECT PANEL CODE:




public class PresentationSingleSelectPanel extends Panel implements 
PresentationSelector, Serializable
{
private static final long serialVersionUID = 7062146893868378278L;

private Section section;
final RadioGroup group = new 
RadioGroup("presentationSingleSelectGroup");

public PresentationSingleSelectPanel(String id, ListItem 
sectionItem)
{
super(id);
section = sectionItem.getModelObject();

ListView presentations = new 
ListView("presentations", 
sectionItem.getModelObject().getPresentations()) 
{
private static final long serialVersionUID = -2741478778745270525L;

protected void populateItem(ListItem presentationItem)
{
presentationItem.add(new Radio("presentation", 
presentationItem.getModel()));
presentationItem.ad

Re: Version Pages by default

2012-04-02 Thread sudeivas
Now I am using 

IRequestMapper cryptoMapper = new CryptoMapper(getRootRequestMapper(),
this);
setRootRequestMapper(cryptoMapper);

By this way the page parameters are encrypted. I hope it will not affect
recreating the page from page mount when the page expiration happens. 

Also can you please answer my above question regarding StalePageException or
any links to regarding this will also help.

Thanks,
Suresh

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Version-Pages-by-default-tp4520432p4526510.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: Version Pages by default

2012-04-02 Thread Martin Grigorov
On Mon, Apr 2, 2012 at 6:28 PM, sudeivas  wrote:
> Now I am using
>
> IRequestMapper cryptoMapper = new CryptoMapper(getRootRequestMapper(),
> this);
> setRootRequestMapper(cryptoMapper);
>
> By this way the page parameters are encrypted. I hope it will not affect
> recreating the page from page mount when the page expiration happens.
>
> Also can you please answer my above question regarding StalePageException or
> any links to regarding this will also help.

See the javadoc of Page#renderCount field.

>
> Thanks,
> Suresh
>
> --
> View this message in context: 
> http://apache-wicket.1842946.n4.nabble.com/Version-Pages-by-default-tp4520432p4526510.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: RadioGroup selections after validation failure problem

2012-04-02 Thread Andrea Del Bene

HI,

try giving a model to your RadioGroup:

final RadioGroup group = new 
RadioGroup("presentationSingleSelectGroup", new 
Model());




Hi All,

My company has just started evaluating Wicket on an app that allows users to 
select and merge multiple PowerPoint presentations.

We’ve hit a bit of a problem though, basically at the moment we have one long 
form containing a number of section panels.

The section panels are either ‘multi select’ (a Panel containing a CheckGroup 
that contains Check objects representing the PowerPoint presentations in that 
section) or ‘single select’ (a Panel containing a RadioGroup that contains 
Radio objects).

The problem happens when a validation failure occurs. Basically the checkboxes 
that the user selected prior to the validation failure are remembered and 
repopulated when the user is bounced back to the page but the radio buttons 
that the user selected aren’t remembered.

Any help would be gratefully received, I’ve snipped out what I think are the 
relevant bits of code below...

Thanks
Matt


FORM CODE:
__

public class PresentationSelectionForm extends 
Form  implements Serializable
{
 private static final long serialVersionUID = 5962930827736414107L;

 final DownloadLinkPanel dlPanel = 
DownloadLinkPanel.getEmptyLink("downloadLinkPanel");
 final HiddenField  messageIndicator = new HiddenField("messageIndicator", 
new Model("0"));

 private List  selectors = new 
ArrayList();

 @SpringBean
 private AssetBankService assetBankService;



 public PresentationSelectionForm(String name, List  sections, 
final PageParameters parameters)
 {
 super(name, new 
CompoundPropertyModel(new 
PresentationSelectionFormModel()));

 add(new FeedbackPanel("feedback"));
 add(dlPanel);
 add(messageIndicator);

 HiddenField  mandatorySections = new 
HiddenField("requiredSections", new 
Model(getIdListFromMandatorySections(sections)));
 add(mandatorySections);

 ListView  sectionList = new ListView("sections", 
sections)
 {
 private static final long serialVersionUID = 7480938703389583883L;

 protected void populateItem(ListItem  sectionItem)
 {
 sectionItem.add(new Label("sectionTitle", 
sectionItem.getModelObject().getTitle()));
 PresentationMultiSelectPanel multi = new 
PresentationMultiSelectPanel("presentationMultiSelectPanel", sectionItem);
 PresentationSingleSelectPanel single = new 
PresentationSingleSelectPanel("presentationSingleSelectPanel", sectionItem);
 selectors.add(multi);
 selectors.add(single);
 sectionItem.add(multi);
 sectionItem.add(single);
 }
 };

 sectionList.setReuseItems(true);
 add(sectionList);
 }



 @Override
 public void onSubmit()
 {
 //create the list of asset bank ids to merge from the panel input...
 List  assetBankAssetIds = new ArrayList();

 for (PresentationSelector selector : selectors)
 {
 assetBankAssetIds.addAll(selector.getSelectedAssetBankAssetIds());
 }

 if (assetBankAssetIds.size() == 0)
 {
 error("Unable to complete merge, no presentations were selected. Please 
select from the list then try again");
 }
 else if (!allMandatorySectionsAreCompleted())
 {
 error("Unable to complete merge, not all mandatory sections were 
completed. Please complete all mandatory sections and try again");
 }
 else
 {
 try
 {
 File mergedPresentations = 
assetBankService.getMergedPresentations(assetBankAssetIds);
 
addOrReplace(DownloadLinkPanel.getLinkToResourceFile("downloadLinkPanel", 
mergedPresentations, "Download your file: "+mergedPresentations.getName()));
 }
 catch (IOException e)
 {
 throw new RuntimeException("Error merging presentations", e);
 }
 }

 addOrReplace(new HiddenField("messageIndicator", new 
Model("1")));
 }
}



SINGLE SELECT PANEL CODE:




public class PresentationSingleSelectPanel extends Panel implements 
PresentationSelector, Serializable
{
 private static final long serialVersionUID = 7062146893868378278L;

 private Section section;
 final RadioGroup  group = new 
RadioGroup("presentationSingleSelectGroup");

 public PresentationSingleSelectPanel(String id, ListItem  
sectionItem)
 {
 super(id);
 section = sectionItem.getModelObject();

 ListView  presentations = new 
ListView("presentations", 
sectionItem.getModelObject().getPresentations())
 {
 private static final long serialVersionUID = -2741478778745270525L;

 protected void populateItem(ListItem