Module org.jhotdraw8.application
Package org.jhotdraw8.application.action
Class AbstractSaveUnsavedChangesAction
java.lang.Object
org.jhotdraw8.application.AbstractDisableable
org.jhotdraw8.application.action.AbstractAction
org.jhotdraw8.application.action.AbstractApplicationAction
org.jhotdraw8.application.action.AbstractActivityAction<FileBasedActivity>
org.jhotdraw8.application.action.AbstractSaveUnsavedChangesAction
- All Implemented Interfaces:
EventListener,javafx.event.EventHandler<javafx.event.ActionEvent>,Action,PropertyBean,Disableable
- Direct Known Subclasses:
ClearFileAction,CloseFileAction
public abstract class AbstractSaveUnsavedChangesAction
extends AbstractActivityAction<FileBasedActivity>
This abstract class can be extended to implement an
Action that asks
to write unsaved changes of a FileBasedActivity
before a destructive action is performed.
If the view has no unsaved changes, method doIt is invoked
immediately. If unsaved changes are present, a dialog is shown asking whether
the user wants to discard the changes, cancel or write the changes before
doing it. If the user chooses to discard the changes, doIt is invoked
immediately. If the user chooses to cancel, the action is aborted. If the
user chooses to write the changes, the view is saved, and doIt is
only invoked after the view was successfully saved.
- Author:
- Werner Randelshofer
-
Property Summary
Properties inherited from class org.jhotdraw8.application.action.AbstractAction
selectedProperties inherited from class org.jhotdraw8.application.AbstractDisableable
disabledProperties inherited from interface org.jhotdraw8.fxbase.control.Disableable
disabled -
Field Summary
Fields inherited from class org.jhotdraw8.application.action.AbstractApplicationAction
appFields inherited from class org.jhotdraw8.application.action.AbstractAction
propertiesFields inherited from class org.jhotdraw8.application.AbstractDisableable
disabled, disablersFields inherited from interface org.jhotdraw8.application.action.Action
ACCELERATOR_KEY, ID_KEY, LABEL, LARGE_ICON_KEY, LONG_DESCRIPTION, MNEMONIC_KEY, SELECTED_PROPERTY, SHORT_DESCRIPTION, SMALL_ICONFields inherited from interface org.jhotdraw8.fxbase.control.Disableable
DISABLED_PROPERTY -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new instance. -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract CompletionStage<Void> protected @Nullable URIChoosergetChooser(FileBasedActivity view) protected @Nullable javafx.scene.NodegetFocusOwner(@NonNull javafx.scene.Node node) voidprotected final voidonActionPerformed(@NonNull javafx.event.ActionEvent evt, @NonNull FileBasedActivity activity) This method is invoked when the action is not disabled and the event is not consumed.protected voidsaveView(@NonNull FileBasedActivity v, WorkState<Void> workState) protected voidsaveViewToURI(@NonNull FileBasedActivity v, @NonNull URI uri, @Nullable URIChooser chooser, javafx.scene.input.DataFormat dataFormat, WorkState<Void> workState) Methods inherited from class org.jhotdraw8.application.action.AbstractActivityAction
getActivity, onActionPerformedMethods inherited from class org.jhotdraw8.application.action.AbstractApplicationAction
createAlert, createErrorMessage, getApplication, onActionPerformedMethods inherited from class org.jhotdraw8.application.action.AbstractAction
getProperties, handle, selectedPropertyMethods inherited from class org.jhotdraw8.application.AbstractDisableable
disabledProperty, disablersMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.jhotdraw8.application.action.Action
getId, getLabel, isSelected, setSelectedMethods inherited from interface org.jhotdraw8.fxbase.control.Disableable
addDisabler, disabledProperty, disablers, isDisabled, removeDisablerMethods inherited from interface org.jhotdraw8.fxbase.beans.PropertyBean
get, getNonNull, getProperty, put, remove, set, setNonNull, valueAt
-
Constructor Details
-
AbstractSaveUnsavedChangesAction
Creates a new instance.- Parameters:
activity- the view
-
-
Method Details
-
onActionPerformed
protected final void onActionPerformed(@NonNull javafx.event.ActionEvent evt, @NonNull FileBasedActivity activity) Description copied from class:AbstractActivityActionThis method is invoked when the action is not disabled and the event is not consumed.- Specified by:
onActionPerformedin classAbstractActivityAction<FileBasedActivity>- Parameters:
evt- the action eventactivity- the activity
-
getChooser
-
onActionOnViewPerformed
-
getFocusOwner
-
saveView
-
saveViewToURI
protected void saveViewToURI(@NonNull FileBasedActivity v, @NonNull URI uri, @Nullable URIChooser chooser, javafx.scene.input.DataFormat dataFormat, WorkState<Void> workState) -
doIt
-