Handles the drop for a sitemap item which was dragged to a different position.<p>

@param sitemapEntry the dropped item
@param target the drop target
@param parent the parent sitemap entry
773527
private void handleDropSitemapEntry(
        final CmsSitemapTreeItem sitemapEntry,
        final I_CmsDropTarget target,
        CmsClientSitemapEntry parent) {

        if (isChangedPosition(sitemapEntry, target, true)) {
            // moving a tree entry around
            final CmsClientSitemapEntry entry = sitemapEntry.getSitemapEntry();
            m_controller.ensureUniqueName(parent, entry.getName(), new I_CmsSimpleCallback<String>() {

                public void execute(String uniqueName) {

                    if (!uniqueName.equals(entry.getName()) && isChangedPosition(sitemapEntry, target, false)) {
                        m_controller.editAndChangeName(
                            entry,
                            uniqueName,
                            Collections.<CmsPropertyModification> emptyList(),
                            entry.isNew(),
                            CmsReloadMode.none);
                        m_controller.move(entry, m_insertPath + uniqueName + "/", m_insertIndex);
                    } else {
                        m_controller.move(entry, m_insertPath + entry.getName() + "/", m_insertIndex);
                    }
                }
            });
        } else {
            sitemapEntry.resetEntry();
        }
    }
1041442
public void addSite(String siteKey) {
		ValueMap gv = new ValueMap(siteKey);
		if (!this.valueMaps.contains(gv)) {
			this.valueMaps.add(gv);
		}
	}
842953
private void setSiteMatcherSites(Map<CmsSiteMatcher, CmsSite> siteMatcherSites) {

        m_siteMatcherSites = Collections.unmodifiableMap(siteMatcherSites);
        m_siteMatchers = Collections.unmodifiableList(new ArrayList<CmsSiteMatcher>(m_siteMatcherSites.keySet()));
    }
527385
public void setParent( IParseTree l )
  {
    if( l != null && !l.contains( this ) && getLength() > 0 )
    {
      throw new IllegalArgumentException( "Attempted set the parent location, but the parent location's area is not a superset of this location's area." );
    }
    if( _pe != null )
    {
      ParsedElement parentElement = (ParsedElement)_pe.getParent();
      if( parentElement != null )
      {
        ParseTree oldParent = parentElement.getLocation();
        if( oldParent != null )
        {
          oldParent._children.remove( this );
        }
      }
      _pe.setParent( l == null ? null : ((ParseTree)l)._pe );
    }
  }
746032
@UiThread
    protected void parentCollapsedFromViewHolder(int flatParentPosition) {
        ExpandableWrapper<P, C> parentWrapper = mFlatItemList.get(flatParentPosition);
        updateCollapsedParent(parentWrapper, flatParentPosition, true);
    }
524911
public void loadPath(
        final String sitePath,
        final boolean continueIfNotLoaded,
        final AsyncCallback<CmsClientSitemapEntry> callback) {

        if (getEntry(sitePath) != null) {
            CmsClientSitemapEntry entry = getEntry(sitePath);
            getChildren(entry.getId(), CmsSitemapTreeItem.getItemById(entry.getId()).isOpen(), callback);
        } else {
            String parentPath = CmsResource.getParentFolder(sitePath);
            CmsUUID idToLoad = null;
            CmsClientSitemapEntry entry = getEntry(parentPath);
            while (entry == null) {
                parentPath = CmsResource.getParentFolder(parentPath);
                if (parentPath == null) {
                    break;
                } else {
                    entry = getEntry(parentPath);
                }
            }
            if (entry != null) {
                idToLoad = entry.getId();
            } else {
                idToLoad = m_data.getSiteRootId();
            }
            CmsSitemapTreeItem treeItem = CmsSitemapTreeItem.getItemById(idToLoad);
            boolean open = true;
            if (treeItem != null) {
                open = treeItem.isOpen();
            }
            getChildren(idToLoad, open, continueIfNotLoaded, new AsyncCallback<CmsClientSitemapEntry>() {

                public void onFailure(Throwable caught) {

                    // nothing to do
                }

                public void onSuccess(CmsClientSitemapEntry result) {

                    // check if target entry is loaded
                    CmsClientSitemapEntry target = getEntry(sitePath);
                    if (target == null) {
                        loadPath(sitePath, continueIfNotLoaded, callback);
                    } else {
                        if (callback != null) {
                            callback.onSuccess(target);
                        }
                    }
                }
            });
        }
    }
