/** * Sets whether or not this text area should be treated as read-only. * This fires a property change event of type {@link #READ_ONLY_PROPERTY}. * * @param readOnly Whether or not the document is read-only. * @see #isReadOnly() */ public void setReadOnly(boolean readOnly) { if (this.readOnly!=readOnly) { this.readOnly = readOnly; firePropertyChange(READ_ONLY_PROPERTY, !readOnly, readOnly); } }
/** * Sets whether or not this text in this editor has unsaved changes. * This fires a property change event of type {@link #DIRTY_PROPERTY}.<p> * * Applications will usually have no need to call this method directly; the * only time you might have a need to call this method directly is if you * have to initialize an instance of TextEditorPane with content that does * not come from a file. <code>TextEditorPane</code> automatically sets its * own dirty flag when its content is edited, when its encoding is changed, * or when its line ending property is changed. It is cleared whenever * <code>load()</code>, <code>reload()</code>, <code>save()</code>, or * <code>saveAs()</code> are called. * * @param dirty Whether or not the text has been modified. * @see #isDirty() */ public void setDirty(boolean dirty) { if (this.dirty!=dirty) { this.dirty = dirty; firePropertyChange(DIRTY_PROPERTY, !dirty, dirty); } }
/** * Sets the encoding to use when reading or writing this file. This * method sets the editor's dirty flag when the encoding is changed, and * fires a property change event of type {@link #ENCODING_PROPERTY}. * * @param encoding The new encoding. * @throws UnsupportedCharsetException If the encoding is not supported. * @throws NullPointerException If <code>encoding</code> is * <code>null</code>. * @see #getEncoding() */ public void setEncoding(String encoding) { if (encoding==null) { throw new NullPointerException("encoding cannot be null"); } else if (!Charset.isSupported(encoding)) { throw new UnsupportedCharsetException(encoding); } if (charSet==null || !charSet.equals(encoding)) { String oldEncoding = charSet; charSet = encoding; firePropertyChange(ENCODING_PROPERTY, oldEncoding, charSet); setDirty(true); } }
/** * Saves this file in a new local location. This method fires a property * change event of type {@link #FULL_PATH_PROPERTY}. * * @param loc The location to save to. * @throws IOException If an IO error occurs. * @see #save() * @see #load(FileLocation, String) */ public void saveAs(FileLocation loc) throws IOException { saveImpl(loc); // No exception thrown - we can "rename" the file. String old = getFileFullPath(); this.loc = loc; setDirty(false); lastSaveOrLoadTime = loc.getActualLastModified(); firePropertyChange(FULL_PATH_PROPERTY, old, getFileFullPath()); }
/** * Sets whether or not this text area should be treated as read-only. * This fires a property change event of type {@link #READ_ONLY_PROPERTY}. * * @param readOnly Whether or not the document is read-only. * @see #isReadOnly() */ public void setReadOnly(boolean readOnly) { if (this.readOnly!=readOnly) { this.readOnly = readOnly; firePropertyChange(READ_ONLY_PROPERTY, !readOnly, readOnly); } }
/** * Sets whether or not this text area should be treated as read-only. * This fires a property change event of type {@link #READ_ONLY_PROPERTY}. * * @param readOnly Whether or not the document is read-only. * @see #isReadOnly() */ public void setReadOnly(boolean readOnly) { if (this.readOnly!=readOnly) { this.readOnly = readOnly; firePropertyChange(READ_ONLY_PROPERTY, !readOnly, readOnly); } }
/** * Sets whether or not this text area should be treated as read-only. * This fires a property change event of type {@link #READ_ONLY_PROPERTY}. * * @param readOnly Whether or not the document is read-only. * @see #isReadOnly() */ public void setReadOnly(boolean readOnly) { if (this.readOnly!=readOnly) { this.readOnly = readOnly; firePropertyChange(READ_ONLY_PROPERTY, !readOnly, readOnly); } }
/** * Sets whether or not this text in this editor has unsaved changes. * This fires a property change event of type {@link #DIRTY_PROPERTY}. * * @param dirty Whether or not the text has beeen modified. * @see #isDirty() */ private void setDirty(boolean dirty) { if (this.dirty!=dirty) { this.dirty = dirty; firePropertyChange(DIRTY_PROPERTY, !dirty, dirty); } }
/** * Sets whether or not this text in this editor has unsaved changes. * This fires a property change event of type {@link #DIRTY_PROPERTY}. * * @param dirty Whether or not the text has beeen modified. * @see #isDirty() */ private void setDirty(boolean dirty) { if (this.dirty!=dirty) { this.dirty = dirty; firePropertyChange(DIRTY_PROPERTY, !dirty, dirty); } }
/** * Sets whether or not this text in this editor has unsaved changes. * This fires a property change event of type {@link #DIRTY_PROPERTY}.<p> * * Applications will usually have no need to call this method directly; the * only time you might have a need to call this method directly is if you * have to initialize an instance of TextEditorPane with content that does * not come from a file. <code>TextEditorPane</code> automatically sets its * own dirty flag when its content is edited, when its encoding is changed, * or when its line ending property is changed. It is cleared whenever * <code>load()</code>, <code>reload()</code>, <code>save()</code>, or * <code>saveAs()</code> are called. * * @param dirty Whether or not the text has been modified. * @see #isDirty() */ public void setDirty(boolean dirty) { if (this.dirty!=dirty) { this.dirty = dirty; firePropertyChange(DIRTY_PROPERTY, !dirty, dirty); } }
setCaretPosition(0); discardAllEdits(); firePropertyChange(FULL_PATH_PROPERTY, old, getFileFullPath());
/** * Sets the encoding to use when reading or writing this file. This * method sets the editor's dirty flag when the encoding is changed, and * fires a property change event of type {@link #ENCODING_PROPERTY}. * * @param encoding The new encoding. * @throws UnsupportedCharsetException If the encoding is not supported. * @throws NullPointerException If <code>encoding</code> is * <code>null</code>. * @see #getEncoding() */ public void setEncoding(String encoding) { if (encoding==null) { throw new NullPointerException("encoding cannot be null"); } else if (!Charset.isSupported(encoding)) { throw new UnsupportedCharsetException(encoding); } if (charSet==null || !charSet.equals(encoding)) { String oldEncoding = charSet; charSet = encoding; firePropertyChange(ENCODING_PROPERTY, oldEncoding, charSet); setDirty(true); } }
/** * Saves this file in a new local location. This method fires a property * change event of type {@link #FULL_PATH_PROPERTY}. * * @param loc The location to save to. * @throws IOException If an IO error occurs. * @see #save() * @see #load(FileLocation, String) */ public void saveAs(FileLocation loc) throws IOException { saveImpl(loc); // No exception thrown - we can "rename" the file. String old = getFileFullPath(); this.loc = loc; setDirty(false); lastSaveOrLoadTime = loc.getActualLastModified(); firePropertyChange(FULL_PATH_PROPERTY, old, getFileFullPath()); }
/** * Saves this file in a new local location. This method fires a property * change event of type {@link #FULL_PATH_PROPERTY}. * * @param loc The location to save to. * @throws IOException If an IO error occurs. * @see #save() * @see #load(FileLocation, String) */ public void saveAs(FileLocation loc) throws IOException { saveImpl(loc); // No exception thrown - we can "rename" the file. String old = getFileFullPath(); this.loc = loc; setDirty(false); lastSaveOrLoadTime = loc.getActualLastModified(); firePropertyChange(FULL_PATH_PROPERTY, old, getFileFullPath()); }
/** * Saves this file in a new local location. This method fires a property * change event of type {@link #FULL_PATH_PROPERTY}. * * @param loc The location to save to. * @throws IOException If an IO error occurs. * @see #save() * @see #load(FileLocation, String) */ public void saveAs(FileLocation loc) throws IOException { saveImpl(loc); // No exception thrown - we can "rename" the file. String old = getFileFullPath(); this.loc = loc; setDirty(false); lastSaveOrLoadTime = loc.getActualLastModified(); firePropertyChange(FULL_PATH_PROPERTY, old, getFileFullPath()); }
setCaretPosition(0); discardAllEdits(); firePropertyChange(FULL_PATH_PROPERTY, old, getFileFullPath());