[Patchanim-commit] SF.net SVN: patchanim: [89] trunk/patchanim/src/com/mebigfatguy/patchanim
Brought to you by:
dbrosius
|
From: <dbr...@us...> - 2008-02-03 00:52:41
|
Revision: 89
http://patchanim.svn.sourceforge.net/patchanim/?rev=89&view=rev
Author: dbrosius
Date: 2008-02-02 16:52:44 -0800 (Sat, 02 Feb 2008)
Log Message:
-----------
allow for named patches, and fix error messages
Modified Paths:
--------------
trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchAnimFrame.java
trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchListPanel.java
trunk/patchanim/src/com/mebigfatguy/patchanim/main/PatchAnimBundle.java
trunk/patchanim/src/com/mebigfatguy/patchanim/resources.properties
trunk/patchanim/src/com/mebigfatguy/patchanim/surface/CombinedPatch.java
Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchAnimFrame.java
===================================================================
--- trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchAnimFrame.java 2008-02-03 00:28:51 UTC (rev 88)
+++ trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchAnimFrame.java 2008-02-03 00:52:44 UTC (rev 89)
@@ -137,7 +137,8 @@
dispose();
System.exit(0);
} catch (IOException ioe) {
- JOptionPane.showMessageDialog(JPatchAnimFrame.this, PatchAnimBundle.SAVEFAILED);
+ ResourceBundle rb = PatchAnimBundle.getBundle();
+ JOptionPane.showMessageDialog(JPatchAnimFrame.this, rb.getString(PatchAnimBundle.SAVEFAILED));
}
}
});
@@ -158,7 +159,8 @@
documentLocation = null;
saveItem.setEnabled(false);
} catch (IOException ioe) {
- JOptionPane.showMessageDialog(JPatchAnimFrame.this, PatchAnimBundle.SAVEFAILED);
+ ResourceBundle rb = PatchAnimBundle.getBundle();
+ JOptionPane.showMessageDialog(JPatchAnimFrame.this, rb.getString(PatchAnimBundle.SAVEFAILED));
}
}
});
@@ -176,7 +178,8 @@
}
load();
} catch (IOException ioe) {
- JOptionPane.showMessageDialog(JPatchAnimFrame.this, PatchAnimBundle.LOADFAILED);
+ ResourceBundle rb = PatchAnimBundle.getBundle();
+ JOptionPane.showMessageDialog(JPatchAnimFrame.this, rb.getString(PatchAnimBundle.LOADFAILED));
}
}
});
@@ -190,7 +193,8 @@
save();
}
} catch (IOException ioe) {
- JOptionPane.showMessageDialog(JPatchAnimFrame.this, PatchAnimBundle.SAVEFAILED);
+ ResourceBundle rb = PatchAnimBundle.getBundle();
+ JOptionPane.showMessageDialog(JPatchAnimFrame.this, rb.getString(PatchAnimBundle.SAVEFAILED));
}
}
});
@@ -200,7 +204,8 @@
try {
saveAs();
} catch (IOException ioe) {
- JOptionPane.showMessageDialog(JPatchAnimFrame.this, PatchAnimBundle.SAVEFAILED);
+ ResourceBundle rb = PatchAnimBundle.getBundle();
+ JOptionPane.showMessageDialog(JPatchAnimFrame.this, rb.getString(PatchAnimBundle.SAVEFAILED));
}
}
});
@@ -243,7 +248,8 @@
dispose();
System.exit(0);
} catch (IOException ioe) {
- JOptionPane.showMessageDialog(JPatchAnimFrame.this, PatchAnimBundle.SAVEFAILED);
+ ResourceBundle rb = PatchAnimBundle.getBundle();
+ JOptionPane.showMessageDialog(JPatchAnimFrame.this, rb.getString(PatchAnimBundle.SAVEFAILED));
}
}
});
@@ -289,7 +295,8 @@
document = PatchAnimIO.loadFile(documentLocation);
}
} catch (Exception e) {
- JOptionPane.showMessageDialog(JPatchAnimFrame.this, PatchAnimBundle.SAVEFAILED);
+ ResourceBundle rb = PatchAnimBundle.getBundle();
+ JOptionPane.showMessageDialog(JPatchAnimFrame.this, rb.getString(PatchAnimBundle.SAVEFAILED));
documentLocation = null;
document = new PatchAnimDocument();
} finally {
@@ -384,7 +391,8 @@
}
});
} catch (IOException ioe) {
- JOptionPane.showMessageDialog(JPatchAnimFrame.this, PatchAnimBundle.EXPORTFAILED);
+ ResourceBundle rb = PatchAnimBundle.getBundle();
+ JOptionPane.showMessageDialog(JPatchAnimFrame.this, rb.getString(PatchAnimBundle.EXPORTFAILED));
}
}
});
Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchListPanel.java
===================================================================
--- trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchListPanel.java 2008-02-03 00:28:51 UTC (rev 88)
+++ trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchListPanel.java 2008-02-03 00:52:44 UTC (rev 89)
@@ -22,6 +22,8 @@
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
import java.util.ResourceBundle;
import javax.swing.BorderFactory;
@@ -31,6 +33,7 @@
import javax.swing.JButton;
import javax.swing.JComponent;
import javax.swing.JList;
+import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.ListSelectionModel;
@@ -192,6 +195,27 @@
}
}
});
+
+ patchList.addMouseListener(new MouseAdapter() {
+ @Override
+ public void mouseClicked(MouseEvent me) {
+ ResourceBundle rb = PatchAnimBundle.getBundle();
+ if (me.getClickCount() == 2) {
+ CombinedPatch patch = (CombinedPatch)patchList.getSelectedValue();
+ if (patch != null) {
+ String newName = JOptionPane.showInputDialog(JPatchListPanel.this, rb.getString(PatchAnimBundle.ENTERNEWPATCHNAME), patch.getName());
+ if (newName != null) {
+ patch.setName(newName);
+ PatchPanelMediator mediator = PatchPanelMediator.getMediator();
+ mediator.getDocument().setDirty(true);
+ patchList.invalidate();
+ patchList.revalidate();
+ patchList.repaint();
+ }
+ }
+ }
+ }
+ });
}
private void enabledMovementCtrls() {
Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/main/PatchAnimBundle.java
===================================================================
--- trunk/patchanim/src/com/mebigfatguy/patchanim/main/PatchAnimBundle.java 2008-02-03 00:28:51 UTC (rev 88)
+++ trunk/patchanim/src/com/mebigfatguy/patchanim/main/PatchAnimBundle.java 2008-02-03 00:52:44 UTC (rev 89)
@@ -56,6 +56,8 @@
public static final String TWEENFRAMES = "patchanim.tween";
public static final String TEST = "patchanim.test";
public static final String STOP = "patchanim.stop";
+ public static final String DEFAULTPATCHNAME = "patchanim.defaultpatchname";
+ public static final String ENTERNEWPATCHNAME = "patchanim.enternewpatchname";
public static final String ADD = "patchanim.add";
public static final String REMOVE = "patchanim.remove";
public static final String COLOR = "patchanim.color";
Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/resources.properties
===================================================================
--- trunk/patchanim/src/com/mebigfatguy/patchanim/resources.properties 2008-02-03 00:28:51 UTC (rev 88)
+++ trunk/patchanim/src/com/mebigfatguy/patchanim/resources.properties 2008-02-03 00:52:44 UTC (rev 89)
@@ -49,6 +49,8 @@
patchanim.tween = In-between frames
patchanim.test = Test
patchanim.stop = Stop
+patchanim.defaultpatchname = Patch Coordinates
+patchanim.enternewpatchname = Rename Patch to
patchanim.add = Add
patchanim.remove = Remove
patchanim.color = Color
Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/surface/CombinedPatch.java
===================================================================
--- trunk/patchanim/src/com/mebigfatguy/patchanim/surface/CombinedPatch.java 2008-02-03 00:28:51 UTC (rev 88)
+++ trunk/patchanim/src/com/mebigfatguy/patchanim/surface/CombinedPatch.java 2008-02-03 00:52:44 UTC (rev 89)
@@ -20,13 +20,16 @@
import java.io.Serializable;
import java.util.EnumMap;
+import java.util.ResourceBundle;
import com.mebigfatguy.patchanim.PatchColor;
+import com.mebigfatguy.patchanim.main.PatchAnimBundle;
public class CombinedPatch implements Serializable {
- private static final long serialVersionUID = 8732763987020552187L;
+ private static final long serialVersionUID = 3521025714125245036L;
private EnumMap<PatchColor, PatchCoords> patches = new EnumMap<PatchColor, PatchCoords>(PatchColor.class);
+ private String name;
public CombinedPatch(boolean init) {
if (init) {
@@ -38,6 +41,8 @@
patches.put(PatchColor.Green, new PatchCoords());
patches.put(PatchColor.Blue, new PatchCoords());
}
+ ResourceBundle rb = PatchAnimBundle.getBundle();
+ name = rb.getString(PatchAnimBundle.DEFAULTPATCHNAME);
}
public CombinedPatch(PatchCoords redPatch, PatchCoords greenPatch, PatchCoords bluePatch) {
@@ -74,8 +79,15 @@
patches.put(color, coords);
}
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String patchName) {
+ name = patchName;
+ }
@Override
public String toString() {
- return "Patch Coordinates";
+ return name;
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|