Search in sources :

Example 1 with PanelCollapse

use of org.gwtbootstrap3.client.ui.PanelCollapse 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)

Example 2 with PanelCollapse

use of org.gwtbootstrap3.client.ui.PanelCollapse in project drools-wb by kiegroup.

the class GuidedDecisionTreePalette method makePanelGroup.

private PanelGroup makePanelGroup(final String className, final boolean isReadOnly) {
    return new PanelGroup() {

        {
            final PanelCollapse collapse = new PanelCollapse() {

                {
                    add(new PanelBody() {

                        {
                            add(makeStencils(className, isReadOnly));
                        }
                    });
                }
            };
            add(new PanelHeader() {

                {
                    setDataToggle(Toggle.COLLAPSE);
                    setDataParent(getId());
                    setDataTargetWidget(collapse);
                    add(new Heading(HeadingSize.H4) {

                        {
                            setText(className);
                        }
                    });
                }
            });
            add(collapse);
        }
    };
}
Also used : Heading(org.gwtbootstrap3.client.ui.Heading) PanelHeader(org.gwtbootstrap3.client.ui.PanelHeader) PanelGroup(org.gwtbootstrap3.client.ui.PanelGroup) PanelBody(org.gwtbootstrap3.client.ui.PanelBody) PanelCollapse(org.gwtbootstrap3.client.ui.PanelCollapse)

Example 3 with PanelCollapse

use of org.gwtbootstrap3.client.ui.PanelCollapse in project ovirt-engine by oVirt.

the class NotificationListWidget method setInternalRowData.

private void setInternalRowData(int start, List<? extends AuditLog> values) {
    // Compare the new values with the ones currently displayed, if no changes, don't refresh.
    if (values != null && !valuesEquals(values)) {
        rowCount = values.size();
        boolean collapsed = checkIfCollapsed();
        currentValues = values;
        content.clear();
        eventPanelHeading = new PanelHeader();
        Heading titleHeading = new Heading(HeadingSize.H4);
        titleHeading.addStyleName(PatternflyConstants.PF_PANEL_TITLE);
        titleAnchor = new Anchor(hashString(thisWidgetId));
        titleAnchor.setDataParent(hashString(parentWidgetId));
        titleAnchor.setDataTarget(hashString(thisWidgetId));
        titleAnchor.setDataToggle(this.toggle);
        titleAnchor.setText(this.title);
        titleAnchor.addClickHandler(e -> e.preventDefault());
        if (collapsed) {
            titleAnchor.addStyleName(PatternflyConstants.COLLAPSED);
        }
        titleHeading.add(titleAnchor);
        eventPanelHeading.add(titleHeading);
        content.add(eventPanelHeading);
        PanelCollapse eventCollapse = new PanelCollapse();
        eventCollapse.setId(thisWidgetId);
        eventPanelBody = new PanelBody();
        if (this.containerHeight > 0) {
            eventPanelBody.getElement().getStyle().setProperty(MAX_HEIGHT, containerHeight + Unit.PX.getType());
            eventPanelBody.getElement().getStyle().setOverflowY(Overflow.AUTO);
        }
        eventCollapse.add(eventPanelBody);
        if (collapsed) {
            eventCollapse.getElement().setAttribute(ARIA_EXPANDED, String.valueOf(false));
            eventCollapse.getElement().getStyle().setHeight(0, Unit.PX);
        } else {
            eventCollapse.getElement().setAttribute(ARIA_EXPANDED, String.valueOf(true));
            eventCollapse.addStyleName(Styles.IN);
        }
        content.add(eventCollapse);
        for (final AuditLog auditLog : values) {
            DrawerNotification notification = new DrawerNotification(auditLog);
            for (int i = 0; i < actionLabels.size(); i++) {
                final int index = i;
                ActionAnchorListItem listItem = new ActionAnchorListItem(actionLabels.get(index));
                listItem.addClickHandler(e -> auditLogActions.get(index).executeCommand(actionCommand.get(index), auditLog));
                notification.addActionButton(listItem);
            }
            eventPanelBody.add(notification);
        }
        if (clearAllActionLabel != null) {
            actionPanel = new FlowPanel();
            actionPanel.addStyleName(PatternflyConstants.PF_DRAWER_ACTION);
            eventCollapse.add(actionPanel);
            Button clearAllbutton = new Button(clearAllActionLabel);
            clearAllbutton.addStyleName(BTN_LINK);
            clearAllbutton.addStyleName(Styles.BTN_BLOCK);
            clearAllbutton.removeStyleName(BTN_DEFAULT);
            clearAllbutton.addClickHandler(event -> clearAllActionCallback.executeCommand(clearAllActionCommand, null));
            actionPanel.add(clearAllbutton);
            Button restoreAllbutton = new Button(restoreAllActionLabel);
            restoreAllbutton.addStyleName(BTN_LINK);
            restoreAllbutton.addStyleName(Styles.BTN_BLOCK);
            restoreAllbutton.removeStyleName(BTN_DEFAULT);
            restoreAllbutton.addClickHandler(event -> restoreAllActionCallback.executeCommand(restoreAllActionCommand, null));
            actionPanel.add(restoreAllbutton);
        }
    }
}
Also used : ActionAnchorListItem(org.ovirt.engine.ui.common.widget.action.ActionAnchorListItem) Heading(org.gwtbootstrap3.client.ui.Heading) Anchor(org.gwtbootstrap3.client.ui.Anchor) PanelHeader(org.gwtbootstrap3.client.ui.PanelHeader) Button(org.gwtbootstrap3.client.ui.Button) FlowPanel(com.google.gwt.user.client.ui.FlowPanel) PanelBody(org.gwtbootstrap3.client.ui.PanelBody) PanelCollapse(org.gwtbootstrap3.client.ui.PanelCollapse) AuditLog(org.ovirt.engine.core.common.businessentities.AuditLog)

