}
};
copyForm.setOutputMarkupId(true);
copyForm.add(new Label("docType-label", "Doc Type"));
TextField typeField = new TextField("docType", new PropertyModel(
this, "docType"));
typeField.setRequired(true);
copyForm.add(typeField);
copyForm.add(new Label("docName-label", "Document Name"));
TextField nameField = new TextField("docName", new PropertyModel(
this, "docName"));
nameField.setRequired(true);
copyForm.add(nameField);
AjaxCheckBox copyIdsChkBox = new AjaxCheckBox("copyIds", new PropertyModel(this, "copyIds"))
{
@Override
protected void onUpdate(AjaxRequestTarget target)
{
}
};
copyForm.add(copyIdsChkBox);
AjaxButton copyButton = new AjaxButton("copy",new ResourceModel("common.copy"),copyForm)
{
@Override
protected void onSubmit(AjaxRequestTarget target, Form<?> form)
{
docAction(true, docOldName, getDocName(), docOldPath, getDocPath(), getCopyIds());
((ModalWindow) CopyMoveWindow.this.getParent()).close(target);
}
@Override
protected void onError(AjaxRequestTarget target, Form<?> form)
{
target.addComponent(feedback);
}
};
AjaxButton moveButton = new AjaxButton("move",new ResourceModel("common.move"), copyForm)
{
@Override
protected void onSubmit(AjaxRequestTarget target, Form<?> form)
{
docAction(false, docOldName, getDocName(), docOldPath, getDocPath(), getCopyIds());
((ModalWindow) CopyMoveWindow.this.getParent()).close(target);
}
@Override
protected void onError(AjaxRequestTarget target, Form<?> form)
{
target.addComponent(feedback);
}
};
copyButton.setVisibilityAllowed(true);
moveButton.setVisibilityAllowed(true);
copyForm.add(copyButton);
copyForm.add(moveButton);
if (copyFlag)
{
copyButton.setVisible(true);
moveButton.setVisible(false);
}
else
{
copyButton.setVisible(false);
moveButton.setVisible(true);
}
setCopyIds(!copyFlag);
// Adding menu tree node
DefaultMutableTreeNode rootNode = new DefaultMutableTreeNode(new SiteTreeNode("Root", "/", FileType.Folder, false));
retrieveCopyFolders("/", rootNode);
copyTreeNode = new DefaultTreeModel(rootNode);
final LinkTree copyTree = new LinkTree("copyTree", new PropertyModel(this, "copyTreeNode"))
{
@Override
protected void onNodeLinkClicked(Object node, BaseTree tree,
AjaxRequestTarget target)
{