Performs the change element language action of the editor.<p>
183485
public void actionChangeElementLanguage() {

        // save eventually changed content of the editor
        Locale oldLocale = CmsLocaleManager.getLocale(getParamOldelementlanguage());
        Locale newLocale = getElementLocale();
        try {
            setEditorValues(oldLocale);
            if (!m_content.validate(getCms()).hasErrors(oldLocale)) {
                // no errors found in content
                if (!m_content.hasLocale(newLocale)) {
                    // check if we should copy the content from a default locale
                    boolean addNew = true;
                    List<Locale> locales = OpenCms.getLocaleManager().getDefaultLocales(getCms(), getParamResource());
                    if (locales.size() > 1) {
                        // default locales have been set, try to find a match
                        try {
                            m_content.copyLocale(locales, newLocale);
                            addNew = false;
                        } catch (CmsXmlException e) {
                            // no matching default locale was available, we will create a new one later
                        }
                    }
                    if (addNew) {
                        // create new element if selected language element is not present
                        try {
                            m_content.addLocale(getCms(), newLocale);
                        } catch (CmsXmlException e) {
                            if (LOG.isErrorEnabled()) {
                                LOG.error(e.getLocalizedMessage(), e);
                            }
                        }
                    }
                }
                //save to temporary file
                writeContent();
                // set default action to suppress error messages
                setAction(ACTION_DEFAULT);
            } else {
                // errors found, switch back to old language to show errors
                setParamElementlanguage(getParamOldelementlanguage());
                // set stored locale to null to reinitialize it
                m_elementLocale = null;
            }
        } catch (Exception e) {
            // should usually never happen
            if (LOG.isInfoEnabled()) {
                LOG.info(e.getLocalizedMessage(), e);
            }
        }
    }
396298
public void setElementView(CmsElementViewInfo viewInfo, Runnable nextAction) {

        if (viewInfo != null) {
            m_elementView = viewInfo;

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

                @SuppressWarnings("synthetic-access")
                @Override
                public void execute() {

                    getContainerpageService().setElementView(m_elementView.getElementViewId(), this);
                }

                @Override
                protected void onResponse(Void result) {

                    // nothing to do
                }
            };
            action.execute();
            m_currentEditLevel = -1;
            reinitializeButtons();
            reInitInlineEditing();
            updateGalleryData(true, nextAction);
        }
    }
781200
function somethingChanged() {
                // don't fire events if the editor is readOnly as they are false detections
                if (editor.readOnly)
                    return;

                if (timer)
                    return;

                timer = setTimeout(function () {
                    timer = 0;
                    editor.fire('change');
                }, editor.config.minimumChangeMilliseconds || 100);
            }
577217
public void actionCopyElementLocale() throws JspException {

        try {
            setEditorValues(getElementLocale());
            if (!hasValidationErrors()) {
                // save content of the editor only to the temporary file
                writeContent();
                CmsObject cloneCms = getCloneCms();
                CmsUUID tempProjectId = OpenCms.getWorkplaceManager().getTempFileProjectId();
                cloneCms.getRequestContext().setCurrentProject(getCms().readProject(tempProjectId));
                // remove eventual release & expiration date from temporary file to make preview work
                cloneCms.setDateReleased(getParamTempfile(), CmsResource.DATE_RELEASED_DEFAULT, false);
                cloneCms.setDateExpired(getParamTempfile(), CmsResource.DATE_EXPIRED_DEFAULT, false);
            }
        } catch (CmsException e) {
            // show error page
            showErrorPage(this, e);
        }
    }
785169
private void updateButtonVisibility(CmsContainerPageElementPanel elementWidget) {

        Iterator<Widget> it = elementWidget.getElementOptionBar().iterator();
        while (it.hasNext()) {
            Widget w = it.next();
            if (w instanceof I_CmsGroupEditorOption) {
                if (((I_CmsGroupEditorOption)w).checkVisibility()) {
                    w.getElement().getStyle().clearDisplay();
                } else {
                    w.getElement().getStyle().setDisplay(Display.NONE);
                }
            }
        }
    }
