Author: remi
Date: 2008-08-13 12:32:18 +0200 (Wed, 13 Aug 2008)
New Revision: 1468

Modified:
   
software_suite_v2/software/tools/attitunesStudio/trunk/src/GUI/AttitunePropertiesFrame.java
   software_suite_v2/software/tools/attitunesStudio/trunk/src/MainFrame.java
   
software_suite_v2/software/tools/attitunesStudio/trunk/src/com/tuxisalive/attitunes/format/ATTFormatReadWrite.java
   
software_suite_v2/software/tools/attitunesStudio/trunk/src/com/tuxisalive/attitunes/format/ATTXmlParser.java
Log:
* update

Modified: 
software_suite_v2/software/tools/attitunesStudio/trunk/src/GUI/AttitunePropertiesFrame.java
===================================================================
--- 
software_suite_v2/software/tools/attitunesStudio/trunk/src/GUI/AttitunePropertiesFrame.java
 2008-08-12 23:02:08 UTC (rev 1467)
+++ 
software_suite_v2/software/tools/attitunesStudio/trunk/src/GUI/AttitunePropertiesFrame.java
 2008-08-13 10:32:18 UTC (rev 1468)
@@ -17,6 +17,7 @@
 import java.awt.event.MouseEvent;
 import java.awt.event.WindowAdapter;
 import java.awt.event.WindowEvent;
+import java.awt.event.WindowListener;
 import javax.swing.BorderFactory;
 import javax.swing.BoxLayout;
 import javax.swing.ComboBoxModel;
@@ -25,6 +26,8 @@
 import javax.swing.JComboBox;
 import javax.swing.JLabel;
 import javax.swing.JList;
+import javax.swing.JFrame;
+import javax.swing.JOptionPane;
 import javax.swing.JPanel;
 import javax.swing.JScrollPane;
 import javax.swing.JTextArea;
@@ -127,6 +130,7 @@
        private JTextArea jTextAreaDescription;
        private JTextField jTextFieldAuthor;
        private JTextField jTextFieldName;
+       private JButton jButtonClose;
        private JButton jButtonDelete;
        private JButton jButtonAdd;
        private JList jListKeywords;
