Author: jerome
Date: 2008-08-17 11:47:03 +0200 (Sun, 17 Aug 2008)
New Revision: 1532
Modified:
software_suite_v2/software/tools/chatterTux/trunk/Chatter_tux/src/ChatterTuxServer.java
software_suite_v2/software/tools/chatterTux/trunk/Chatter_tux/src/ConfInterface.java
software_suite_v2/software/tools/chatterTux/trunk/Chatter_tux/src/Properties.java
Log:
* Update components functions when deleting / modifying / add entries to
ChatterTux ini configuration file.
Modified:
software_suite_v2/software/tools/chatterTux/trunk/Chatter_tux/src/ChatterTuxServer.java
===================================================================
---
software_suite_v2/software/tools/chatterTux/trunk/Chatter_tux/src/ChatterTuxServer.java
2008-08-17 09:11:26 UTC (rev 1531)
+++
software_suite_v2/software/tools/chatterTux/trunk/Chatter_tux/src/ChatterTuxServer.java
2008-08-17 09:47:03 UTC (rev 1532)
@@ -29,6 +29,7 @@
public static void start(){
try {
+ ChatterTuxServer.stop();
Runtime.getRuntime().exec(ChatterTuxServer.start);
} catch (IOException e) {
e.printStackTrace();
@@ -44,8 +45,8 @@
}
public static void reset(){
+ ChatterTuxServer.stop();
ChatterTuxServer.start();
- ChatterTuxServer.start();
}
}
\ No newline at end of file
Modified:
software_suite_v2/software/tools/chatterTux/trunk/Chatter_tux/src/ConfInterface.java
===================================================================
---
software_suite_v2/software/tools/chatterTux/trunk/Chatter_tux/src/ConfInterface.java
2008-08-17 09:11:26 UTC (rev 1531)
+++
software_suite_v2/software/tools/chatterTux/trunk/Chatter_tux/src/ConfInterface.java
2008-08-17 09:47:03 UTC (rev 1532)
@@ -191,6 +191,29 @@
}
+ /*
+ * Sets the stored locutor into locutor combobox.
+ */
+ public void setStoredLocutor(){
+ Hashtable<String, String> storedLocutor =
this.properties.getProperties("VOICE CONFIGURATION");
+ String locutor = storedLocutor.get("locutor");
+
+ //Displaying registered locutor configuration.
+ if(this.locutorSet.getItemCount() <= 0){
+ this.locutorSet.addItem(locutor);
+ }
+ else{
+ for(int i=0 ; i< this.locutorSet.getItemCount(); i++){
+
if(this.locutorSet.getModel().getElementAt(i).equals(locutor)){
+ this.locutorSet.setSelectedIndex(i);
+ }
+ else this.locutorSet.addItem(locutor);
+ }
+ }
+ this.locutorSet.setSelectedItem(locutor);
+ }
+
+
//Gets voice configuration panel.
public JPanel getVoiceConfigurationPanel(){
if(this.voiceConfigPanel == null){
@@ -220,23 +243,9 @@
}
this.pitchSet.setModel(new SpinnerListModel(values));
+ this.setStoredLocutor(); //Sets the registered locutor
as first.
Hashtable<String, String> storedLocutor =
this.properties.getProperties("VOICE CONFIGURATION");
- String locutor = storedLocutor.get("locutor");
String pitch = storedLocutor.get("pitch");
-
- //Displaying registered locutor configuration.
- if(this.locutorSet.getItemCount() <= 0){
- this.locutorSet.addItem(locutor);
- }
- else{
- for(int i=0 ; i<
this.locutorSet.getItemCount(); i++){
-
if(this.locutorSet.getModel().getElementAt(i).equals(locutor)){
-
this.locutorSet.setSelectedIndex(i);
- }
- else this.locutorSet.addItem(locutor);
- }
- }
-
//Displaying registered pitch configuration.
this.pitchSet.setValue(Integer.valueOf(pitch));
this.pitchSet.setFocusable(false);
@@ -293,8 +302,10 @@
public void actionPerformed(ActionEvent arg0) {
if(arg0.getActionCommand().equalsIgnoreCase("comboboxchanged")){
- String key =
parametrized.getModel().getSelectedItem().toString();
- setAreaValues(key);
+ try{
+ String key =
parametrized.getModel().getSelectedItem().toString();
+ setAreaValues(key);
+ }catch(NullPointerException
nothing){}
}
}
@@ -429,6 +440,19 @@
this.actionType.setFocusable(false);
this.actionType.setLocation(this.locutorSet.getLocation());
this.editPanel.add(this.actionType);
+ this.actionType.addActionListener(new ActionListener(){
+
+ public void actionPerformed(ActionEvent arg0) {
+
if(arg0.getActionCommand().equalsIgnoreCase("comboboxchanged")){
+ String selection =
actionType.getModel().getSelectedItem().toString();
+
if(selection.equals(actionType.getItemAt(0))){
+
setAPIEditComponentsVisible(true);
+ }else{
+
setTTSEditComponentsVivible(true);
+ }
+ }
+ }
+ });
//Create api modification gfx.
this.tuxBody = new JComboBox();
this.tuxBody.addItem("Mouth");
@@ -473,7 +497,9 @@
}
- //TODO remove entry from ini.
+ /*
+ * Remove a ChatterTux Ini entry.
+ */
public void removeFromIni(String key){
try {
this.writer.delete(key);
@@ -481,6 +507,8 @@
System.out.println(String.format("Problem deleting %s",
key));
e.printStackTrace();
}
+ this.properties.updateHashTable(this.ini.getHashtable());
+ this.updateValues();
}
/*****************************************************************************/
@@ -584,7 +612,18 @@
return returns.toString();
}
+ //TODO
+ public void updateValues(){
+ this.onRadioConnected(null, null);
+ this.parametrized.removeAllItems();
+ for(int i=1; i < this.ini.getLength(); i++){
+
this.parametrized.addItem((String)this.ini.getKeyAtIndex(i));
+ }
+ this.parametrized.setSelectedIndex(0);
+ this.setStoredLocutor();
+ }
+
private class ServerControlActionListener implements ActionListener{
public void actionPerformed(ActionEvent e) {
Modified:
software_suite_v2/software/tools/chatterTux/trunk/Chatter_tux/src/Properties.java
===================================================================
---
software_suite_v2/software/tools/chatterTux/trunk/Chatter_tux/src/Properties.java
2008-08-17 09:11:26 UTC (rev 1531)
+++
software_suite_v2/software/tools/chatterTux/trunk/Chatter_tux/src/Properties.java
2008-08-17 09:47:03 UTC (rev 1532)
@@ -31,6 +31,10 @@
this.hash = hash;
}
+ public void updateHashTable(Hashtable<String, Vector<String>> newHash){
+ this.hash = newHash;
+ }
+
public Hashtable<String, String> getProperties(String key){
Vector<String> vecteur = (Vector<String>)this.hash.get(key);
Hashtable<String, String> table = new Hashtable<String,
String>();
-------------------------------------------------------------------------
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