491975
public void addAction(M element, short value)
    {
        actions.put(element, Short.valueOf(value));
    }
553767
protected void openEditorForNewElement(
        org.opencms.ade.containerpage.client.ui.CmsContainerPageElementPanel element,
        CmsContainerElement newElementData,
        boolean inline) {

        String oldId = element.getNewType();
        element.setNewType(null);
        if (inline) {
            String newId = getServerId(newElementData.getClientId());
            CmsContentEditor.replaceResourceIds(element.getElement(), oldId, newId);
        }
        element.setId(newElementData.getClientId());
        element.setSitePath(newElementData.getSitePath());

        setPageChanged();
        getHandler().hidePageOverlay();
        getHandler().openEditorForElement(element, inline, true);
    }
691092
protected void initEditorChangeHandlers(Element element) {

        Iterator<Element> i = CmsXmlGenericWrapper.elementIterator(element, APPINFO_EDITOR_CHANGE_HANDLER);
        while (i.hasNext()) {
            // iterate all "default" elements in the "defaults" node
            Element handlerElement = i.next();
            String handlerClass = handlerElement.attributeValue(APPINFO_ATTR_CLASS);
            String configuration = handlerElement.attributeValue(APPINFO_ATTR_CONFIGURATION);
            String scope = handlerElement.attributeValue(APPINFO_ATTR_SCOPE);
            try {
                I_CmsXmlContentEditorChangeHandler handler = (I_CmsXmlContentEditorChangeHandler)Class.forName(
                    handlerClass).newInstance();
                handler.setConfiguration(configuration);
                handler.setScope(scope);
                m_editorChangeHandlers.add(handler);
            } catch (Exception e) {
                LOG.error(e.getLocalizedMessage(), e);
            }
        }
    }
267208
void renderFormContent() {

        initLocaleSelect();
        setNativeResourceInfo(m_sitePath, m_locale);
        m_contentInfoHeader = new CmsInfoHeader(m_title, null, m_sitePath, m_locale, m_iconClasses);
        m_basePanel.add(m_contentInfoHeader);
        SimplePanel content = new SimplePanel();
        content.setStyleName(org.opencms.acacia.client.css.I_CmsLayoutBundle.INSTANCE.form().formParent());
        m_basePanel.add(content);
        initEntityObserver();
        if (m_definitions.get(m_locale).hasEditorChangeHandlers()) {
            initEditorChangeHandlers(m_definitions.get(m_locale).getEditorChangeScopes());
        }
        renderEntityForm(m_entityId, m_tabInfos, content, m_basePanel.getElement());
        if ((m_clientId != null) && (getFormTabs() != null)) {

            CmsListInfoBean pageInfo = CmsContainerpageController.get().getData().getPageInfo();
            m_pageInfoHeader = new CmsInfoHeader(
                pageInfo.getTitle(),
                null,
                pageInfo.getSubTitle(),
                CmsContainerpageController.get().getData().getLocale(),
                pageInfo.getBigIconClasses());
            updateInfoHeader(CmsContentDefinition.SETTINGS_TAB_ID.equals(getFormTabs().getSelectedId()));
            getFormTabs().addSelectionHandler(new SelectionHandler<Integer>() {

                public void onSelection(SelectionEvent<Integer> event) {

                    updateInfoHeader(CmsContentDefinition.SETTINGS_TAB_ID.equals(getFormTabs().getSelectedId()));
                }
            });
        }
    }
709085
@Override
    public void selectionChanged(IAction action, ISelection selection) {
        bugInstance = null;
        // TODO learn to deal with ALL elements
        IMarker marker = MarkerUtil.getMarkerFromSingleSelection(selection);
        if (marker == null) {
            return;
        }
        bugInstance = MarkerUtil.findBugInstanceForMarker(marker);
    }
