Author: remi
Date: 2008-08-13 01:02:08 +0200 (Wed, 13 Aug 2008)
New Revision: 1467
Added:
software_suite_v2/software/tools/attitunesStudio/trunk/src/GUI/AttitunePropertiesFrame.java
Modified:
software_suite_v2/software/tools/attitunesStudio/trunk/src/MainFrame.java
software_suite_v2/software/tools/attitunesStudio/trunk/src/com/tuxisalive/attitunes/format/ATTBlockParams.java
software_suite_v2/software/tools/attitunesStudio/trunk/src/com/tuxisalive/attitunes/visual/ATTBlockViewer.java
Log:
* update
Added:
software_suite_v2/software/tools/attitunesStudio/trunk/src/GUI/AttitunePropertiesFrame.java
===================================================================
---
software_suite_v2/software/tools/attitunesStudio/trunk/src/GUI/AttitunePropertiesFrame.java
(rev 0)
+++
software_suite_v2/software/tools/attitunesStudio/trunk/src/GUI/AttitunePropertiesFrame.java
2008-08-12 23:02:08 UTC (rev 1467)
@@ -0,0 +1,577 @@
+package GUI;
+
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Arrays;
+
+import java.awt.Frame;
+import java.awt.Color;
+import java.awt.BorderLayout;
+import java.awt.FlowLayout;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.Insets;
+import java.awt.event.ItemEvent;
+import java.awt.event.ItemListener;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+import javax.swing.BorderFactory;
+import javax.swing.BoxLayout;
+import javax.swing.ComboBoxModel;
+import javax.swing.DefaultComboBoxModel;
+import javax.swing.JButton;
+import javax.swing.JComboBox;
+import javax.swing.JLabel;
+import javax.swing.JList;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JTextArea;
+import javax.swing.JTextField;
+import javax.swing.ListModel;
+import javax.swing.border.BevelBorder;
+
+import com.tuxisalive.attitunes.*;
+import com.tuxisalive.attitunes.format.*;
+import com.tuxisalive.attitunes.block.ATTBlock;
+import com.tuxisalive.attitunes.block.ATTBlockContainer;
+import com.tuxisalive.attitunes.visual.ATTBlockViewer;
+
+/**
+* This code was edited or generated using CloudGarden's Jigloo
+* SWT/Swing GUI Builder, which is free for non-commercial
+* use. If Jigloo is being used commercially (ie, by a corporation,
+* company or business for any purpose whatever) then you
+* should purchase a license for each developer using Jigloo.
+* Please visit www.cloudgarden.com for details.
+* Use of Jigloo implies acceptance of these licensing terms.
+* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
+* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
+* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
+*/
+public class AttitunePropertiesFrame extends javax.swing.JFrame
+{
+ private static String[] ATT_CATEGORIES = {
+ "Others",
+ "Alert",
+ "Fun",
+ "Education",
+ "Music",
+ "Messages",
+ "Kids",
+ "System"
+ };
+
+ private static String[] ATT_CATEGORY_OTHERS = {
+ "Others"
+ };
+
+ private static String[] ATT_CATEGORY_ALERT = {
+ "General",
+ "RSS",
+ "Mail"
+ };
+
+ private static String[] ATT_CATEGORY_FUN = {
+ "General",
+ "Jokes",
+ "Sketches"
+ };
+
+ private static String[] ATT_CATEGORY_EDUCATION = {
+ "General",
+ "Language",
+ "Computer",
+ "Sport"
+ };
+
+ private static String[] ATT_CATEGORY_MUSIC = {
+ "General",
+ "Dance",
+ "Top 50",
+ "Bulletin / Chronicle"
+ };
+
+ private static String[] ATT_CATEGORY_MESSAGES = {
+ "Birthday",
+ "St Valentine day",
+ "Congrats",
+ "Christmas"
+ };
+
+ private static String[] ATT_CATEGORY_KIDS = {
+ "Stories",
+ "Games",
+ "Lullaby",
+ "Divers"
+ };
+
+ private static String[] ATT_CATEGORY_SYSTEM = {
+ "General",
+ "Battery",
+ "Lifeguard"
+ };
+
+ private static final long serialVersionUID = 1L;
+ private JPanel jPanelNeededChamps;
+ private JPanel jPanelChamps;
+ private JPanel jPanelValidate;
+ private JLabel jLabelNeedChamp;
+ private JButton jButtonValidate;
+ private JPanel jPanel1;
+ private JPanel jPanelKeywords;
+ private JComboBox jComboBoxSubCategory;
+ private JComboBox jComboBoxCategory;
+ private JTextField jTextFieldVersion;
+ private JTextArea jTextAreaDescription;
+ private JTextField jTextFieldAuthor;
+ private JTextField jTextFieldName;
+ private JButton jButtonDelete;
+ private JButton jButtonAdd;
+ private JList jListKeywords;
+ private JScrollPane jScrollPane1;
+ private JLabel jLabelPKeywords;
+ private JLabel jLabelPSubCategory;
+ private JLabel jLabelPCategory;
+ private JLabel jLabelPVersion;
+ private JLabel jLabelPDescription;
+ private JLabel jLabelPAuthor;
+ private JLabel jLabelPName;
+
+ private ATTBlockViewer blockViewer;
+
+ {
+ //Set Look & Feel
+ try {
+
javax.swing.UIManager.setLookAndFeel("com.jgoodies.looks.plastic.Plastic3DLookAndFeel");
+ } catch(Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ /*
+ *
+ */
+ public AttitunePropertiesFrame(ATTBlockViewer blockViewer)
+ {
+ super();
+ this.blockViewer = blockViewer;
+ /* Init the frame */
+ initGUI();
+ /* Fill the parameters */
+ fillParameters();
+ }
+
+ /*
+ *
+ */
+ private void fillParameters()
+ {
+ /* Get the bad parameters */
+ List<String> badParams = blockViewer.checkHeader();
+
+ /* Name */
+
jTextFieldName.setText(blockViewer.attituneFile.getHeaderName());
+ if (badParams.contains("name"))
+ {
+ jLabelPName.setForeground(Color.RED);
+ }
+ else
+ {
+ jLabelPName.setForeground(Color.BLACK);
+ }
+ /* Author */
+
jTextFieldAuthor.setText(blockViewer.attituneFile.getHeaderAuthor());
+
+ /* Description */
+
jTextAreaDescription.setText(blockViewer.attituneFile.getHeaderDescription());
+ if (badParams.contains("description"))
+ {
+ jLabelPDescription.setForeground(Color.RED);
+ }
+ else
+ {
+ jLabelPDescription.setForeground(Color.BLACK);
+ }
+
+ /* Version */
+
jTextFieldVersion.setText(blockViewer.attituneFile.getHeaderVersion());
+
+ /* Category */
+ List<String> cat = new ArrayList<String>();
+ cat.addAll(Arrays.asList(ATT_CATEGORIES));
+ if (cat.contains(blockViewer.attituneFile.getHeaderCategory()))
+ {
+
jComboBoxCategory.setSelectedItem(blockViewer.attituneFile.getHeaderCategory());
+ }
+ else
+ {
+ jComboBoxCategory.setSelectedItem("Others");
+ }
+
+ /* Sub category */
+ List<String> scat = new ArrayList<String>();
+
scat.addAll(Arrays.asList(getSubCategoryList(blockViewer.attituneFile.getHeaderCategory())));
+ if
(scat.contains(blockViewer.attituneFile.getHeaderSubCategory()))
+ {
+
jComboBoxSubCategory.setSelectedItem(blockViewer.attituneFile.getHeaderSubCategory());
+ }
+
+ /* Keywords */
+ String[] keywords =
blockViewer.attituneFile.getHeaderKeywords().split(", ");
+ ListModel jListKeywordsModel = new
DefaultComboBoxModel(keywords);
+ jListKeywords.setModel(jListKeywordsModel);
+ }
+
+ /*
+ *
+ */
+ private void setParametersToTheHeader()
+ {
+ /* Set the name */
+
blockViewer.attituneFile.setHeaderName(jTextFieldName.getText());
+ /* Set the author */
+
blockViewer.attituneFile.setHeaderAuthor(jTextFieldAuthor.getText());
+ /* Set the description */
+ String description = jTextAreaDescription.getText();
+ description = description.replace("<", "");
+ description = description.replace(">", "");
+ description = description.replace("//", "");
+ blockViewer.attituneFile.setHeaderDescription(description);
+ /* Set the version */
+
blockViewer.attituneFile.setHeaderVersion(jTextFieldVersion.getText());
+ /* Set the category */
+
blockViewer.attituneFile.setHeaderCategory((String)jComboBoxCategory.getSelectedItem());
+ /* Set the sub category */
+
blockViewer.attituneFile.setHeaderSubCategory((String)jComboBoxSubCategory.getSelectedItem());
+ /* Set the keywords */
+ String keywords = "";
+ for (int i = 0; i < jListKeywords.getModel().getSize(); i++)
+ {
+ keywords +=
(String)jListKeywords.getModel().getElementAt(i);
+
+ if (i < jListKeywords.getModel().getSize() - 1)
+ {
+ keywords += ", ";
+ }
+ }
+ blockViewer.attituneFile.setHeaderKeywords(keywords);
+ /* Set the scene have changed */
+ blockViewer.setSceneHaveChanged(true);
+ }
+
+ /*
+ *
+ */
+ private String[] getSubCategoryList(String category)
+ {
+ if (category.equals("Others")) return ATT_CATEGORY_OTHERS;
+ else if (category.equals("Alert")) return ATT_CATEGORY_ALERT;
+ else if (category.equals("Fun")) return ATT_CATEGORY_FUN;
+ else if (category.equals("Education")) return
ATT_CATEGORY_EDUCATION;
+ else if (category.equals("Music")) return ATT_CATEGORY_MUSIC;
+ else if (category.equals("Messages")) return
ATT_CATEGORY_MESSAGES;
+ else if (category.equals("Kids")) return ATT_CATEGORY_KIDS;
+ else if (category.equals("System")) return ATT_CATEGORY_SYSTEM;
+ else return ATT_CATEGORY_OTHERS;
+ }
+
+ /*
+ *
+ */
+ private void initGUI()
+ {
+ try
+ {
+ 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);
+ }
+ public void windowClosing(WindowEvent evt) {
+ thisWindowClosing(evt);
+ }
+ });
+ {
+ jPanelNeededChamps = new JPanel();
+ getContentPane().add(jPanelNeededChamps);
+ jPanelNeededChamps.setSize(420, 20);
+ jPanelNeededChamps.setPreferredSize(new
java.awt.Dimension(420, 29));
+ jPanelNeededChamps.setMaximumSize(new
java.awt.Dimension(32767, 20));
+ jPanelNeededChamps.setMinimumSize(new
java.awt.Dimension(10, 20));
+
jPanelNeededChamps.setBorder(BorderFactory.createEtchedBorder(BevelBorder.LOWERED));
+ {
+ jLabelNeedChamp = new JLabel();
+ jPanelNeededChamps.add(jLabelNeedChamp);
+ jLabelNeedChamp.setText("The parameters
marked as red color are wrong.");
+ jLabelNeedChamp.setBackground(new
java.awt.Color(255,128,128));
+ jLabelNeedChamp.setForeground(new
java.awt.Color(255,0,0));
+ }
+ {
+
+ }
+
+ jPanelChamps = new JPanel();
+ GridBagLayout jPanelChampsLayout = new
GridBagLayout();
+ getContentPane().add(jPanelChamps);
+ jPanelChampsLayout.rowWeights = new double[]
{0.1, 0.1, 0.0, 0.1, 0.1, 0.1, 0.0, 0.1};
+ jPanelChampsLayout.rowHeights = new int[] {20,
20, 60, 20, 20, 20, 92, 20};
+ jPanelChampsLayout.columnWeights = new double[]
{0.0, 0.0, 0.1, 0.0};
+ jPanelChampsLayout.columnWidths = new int[] {7,
136, 7, 7};
+ jPanelChamps.setLayout(jPanelChampsLayout);
+ jPanelChamps.setPreferredSize(new
java.awt.Dimension(420, 321));
+
jPanelChamps.setBorder(BorderFactory.createEtchedBorder(BevelBorder.LOWERED));
+ {
+ jLabelPName = new JLabel();
+ BorderLayout jLabelPNameLayout = new
BorderLayout();
+
jLabelPName.setLayout(jLabelPNameLayout);
+ jPanelChamps.add(jLabelPName, new
GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST,
GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
+ jLabelPName.setText("Name :");
+ }
+ {
+ jLabelPAuthor = new JLabel();
+ jPanelChamps.add(jLabelPAuthor, new
GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.WEST,
GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
+ jLabelPAuthor.setText("Author :");
+ }
+ {
+ jLabelPDescription = new JLabel();
+ jPanelChamps.add(jLabelPDescription,
new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0, GridBagConstraints.WEST,
GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
+ jLabelPDescription.setText("Description
:");
+ }
+ {
+ jLabelPVersion = new JLabel();
+ jPanelChamps.add(jLabelPVersion, new
GridBagConstraints(1, 3, 1, 1, 0.0, 0.0, GridBagConstraints.WEST,
GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
+ jLabelPVersion.setText("Version :");
+ }
+ {
+ jLabelPCategory = new JLabel();
+ jPanelChamps.add(jLabelPCategory, new
GridBagConstraints(1, 4, 1, 1, 0.0, 0.0, GridBagConstraints.WEST,
GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
+ jLabelPCategory.setText("Category :");
+ }
+ {
+ jLabelPSubCategory = new JLabel();
+ jPanelChamps.add(jLabelPSubCategory,
new GridBagConstraints(1, 5, 1, 1, 0.0, 0.0, GridBagConstraints.WEST,
GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
+ jLabelPSubCategory.setText("Sub
category :");
+ }
+ {
+ jLabelPKeywords = new JLabel();
+ jPanelChamps.add(jLabelPKeywords, new
GridBagConstraints(1, 6, 1, 1, 0.0, 0.0, GridBagConstraints.WEST,
GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
+ jLabelPKeywords.setText("Keywords :");
+ }
+ {
+ jTextFieldName = new JTextField();
+ jPanelChamps.add(jTextFieldName, new
GridBagConstraints(2, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
+ jTextFieldName.setAlignmentX(0.7f);
+ }
+ {
+ jTextFieldAuthor = new JTextField();
+ jPanelChamps.add(jTextFieldAuthor, new
GridBagConstraints(2, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
+ }
+ {
+ jTextAreaDescription = new JTextArea();
+ jPanelChamps.add(jTextAreaDescription,
new GridBagConstraints(2, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
+
jTextAreaDescription.setBorder(BorderFactory.createTitledBorder(""));
+ }
+ {
+ jTextFieldVersion = new JTextField();
+ jPanelChamps.add(jTextFieldVersion, new
GridBagConstraints(2, 3, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
+ }
+ {
+ ComboBoxModel jComboBoxCategoryModel =
+ new
DefaultComboBoxModel(ATT_CATEGORIES);
+ jComboBoxCategory = new JComboBox();
+ jPanelChamps.add(jComboBoxCategory, new
GridBagConstraints(2, 4, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
+
jComboBoxCategory.setModel(jComboBoxCategoryModel);
+ jComboBoxCategory.setSelectedIndex(0);
+ jComboBoxCategory.addItemListener(new
ItemListener() {
+ public void
itemStateChanged(ItemEvent evt) {
+
jComboBoxCategoryItemStateChanged(evt);
+ }
+ });
+ }
+ {
+ ComboBoxModel jComboBoxSuCategoryModel
=
+ new
DefaultComboBoxModel(ATT_CATEGORY_OTHERS);
+ jComboBoxSubCategory = new JComboBox();
+ jPanelChamps.add(jComboBoxSubCategory,
new GridBagConstraints(2, 5, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
+
jComboBoxSubCategory.setModel(jComboBoxSuCategoryModel);
+ }
+ {
+ jPanelKeywords = new JPanel();
+ BoxLayout jPanel1Layout = new
BoxLayout(jPanelKeywords, javax.swing.BoxLayout.Y_AXIS);
+ jPanelKeywords.setLayout(jPanel1Layout);
+ jPanelChamps.add(jPanelKeywords, new
GridBagConstraints(2, 6, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
+ {
+ jScrollPane1 = new
JScrollPane();
+
jPanelKeywords.add(jScrollPane1);
+
jScrollPane1.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
+
jScrollPane1.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
+
jScrollPane1.setPreferredSize(new java.awt.Dimension(266, 92));
+ {
+ ListModel
jListKeywordsModel =
+ new
DefaultComboBoxModel(
+
new String[] {});
+ jListKeywords = new
JList();
+
jScrollPane1.setViewportView(jListKeywords);
+
jListKeywords.setModel(jListKeywordsModel);
+ }
+ }
+ }
+ {
+ jPanel1 = new JPanel();
+ GridBagLayout jPanel1Layout = new
GridBagLayout();
+ jPanelChamps.add(jPanel1, new
GridBagConstraints(2, 7, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
+ jPanel1Layout.rowWeights = new double[]
{0.0, 0.1};
+ jPanel1Layout.rowHeights = new int[]
{0, 20};
+ jPanel1Layout.columnWeights = new
double[] {0.0, 0.0, 0.1};
+ jPanel1Layout.columnWidths = new int[]
{133, 7, 7};
+ jPanel1.setLayout(jPanel1Layout);
+ {
+ jButtonAdd = new JButton();
+ 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) {
+
jButtonAddMouseClicked(evt);
+ }
+ });
+ }
+ {
+ jButtonDelete = new JButton();
+ 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) {
+
jButtonDeleteMouseClicked(evt);
+ }
+ });
+ }
+ }
+
+ jPanelValidate = new JPanel();
+ GridBagLayout jPanelValidateLayout = new
GridBagLayout();
+ getContentPane().add(jPanelValidate);
+ 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};
+ 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));
+ jButtonValidate.setText("Validate");
+ jButtonValidate.addMouseListener(new
MouseAdapter() {
+ public void
mouseClicked(MouseEvent evt) {
+
jButtonValidateMouseClicked(evt);
+ }
+ });
+ }
+ }
+
+ pack();
+ this.setSize(428, 425);
+ }
+ catch (Exception e)
+ {
+
+ }
+ }
+
+ /*
+ * On validate button clicked
+ */
+ private void jButtonValidateMouseClicked(MouseEvent evt)
+ {
+ setParametersToTheHeader();
+ fillParameters();
+ }
+
+ /*
+ * On Category choosing
+ */
+ @SuppressWarnings("static-access")
+ private void jComboBoxCategoryItemStateChanged(ItemEvent evt)
+ {
+ ComboBoxModel jComboBoxCategoryModel;
+
+ if (evt.getStateChange() == evt.SELECTED)
+ {
+ if (evt.getItem().equals("Others"))
+ {
+ jComboBoxCategoryModel = new
DefaultComboBoxModel(ATT_CATEGORY_OTHERS);
+ }
+ else if (evt.getItem().equals("Alert"))
+ {
+ jComboBoxCategoryModel = new
DefaultComboBoxModel(ATT_CATEGORY_ALERT);
+ }
+ else if (evt.getItem().equals("Fun"))
+ {
+ jComboBoxCategoryModel = new
DefaultComboBoxModel(ATT_CATEGORY_FUN);
+ }
+ else if (evt.getItem().equals("Education"))
+ {
+ jComboBoxCategoryModel = new
DefaultComboBoxModel(ATT_CATEGORY_EDUCATION);
+ }
+ else if (evt.getItem().equals("Music"))
+ {
+ jComboBoxCategoryModel = new
DefaultComboBoxModel(ATT_CATEGORY_MUSIC);
+ }
+ else if (evt.getItem().equals("Messages"))
+ {
+ jComboBoxCategoryModel = new
DefaultComboBoxModel(ATT_CATEGORY_MESSAGES);
+ }
+ else if (evt.getItem().equals("Kids"))
+ {
+ jComboBoxCategoryModel = new
DefaultComboBoxModel(ATT_CATEGORY_KIDS);
+ }
+ else if (evt.getItem().equals("System"))
+ {
+ jComboBoxCategoryModel = new
DefaultComboBoxModel(ATT_CATEGORY_SYSTEM);
+ }
+ else
+ {
+ jComboBoxCategoryModel = new
DefaultComboBoxModel(ATT_CATEGORY_OTHERS);
+ }
+ jComboBoxSubCategory.setModel(jComboBoxCategoryModel);
+ }
+ }
+
+ /*
+ * Before to close the window
+ */
+ private void thisWindowClosing(WindowEvent evt)
+ {
+ System.out.println("this.windowClosing, event="+evt);
+ System.gc();
+ }
+
+ /*
+ * On window closed
+ */
+ private void thisWindowClosed(WindowEvent evt)
+ {
+ System.out.println("this.windowClosed, event="+evt);
+ }
+
+ private void thisWindowOpened(WindowEvent evt) {
+ System.out.println("this.windowOpened, event="+evt);
+ //TODO add your code for this.windowOpened
+ }
+
+ private void jButtonAddMouseClicked(MouseEvent evt) {
+ System.out.println("jButtonAdd.mouseClicked, event="+evt);
+ //TODO add your code for jButtonAdd.mouseClicked
+ }
+
+ private void jButtonDeleteMouseClicked(MouseEvent evt) {
+ System.out.println("jButtonDelete.mouseClicked, event="+evt);
+ //TODO add your code for jButtonDelete.mouseClicked
+ }
+}
Modified:
software_suite_v2/software/tools/attitunesStudio/trunk/src/MainFrame.java
===================================================================
--- software_suite_v2/software/tools/attitunesStudio/trunk/src/MainFrame.java
2008-08-12 18:14:00 UTC (rev 1466)
+++ software_suite_v2/software/tools/attitunesStudio/trunk/src/MainFrame.java
2008-08-12 23:02:08 UTC (rev 1467)
@@ -9,6 +9,7 @@
import java.awt.event.WindowEvent;
import java.awt.*;
import java.util.Hashtable;
+import java.util.List;
import javax.swing.*;
import com.tuxisalive.attitunes.*;
@@ -348,6 +349,13 @@
*/
public void onMenuItemSave(MenuItem menuItem)
{
+ /* Check the header */
+ List<String> badParams = attBlockViewer.checkHeader();
+ if (badParams.size() > 0)
+ {
+ onMenuItemProperties(menuItem);
+ return;
+ }
/* Check if the current scene is the template */
if (attBlockViewer.getAttituneIsTemplate())
{
@@ -365,6 +373,13 @@
*/
public void onMenuItemSaveAs(MenuItem menuItem)
{
+ /* Check the header */
+ List<String> badParams = attBlockViewer.checkHeader();
+ if (badParams.size() > 0)
+ {
+ onMenuItemProperties(menuItem);
+ return;
+ }
/* Open a file viewer to select an attitune */
if (fileChooser.showSaveDialog(this) == 1)
{
@@ -392,7 +407,9 @@
*/
public void onMenuItemProperties(MenuItem menuItem)
{
- System.out.println("Properties");
+ AttitunePropertiesFrame pFrame = new
AttitunePropertiesFrame(attBlockViewer);
+ pFrame.setLocationRelativeTo(null);
+ pFrame.setVisible(true);
}
/*
Modified:
software_suite_v2/software/tools/attitunesStudio/trunk/src/com/tuxisalive/attitunes/format/ATTBlockParams.java
===================================================================
---
software_suite_v2/software/tools/attitunesStudio/trunk/src/com/tuxisalive/attitunes/format/ATTBlockParams.java
2008-08-12 18:14:00 UTC (rev 1466)
+++
software_suite_v2/software/tools/attitunesStudio/trunk/src/com/tuxisalive/attitunes/format/ATTBlockParams.java
2008-08-12 23:02:08 UTC (rev 1467)
@@ -21,16 +21,17 @@
public static Hashtable<String,Object> LEDS_BLINK_CANVAS = new
Hashtable<String,Object>();
static {
LEDS_BLINK_CANVAS.put("cmd", "leds_blink");
- LEDS_BLINK_CANVAS.put("count", 1);
- LEDS_BLINK_CANVAS.put("speed", 1);
+ LEDS_BLINK_CANVAS.put("count", 1.0);
+ LEDS_BLINK_CANVAS.put("speed", 1.0);
LEDS_BLINK_CANVAS.put("duration", 0.0);
}
private static String[] ledsBlinkTmc(Hashtable<String,Object> struct)
{
String[] result = new String[1];
- double duration = (Double)((Integer)struct.get("speed") *
0.008);
- String cmd = String.format("TUX_CMD:LED:BLINK:LED_BOTH,%d,%g",
- (Integer)struct.get("count"), duration);
+ Double speed = (Double)struct.get("speed");
+ Double duration = (Double)(speed * 0.008);
+ String cmd = String.format("TUX_CMD:LED:BLINK:LED_BOTH,%g,%g",
+ (Double)struct.get("count"), duration);
result[0] = cmd;
return result;
}
Modified:
software_suite_v2/software/tools/attitunesStudio/trunk/src/com/tuxisalive/attitunes/visual/ATTBlockViewer.java
===================================================================
---
software_suite_v2/software/tools/attitunesStudio/trunk/src/com/tuxisalive/attitunes/visual/ATTBlockViewer.java
2008-08-12 18:14:00 UTC (rev 1466)
+++
software_suite_v2/software/tools/attitunesStudio/trunk/src/com/tuxisalive/attitunes/visual/ATTBlockViewer.java
2008-08-12 23:02:08 UTC (rev 1467)
@@ -252,6 +252,15 @@
/**
*
+ * @param value
+ */
+ public void setSceneHaveChanged(Boolean value)
+ {
+ sceneHaveChanged = value;
+ }
+
+ /**
+ *
* @return
*/
public boolean getAttituneIsTemplate()
@@ -1604,7 +1613,7 @@
kw = kw.replace("]", "");
kw = kw.replace("'", "");
attituneFile.setHeaderKeywords(kw);
- if (attituneFile.getHeaderKeywords().equals(""))
+ if (attituneFile.getHeaderKeywords().replace(" ",
"").equals("") || attituneFile.getHeaderKeywords().replace(" ", "").equals(","))
{
attituneFile.setHeaderKeywords(attituneFile.getHeaderCategory() + ", " +
attituneFile.getHeaderSubCategory());
-------------------------------------------------------------------------
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