Display the CWF markup for the component tree rooted at root.

@param root Root component of tree.
@param excludedProperties Excluded properties.
@return The dialog.
325182
public static Window showCWF(BaseComponent root, String... excludedProperties) {
        Window window = showXML(CWF2XML.toDocument(root, excludedProperties));
        window.setTitle("CWF Markup");
        return window;
    }
1167001
public JTree getTreeSite() {
		if (treeSite == null) {
			treeSite = new JTree(new DefaultTreeModel(new DefaultMutableTreeNode()));
			treeSite.setShowsRootHandles(true);
			treeSite.setName("treeSite");
			treeSite.setToggleClickCount(1);

			// Force macOS L&F to query the row height from SiteMapTreeCellRenderer to hide the filtered nodes.
			// Other L&Fs hide the filtered nodes by default.
			LookAndFeel laf = UIManager.getLookAndFeel();
			if (laf != null && Constant.isMacOsX()
					&& UIManager.getSystemLookAndFeelClassName().equals(laf.getClass().getName())) {
				treeSite.setRowHeight(0);
			}

			treeSite.addTreeSelectionListener(new javax.swing.event.TreeSelectionListener() { 

				@Override
				public void valueChanged(javax.swing.event.TreeSelectionEvent e) {    

				    SiteNode node = (SiteNode) treeSite.getLastSelectedPathComponent();
				    if (node == null) {
				        return;
				    }
				    if (!node.isRoot()) {
				    	HttpMessage msg = null;
                        try {
                            msg = node.getHistoryReference().getHttpMessage();
                        } catch (Exception e1) {
                        	// ZAP: Log exceptions
                        	log.warn(e1.getMessage(), e1);
                            return;
                            
                        }

                        getView().displayMessage(msg);

			        	// ZAP: Call SiteMapListenners
			            for (SiteMapListener listener : listeners) {
			            	listener.nodeSelected(node);
			            }
				    } else {
				    	// ZAP: clear the views when the root is selected
				        getView().displayMessage(null);
				    }
	
				}
			});
	        treeSite.setComponentPopupMenu(new SitesCustomPopupMenu());

			// ZAP: Add custom tree cell renderer.
	        DefaultTreeCellRenderer renderer = new SiteMapTreeCellRenderer(listeners);
			treeSite.setCellRenderer(renderer);

			String deleteSiteNode = "zap.delete.sitenode";
			treeSite.getInputMap().put(getView().getDefaultDeleteKeyStroke(), deleteSiteNode);
			treeSite.getActionMap().put(deleteSiteNode, new AbstractAction() {

				private static final long serialVersionUID = 1L;

				@Override
				public void actionPerformed(ActionEvent e) {
					ExtensionHistory extHistory = Control.getSingleton().getExtensionLoader().getExtension(
							ExtensionHistory.class);
					if (extHistory == null || treeSite.getSelectionCount() == 0) {
						return;
					}

					int result = View.getSingleton().showConfirmDialog(Constant.messages.getString("sites.purge.warning"));
					if (result != JOptionPane.YES_OPTION) {
						return;
					}

					SiteMap siteMap = Model.getSingleton().getSession().getSiteTree();
					for (TreePath path : treeSite.getSelectionPaths()) {
						extHistory.purge(siteMap, (SiteNode) path.getLastPathComponent());
					}
				}
			});
		}
		return treeSite;
	}
