final AddFolderDialog addFolder = new AddFolderDialog("addFolder", WebSession.getString(712)) {
private static final long serialVersionUID = 1L;
@Override
protected void onSubmit(AjaxRequestTarget target) {
FlvRecording f = new FlvRecording();
f.setFileName(getModelObject());
f.setInsertedBy(getUserId());
f.setInserted(new Date());
f.setFolder(true);
f.setIsImage(false);
f.setIsPresentation(false);
f.setIsRecording(true);
FlvRecording p = rm.getObject();
long parentId = p.getFlvRecordingId();
if (p.isFolder()) {
f.setParentFileExplorerItemId(parentId);
}
f.setOwnerId(p.getOwnerId());
f.setOrganization_id(p.getOrganization_id());
getBean(FlvRecordingDao.class).update(f);
target.add(trees); //FIXME add correct refresh
}
};
add(addFolder);
add(new WebMarkupContainer("create").add(new AjaxEventBehavior("onclick") {
private static final long serialVersionUID = 1L;
@Override
protected void onEvent(AjaxRequestTarget target) {
addFolder.open(target);
}
}));
add(new WebMarkupContainer("refresh").add(new AjaxEventBehavior("onclick") {
private static final long serialVersionUID = 1L;
@Override
protected void onEvent(AjaxRequestTarget target) {
target.add(trees); //FIXME add correct refresh
}
}));
ConfirmableAjaxLink trash = new ConfirmableAjaxLink("trash", 713) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
long id = rm.getObject().getFlvRecordingId();
if (id > 0) {
getBean(FlvRecordingDao.class).delete(rm.getObject());
}
target.add(trees); //FIXME add correct refresh
}
};
trash.add(new WebMarkupContainer("drop-center").setOutputMarkupId(true)).add(new DropTarget(Operation.MOVE) {
private static final long serialVersionUID = 1L;
@Override
public void onDrop(AjaxRequestTarget target, Transfer transfer, Location location) throws Reject {
FlvRecording r = transfer.getData();
getBean(FlvRecordingDao.class).delete(r);
target.add(trees); //FIXME add correct refresh
}
}.dropCenter("span"));
add(trash/*.add(new WindowsTheme())*/); //TODO check theme here