@@ -287,9 +291,6 @@
                        BoxLayout thisLayout = new BoxLayout(getContentPane(), 
javax.swing.BoxLayout.Y_AXIS);
                        getContentPane().setLayout(thisLayout);
                        this.addWindowListener(new WindowAdapter() {
-                               public void windowOpened(WindowEvent evt) {
-                                       thisWindowOpened(evt);
-                               }
                                public void windowClosed(WindowEvent evt) {
                                        thisWindowClosed(evt);
                                }
@@ -308,7 +309,7 @@
                                {
                                        jLabelNeedChamp = new JLabel();
                                        jPanelNeededChamps.add(jLabelNeedChamp);
-                                       jLabelNeedChamp.setText("The parameters 
marked as red color are wrong.");
+                                       jLabelNeedChamp.setText("The parameters 
marked as red color are missing.");
                                        jLabelNeedChamp.setBackground(new 
java.awt.Color(255,128,128));
                                        jLabelNeedChamp.setForeground(new 
java.awt.Color(255,0,0));
                                }
@@ -436,7 +437,7 @@
                                                jPanel1.add(jButtonAdd, new 
GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, 
GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
                                                jButtonAdd.setText("Add");
                                                jButtonAdd.addMouseListener(new 
MouseAdapter() {
-                                                       public void 
mouseClicked(MouseEvent evt) {
+                                                       public void 
mousePressed(MouseEvent evt) {
                                                                
jButtonAddMouseClicked(evt);
                                                        }
                                                });
@@ -446,7 +447,7 @@
                                                jPanel1.add(jButtonDelete, new 
GridBagConstraints(2, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, 
GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
                                                jButtonDelete.setText("Delete");
                                                
jButtonDelete.addMouseListener(new MouseAdapter() {
-                                                       public void 
mouseClicked(MouseEvent evt) {
+                                                       public void 
mousePressed(MouseEvent evt) {
                                                                
jButtonDeleteMouseClicked(evt);
                                                        }
                                                });
@@ -459,39 +460,39 @@
                                jPanelValidate.setPreferredSize(new 
java.awt.Dimension(420, 25));
                                jPanelValidateLayout.rowWeights = new double[] 
{0.1};
                                jPanelValidateLayout.rowHeights = new int[] {7};
-                               jPanelValidateLayout.columnWeights = new 
double[] {0.0, 0.1, 0.1, 0.1, 0.0};
-                               jPanelValidateLayout.columnWidths = new int[] 
{7, 7, 7, 7, 7};
+                               jPanelValidateLayout.columnWeights = new 
double[] {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+                               jPanelValidateLayout.columnWidths = new int[] 
{7, 136, 132, 7, 127, 7};
                                jPanelValidate.setLayout(jPanelValidateLayout);
                                
jPanelValidate.setBorder(BorderFactory.createEtchedBorder(BevelBorder.LOWERED));
                                {
                                        jButtonValidate = new JButton();
-                                       jPanelValidate.add(jButtonValidate, new 
GridBagConstraints(3, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, 
GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
+                                       jPanelValidate.add(jButtonValidate, new 
GridBagConstraints(2, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, 
GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
                                        jButtonValidate.setText("Validate");
                                        jButtonValidate.addMouseListener(new 
MouseAdapter() {
-                                               public void 
mouseClicked(MouseEvent evt) {
+                                               public void 
mousePressed(MouseEvent evt) {
                                                        
jButtonValidateMouseClicked(evt);
                                                }
                                        });
                                }
+                               {
+                                       jButtonClose = new JButton();
+                                       jPanelValidate.add(jButtonClose, new 
GridBagConstraints(4, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, 
GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
+                                       jButtonClose.setText("Close");
+                                       jButtonClose.addMouseListener(new 
MouseAdapter() {
+                                               public void 
mousePressed(MouseEvent evt) {
+                                                       
jButtonCloseMouseClicked(evt);
+                                               }
+                                       });
+                               }
                        }
 
                        pack();
                        this.setSize(428, 425);
                }
                catch (Exception e)
-               {
-                       
+               {       
                }
        }
-       
-       /*
-        * On validate button clicked
-        */
-       private void jButtonValidateMouseClicked(MouseEvent evt)
-       {
-               setParametersToTheHeader();
-               fillParameters();
-       }
 
        /*
         * On Category choosing
@@ -544,34 +545,90 @@
        }
        
        /*
-        * Before to close the window
+        * On add keyword button clicked
         */
-       private void thisWindowClosing(WindowEvent evt)
+       private void jButtonAddMouseClicked(MouseEvent evt)
        {
-               System.out.println("this.windowClosing, event="+evt);
-               System.gc();
+               String keyword = JOptionPane.showInputDialog("Enter your 
keyword :");
+               
+               if (keyword == null)
+               {
+                       return;
+               }
+               
+               if (!keyword.equals(""))
+               {
+                       
((DefaultComboBoxModel)jListKeywords.getModel()).addElement(keyword);
+               }
        }
        
        /*
-        * On window closed
+        * On delete keyword button clicked
         */
-       private void thisWindowClosed(WindowEvent evt)
+       private void jButtonDeleteMouseClicked(MouseEvent evt)
        {
-               System.out.println("this.windowClosed, event="+evt);
+               String selected = (String)jListKeywords.getSelectedValue();
+               
+               if (selected == null)
+               {
+                       return;
+               }
+               
+               if (!selected.equals(""))
+               {
+                       
((DefaultComboBoxModel)jListKeywords.getModel()).removeElement(selected);
+               }
        }
        
-       private void thisWindowOpened(WindowEvent evt) {
-               System.out.println("this.windowOpened, event="+evt);
-               //TODO add your code for this.windowOpened
+       /*
+        * On validate button clicked
+        */
+       private void jButtonValidateMouseClicked(MouseEvent evt)
+       {
+               setParametersToTheHeader();
+               fillParameters();
+               /* Check the header */
+               List<String> badParams = blockViewer.checkHeader();
+               if (badParams.size() > 0)
+               {
+                       JOptionPane.showMessageDialog(this,
+                                       "Some parameters are missing.");
+                       return;
+               }
        }
        
-       private void jButtonAddMouseClicked(MouseEvent evt) {
-               System.out.println("jButtonAdd.mouseClicked, event="+evt);
-               //TODO add your code for jButtonAdd.mouseClicked
+       /*
+        * On close button clicked
+        */
+       private void jButtonCloseMouseClicked(MouseEvent evt)
+       {       
+               WindowEvent we = new WindowEvent(this, 
WindowEvent.WINDOW_CLOSING);
+               for (WindowListener l : this.getWindowListeners())
+               {
+                   l.windowClosing(we);
+           }
+               this.dispose();
        }
        
-       private void jButtonDeleteMouseClicked(MouseEvent evt) {
-               System.out.println("jButtonDelete.mouseClicked, event="+evt);
-               //TODO add your code for jButtonDelete.mouseClicked
+       /*
+        * Before to close the window
+        */
+       private void thisWindowClosing(WindowEvent evt)
+       {
+               System.out.println(evt);
+               /* Check the header */
+               List<String> badParams = blockViewer.checkHeader();
+               if (badParams.size() > 0)
+               {
+                       JOptionPane.showMessageDialog(this,
+                                       "Some parameters are missing.");
+               }
        }
+       
+       /*
+        * On window closed
+        */
+       private void thisWindowClosed(WindowEvent evt)
+       {
+       }
 }

Modified: 
software_suite_v2/software/tools/attitunesStudio/trunk/src/MainFrame.java
===================================================================
--- software_suite_v2/software/tools/attitunesStudio/trunk/src/MainFrame.java   
2008-08-12 23:02:08 UTC (rev 1467)
+++ software_suite_v2/software/tools/attitunesStudio/trunk/src/MainFrame.java   
2008-08-13 10:32:18 UTC (rev 1468)
@@ -276,6 +276,15 @@
                onMenuItemQuit(null);
        }
        
+       /*
+        * Event On properties window closed
+        */
+       public void propertiesWindowClosed(WindowEvent evt)
+       {
+               System.out.println("The properties windows is closed !!");
+               this.setTitle("Attitunes studio - " + 
attBlockViewer.attituneFile.getHeaderName());
+       }
+       
        /* 
------------------------------------------------------------------------
         * Menu events
         * 
--------------------------------------------------------------------- */
@@ -340,6 +349,7 @@
                        if (attBlockViewer.loadAttitune(selFile.getPath()))
                        {
                                attBlockViewer.setAttituneIsTemplate(false);
+                               JOptionPane.showMessageDialog(this, "The 
attitune has been loaded");
                        }
                }
        }
@@ -353,7 +363,8 @@
                List<String> badParams = attBlockViewer.checkHeader();
                if (badParams.size() > 0)
                {
-                       onMenuItemProperties(menuItem);
+                       JOptionPane.showMessageDialog(this,
+                                       "You must to set some parameters in 
your attitune before to save it.\n Goto the menu <File|Properties>");
                        return;
                }
                /* Check if the current scene is the template */
@@ -377,7 +388,8 @@
                List<String> badParams = attBlockViewer.checkHeader();
                if (badParams.size() > 0)
                {
-                       onMenuItemProperties(menuItem);
+                       JOptionPane.showMessageDialog(this,
+                               "You must to set some parameters in your 
attitune before to save it.\n Goto the menu <File|Properties>");
                        return;
                }
                /* Open a file viewer to select an attitune */
@@ -408,6 +420,12 @@
        public void onMenuItemProperties(MenuItem menuItem)
        {
                AttitunePropertiesFrame pFrame = new 
AttitunePropertiesFrame(attBlockViewer);
+               /* Close window */
+               pFrame.addWindowListener(new WindowAdapter() {
+                       public void windowClosing(WindowEvent evt) {
+                               propertiesWindowClosed(evt);
+                       }
+               });
                pFrame.setLocationRelativeTo(null);
                pFrame.setVisible(true);
        }
@@ -577,6 +595,7 @@
                statusBar.setLabel1("Position : " + 
ATTMisc.timeToString(attBlockViewer.getCurrentPosition()));
                statusBar.setLabel2("Duration : " + 
ATTMisc.timeToString(attBlockViewer.getLength()));
                statusBar.setLabel3("Block start : 00:00:00");
+               this.setTitle("Attitunes studio - " + 
attBlockViewer.attituneFile.getHeaderName());
        }
        
        /*
@@ -584,6 +603,7 @@
         */
        public void onAttituneSaved(ATTBlockViewer bv)
        {
+               JOptionPane.showMessageDialog(this, "Your attitune has been 
saved");
        }
        
        /* 
------------------------------------------------------------------------

Modified: 
software_suite_v2/software/tools/attitunesStudio/trunk/src/com/tuxisalive/attitunes/format/ATTFormatReadWrite.java
===================================================================
--- 
software_suite_v2/software/tools/attitunesStudio/trunk/src/com/tuxisalive/attitunes/format/ATTFormatReadWrite.java
  2008-08-12 23:02:08 UTC (rev 1467)
+++ 
software_suite_v2/software/tools/attitunesStudio/trunk/src/com/tuxisalive/attitunes/format/ATTFormatReadWrite.java
  2008-08-13 10:32:18 UTC (rev 1468)
@@ -139,6 +139,10 @@
                Hashtable<String,Object> nodeScript = new 
Hashtable<String,Object>();
                Hashtable<String,Object> nodeBody = new 
Hashtable<String,Object>();
                
+               if (blocksStruct.size() == 0)
+               {
+                       blocksStruct.put("truc", "Empty");
+               }
                nodeScript.put("timeline", blocksStruct);
                nodeBody.put("script", nodeScript);
                newXmlStruct.put("body", nodeBody);

Modified: 
software_suite_v2/software/tools/attitunesStudio/trunk/src/com/tuxisalive/attitunes/format/ATTXmlParser.java
===================================================================
--- 
software_suite_v2/software/tools/attitunesStudio/trunk/src/com/tuxisalive/attitunes/format/ATTXmlParser.java
        2008-08-12 23:02:08 UTC (rev 1467)
+++ 
software_suite_v2/software/tools/attitunesStudio/trunk/src/com/tuxisalive/attitunes/format/ATTXmlParser.java
        2008-08-13 10:32:18 UTC (rev 1468)
@@ -90,6 +90,12 @@
        {
                String key;
                Node newNode;
+               
+               if (nodeStruct.size() < 1)
+               {
+                       return;
+               }
+               
                Iterator<String> it = (Iterator<String>)nodeStruct.keys();
                
                while (it.hasNext())


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Tux-droid-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tux-droid-svn

Reply via email to