1349129
public void stateChanged (ChangeEvent e)
    {
        JSlider source = (JSlider)e.getSource();
        if (!source.getValueIsAdjusting()) {
            _value.setText(Integer.toString(source.getValue()));
        }
    }
848844
void internalOpenDialog(
        final CmsContainerPageElementPanel element,
        String editContentId,
        final boolean inline,
        boolean wasNew) {

        if (!m_editorOpened) {
            m_editorOpened = true;
            m_handler.disableToolbarButtons();
            m_handler.deactivateCurrentButton();
            m_currentElementId = editContentId;
            final String serverId = CmsContainerpageController.getServerId(m_currentElementId);
            final Runnable classicEdit = new Runnable() {

                public void run() {

                    CmsEditableData editableData = new CmsEditableData();
                    editableData.setElementLanguage(CmsCoreProvider.get().getLocale());
                    editableData.setStructureId(new CmsUUID(serverId));
                    editableData.setSitePath(element.getSitePath());
                    editableData.setMainLanguage(m_handler.m_controller.getData().getMainLocale());
                    CmsContentEditorDialog.get().openEditDialog(
                        editableData,
                        false,
                        null,
                        new DialogOptions(),
                        CmsContentEditorHandler.this);
                }
            };

            if (m_handler.m_controller.getData().isUseClassicEditor() || element.isNewEditorDisabled()) {
                classicEdit.run();
            } else {
                String editorLocale = CmsCoreProvider.get().getLocale();
                final String mainLocale;
                if (m_handler.m_controller.getData().getMainLocale() == null) {
                    Element htmlEl = CmsDomUtil.querySelector(
                        "[" + CmsGwtConstants.ATTR_DATA_ID + "*='" + serverId + "']",
                        element.getElement());
                    if (htmlEl != null) {
                        String entityId = htmlEl.getAttribute(CmsGwtConstants.ATTR_DATA_ID);
                        mainLocale = CmsContentDefinition.getLocaleFromId(entityId);
                    } else {
                        mainLocale = null;
                    }
                } else {
                    mainLocale = m_handler.m_controller.getData().getMainLocale();
                }
                I_CmsSimpleCallback<Boolean> onClose = new I_CmsSimpleCallback<Boolean>() {

                    public void execute(Boolean hasChangedSettings) {

                        addClosedEditorHistoryItem();
                        onClose(element.getSitePath(), new CmsUUID(serverId), false, hasChangedSettings.booleanValue());
                    }
                };
                if (inline && CmsContentEditor.hasEditable(element.getElement())) {
                    addEditingHistoryItem(true);
                    CmsEditorContext context = getEditorContext();
                    context.setHtmlContextInfo(getContextInfo(element));
                    // remove expired style before initializing the editor
                    element.setReleasedAndNotExpired(true);
                    // in case of new elements, ignore load time
                    CmsDebugLog.consoleLog("Opening inline editor for element. Was new: " + wasNew);
                    long loadTime = wasNew ? Long.MAX_VALUE : m_handler.m_controller.getLoadTime();
                    CmsContentEditor.getInstance().openInlineEditor(
                        context,
                        new CmsUUID(serverId),
                        editorLocale,
                        element,
                        mainLocale,
                        loadTime,
                        onClose);
                } else {
                    addEditingHistoryItem(false);
                    Map<String, String> settingPresets = new HashMap<String, String>();
                    CmsEditorContext context = getEditorContext();
                    I_CmsDropContainer dropContainer = element.getParentTarget();
                    if (dropContainer instanceof CmsContainerPageContainer) {
                        CmsContainerPageContainer container = (CmsContainerPageContainer)dropContainer;
                        settingPresets.putAll(container.getSettingPresets());
                    }
                    context.setSettingPresets(settingPresets);

                    boolean allowSettings = m_handler.m_controller.getData().allowSettingsInEditor()
                        && !m_handler.m_controller.isEditingDisabled()
                        && !serverId.equals(String.valueOf(m_handler.m_controller.getData().getDetailId()));
                    I_CmsSimpleCallback<Boolean> openEditor = new I_CmsSimpleCallback<Boolean>() {

                        public void execute(Boolean lockedPage) {

                            CmsContentEditor.getInstance().openFormEditor(
                                context,
                                editorLocale,
                                serverId,
                                lockedPage.booleanValue() ? getCurrentElementId() : null,
                                null,
                                null,
                                null,
                                null,
                                mainLocale,
                                null,
                                onClose);
                        }
                    };
                    if (allowSettings) {
                        if (m_handler.m_controller.getData().getDetailContainerPage() != null) {
                            CmsCoreProvider.get().lock(
                                m_handler.m_controller.getData().getDetailContainerPage(),
                                m_handler.m_controller.getLoadTime(),
                                openEditor);
                        } else {
                            CmsCoreProvider.get().lock(
                                CmsCoreProvider.get().getStructureId(),
                                m_handler.m_controller.getLoadTime(),
                                openEditor);
                        }
                    } else {
                        openEditor.execute(Boolean.FALSE);
                    }

                }
            }
        } else {
            CmsDebugLog.getInstance().printLine("Editor is already being opened.");
        }
    }
