Login | Register
My pages Projects Community openCollabNet

Discussions > cvs > CVS update: /openetl/src/org/tigris/openetl/ui/constants/, /openetl/src/org/tigris/openetl/ui/

openetl
Discussion topic

Back to topic list

CVS update: /openetl/src/org/tigris/openetl/ui/constants/, /openetl/src/org/tigris/openetl/ui/

Reply

Author ernani_joppert
Full name Ernani Joppert Pontes Martins
Date 2004-08-09 13:20:23 PDT
Message User: ernani_joppert
Date: 04/08/09 13:20:23

Added:
 /openetl/src/org/tig​ris/openetl/ui/
  Dialog.java

Modified:
 /openetl/src/org/tig​ris/openetl/ui/const​ants/
  Application.java
 /openetl/src/org/tig​ris/openetl/ui/
  MenuBar.java, MainFrame.java, ToolBar.java

Log:
 added confirmation to close app, some menu items, and made better event handling.

File Changes:

Directory: /openetl/src/org/tig​ris/openetl/ui/const​ants/
====================​====================​================

File [changed]: Application.java
Url: http://openetl.tigri​s.org/source/browse/​openetl/src/org/tigr​is/openetl/ui/consta​nts/Application.java​?r1=1.3&r2=1.4
Delta lines: +23 -1
--------------------
--- Application.java 5 Aug 2004 22:37:44 -0000 1.3
+++ Application.java 9 Aug 2004 20:20:23 -0000 1.4
@@ -18,8 +18,30 @@
     /**
      * The title of main mdi form.
      */
- static String MAIN_TITLE = "Application Main Title";
+ static String MAIN_TITLE = "OpenETL - An open source ETL tool";
 
+ /**
+ * The confirmation text for closing the application.
+ */
+ static String reallyQuitMessage = "Are you sure you want to quit \r\n the application?";
+
+ /**
+ * Action command attribute for new project operations.
+ */
     static String COMMAND_NEW = "new";
+
+ /**
+ * Action command attribute for open project operations.
+ */
     static String COMMAND_OPEN = "open";
+
+ /**
+ * Action command attribute for save project operations.
+ */
+ static String COMMAND_SAVE = "save";
+
+ /**
+ * Action command attribute for quit operation.
+ */
+ static String COMMAND_QUIT = "quit";
 }

Directory: /openetl/src/org/tig​ris/openetl/ui/
====================​====================​======

File [changed]: MenuBar.java
Url: http://openetl.tigri​s.org/source/browse/​openetl/src/org/tigr​is/openetl/ui/MenuBa​r.java?r1=1.3&r2​=1.4
Delta lines: +17 -9
--------------------
--- MenuBar.java 9 Aug 2004 04:56:22 -0000 1.3
+++ MenuBar.java 9 Aug 2004 20:20:23 -0000 1.4
@@ -11,6 +11,8 @@
 import javax.swing.JMenuItem;
 import javax.swing.KeyStroke;
 
+import org.tigris.openetl.u​i.constants.Applicat​ion;
+
 /**
  * This is the applications main menu bar. It defines all object items from the
  * main menu.
@@ -32,21 +34,27 @@
         menu.setMnemonic(Key​Event.VK_D);
         this.add(menu);
 
- // Set up the first menu item.
- JMenuItem menuItem = new JMenuItem("New");
+ // Set up the new project menu item.
+ JMenuItem menuItem = new JMenuItem("New Project");
         menuItem.setMnemonic​(KeyEvent.VK_N);
- menuItem.setAccelera​tor(KeyStroke.getKey​Stroke(KeyEvent.VK_N​,
- ActionEvent.ALT_MASK));
- menuItem.setActionCo​mmand("new");
+ menuItem.setAccelera​tor(KeyStroke.getKey​Stroke(KeyEvent.VK_N​, ActionEvent.ALT_MASK));
+ menuItem.setActionCo​mmand(Application.CO​MMAND_NEW);
+ menuItem.addActionLi​stener(frame);
+ menu.add(menuItem);
+
+ // Set up the open project menu item.
+ menuItem = new JMenuItem("Open Project");
+ menuItem.setMnemonic​(KeyEvent.VK_O);
+ menuItem.setAccelera​tor(KeyStroke.getKey​Stroke(KeyEvent.VK_O​, ActionEvent.CTRL_MASK));
+ menuItem.setActionCo​mmand(Application.CO​MMAND_OPEN);
         menuItem.addActionLi​stener(frame);
         menu.add(menuItem);
 
- // Set up the second menu item.
+ // Set up the quit menu item.
         menuItem = new JMenuItem("Quit");
         menuItem.setMnemonic​(KeyEvent.VK_Q);
- menuItem.setAccelera​tor(KeyStroke.getKey​Stroke(KeyEvent.VK_Q​,
- ActionEvent.ALT_MASK));
- menuItem.setActionCo​mmand("quit");
+ menuItem.setAccelera​tor(KeyStroke.getKey​Stroke(KeyEvent.VK_Q​, ActionEvent.ALT_MASK));
+ menuItem.setActionCo​mmand(Application.CO​MMAND_QUIT);
         menuItem.addActionLi​stener(frame);
         menu.add(menuItem);
     }

File [added]: Dialog.java
Url: http://openetl.tigri​s.org/source/browse/​openetl/src/org/tigr​is/openetl/ui/Dialog​.java?rev=1.1&co​ntent-type=text/vnd.​viewcvs-markup
Added lines: 89
---------------
/*
 * Created on 09/08/2004
 */
package org.tigris.openetl.ui;

import java.awt.Dimension;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyC​hangeListener;

import javax.swing.JDialog;
import javax.swing.JOptionPane;

import org.tigris.openetl.u​i.constants.Applicat​ion;

