]> git.argeo.org Git - gpl/argeo-slc.git/blobdiff - legacy/runtime/org.argeo.slc.support.jemmy/src/main/java/org/argeo/slc/jemmy/AbstractComponentWrapper.java
Reactivate:
[gpl/argeo-slc.git] / legacy / runtime / org.argeo.slc.support.jemmy / src / main / java / org / argeo / slc / jemmy / AbstractComponentWrapper.java
diff --git a/legacy/runtime/org.argeo.slc.support.jemmy/src/main/java/org/argeo/slc/jemmy/AbstractComponentWrapper.java b/legacy/runtime/org.argeo.slc.support.jemmy/src/main/java/org/argeo/slc/jemmy/AbstractComponentWrapper.java
deleted file mode 100644 (file)
index 65e64f5..0000000
+++ /dev/null
@@ -1,125 +0,0 @@
-/*\r
- * Copyright (C) 2007-2012 Argeo GmbH\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- *         http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-package org.argeo.slc.jemmy;\r
-\r
-import java.util.ArrayList;\r
-import java.util.HashMap;\r
-import java.util.Iterator;\r
-import java.util.List;\r
-import java.util.Map;\r
-import java.util.Set;\r
-\r
-import org.netbeans.jemmy.operators.ComponentOperator;\r
-\r
-public class AbstractComponentWrapper implements ComponentWrapper {\r
-\r
-       protected ComponentWrapper parent;\r
-\r
-       /**\r
-        * List of children ComponentWrapper\r
-        */\r
-       protected List children = new ArrayList();\r
-\r
-       protected WrapperLocator locator;\r
-\r
-       protected String prefix;\r
-\r
-       public ComponentOperator find() {\r
-               return locator.find(this);\r
-       }\r
-\r
-       protected String createNewKey(String oldKey) {\r
-               return (prefix == null) ? oldKey : (prefix + "." + oldKey);\r
-       }\r
-\r
-       protected void addToAccessorMap(Map accessors, String oldKey,\r
-                       Object accessor) {\r
-               String newKey = createNewKey(oldKey);\r
-               if (accessors.containsKey(newKey)) {\r
-                       throw new ConfigRuntimeException("An Accessor with key '" + newKey\r
-                                       + "' was already registered");\r
-               }\r
-               accessors.put(newKey, accessor);\r
-       }\r
-\r
-       public Map getAccessors(Class accessorClass) {\r
-               Map accessors = new HashMap();\r
-               if (accessorClass.isInstance(this)) {\r
-                       addToAccessorMap(accessors, ((Accessor) this).getFieldName(), this);\r
-               }\r
-               for (int i = 0; i < children.size(); i++) {\r
-                       Map childAccessors = ((ComponentWrapper) children.get(i))\r
-                                       .getAccessors(accessorClass);\r
-\r
-                       Set entries = childAccessors.entrySet();\r
-                       Iterator it = entries.iterator();\r
-\r
-                       while (it.hasNext()) {\r
-                               Map.Entry keyValue = (Map.Entry) it.next();\r
-                               addToAccessorMap(accessors, keyValue.getKey().toString(),\r
-                                               keyValue.getValue());\r
-                       }\r
-               }\r
-               return accessors;\r
-       }\r
-\r
-       public ComponentWrapper getParent() {\r
-               return parent;\r
-       }\r
-\r
-       public void setParent(ComponentWrapper parent) {\r
-               if (this.parent != null) {\r
-                       throw new ConfigRuntimeException("Parent already set");\r
-               }\r
-               this.parent = parent;\r
-       }\r
-\r
-       public List getChildren() {\r
-               return children;\r
-       }\r
-\r
-       public void setChildren(List children) {\r
-               this.children = children;\r
-\r
-               // check that all elements of the list are ComponentWrapper\r
-               // and set their parent\r
-               for (int i = 0; i < this.children.size(); i++) {\r
-                       ComponentWrapper wrapper = (ComponentWrapper) this.children.get(i);\r
-                       if (wrapper == null) {\r
-                               throw new ConfigRuntimeException(\r
-                                               "Children of ComponentWrappers must be ComponentWrappers");\r
-                       }\r
-                       wrapper.setParent(this);\r
-               }\r
-       }\r
-\r
-       public WrapperLocator getLocator() {\r
-               return locator;\r
-       }\r
-\r
-       public void setLocator(WrapperLocator locator) {\r
-               this.locator = locator;\r
-       }\r
-\r
-       public String getPrefix() {\r
-               return prefix;\r
-       }\r
-\r
-       public void setPrefix(String prefix) {\r
-               this.prefix = prefix;\r
-       }\r
-\r
-}\r