No, I don't have any additional reference, we figured this all out by just
reading the source for other dialogs and exploring the available classes.
You probably don't need to provide custom implementations of the classes you
mentioned, but you probably do need to provide a custom form dialog definition
for your component. Our configuration looks like this:
[code]/modules
/your-own-module
/dialogs
/components
/your-custom-component
/class: org.example.YourCustomFormDialogDefinition[/code]
The definition class looks like this:
[code]public class YourCustomFormDialogDefinition extends
ConfiguredFormDialogDefinition {
@Override
public void setPresenterClass(Class<? extends DialogPresenter>
presenterClass) {
super.setPresenterClass(YourCustomFormDialogPresenter.class);
}
}[/code]
And then the form dialog presenter class will look something like this:
[code]public class YourCustomFormDialogPresenter extends
FormDialogPresenterImpl {
@Inject
public YourCustomFormDialogPresenter(DialogDefinitionRegistry
dialogDefinitionRegistry, FormBuilder formBuilder, ComponentProvider
componentProvider, DialogActionExecutor executor, FormView view, I18nizer
i18nizer, SimpleTranslator i18n, AvailabilityChecker checker, ContentConnector
contentConnector) {
super(dialogDefinitionRegistry, formBuilder, componentProvider,
executor, view, i18nizer, i18n, checker, contentConnector);
// You can add any additional injectable components you need to the
constructor signature.
}
@Override
public DialogView start(Item item, String dialogId, UiContext uiContext,
EditorCallback callback) {
FormDialogDefinition formDialogDefinition;
// Construct your formDialogDefinition programmatically using code
// Below is an example of what this might look like, adapted from our
code, but you're free to do whatever you want of course
if (item instanceof AbstractJcrNodeAdapter) {
Node node = ((AbstractJcrNodeAdapter) item).getJcrItem();
if (node != null) {
if (isCustomComponent(node)) {
formDialogDefinition =
getFormDialogForExistingCustomComponent(); // This method can use FormBuilder,
etc. to programmatically build a form dialog definition
} else if (isComponent(node)) {
try {
Node area = node.getParent();
delete(node);
formDialogDefinition = getFormDialogForNewComponent();
// This method can use FormBuilder, etc. to programmatically build a form
dialog definition
} catch (RepositoryException e) {
log.error("I don't know how to handle {} without a
parent", e);
}
} else if (isArea(node)) {
formDialogDefinition = getFormDialogForNewComponent(); //
This method can use FormBuilder, etc. to programmatically build a form dialog
definition
} else {
log.error("I don't know how to handle {}", node);
}
}
} else {
log.error("Can't get node from item {}", item);
}
return start(item, formDialogDefinition, uiContext, callback);
}
}[/code]
I hope this helps a little. Understanding how all these pieces fit together can
be quite challenging (it took us quite a while), so you might want to spend
some time looking around Magnolia's own dialog presenters and checking out the
available classes in that corner of the codebase.
--
Context is everything:
http://forum.magnolia-cms.com/forum/thread.html?threadId=bbab5514-b2f4-4ebb-a02d-c77b84fe9555
----------------------------------------------------------------
For list details, see http://www.magnolia-cms.com/community/mailing-lists.html
Alternatively, use our forums: http://forum.magnolia-cms.com/
To unsubscribe, E-mail to: <[email protected]>
----------------------------------------------------------------