Examples of MTComponent


Examples of org.mt4j.components.MTComponent

      ){
        IFontFactory fontFactory = FontManager.getInstance().getFactoryForFileSuffix("");
        if (fontFactory != null && fontFactory instanceof BitmapFontFactory){
          BitmapFontFactory bitmapFontFactory = (BitmapFontFactory)fontFactory;
          if (this.getCharacters().length > 0 && this.getCharacters()[0] != null && this.getCharacters()[0] instanceof MTComponent){
            MTComponent comp = (MTComponent)this.getCharacters()[0];
            PApplet pa = comp.getRenderer();
            List<BitmapFontCharacter> charactersList = bitmapFontFactory.getCharacters(pa, unicode, fillColor, strokeColor, this.fontFileName, this.originalFontSize, this.antiAliased);
            BitmapFontCharacter[] characters = charactersList.toArray(new BitmapFontCharacter[charactersList.size()]);
            if (characters.length >= 1 && characters[0] != null){
              BitmapFontCharacter loadedCharacter = characters[0];
              BitmapFontCharacter[] newArray = new BitmapFontCharacter[this.getCharacters().length + 1];
View Full Code Here

Examples of org.mt4j.components.MTComponent

    //Remove the Selection Polygon of the now empty former selection from the canvas
    this.removeClusterPolyFromCanvas(selection.getClusterPolygon());
   
    //mark the remaining components from the deleted slection as not selected
    for (int i = 0; i < selection.getChildCount(); i++) {
      MTComponent comp = selection.getChildByIndex(i);
      if (comp instanceof IdragClusterable)
        ((IdragClusterable)comp).setSelected(false);
    }
   
    if (this.containsCluster(selection))
View Full Code Here

Examples of org.mt4j.components.MTComponent

    if (selectionPolygon != null){
      this.addChild(selectionPolygon);
    }
   
    for (int i = 0; i < components.length; i++) {
      MTComponent component3D = components[i];
      this.addChild(component3D);
    }
   
    this.setName("unnamed Cluster");
  }
View Full Code Here

Examples of org.mt4j.components.MTComponent

    MTPolygon clusterPoly = getClusterPolygon();
    this.removeChild(clusterPoly);
   
    MTComponent[] children = this.getChildren();
    for (int i = 0; i < children.length; i++) {
      MTComponent component = children[i];
     
      //Get vertices for convex hull of all selected components
      if (component instanceof AbstractShape){
        shapes++;
        AbstractShape shape = (AbstractShape)component;
View Full Code Here

Examples of org.mt4j.components.MTComponent

    if (this.getClusterPolygon() != null){
      this.getClusterPolygon().sendToFront();
    }
   
    for (int i = 0; i < this.getChildren().length; i++) {
      MTComponent childComp = this.getChildren()[i];
      if (!childComp.equals(this.getClusterPolygon()))
        childComp.sendToFront();
    }
  }
View Full Code Here

Examples of org.mt4j.components.MTComponent

  }

  @Override
  public void addChildren(MTComponent[] tangibleComps) {
    for (int i = 0; i < tangibleComps.length; i++) {
      MTComponent object = tangibleComps[i];
     
      //Add direct objects
      this.getChildList().add(object);
    }
  }
View Full Code Here

Examples of org.mt4j.components.MTComponent

          //Set all cards selected
          for (IdragClusterable currentComp : selectedComps){
            System.out.print((currentComp).getName() + "  "); //remove later
           
            if (currentComp instanceof MTComponent){//Add selected comps to selection - RIGHT NOW ONLY SUPPORTS INSTANCES OF MTCOMPONENT!
              MTComponent mtCurrentComp = (MTComponent)currentComp;
             
///////////////////////////////             
              // Listen to destroy events of the clustered components, to remove them from
              // the cluster and pack the polygon.
              mtCurrentComp.addStateChangeListener(StateChange.COMPONENT_DESTROYED, new StateChangeListener(){
                public void stateChanged(StateChangeEvent evt) {
                  if (evt.getSource() instanceof MTComponent) {
                    MTComponent sourceComp = (MTComponent) evt.getSource();
                   
                    //Remove component from cluster it is in
                    Cluster clusterOfComponent = clusterMgr.getCluster(sourceComp);
                    if (clusterOfComponent != null){
                      ((IdragClusterable)sourceComp).setSelected(false);
                      //Remvove the component from its former selection
                      clusterOfComponent.removeChild(sourceComp);
                     
                      //System.out.println("Comp destroyed and removed from cluster: " + sourceComp.getName());
                     
                      //remove the former selection from the selectionmanager if it consists only of 1 less components
                      if (clusterOfComponent.getChildCount() <= 2){
                        clusterMgr.removeCluster(clusterOfComponent);
                       
                      }else{
                        //Tighten convex hull of reduced cluster
                        clusterOfComponent.packClusterPolygon();
                      }
                    }
                  }
                }
              });
////////////////////////////////
             
              //Remove comp from former selection if it is in a new selection
              Cluster formerSelection = clusterMgr.getCluster(currentComp);
              if (formerSelection != null){
                formerSelection.removeChild(mtCurrentComp);
                //Remove the former selection from the selectionmanager if it consists only of 1 less components
                if (formerSelection.getChildCount() <= 2){ //2 because the selection polygon is also always in the selection
//                  SceneManager.getInstance().getCurrentScene().getMainCanvas().getSelectionManager().removeSelection(formerSelection);
                  clusterMgr.removeCluster(formerSelection);
                }else{
                  //Tighten convex hull of reduced cluster
                  formerSelection.packClusterPolygon();
                }
              }
             
              //Get the last index of the selected component in the parent list to know where to add the selectionpoly
              if (mtCurrentComp.getParent() != null){
                int indexInParentList = mtCurrentComp.getParent().getChildIndexOf(mtCurrentComp);
//                if (indexInParentList > n){
//                  n = indexInParentList;
//                }
                if (indexInParentList < n){
                  n = indexInParentList;
                }
              }
               
              //ADD components to the selection and set it to selected
              cluster.addChild(mtCurrentComp);
              currentComp.setSelected(true);
            }//if instance mtbasecomp
          }//for
         
          //Draw a convex hull around all selected shapes
          cluster.packClusterPolygon();
          dse.getSelectionPoly().setLineStipple((short)0xDDDD);
          dse.getSelectionPoly().setStrokeColor(new MTColor(0,0,0,255));
         
          //Add the selection poly 1 index after the index of the highest index of the selected components
          if (selectedComps[0] instanceof MTComponent
            && ((MTComponent)selectedComps[0]).getParent() != null){
              MTComponent firstSelectedComp = (MTComponent)selectedComps[0];
             
//              System.out.println("n:" + n);
//              System.out.println("Parent childcount: " + firstSelectedComp.getParent().getChildCount());
             
              firstSelectedComp.getParent().addChild(n, dse.getSelectionPoly());
             
//              if (n < firstSelectedComp.getParent().getChildCount())
//                firstSelectedComp.getParent().addChild(n+1, dse.getSelectionPoly());
//              else //FIXME this has caused out of bounds
//                firstSelectedComp.getParent().addChild(n, dse.getSelectionPoly());
View Full Code Here

Examples of org.mt4j.components.MTComponent

    if (g instanceof TapEvent){
      TapEvent clickEvent = (TapEvent)g;
     
     
      if (g.getTargetComponent() instanceof MTComponent){
        MTComponent comp = (MTComponent)g.getTargetComponent();
       
        //Hack for keeping up with the buttons current width if it was changed
        //due to .scale or something sometime
        if (comp instanceof IclickableButton) {
          IclickableButton button = (IclickableButton) comp;
          if (!button.isSelected()){
//            this.width = ((AbstractShape)button).getWidthLocal();
            this.width = getCurrentUnscaledWidth();
           
//            this.getReferenceComp().getWidthVectObjSpace();
//            //TODO aktuelle width holen zu comptoscale relative
//            this.width = this.getReferenceComp().getWidthLocal();
          }
        }
       
        switch (clickEvent.getId()) {
        case MTGestureEvent.GESTURE_DETECTED:
//          if (comp.isGestureAllowed(TapAnalyzer.class)
//            && comp.isVisible()
//          ){
            comp.sendToFront();
//            if ( ((TapEvent)g).getId() == TapEvent.BUTTON_DOWN){
            if ( ((TapEvent)g).getTapID() == TapEvent.BUTTON_DOWN){
             
              //Resize button
//              getCompToResize().setSizeLocal(width-5, width-5);
View Full Code Here

Examples of org.mt4j.components.MTComponent

     
      switch (dragEvent.getId()) {
      case MTGestureEvent.GESTURE_DETECTED:
        //Put target on top -> draw on top of others
        if (dragTarget instanceof MTComponent){
          MTComponent baseComp = (MTComponent)dragTarget;
         
          baseComp.sendToFront();
         
          /*
          //End all animations of the target
          Animation[] animations = AnimationManager.getInstance().getAnimationsForTarget(dragTarget);
          for (int i = 0; i < animations.length; i++) {
View Full Code Here

Examples of org.mt4j.components.MTComponent

      ((MTComponent)target).sendToFront();
    }
   
    if (aEvt.getId() == ArcBallGestureEvent.GESTURE_UPDATED){
      if (target instanceof MTComponent){
        MTComponent comp = (MTComponent)target;
        comp.transform(aEvt.getTransformationMatrix());
      }
    }
    return false;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.