1073616
function ( root ) {
    var walker = new TreeWalker( root, SHOW_TEXT, function () {
            return true;
        }, false ),
        parent, node, index;
    while ( node = walker.nextNode() ) {
        while ( ( index = node.data.indexOf( ZWS ) ) > -1 ) {
            if ( node.length === 1 ) {
                do {
                    parent = node.parentNode;
                    parent.removeChild( node );
                    node = parent;
                    walker.currentNode = parent;
                } while ( isInline( node ) && !getLength( node ) );
                break;
            } else {
                node.deleteData( index, 1 );
            }
        }
    }
}
1265244
protected void initTree(CmsResource rootRes) throws CmsException {

        m_currentRoot = rootRes;
        m_treeContainer.removeAllComponents();
        showHeader();
        CmsSitemapTreeController controller = new CmsSitemapTreeController(
            A_CmsUI.getCmsObject(),
            rootRes,
            this,
            m_treeContainer);

        // no need to escape a structure id
        JavaScript.eval(CmsGwtConstants.VAR_LOCALE_ROOT + "='" + rootRes.getStructureId() + "'");

        CmsSitemapUI ui = (CmsSitemapUI)(A_CmsUI.get());
        ui.getSitemapExtension().setSitemapTreeController(controller);
        CmsSitemapTreeNode root1 = controller.createRootNode();
        controller.initEventHandlers(root1);
        m_treeContainer.addComponent(root1);
        controller.onClickOpen(root1);
    }
39430
private static function displayInventoryTreeHelper(
        AdUnit $root,
        array $treeMap,
        $depth
    ) {
        $rootId = $root->getId();

        printf(
            "%s%s(%s)%s",
            self::generateTab($depth),
            $root->getName(),
            $rootId,
            PHP_EOL
        );

        if (!array_key_exists($rootId, $treeMap) || empty($treeMap[$rootId])) {
            return;
        }

        foreach ($treeMap[$rootId] as $child) {
            self::displayInventoryTreeHelper($child, $treeMap, $depth + 1);
        }
    }
286795
private void setTree(ComponentTree tree) {
        synchronized (this) {
            this.tree = tree;
            for (ComponentVertex child : children) {
                child.setTree(tree);
            }
        }
    }
547391
@Override
	public Component getTreeCellRendererComponent(JTree tree, Object value,
			boolean sel, boolean expanded, boolean leaf, int row,
			boolean hasFocus) {

		component.removeAll();
		SiteNode node = null;
		if (value instanceof SiteNode) {
			node = (SiteNode) value;
		}
		
		if (node != null) {
	        if( node.isFiltered()) {
	        	// Hide the node
	            setPreferredSize( new Dimension(0, 0) );
	            return this;
	        }

			setPreferredSize(null);	// clears the preferred size, making the node visible
			super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus);

			// folder / file icons with scope 'target' if relevant
			if (node.isRoot()) {
				component.add(wrap(ROOT_ICON)); // 'World' icon
			} else {
				OverlayIcon icon;
		        if (node.isDataDriven()) {
					if (node.isIncludedInScope() && ! node.isExcludedFromScope()) {
						icon = new OverlayIcon(DATA_DRIVEN_IN_SCOPE_ICON);
					} else {
						icon = new OverlayIcon(DATA_DRIVEN_ICON);
					}
		        } else if (leaf) {
					if (node.isIncludedInScope() && ! node.isExcludedFromScope()) {
						icon = new OverlayIcon(LEAF_IN_SCOPE_ICON);
					} else {
						icon = new OverlayIcon(LEAF_ICON);
					}
				} else {
					if  (expanded) {
						if (node.isIncludedInScope() && ! node.isExcludedFromScope()) {
							icon = new OverlayIcon(FOLDER_OPEN_IN_SCOPE_ICON);
						} else {
							icon = new OverlayIcon(FOLDER_OPEN_ICON);
						}
					} else {
						if (node.isIncludedInScope() && ! node.isExcludedFromScope()) {
							icon = new OverlayIcon(FOLDER_CLOSED_IN_SCOPE_ICON);
						} else {
							icon = new OverlayIcon(FOLDER_CLOSED_ICON);
						}
					}
				}
				if (node.getParent().isRoot() && node.getNodeName().startsWith("https://")) {
					// Add lock icon to site nodes with https
					icon.add(LOCK_OVERLAY_ICON);
				}
				
				component.add(wrap(DisplayUtils.getScaledIcon(icon)));
				
				Alert alert = node.getHighestAlert();
				if (alert != null) {
					component.add(wrap(alert.getIcon()));
				}

				for (ImageIcon ci : node.getCustomIcons()){
					component.add(wrap(DisplayUtils.getScaledIcon(ci)));
				}
				
			}
			setText(node.toString());
			setIcon(null);
			component.add(this);

	        for (SiteMapListener listener : listeners) {
	        	listener.onReturnNodeRendererComponent(this, leaf, node);
	        }
	        return component;
		}

		return this;
	}
403517
private void renderBundle(final ContextTreeConfig config, final TreeNode root,
                              final Class<?> scope, final Class<Object> bundle) {
        final BundleItemInfo info = service.getData().getInfo(bundle);
        if (isHidden(config, info, scope)) {
            return;
        }
        final List<String> markers = Lists.newArrayList();
        fillCommonMarkers(info, markers, scope);
        final TreeNode node = new TreeNode(RenderUtils.renderClassLine(bundle, markers));
        // avoid duplicate bundle content render
        if (!isDuplicateRegistration(info, scope)) {
            renderScopeContent(config, node, bundle);
        }
        // avoid showing empty bundle line if configured to hide (but show if bundle is ignored as duplicate)
        if (node.hasChildren() || !config.isHideEmptyBundles()
                || (!config.isHideDisables() && markers.contains(IGNORED))) {
            root.child(node);
        }
    }
792076
private void detachDecorators(@NonNull final DialogRootView rootView) {
        for (AbstractDecorator<?, ?> decorator : decorators) {
            decorator.detach();
            decorator.removeAreaListener(rootView);
        }
    }
963918
public static boolean start(RootDoc root) {
		try {
			HtmlDoclet doclet = new HtmlDoclet();
			return doclet.start(doclet, root);
		} finally {
			ConfigurationImpl.reset();
		}
	}
515480
private void dialogChanged() {
		
		// TODO: Needs to be cleaned up, this design is tied to a two page design and can't handle a third page, e.g. used for some other component type...

		if (componentType.value == UTILITY_COMPONENT.ordinal()) {
			updateStatus("Utility components are not yet supported");
			return;
		}

		String artifactId = getArtifactId();
		if (artifactId == null) {
			updateStatus("Missing artifact id");
			return;
		}

		if (artifactId.toLowerCase().startsWith("test")) {
			updateStatus("Artifact id should not start with \"test\" since it will confuse JUnit to think that non unit-test classes are unit-test classes");
			return;
		}

		// If creating an integration component then force viewing page #2 otherwise mark it as completed
		ComponentEnum compEnum = ComponentEnum.get(componentType.value);
		CreateIntegrationComponentPage p = ((CreateComponentWizard)getWizard()).getCreateIntegrationComponentPage();
		p.setMustBeDisplayed(compEnum == INTEGRATION_COMPONENT);
		getContainer().updateButtons();

		// If creating an schema description integration component then force viewing page #2 otherwise mark it as completed
		CreateServiceDescriptionComponentPage p2 = ((CreateComponentWizard)getWizard()).getCreateServiceDescriptionComponentPage();
		p2.setMustBeDisplayed(compEnum == SD_SCHEMA_COMPONENT);
		getContainer().updateButtons();
		
		String rootFolderName = getRootFolder();

		if (rootFolderName.length() == 0) {
			updateStatus("The root folder must be specified");
			return;
		}

		File rootFolder = new File(rootFolderName);
		if (!rootFolder.isDirectory()) {
			updateStatus("The root folder must be an existing folder");
			return;
		}
		
		String projectFolderName = getComponentProjectName(componentType.value, getGroupId(), getArtifactId());
		
		System.err.println("comp-type: " + componentType + ", proj-namn: " + projectFolderName);
		if (projectFolderName != null) {
			File projectFolder = new File(rootFolderName + "/" + projectFolderName);
			if (projectFolder.exists()) {
				updateStatus("Project folder [" + projectFolderName + "] already exists in root folder [" + rootFolderName + "], select a name of a non-existing folder");
				return;
			}
		}
		
		// TODO: Also assert that a project with the selected name doesn't already exist in the workspace

		File mvnHome = new File(getMavenHome());
		if (!mvnHome.isDirectory()) {
			updateStatus("The maven home folder must be an existing folder, update in the soi-toolkit preferences page");
			return;
		}
		
		File mvn = new File(getMavenHome() + "/bin/mvn" + (SwtUtil.isWindows() ? ".bat" : ""));
		if (!mvn.isFile()) {
			updateStatus("The maven executable can't be found at: " + mvn.getAbsolutePath() + ", update in the soi-toolkit preferences page");
			return;
		}
		
		// Validate custom model by setting it on the model-factory-class
		String groovyClass = getCustomGroovyModelImpl();
		if (groovyClass == null || groovyClass.trim().length() == 0) {
			System.err.println("### Empty groovy-classname, reset model");
			ModelFactory.resetModelClass();
		} else {
			try {
				System.err.println("### Setting groovy-classname: " + groovyClass);
				ModelFactory.setModelGroovyClass(new URL(groovyClass));
			} catch (Throwable ex) {
				ModelFactory.resetModelClass();
				updateStatus("Invalid Groovy class for a custom model (update in the soi-toolkit preferences page), error: " + ex);
				return;
			}
		}

		updateStatus(null);
	}
