Called whenever a property changes on a component we're listening to. @param e The event.
(PropertyChangeEvent e)
| 255 | * @param e The event. |
| 256 | */ |
| 257 | @Override |
| 258 | public void propertyChange(PropertyChangeEvent e) { |
| 259 | |
| 260 | String property = e.getPropertyName(); |
| 261 | |
| 262 | // If a file was just saved... |
| 263 | if (property.equals(RTextEditorPane.DIRTY_PROPERTY)) { |
| 264 | boolean wasDirty = (Boolean)e.getOldValue(); |
| 265 | boolean isDirty = (Boolean)e.getNewValue(); |
| 266 | if (wasDirty && !isDirty) |
| 267 | setStatusMessage(fileSaveSuccessfulText); |
| 268 | } |
| 269 | |
| 270 | // If they opened a file... |
| 271 | else if (property.equals(AbstractMainView.TEXT_AREA_ADDED_PROPERTY)) { |
| 272 | RTextEditorPane textArea = (RTextEditorPane)e.getNewValue(); |
| 273 | setStatusMessage(MessageFormat.format(openedFileText, |
| 274 | textArea.getFileName())); |
| 275 | } |
| 276 | |
| 277 | // If they saved a read-only file with a different filename (hence it |
| 278 | // is now not read-only)... |
| 279 | // NOTE: We don't have the "else" below because we'll get both this |
| 280 | // property change notification and a DIRTY_PROPERTY one. |
| 281 | if (property.equals(RTextEditorPane.READ_ONLY_PROPERTY)) { |
| 282 | boolean enabled = (Boolean)e.getNewValue(); |
| 283 | setReadOnlyIndicatorEnabled(enabled); |
| 284 | } |
| 285 | |
| 286 | } |
| 287 | |
| 288 | |
| 289 | /** |
nothing calls this directly
no test coverage detected