Class SaveActionBase

    • Field Detail

      • quiet

        private boolean quiet
    • Constructor Detail

      • SaveActionBase

        protected SaveActionBase​(java.lang.String name,
                                 java.lang.String iconName,
                                 java.lang.String tooltip,
                                 Shortcut shortcut)
        Constructs a new SaveActionBase.
        Parameters:
        name - The action's text as displayed on the menu (if it is added to a menu)
        iconName - The filename of the icon to use
        tooltip - A longer description of the action that will be displayed in the tooltip
        shortcut - A ready-created shortcut object or null if you don't want a shortcut
      • SaveActionBase

        protected SaveActionBase​(java.lang.String name,
                                 java.lang.String iconName,
                                 java.lang.String tooltip,
                                 Shortcut shortcut,
                                 boolean quiet)
        Constructs a new SaveActionBase.
        Parameters:
        name - The action's text as displayed on the menu (if it is added to a menu)
        iconName - The filename of the icon to use
        tooltip - A longer description of the action that will be displayed in the tooltip
        shortcut - A ready-created shortcut object or null if you don't want a shortcut
        quiet - whether the quiet exporter is called
        Since:
        15496
    • Method Detail

      • actionPerformed

        public void actionPerformed​(java.awt.event.ActionEvent e)
      • doSave

        public boolean doSave()
        Saves the active layer.
        Returns:
        true if the save operation succeeds
      • doSave

        public boolean doSave​(boolean quiet)
        Saves the active layer.
        Parameters:
        quiet - If the file is saved without prompting the user
        Returns:
        true if the save operation succeeds
        Since:
        15496
      • doSave

        public boolean doSave​(Layer layer)
        Saves the given layer.
        Parameters:
        layer - layer to save
        Returns:
        true if the save operation succeeds
      • doSave

        public boolean doSave​(Layer layer,
                              boolean quiet)
        Saves the given layer.
        Parameters:
        layer - layer to save
        quiet - If the file is saved without prompting the user
        Returns:
        true if the save operation succeeds
        Since:
        15496
      • doSave

        public static boolean doSave​(Layer layer,
                                     java.io.File file,
                                     boolean checkSaveConditions)
        Saves a layer to a given file.
        Parameters:
        layer - The layer to save
        file - The destination file
        checkSaveConditions - if true, checks preconditions before saving. Set it to false to skip it and prevent dialogs from being shown.
        Returns:
        true if the layer has been successfully saved, false otherwise
        Since:
        7204
      • doInternalSave

        private static boolean doInternalSave​(Layer layer,
                                              java.io.File file,
                                              boolean quiet)
      • getFile

        protected abstract java.io.File getFile​(Layer layer)
      • checkFileAndConfirmOverWrite

        public static java.io.File checkFileAndConfirmOverWrite​(AbstractFileChooser fc,
                                                                java.lang.String extension)
        Checks if selected filename has the given extension. If not, adds the extension and asks for overwrite if filename exists.
        Parameters:
        fc - FileChooser where file was already selected
        extension - file extension
        Returns:
        the File or null if the user cancelled the dialog.
      • confirmOverwrite

        public static boolean confirmOverwrite​(java.io.File file)
        Asks user to confirm overwiting a file.
        Parameters:
        file - file to overwrite
        Returns:
        true if the file can be written