Author: mes
Date: 2011-11-28 13:33:30 -0800 (Mon, 28 Nov 2011)
New Revision: 27611
Added:
core3/api/trunk/work-api/src/test/java/org/cytoscape/work/undo/AbstractCyEditTest.java
Removed:
core3/api/trunk/work-api/src/main/java/org/cytoscape/work/undo/AbstractUndoableEdit.java
core3/api/trunk/work-api/src/test/java/org/cytoscape/work/undo/AbstractUndoableEditTest.java
Modified:
core3/api/trunk/work-api/src/main/java/org/cytoscape/work/undo/AbstractCyEdit.java
core3/api/trunk/work-api/src/test/java/org/cytoscape/work/undo/SimpleUndoableEditTest.java
Log:
got rid of AbstractUndoableEdit
Modified:
core3/api/trunk/work-api/src/main/java/org/cytoscape/work/undo/AbstractCyEdit.java
===================================================================
---
core3/api/trunk/work-api/src/main/java/org/cytoscape/work/undo/AbstractCyEdit.java
2011-11-28 20:51:27 UTC (rev 27610)
+++
core3/api/trunk/work-api/src/main/java/org/cytoscape/work/undo/AbstractCyEdit.java
2011-11-28 21:33:30 UTC (rev 27611)
@@ -40,7 +40,7 @@
* @CyAPI.Abstract.Class
*/
public abstract class AbstractCyEdit extends AbstractUndoableEdit {
- /** The presentation name of this CyAbstractEdit. */
+ /** The presentation name of this AbstractCyEdit. */
protected String desc;
/**
@@ -49,6 +49,10 @@
*/
public AbstractCyEdit(String desc) {
super();
+
+ if (desc == null)
+ throw new NullPointerException("Presentation name must
not be null!");
+
this.desc = desc;
}
Deleted:
core3/api/trunk/work-api/src/main/java/org/cytoscape/work/undo/AbstractUndoableEdit.java
===================================================================
---
core3/api/trunk/work-api/src/main/java/org/cytoscape/work/undo/AbstractUndoableEdit.java
2011-11-28 20:51:27 UTC (rev 27610)
+++
core3/api/trunk/work-api/src/main/java/org/cytoscape/work/undo/AbstractUndoableEdit.java
2011-11-28 21:33:30 UTC (rev 27611)
@@ -1,63 +0,0 @@
-/*
- File: CyAbstractEdit.java
-
- Copyright (c) 2006, 2010, The Cytoscape Consortium (www.cytoscape.org)
-
- This library is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as published
- by the Free Software Foundation; either version 2.1 of the License, or
- any later version.
-
- This library is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF
- MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. The software and
- documentation provided hereunder is on an "as is" basis, and the
- Institute for Systems Biology and the Whitehead Institute
- have no obligations to provide maintenance, support,
- updates, enhancements or modifications. In no event shall the
- Institute for Systems Biology and the Whitehead Institute
- be liable to any party for direct, indirect, special,
- incidental or consequential damages, including lost profits, arising
- out of the use of this software and its documentation, even if the
- Institute for Systems Biology and the Whitehead Institute
- have been advised of the possibility of such damage. See
- the GNU Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public License
- along with this library; if not, write to the Free Software Foundation,
- Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
-*/
-package org.cytoscape.work.undo;
-
-
-/**
- * A small convenience class that can be used to create new undo/redo edits.
All
- * you should have to do is implement the undo() and redo() methods. The
- * benefit is that you don't need to worry about setting up names.
- * @CyAPI.Abstract.Class
- */
-public abstract class AbstractUndoableEdit extends
javax.swing.undo.AbstractUndoableEdit {
-
- private static final long serialVersionUID = -8072738992232559637L;
-
- private final String presentationName;
-
- /** Initializes an UndoableEdit.
- *
- * @param presentationName the name that will represent the undoable
action
- */
- public AbstractUndoableEdit(final String presentationName) {
- if (presentationName == null)
- throw new IllegalArgumentException("in call to
AbstractUndoableEdit(), presentationName must not be null!");
-
- this.presentationName = presentationName;
- }
-
- /** Returns a string representing the action that can be undone.
- * @return a string representing the action that can be undone.
- */
- @Override
- public final String getPresentationName() {
- return presentationName;
- }
-}
Added:
core3/api/trunk/work-api/src/test/java/org/cytoscape/work/undo/AbstractCyEditTest.java
===================================================================
---
core3/api/trunk/work-api/src/test/java/org/cytoscape/work/undo/AbstractCyEditTest.java
(rev 0)
+++
core3/api/trunk/work-api/src/test/java/org/cytoscape/work/undo/AbstractCyEditTest.java
2011-11-28 21:33:30 UTC (rev 27611)
@@ -0,0 +1,68 @@
+/*
+ Copyright (c) 2010, The Cytoscape Consortium (www.cytoscape.org)
+
+ This library is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as published
+ by the Free Software Foundation; either version 2.1 of the License, or
+ any later version.
+
+ This library is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF
+ MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. The software and
+ documentation provided hereunder is on an "as is" basis, and the
+ Institute for Systems Biology and the Whitehead Institute
+ have no obligations to provide maintenance, support,
+ updates, enhancements or modifications. In no event shall the
+ Institute for Systems Biology and the Whitehead Institute
+ be liable to any party for direct, indirect, special,
+ incidental or consequential damages, including lost profits, arising
+ out of the use of this software and its documentation, even if the
+ Institute for Systems Biology and the Whitehead Institute
+ have been advised of the possibility of such damage. See
+ the GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this library; if not, write to the Free Software Foundation,
+ Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+*/
+package org.cytoscape.work.undo;
+
+
+import static org.junit.Assert.*;
+import org.junit.Test;
+
+import org.cytoscape.work.undo.AbstractCyEdit;
+
+
+public abstract class AbstractCyEditTest {
+ protected AbstractCyEdit undoableEdit;
+
+ public abstract void saveState();
+ public abstract void changeState();
+ public abstract boolean currentStateIsIdenticalToSavedState();
+
+ @Test
+ public final void testPresentationName() {
+ assertTrue("presentation name is non-empty",
!undoableEdit.getPresentationName().isEmpty());
+ assertTrue("redo presentation name is non-empty",
!undoableEdit.getRedoPresentationName().isEmpty());
+ assertTrue("undo presentation name is non-empty",
!undoableEdit.getUndoPresentationName().isEmpty());
+ assertTrue("redo and undo presentation name are different",
undoableEdit.getRedoPresentationName() !=
undoableEdit.getUndoPresentationName());
+ }
+
+ @Test
+ public final void testUndo() {
+ saveState();
+ changeState();
+ undoableEdit.undo();
+ assertTrue("state is back to orginal after undo",
currentStateIsIdenticalToSavedState());
+ }
+
+ @Test
+ public final void testRedo() {
+ saveState();
+ changeState();
+ undoableEdit.undo();
+ undoableEdit.redo();
+ assertTrue("state is different from orginal after undo followed
by redo", !currentStateIsIdenticalToSavedState());
+ }
+}
Deleted:
core3/api/trunk/work-api/src/test/java/org/cytoscape/work/undo/AbstractUndoableEditTest.java
===================================================================
---
core3/api/trunk/work-api/src/test/java/org/cytoscape/work/undo/AbstractUndoableEditTest.java
2011-11-28 20:51:27 UTC (rev 27610)
+++
core3/api/trunk/work-api/src/test/java/org/cytoscape/work/undo/AbstractUndoableEditTest.java
2011-11-28 21:33:30 UTC (rev 27611)
@@ -1,70 +0,0 @@
-/*
- Copyright (c) 2010, The Cytoscape Consortium (www.cytoscape.org)
-
- This library is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as published
- by the Free Software Foundation; either version 2.1 of the License, or
- any later version.
-
- This library is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF
- MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. The software and
- documentation provided hereunder is on an "as is" basis, and the
- Institute for Systems Biology and the Whitehead Institute
- have no obligations to provide maintenance, support,
- updates, enhancements or modifications. In no event shall the
- Institute for Systems Biology and the Whitehead Institute
- be liable to any party for direct, indirect, special,
- incidental or consequential damages, including lost profits, arising
- out of the use of this software and its documentation, even if the
- Institute for Systems Biology and the Whitehead Institute
- have been advised of the possibility of such damage. See
- the GNU Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public License
- along with this library; if not, write to the Free Software Foundation,
- Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
-*/
-package org.cytoscape.work.undo;
-
-
-import javax.swing.undo.UndoableEdit;
-
-import static org.junit.Assert.*;
-import org.junit.Test;
-
-import org.cytoscape.work.undo.AbstractUndoableEdit;
-
-
-public abstract class AbstractUndoableEditTest {
- protected UndoableEdit undoableEdit;
-
- public abstract void saveState();
- public abstract void changeState();
- public abstract boolean currentStateIsIdenticalToSavedState();
-
- @Test
- public final void testPresentationName() {
- assertTrue("presentation name is non-empty",
!undoableEdit.getPresentationName().isEmpty());
- assertTrue("redo presentation name is non-empty",
!undoableEdit.getRedoPresentationName().isEmpty());
- assertTrue("undo presentation name is non-empty",
!undoableEdit.getUndoPresentationName().isEmpty());
- assertTrue("redo and undo presentation name are different",
undoableEdit.getRedoPresentationName() !=
undoableEdit.getUndoPresentationName());
- }
-
- @Test
- public final void testUndo() {
- saveState();
- changeState();
- undoableEdit.undo();
- assertTrue("state is back to orginal after undo",
currentStateIsIdenticalToSavedState());
- }
-
- @Test
- public final void testRedo() {
- saveState();
- changeState();
- undoableEdit.undo();
- undoableEdit.redo();
- assertTrue("state is different from orginal after undo followed
by redo", !currentStateIsIdenticalToSavedState());
- }
-}
Modified:
core3/api/trunk/work-api/src/test/java/org/cytoscape/work/undo/SimpleUndoableEditTest.java
===================================================================
---
core3/api/trunk/work-api/src/test/java/org/cytoscape/work/undo/SimpleUndoableEditTest.java
2011-11-28 20:51:27 UTC (rev 27610)
+++
core3/api/trunk/work-api/src/test/java/org/cytoscape/work/undo/SimpleUndoableEditTest.java
2011-11-28 21:33:30 UTC (rev 27611)
@@ -33,14 +33,14 @@
import org.junit.Before;
import org.junit.Test;
-import org.cytoscape.work.undo.AbstractUndoableEdit;
+import org.cytoscape.work.undo.AbstractCyEdit;
-public class SimpleUndoableEditTest extends AbstractUndoableEditTest {
+public class SimpleUndoableEditTest extends AbstractCyEditTest {
private int state = 0;
private int savedState;
- class SimpleUndoableEdit extends AbstractUndoableEdit {
+ class SimpleUndoableEdit extends AbstractCyEdit {
SimpleUndoableEdit(final String presentationName) {
super(presentationName);
}
@@ -69,7 +69,7 @@
return state == savedState;
}
- @Test(expected=IllegalArgumentException.class)
+ @Test(expected=NullPointerException.class)
public final void testNullConstructorArgument() {
new SimpleUndoableEdit(null);
}
--
You received this message because you are subscribed to the Google Groups
"cytoscape-cvs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/cytoscape-cvs?hl=en.