Main Page | Packages | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

SettingsDialog.java

Go to the documentation of this file.
00001 /*
00002  * SettingsDialog.java
00003  *
00004  * Copyright (C) 2005 Project SQUID, http://www.cs.helsinki.fi/group/squid/
00005  *
00006  * This file is part of Ikayaki.
00007  *
00008  * Ikayaki is free software; you can redistribute it and/or modify
00009  * it under the terms of the GNU General Public License as published by
00010  * the Free Software Foundation; either version 2 of the License, or
00011  * (at your option) any later version.
00012  *
00013  * Ikayaki is distributed in the hope that it will be useful,
00014  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00016  * GNU General Public License for more details.
00017  *
00018  * You should have received a copy of the GNU General Public License
00019  * along with Ikayaki; if not, write to the Free Software
00020  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
00021  */
00022 
00023 package ikayaki.gui;
00024 
00025 import ikayaki.Project;
00026 
00027 import javax.swing.*;
00028 import java.awt.*;
00029 
00035 public class SettingsDialog extends JDialog {
00036 
00037     private static final int DEVICE_SETTINGS = 1;
00038     private static final int PROGRAM_SETTINGS = 2;
00039     private static final int PRINT_PREVIEW = 3;
00040 
00041     private static int dialogType;
00042     private static Project project;
00043     private static boolean printDirectly;
00044 
00045     private SettingsDialog(Frame owner, String message) {
00046         super(owner, message, true);
00047         if (owner != null) {
00048             setLocationRelativeTo(owner);
00049         }
00050     }
00051 
00056     protected void dialogInit() {
00057         super.dialogInit();
00058 
00059         setResizable(false);
00060         setLayout(new BorderLayout());
00061         if (dialogType == DEVICE_SETTINGS) {
00062             add(new DeviceSettingsPanel(this), BorderLayout.CENTER);
00063             pack();
00064         } else if (dialogType == PROGRAM_SETTINGS) {
00065             add(new ProgramSettingsPanel(this), BorderLayout.CENTER);
00066             pack();
00067         } else if (dialogType == PRINT_PREVIEW) {
00068             add(new PrintPanel(this, project, printDirectly), BorderLayout.CENTER);
00069             this.setSize(500, 700);
00070             //setMaximumSize(new Dimension(800,1000));
00071             //setMinimumSize(new Dimension(800,1000));
00072             //pack();
00073         } else {
00074             throw new IllegalArgumentException("dialogType = " + dialogType);
00075         }
00076     }
00077 
00078     public static void showDeviceSettingsDialog(Frame owner, String message) {
00079         dialogType = DEVICE_SETTINGS;
00080         SettingsDialog d = new SettingsDialog(owner, message);
00081         d.setVisible(true);
00082     }
00083 
00084     public static void showProgramSettingsDialog(Frame owner, String message) {
00085         dialogType = PROGRAM_SETTINGS;
00086         SettingsDialog d = new SettingsDialog(owner, message);
00087         d.setVisible(true);
00088     }
00089 
00090     public static void showPrintPreview(Frame owner, String message, Project project, boolean printDirectly) {
00091         dialogType = PRINT_PREVIEW;
00092         SettingsDialog.project = project;
00093         SettingsDialog.printDirectly = printDirectly;
00094         SettingsDialog d = new SettingsDialog(owner, message);
00095         d.setVisible(true);
00096     }
00097 }
00098 

Generated on Fri May 6 16:00:32 2005 for Squid by  doxygen 1.4.1