151586
@UiThread
    public void collapseParent(@NonNull P parent) {
        ExpandableWrapper<P, C> parentWrapper = new ExpandableWrapper<>(parent);
        int flatParentPosition = mFlatItemList.indexOf(parentWrapper);
        if (flatParentPosition == INVALID_FLAT_POSITION) {
            return;
        }

        collapseViews(mFlatItemList.get(flatParentPosition), flatParentPosition);
    }
82378
private void prepareTargetContainer(
        I_CmsDropContainer targetContainer,
        I_CmsDraggable draggable,
        Element placeholder) {

        String positioning = CmsDomUtil.getCurrentStyle(
            targetContainer.getElement(),
            org.opencms.gwt.client.util.CmsDomUtil.Style.position);
        // set target relative, if not absolute or fixed
        if (!Position.ABSOLUTE.getCssName().equals(positioning) && !Position.FIXED.getCssName().equals(positioning)) {
            targetContainer.getElement().getStyle().setPosition(Position.RELATIVE);
        }
        m_originalIndex = targetContainer.getWidgetIndex((Widget)draggable);
        targetContainer.getElement().insertBefore(placeholder, draggable.getElement());
        targetContainer.getElement().addClassName(I_CmsLayoutBundle.INSTANCE.dragdropCss().dragging());
        CmsDomUtil.showOverlay(draggable.getElement(), true);
        targetContainer.highlightContainer();
    }
496048
protected void mergeParent(CmsADEConfigDataInternal parent) {

        List<CmsResourceTypeConfig> parentTypes = null;
        if (parent != null) {
            parentTypes = parent.m_ownResourceTypes;
        } else {
            parentTypes = Collections.emptyList();
        }

        List<CmsPropertyConfig> parentProperties = null;
        if (parent != null) {
            parentProperties = parent.m_ownPropertyConfigurations;
        } else {
            parentProperties = Collections.emptyList();
        }

        List<CmsModelPageConfig> parentModelPages = null;
        if (parent != null) {
            parentModelPages = parent.m_ownModelPageConfig;
        } else {
            parentModelPages = Collections.emptyList();
        }

        List<CmsFunctionReference> parentFunctionRefs = null;
        if (parent != null) {
            parentFunctionRefs = parent.m_functionReferences;
        } else {
            parentFunctionRefs = Collections.emptyList();
        }

        m_ownResourceTypes = CmsADEConfigData.combineConfigurationElements(parentTypes, m_ownResourceTypes, false);
        m_ownPropertyConfigurations = CmsADEConfigData.combineConfigurationElements(
            parentProperties,
            m_ownPropertyConfigurations,
            false);
        m_ownModelPageConfig = CmsADEConfigData.combineConfigurationElements(
            parentModelPages,
            m_ownModelPageConfig,
            false);
        m_functionReferences = CmsADEConfigData.combineConfigurationElements(
            parentFunctionRefs,
            m_functionReferences,
            false);
        if ((parent != null) && (m_ownDynamicFunctions == null)) {
            m_dynamicFunctions = parent.m_dynamicFunctions;
        } else {
            m_dynamicFunctions = m_ownDynamicFunctions;
        }
    }
389748
public void move(CmsClientSitemapEntry entry, String toPath, int position) {

        // check for valid data
        if (!isValidEntryAndPath(entry, toPath)) {
            // invalid data, do nothing
            CmsDebugLog.getInstance().printLine("invalid data, doing nothing");
            return;
        }
        // check for relevance
        if (isChangedPosition(entry, toPath, position)) {
            // only register real changes
            CmsSitemapChange change = new CmsSitemapChange(entry.getId(), entry.getSitePath(), ChangeType.modify);
            change.setDefaultFileId(entry.getDefaultFileId());
            if (!toPath.equals(entry.getSitePath())) {
                change.setParentId(getEntry(CmsResource.getParentFolder(toPath)).getId());
                change.setName(CmsResource.getName(toPath));
            }
            if (CmsSitemapView.getInstance().isNavigationMode()) {
                change.setPosition(position);
            }
            change.setLeafType(entry.isLeafType());
            CmsSitemapClipboardData data = getData().getClipboardData().copy();
            data.addModified(entry);
            change.setClipBoardData(data);
            commitChange(change, null);
        }
    }
