};
}
};
add(pullPanel);
PicnikCall call1 = new PicnikCall();
call1.getGeneralSettings().setApiKey(picnikApi);
ExportSettings exportSettings1 = pullPanel.getExportSettings();
exportSettings1.setTitle("Wicket!");
call1.setExportSettings(exportSettings1);
NavigationSettings navSettings = new NavigationSettings();
navSettings.setPage("/in/upload");
call1.setNavigationSettings(navSettings);
PicnikLinkModel picnikLinkModel1 = new PicnikLinkModel(call1);
ExternalLink picnikLink1 = new ExternalLink("importLink1", picnikLinkModel1);
add(picnikLink1);
final Image logoImage = new Image("logoImage", new ResourceReference(PullPanel.class, "picnik_logo_small.jpg"));
picnikLink1.add(logoImage);
// ========================================================================
// same thing, but in modal window
PicnikCall call3 = new PicnikCall();
call3.getGeneralSettings().setApiKey(picnikApi);
call3.getImportSettings().setImportSource("http://www.indyphone.de/static/media/89e9e0a2-0d17-49db-97fb-e46a2e8c68ea.png");
NavigationSettings navSettings3 = new NavigationSettings();
navSettings3.setPage("/edit");
ExportSettings exportSettings3 = pullPanel.getExportSettings();
exportSettings3.setTitle("Wicket!");
call3.setExportSettings(exportSettings3);
BoxSettings boxSettings3 = new BoxSettings();
boxSettings3.setExpandButton(false);
boxSettings3.setCloseTarget("http://rue.dnsdojo.net:42000/wicketstuff-picnik/");
PicnikLinkModel picnikLinkModel3 = new PicnikLinkModel(call3);
ModalPicnikLink modalPicnikLink = new ModalPicnikLink("modalPicnikLink", picnikLinkModel3)
{
@Override
protected void onPicnikFinished(AjaxRequestTarget target) {
target.addComponent(nonCachingImage1);
}
};
add(modalPicnikLink);
// ========================================================================
final NonCachingImage picnikImage2 = new NonCachingImage("picnikImage2", new WebResource() {
@Override
public IResourceStream getResourceStream() {
return new FileResourceStream(imageFile2);
}
});
picnikImage2.setOutputMarkupId(true);
add(picnikImage2);
PushTargetPanel pushtarget = new PushTargetPanel("pushtargetPanel") {
/**
* @see org.wicketstuff.picnik.PushTargetPanel#createForm(java.lang.String)
*/
@Override
protected StatelessForm createForm(String id, IModel model) {
return new StatelessForm(id, model) {
/**
* @see org.apache.wicket.markup.html.form.Form#onSubmit()
*/
@Override
protected void onSubmit() {
PicnikFileUpload upload = (PicnikFileUpload) getModelObject();
LOG.debug("File received in Session " + getSession().getId() + " from " + ((WebRequest)getRequest()).getHttpServletRequest().getRemoteAddr());
FileUpload fileUpload = upload.getFileUpload();
if (fileUpload != null) {
LOG.debug("Size: " + fileUpload.getSize());
LOG.debug("Name: " + fileUpload.getClientFileName());
LOG.debug("Type: " + fileUpload.getContentType());
try {
fileUpload.writeTo(imageFile2);
} catch (IOException e) {
throw new WicketRuntimeException(e);
}
}
setResponsePage(CloseModalPage.class);
}
};
}
};
add(pushtarget);
// import of static image to Picnik
PicnikCall call2 = new PicnikCall();
call2.getGeneralSettings().setApiKey(picnikApi);
call2.getImportSettings().setImportSource("http://www.indyphone.de/static/media/89e9e0a2-0d17-49db-97fb-e46a2e8c68ea.png");
ExportSettings exportSettings2 = pushtarget.getExportSettings();
exportSettings2.setTitle("Wicket!");
call2.setExportSettings(exportSettings2);
PicnikLinkModel picnikLinkModel2 = new PicnikLinkModel(call2);
add(new ExternalLink("importLink2", picnikLinkModel2));
}