| <%@ jet |
| package="org.eclipse.jubula.toolkit.api.gen" |
| imports="java.util.* |
| org.eclipse.jubula.toolkit.api.gen.internal.utils.GenerateUtil |
| org.eclipse.jubula.toolkit.api.gen.internal.genmodel.CompInfoForToolkitGen |
| org.eclipse.jubula.toolkit.api.gen.internal.genmodel.CommonGenInfo |
| org.eclipse.jubula.toolkit.api.gen.internal.genmodel.ToolkitGenInfo |
| org.eclipse.jubula.tools.internal.xml.businessmodell.ComponentClass |
| org.eclipse.jubula.tools.internal.xml.businessmodell.Property" |
| class="ToolkitInfoGenerator"%> |
| <% |
| CommonGenInfo genInfo = (CommonGenInfo)argument; |
| String className = genInfo.getClassName(); |
| String packageName = genInfo.getClassPackageName(); |
| Object specInfo = genInfo.getSpecificInformation(); |
| String fqnGeneratorClassName = this.getClass().getName(); |
| if (specInfo instanceof ToolkitGenInfo) { |
| ToolkitGenInfo toolkitInfo = (ToolkitGenInfo) specInfo; |
| List<CompInfoForToolkitGen> compInfoList = toolkitInfo.getCompInformation(); |
| %> |
| /******************************************************************************* |
| * Copyright (c) 2014 BREDEX GmbH. |
| * All rights reserved. This program and the accompanying materials |
| * are made available under the terms of the Eclipse Public License v1.0 |
| * which accompanies this distribution, and is available at |
| * http://www.eclipse.org/legal/epl-v10.html |
| * |
| * Contributors: |
| * BREDEX GmbH - initial API and implementation and/or initial documentation |
| *******************************************************************************/ |
| package <%=packageName%>; |
| |
| import java.util.ArrayList; |
| import java.util.HashMap; |
| import java.util.List; |
| import java.util.Map; |
| import javax.annotation.Generated; |
| |
| import org.eclipse.jdt.annotation.NonNull; |
| import org.eclipse.jubula.toolkit.internal.AbstractToolkitInfo; |
| import org.eclipse.jubula.tools.internal.xml.businessmodell.ComponentClass; |
| import org.eclipse.jubula.tools.internal.xml.businessmodell.Property; |
| |
| /** |
| * Contains information about the <%=genInfo.getToolkitPackageName()%> toolkit and its components |
| */ |
| @Generated(value = "<%=fqnGeneratorClassName%>", |
| date = "<%=GenerateUtil.getISO8601Timestamp()%>") |
| public final class <%=className%> extends AbstractToolkitInfo { |
| |
| @NonNull private Map<ComponentClass, String> m_map = new HashMap<ComponentClass, String>(); |
| |
| /** |
| * Constructor |
| */ |
| public <%=className%>() { |
| <%int i = 1;%> |
| <%for (CompInfoForToolkitGen compInfo : compInfoList) { |
| ComponentClass componentClass = compInfo.getComponentClass(); |
| String testerClass = compInfo.getTesterClass(); |
| if (componentClass != null && testerClass != null) {%> |
| ComponentClass newComponentClass<%=i%> = new ComponentClass("<%=componentClass.getName()%>"); //$NON-NLS-1$ |
| <%List properties = componentClass.getProperties();%> |
| <%if (!properties.isEmpty()) {%> |
| List<Property> newProperties<%=i%> = new ArrayList<Property>(); |
| <%int j = 1;%> |
| <%for (Object obj : properties) {%> |
| <%if (obj instanceof Property) { |
| Property property = (Property) obj;%> |
| Property newProperty<%=i%>_<%=j%> = new Property(); |
| newProperty<%=i%>_<%=j%>.setName("<%=property.getName()%>"); //$NON-NLS-1$ |
| newProperty<%=i%>_<%=j%>.setValue("<%=property.getValue()%>"); //$NON-NLS-1$ |
| newProperties<%=i%>.add(newProperty<%=i%>_<%=j%>); |
| <%}%> |
| <%j++;%> |
| <%}%> |
| newComponentClass<%=i%>.setProperties(newProperties<%=i%>); |
| <%}%> |
| m_map.put(newComponentClass<%=i%>,"<%=testerClass%>"); //$NON-NLS-1$ |
| <%}%> |
| <%i++;%> |
| <%}%> |
| } |
| |
| /** {@inheritDoc} */ |
| @NonNull public Map<ComponentClass, String> getTypeMapping() { |
| return m_map; |
| } |
| } |
| <%}%> |