Hello,
I am new to Cuba and have a problem with the folders panel.How do i remove a folder or add one?
Like the library project(is the one of the sample projects).I added a button inside Books.Browse to make add/delete.I can reach out to folders with the code below
FoldersService service = AppBeans.get(FoldersService.NAME);
List<AppFolder> list = service.loadAppFolders();
But that’s all.Modifying list is not affecting the folders panel.
You should add/remove AppFolder entities (via DataManager for example), and then invoke the loadFolders() method of the FoldersPane component which is available on the extended main window.
Thank you for the quick reply sir.Now I have 2 new questions related to it.
How can i create a new AppFolder object?
Changes on the folders panel is not instant.To be able to see the changes, i need to close the application and reopen it from the studio.How can i make it instant?
public class CustomerBrowse extends AbstractLookup {
@Inject
private Metadata metadata;
@Inject
private DataManager dataManager;
public void onAddFolderClick() {
AppFolder appFolder = metadata.create(AppFolder.class);
appFolder.setName("My customers");
appFolder.setFilterComponentId("[sample$Customer.browse].filter");
appFolder.setTabName("My customers");
appFolder.setFilterXml("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
"<filter>\n" +
" <and>\n" +
" <c name=\"name\" class=\"java.lang.String\" operatorType=\"CONTAINS\" width=\"1\" type=\"PROPERTY\"><![CDATA[e.name like :component$filter.name63023 ESCAPE '\\' ]]>\n" +
" <param name=\"component$filter.name63023\" javaClass=\"java.lang.String\">NULL</param>\n" +
" </c>\n" +
" </and>\n" +
"</filter>");
dataManager.commit(appFolder);
showNotification("AppFolder has been added. Re-login to see it.");
}
}
Unfortunately, there is no API to refresh the list of folders, so the user will see the new folder only after logout and login again. We’ll add required methods to the FoldersPane component in 6.6.0, then I will update the example. See the linked issue for tracking the progress.