Package de.sciss.eisenkraut.io

Examples of de.sciss.eisenkraut.io.RoutingConfig


   
    public Object getValueAt( int row, int col )
    {
      if( row > collConfigs[ id ].size() ) return null;
     
      final RoutingConfig c = (RoutingConfig) collConfigs[ id ].get( row );
   
      switch( col ) {
      case 0:
        return c.name;
      case 1:
View Full Code Here


   
    public void setValueAt( Object value, int row, int col )
    {
      if( (row > collConfigs[ id ].size()) || (value == null) ) return;

      final RoutingConfig cfg        = (RoutingConfig) collConfigs[ id ].get( row );
      final int      oldChannels    = cfg.numChannels;
      int[]        newMapping;
      String        name;
      RoutingConfig    newCfg      = null;
      int          newChannels;
      float        newStartAngle;

      switch( col ) {
      case 0:
        name = value.toString();
//        if( (name.length() > 0) && (name.length() < Preferences.MAX_NAME_LENGTH) &&
        if( (name.length() > 0) &&
          !setConfigNames[ id ].contains( name )) {

          newCfg = new RoutingConfig( cfg.id, name, cfg.mapping, cfg.startAngle );
        }
        break;
       
      case 1:
        if( value instanceof Number ) {
          newChannels = Math.max( 0, ((Number) value).intValue() );
        } else if( value instanceof String ) {
          try {
            newChannels = Math.max( 0, Integer.parseInt( value.toString() ));
          }
          catch( NumberFormatException e1 ) {
            break;
          }
        } else {
          assert false : value;
          break;
        }
        if( newChannels < oldChannels ) {
          newMapping = new int[ newChannels ];
          System.arraycopy( cfg.mapping, 0, newMapping, 0, newChannels );
        } else if( newChannels > oldChannels ) {
          newMapping = new int[ newChannels ];
          System.arraycopy( cfg.mapping, 0, newMapping, 0, oldChannels );
          for( int i = oldChannels, minCh = 0; i < newChannels; i++ ) {
chanLp:          for( int ch = minCh; true; ch++ ) {
              for( int j = 0; j < i; j++ ) {
                if( newMapping[ j ] == ch ) continue chanLp;
              }
              newMapping[ i ] = ch;
              minCh = ch + 1;
              break chanLp;
            }
          }
        } else break;

        newCfg = new RoutingConfig( cfg.id, cfg.name, newMapping, cfg.startAngle );
//System.err.print( "now mapping is " );
//for( int i = 0; i < cfg.mapping.length; i++ ) System.err.print( cfg.mapping[ i ] + "  " );
//System.err.println();
        break;
       
      case 2:
        if( value instanceof Number ) {
          newStartAngle = Math.max( -360f, Math.min( 360f, ((Number) value).floatValue() ));
        } else if( value instanceof String ) {
          try {
            newStartAngle = Math.max( -360f, Math.min( 360f, Float.parseFloat( value.toString() )));
          }
          catch( NumberFormatException e1 ) {
            break;
          }
        } else {
          assert false : value;
          break;
        }
        if( newStartAngle != cfg.startAngle ) {
          newCfg = new RoutingConfig( cfg.id, cfg.name, cfg.mapping, newStartAngle );
        }
        break;
       
      default:
        // set by changing numChannels and drag+drop
View Full Code Here

TOP

Related Classes of de.sciss.eisenkraut.io.RoutingConfig

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.