/**
 * @author Ernani Joppert Pontes Martins
 */
public class Dialog extends JDialog {

    /**
     * confirmation option pane.
     */
    private final static JOptionPane optionPane = new JOptionPane(
            Application.reallyQuitMessage, JOptionPane.QUESTION_MESSAGE,
            JOptionPane.YES_NO_OPTION);

    /**
     * confirmation dialog.
     */
    private static JDialog dialog = null;

    /**
     * Main constructor.
     *
     * @param frame
     * The frame to add the popup message.
     */
    public static void writeDialog(MainFrame frame, String windowTitle,
            Dimension screenSize) {

        // this instance.
        dialog = new JDialog(frame, windowTitle, true);

        // set its size.
        dialog.setSize(300, 150);

        // set its location to center on screen.
        dialog.setLocation(s​creenSize.width / 2 - dialog.getWidth() / 2,
                screenSize.height / 2 - dialog.getHeight() / 2);

        // default operation.
        dialog.setDefaultClo​seOperation(JDialog.​DO_NOTHING_ON_CLOSE)​;

        // window adapter.
        dialog.addWindowListener(new WindowAdapter() {

            public void windowClosing(WindowEvent we) {
                System.out.println("YOU CAN'T CLOSE THIS.");
            }
        });

        // check up dummy users.
        optionPane.addProper​tyChangeListener(new​ PropertyChangeListener() {

            public void propertyChange(Prope​rtyChangeEvent e) {
                String prop = e.getPropertyName();
                if (dialog.isVisible() && (e.getSource() == optionPane)
                        && (prop.equals(JOption​Pane.VALUE_PROPERTY)​)) {
                    // hide window.
                    dialog.setVisible(false);
                }
            }
        });

        // add option pane to the dialog.
        dialog.setContentPan​e(optionPane);
        dialog.setVisible(true);

        // get the pressed button value.
        int value = ((Integer) optionPane.getValue(​)).intValue();

        // tries to quit the application.
        if (value == JOptionPane.YES_OPTION) {
            frame.quit();
        }
    }
}

File [changed]: MainFrame.java
Url: http://openetl.tigri​s.org/source/browse/​openetl/src/org/tigr​is/openetl/ui/MainFr​ame.java?r1=1.3&​r2=1.4
Delta lines: +12 -8
--------------------
--- MainFrame.java 5 Aug 2004 22:36:47 -0000 1.3
+++ MainFrame.java 9 Aug 2004 20:20:23 -0000 1.4
@@ -45,7 +45,7 @@
                 screenSize.height - Application.borderSize * 2);
 
         // create internal frame for the MDI.
- this.createInternalFrame();
+ this.createInternalFrame("New Project Automatically opened");
 
         // add MenuBar to the main frame.
         this.setJMenuBar(new MenuBar(this));
@@ -67,20 +67,24 @@
      */
     public void actionPerformed(ActionEvent e) {
 
- if ("new".equals(e.getA​ctionCommand())) {
- // clicked on new.
- createInternalFrame();
- } else {
- quit();
+ if (Application.COMMAND​_NEW.equals(e.getAct​ionCommand())) {
+ // clicked on new project.
+ createInternalFrame("New Project from actioncommand");
+ } else if (Application.COMMAND​_OPEN.equals(e.getAc​tionCommand())) {
+ // open file chooser window.
+ createInternalFrame("This feature is not implemented yet.");
+ } else if ((Application.COMMAN​D_QUIT.equals(e.getA​ctionCommand()))) {
+ // quits the application.
+ Dialog.writeDialog(this, "Close application?", screenSize);
         }
     }
 
     /**
      * Creates a new internal frame for the the mdi form.
      */
- protected void createInternalFrame() {
+ protected void createInternalFrame(String title) {
 
- MdiChildForm childForm = new MdiChildForm("window title to set");
+ MdiChildForm childForm = new MdiChildForm(title);
         mdiForm.add(childForm);
     }
 

File [changed]: ToolBar.java
Url: http://openetl.tigri​s.org/source/browse/​openetl/src/org/tigr​is/openetl/ui/ToolBa​r.java?r1=1.3&r2​=1.4
Delta lines: +9 -2
-------------------
--- ToolBar.java 9 Aug 2004 05:59:41 -0000 1.3
+++ ToolBar.java 9 Aug 2004 20:20:23 -0000 1.4
@@ -39,17 +39,24 @@
 
         JButton button = null;
 
- // first button
+ // new project button
         button = new JButton(new ImageIcon("images/new.gif"));
         button.setActionComm​and(Application.COMM​AND_NEW);
         button.setToolTipText("Creates a new project");
         button.addActionList​ener(frame);
         toolBar.add(button);
 
- // second button
+ // open button
         button = new JButton(new ImageIcon("images/open.gif"));
         button.setActionComm​and(Application.COMM​AND_OPEN);
         button.setToolTipText("Choose a Project to Open");
+ button.addActionList​ener(frame);
+ toolBar.add(button);
+
+ // save button
+ button = new JButton(new ImageIcon("images/save.gif"));
+ button.setActionComm​and(Application.COMM​AND_SAVE);
+ button.setToolTipText("Saves the current project");
         button.addActionList​ener(frame);
         toolBar.add(button);
     }




--------------------​--------------------​--------------------​---------
To unsubscribe, e-mail: cvs-unsubscribe@open​etl.tigris.org
For additional commands, e-mail: cvs-help at openetl dot tigris dot org

« Previous message in topic | 1 of 1 | Next message in topic »

Messages

Show all messages in topic

CVS update: /openetl/src/org/tigris/openetl/ui/constants/, /openetl/src/org/tigris/openetl/ui/ ernani_joppert Ernani Joppert Pontes Martins 2004-08-09 13:20:23 PDT
Messages per page: