Hello,
I have implemented a function to show documents related to an entity. This function is available via the toolbar in the entity table.
It is quite easy to implement for one entity, but now I am wonding what would be the best way to make this available for many entities.
1. Superclass for BrowseController
public abstract class AbstractBrowseWithDocument extends AbstractLookup {
public void openDocument() {
openWindow('Document.browse', WindowManager.OpenType.DIALOG)
}
}
public class MyEntityBrowse extends AbstractBrowseWithDocument { }
<table id="table">
<actions>
...
<action id="document" invoke="openDocument"/>
</actions>
<columns />
<buttonsPanel id="buttonsPanel">
..-
<button id="dokumentBtn"
action="table.document"/>
</buttonsPanel>
</table>
Good
- Definition of Action at one place
###Bad - Edit BrowseController and browse.xml for many entities
2. Extend default list actions
I know that cuba has some build-in actions for lists that I can easily use in all tables (Standard Actions over Collection - CUBA Platform. Developer’s Manual).
Is it possible to extend this list?
public class DocumentAction extends BaseAction {
public static final String ACTION_ID = "document";
...
}
// register DocumentAction somewhere
<table id="table">
<actions>
...
<action id="document" />
</actions>
<columns />
<buttonsPanel id="buttonsPanel">
..-
<button id="dokumentBtn"
action="table.document"/>
</buttonsPanel>
</table>
Good
- Definition of Action at one place
- Edit browse.xml for many entities
- BrowseController can stay the same
Do you have another idea?
Thanks a lot for your support!
Yours,
Joerg