Commit 11b5d39c authored by Radek Ošlejšek's avatar Radek Ošlejšek
Browse files

Resolve "Refactor project GUI"

parent a4febb9e
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
image: maven:3-jdk-11
image: maven:3-openjdk-18-slim

variables: 
  LANG: C.UTF-8
+5 −12
Original line number Diff line number Diff line
@@ -99,6 +99,11 @@
            <artifactId>SpacePartitioning</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>Project</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>HumanFace</artifactId>
@@ -145,18 +150,6 @@
            <artifactId>AbsoluteLayout</artifactId>
            <version>${version.org.netbeans}</version>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
            <version>2.13.0</version>
            <type>jar</type>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-core</artifactId>
            <version>2.13.0</version>
            <type>jar</type>
        </dependency>
        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
+42 −2
Original line number Diff line number Diff line
package cz.fidentis.analyst.gui.app;

import cz.fidentis.analyst.gui.project.ProjectPanel;
import cz.fidentis.analyst.gui.project.ProjectWindow;
import cz.fidentis.analyst.gui.project.SaveProjectAction;
import cz.fidentis.analyst.project.Project;
import java.awt.event.ActionEvent;
import javax.swing.JOptionPane;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
import org.openide.modules.ModuleInstall;
import org.openide.windows.WindowManager;

/**
 * GUI initialization class.
@@ -44,15 +48,51 @@ public class Installer extends ModuleInstall {
    
    @Override
    public boolean closing() {
        ProjectWindow win = (ProjectWindow) WindowManager.getDefault().findTopComponent("ProjectWindow");
        Project project = win.getProjectPanel().getProject();
        
        // If no changes are to be saved, then close silently.
        // Otherwise, ask for saving the project first.
        if (project.changed()) { 
            Object[] options = {"Save and close", "Discard changes and close", "Cancel"};
            int answer = JOptionPane.showOptionDialog(
                    win,
                    "<html><b>Save current project?</b></html>",
                    "Current project modified",
                    JOptionPane.YES_NO_OPTION, 
                    JOptionPane.QUESTION_MESSAGE,
                    null, options, options[0]);
            
            if (answer == 2 || answer == -1) { // cancel
                return false;
            } else if (answer == 0) { // save
                // trigger saving dialogue:
                new SaveProjectAction().actionPerformed(new ActionEvent( 
                        this,
                        ActionEvent.ACTION_PERFORMED,
                        ""));
            
                if (project.changed()) { // saving canceled
                    return false; // skip new project opening
                }
            }
        }
        
        return true;
        
        /*
        int answer = JOptionPane.showConfirmDialog(null,
                "Do you really want to close the application?", "", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE);
        
        if (answer == JOptionPane.YES_OPTION) {
            ProjectPanel.serializeTasks();
            ProjectWindow win = (ProjectWindow) WindowManager.getDefault().findTopComponent("ProjectWindow");
            if (win != null) {
                win.serializeTasks();
            }
        }
        
        return answer == JOptionPane.YES_OPTION;
        */
    }

    
+1 −1
Original line number Diff line number Diff line
@@ -15,7 +15,7 @@ import org.openide.windows.WindowManager;
 * the {@link cz.fidentis.analyst.Logger} and displays them in the output window.
 * 
 * This singleton is currently executed from 
 * the {@link cz.fidentis.analyst.project.ProjectTopComp}, which is always presented
 * the {@link cz.fidentis.analyst.gui.project.ProjectWindow}, which is always presented
 * in the FIDENTIS application.
 *
 * @author Radek Oslejsek
+219 −218

File changed.

Preview size limit exceeded, changes collapsed.

Loading