Search in sources :

Example 1 with LinkedGroup

use of org.gwtbootstrap3.client.ui.LinkedGroup in project kie-wb-common by kiegroup.

the class BusinessViewWidget method renderItems.

@Override
public void renderItems(FolderListing folderListing) {
    tagSelector.loadContent(presenter.getActiveContentTags(), presenter.getCurrentTag());
    itemsContainer.clear();
    sortedFolderItems.clear();
    for (final FolderItem content : folderListing.getContent()) {
        if (!content.getType().equals(FolderItemType.FOLDER)) {
            sortedFolderItems.add(content);
        }
    }
    if (!sortedFolderItems.isEmpty()) {
        final Map<ClientResourceType, Collection<FolderItem>> resourceTypeGroups = classifier.group(sortedFolderItems);
        final TreeMap<ClientResourceType, Collection<FolderItem>> sortedResourceTypeGroups = new TreeMap<>(Sorters.RESOURCE_TYPE_GROUP_SORTER);
        sortedResourceTypeGroups.putAll(resourceTypeGroups);
        for (final Map.Entry<ClientResourceType, Collection<FolderItem>> entry : sortedResourceTypeGroups.entrySet()) {
            final LinkedGroup itemsNavList = new LinkedGroup();
            itemsNavList.getElement().getStyle().setMarginBottom(0, Style.Unit.PX);
            final PanelCollapse collapse = new PanelCollapse();
            final String collapseId = getCollapseId(entry.getKey());
            final PanelCollapse oldCollapse = collapses.get(collapseId);
            final boolean in = (oldCollapse != null) ? oldCollapse.isIn() : false;
            collapse.setId(collapseId);
            collapse.setIn(in);
            final PanelBody body = new PanelBody();
            body.getElement().getStyle().setPadding(0, Style.Unit.PX);
            collapse.add(body);
            body.add(itemsNavList);
            for (FolderItem folderItem : entry.getValue()) {
                itemsNavList.add(makeItemNavLink(entry.getKey(), folderItem));
            }
            itemsContainer.add(new Panel() {

                {
                    add(makeTriggerWidget(entry.getKey(), collapse));
                    add(collapse);
                }
            });
            collapses.put(collapseId, collapse);
        }
    } else {
        itemsContainer.add(new Label(ProjectExplorerConstants.INSTANCE.noItemsExist()));
    }
}
Also used : LinkedGroup(org.gwtbootstrap3.client.ui.LinkedGroup) Label(org.gwtbootstrap3.client.ui.Label) PanelBody(org.gwtbootstrap3.client.ui.PanelBody) TreeMap(java.util.TreeMap) Panel(org.gwtbootstrap3.client.ui.Panel) FolderItem(org.kie.workbench.common.screens.explorer.model.FolderItem) ClientResourceType(org.uberfire.client.workbench.type.ClientResourceType) Collection(java.util.Collection) HashMap(java.util.HashMap) Map(java.util.Map) TreeMap(java.util.TreeMap) PanelCollapse(org.gwtbootstrap3.client.ui.PanelCollapse)

Aggregations

Collection (java.util.Collection)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 TreeMap (java.util.TreeMap)1 Label (org.gwtbootstrap3.client.ui.Label)1 LinkedGroup (org.gwtbootstrap3.client.ui.LinkedGroup)1 Panel (org.gwtbootstrap3.client.ui.Panel)1 PanelBody (org.gwtbootstrap3.client.ui.PanelBody)1 PanelCollapse (org.gwtbootstrap3.client.ui.PanelCollapse)1 FolderItem (org.kie.workbench.common.screens.explorer.model.FolderItem)1 ClientResourceType (org.uberfire.client.workbench.type.ClientResourceType)1