Package de.sciss.util

Examples of de.sciss.util.ParamSpace$Translator


 
  public ConstQPane()
  {
    super( 2, 1, 4, 2 );

    final ParamSpace spcFreq = ParamSpace.spcFreqHertz.reshape( 1, 96000, 27.5 );
    final ParamSpace spcTime = ParamSpace.spcTimeMillis.reshape( 1, 2000, 5 );
   
    ggMinFreq    = new PrefParamField();
    ggMinFreq.addSpace( spcFreq );
    ggMinFreq.setPreferences( prefs, ConstQ.KEY_MINFREQ );
    ggMinFreq.addListener( new ParamField.Listener() {
      public void paramSpaceChanged( ParamField.Event e ) { /* ignore */ }
      public void paramValueChanged( ParamField.Event e )
      {
        if( ggMaxFreq.getValue().val < e.getValue().val ) {
          ggMaxFreq.setValue( e.getValue() );
        }
      }
    });
    ggMaxFreq    = new PrefParamField();
    ggMaxFreq.addSpace( ParamSpace.spcFreqHertz );
    ggMaxFreq.setPreferences( prefs, ConstQ.KEY_MAXFREQ );
    ggMaxFreq.addListener( new ParamField.Listener() {
      public void paramSpaceChanged( ParamField.Event e ) { /* ignore */ }
      public void paramValueChanged( ParamField.Event e )
      {
        if( ggMinFreq.getValue().val > e.getValue().val ) {
          ggMinFreq.setValue( e.getValue() );
        }
      }
    });
    ggBandsPerOct  = new PrefParamField();
//    ggBandsPerOct.setSpace( NumberSpace.createIntSpace( 1, 96 ));
    ggBandsPerOct.addSpace( new ParamSpace( 1, 96, 1, 0, 0, 24 ));
    ggBandsPerOct.setPreferences( prefs, ConstQ.KEY_BANDSPEROCT );
    ggMaxTimeRes  = new PrefParamField();
    ggMaxTimeRes.addSpace( spcTime );
    ggMaxTimeRes.setPreferences( prefs, ConstQ.KEY_MAXTIMERES );
    ggMaxFFTSize  = new PrefComboBox();
View Full Code Here


  {
    final JPanel      p      = new JPanel( new BorderLayout() );
    final PrefParamField  ggNimRod  = new PrefParamField();
    final Application    app      = AbstractApplication.getApplication();
   
    ggNimRod.addSpace( new ParamSpace( Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY, 1, 0, 0, 1 ));
    ggNimRod.setValueAndSpace( DEFAULT_NUMROT );
    ggNimRod.setPreferences( prefs, KEY_NUMROT );

    p.add( new JLabel( app.getResourceString( "plugInChanShift" ), SwingConstants.RIGHT ), BorderLayout.WEST );
    p.add( ggNimRod, BorderLayout.CENTER );
View Full Code Here

    final int    prefsUnit;
    final int    sepIdx    = prefsStr.indexOf( ' ' );
    final Param    guiValue  = getValue();
    final double  prefsVal;
    Param      prefsValue;
    ParamSpace    newSpace  = null;
    boolean      switchSpace  = false;
   
    try {
      if( sepIdx >= 0 ) {
        prefsVal    = Double.parseDouble( prefsStr.substring( 0, sepIdx ));
View Full Code Here

  }
 
  public void setValueAndSpace( Param newValue )
  {
    int spcIdx    = 0;
    ParamSpace spc  = currentSpace;
    boolean newSpc  = false;
    for( ; spcIdx < collSpaces.size(); spcIdx++ ) {
      spc = (ParamSpace) collSpaces.get( spcIdx );
      if( (spc != currentSpace) && (spc.unit == newValue.unit) ) {
        newSpc = true;
View Full Code Here

  protected void selectSpace( int selectedIdx )
  {
    if( selectedIdx >= 0 && selectedIdx < collSpaces.size() ) {

      final ParamSpace oldSpace = currentSpace;
      currentSpace      = (ParamSpace) collSpaces.get( selectedIdx );

      final Number oldNum    = ggNumber.getNumber();
      final Param oldParam  = new Param( oldNum == null ?
        (oldSpace == null ? 0.0 : oldSpace.reset) : oldNum.doubleValue(),
View Full Code Here

      pChan.add( ggMono );
      ggStereo  = new JToggleButton( getResourceString( "buttonStereo" ));
      chanGroup.add( ggStereo );
      pChan.add( ggStereo );
      ggChanNum  = new PrefParamField();
      ggChanNum.addSpace( new ParamSpace( 0, 0xFFFF, 1, 0, 0, 4, ParamSpace.NONE ));
      ggChanNum.setEnabled( false );
      ggMulti    = new JToggleButton( getResourceString( "buttonMultichannel" ));
      if( prefs != null ) ggChanNum.setPreferences( prefs, KEY_CHANNELS );
      ggMulti.addItemListener( this );
      chanGroup.add( ggMulti );
View Full Code Here

        return newMock(FieldTranslator.class);
    }

    protected final Translator mockTranslator(String name, Class type)
    {
        Translator translator = mockTranslator();

        train_getName(translator, name);
        train_getType(translator, type);

        return translator;
View Full Code Here


    @Test
    public void found_translator_by_name()
    {
        Translator translator = mockTranslator("mock", String.class);

        Collection<Translator> configuration = CollectionFactory.newList(translator);

        replay();
View Full Code Here

    }

    @Test
    public void unknown_translator_is_failure()
    {
        Translator fred = mockTranslator("fred", String.class);
        Translator barney = mockTranslator("barney", Long.class);

        Collection<Translator> configuration = CollectionFactory.newList(fred, barney);

        replay();
View Full Code Here

    }

    @Test(dataProvider = "to_client_data")
    public void to_client(Class type, Object value, String expected)
    {
        Translator t = source.getByType(type);

        String actual = t.toClient(value);

        assertEquals(actual, expected);
    }
View Full Code Here

TOP

Related Classes of de.sciss.util.ParamSpace$Translator

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.