18421
public void onReceiveSitemapPreloadData(CmsSitemapEntryBean sitemapPreloadData) {

        fillWithPreloadInfo(Collections.singletonList(sitemapPreloadData));
        String siteRoot = sitemapPreloadData.getSiteRoot();
        if (siteRoot != null) {
            selectSite(siteRoot);
        }
    }
1195756
function(target) {
      while (target) {
        if (target.classList && target.classList.contains(ITEM_CLASS)) {
          return target;
        }
        target = target.parentNode;
      }
      return null;
    }
909411
public void setParentLinks(java.util.Collection<ObjectIdentifierAndLinkNameTuple> parentLinks) {
        if (parentLinks == null) {
            this.parentLinks = null;
            return;
        }

        this.parentLinks = new java.util.ArrayList<ObjectIdentifierAndLinkNameTuple>(parentLinks);
    }
3875
protected void performSingleMoveOperation(String source, String target, String sitePrefix) throws CmsException {

        // calculate the target name
        String finalTarget = getCms().getRequestContext().getFileTranslator().translateResource(target);
        finalTarget = CmsLinkManager.getAbsoluteUri(finalTarget, CmsResource.getParentFolder(source));

        if (finalTarget.equals(source) || (isMultiOperation() && finalTarget.startsWith(source))) {
            throw new CmsVfsException(Messages.get().container(Messages.ERR_MOVE_ONTO_ITSELF_1, finalTarget));
        }

        try {
            CmsResource res = getCms().readResource(finalTarget, CmsResourceFilter.ALL);
            if (res.isFolder()) {
                // target folder already exists, so we add the current folder name
                if (!finalTarget.endsWith("/")) {
                    finalTarget += "/";
                }
                finalTarget = finalTarget + CmsResource.getName(source);
                if (finalTarget.endsWith("/")) {
                    finalTarget = finalTarget.substring(0, finalTarget.length() - 1);
                }
            }
        } catch (CmsVfsResourceNotFoundException e) {
            // target folder does not already exist, so target name is o.k.
            if (LOG.isInfoEnabled()) {
                LOG.info(e.getLocalizedMessage());
            }
        }

        // set the target parameter value
        setParamTarget(finalTarget);

        // could not overwrite a resource in a move operation
        if (getCms().existsResource(finalTarget, CmsResourceFilter.ALL)) {
            // throw exception to indicate that the target exists
            throw new CmsVfsResourceAlreadyExistsException(
                Messages.get().container(
                    Messages.ERR_MOVE_FAILED_TARGET_EXISTS_2,
                    source,
                    getJsp().getRequestContext().removeSiteRoot(finalTarget)));
        }

        // lock resource if autolock is enabled
        checkLock(sitePrefix + source);
        // move the resource
        getCms().moveResource(sitePrefix + source, finalTarget);
    }
926490
@LogExecTime
	public void dragAndDropWithPause(String locator, String targetLocator, int pause)
	{
		jtEvent.dragAndDropWithPause(locator, targetLocator, pause);
	}
561931
private void deleteResource(final String sitePath) {

        CmsRpcAction<Void> action = new CmsRpcAction<Void>() {

            /**
             * @see org.opencms.gwt.client.rpc.CmsRpcAction#execute()
             */
            @Override
            public void execute() {

                CmsCoreProvider.getVfsService().deleteResource(sitePath, this);

            }

            /**
             * @see org.opencms.gwt.client.rpc.CmsRpcAction#onResponse(java.lang.Object)
             */
            @Override
            protected void onResponse(Void result) {

                onAfterDeletion();
            }
        };
        action.execute();
    }
1050442
public void setParent(ProjectCalendar calendar)
   {
      // I've seen a malformed MSPDI file which sets the parent calendar to itself.
      // Silently ignore this here.
      if (calendar != this)
      {
         if (getParent() != null)
         {
            getParent().removeDerivedCalendar(this);
         }

         super.setParent(calendar);

         if (calendar != null)
         {
            calendar.addDerivedCalendar(this);
         }
         clearWorkingDateCache();
      }
   }