652991
function _updateLanguageInfo(editor) {
        var doc = editor.document,
            lang = doc.getLanguage();

        // Show the current language as button title
        languageSelect.$button.text(lang.getName());
    }
555027
protected void applyChange(CmsSitemapChange change) {

        // update the clip board data
        if (change.getClipBoardData() != null) {
            getData().getClipboardData().setDeletions(change.getClipBoardData().getDeletions());
            getData().getClipboardData().setModifications(change.getClipBoardData().getModifications());
        }
        switch (change.getChangeType()) {
            case bumpDetailPage:
                CmsDetailPageTable detailPageTable = getData().getDetailPageTable();
                if (detailPageTable.contains(change.getEntryId())) {
                    detailPageTable.bump(change.getEntryId());
                }
                break;
            case clipboardOnly:
                // nothing to do
                break;
            case remove:
                CmsClientSitemapEntry entry = getEntryById(change.getEntryId());
                entry.setInNavigation(false);
                CmsPropertyModification propMod = new CmsPropertyModification(
                    entry.getId(),
                    CmsClientProperty.PROPERTY_NAVTEXT,
                    null,
                    true);
                executePropertyModification(propMod);
                propMod = new CmsPropertyModification(entry.getId(), CmsClientProperty.PROPERTY_NAVTEXT, null, true);
                executePropertyModification(propMod);
                entry.normalizeProperties();
                break;
            case undelete:
                updateEntry(change.getParentId());
                break;
            case create:
                CmsClientSitemapEntry newEntry = change.getUpdatedEntry();
                getEntryById(change.getParentId()).insertSubEntry(newEntry, change.getPosition(), this);
                newEntry.initializeAll(this);
                if (isDetailPage(newEntry)) {
                    CmsDetailPageInfo info = getDetailPageInfo(newEntry.getId());
                    if (info == null) {
                        info = new CmsDetailPageInfo(
                            newEntry.getId(),
                            newEntry.getSitePath(),
                            newEntry.getDetailpageTypeName(),
                            newEntry.getVfsModeIcon());
                    }
                    addDetailPageInfo(info);
                }
                break;
            case delete:
                removeEntry(change.getEntryId(), change.getParentId());
                break;
            case modify:
                if (change.hasNewParent() || change.hasChangedPosition()) {
                    CmsClientSitemapEntry moved = getEntryById(change.getEntryId());
                    String oldSitepath = moved.getSitePath();
                    CmsClientSitemapEntry sourceParent = getEntry(CmsResource.getParentFolder(oldSitepath));
                    sourceParent.removeSubEntry(moved.getId());
                    CmsClientSitemapEntry destParent = change.hasNewParent()
                    ? getEntryById(change.getParentId())
                    : sourceParent;
                    if (change.getPosition() < destParent.getSubEntries().size()) {
                        destParent.insertSubEntry(moved, change.getPosition(), this);
                    } else {
                        // inserting as last entry of the parent list
                        destParent.addSubEntry(moved, this);
                    }
                    if (change.hasNewParent()) {
                        cleanupOldPaths(oldSitepath, destParent.getSitePath());
                    }
                }
                if (change.hasChangedName()) {
                    CmsClientSitemapEntry changed = getEntryById(change.getEntryId());
                    String oldSitepath = changed.getSitePath();
                    String parentPath = CmsResource.getParentFolder(oldSitepath);
                    String newSitepath = CmsStringUtil.joinPaths(parentPath, change.getName());
                    changed.updateSitePath(newSitepath, this);
                    cleanupOldPaths(oldSitepath, newSitepath);
                }
                if (change.hasChangedProperties()) {
                    for (CmsPropertyModification modification : change.getPropertyChanges()) {
                        executePropertyModification(modification);
                    }
                    getEntryById(change.getEntryId()).normalizeProperties();
                }
                if (change.getUpdatedEntry() != null) {
                    CmsClientSitemapEntry oldEntry = getEntryById(change.getEntryId());
                    CmsClientSitemapEntry parent = getEntry(CmsResource.getParentFolder(oldEntry.getSitePath()));
                    removeEntry(change.getEntryId(), parent.getId());
                    parent.insertSubEntry(change.getUpdatedEntry(), oldEntry.getPosition(), this);
                    change.getUpdatedEntry().initializeAll(this);
                }
                break;
            default:
        }
        if (change.getChangeType() != ChangeType.delete) {
            recomputeProperties();
        }
        m_eventBus.fireEventFromSource(new CmsSitemapChangeEvent(change), this);
    }
