public void writeVDCTData(java.io.DataOutputStream file, java.lang.String path2remove) throws java.io.IOException {             Object obj; Group group; Record record; Template template; Connector connector; EPICSLinkOut link; EPICSLink field; Enumeration e2;  final String nl = "\n";  final String comma = ","; final String quote = "\""; final String ending = ")"+nl;  final String RECORD_START    = "#! "+DBResolver.VDCTRECORD+"("; final String GROUP_START     = "#! "+DBResolver.VDCTGROUP+"("; final String FIELD_START     = "#! "+DBResolver.VDCTFIELD+"("; final String VISIBILITY_START= "#! "+DBResolver.VDCTVISIBILITY+"("; final String LINK_START      = "#! "+DBResolver.VDCTLINK+"("; final String CONNECTOR_START = "#! "+DBResolver.VDCTCONNECTOR+"("; final String TEMPLATE_START  = "#! "+DBResolver.TEMPLATE_INSTANCE+"("; final String TEMPLATE_PROPERTY_START  = "#! "+DBResolver.TEMPLATE_PROPERTY+"("; final String TEMPLATE_VALUE_START     = "#! "+DBResolver.TEMPLATE_VALUE+"(";  Enumeration e = getSubObjectsV().elements(); while (e.hasMoreElements()) { obj = e.nextElement();  if (obj instanceof Record) { record = (Record)obj;  file.writeBytes(RECORD_START+ StringUtils.quoteIfMacro( StringUtils.removeBegining(record.getRecordData().getName(), path2remove) ) + comma + record.getX() + comma + record.getY() + comma + StringUtils.color2string(record.getColor()) + comma + StringUtils.boolean2str(record.isRight()) + comma + quote + StringUtils.removeBegining(record.getDescription(), path2remove) + quote +	")\n");  e2 = record.getSubObjectsV().elements(); while (e2.hasMoreElements()) { obj = e2.nextElement(); if (obj instanceof Connector) { connector = (Connector)obj;  file.writeBytes(CONNECTOR_START+ StringUtils.quoteIfMacro( StringUtils.removeBegining(connector.getID(), path2remove) ) + comma + StringUtils.quoteIfMacro( StringUtils.removeBegining(connector.getInput().getID(), path2remove) ) + comma + connector.getX() + comma + connector.getY() + comma + StringUtils.color2string(connector.getColor()) + comma + quote +  quote + ending); } else { if (obj instanceof EPICSLink) { field = (EPICSLink)obj;  file.writeBytes(FIELD_START+ StringUtils.quoteIfMacro( StringUtils.removeBegining(field.getFieldData().getFullName(), path2remove) ) + comma + StringUtils.color2string(field.getColor()) + comma + StringUtils.boolean2str(field.isRight()) + comma + quote + StringUtils.removeBegining(field.getDescription(), path2remove) + quote + ending);  } if (obj instanceof EPICSLinkOut) { link = (EPICSLinkOut)obj; if (link.getInput()!=null) file.writeBytes(LINK_START+ StringUtils.quoteIfMacro( StringUtils.removeBegining(link.getFieldData().getFullName(), path2remove) ) + comma + StringUtils.quoteIfMacro( StringUtils.removeBegining(link.getInput().getID(), path2remove) ) + ending); } } }  VDBFieldData vfd; e2 = record.getRecordData().getFieldsV().elements(); while (e2.hasMoreElements()) { vfd = (VDBFieldData)e2.nextElement(); if (vfd.getVisibility()!=InspectableProperty.NON_DEFAULT_VISIBLE) file.writeBytes(VISIBILITY_START+ StringUtils.quoteIfMacro( StringUtils.removeBegining(vfd.getFullName(), path2remove) ) + comma + String.valueOf(vfd.getVisibility()) + ending); }   } else if (obj instanceof Group) { group = (Group)obj; file.writeBytes(GROUP_START+ StringUtils.quoteIfMacro( StringUtils.removeBegining(group.getAbsoluteName(), path2remove) ) + comma + group.getX() + comma + group.getY() + comma + StringUtils.color2string(group.getColor()) + comma + quote + quote + ending); group.writeVDCTData(file, path2remove); }  else if (obj instanceof Template) { template = (Template)obj; String templateName = StringUtils.removeBegining(template.getName(), path2remove);  file.writeBytes(nl); file.writeBytes(TEMPLATE_START+ quote + templateName + quote + comma + quote + template.getTemplateData().getTemplate().getId() + quote + comma + template.getX() + comma + template.getY() + comma + StringUtils.color2string(template.getColor()) + comma + quote  + quote + ending);  TreeMap properties = template.getTemplateData().getProperties(); Iterator i = properties.keySet().iterator(); while (i.hasNext()) { String name = i.next().toString(); String value = (String)properties.get(name); file.writeBytes(TEMPLATE_PROPERTY_START+ quote + templateName + quote + comma + quote + name + quote + comma + quote + value + quote + ending); }  e2 = template.getSubObjectsV().elements(); while (e2.hasMoreElements()) {  obj = e2.nextElement(); if (obj instanceof EPICSLink) { field = (EPICSLink)obj;  String name = field.getFieldData().getName(); String value = field.getFieldData().getValue();  VDBFieldData fd = null; fd = (VDBFieldData)template.getTemplateData().getTemplate().getInputs().get(name); if (fd==null) fd = (VDBFieldData)template.getTemplateData().getTemplate().getOutputs().get(name); if (fd==null) { System.out.println("Internar error: field '"+name+"' not found in template definition of '"+template.getTemplateData().getTemplate().getId()+ "' of template instance '"+templateName+"'. Skipping..."); continue; }  if (!value.equals(fd.getValue())) file.writeBytes(TEMPLATE_VALUE_START+ quote + templateName + quote + comma + quote + name + quote + comma + quote + value + quote + ending); } }  file.writeBytes(nl); }   }
public void writeVDCTData(java.io.DataOutputStream file, NameManipulator namer) throws java.io.IOException { writeVDCTData(getSubObjectsV(), file, namer);
public void writeVDCTData(java.io.DataOutputStream file, java.lang.String path2remove) throws java.io.IOException { // write layout data // used format #! Record(recordname, xpos, ypos, color, rotated, "description") // used format #! Group(groupname, xpos, ypos, color, "description") // used format #! Field(fieldname, color, rotated, "description") // used format #! Visibility(fieldname, visibility) // used format #! Link(fieldname, inLinkID) // used format #! Connector(id, outLinkID, xpos, ypos, color, "description") //	 eg.		#! Record(ts:fanOut0, 124, 432, 324568, 0, "fanOut record") Object obj; Group group; Record record; Template template; Connector connector; EPICSLinkOut link;  EPICSLink field;  Enumeration e2;  final String nl = "\n"; final String comma = ","; final String quote = "\""; final String ending = ")"+nl; final String RECORD_START    = "#! "+DBResolver.VDCTRECORD+"("; final String GROUP_START     = "#! "+DBResolver.VDCTGROUP+"("; final String FIELD_START     = "#! "+DBResolver.VDCTFIELD+"("; final String VISIBILITY_START= "#! "+DBResolver.VDCTVISIBILITY+"("; final String LINK_START      = "#! "+DBResolver.VDCTLINK+"("; final String CONNECTOR_START = "#! "+DBResolver.VDCTCONNECTOR+"("; final String TEMPLATE_START  = "#! "+DBResolver.TEMPLATE_INSTANCE+"("; final String TEMPLATE_PROPERTY_START  = "#! "+DBResolver.TEMPLATE_PROPERTY+"("; final String TEMPLATE_VALUE_START     = "#! "+DBResolver.TEMPLATE_VALUE+"("; 	 Enumeration e = getSubObjectsV().elements(); while (e.hasMoreElements())  	{	 	obj = e.nextElement();		 	if (obj instanceof Record)	 		{			 	record = (Record)obj;	 			file.writeBytes(RECORD_START+			 		StringUtils.quoteIfMacro(				 		StringUtils.removeBegining(record.getRecordData().getName(), path2remove)				 	) + comma + record.getX() + comma + record.getY() + 				 	comma + StringUtils.color2string(record.getColor()) +				 	comma + StringUtils.boolean2str(record.isRight()) +					comma + quote + 					StringUtils.removeBegining(record.getDescription(), path2remove) + 					quote +	")\n");	 			e2 = record.getSubObjectsV().elements();	 			while (e2.hasMoreElements())	 			{			 		obj = e2.nextElement();				 	if (obj instanceof Connector)			 		{			 			connector = (Connector)obj;			 			file.writeBytes(CONNECTOR_START+					 		StringUtils.quoteIfMacro(						 		StringUtils.removeBegining(connector.getID(), path2remove)						 	) + comma +  					 		StringUtils.quoteIfMacro(						 		StringUtils.removeBegining(connector.getInput().getID(), path2remove)						 	) + comma + connector.getX() + comma + connector.getY() + 						 	comma + StringUtils.color2string(connector.getColor()) +							comma + quote + /*!!!+ StringUtils.removeBegining(connector.getDescription(), path2remove) +*/ quote +							ending);		 			 }			 		else			 		{				 		if (obj instanceof EPICSLink)				 		{				 			field = (EPICSLink)obj;					 			file.writeBytes(FIELD_START+						 		StringUtils.quoteIfMacro(							 		StringUtils.removeBegining(field.getFieldData().getFullName(), path2remove)							 	) + 							 	comma + StringUtils.color2string(field.getColor()) +							 	comma + StringUtils.boolean2str(field.isRight()) +								comma + quote + StringUtils.removeBegining(field.getDescription(), path2remove) + quote + 								ending);			 			 }				 		if (obj instanceof EPICSLinkOut)				 		{				 			link = (EPICSLinkOut)obj;				 			if (link.getInput()!=null)				 				file.writeBytes(LINK_START+						 			StringUtils.quoteIfMacro(							 			StringUtils.removeBegining(link.getFieldData().getFullName(), path2remove)							 		) + comma + 					 				StringUtils.quoteIfMacro(						 				StringUtils.removeBegining(link.getInput().getID(), path2remove)							 		) +									ending);			 			 }			 		}	 			}				VDBFieldData vfd;	 			e2 = record.getRecordData().getFieldsV().elements();	 			while (e2.hasMoreElements())	 			{			 		vfd = (VDBFieldData)e2.nextElement();					if (vfd.getVisibility()!=InspectableProperty.NON_DEFAULT_VISIBLE)		 				file.writeBytes(VISIBILITY_START+				 			StringUtils.quoteIfMacro(					 			StringUtils.removeBegining(vfd.getFullName(), path2remove)					 		) + comma +					 		String.valueOf(vfd.getVisibility()) +							ending);	 			} 			 } 	 	else if (obj instanceof Group) 	 		{			 	 group = (Group)obj;			 	 file.writeBytes(GROUP_START+ 					StringUtils.quoteIfMacro(	 					StringUtils.removeBegining(group.getAbsoluteName(), path2remove)		 			 ) + comma + group.getX() + comma + group.getY() + 				 	 comma + StringUtils.color2string(group.getColor()) +					 comma + quote /*+ connector.getDescription() */+ quote +					 ending);			 	 group.writeVDCTData(file, path2remove);	 		} 	 	else if (obj instanceof Template) 	 		{			 	 template = (Template)obj;				 String templateName = StringUtils.removeBegining(template.getName(), path2remove);			     file.writeBytes(nl);			 	 file.writeBytes(TEMPLATE_START+ 					 quote + templateName + quote + 					 comma + quote + template.getTemplateData().getTemplate().getId() + quote +		 			 comma + template.getX() + comma + template.getY() + 				 	 comma + StringUtils.color2string(template.getColor()) +					 comma + quote /*+ template.getDescription()*/ + quote +					 ending);					 				 TreeMap properties = template.getTemplateData().getProperties();				 Iterator i = properties.keySet().iterator();				 while (i.hasNext())				 {					 String name = i.next().toString();					 String value = (String)properties.get(name);				 	 file.writeBytes(TEMPLATE_PROPERTY_START+	 					 quote + templateName + quote +	 					 comma + quote + name + quote +						 comma + quote + value + quote +						 ending);				 }					 	 			e2 = template.getSubObjectsV().elements();	 			while (e2.hasMoreElements())	 			{									 		obj = e2.nextElement();				 	if (obj instanceof EPICSLink)			 		{			 			field = (EPICSLink)obj;		 				String name = field.getFieldData().getName();				 		String value = field.getFieldData().getValue();							VDBFieldData fd = null;						fd = (VDBFieldData)template.getTemplateData().getTemplate().getInputs().get(name);						if (fd==null) 							fd = (VDBFieldData)template.getTemplateData().getTemplate().getOutputs().get(name);						if (fd==null)						{							System.out.println("Internar error: field '"+name+"' not found in template definition of '"+template.getTemplateData().getTemplate().getId()+											   "' of template instance '"+templateName+"'. Skipping...");							continue;						}												if (!value.equals(fd.getValue()))						 	file.writeBytes(TEMPLATE_VALUE_START+			 					 quote + templateName + quote +			 					 comma + quote + name + quote +								 comma + quote + value + quote +								 ending);		 			 }				 }					 			     file.writeBytes(nl);	 		} 	 		 	 }}