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()));
}
}
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);
}
};
}
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);
}
}
}
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);
}
});
}
Aggregations