text: // Generated Code for the Draw2D touch HTML5 lib
  //                                                        
  // http://www.draw2d.org                                  
  //                                                        
  // Go to the Designer http://www.draw2d.org               
  // to design your own shape or download user generated    
  //                                                        
  var draw2d_circuit_gate_NOT = draw2d.SetFigure.extend({            
  
     NAME: "draw2d_circuit_gate_NOT",
  
     init:function(attr, setter, getter)
     {
       this._super( $.extend({stroke:0, bgColor:null, width:36,height:42.5},attr), setter, getter);
       var port;
       // input01
       port = this.addPort(new DecoratedInputPort(), new draw2d.layout.locator.XYRelPortLocator(0, 54.11764705882353));
       port.setConnectionDirection(3);
       port.setBackgroundColor("#1C9BAB");
       port.setName("input01");
       port.setMaxFanOut(20);
       // output
       port = this.createPort("output", new draw2d.layout.locator.XYRelPortLocator(100, 50.58823529411765));
       port.setConnectionDirection(1);
       port.setBackgroundColor("#1C9BAB");
       port.setName("output");
       port.setMaxFanOut(20);
       this.persistPorts=false;
     },
  
     createShapeElement : function()
     {
        var shape = this._super();
        this.originalWidth = 36;
        this.originalHeight= 42.5;
        return shape;
     },
  
     createSet: function()
     {
         this.canvas.paper.setStart();
  
          // BoundingBox
          shape = this.canvas.paper.path("M0,0 L36,0 L36,42.5 L0,42.5");
          shape.attr({"stroke":"none","stroke-width":0,"fill":"none"});
          shape.data("name","BoundingBox");
          
          // Rectangle
          shape = this.canvas.paper.path('M0,5.5Q0,2.5 3, 2.5L27,2.5Q30,2.5 30, 5.5L30,39.5Q30,42.5 27, 42.5L3,42.5Q0,42.5 0, 39.5L0,5.5');
          shape.attr({"stroke":"#303030","stroke-width":1,"fill":"#FFFFFF","dasharray":null,"opacity":1});
          shape.data("name","Rectangle");
          
          // Label
          shape = this.canvas.paper.text(0,0,'1');
          shape.attr({"x":10,"y":16,"text-anchor":"start","text":"1","font-family":"\"Arial\"","font-size":20,"stroke":"none","fill":"#080808","stroke-scale":true,"font-weight":"normal","stroke-width":0,"opacity":1});
          shape.data("name","Label");
          
          // Circle
          shape = this.canvas.paper.ellipse();
          shape.attr({"rx":4,"ry":4,"cx":32,"cy":21.5,"stroke":"#1B1B1B","stroke-width":1,"fill":"#FCFFFF","dasharray":null,"opacity":1});
          shape.data("name","Circle");
          
  
          return this.canvas.paper.setFinish();
     },
  
     applyAlpha: function()
     {
     },
  
     layerGet: function(name, attributes)
     {
        if(this.svgNodes===null) return null;
  
        var result=null;
        this.svgNodes.some(function(shape){
           if(shape.data("name")===name){
              result=shape;
           }
           return result!==null;
        });
  
        return result;
     },
  
     layerAttr: function(name, attributes)
     {
       if(this.svgNodes===null) return;
  
       this.svgNodes.forEach(function(shape){
               if(shape.data("name")===name){
                    shape.attr(attributes);
               }
       });
     },
  
     layerShow: function(name, flag, duration)
     {
        if(this.svgNodes===null) return;
  
        if(duration){
          this.svgNodes.forEach(function(node){
              if(node.data("name")===name){
                  if(flag){
                      node.attr({ opacity : 0 }).show().animate({ opacity : 1 }, duration);
                  }
                  else{
                      node.animate({ opacity : 0 }, duration, function () { this.hide() });
                  }
              }
          });
        }
        else{
            this.svgNodes.forEach(function(node){
                if(node.data("name")===name){
                     if(flag){node.show();}
                     else{node.hide();}
                 }
             });
        }
     },
  
      calculate: function()
      {
      },
  
      onStart: function()
      {
      },
  
      onStop:function()
      {
      },
  
      getParameterSettings: function()
      {
          return [];
      },
  
      /**
       * @method
       */
      addPort: function(port, locator)
      {
          this._super(port, locator);
          return port;
      },
  
      /**
       * @method
       * Return an objects with all important attributes for XML or JSON serialization
       *
       * @returns {Object}
       */
      getPersistentAttributes : function()
      {
          var memento = this._super();
  
          // add all decorations to the memento
          //
          memento.labels = [];
          this.children.each(function(i,e){
              var labelJSON = e.figure.getPersistentAttributes();
              labelJSON.locator=e.locator.NAME;
              memento.labels.push(labelJSON);
          });
  
          return memento;
      },
  
      /**
       * @method
       * Read all attributes from the serialized properties and transfer them into the shape.
       *
       * @param {Object} memento
       * @returns
       */
      setPersistentAttributes : function(memento)
      {
          this._super(memento);
  
          // remove all decorations created in the constructor of this element
          //
          this.resetChildren();
  
          // and add all children of the JSON document.
          //
          $.each(memento.labels, $.proxy(function(i,json){
              // create the figure stored in the JSON
              var figure =  eval("new "+json.type+"()");
  
              // apply all attributes
              figure.attr(json);
  
              // instantiate the locator
              var locator =  eval("new "+json.locator+"()");
  
              // add the new figure as child to this figure
              this.add(figure, locator);
          },this));
      }
  });
  
  /**
   * by 'Draw2D Shape Designer'
   *
   * Custom JS code to tweak the standard behaviour of the generated
   * shape. add your custome code and event handler here.
   *
   *
   */
  draw2d_circuit_gate_NOT = draw2d_circuit_gate_NOT.extend({
  
      init: function(attr, setter, getter){
          this._super(attr, setter, getter);
  
          this.attr({resizeable:false});
          this.installEditPolicy(new draw2d.policy.figure.AntSelectionFeedbackPolicy());
  
      },
      
      calculate:function()
      {
          var i1 = this.getInputPort(0);
          var o1 = this.getOutputPort(0);
          
          o1.setValue(!i1.getValue());
      }
  });
  draw2d_circuit_gate_NOT.github="./shapes/org/draw2d/circuit/gate/NOT.shape";