i used to use the code below, but now i see eelco has removed AbstractCalendar :( so maybe he can tell us how we can accomplish it now
package com.tbs.webapp.component; import java.util.Date; import java.util.Map; import org.apache.wicket.extensions.yui.calendar.AbstractCalendar; import org.apache.wicket.markup.html.IHeaderContributor; import org.apache.wicket.markup.html.IHeaderResponse; import org.apache.wicket.markup.html.link.ILinkListener; import org.apache.wicket.model.IModel; import org.joda.time.DateMidnight; public class Calendar extends AbstractCalendar implements ILinkListener, IHeaderContributor { public Calendar(String id) { super(id); } public Calendar(String id, IModel model) { super(id); setModel(model); } public final void onLinkClicked() { String arg = getRequest().getParameter(getJavascriptWidgetId()); String[] parts = arg.split(","); int year = Integer.parseInt(parts[0]); int month = Integer.parseInt(parts[1]); int day = Integer.parseInt(parts[2]); setModelObject(new DateMidnight(year, month, day).toDate()); onClick(); } @Override protected void appendToInit(String markupId, String javascriptId, String javascriptWidgetId, StringBuffer b) { super.appendToInit(markupId, javascriptId, javascriptWidgetId, b); b.append(getJavascriptWidgetId()); b.append(".selectEvent.subscribe(\n\tfunction(type,args,obj) {\n\t\twindow.location='"); b.append(urlFor(ILinkListener.INTERFACE)); b.append("&").append(getJavascriptWidgetId()).append("='+args;\n"); b.append("\t}\n\t,").append(getJavascriptWidgetId()).append(", true);"); Date date = (Date) getModelObject(); b.append(getJavascriptWidgetId()); b.append(".setYear(").append(1900 + date.getYear()); b.append(");"); b.append(getJavascriptWidgetId()); b.append(".setMonth(").append(date.getMonth()); b.append(");"); } public void renderHead(IHeaderResponse response) { // TODO Auto-generated method stub } @Override protected void configureWidgetProperties(Map widgetProperties) { super.configureWidgetProperties(widgetProperties); Date date = (Date) getModelObject(); if (date != null) { widgetProperties.put("selected", (date.getMonth() + 1) + "/" + date.getDate() + "/" + (1900 + date.getYear())); } } protected void onClick() { } } -igor On 8/8/07, Per Newgro <[EMAIL PROTECTED]> wrote: > > Hi *, > > i'm new to the group and hope to find some answers here :-). > > I checked the examples and i got the idea to add a simple "rendered" > yui calendar instance to a webpage. > I don't want to add a datetextfield and then click the button beside it. > Is this possible? And if so how? > > Thanks for your time > Cheers > Per > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > >