<commit_before><!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
    xmlns:c="http://java.sun.com/jsp/jstl/core"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:p="http://primefaces.org/ui">
    
<div>
    <span id="tag-palette-title" class="fa fa-tags" >&nbsp;&nbsp;#{msg['label_tag_palette']}</span>
</div>

<h:form id="tag-palette-form">
    <p:dialog id="tag-editor" header="#{msg['label_edit']}" width="600px" modal="false" showEffect="fade" widgetVar="tagEditor" position="center" draggable="true" resizable="false" >
    	<p:panel id="tag-name-panel">
	    	<div class="fa fa-tag">&nbsp;&nbsp;
		    	<p:inplace widgetVar="tagNameInplace">
		            <p:inputText style="width:80%" value="#{paramTagBean.tag.tagName}"/>
		        </p:inplace>
	    	</div>
    	</p:panel>
    	<br/>
    	<h:panelGrid columns="2" cellpadding="10">
    		<f:facet name="header">
	        	<div class="fa fa-arrow-up"></div>
	        	<div class="fa fa-arrow-down"></div>
    		</f:facet>
	        <p:panel>
	            <div class="fa fa-tag">
	                &nbsp;&nbsp;
	                <p:inplace editor="true" label="+" saveLabel="#{msg['label_save']}" cancelLabel="#{msg['label_cancel']}">
	                	<p:ajax event="save" update="parent-tags"/>
						<p:selectOneListbox value="#{tagListBean.newParentTagId}" scrollHeight="#{cfg['tag.editor.sel.list.scrl.hgt']}" filter="true" filterMatchMode="contains">
					    	<f:selectItems value="#{tagListBean.listOfSelectableParents()}" var="tag" itemLabel="#{tag.tagName}" itemValue="#{tag.id}" />
						</p:selectOneListbox>
		            </p:inplace>
	            </div><br/>
	            <h:panelGroup id="parent-tags">
	        		<ui:repeat var="parent" value="#{tagListBean.parentTags}">
	        			<span class="fa fa-tag">&nbsp;&nbsp;#{parent.tagName}&nbsp;&nbsp;</span>
	        			<p:commandLink update=":tag-palette-form:parent-tags" action="#{tagListBean.removeParentTag(parent.id)}" styleClass="fa fa-minus-circle button-link" />
	        			<br/>
	        		</ui:repeat>
	            </h:panelGroup>
	        </p:panel>
	        <p:panel>
	            <div class="fa fa-tag">
                    &nbsp;&nbsp;
                    <p:inplace editor="true" label="+" saveLabel="#{msg['label_save']}" cancelLabel="#{msg['label_cancel']}">
                    	<p:ajax event="save" update="child-tags"/>
						<p:selectOneListbox value="#{tagListBean.newChildTagId}" scrollHeight="#{cfg['tag.editor.sel.list.scrl.hgt']}" filter="true" filterMatchMode="contains">
					    	<f:selectItems value="#{tagListBean.listOfSelectableChildren()}" var="tag" itemLabel="#{tag.tagName}" itemValue="#{tag.id}" />
						</p:selectOneListbox>
                    </p:inplace>
                </div><br/>
                <h:panelGroup id="child-tags">
	        		<ui:repeat var="child" value="#{tagListBean.childTags}">
	        			<span class="fa fa-tag">&nbsp;&nbsp;#{child.tagName}&nbsp;&nbsp;</span>
	        			<p:commandLink update=":tag-palette-form:child-tags" action="#{tagListBean.removeChildTag(child.id)}" styleClass="fa fa-minus-circle button-link" />
	        			<br/>
	        		</ui:repeat>
                </h:panelGroup>
	        </p:panel>
    	</h:panelGrid>
        <p:commandButton action="save-tag" value="#{msg['label_save']}" icon="ui-icon-check"/>
    </p:dialog>
    
    <div id="tag-context-menu" style="display:none; z-index:5000; position:absolute;">
	    <p:menu>
            <p:menuitem styleClass="fa" oncomplete="showTagEditor()" value="&#xf040; #{msg['label_edit']}"
            	update="tag-editor" actionListener="#{mainController.prepareTagListBeanToEditTag(tagListBean, paramTagBean)}"/>
            <p:menuitem styleClass="fa" onclick="confirmTrashingTagFromCtxtMenu()" value="&#xf1f8; #{msg['label_trash']}"/>
	    </p:menu>
    </div>
    
    <h:inputHidden id="id-placeholder-for-tag" value="#{paramTagBean.tag.id}" />
    
    <div id="tag-palette-panel">
        <ul>
            <li>
                <a href="#tag-palette-flat" title="#{msg['label_flat_view']}" >
                    <span class="fa fa-list fa-2x" ></span>
                </a>
            </li>
            <li>
                <a href="#tag-palette-tree" title="#{msg['label_tree_view']}" >
                    <span class="fa fa-tree fa-2x" ></span>
                </a>
            </li>
        </ul>
        
	    <div id="trashcan">
		    <p:commandLink action="filter-by-tag" title="#{msg['go_to_trashcan']}">
		        <span class="fa fa-trash fa-2x button-link" style="color:lightgray"></span>
		        <f:param name="tagId" value="0" />
		    </p:commandLink>
		</div>
	    
        <div id="tag-palette-flat">
            <c:forEach var="tagBean" items="#{tagListBean.tagBeans}">
                <c:set var="tag" value="#{tagBean.tag}"/>
                <ui:include src="each-tag.xhtml" />
                <br/>
            </c:forEach>
        </div>
        <div id="tag-palette-tree">
            <p:tree value="#{tagListBean.tagTree.root}" var="tagBean" dynamic="true" style="width:100%">
            	<p:ajax event="expand" listener="#{tagListBean.tagTree.onNodeExpand}" oncomplete="onExpandComplete()"/>
            	<p:ajax event="collapse" listener="#{tagListBean.tagTree.onNodeCollapse}" />
                <c:set var="tag" value="#{tagBean.tag}"/>
                <p:treeNode>
                    <ui:include src="each-tag.xhtml" />
                </p:treeNode>
            </p:tree>
        </div>
    </div>
</h:form>

</ui:composition><commit_msg>[bug fix] fetching trashed fragments was not working;<commit_after><!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
    xmlns:c="http://java.sun.com/jsp/jstl/core"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:p="http://primefaces.org/ui">
    
<div>
    <span id="tag-palette-title" class="fa fa-tags" >&nbsp;&nbsp;#{msg['label_tag_palette']}</span>
</div>

<h:form id="tag-palette-form">
    <p:dialog id="tag-editor" header="#{msg['label_edit']}" width="600px" modal="false" showEffect="fade" widgetVar="tagEditor" position="center" draggable="true" resizable="false" >
    	<p:panel id="tag-name-panel">
	    	<div class="fa fa-tag">&nbsp;&nbsp;
		    	<p:inplace widgetVar="tagNameInplace">
		            <p:inputText style="width:80%" value="#{paramTagBean.tag.tagName}"/>
		        </p:inplace>
	    	</div>
    	</p:panel>
    	<br/>
    	<h:panelGrid columns="2" cellpadding="10">
    		<f:facet name="header">
	        	<div class="fa fa-arrow-up"></div>
	        	<div class="fa fa-arrow-down"></div>
    		</f:facet>
	        <p:panel>
	            <div class="fa fa-tag">
	                &nbsp;&nbsp;
	                <p:inplace editor="true" label="+" saveLabel="#{msg['label_save']}" cancelLabel="#{msg['label_cancel']}">
	                	<p:ajax event="save" update="parent-tags"/>
						<p:selectOneListbox value="#{tagListBean.newParentTagId}" scrollHeight="#{cfg['tag.editor.sel.list.scrl.hgt']}" filter="true" filterMatchMode="contains">
					    	<f:selectItems value="#{tagListBean.listOfSelectableParents()}" var="tag" itemLabel="#{tag.tagName}" itemValue="#{tag.id}" />
						</p:selectOneListbox>
		            </p:inplace>
	            </div><br/>
	            <h:panelGroup id="parent-tags">
	        		<ui:repeat var="parent" value="#{tagListBean.parentTags}">
	        			<span class="fa fa-tag">&nbsp;&nbsp;#{parent.tagName}&nbsp;&nbsp;</span>
	        			<p:commandLink update=":tag-palette-form:parent-tags" action="#{tagListBean.removeParentTag(parent.id)}" styleClass="fa fa-minus-circle button-link" />
	        			<br/>
	        		</ui:repeat>
	            </h:panelGroup>
	        </p:panel>
	        <p:panel>
	            <div class="fa fa-tag">
                    &nbsp;&nbsp;
                    <p:inplace editor="true" label="+" saveLabel="#{msg['label_save']}" cancelLabel="#{msg['label_cancel']}">
                    	<p:ajax event="save" update="child-tags"/>
						<p:selectOneListbox value="#{tagListBean.newChildTagId}" scrollHeight="#{cfg['tag.editor.sel.list.scrl.hgt']}" filter="true" filterMatchMode="contains">
					    	<f:selectItems value="#{tagListBean.listOfSelectableChildren()}" var="tag" itemLabel="#{tag.tagName}" itemValue="#{tag.id}" />
						</p:selectOneListbox>
                    </p:inplace>
                </div><br/>
                <h:panelGroup id="child-tags">
	        		<ui:repeat var="child" value="#{tagListBean.childTags}">
	        			<span class="fa fa-tag">&nbsp;&nbsp;#{child.tagName}&nbsp;&nbsp;</span>
	        			<p:commandLink update=":tag-palette-form:child-tags" action="#{tagListBean.removeChildTag(child.id)}" styleClass="fa fa-minus-circle button-link" />
	        			<br/>
	        		</ui:repeat>
                </h:panelGroup>
	        </p:panel>
    	</h:panelGrid>
        <p:commandButton action="save-tag" value="#{msg['label_save']}" icon="ui-icon-check"/>
    </p:dialog>
    
    <div id="tag-context-menu" style="display:none; z-index:5000; position:absolute;">
	    <p:menu>
            <p:menuitem styleClass="fa" oncomplete="showTagEditor()" value="&#xf040; #{msg['label_edit']}"
            	update="tag-editor" actionListener="#{mainController.prepareTagListBeanToEditTag(tagListBean, paramTagBean)}"/>
            <p:menuitem styleClass="fa" onclick="confirmTrashingTagFromCtxtMenu()" value="&#xf1f8; #{msg['label_trash']}"/>
	    </p:menu>
    </div>
    
    <h:inputHidden id="id-placeholder-for-tag" value="#{paramTagBean.tag.id}" />
    
    <div id="tag-palette-panel">
        <ul>
            <li>
                <a href="#tag-palette-flat" title="#{msg['label_flat_view']}" >
                    <span class="fa fa-list fa-2x" ></span>
                </a>
            </li>
            <li>
                <a href="#tag-palette-tree" title="#{msg['label_tree_view']}" >
                    <span class="fa fa-tree fa-2x" ></span>
                </a>
            </li>
        </ul>
        
	    <div id="trashcan">
		    <p:commandLink onclick="fetchFragmentsByTag($(this).find('span'), null); event.preventDefault();"  title="#{msg['go_to_trashcan']}">
		        <span class="fa fa-trash fa-2x button-link" _tid="0" style="color:lightgray"></span>
		    </p:commandLink>
		</div>
	    
        <div id="tag-palette-flat">
            <c:forEach var="tagBean" items="#{tagListBean.tagBeans}">
                <c:set var="tag" value="#{tagBean.tag}"/>
                <ui:include src="each-tag.xhtml" />
                <br/>
            </c:forEach>
        </div>
        <div id="tag-palette-tree">
            <p:tree value="#{tagListBean.tagTree.root}" var="tagBean" dynamic="true" style="width:100%">
            	<p:ajax event="expand" listener="#{tagListBean.tagTree.onNodeExpand}" oncomplete="onExpandComplete()"/>
            	<p:ajax event="collapse" listener="#{tagListBean.tagTree.onNodeCollapse}" />
                <c:set var="tag" value="#{tagBean.tag}"/>
                <p:treeNode>
                    <ui:include src="each-tag.xhtml" />
                </p:treeNode>
            </p:tree>
        </div>
    </div>
</h:form>

</ui:composition>
{'fraction_non_alphanumeric': 0.1970468871427338, 'fraction_numerical': 0.006044383041188153, 'mean_word_length': 2.5647891658971993, 'pattern_counts': {'":': 4, '<': 228, '<?xml version=': 0, '>': 228, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 12}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5538018', 'n_tokens_mistral': 4143, 'n_tokens_neox': 3869, 'n_words': 524}