Package org.mt4j.components.interfaces

Examples of org.mt4j.components.interfaces.IclickableButton


        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);
//              Vector3D centerPoint = this.getRefCompCenterLocal();
//              this.getCompToResize().scale(1/this.getReferenceComp().getWidthLocal(), 1/this.getReferenceComp().getHeightLocal(), 1, centerPoint);
//              this.getCompToResize().scale(width-5, width-5, 1, centerPoint);
             
//              this.resize(width-5, width-5);
             
//              this.shrink(width-shrinkValue, width-shrinkValue);
              this.shrink(width-sizeChangeValue, height-sizeChangeValue);
             
              if (comp instanceof IclickableButton){
                IclickableButton polyButton = (IclickableButton)g.getTargetComponent();
                polyButton.fireActionPerformed((TapEvent)g);
                polyButton.setSelected(true);
              }
            }
//          }
          break;
        case MTGestureEvent.GESTURE_UPDATED:
          //NOTE: usually click gesture analyzers dont send gesture update events
//          if (comp.isGestureAllowed(TapAnalyzer.class)
//              && comp.isVisible()
//            ){
//            if ( ((TapEvent)g).getId() == TapEvent.BUTTON_DOWN){
          if ( ((TapEvent)g).getTapID() == TapEvent.BUTTON_DOWN){
              if (comp instanceof IclickableButton){
                IclickableButton polyButton = (IclickableButton)g.getTargetComponent();
                polyButton.fireActionPerformed((TapEvent)g);
              }
            }
//          }
          break;
        case MTGestureEvent.GESTURE_ENDED:
         
//          if (comp.isGestureAllowed(TapAnalyzer.class)
//              && comp.isVisible()
//            ){
//            if ( ((TapEvent)g).getId() == TapEvent.BUTTON_CLICKED
//              || ((TapEvent)g).getId() == TapEvent.BUTTON_UP
//            ){
            if ( ((TapEvent)g).getTapID() == TapEvent.BUTTON_CLICKED
                || ((TapEvent)g).getTapID() == TapEvent.BUTTON_UP
              ){
              //Resize button
//              polyButton.setSizeLocal(width, width);
//              this.resize(width, width);
             
//              this.enlarge(width, width);
              this.enlarge(width, height);
             
//              Vector3D centerPoint = this.getRefCompCenterLocal();
//              this.getCompToResize().scale(1/this.getReferenceComp().getWidthLocal(), 1/this.getReferenceComp().getHeightLocal(), 1, centerPoint);
//              this.getCompToResize().scale(width, width, 1, centerPoint);
             
              if (comp instanceof IclickableButton){
                IclickableButton polyButton = (IclickableButton)g.getTargetComponent();
                polyButton.fireActionPerformed((TapEvent)g);
                polyButton.setSelected(false);
              }
            }
//          }
          break;
        default:
View Full Code Here

TOP

Related Classes of org.mt4j.components.interfaces.IclickableButton

Copyright © 2018 www.massapicom. 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.