Example 4 with PanelCollapse

use of org.gwtbootstrap3.client.ui.PanelCollapse in project drools-wb by kiegroup.

the class GuidedDecisionTreePalette method setDataModelOracle.

public void setDataModelOracle(final AsyncPackageDataModelOracle oracle, final boolean isReadOnly) {
    this.oracle = PortablePreconditions.checkNotNull("oracle", oracle);
    clear();
    // Add types and constraints
    for (String className : oracle.getFactTypes()) {
        add(makePanelGroup(className, isReadOnly));
    }
    // Add actions
    final GuidedDecisionTreePaletteGroup paletteGroup = new GuidedDecisionTreePaletteGroup();
    if (oracle.getFactTypes().length > 0) {
        final String className = oracle.getFactTypes()[0];
        final ActionInsertNode an1 = new ActionInsertNodeImpl(className);
        paletteGroup.addStencil(actionInsertNodeFactory, stencilBuilder, new ActionInsertFactoryHelper(an1, isReadOnly), isReadOnly);
    }
    final ActionUpdateNode an2 = new ActionUpdateNodeImpl();
    paletteGroup.addStencil(actionUpdateNodeFactory, stencilBuilder, new ActionUpdateFactoryHelper(an2, isReadOnly), isReadOnly);
    final ActionRetractNode an3 = new ActionRetractNodeImpl();
    paletteGroup.addStencil(actionRetractNodeFactory, stencilBuilder, new ActionRetractFactoryHelper(an3, isReadOnly), isReadOnly);
    add(new PanelGroup() {

        {
            final PanelCollapse collapse = new PanelCollapse() {

                {
                    add(new PanelBody() {

                        {
                            add(paletteGroup);
                        }
                    });
                }
            };
            add(new PanelHeader() {

                {
                    setDataToggle(Toggle.COLLAPSE);
                    setDataParent(getId());
                    setDataTargetWidget(collapse);
                    add(new Heading(HeadingSize.H4) {

                        {
                            setText(GuidedDecisionTreeConstants.INSTANCE.actionsPaletteGroup());
                        }
                    });
                }
            });
            add(collapse);
        }
    });
}
Also used : ActionInsertNode(org.drools.workbench.models.guided.dtree.shared.model.nodes.ActionInsertNode) Heading(org.gwtbootstrap3.client.ui.Heading) ActionRetractFactoryHelper(org.drools.workbench.screens.guided.dtree.client.widget.factories.ActionRetractFactoryHelper) ActionUpdateFactoryHelper(org.drools.workbench.screens.guided.dtree.client.widget.factories.ActionUpdateFactoryHelper) ActionRetractNode(org.drools.workbench.models.guided.dtree.shared.model.nodes.ActionRetractNode) ActionInsertFactoryHelper(org.drools.workbench.screens.guided.dtree.client.widget.factories.ActionInsertFactoryHelper) ActionInsertNodeImpl(org.drools.workbench.models.guided.dtree.shared.model.nodes.impl.ActionInsertNodeImpl) ActionRetractNodeImpl(org.drools.workbench.models.guided.dtree.shared.model.nodes.impl.ActionRetractNodeImpl) PanelBody(org.gwtbootstrap3.client.ui.PanelBody) PanelHeader(org.gwtbootstrap3.client.ui.PanelHeader) ActionUpdateNode(org.drools.workbench.models.guided.dtree.shared.model.nodes.ActionUpdateNode) ActionUpdateNodeImpl(org.drools.workbench.models.guided.dtree.shared.model.nodes.impl.ActionUpdateNodeImpl) PanelGroup(org.gwtbootstrap3.client.ui.PanelGroup) PanelCollapse(org.gwtbootstrap3.client.ui.PanelCollapse)

Aggregations

PanelBody (org.gwtbootstrap3.client.ui.PanelBody)4 PanelCollapse (org.gwtbootstrap3.client.ui.PanelCollapse)4 Heading (org.gwtbootstrap3.client.ui.Heading)3 PanelHeader (org.gwtbootstrap3.client.ui.PanelHeader)3 PanelGroup (org.gwtbootstrap3.client.ui.PanelGroup)2 FlowPanel (com.google.gwt.user.client.ui.FlowPanel)1 Collection (java.util.Collection)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 TreeMap (java.util.TreeMap)1 ActionInsertNode (org.drools.workbench.models.guided.dtree.shared.model.nodes.ActionInsertNode)1 ActionRetractNode (org.drools.workbench.models.guided.dtree.shared.model.nodes.ActionRetractNode)1 ActionUpdateNode (org.drools.workbench.models.guided.dtree.shared.model.nodes.ActionUpdateNode)1 ActionInsertNodeImpl (org.drools.workbench.models.guided.dtree.shared.model.nodes.impl.ActionInsertNodeImpl)1 ActionRetractNodeImpl (org.drools.workbench.models.guided.dtree.shared.model.nodes.impl.ActionRetractNodeImpl)1 ActionUpdateNodeImpl (org.drools.workbench.models.guided.dtree.shared.model.nodes.impl.ActionUpdateNodeImpl)1 ActionInsertFactoryHelper (org.drools.workbench.screens.guided.dtree.client.widget.factories.ActionInsertFactoryHelper)1 ActionRetractFactoryHelper (org.drools.workbench.screens.guided.dtree.client.widget.factories.ActionRetractFactoryHelper)1 ActionUpdateFactoryHelper (org.drools.workbench.screens.guided.dtree.client.widget.factories.ActionUpdateFactoryHelper)1 Anchor (org.gwtbootstrap3.client.ui.Anchor)1