⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 changetierattributescommand.java

📁 编辑视频文件
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
                }                if ((annotator != null) && (!annotator.equals(oldAnnotator))) {                    tier.setAnnotator(oldAnnotator);                }                if (locale != oldLocale) {                    tier.setDefaultLocale(oldLocale);                }                // finally recreate annotations if necessary                //HS sep-04 see execute                /*                   if ((parentTier != oldParentTier) ||                           !oldLingType.getLinguisticTypeName().equals(lingTypeName)) {                       if ((transcription != null) && (annotationsNodes != null) &&                               (annotationsNodes.size() > 0)) {                           setWaitCursor(true);                           tier.removeAllAnnotations();                           DefaultMutableTreeNode node;                           if (tier.hasParentTier()) {                               AnnotationRecreator.createAnnotationsSequentially(transcription,                                   annotationsNodes);                           } else {                               for (int i = 0; i < annotationsNodes.size(); i++) {                                   node = (DefaultMutableTreeNode) annotationsNodes.get(i);                                   AnnotationRecreator.createAnnotationFromTree(transcription,                                       node);                               }                           }                           setWaitCursor(false);                       }                   }                 */                if ((lingType != null) &&                        (oldLingType.hasGraphicReferences() != lingType.hasGraphicReferences())) {                    new ConversionThread(transcription, tier).start();                }            } catch (Exception ex) {                ex.printStackTrace();                setWaitCursor(false);            }        }    }    /**     * The redo action.     */    public void redo() {        if (tier != null) {            setWaitCursor(true);            try {                if ((tierName != null) && (!tierName.equals(oldTierName))) {                    tier.setName(tierName);                }                if (parentTier != oldParentTier) {                    tier.setParentTier(parentTier);                }                if (lingType != null) {                    tier.setLinguisticType(lingType);                }                /*                   if ((oldLingType == null) ||                           (lingTypeName != oldLingType.getLinguisticTypeName())) {                       Vector types = ((Transcription) (tier.getParent())).getLinguisticTypes();                       LinguisticType t = null;                       Iterator typeIter = types.iterator();                       while (typeIter.hasNext()) {                           t = (LinguisticType) typeIter.next();                           if (t.getLinguisticTypeName().equals(lingTypeName)) {                               break;                           }                       }                       tier.setLinguisticType(t);                   }                 */                if ((participant != null) &&                        (!participant.equals(oldParticipant))) {                    tier.setParticipant(participant);                }                if (!annotator.equals(oldAnnotator)) {                    tier.setAnnotator(annotator);                }                if (locale != oldLocale) {                    tier.setDefaultLocale(locale);                }                if ((lingType != null) &&                        (oldLingType.hasGraphicReferences() != lingType.hasGraphicReferences())) {                    new ConversionThread(transcription, tier).start();                }            } catch (Exception ex) {                ex.printStackTrace();                setWaitCursor(false);            }            setWaitCursor(false);        }    }    /**     * Returns the name of the command.     *     * @return the name of the command     */    public String getName() {        return commandName;    }    /**     * Changes the cursor to either a 'busy' cursor or the default cursor.     *     * @param showWaitCursor when <code>true</code> show the 'busy' cursor     */    private void setWaitCursor(boolean showWaitCursor) {        if (showWaitCursor) {            ELANCommandFactory.getRootFrame(transcription).getRootPane()                              .setCursor(Cursor.getPredefinedCursor(                    Cursor.WAIT_CURSOR));        } else {            ELANCommandFactory.getRootFrame(transcription).getRootPane()                              .setCursor(Cursor.getDefaultCursor());        }    }    ////////////////////////////////////////////////////////////////////    // conversion thread    ////////////////////////////////////////////////////////////////////    /**     * A thread to execute and monitor conversion of annotations on a tier.     *     * @author Han Sloetjes     */    class ConversionThread extends Thread {        /** Holds value of property DOCUMENT ME! */        TranscriptionImpl transcription;        /** Holds value of property DOCUMENT ME! */        TierImpl tier;        /** Holds value of property DOCUMENT ME! */        boolean storeGraphicsData = false;        /**         * Constructor.         *         * @param transcription the transcription         * @param tier the single tier to convert         */        public ConversionThread(TranscriptionImpl transcription, TierImpl tier) {            this.transcription = transcription;            this.tier = tier;        }        /**         * Tells the converter whether or not to store relevant data of         * annotations  referencing a graphical object.         *         * @param storeGraphicsData if true store datarecords of annotations         *        with  graphical objects         */        public void start(boolean storeGraphicsData) {            this.storeGraphicsData = storeGraphicsData;            this.start();        }        /**         * Implementation of the Runnable interface.         */        public void run() {            final IndeterminateProgressMonitor monitor = new IndeterminateProgressMonitor(ELANCommandFactory.getRootFrame(                        transcription), true,                    ElanLocale.getString("EditTypeDialog.Message.Convert"),                    false, null);            // if we are blocking (modal) call show from a separate thread            new Thread(new Runnable() {                    public void run() {                        monitor.show();                    }                }).start();            int curPropMode = 0;            curPropMode = transcription.getTimeChangePropagationMode();            if (curPropMode != Transcription.NORMAL) {                transcription.setTimeChangePropagationMode(Transcription.NORMAL);            }            transcription.setNotifying(false);            if (storeGraphicsData) {                ChangeTierAttributesCommand.this.storedGraphicsData = AnnotationRecreator.storeGraphicsData(transcription,                        tier);            }            AnnotationRecreator.convertAnnotations(transcription, tier);            if ((ChangeTierAttributesCommand.this.storedGraphicsData != null) &&                    tier.getLinguisticType().hasGraphicReferences()) {                // apparently we are undoing a previous conversion...                AnnotationRecreator.restoreGraphicsData(transcription,                    ChangeTierAttributesCommand.this.storedGraphicsData);            }            transcription.setNotifying(true);            // restore the time propagation mode            transcription.setTimeChangePropagationMode(curPropMode);            monitor.close();        }    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -