FFGPanel.java :  » Game » FFGenie-2010.3-src » ffg » gui » Java Open Source

Java Open Source » Game » FFGenie 2010.3 src 
FFGenie 2010.3 src » ffg » gui » FFGPanel.java
/*
 * FFGPanel.java
 *
 * Created on 19 June 2006, 10:31
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package ffg.gui;

import ffg.game.FFGPanelException;
import ffg.game.GameManager;
import java.awt.LayoutManager;
import java.io.File;
import java.util.List;
import javax.swing.Action;
import javax.swing.JPanel;

/**
 *
 * @author eugene
 */
public abstract class FFGPanel extends JPanel {
    enum SaveOptions {
        Save("Save"), SaveAs("Save As"), DontSave("Don't Save"), Cancel("Cancel");
        
        private final String name;
        SaveOptions(String name) {
            this.name = name;
        }
        @Override
        public String toString() {
            return name;
        }
    }
    enum SaveResult {
        SAVED, CLOSED, CANCELLED, ERROR;
    }
    /*package-protected*/ static final SaveOptions[] SAVE_OPTIONS = SaveOptions.values();
    
    protected final FFGFrame frame;
    
    public FFGPanel(FFGFrame frame) throws FFGPanelException {
        super();
        this.frame = frame;
    }
    
    public FFGPanel(FFGFrame frame, boolean isDoubleBuffered) throws FFGPanelException {
        super(isDoubleBuffered);
        this.frame = frame;
    }
    
    public FFGPanel(FFGFrame frame, LayoutManager layout) throws FFGPanelException {
        super(layout);
        this.frame = frame;
    }
    
    public FFGPanel(FFGFrame frame, LayoutManager layout, boolean isDoubleBuffered) throws FFGPanelException {
        super(layout, isDoubleBuffered);
        this.frame = frame;
    }
    
    public abstract String getSaveKey();
    public abstract boolean save() throws SaveException;
    public abstract boolean saveAs(File file) throws SaveException;
    public abstract boolean isSaved();
    public abstract SaveResult doCloseOperation();
    public abstract List<Action> getActions();
    public abstract GameManager getGameManager();
}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.