214806
public static UIViewRoot getViewRoot(FaceletContext ctx, UIComponent parent)
    {
        UIComponent c = parent;
        do
        {
            if (c instanceof UIViewRoot)
            {
                return (UIViewRoot) c;
            }
            else
            {
                c = c.getParent();
            }
        } while (c != null);

        UIViewRoot root = ctx.getFacesContext().getViewRoot();
        if (root == null)
        {
            root = FaceletCompositionContext.getCurrentInstance(ctx).getViewRoot(ctx.getFacesContext());
        }
        return root;
    }
1072143
public static <T> T root(TreeDef.Parented<T> treeDef, T node) {
		T lastParent;
		T parent = node;
		do {
			lastParent = parent;
			parent = treeDef.parentOf(lastParent);
		} while (parent != null);
		return lastParent;
	}
767394
public static FramesConfig imports(Xml root)
    {
        Check.notNull(root);

        final Xml node = root.getChild(NODE_FRAMES);
        final int horizontals = node.readInteger(ATT_HORIZONTAL);
        final int verticals = node.readInteger(ATT_VERTICAL);
        final int offsetX = node.readInteger(0, ATT_OFFSET_X);
        final int offsetY = node.readInteger(0, ATT_OFFSET_Y);

        return new FramesConfig(horizontals, verticals, offsetX, offsetY);
    }
860578
public Predicate generateJPAPredicate(CriteriaBuilder criteriaBuilder, Root<?> root) {
		
		// On retourne le predicat
		return criteriaBuilder.like(this.<String>buildPropertyPath(root, property), value);
	}
526137
void showParentFolder() {

        CmsUUID parentId = (CmsUUID)m_treeContainer.getParent(m_currentFolder);
        if (parentId != null) {
            Item resourceItem = m_treeContainer.getItem(parentId);
            if ((resourceItem.getItemProperty(CmsResourceTableProperty.PROPERTY_DISABLED).getValue() == null)
                || !((Boolean)resourceItem.getItemProperty(
                    CmsResourceTableProperty.PROPERTY_DISABLED).getValue()).booleanValue()) {
                // don't open disabled parent folders
                try {
                    readFolder(parentId);
                    m_fileTree.select(parentId);
                } catch (CmsException e) {
                    CmsErrorDialog.showErrorDialog(
                        CmsVaadinUtils.getMessageText(Messages.ERR_EXPLORER_CAN_NOT_READ_RESOURCE_1, parentId),
                        e);
                    LOG.error(e.getLocalizedMessage(), e);
                }
            }
        }
    }
300597
@SuppressFBWarnings("RV_RETURN_VALUE_IGNORED_INFERRED")
    private void renderLeaf(final TreeNode root, final String name,
                            final Class<?> item, final List<String> markers) {
        root.child(String.format("%-10s ", name) + RenderUtils.renderClassLine(item, markers));
    }