UML 프런트엔드 디스플레이용 jsuml2 플러그인

2144 단어 uml
jsuml2의 예
jsuml2의 구조
jsuml2의 예
  • showumltest.jsp 코드 Example of a simple class diagram using the jsUML2 library window.onload = function(){ var classDiagram = new UMLClassDiagram({id: 'classDiagram', width: 380, height: 300 }); // Adding classes... var vehicleClass = new UMLClass({ x:100, y:50 }); var carClass = new UMLClass({ x:30, y:170 }); var boatClass = new UMLClass({ x:150, y:170 }); classDiagram.addElement(vehicleClass); classDiagram.addElement(carClass); classDiagram.addElement(boatClass); // Adding generalizations... var generalization1 = new UMLGeneralization({ b:vehicleClass, a:carClass }); var generalization2 = new UMLGeneralization({ b:vehicleClass, a:boatClass }); classDiagram.addElement(generalization1); classDiagram.addElement(generalization2); //Defining vehicleClass vehicleClass.setName("Vehicle"); vehicleClass.addAttribute( 'owner' ); vehicleClass.addAttribute( 'capacity' ); vehicleClass.addOperation( 'getOwner()' ); vehicleClass.addOperation( 'getCapacity()' ); //Defining carClass carClass.setName("Car"); carClass.addAttribute( 'num_doors' ); carClass.addOperation( 'getNumDoors()' ); //Defining boatClass boatClass.setName("Boat"); boatClass.addAttribute( 'mast' ); boatClass.addOperation( 'getMast()' ); //Draw the diagram classDiagram.draw(); //Interaction is possible (editable) classDiagram.interaction(true); } View code

  • 효과
  • 좋은 웹페이지 즐겨찾기