114872
public void updateClipboard(Map<String, CmsContainerElementData> elements) {

        if (m_editor.getClipboard().isOpen()) {
            for (CmsContainerElementData elementData : elements.values()) {
                m_editor.getClipboard().replaceFavoriteItem(
                    m_controller.getContainerpageUtil().createListItem(elementData));
                m_editor.getClipboard().replaceRecentItem(
                    m_controller.getContainerpageUtil().createListItem(elementData));
            }
        }
    }
328897
public void reInitInlineEditing() {

        removeEditButtonsPositionTimer();
        if ((m_targetContainers == null) || getData().isUseClassicEditor()) {
            // if the target containers are not initialized yet or classic editor is set, don't do anything
            return;
        }
        if (isGroupcontainerEditing()) {
            for (Widget element : m_groupEditor.getGroupContainerWidget()) {
                if (((element instanceof CmsContainerPageElementPanel)
                    && isInlineEditable(
                        (CmsContainerPageElementPanel)element,
                        m_groupEditor.getGroupContainerWidget()))) {
                    ((CmsContainerPageElementPanel)element).initInlineEditor(this);
                }
            }
        } else {
            for (CmsContainerPageContainer container : m_targetContainers.values()) {
                // first remove inline editors
                for (Widget element : container) {
                    if ((element instanceof CmsContainerPageElementPanel)) {
                        ((CmsContainerPageElementPanel)element).removeInlineEditor();
                    }
                }

                // add inline editors only on suitable elements
                if (isContainerEditable(container) && matchesCurrentEditLevel(container)) {
                    for (Widget element : container) {
                        if ((element instanceof CmsContainerPageElementPanel)
                            && isInlineEditable((CmsContainerPageElementPanel)element, container)) {
                            ((CmsContainerPageElementPanel)element).initInlineEditor(this);
                        }
                    }
                }
            }
        }
    }
731808
public void stateChanged (ChangeEvent e)
    {
        JSlider source = (JSlider)e.getSource();
        if (!source.getValueIsAdjusting()) {
            int val = source.getValue();
            // update the model with the newly selected component
            setSelectedComponent(val);
            // update the label with the new value
            _clabel.setText(Integer.toString(val));
        }
    }