templates.objects.xml Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of core Show documentation
Show all versions of core Show documentation
The INGENIAS Meta-Editor core. It is a set of facilities to generate an editor from a detailed xml description
@@@program xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../plantilla.xsd"@@@ @@@repeat id="objects"@@@ @@@!-- ************************* --@@@ @@@!-- meta-class representation --@@@ @@@!-- ************************* --@@@ @@@saveto@@@ @@@file overwrite="yes"@@@@@@v@@@jadeproject@@@/v@@@/target/generated/src/main/java/ingenias/editor/entities/@@@v@@@object@@@/v@@@.java@@@/file@@@ @@@text@@@ /** * Copyright (C) 2010 Jorge J. Gomez-Sanz * * * This file is part of the INGENME tool. INGENME is an open source meta-editor * which produces customized editors for user-defined modeling languages * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation version 3 of the License * * This program 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. See the * GNU General Public License for more details. * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/> **/ package ingenias.editor.entities; import java.util.*; import ingenias.editor.TypedVector; public class @@@v@@@object@@@/v@@@ extends @@@v@@@parent@@@/v@@@ { @@@repeat id="attributes"@@@ public @@@v@@@type@@@/v@@@ @@@v@@@name@@@/v@@@; @@@/repeat@@@ @@@repeat id="collectionattributes"@@@ public TypedVector @@@v@@@name@@@/v@@@=new TypedVector(@@@v@@@type@@@/v@@@.class); @@@/repeat@@@ public @@@v@@@object@@@/v@@@(String id) { super(id); this.setHelpDesc("@@@v@@@desc@@@/v@@@"); this.setHelpRecom("@@@v@@@rec@@@/v@@@"); } @@@repeat id="methods"@@@ public @@@v@@@type@@@/v@@@ get@@@v@@@name@@@/v@@@(){ return @@@v@@@name@@@/v@@@; } public void set@@@v@@@name@@@/v@@@(@@@v@@@type@@@/v@@@ @@@v@@@name@@@/v@@@){ this.@@@v@@@name@@@/v@@@=@@@v@@@name@@@/v@@@; } @@@/repeat@@@ @@@repeat id="collectionmethods"@@@ public void set@@@v@@@name@@@/v@@@(TypedVector tv){ this.@@@v@@@name@@@/v@@@=tv; } public String get@@@v@@@name@@@/v@@@(){ return @@@v@@@name@@@/v@@@.toString(); } public Class get@@@v@@@name@@@/v@@@Type(){ return @@@v@@@name@@@/v@@@.getType(); } public void add@@@v@@@name@@@/v@@@(@@@v@@@type@@@/v@@@ element){ this.@@@v@@@name@@@/v@@@.add(element); } public void insert@@@v@@@name@@@/v@@@At(int pos,@@@v@@@type@@@/v@@@ element){ this.@@@v@@@name@@@/v@@@.insert(element,pos); } public int contains@@@v@@@name@@@/v@@@(@@@v@@@type@@@/v@@@ element){ return this.@@@v@@@name@@@/v@@@.indexOf(element); } public Enumeration get@@@v@@@name@@@/v@@@Elements(){ return this.@@@v@@@name@@@/v@@@.elements(); } public void remove@@@v@@@name@@@/v@@@Element(String id){ Enumeration enumeration=this.get@@@v@@@name@@@/v@@@Elements(); ingenias.editor.entities.Entity found=null; while (enumeration.hasMoreElements() && found==null){ ingenias.editor.entities.Entity ent=(ingenias.editor.entities.Entity)enumeration.nextElement(); if (ent.getId().equalsIgnoreCase(id)) found=ent; } if (found!=null) this.@@@v@@@name@@@/v@@@.remove(found); } @@@/repeat@@@ public void fromMap(Map ht){ super.fromMap(ht); @@@repeat id="simpleattributes"@@@ if (ht.get("@@@v@@@name@@@/v@@@")!=null && ht.get("@@@v@@@name@@@/v@@@").equals("")) this.set@@@v@@@name@@@/v@@@(null); else if (ht.get("@@@v@@@name@@@/v@@@")!=null) this.set@@@v@@@name@@@/v@@@(new @@@v@@@type@@@/v@@@(ht.get("@@@v@@@name@@@/v@@@").toString())); @@@/repeat@@@ } public void toMap(Map ht){ super.toMap(ht); @@@repeat id="simpleattributes"@@@ //if (this.get@@@v@@@name@@@/v@@@() instanceof String) if (this.get@@@v@@@name@@@/v@@@()!=null) ht.put("@@@v@@@name@@@/v@@@",this.get@@@v@@@name@@@/v@@@().toString()); else ht.put("@@@v@@@name@@@/v@@@",""); @@@/repeat@@@ } public String toString(){ /*if (this.get@@@v@@@keyfield@@@/v@@@()==null || this.get@@@v@@@keyfield@@@/v@@@().toString().equals("")) return "Please, define the value of field @@@v@@@keyfield@@@/v@@@"; else return this.get@@@v@@@keyfield@@@/v@@@().toString();*/ return ""+@@@v@@@tostring@@@/v@@@; } } @@@/text@@@ @@@/saveto@@@ @@@saveto@@@ @@@file overwrite="yes"@@@@@@v@@@jadeproject@@@/v@@@/target/generated/src/main/java/ingenias/editor/widget/@@@v@@@object@@@/v@@@WidgetPreferences.java@@@/file@@@ @@@text@@@ /** * Copyright (C) 2010 Jorge J. Gomez-Sanz over original code from Ruben Fuentes * * Modifications over original code from jgraph.sourceforge.net * * This file is part of the INGENME tool. INGENME is an open source meta-editor * which produces customized editors for user-defined modeling languages * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation version 3 of the License * * This program 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. See the * GNU General Public License for more details. * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/> **/ package ingenias.editor.widget; import org.jgraph.graph.*; import java.util.*; public class @@@v@@@object@@@/v@@@WidgetPreferences extends @@@v@@@parent@@@/v@@@WidgetPreferences { Hashtable preferredWidget=new Hashtable(); Hashtable defaultValues=new Hashtable(); public @@@v@@@object@@@/v@@@WidgetPreferences() { super(); String[] preferredOrder={@@@repeat id="preferredorder"@@@"@@@v@@@order@@@/v@@@",@@@/repeat@@@""}; this.setPreferredOrder(preferredOrder); Vector result=null; @@@repeat id="simpleattributes"@@@ preferredWidget.put("@@@v@@@name@@@/v@@@",@@@v@@@widget@@@/v@@@.class); result=new Vector(); @@@repeat id="defaultvalues"@@@ result.add("@@@v@@@value@@@/v@@@"); @@@/repeat@@@ defaultValues.put("@@@v@@@name@@@/v@@@",result); @@@/repeat@@@ }; public Object getWidget(String attName) throws IllegalAccessException,InstantiationException{ Class result=null; ConfigurableWidget instance=null; if (preferredWidget.get(attName)!=null) result= ((Class)preferredWidget.get(attName)); else return (super.getWidget(attName)); if (result!=null){ instance=(ConfigurableWidget)result.newInstance(); Vector values=(Vector)defaultValues.get(attName); instance.setDefaultValues(values); } return instance; } public void configureWidget(ConfigurableWidget cw){ // cw.setDefaultValues(result); } } @@@/text@@@ @@@/saveto@@@ @@@/repeat@@@ @@@/program@@@