@Override public void onEvent(Component component, IEvent<?> event) { super.onEvent(component, event); final AjaxRequestTarget target = RequestCycle.get().find(AjaxRequestTarget.class); Object payload = event.getPayload(); if (payload instanceof SInstance) { final SInstance instance = (SInstance) payload; for (BSTab tab : panel.getTabs().values()) { if (instance.isDescendantOf(tab.getModelObject())) { panel.getTabItem(tab).ifPresent(target::add); } } } else if (payload instanceof SingularFormProcessingPayload) { SingularFormProcessingPayload singularPayload = (SingularFormProcessingPayload) payload; Set<String> typeNames = tabViewSupplier.get().getTabs().stream() .flatMap(it -> it.getTypesNames().stream()) .collect(Collectors.toSet()); if (singularPayload.hasUpdatedType(typeNames)) { target.add(panel); } } } });
private LinkedHashSet<DocTable> collectTableRoots(SType<?> sType) { LinkedHashSet<DocTable> roots = new LinkedHashSet<DocTable>(); if (isDocumentationRelated(sType)) { SView view = getViewFor(sType); if (view instanceof SViewTab) { SViewTab viewTab = (SViewTab) view; for (SViewTab.STab t : viewTab.getTabs()) { roots.add(new DocTable(DocumentationMetadataUtil.getLabelForType(t.getTitle(), sType), retrieveSTypeListFromRelativeTypeName(sType, t.getTypesNames()).toArray(new SType[0]))); } } else if (view instanceof SViewListByMasterDetail) { roots.add(new DocTable(DocumentationMetadataUtil.getLabelForType(sType), sType)); } } return roots; }
private LinkedHashSet<DocTable> collectTableRoots(SType<?> sType) { LinkedHashSet<DocTable> roots = new LinkedHashSet<DocTable>(); if (isDocumentationRelated(sType)) { SView view = getViewFor(sType); if (view instanceof SViewTab) { SViewTab viewTab = (SViewTab) view; for (SViewTab.STab t : viewTab.getTabs()) { roots.add(new DocTable(DocumentationMetadataUtil.getLabelForType(t.getTitle(), sType), retrieveSTypeListFromRelativeTypeName(sType, t.getTypesNames()).toArray(new SType[0]))); } } else if (view instanceof SViewListByMasterDetail) { roots.add(new DocTable(DocumentationMetadataUtil.getLabelForType(sType), sType)); } } return roots; }
defineTabIconCss(ctx, instance, tab.getTypesNames()); IModel<SInstance> baseInstanceModel = (IModel<SInstance>) ctx.getModel(); BSPanelGrid.BSTab t = panel.addTab(tab.getId(), tab.getTitle(), tab.getTypesNames(), baseInstanceModel, tab.isDefault()); t.iconClass((t1, m) -> defineTabIconCss(ctx, (SIComposite) m.getObject(), t1.getSubtree())); } else { tab.getTypesNames() .forEach(tp -> ctx.getModel().getObject().getField(tp).asAtr().visible(false)); renderTab(tabDefault.getTypesNames(), panel, ctx);
@Override protected void doWriteOnCanvas(DocumentCanvas canvas, FlatViewContext context) { canvas.addSubtitle(context.getLabel()); SIComposite instance = (SIComposite) context.getInstance(); SViewTab viewTab = (SViewTab) ViewResolver.resolveView(instance.getType()); for (SViewTab.STab tab : viewTab.getTabs()) { canvas.addSubtitle(tab.getTitle()); for (String path : tab.getTypesNames()) { SInstance child = instance.getField(path); child.getAspect(FlatViewGenerator.ASPECT_FLAT_VIEW_GENERATOR) .ifPresent(viewGenerator -> callChildWrite(canvas.addChild(), child, viewGenerator)); } } }
private LinkedHashSet<DocTable> collectTableRoots(SType<?> sType) { LinkedHashSet<DocTable> roots = new LinkedHashSet<DocTable>(); if (isDocumentationRelated(sType)) { SView view = getViewFor(sType); if (view instanceof SViewTab) { SViewTab viewTab = (SViewTab) view; for (SViewTab.STab t : viewTab.getTabs()) { roots.add(new DocTable(getLabelForType(t.getTitle(), sType), retrieveSTypeListFromRelativeTypeName(sType, t.getTypesNames()).toArray(new SType[0]))); } } else if (view instanceof SViewListByMasterDetail) { roots.add(new DocTable(getLabelForType(sType), sType)); } } return roots; }