Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAchim Loerke2012-03-15 06:24:33 -0400
committerAchim Loerke2012-03-15 06:24:33 -0400
commitf2e996bd0c54563ef942329d161ff3870310d0a1 (patch)
treeeed8dcf348097cd6623d8f7c8880f51bde50ae7b /org.eclipse.jubula.examples.aut.dvdtool
parent0368a34d41386de251519f40efb6c7a9c9755947 (diff)
downloadorg.eclipse.jubula.core-f2e996bd0c54563ef942329d161ff3870310d0a1.tar.gz
org.eclipse.jubula.core-f2e996bd0c54563ef942329d161ff3870310d0a1.tar.xz
org.eclipse.jubula.core-f2e996bd0c54563ef942329d161ff3870310d0a1.zip
DVDTool example: removed Java5 dependencies
Diffstat (limited to 'org.eclipse.jubula.examples.aut.dvdtool')
-rw-r--r--org.eclipse.jubula.examples.aut.dvdtool/src/org/eclipse/jubula/examples/aut/dvdtool/DVDTool.java10
-rw-r--r--org.eclipse.jubula.examples.aut.dvdtool/src/org/eclipse/jubula/examples/aut/dvdtool/DevelopmentState.java28
-rw-r--r--org.eclipse.jubula.examples.aut.dvdtool/src/org/eclipse/jubula/examples/aut/dvdtool/control/DvdAddCategoryAction.java10
-rw-r--r--org.eclipse.jubula.examples.aut.dvdtool/src/org/eclipse/jubula/examples/aut/dvdtool/model/DvdCategory.java4
4 files changed, 30 insertions, 22 deletions
diff --git a/org.eclipse.jubula.examples.aut.dvdtool/src/org/eclipse/jubula/examples/aut/dvdtool/DVDTool.java b/org.eclipse.jubula.examples.aut.dvdtool/src/org/eclipse/jubula/examples/aut/dvdtool/DVDTool.java
index ee3411d75..59538662f 100644
--- a/org.eclipse.jubula.examples.aut.dvdtool/src/org/eclipse/jubula/examples/aut/dvdtool/DVDTool.java
+++ b/org.eclipse.jubula.examples.aut.dvdtool/src/org/eclipse/jubula/examples/aut/dvdtool/DVDTool.java
@@ -10,7 +10,6 @@
*******************************************************************************/
package org.eclipse.jubula.examples.aut.dvdtool;
-import org.eclipse.jubula.examples.aut.dvdtool.DevelopmentState.State;
import org.eclipse.jubula.examples.aut.dvdtool.control.DvdMainFrameController;
import org.eclipse.jubula.examples.aut.dvdtool.gui.DvdMainFrame;
@@ -49,9 +48,12 @@ public class DVDTool {
private static void checkForDevelopmentVersion(String[] args) {
if (args.length == 1) {
try {
- State state = State.valueOf(args[0].toUpperCase());
- DevelopmentState.instance().setState(state);
- } catch (IllegalArgumentException e) {
+ String s = args[0].toUpperCase();
+ if ((s.length() == 2) && s.startsWith("V")) { //$NON-NLS-1$
+ int state = Integer.parseInt(s.substring(1));
+ DevelopmentState.instance().setState(state);
+ }
+ } catch (NumberFormatException e) {
// ignore wrong parameters
}
}
diff --git a/org.eclipse.jubula.examples.aut.dvdtool/src/org/eclipse/jubula/examples/aut/dvdtool/DevelopmentState.java b/org.eclipse.jubula.examples.aut.dvdtool/src/org/eclipse/jubula/examples/aut/dvdtool/DevelopmentState.java
index cf613727c..fea571da5 100644
--- a/org.eclipse.jubula.examples.aut.dvdtool/src/org/eclipse/jubula/examples/aut/dvdtool/DevelopmentState.java
+++ b/org.eclipse.jubula.examples.aut.dvdtool/src/org/eclipse/jubula/examples/aut/dvdtool/DevelopmentState.java
@@ -10,21 +10,25 @@ package org.eclipse.jubula.examples.aut.dvdtool;
* trigger certain behaviors which simulated development states.
*/
public final class DevelopmentState {
- /**
- * Symbolic names for development states
- */
- public enum State { V0, V1, V2, V3 }
+ /**Symbolic name for development state */
+ public static final int V0 = 0;
+ /**Symbolic name for development state */
+ public static final int V1 = 1;
+ /**Symbolic name for development state */
+ public static final int V2 = 2;
+ /**Symbolic name for development state */
+ public static final int V3 = 3;
/** Singleton instance variable */
private static DevelopmentState instance;
/** simulated development state */
- private State m_state;
+ private int m_state;
/**
* private constructor required by the Singleton pattern.
*/
private DevelopmentState() {
- m_state = State.V0;
+ m_state = V0;
}
/**
@@ -41,14 +45,14 @@ public final class DevelopmentState {
/**
* @return the m_state
*/
- public State getState() {
+ public int getState() {
return m_state;
}
/**
* @param state the m_state to set
*/
- public void setState(State state) {
+ public void setState(int state) {
m_state = state;
}
@@ -57,7 +61,7 @@ public final class DevelopmentState {
* @return true if the state from the method name is set
*/
public boolean isV0() {
- return m_state == State.V0;
+ return m_state == V0;
}
/**
@@ -65,7 +69,7 @@ public final class DevelopmentState {
* @return true if the state from the method name is set
*/
public boolean isV1() {
- return m_state == State.V1;
+ return m_state == V1;
}
/**
@@ -73,7 +77,7 @@ public final class DevelopmentState {
* @return true if the state from the method name is set
*/
public boolean isV2() {
- return m_state == State.V2;
+ return m_state == V2;
}
/**
@@ -81,7 +85,7 @@ public final class DevelopmentState {
* @return true if the state from the method name is set
*/
public boolean isV3() {
- return m_state == State.V3;
+ return m_state == V3;
}
}
diff --git a/org.eclipse.jubula.examples.aut.dvdtool/src/org/eclipse/jubula/examples/aut/dvdtool/control/DvdAddCategoryAction.java b/org.eclipse.jubula.examples.aut.dvdtool/src/org/eclipse/jubula/examples/aut/dvdtool/control/DvdAddCategoryAction.java
index 5d12a98ea..23a61d2c2 100644
--- a/org.eclipse.jubula.examples.aut.dvdtool/src/org/eclipse/jubula/examples/aut/dvdtool/control/DvdAddCategoryAction.java
+++ b/org.eclipse.jubula.examples.aut.dvdtool/src/org/eclipse/jubula/examples/aut/dvdtool/control/DvdAddCategoryAction.java
@@ -14,6 +14,7 @@ import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
+import java.util.Iterator;
import javax.swing.JButton;
import javax.swing.JDialog;
@@ -65,7 +66,6 @@ public class DvdAddCategoryAction extends DvdAbstractDialogAction {
/**
* {@inheritDoc}
*/
- @Override
public void actionPerformed(ActionEvent e) {
if (isVersion1 || isVersion2 || isVersion3) {
final JTextField textField = new JTextField(30);
@@ -91,14 +91,14 @@ public class DvdAddCategoryAction extends DvdAbstractDialogAction {
m_controller.getDvdMainFrame(),
Resources.getString("new.category.input.message")); //$NON-NLS-1$
okButton.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
+ public void actionPerformed(ActionEvent ev) {
pane.setValue(textField.getText());
dialog.setVisible(false);
}
});
okButton.setEnabled(false);
cancelButton.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
+ public void actionPerformed(ActionEvent ev) {
pane.setValue(null);
dialog.setVisible(false);
}
@@ -146,7 +146,9 @@ public class DvdAddCategoryAction extends DvdAbstractDialogAction {
if (cat.getName().equals(newCatName)) {
return true;
}
- for (DvdCategory child : cat.getCategories()) {
+ Iterator it = cat.getCategories().iterator();
+ while (it.hasNext()) {
+ DvdCategory child = (DvdCategory)it.next();
if (categoryExists(child, newCatName)) {
return true;
}
diff --git a/org.eclipse.jubula.examples.aut.dvdtool/src/org/eclipse/jubula/examples/aut/dvdtool/model/DvdCategory.java b/org.eclipse.jubula.examples.aut.dvdtool/src/org/eclipse/jubula/examples/aut/dvdtool/model/DvdCategory.java
index 8ec0e4457..7bd498f0c 100644
--- a/org.eclipse.jubula.examples.aut.dvdtool/src/org/eclipse/jubula/examples/aut/dvdtool/model/DvdCategory.java
+++ b/org.eclipse.jubula.examples.aut.dvdtool/src/org/eclipse/jubula/examples/aut/dvdtool/model/DvdCategory.java
@@ -28,7 +28,7 @@ public class DvdCategory implements Serializable {
private DvdCategory m_parent = null;
/** the children categories, a Vector, see insert() and remove() */
- private List<DvdCategory> m_categories;
+ private List m_categories;
/** the dvds of this category, a Vector, see insert() and remove() */
private List m_dvds;
@@ -146,7 +146,7 @@ public class DvdCategory implements Serializable {
/**
* @return Returns the children.
*/
- public List<DvdCategory> getCategories() {
+ public List getCategories() {
return m_categories;
}

Back to the top