1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94
|
package CA;
import java.io.File;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller;
import javax.xml.bind.Unmarshaller;
import CA.GraphicView.View;
import CA.GraphicView.View.GraphicObjects;
public class AdaptationCA {
private static Marshaller mapperObjetsXML;
private static Unmarshaller mapperXMLObjets;
private static File file1 = new File("D:\\CA.cfg");
private static File file2 = new File("D:\\TR1.cfg");
private static File file3 = new File("D:\\View.cfg");
static ObjectFactory fabrique = new ObjectFactory();
static JAXBContext context;
static GraphicView graphV1;
static View embed;
public static void Mapper(){
try {
context = JAXBContext.newInstance("CA");
// création d'un marshaller. L'objet créé va permettre de transformer un ensemble d'objet en un document xml
mapperObjetsXML = context.createMarshaller();
mapperObjetsXML.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
// création d'un unmarshaller. l'objet créé va permettre de transformer le document XML en un ensemble d'objet
mapperXMLObjets = context.createUnmarshaller() ;
graphV1 = (GraphicView)mapperXMLObjets.unmarshal(file1);
embed = (View)mapperXMLObjets.unmarshal(file3);
} catch (JAXBException e) {
e.printStackTrace();
}
}
/***************************************************************************************************/
/**********************INCRUSTER LA VUE DE L'ANIMATION DU DEFAUT DE MATERIEL OU DE COMMANDE*********/
/***************************************************************************************************/
private static void AddEmbeddedView(String refVName, int x, int y, int width, int height, String transf, String fil){
GraphicObjects graphO = graphV1.getGraphicObjects();
embed.getFilled();
embed.getHeight();
embed.getReferenceViewName();
embed.getTransformationPointPosition();
embed.getWidth();
embed.getX();
embed.getY();
}
private static void enregistrer() {
try {
mapperObjetsXML.marshal(graphV1, file2);
}
catch (JAXBException ex) {
ex.printStackTrace();
}
}
public static void main(String[] args) throws Exception {
Mapper();
AddView("../Voyant2", 63, 19, 24, 23, "Center", "False");
enregistrer();
}
} |
Partager