From: <kum...@us...> - 2008-06-27 09:51:52
|
Revision: 6762 http://smartfrog.svn.sourceforge.net/smartfrog/?rev=6762&view=rev Author: kumaravelg Date: 2008-06-27 02:51:47 -0700 (Fri, 27 Jun 2008) Log Message: ----------- refactoring the meta model with appropriate "ROLE" names Removed Paths: ------------- trunk/core/extras/AuthoringTool/src/org/smartfrog/authoringtool/And.java trunk/core/extras/AuthoringTool/src/org/smartfrog/authoringtool/Attribute.java trunk/core/extras/AuthoringTool/src/org/smartfrog/authoringtool/AttributeValidators.java trunk/core/extras/AuthoringTool/src/org/smartfrog/authoringtool/Component.java trunk/core/extras/AuthoringTool/src/org/smartfrog/authoringtool/Composite.java trunk/core/extras/AuthoringTool/src/org/smartfrog/authoringtool/Connectors.java trunk/core/extras/AuthoringTool/src/org/smartfrog/authoringtool/DSMLEditor.java trunk/core/extras/AuthoringTool/src/org/smartfrog/authoringtool/DependencyModel.java trunk/core/extras/AuthoringTool/src/org/smartfrog/authoringtool/EMFInputDependencyProxy.java trunk/core/extras/AuthoringTool/src/org/smartfrog/authoringtool/EMFModelObject.java trunk/core/extras/AuthoringTool/src/org/smartfrog/authoringtool/EMFOutputDependencyProxy.java trunk/core/extras/AuthoringTool/src/org/smartfrog/authoringtool/EMFSimpleDependencyProxy.java trunk/core/extras/AuthoringTool/src/org/smartfrog/authoringtool/EMFSubtypeImpl.java trunk/core/extras/AuthoringTool/src/org/smartfrog/authoringtool/GemsCreationWizard.java trunk/core/extras/AuthoringTool/src/org/smartfrog/authoringtool/GemsFactory.java trunk/core/extras/AuthoringTool/src/org/smartfrog/authoringtool/GemsWizardPage.java trunk/core/extras/AuthoringTool/src/org/smartfrog/authoringtool/GraphicsProviderImpl.java trunk/core/extras/AuthoringTool/src/org/smartfrog/authoringtool/InputDependencyConnectionType.java trunk/core/extras/AuthoringTool/src/org/smartfrog/authoringtool/LabelProviderImpl.java trunk/core/extras/AuthoringTool/src/org/smartfrog/authoringtool/MementoImpl.java trunk/core/extras/AuthoringTool/src/org/smartfrog/authoringtool/Nand.java trunk/core/extras/AuthoringTool/src/org/smartfrog/authoringtool/Nor.java trunk/core/extras/AuthoringTool/src/org/smartfrog/authoringtool/Or.java trunk/core/extras/AuthoringTool/src/org/smartfrog/authoringtool/OutputDependencyConnectionType.java trunk/core/extras/AuthoringTool/src/org/smartfrog/authoringtool/Root.java trunk/core/extras/AuthoringTool/src/org/smartfrog/authoringtool/Serializer.java trunk/core/extras/AuthoringTool/src/org/smartfrog/authoringtool/SimpleDependencyConnectionType.java trunk/core/extras/AuthoringTool/src/org/smartfrog/authoringtool/SmartfrogConstraintsChecker.java trunk/core/extras/AuthoringTool/src/org/smartfrog/authoringtool/SmartfrogPaletteProvider.java trunk/core/extras/AuthoringTool/src/org/smartfrog/authoringtool/SmartfrogPlugin.java trunk/core/extras/AuthoringTool/src/org/smartfrog/authoringtool/SmartfrogProvider.java trunk/core/extras/AuthoringTool/src/org/smartfrog/authoringtool/SmartfrogVisitor.java Deleted: trunk/core/extras/AuthoringTool/src/org/smartfrog/authoringtool/And.java =================================================================== --- trunk/core/extras/AuthoringTool/src/org/smartfrog/authoringtool/And.java 2008-06-27 09:50:36 UTC (rev 6761) +++ trunk/core/extras/AuthoringTool/src/org/smartfrog/authoringtool/And.java 2008-06-27 09:51:47 UTC (rev 6762) @@ -1,299 +0,0 @@ - - -/* - * Created on Tue Jun 10 05:25:03 IST 2008 - * - * Generated by GEMS - */ - -package org.smartfrog.authoringtool; - - - -import org.gems.designer.metamodel.gen.AttributeInfo; -import org.gems.designer.model.AttributeValidator; -import org.gems.designer.ModelProvider; -import org.gems.designer.ModelRepository; -import org.gems.designer.model.Visitor; -import org.gems.designer.model.ConnectionType; -import org.gems.designer.model.Wire; -import org.eclipse.ui.views.properties.IPropertyDescriptor; - -import java.util.Vector; -import org.gems.designer.model.ModelObject; -import org.gems.designer.model.LogicElement; -import java.util.List; -import org.eclipse.emf.common.notify.Adapter; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.notify.Notifier; -import org.eclipse.draw2d.geometry.Dimension; -import org.eclipse.draw2d.geometry.Point; -import org.gems.designer.model.ModelUtilities; -import org.gems.designer.model.props.CustomProperty; -import org.gems.designer.model.props.CustomPropertyEx; -import org.gems.designer.model.props.PropertyRepository; -import org.eclipse.emf.ecore.EObject; -import org.smartfrog.authoringtool.emf.*; - -public class And extends Connectors implements Adapter, EMFModelObject, org.gems.designer.model.EMFModelElement{ - - private org.smartfrog.authoringtool.emf.And model_; - private Notifier target_; - - public And(){ - } - - public And(org.smartfrog.authoringtool.emf.And model){ - model_ = model; - super.setName(model_.getName()); - super.setID(model_.getId()); - model_.eAdapters().add(this); - } - - public org.smartfrog.authoringtool.emf.And getModel(){ - if(model_ == null){ - model_ = org.smartfrog.authoringtool.emf.impl.SmartfrogFactoryImpl.eINSTANCE.createAnd(); - super.setName(model_.getName()); - model_.eAdapters().add(this); - } - return model_; - } - - public org.smartfrog.authoringtool.emf.And getExtendedModel(){ - return getModel(); - } - - public org.smartfrog.authoringtool.emf.And getEMFObject(){ - return getModel(); - } - - - public Notifier getTarget() { - return target_; - } - - public void setTarget(Notifier newTarget) { - target_ = newTarget; - } - - public boolean isAdapterForType(Object type) { - return getModel() == type; - } - - - - - public static final IPropertyDescriptor[] AND_ATTRIBUTE_DESCRIPTORS = - { - }; - public static final Object[] AND_DEFAULT_ATTRIBUTE_VALUES = { - - }; - - - - - protected void getPropertyDescriptors(Vector desc){ - desc.addAll(java.util.Arrays.asList(AND_ATTRIBUTE_DESCRIPTORS)); - super.getPropertyDescriptors(desc); - } - - - - public String findAttributeType(String attr){ - return super.findAttributeType(attr); - } - public Object getAttribute(String attr){ - - return super.getAttribute(attr); - } - - - public void setAttribute(String attr, Object val){ - if(attr != null){ - AttributeValidator validator = AttributeValidators.getInstance().getValidator(attr); - if(validator != null && - !validator.validValue(this,attr,val)){ - return; - } - } - if(attr.equals(org.gems.designer.model.Atom.NAME)){ - getModel().setName((String)val); - } - super.setAttribute(attr,val); - } - - public void notifyChanged(Notification notification) { - int type = notification.getEventType(); - int featureId = notification.getFeatureID(SmartfrogPackage.class); - - switch(type) { - case Notification.SET: - - case Notification.ADD: - case Notification.REMOVE: - } - } - - - - - - - - - - - - - -public void connectInput(Wire w, boolean modifymodel) { - if(!modifymodel) - super.connectInput(w,modifymodel); - else - connectInput(w); -} - -public void disconnectInput(Wire w, boolean modifymodel) { - if(!modifymodel) - super.disconnectInput(w,modifymodel); - else - disconnectInput(w); -} - - - -public void connectOutput(Wire w, boolean modifymodel) { - if(!modifymodel) - super.connectOutput(w,modifymodel); - else - connectOutput(w); -} - -public void disconnectOutput(Wire w, boolean modifymodel) { - if(!modifymodel) - super.disconnectOutput(w,modifymodel); - else - disconnectOutput(w); -} - - - - - - public String getConnectionRole(ConnectionType ct, boolean src){ - - return super.getConnectionRole(ct,src); - } - - public List<String> getRelationshipRoles(){ - java.util.List<String> roles = super.getRelationshipRoles(); - - return roles; - } - - - public ConnectionType getConnectionTypeForRole(String role){ - - return super.getConnectionTypeForRole(role); - } - - public Object getRoleValue(String role){ - - - - return super.getRoleValue(role); - } - - - - public boolean isAbstract(){return false;} - - public ModelProvider getModelProvider() { - ModelProvider provider = super.getModelProvider(); - if(provider == null){ - provider = new SmartfrogProvider(); - ModelRepository.getInstance().registerModelProvider(provider); - } - return provider; - } - - protected void buildContainmentNames() { - } - - public List<String> getContainmentRoles(){ - List<String> roles = super.getContainmentRoles(); - - return roles; - } - - public Class getParentForRole(String role){ - - return super.getParentForRole(role); - } - - public String getRoleForParent(Class c){ - - return super.getRoleForParent(c); - } - -public void accept(Visitor visitor) { - if(visitor instanceof SmartfrogVisitor) - ((SmartfrogVisitor)visitor).visitAnd(this); - else - super.accept(visitor); -} - - - public void addChild(LogicElement child, int index) { - addChild(child,index,true); - } - - public void addChild(LogicElement child, int index, boolean modifymodel) { - if(modifymodel){ - } - - super.addChild(child,index,modifymodel); - - } - - public void removeChild(LogicElement child){ - removeChild(child,true); - } - - public void removeChild(LogicElement child, boolean modifymodel){ - if(modifymodel){ - - } - - super.removeChild(child,modifymodel); - - } - - - public boolean isExpanded(){ - return getExtendedModel().isExpanded(); - } - - public void setExpanded(boolean ex){ - getExtendedModel().setExpanded(ex); - super.setExpanded(ex); - } - - public Dimension getExpandSize() { - return new Dimension(getModel().getExpandedWidth(),getModel().getExpandedHeight()); - } - - public void setExpandSize(Dimension d){ - getExtendedModel().setExpandedWidth(d.width); - getExtendedModel().setExpandedHeight(d.height); - super.setExpandSize(d); - } - - public String getModelID() { - return SmartfrogProvider.MODEL_ID; - } - - -} - Deleted: trunk/core/extras/AuthoringTool/src/org/smartfrog/authoringtool/Attribute.java =================================================================== --- trunk/core/extras/AuthoringTool/src/org/smartfrog/authoringtool/Attribute.java 2008-06-27 09:50:36 UTC (rev 6761) +++ trunk/core/extras/AuthoringTool/src/org/smartfrog/authoringtool/Attribute.java 2008-06-27 09:51:47 UTC (rev 6762) @@ -1,619 +0,0 @@ - - -/* - * Created on Tue Jun 10 05:25:03 IST 2008 - * - * Generated by GEMS - */ - -package org.smartfrog.authoringtool; - - - -import org.gems.designer.metamodel.gen.AttributeInfo; -import org.gems.designer.model.AttributeValidator; -import org.gems.designer.ModelProvider; -import org.gems.designer.ModelRepository; -import org.gems.designer.model.Visitor; -import org.gems.designer.model.ConnectionType; -import org.gems.designer.model.Wire; -import org.eclipse.ui.views.properties.IPropertyDescriptor; - -import java.util.Vector; -import org.gems.designer.model.ModelObject; -import org.gems.designer.model.LogicElement; -import java.util.List; -import org.eclipse.emf.common.notify.Adapter; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.notify.Notifier; -import org.eclipse.draw2d.geometry.Dimension; -import org.eclipse.draw2d.geometry.Point; -import org.gems.designer.model.ModelUtilities; -import org.gems.designer.model.props.CustomProperty; -import org.gems.designer.model.props.CustomPropertyEx; -import org.gems.designer.model.props.PropertyRepository; -import org.eclipse.emf.ecore.EObject; -import org.smartfrog.authoringtool.emf.*; - -public class Attribute extends org.gems.designer.model.LinkedModel implements Adapter, EMFModelObject, org.gems.designer.model.EMFModelElement{ - - private org.smartfrog.authoringtool.emf.Attribute model_; - private Notifier target_; - - public Attribute(){ - } - - public Attribute(org.smartfrog.authoringtool.emf.Attribute model){ - model_ = model; - super.setName(model_.getName()); - super.setID(model_.getId()); - model_.eAdapters().add(this); - } - - public org.smartfrog.authoringtool.emf.Attribute getModel(){ - if(model_ == null){ - model_ = org.smartfrog.authoringtool.emf.impl.SmartfrogFactoryImpl.eINSTANCE.createAttribute(); - super.setName(model_.getName()); - model_.eAdapters().add(this); - } - return model_; - } - - public org.smartfrog.authoringtool.emf.Attribute getExtendedModel(){ - return getModel(); - } - - public org.smartfrog.authoringtool.emf.Attribute getEMFObject(){ - return getModel(); - } - - - public String getName(){ - return getExtendedModel().getName(); - } - - public boolean isVisible(){ - return getExtendedModel().isVisible(); - } - - - public void setVisible(boolean b){ - getExtendedModel().setVisible(b); - super.setVisible(b); - } - - public void setName(String name){ - getExtendedModel().setName(name); - super.setName(name); - } - - public String getID(){ - return getExtendedModel().getId(); - } - - public boolean isSubtype(){ - return getExtendedModel().isSubtype(); - } - - public void setSubtype(boolean b){ - getExtendedModel().setSubtype(b); - super.setSubtype(b); - } - - public void setID(String id){ - getExtendedModel().setId(id); - super.setID(id); - } - - public Point getLocation(){ - return new Point(getExtendedModel().getX(),getExtendedModel().getY()); - } - - public void setLocation(Point p) { - getExtendedModel().setX(p.x); - getExtendedModel().setY(p.y); - super.setLocation(p); - } - - public Dimension getSize() { - return new Dimension(getExtendedModel().getWidth(),getExtendedModel().getHeight()); - } - - public org.gems.designer.Subtype createSubtype(){ - return new EMFSubtypeImpl(this,getName()); - } - - public void setSize(Dimension d){ - getExtendedModel().setWidth(d.width); - getExtendedModel().setHeight(d.height); - super.setSize(d); - } - - public EObject getEMFModelElement(){ - return getEMFObject(); - } - - public String getModelLinkTarget(){ - return getExtendedModel().getModelLinkTarget(); - } - - public void setModelLinkTarget(String target){ - getExtendedModel().setModelLinkTarget(target); - super.setModelLinkTarget(target); - } - - public Notifier getTarget() { - return target_; - } - - public void setTarget(Notifier newTarget) { - target_ = newTarget; - } - - public boolean isAdapterForType(Object type) { - return getModel() == type; - } - - - - - public static final IPropertyDescriptor[] ATTRIBUTE_ATTRIBUTE_DESCRIPTORS = - { -new org.eclipse.ui.views.properties.TextPropertyDescriptor("Value","Value") - - - , -new org.eclipse.ui.views.properties.TextPropertyDescriptor("StateData","StateData") - - - , -new org.eclipse.ui.views.properties.TextPropertyDescriptor("StateListen","StateListen") - - - , -new org.eclipse.ui.views.properties.TextPropertyDescriptor("StateNotify","StateNotify") - - - , -new org.eclipse.ui.views.properties.TextPropertyDescriptor("IsLazyValue","IsLazyValue") - - - }; - public static final Object[] ATTRIBUTE_DEFAULT_ATTRIBUTE_VALUES = { - - "0" - , - new Boolean(false) - , - new Boolean(false) - , - new Boolean(false) - , - new Boolean(false) - }; - - - - - protected void getPropertyDescriptors(Vector desc){ - desc.addAll(java.util.Arrays.asList(ATTRIBUTE_ATTRIBUTE_DESCRIPTORS)); - super.getPropertyDescriptors(desc); - } - - - - private String Value_ = "0"; - private Boolean StateData_ = new Boolean(false); - private Boolean StateListen_ = new Boolean(false); - private Boolean StateNotify_ = new Boolean(false); - private Boolean IsLazyValue_ = new Boolean(false); - public String findAttributeType(String attr){ - if(attr.equals("Value")){ - return STRING_MTYPE; - } - if(attr.equals("StateData")){ - return BOOLEAN_MTYPE; - } - if(attr.equals("StateListen")){ - return BOOLEAN_MTYPE; - } - if(attr.equals("StateNotify")){ - return BOOLEAN_MTYPE; - } - if(attr.equals("IsLazyValue")){ - return BOOLEAN_MTYPE; - } - return super.findAttributeType(attr); - } - public String getValue(){ - return getModel().getValue(); - - } - public void setValue(String val){ - Object old = getValue(); - getModel().setValue(val); - - Object[] valuepair = {"Value",old}; - org.gems.designer.model.event.ModelChangeEvent event = new org.gems.designer.model.event.ModelChangeEvent(this, - org.gems.designer.model.event.ModelChangeEvent.ELEMENT_ATTRIBUTE_CHANGED,false,(Object)valuepair); - org.gems.designer.model.event.ModelEventDispatcher.dispatch(event); - - if(event.vetoed()){ - setValue((String)old); - } - } - public Boolean getStateData(){ - return getModel().isStateData(); - - } - public void setStateData(Boolean val){ - Object old = getStateData(); - getModel().setStateData(val); - - Object[] valuepair = {"StateData",old}; - org.gems.designer.model.event.ModelChangeEvent event = new org.gems.designer.model.event.ModelChangeEvent(this, - org.gems.designer.model.event.ModelChangeEvent.ELEMENT_ATTRIBUTE_CHANGED,false,(Object)valuepair); - org.gems.designer.model.event.ModelEventDispatcher.dispatch(event); - - if(event.vetoed()){ - setStateData((Boolean)old); - } - } - public Boolean getStateListen(){ - return getModel().isStateListen(); - - } - public void setStateListen(Boolean val){ - Object old = getStateListen(); - getModel().setStateListen(val); - - Object[] valuepair = {"StateListen",old}; - org.gems.designer.model.event.ModelChangeEvent event = new org.gems.designer.model.event.ModelChangeEvent(this, - org.gems.designer.model.event.ModelChangeEvent.ELEMENT_ATTRIBUTE_CHANGED,false,(Object)valuepair); - org.gems.designer.model.event.ModelEventDispatcher.dispatch(event); - - if(event.vetoed()){ - setStateListen((Boolean)old); - } - } - public Boolean getStateNotify(){ - return getModel().isStateNotify(); - - } - public void setStateNotify(Boolean val){ - Object old = getStateNotify(); - getModel().setStateNotify(val); - - Object[] valuepair = {"StateNotify",old}; - org.gems.designer.model.event.ModelChangeEvent event = new org.gems.designer.model.event.ModelChangeEvent(this, - org.gems.designer.model.event.ModelChangeEvent.ELEMENT_ATTRIBUTE_CHANGED,false,(Object)valuepair); - org.gems.designer.model.event.ModelEventDispatcher.dispatch(event); - - if(event.vetoed()){ - setStateNotify((Boolean)old); - } - } - public Boolean getIsLazyValue(){ - return getModel().isIsLazyValue(); - - } - public void setIsLazyValue(Boolean val){ - Object old = getIsLazyValue(); - getModel().setIsLazyValue(val); - - Object[] valuepair = {"IsLazyValue",old}; - org.gems.designer.model.event.ModelChangeEvent event = new org.gems.designer.model.event.ModelChangeEvent(this, - org.gems.designer.model.event.ModelChangeEvent.ELEMENT_ATTRIBUTE_CHANGED,false,(Object)valuepair); - org.gems.designer.model.event.ModelEventDispatcher.dispatch(event); - - if(event.vetoed()){ - setIsLazyValue((Boolean)old); - } - } - public Object getAttribute(String attr){ - - if(attr != null && - attr.equals("Value")){ - return getValue().toString(); - } - if(attr != null && - attr.equals("StateData")){ - return getStateData().toString(); - } - if(attr != null && - attr.equals("StateListen")){ - return getStateListen().toString(); - } - if(attr != null && - attr.equals("StateNotify")){ - return getStateNotify().toString(); - } - if(attr != null && - attr.equals("IsLazyValue")){ - return getIsLazyValue().toString(); - } - return super.getAttribute(attr); - } - - - public void setAttribute(String attr, Object val){ - if(attr != null){ - AttributeValidator validator = AttributeValidators.getInstance().getValidator(attr); - if(validator != null && - !validator.validValue(this,attr,val)){ - return; - } - } - if(attr.equals(org.gems.designer.model.Atom.NAME)){ - getModel().setName((String)val); - } - if(attr != null && - attr.equals("Value")){ - setValue(new String((String)val)); - } - else if(attr != null && - attr.equals("StateData")){ - setStateData(new Boolean((String)val)); - } - else if(attr != null && - attr.equals("StateListen")){ - setStateListen(new Boolean((String)val)); - } - else if(attr != null && - attr.equals("StateNotify")){ - setStateNotify(new Boolean((String)val)); - } - else if(attr != null && - attr.equals("IsLazyValue")){ - setIsLazyValue(new Boolean((String)val)); - } - else { - super.setAttribute(attr,val); } - } - - public void notifyChanged(Notification notification) { - int type = notification.getEventType(); - int featureId = notification.getFeatureID(SmartfrogPackage.class); - - switch(type) { - case Notification.SET: - - switch(featureId) { - case SmartfrogPackage.ATTRIBUTE__VALUE : - firePropertyChange(ATTRIBUTE_PREFIX+"Value", notification.getOldStringValue(), notification.getNewStringValue()); - break; - } - - switch(featureId) { - case SmartfrogPackage.ATTRIBUTE__STATE_DATA : - firePropertyChange(ATTRIBUTE_PREFIX+"StateData", notification.getOldBooleanValue(), notification.getNewBooleanValue()); - break; - } - - switch(featureId) { - case SmartfrogPackage.ATTRIBUTE__STATE_LISTEN : - firePropertyChange(ATTRIBUTE_PREFIX+"StateListen", notification.getOldBooleanValue(), notification.getNewBooleanValue()); - break; - } - - switch(featureId) { - case SmartfrogPackage.ATTRIBUTE__STATE_NOTIFY : - firePropertyChange(ATTRIBUTE_PREFIX+"StateNotify", notification.getOldBooleanValue(), notification.getNewBooleanValue()); - break; - } - - switch(featureId) { - case SmartfrogPackage.ATTRIBUTE__IS_LAZY_VALUE : - firePropertyChange(ATTRIBUTE_PREFIX+"IsLazyValue", notification.getOldBooleanValue(), notification.getNewBooleanValue()); - break; - } - - case Notification.ADD: - case Notification.REMOVE: - } - } - - - - - - - - - - - - - -public void connectInput(Wire w, boolean modifymodel) { - if(!modifymodel) - super.connectInput(w); - else - connectInput(w); -} - -public void disconnectInput(Wire w, boolean modifymodel) { - if(!modifymodel) - super.disconnectInput(w); - else - disconnectInput(w); -} - - - -public void connectOutput(Wire w, boolean modifymodel) { - if(!modifymodel) - super.connectOutput(w); - else - connectOutput(w); -} - -public void disconnectOutput(Wire w, boolean modifymodel) { - if(!modifymodel) - super.disconnectOutput(w); - else - disconnectOutput(w); -} - - - - - - public String getConnectionRole(ConnectionType ct, boolean src){ - - return super.getConnectionRole(ct,src); - } - - public List<String> getRelationshipRoles(){ - java.util.List<String> roles = super.getRelationshipRoles(); - - return roles; - } - - - public ConnectionType getConnectionTypeForRole(String role){ - - return super.getConnectionTypeForRole(role); - } - - public Object getRoleValue(String role){ - - - if("Attributes".equalsIgnoreCase(role)){ - return getAttributes(); - } - - if("Composite_arrtibutes".equalsIgnoreCase(role)){ - return getComposite_arrtibutes(); - } - - - return super.getRoleValue(role); - } - - - public Component getAttributes(){ - if(getParent() instanceof Component){ - return (Component)getParent(); - } - return null; - } - - public Composite getComposite_arrtibutes(){ - if(getParent() instanceof Composite){ - return (Composite)getParent(); - } - return null; - } - - - public boolean isAbstract(){return false;} - - public ModelProvider getModelProvider() { - ModelProvider provider = super.getModelProvider(); - if(provider == null){ - provider = new SmartfrogProvider(); - ModelRepository.getInstance().registerModelProvider(provider); - } - return provider; - } - - protected void buildContainmentNames() { - } - - public List<String> getContainmentRoles(){ - List<String> roles = super.getContainmentRoles(); - - roles.add("Attributes"); - - roles.add("Composite_arrtibutes"); - - return roles; - } - - public Class getParentForRole(String role){ - - if("Attributes".equals(role)){ - return Component.class; - } - - if("Composite_arrtibutes".equals(role)){ - return Composite.class; - } - - return super.getParentForRole(role); - } - - public String getRoleForParent(Class c){ - - if(Component.class.isAssignableFrom(c)){ - return "Attributes"; - } - - if(Composite.class.isAssignableFrom(c)){ - return "Composite_arrtibutes"; - } - - return super.getRoleForParent(c); - } - -public void accept(Visitor visitor) { - if(visitor instanceof SmartfrogVisitor) - ((SmartfrogVisitor)visitor).visitAttribute(this); - else - super.accept(visitor); -} - - - public void addChild(LogicElement child, int index) { - addChild(child,index,true); - } - - public void addChild(LogicElement child, int index, boolean modifymodel) { - if(modifymodel){ - } - - super.addChild(child,index); - - } - - public void removeChild(LogicElement child){ - removeChild(child,true); - } - - public void removeChild(LogicElement child, boolean modifymodel){ - if(modifymodel){ - - } - - super.removeChild(child); - - } - - - public boolean isExpanded(){ - return getExtendedModel().isExpanded(); - } - - public void setExpanded(boolean ex){ - getExtendedModel().setExpanded(ex); - super.setExpanded(ex); - } - - public Dimension getExpandSize() { - return new Dimension(getModel().getExpandedWidth(),getModel().getExpandedHeight()); - } - - public void setExpandSize(Dimension d){ - getExtendedModel().setExpandedWidth(d.width); - getExtendedModel().setExpandedHeight(d.height); - super.setExpandSize(d); - } - - public String getModelID() { - return SmartfrogProvider.MODEL_ID; - } - - -} - Deleted: trunk/core/extras/AuthoringTool/src/org/smartfrog/authoringtool/AttributeValidators.java =================================================================== --- trunk/core/extras/AuthoringTool/src/org/smartfrog/authoringtool/AttributeValidators.java 2008-06-27 09:50:36 UTC (rev 6761) +++ trunk/core/extras/AuthoringTool/src/org/smartfrog/authoringtool/AttributeValidators.java 2008-06-27 09:51:47 UTC (rev 6762) @@ -1,39 +0,0 @@ -/****************************************************************************** - * Copyright (c) 2005, 2006 Jules White. - * 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: - * Jules White - initial API and implementation - ****************************************************************************/ - - -package org.smartfrog.authoringtool; - - -import org.gems.designer.model.ModelObject; - - - -public class AttributeValidators extends org.gems.designer.model.AttributeValidators { - - private static AttributeValidators instance_ = new AttributeValidators(); - - public static AttributeValidators getInstance() { - return instance_; - } - /** - * - */ - private AttributeValidators() { - super(); - } - - - public void createValidators() { - - super.createValidators(); - } -} Deleted: trunk/core/extras/AuthoringTool/src/org/smartfrog/authoringtool/Component.java =================================================================== --- trunk/core/extras/AuthoringTool/src/org/smartfrog/authoringtool/Component.java 2008-06-27 09:50:36 UTC (rev 6761) +++ trunk/core/extras/AuthoringTool/src/org/smartfrog/authoringtool/Component.java 2008-06-27 09:51:47 UTC (rev 6762) @@ -1,637 +0,0 @@ - - -/* - * Created on Tue Jun 10 05:25:03 IST 2008 - * - * Generated by GEMS - */ - -package org.smartfrog.authoringtool; - - - -import org.gems.designer.metamodel.gen.AttributeInfo; -import org.gems.designer.model.AttributeValidator; -import org.gems.designer.ModelProvider; -import org.gems.designer.ModelRepository; -import org.gems.designer.model.Visitor; -import org.gems.designer.model.ConnectionType; -import org.gems.designer.model.Wire; -import org.eclipse.ui.views.properties.IPropertyDescriptor; - -import java.util.Vector; -import org.gems.designer.model.ModelObject; -import org.gems.designer.model.LogicElement; -import java.util.List; -import org.eclipse.emf.common.notify.Adapter; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.notify.Notifier; -import org.eclipse.draw2d.geometry.Dimension; -import org.eclipse.draw2d.geometry.Point; -import org.gems.designer.model.ModelUtilities; -import org.gems.designer.model.props.CustomProperty; -import org.gems.designer.model.props.CustomPropertyEx; -import org.gems.designer.model.props.PropertyRepository; -import org.eclipse.emf.ecore.EObject; -import org.smartfrog.authoringtool.emf.*; - -public class Component extends org.gems.designer.model.LinkedModel implements Adapter, EMFModelObject, org.gems.designer.model.EMFModelElement{ - - private org.smartfrog.authoringtool.emf.Component model_; - private Notifier target_; - - public Component(){ - } - - public Component(org.smartfrog.authoringtool.emf.Component model){ - model_ = model; - super.setName(model_.getName()); - super.setID(model_.getId()); - model_.eAdapters().add(this); - } - - public org.smartfrog.authoringtool.emf.Component getModel(){ - if(model_ == null){ - model_ = org.smartfrog.authoringtool.emf.impl.SmartfrogFactoryImpl.eINSTANCE.createComponent(); - super.setName(model_.getName()); - model_.eAdapters().add(this); - } - return model_; - } - - public org.smartfrog.authoringtool.emf.Component getExtendedModel(){ - return getModel(); - } - - public org.smartfrog.authoringtool.emf.Component getEMFObject(){ - return getModel(); - } - - - public String getName(){ - return getExtendedModel().getName(); - } - - public boolean isVisible(){ - return getExtendedModel().isVisible(); - } - - - public void setVisible(boolean b){ - getExtendedModel().setVisible(b); - super.setVisible(b); - } - - public void setName(String name){ - getExtendedModel().setName(name); - super.setName(name); - } - - public String getID(){ - return getExtendedModel().getId(); - } - - public boolean isSubtype(){ - return getExtendedModel().isSubtype(); - } - - public void setSubtype(boolean b){ - getExtendedModel().setSubtype(b); - super.setSubtype(b); - } - - public void setID(String id){ - getExtendedModel().setId(id); - super.setID(id); - } - - public Point getLocation(){ - return new Point(getExtendedModel().getX(),getExtendedModel().getY()); - } - - public void setLocation(Point p) { - getExtendedModel().setX(p.x); - getExtendedModel().setY(p.y); - super.setLocation(p); - } - - public Dimension getSize() { - return new Dimension(getExtendedModel().getWidth(),getExtendedModel().getHeight()); - } - - public org.gems.designer.Subtype createSubtype(){ - return new EMFSubtypeImpl(this,getName()); - } - - public void setSize(Dimension d){ - getExtendedModel().setWidth(d.width); - getExtendedModel().setHeight(d.height); - super.setSize(d); - } - - public EObject getEMFModelElement(){ - return getEMFObject(); - } - - public String getModelLinkTarget(){ - return getExtendedModel().getModelLinkTarget(); - } - - public void setModelLinkTarget(String target){ - getExtendedModel().setModelLinkTarget(target); - super.setModelLinkTarget(target); - } - - public Notifier getTarget() { - return target_; - } - - public void setTarget(Notifier newTarget) { - target_ = newTarget; - } - - public boolean isAdapterForType(Object type) { - return getModel() == type; - } - - - - - public static final IPropertyDescriptor[] COMPONENT_ATTRIBUTE_DESCRIPTORS = - { - }; - public static final Object[] COMPONENT_DEFAULT_ATTRIBUTE_VALUES = { - - }; - - - - - protected void getPropertyDescriptors(Vector desc){ - desc.addAll(java.util.Arrays.asList(COMPONENT_ATTRIBUTE_DESCRIPTORS)); - super.getPropertyDescriptors(desc); - } - - - - public String findAttributeType(String attr){ - return super.findAttributeType(attr); - } - public Object getAttribute(String attr){ - - return super.getAttribute(attr); - } - - - public void setAttribute(String attr, Object val){ - if(attr != null){ - AttributeValidator validator = AttributeValidators.getInstance().getValidator(attr); - if(validator != null && - !validator.validValue(this,attr,val)){ - return; - } - } - if(attr.equals(org.gems.designer.model.Atom.NAME)){ - getModel().setName((String)val); - } - super.setAttribute(attr,val); - } - - public void notifyChanged(Notification notification) { - int type = notification.getEventType(); - int featureId = notification.getFeatureID(SmartfrogPackage.class); - - switch(type) { - case Notification.SET: - - case Notification.ADD: - case Notification.REMOVE: - } - } - - - - - public List<Component> getDepends_By(){ - return (List<Component>)ModelUtilities.getConnectedTargets(this,Component.class,SimpleDependencyConnectionType.INSTANCE); - } - - public List<Connectors> getBy(){ - return (List<Connectors>)ModelUtilities.getConnectedTargets(this,Connectors.class,InputDependencyConnectionType.INSTANCE); - } - - - - public List<Component> getDependOn(){ - return (List<Component>)ModelUtilities.getConnectedSources(this,Component.class,SimpleDependencyConnectionType.INSTANCE); - } - - public List<Connectors> getOn(){ - return (List<Connectors>)ModelUtilities.getConnectedSources(this,Connectors.class,OutputDependencyConnectionType.INSTANCE); - } - - -@Override -public void connectOutput(Wire w) { - - ConnectionType type = w.getConnectionType(); - if(type != null){ - - - if(type.getName().equals(SimpleDependencyConnectionType.NAME)){ - - org.smartfrog.authoringtool.Root r = (org.smartfrog.authoringtool.Root)ModelRepository.getInstance().getInstanceRepository().getInstance(getModelInstanceID()).getRoot(); - if(r != null) - r.addConnection(w); - SimpleDependencyConnection con = (SimpleDependencyConnection)w.getAttribute(SimpleDependencyConnectionType.NAME); - if(con != null){ - con.setSource(getModel()); - - getModel().getDepends_By().add(con); - - } - - } - - - if(type.getName().equals(InputDependencyConnectionType.NAME)){ - - getModel().getBy().add(((EMFModelObject)w.getTarget()).getEMFObject()); - - } - - } - super.connectOutput(w); -} - -@Override -public void connectInput(Wire w) { - - ConnectionType type = w.getConnectionType(); - if(type != null){ - - - if(type.getName().equals(SimpleDependencyConnectionType.NAME)){ - - org.smartfrog.authoringtool.Root r = (org.smartfrog.authoringtool.Root)ModelRepository.getInstance().getInstanceRepository().getInstance(getModelInstanceID()).getRoot(); - if(r != null) - r.addConnection(w); - - SimpleDependencyConnection con = (SimpleDependencyConnection)w.getAttribute(SimpleDependencyConnectionType.NAME); - if(con != null){ - con.setTarget(getModel()); - - getModel().setDependOn(con); - - } - - } - - - if(type.getName().equals(OutputDependencyConnectionType.NAME)){ - - getModel().getOn().add(((EMFModelObject)w.getSource()).getEMFObject()); - - } - - } - super.connectInput(w); -} - -@Override -public void disconnectInput(Wire w) { - - ConnectionType type = w.getConnectionType(); - if(type != null){ - - - if(type.getName().equals(SimpleDependencyConnectionType.NAME)){ - - ((org.smartfrog.authoringtool.Root)ModelRepository.getInstance().getInstanceRepository().getInstance(getModelInstanceID()).getRoot()).removeConnection(w); - SimpleDependencyConnection con = (SimpleDependencyConnection)w.getAttribute(SimpleDependencyConnectionType.NAME); - if(con != null){ - con.setTarget(null); - - getModel().setDependOn(null); - - } - - } - - - if(type.getName().equals(OutputDependencyConnectionType.NAME)){ - - getModel().getOn().remove(((EMFModelObject)w.getSource()).getEMFObject()); - - } - - } - super.disconnectInput(w); -} - - -@Override -public void disconnectOutput(Wire w) { - - ConnectionType type = w.getConnectionType(); - if(type != null){ - - if(type.getName().equals(SimpleDependencyConnectionType.NAME)){ - ((org.smartfrog.authoringtool.Root)ModelRepository.getInstance().getInstanceRepository().getInstance(getModelInstanceID()).getRoot()).removeConnection(w); - SimpleDependencyConnection con = (SimpleDependencyConnection)w.getAttribute(SimpleDependencyConnectionType.NAME); - - if(con != null){ - con.setSource(null); - - getModel().getDepends_By().remove(con); - - } - - } - - if(type.getName().equals(InputDependencyConnectionType.NAME)){ - ((org.smartfrog.authoringtool.Root)ModelRepository.getInstance().getInstanceRepository().getInstance(getModelInstanceID()).getRoot()).removeConnection(w); - InputDependencyConnection con = (InputDependencyConnection)w.getAttribute(InputDependencyConnectionType.NAME); - - getModel().getBy().remove(((EMFModelObject)w.getTarget()).getEMFObject()); - - } - - } - super.disconnectOutput(w); -} - - -public void connectInput(Wire w, boolean modifymodel) { - if(!modifymodel) - super.connectInput(w); - else - connectInput(w); -} - -public void disconnectInput(Wire w, boolean modifymodel) { - if(!modifymodel) - super.disconnectInput(w); - else - disconnectInput(w); -} - - - -public void connectOutput(Wire w, boolean modifymodel) { - if(!modifymodel) - super.connectOutput(w); - else - connectOutput(w); -} - -public void disconnectOutput(Wire w, boolean modifymodel) { - if(!modifymodel) - super.disconnectOutput(w); - else - disconnectOutput(w); -} - - - - - - public String getConnectionRole(ConnectionType ct, boolean src){ - - if(ct instanceof SimpleDependencyConnectionType && src){ - return "Depends_By"; - } - - if(ct instanceof InputDependencyConnectionType && src){ - return "By"; - } - - if(ct instanceof SimpleDependencyConnectionType && !src){ - return "DependOn"; - } - - if(ct instanceof OutputDependencyConnectionType && !src){ - return "On"; - } - - return super.getConnectionRole(ct,src); - } - - public List<String> getRelationshipRoles(){ - java.util.List<String> roles = super.getRelationshipRoles(); - - roles.add("Depends_By"); - - roles.add("By"); - - roles.add("DependOn"); - - roles.add("On"); - - return roles; - } - - - public ConnectionType getConnectionTypeForRole(String role){ - - if("Depends_By".equalsIgnoreCase(role)){ - return SimpleDependencyConnectionType.INSTANCE; - } - - if("By".equalsIgnoreCase(role)){ - return InputDependencyConnectionType.INSTANCE; - } - - if("DependOn".equalsIgnoreCase(role)){ - return SimpleDependencyConnectionType.INSTANCE; - } - - if("On".equalsIgnoreCase(role)){ - return OutputDependencyConnectionType.INSTANCE; - } - - return super.getConnectionTypeForRole(role); - } - - public Object getRoleValue(String role){ - - if("Depends_By".equalsIgnoreCase(role)){ - return getDepends_By(); - } - - if("By".equalsIgnoreCase(role)){ - return getBy(); - } - - if("DependOn".equalsIgnoreCase(role)){ - return getDependOn(); - } - - if("On".equalsIgnoreCase(role)){ - return getOn(); - } - - - if("Group_of_components".equalsIgnoreCase(role)){ - return getGroup_of_components(); - } - - if("Comps".equalsIgnoreCase(role)){ - return getComps(); - } - - - if("Comp".equalsIgnoreCase(role)){ - return getComp(); - } - - return super.getRoleValue(role); - } - - - public Composite getGroup_of_components(){ - if(getParent() instanceof Composite){ - return (Composite)getParent(); - } - return null; - } - - public DependencyModel getComps(){ - if(getParent() instanceof DependencyModel){ - return (DependencyModel)getParent(); - } - return null; - } - - - public boolean isAbstract(){return false;} - - public ModelProvider getModelProvider() { - ModelProvider provider = super.getModelProvider(); - if(provider == null){ - provider = new SmartfrogProvider(); - ModelRepository.getInstance().registerModelProvider(provider); - } - return provider; - } - - protected void buildContainmentNames() { - containmentNames_.put(Attribute.class,"Comp"); - containmentNames_.put("Comp",Attribute.class); - childContainmentNames_.put(Attribute.class,"Attributes"); - } - - public List<String> getContainmentRoles(){ - List<String> roles = super.getContainmentRoles(); - - roles.add("Group_of_components"); - - roles.add("Comps"); - - return roles; - } - - public Class getParentForRole(String role){ - - if("Group_of_components".equals(role)){ - return Composite.class; - } - - if("Comps".equals(role)){ - return DependencyModel.class; - } - - return super.getParentForRole(role); - } - - public String getRoleForParent(Class c){ - - if(Composite.class.isAssignableFrom(c)){ - return "Group_of_components"; - } - - if(DependencyModel.class.isAssignableFrom(c)){ - return "Comps"; - } - - return super.getRoleForParent(c); - } - -public void accept(Visitor visitor) { - if(visitor instanceof SmartfrogVisitor) - ((SmartfrogVisitor)visitor).visitComponent(this); - else - super.accept(visitor); -} - - - public void addChild(LogicElement child, int index) { - addChild(child,index,true); - } - - public void addChild(LogicElement child, int index, boolean modifymodel) { - if(modifymodel){ - if(child instanceof Attribute){ - org.smartfrog.authoringtool.emf.Attribute ceobj = ((Attribute)child).getEMFObject(); - getModel().getComp().add(ceobj); - ceobj.setAttributes(getModel()); - } - - } - - super.addChild(child,index); - - } - - public void removeChild(LogicElement child){ - removeChild(child,true); - } - - public void removeChild(LogicElement child, boolean modifymodel){ - if(modifymodel){ - - if(child instanceof Attribute){ - org.smartfrog.authoringtool.emf.Attribute ceobj = ((Attribute)child).getEMFObject(); - getModel().getComp().remove(ceobj); - ceobj.setAttributes(null); - } - - } - - super.removeChild(child); - - } - - /** - * Returns any children of type Attribute.class. - */ - public List<Attribute> getComp(){ - return (List<Attribute>)listChildrenOfType(Attribute.class); - } - - public boolean isExpanded(){ - return getExtendedModel().isExpanded(); - } - - public void setExpanded(boolean ex){ - getExtendedModel().setExpanded(ex); - super.setExpanded(ex); - } - - public Dimension getExpandSize() { - return new Dimension(getModel().getExpandedWidth(),getModel().getExpandedHeight()); - } - - public void setExpandSize(Dimension d){ - getExtendedModel().setExpandedWidth(d.width); - getExtendedModel().setExpandedHeight(d.height); - super.setExpandSize(d); - } - - public String getModelID() { - return SmartfrogProvider.MODEL_ID; - } - - -} - Deleted: trunk/core/extras/AuthoringTool/src/org/smartfrog/authoringtool/Composite.java =================================================================== --- trunk/core/extras/AuthoringTool/src/org/smartfrog/authoringtool/Composite.java 2008-06-27 09:50:36 UTC (rev 6761) +++ trunk/core/extras/AuthoringTool/src/org/smartfrog/authoringtool/Composite.java 2008-06-27 09:51:47 UTC (rev 6762) @@ -1,515 +0,0 @@ - - -/* - * Created on Tue Jun 10 05:25:03 IST 2008 - * - * Generated by GEMS - */ - -package org.smartfrog.authoringtool; - - - -import org.gems.designer.metamodel.gen.AttributeInfo; -import org.gems.designer.model.AttributeValidator; -import org.gems.designer.ModelProvider; -import org.gems.designer.ModelRepository; -import org.gems.designer.model.Visitor; -import org.gems.designer.model.ConnectionType; -import org.gems.designer.model.Wire; -import org.eclipse.ui.views.properties.IPropertyDescriptor; - -import java.util.Vector; -import org.gems.designer.model.ModelObject; -import org.gems.designer.model.LogicElement; -import java.util.List; -import org.eclipse.emf.common.notify.Adapter; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.notify.Notifier; -import org.eclipse.draw2d.geometry.Dimension; -import org.eclipse.draw2d.geometry.Point; -import org.gems.designer.model.ModelUtilities; -import org.gems.designer.model.props.CustomProperty; -import org.gems.designer.model.props.CustomPropertyEx; -import org.gems.designer.model.props.PropertyRepository; -import org.eclipse.emf.ecore.EObject; -import org.smartfrog.authoringtool.emf.*; - -public class Composite extends org.gems.designer.model.LinkedModel implements Adapter, EMFModelObject, org.gems.designer.model.EMFModelElement{ - - private org.smartfrog.authoringtool.emf.Composite model_; - private Notifier target_; - - public Composite(){ - } - - public Composite(org.smartfrog.authoringtool.emf.Composite model){ - model_ = model; - super.setName(model_.getName()); - super.setID(model_.getId()); - model_.eAdapters().add(this); - } - - public org.smartfrog.authoringtool.emf.Composite getModel(){ - if(model_ == null){ - model_ = org.smartfrog.authoringtool.emf.impl.SmartfrogFactoryImpl.eINSTANCE.createComposite(); - super.setName(model_.getName()); - model_.eAdapters().add(this); - } - return model_; - } - - public org.smartfrog.authoringtool.emf.Composite getExtendedModel(){ - return getModel(); - } - - public org.smartfrog.authoringtool.emf.Composite getEMFObject(){ - return getModel(); - } - - - public String getName(){ - return getExtendedModel().getName(); - } - - public boolean isVisible(){ - return getExtendedModel().isVisible(); - } - - - public void setVisible(boolean b){ - getExtendedModel().setVisible(b); - super.setVisible(b); - } - - public void setName(String name){ - getExtendedModel().setName(name); - super.setName(name); - } - - public String getID(){ - return getExtendedModel().getId(); - } - - public boolean isSubtype(){ - return getExtendedModel().isSubtype(); - } - - public void setSubtype(boolean b){ - getExtendedModel().setSubtype(b); - super.setSubtype(b); - } - - public void setID(String id){ - getExtendedModel().setId(id); - super.setID(id); - } - - public Point getLocation(){ - return new Point(getExtendedModel().getX(),getExtendedModel().getY()); - } - - public void setLocation(Point p) { - getExtendedModel().setX(p.x); - getExtendedModel().setY(p.y); - super.setLocation(p); - } - - public Dimension getSize() { - return new Dimension(getExtendedModel().getWidth(),getExtendedModel().getHeight()); - } - - public org.gems.designer.Subtype createSubtype(){ - return new EMFSubtypeImpl(this,getName()); - } - - public void setSize(Dimension d){ - getExtendedModel().setWidth(d.width); - getExtendedModel().setHeight(d.height); - super.setSize(d); - } - - public EObject getEMFModelElement(){ - return getEMFObject(); - } - - public String getModelLinkTarget(){ - return getExtendedModel().getModelLinkTarget(); - } - - public void setModelLinkTarget(String target){ - getExtendedModel().setModelLinkTarget(target); - super.setModelLinkTarget(target); - } - - public Notifier getTarget() { - return target_; - } - - public void setTarget(Notifier newTarget) { - target_ = newTarget; - } - - public boolean isAdapterForType(Object type) { - return getModel() == type; - } - - - - - public static final IPropertyDescriptor[] COMPOSITE_ATTRIBUTE_DESCRIPTORS = - { - }; - public static final Object[] COMPOSITE_DEFAULT_ATTRIBUTE_VALUES = { - - }; - - - - - protected void getPropertyDescriptors(Vector desc){ - desc.addAll(java.util.Arrays.asList(COMPOSITE_ATTRIBUTE_DESCRIPTORS)); - super.getPropertyDescriptors(desc); - } - - - - public String findAttributeType(String attr){ - return super.findAttributeType(attr); - } - public Object getAttribute(String attr){ - - return super.getAttribute(attr); - } - - - public void setAttribute(String attr, Object val){ - if(attr != null){ - AttributeValidator validator = AttributeValidators.getInstance().getValidator(attr); - if(validator != null && - !validator.validValue(this,attr,val)){ - return; - } - } - if(attr.equals(org.gems.designer.model.Atom.NAME)){ - getModel().setName((String)val); - } - super.setAttribute(attr,val); - } - - public void notifyChanged(Notification notification) { - int type = notification.getEventType(); - int featureId = notification.getFeatureID(SmartfrogPackage.class); - - switch(type) { - case Notification.SET: - - case Notification.ADD: - case Notification.REMOVE: - } - } - - - - - - - - - - - - - -public void connectInput(Wire w, boolean modifymodel) { - if(!modifymodel) - super.connectInput(w); - else - connectInput(w); -} - -public void disconnectInput(Wire w, boolean modifymodel) { - if(!modifymodel) - super.disconnectInput(w); - else - disconnectInput(w); -} - - - -public void connectOutput(Wire w, boolean modifymodel) { - if(!modifymodel) - super.connectOutput(w); - else - connectOutput(w); -} - -public void disconnectOutput(Wire w, boolean modifymodel) { - if(!modifymodel) - super.disconnectOutput(w); - else - disconnectOutput(w); -} - - - - - - public String getConnectionRole(ConnectionType ct, boolean src){ - - return super.getConnectionRole(ct,src); - } - - public List<String> getRelationshipRoles(){ - java.util.List<String> roles = super.getRelationshipRoles(); - - return roles; - } - - - public ConnectionType getConnectionTypeForRole(String role){ - - return super.getConnectionTypeForRole(role); - } - - public Object getRoleValue(String role){ - - - if("ChildComposite".equalsIgnoreCase(role)){ - return getChildComposite(); - } - - if("Composites".equalsIgnoreCase(role)){ - return getComposites(); - } - - - if("SuperComposite".equalsIgnoreCase(role)){ - return getSuperComposite(); - } - - if("Components".equalsIgnoreCase(role)){ - return getComponents(); - } - - if("Compos".equalsIgnoreCase(role)){ - return getCompos(); - } - - if("Compo".equalsIgnoreCase(role)){ - return getCompo(); - } - - return super.getRoleValue(role); - } - - - public Composite getChildComposite(){ - if(getParent() instanceof Composite){ - return (Composite)getParent(); - } - return null; - } - - public DependencyModel getComposites(){ - if(getParent() instanceof DependencyModel){ - return (DependencyModel)getParent(); - } - return null; - } - - - public boolean isAbstract(){return false;} - - public ModelProvider getModelProvider() { - ModelProvider provider = super.getModelProvider(); - if(provider == null){ - provider = new SmartfrogProvider(); - ModelRepository.getInstance().registerModelProvider(provider); - } - return provider; - } - - protected void buildContainmentNames() { - containmentNames_.put(Composite.class,"SuperComposite"); - containmentNames_.put("SuperComposite",Composite.class); - childContainmentNames_.put(Composite.class,"ChildComposite"); - containmentNames_.put(Component.class,"Components"); - containmentNames_.put("Components",Component.class); - childContainmentNames_.put(Component.class,"Group_of_components"); - containmentNames_.put(Attribute.class,"Compos"); - containmentNames_.put("Compos",Attribute.class); - childContainmentNames_.put(Attribute.class,"Composite_arrtibutes"); - containmentNames_.put(Connectors.class,"Compo"); - containmentNames_.put("Compo",Connectors.class); - childContainmentNames_.put(Connectors.class,"DepConnector"); - } - - public List<String> getContainmentRoles(){ - List<String> roles = super.getContainmentRoles(); - - roles.add("ChildComposite"); - - roles.add("Composites"); - - return roles; - } - - public Class getParentForRole(String role){ - - if("ChildComposite".equals(role)){ - return Composite.class; - } - - if("Composites".equals(role)){ - return DependencyModel.class; - } - - return super.getParentForRole(role); - } - - public String getRoleForParent(Class c){ - - if(Composite.class.isAssignableFrom(c)){ - return "ChildComposite"; - } - - if(DependencyModel.class.isAssignableFrom(c)){ - return "Composites"; - } - - return super.getRoleForParent(c); - } - -public void accept(Visitor visitor) { - if(visitor instanceof SmartfrogVisitor) - ((SmartfrogVisitor)visitor).visitComposite(this); - else - super.accept(visitor); -} - - - public void addChild(LogicElement child, int index) { - addChild(child,index,true); - } - - public void addChild(LogicElement child, int index, boolean modifymodel) { - if(modifymodel){ - if(child instanceof Composite){ - org.smartfrog.authoringtool.emf.Composite ceobj = ((Composite)child).getEMFObject(); - getModel().getSuperComposite().add(ceobj); - ceobj.setChildComposite(getModel()); - } - - if(child instanceof Component){ - org.smartfrog.authoringtool.emf.Component ceobj = ((Component)child).getEMFObject(); - getModel().getComponents().add(ceobj); - ceobj.setGroup_of_components(getModel()); - } - - if(child instanceof Attribute){ - org.smartfrog.authoringtool.emf.Attribute ceobj = ((Attribute)child).getEMFObject(); - getModel().getCompos().add(ceobj); - ceobj.setComposite_arrtibutes(getModel()); - } - - if(child instanceof Connectors){ - org.smartfrog.authoringtool.emf.Connectors ceobj = ((Connectors)child).getEMFObject(); - getModel().getCompo().add(ceobj); - ceobj.setDepConnector(getModel()); - } - - } - - super.addChild(child,index); - - } - - public void removeChild(LogicElement child){ - removeChild(child,true); - } - - public void removeChild(LogicElement child, boolean modifymodel){ - if(modifymodel){ - - if(child instanceof Composite){ - org.smartfrog.authoringtool.emf.Composite ceobj = ((Composite)child).getEMFObject(); - getModel().getSuperComposite().remove(ceobj); - ceobj.setChildComposite(null); - } - - if(child instanceof Component){ - org.smartfrog.authoringtool.emf.Component ceobj = ((Component)child).getEMFObject(); - getModel().getComponents().remove(ceobj); - ceobj.setGroup_of_components(null); - } - - if(child instanceof Attribute){ - org.smartfrog.authoringtool.emf.Attribute ceobj = ((Attribute)child).getEMFObject(); - getModel().getCompos().remove(ceobj); - ceobj.setComposite_arrtibutes(null); - } - - if(child instanceof Connectors){ - org.smartfrog.authoringtool.emf.Connectors ceobj = ((Connectors)child).getEMFObject(); - getModel().getCompo().remove(ceobj); - ceobj.setDepConnector(null); - } - - } - - super.removeChild(child); - - } - - /** - * Returns any children of type Composite.class. - */ - public List<Composite> getSuperComposite(){ - return (List<Composite>)listChildrenOfType(Composite.class); - } - /** - * Returns any children of type Component.class. - */ - public List<Component> getComponents(){ - return (List<Component>)listChildrenOfType(Component.class); - } - /** - * Returns any children of type Attribute.class. - */ - public List<Attribute> getCompos(){ - return (List<Attribute>)listChildrenOfType(Attribute.class); - } - /** - * Returns any children of type Connectors.class. - */ - public List<Connectors> getCompo(){ - return (List<Connectors>)listChildrenOfType(Connectors.class); - } - - public boolean isExpanded(){ - return getExtendedModel().isExpanded(); - } - - public void setExpanded(boolean ex){ - getExtendedModel().setExpanded(ex); - super.setExpanded(ex); - } - - public Dimension getExpandSize() { - return new Dimension(getModel().getExpandedWidth(),getModel().getExpandedHeight()); - } - - public void setExpandSize(Dimension d){ - getExtendedModel().setExpandedWidth(d.width); - getExtendedModel().setExpandedHeight(d... [truncated message content] |