Package de.sciss.gui

Examples of de.sciss.gui.SpringPanel


  private void createGadgets( int flags )
  {
    bottomPanel    = createBottomPanel( flags );
//    ggSettingsPane  = new JScrollPane( JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
//                       JScrollPane.HORIZONTAL_SCROLLBAR_NEVER );
    ggSettingsPane  = new SpringPanel( 4, 2, 4, 2 );
//    ggBlendTime    = new PrefNumberField( 0, NumberSpace.genericDoubleSpace, "sec." );
    ut.setLengthAndRate( 0, timeline.getRate() );
    ggBlendTime    = new PrefParamField( ut );
    ggBlendTime.addSpace( ParamSpace.spcTimeMillis );
    ggBlendTime.addSpace( ParamSpace.spcTimeSmps );
View Full Code Here


    numChannels    = doc.getAudioTrail().getChannelNum();
   
    doc.getTransport().stop();

    final Application      app        = AbstractApplication.getApplication();
    final SpringPanel      recPane;
    final Container        cp        = getContentPane();
    final JPanel        butPane;
    final WindowAdapter      winListener;
    final String        className    = getClass().getName();
    final AudioFileDescr    displayAFD    = doc.getDisplayDescr();
    final JButton        ggPeakReset;
    final JToolBar        tbMonitoring;
    final TimeLabel        lbTime;
    final MessageFormat      frmtPeak    = new MessageFormat( getResourceString( "msgPeak" ), Locale.US ); // XXX Locale.US
    final Object[]        peakArgs    = new Object[1];
    final JRootPane        rp        = getRootPane();
    final InputMap        imap      = rp.getInputMap( JComponent.WHEN_IN_FOCUSED_WINDOW );
    final ActionMap        amap      = rp.getActionMap();
    final JButton        ggAbort, ggRecord, ggStop, ggClose;
    final int          myMeta      = BasicMenuFactory.MENU_SHORTCUT == InputEvent.CTRL_MASK ?
      InputEvent.CTRL_MASK | InputEvent.SHIFT_MASK : BasicMenuFactory.MENU_SHORTCUT;  // META on Mac, CTRL+SHIFT on PC

    // use same encoding as parent document
    encodingString = (displayAFD.sampleFormat == AudioFileDescr.FORMAT_INT ? "int" : "float") +
             String.valueOf( displayAFD.bitsPerSample );
//encodingString = "float32";

    audioPrefs  = app.getUserPrefs().node( PrefsUtil.NODE_AUDIO );
    classPrefs  = app.getUserPrefs().node( className.substring( className.lastIndexOf( '.' ) + 1 ));
   
    recPane    = new SpringPanel( 4, 2, 4, 2 );
//    affp    = new AudioFileFormatPane( AudioFileFormatPane.ENCODING );
//    recPane.gridAdd( new JLabel( getResourceString( "labelFormat" ), SwingConstants.RIGHT ), 0, 1 );
//    recPane.gridAdd( affp, 1, 1 );
    ggRecordConfig  = new PrefComboBox();
    ggRecordConfig.setFocusable( false );
    lbPeak      = new JLabel();
    actionPeakReset  = new ActionPeakReset();
    ggPeakReset    = new JButton( actionPeakReset );
    ggPeakReset.setFocusable( false );
    lbTime      = new TimeLabel();
    tbMonitoring  = new JToolBar();
    tbMonitoring.setFloatable( false );
    ggMonitoring  = new JToggleButton( new ActionMonitoring() );
    ggMonitoring.setFocusable( false );
    tbMonitoring.add( ggMonitoring );
    recPane.gridAdd( lbTime, 1, 0, -2, 1 );
    recPane.gridAdd( new JLabel( getResourceString( "labelRecInputs" ), SwingConstants.RIGHT ), 0, 1 );
    recPane.gridAdd( ggRecordConfig, 1, 1, -1, 1 );
    recPane.gridAdd( tbMonitoring, 2, 1 );
    recPane.gridAdd( new JLabel( getResourceString( "labelHeadroom" ) + " :", SwingConstants.RIGHT ), 0, 2 );
    recPane.gridAdd( lbPeak, 1, 2 );
//    recPane.gridAdd( new JLabel( getResourceString( "labelDB" ), SwingConstants.RIGHT ), 2, 1 );
    recPane.gridAdd( ggPeakReset, 2, 2, -1, 1 );
   
    refillConfigs();

//    affp.setPreferences( classPrefs );
    ggRecordConfig.setPreferences( classPrefs, KEY_CONFIG );

    recPane.makeCompactGrid();

    butPane        = new JPanel(); // new FlowLayout( FlowLayout.TRAILING ));
    butPane.setLayout( new BoxLayout( butPane, BoxLayout.X_AXIS ));
    actionRecord    = new ActionRecord();
    actionStop      = new ActionStop();
View Full Code Here

   
    final Container    cp      = getContentPane();
//    final JRootPane    rp      = getRootPane();
    final JScrollPane  ggScroll;
    final JPanel    p2      = new JPanel( new BorderLayout() );
    final SpringPanel  p3      = new SpringPanel( 4, 2, 4, 2 );
    JLabel        lb;

    p      = new SpringPanel( 4, 2, 4, 2 );
   
    p3.gridAdd( new JLabel( getResourceString( "labelName" )), 0, 0 );
    lbName    = new JLabel();
    p3.gridAdd( lbName, 1, 0 );
   
    p3.gridAdd( new JLabel( getResourceString( "labelSampleRate" )), 0, 1 );
    ggRate    = new ParamField();
    ggRate.addSpace( ParamSpace.spcFreqHertz.reshape( 0.01, Double.POSITIVE_INFINITY, 44100.0 ));
    ggRate.addListener( this );
    p3.gridAdd( ggRate, 1, 1 );
   
    ggComment  = new JTextArea( 4, 24 );
    new LooseFocusAction( ggComment );
    ggComment.addFocusListener( new FocusAdapter() {
      public void focusLost( FocusEvent e )
      {
        if( doc != null ) {
          final AudioFileDescr  displayAFD  = doc.getDisplayDescr();
          final String      newText    = ggComment.getText();
          final String      oldText    = (String) displayAFD.getProperty( AudioFileDescr.KEY_COMMENT );
         
          if( !newText.equals( oldText )) {
            doc.getUndoManager().addEdit( new EditChangeAudioFileDescr( this, displayAFD,
              AudioFileDescr.KEY_COMMENT, newText, getResourceString( "editChangeComment" )).perform() );
          }
        }
      }
    });
    ggScroll  = new JScrollPane( ggComment, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,
                                         ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER );
    lb      = new JLabel( getResourceString( "labelComment" ));
    lb.setVerticalAlignment( SwingConstants.TOP );
    p.gridAdd( lb, 0, 2 );
    ggComment.setLineWrap( true );
    ggComment.setWrapStyleWord( true );
    p.gridAdd( ggScroll, 1, 2, 1, 2 );
   
    p.makeCompactGrid();
    p3.makeCompactGrid();
    p2.add( p3, BorderLayout.NORTH );
    p2.add( p, BorderLayout.CENTER );
   
    cp.add( p2, BorderLayout.CENTER );
//        if( AbstractApplication.getApplication().getUserPrefs().getBoolean( PrefsUtil.KEY_INTRUDINGSIZE, false )) {
View Full Code Here

    setTitle( app.getResourceString( "paletteObserver" ));
    setResizable( false );
   
    final Container    cp    = getContentPane();
    JPanel        c;
    SpringPanel      p;
    JLabel        lb;
    GridBagLayout    lay;
    GridBagConstraints  con;

    ggTabPane = new JTabbedPane();
        ggTabPane.setTabLayoutPolicy( JTabbedPane.WRAP_TAB_LAYOUT );

    // ----- cursor tab ------
    c        = new JPanel();
    lay        = new GridBagLayout();
    con        = new GridBagConstraints();
    con.insets    = new Insets( 2, 2, 2, 2 );
    c.setLayout( lay );
    con.weightx    = 1.0;
    con.gridwidth   = GridBagConstraints.REMAINDER;
    lbCursorInfo  = new JLabel[ NUM_CURSOR_ROWS ];
    for( int i = 0; i < NUM_CURSOR_ROWS; i++ ) {
      lb      = new JLabel();
      lay.setConstraints( lb, con );
      c.add( lb );
      lbCursorInfo[i] = lb;
    }
    ggTabPane.addTab( app.getResourceString( "observerCursor" ), null, c, null );
       
    // ----- timeline tab ------
    timeTrans    = new DefaultUnitTranslator();
   
    p        = new SpringPanel( 4, 2, 4, 2 );
    lb        = new JLabel( app.getResourceString( "observerStart" ), RIGHT );
    p.gridAdd( lb, 1, 0 );
    ggTimelineStart  = new ParamField( timeTrans );
    ggTimelineStart.addSpace( ParamSpace.spcTimeHHMMSS );
    ggTimelineStart.addSpace( ParamSpace.spcTimeSmps );
    ggTimelineStart.addSpace( ParamSpace.spcTimeMillis );
    ggTimelineStart.addSpace( ParamSpace.spcTimePercentR );
    ggTimelineStart.addListener( this );
    p.gridAdd( ggTimelineStart, 2, 0 );
    lb.setLabelFor( ggTimelineStart );
   
    ggLockStop    = new LockButton( true );
    ggLockStop.addActionListener( this );
    p.gridAdd( ggLockStop, 0, 1 );
    lb        = new JLabel( app.getResourceString( "observerStop" ), RIGHT );
    p.gridAdd( lb, 1, 1 );
    ggTimelineStop  = new ParamField( timeTrans );
    ggTimelineStop.addSpace( ParamSpace.spcTimeHHMMSS );
    ggTimelineStop.addSpace( ParamSpace.spcTimeSmps );
    ggTimelineStop.addSpace( ParamSpace.spcTimeMillis );
    ggTimelineStop.addSpace( ParamSpace.spcTimePercentR );
    ggTimelineStop.addListener( this );
    p.gridAdd( ggTimelineStop, 2, 1 );
    lb.setLabelFor( ggTimelineStop );

    ggLockLen    = new LockButton( true );
    ggLockLen.addActionListener( this );
    p.gridAdd( ggLockLen, 0, 2 );
    lb        = new JLabel( app.getResourceString( "observerLen" ), RIGHT );
    p.gridAdd( lb, 1, 2 );
    ggTimelineLen  = new ParamField( timeTrans );
    ggTimelineLen.addSpace( ParamSpace.spcTimeHHMMSS );
    ggTimelineLen.addSpace( ParamSpace.spcTimeSmps );
    ggTimelineLen.addSpace( ParamSpace.spcTimeMillis );
    ggTimelineLen.addSpace( ParamSpace.spcTimePercentR );
    ggTimelineLen.addListener( this );
    p.gridAdd( ggTimelineLen, 2, 2 );
    lb.setLabelFor( ggTimelineLen );
   
    p.makeCompactGrid( false, false );
    ggTabPane.addTab( app.getResourceString( "observerTimeline" ), null, p, null );
       
    cp.add( BorderLayout.CENTER, ggTabPane );
   
    AbstractWindowHandler.setDeepFont( ggTabPane );
View Full Code Here

      perform();
    }
   
    private void perform()
    {
      final SpringPanel      msgPane;
      final int          result;
      final ParamField      ggDuration;
      final Param          durationSmps;
      final DefaultUnitTranslator  timeTrans;
     
      msgPane      = new SpringPanel( 4, 2, 4, 2 );
      timeTrans    = new DefaultUnitTranslator();
      ggDuration    = new ParamField( timeTrans );
      ggDuration.addSpace( ParamSpace.spcTimeHHMMSS );
      ggDuration.addSpace( ParamSpace.spcTimeSmps );
      ggDuration.addSpace( ParamSpace.spcTimeMillis );
      ggDuration.addSpace( ParamSpace.spcTimePercentF );
      msgPane.gridAdd( ggDuration, 0, 0 );
      msgPane.makeCompactGrid();
      GUIUtil.setInitialDialogFocus( ggDuration );

      timeTrans.setLengthAndRate( timeline.getLength(), timeline.getRate() );

      if( value == null ) {
View Full Code Here

    final Flag            haveWarned      = new Flag( false );
    final String          txtWarnLookAndFeel  = getResourceString( "warnLookAndFeelUpdate" );

    final TreeExpanderButton    ggTreeAudio;
    final List            collAudioAdvanced;
    SpringPanel            tab;
    PrefParamField          ggParam;
    BasicPathField          ggPath;
    PrefCheckBox          ggCheckBox;
        PrefComboBox          ggChoice;
    JTabbedPane            ggTabPane;
    JLabel              lb;
    JComboBox            ggCombo;
        UIManager.LookAndFeelInfo[]    lafInfos;
    Box                b;

    Preferences            prefs;
    String              key, key2, title;
    int                row;

    ggTabPane  = new JTabbedPane();

    // ---------- global pane ----------

    tab    = createTab();

    row    = 0;
    prefs   = IOUtil.getUserPrefs();
    key    = IOUtil.KEY_TEMPDIR;
    key2  = "prefsTmpDir";
    lb    = new JLabel( getResourceString( key2 ), TRAILING );
    tab.gridAdd( lb, 0, row );
    ggPath  = new BasicPathField( PathField.TYPE_FOLDER, getResourceString( key2 ));
    ggPath.setPreferences( prefs, key );
    tab.gridAdd( ggPath, 1, row );

    row++;
    cm    = PrefCacheManager.getInstance();
    prefs   = cm.getPreferences();
    key    = PrefCacheManager.KEY_ACTIVE;
    key2  = "prefsCache";
    lb    = new JLabel( getResourceString( key2 ), TRAILING );
    tab.gridAdd( lb, 0, row );
    ggCheckBox = new PrefCheckBox( getResourceString( "prefsCacheActive" ));
    ggCheckBox.setPreferences( prefs, key );
//    tab.gridAdd( ggCheckBox, 1, row, -1, 1 );
    b    = Box.createHorizontalBox();
    b.add( ggCheckBox );
//
//    row++;
    key    = PrefCacheManager.KEY_CAPACITY;
    key2  = "prefsCacheCapacity";
    lb    = new JLabel( getResourceString( key2 ) + " [" +
                getResourceString( "labelMegaBytes" ) + "]", TRAILING );
//    tab.gridAdd( lb, 0, row );
    b.add( Box.createHorizontalStrut( 16 ));
    b.add( lb );
    ggParam  = new PrefParamField();
    ggParam.addSpace( spcIntegerFromOne );
    ggParam.setPreferences( prefs, key );
//    tab.gridAdd( ggParam, 1, row, -1, 1 );
    b.add( ggParam );
    tab.gridAdd( b, 1, row, -1, 1 );

    row++;   
    key    = PrefCacheManager.KEY_FOLDER;
    key2  = "prefsCacheFolder";
    lb    = new JLabel( getResourceString( key2 ), TRAILING );
    tab.gridAdd( lb, 0, row );
    ggPath  = new BasicPathField( PathField.TYPE_FOLDER, getResourceString( key2 ));
    ggPath.setPreferences( prefs, key );
    tab.gridAdd( ggPath, 1, row );

    row++;
    prefs   = app.getUserPrefs();
        key     = PrefsUtil.KEY_LOOKANDFEEL;
    key2  = "prefsLookAndFeel";
    title  = getResourceString( key2 );
    lb    = new JLabel( title, TRAILING );
    tab.gridAdd( lb, 0, row );
    ggChoice = new PrefComboBox();
    lafInfos = UIManager.getInstalledLookAndFeels();
        for( int i = 0; i < lafInfos.length; i++ ) {
            ggChoice.addItem( new StringItem( lafInfos[i].getClassName(), lafInfos[i].getName() ));
        }
    ggChoice.setPreferences( prefs, key );
    ggChoice.addActionListener( new WarnPrefsChange( ggChoice, ggChoice, haveWarned, txtWarnLookAndFeel, title ));
   
    tab.gridAdd( ggChoice, 1, row, -1, 1 );

    row++;
         key    = BasicWindowHandler.KEY_LAFDECORATION;
    key2  = "prefsLAFDecoration";
    title  = getResourceString( key2 );
    ggCheckBox  = new PrefCheckBox( title );
    ggCheckBox.setPreferences( prefs, key );
    tab.gridAdd( ggCheckBox, 1, row, -1, 1 );
    ggCheckBox.addActionListener( new WarnPrefsChange( ggCheckBox, ggCheckBox, haveWarned, txtWarnLookAndFeel, title ));

    row++;
         key    = BasicWindowHandler.KEY_INTERNALFRAMES;
    key2  = "prefsInternalFrames";
    title  = getResourceString( key2 );
    ggCheckBox  = new PrefCheckBox( title );
    ggCheckBox.setPreferences( prefs, key );
    tab.gridAdd( ggCheckBox, 1, row, -1, 1 );
    ggCheckBox.addActionListener( new WarnPrefsChange( ggCheckBox, ggCheckBox, haveWarned, txtWarnLookAndFeel, title ));

    row++;
         key    = CoverGrowBox.KEY_INTRUDINGSIZE;
    key2  = "prefsIntrudingSize";
    ggCheckBox  = new PrefCheckBox( getResourceString( key2 ));
    ggCheckBox.setPreferences( prefs, key );
    tab.gridAdd( ggCheckBox, 1, row, -1, 1 );

    row++;
         key    = BasicWindowHandler.KEY_FLOATINGPALETTES;
    key2  = "prefsFloatingPalettes";
    ggCheckBox  = new PrefCheckBox( getResourceString( key2 ));
    ggCheckBox.setPreferences( prefs, key );
    tab.gridAdd( ggCheckBox, 1, row, -1, 1 );
    ggCheckBox.addActionListener( new WarnPrefsChange( ggCheckBox, ggCheckBox, haveWarned, txtWarnLookAndFeel, title ));

//    row++;
//    prefs   = GUIUtil.getUserPrefs();
//    key2  = "prefsKeyStrokeHelp";
//    lb    = new JLabel( getResourceString( key2 ), JLabel.TRAILING );
//    tab.gridAdd( lb, 0, row );
//    ggKeyStroke = new KeyStrokeTextField();
//    ggKeyStroke.setPreferences( prefs, key );
//    tab.gridAdd( ggKeyStroke, 1, row, -1, 1 );

    addTab( ggTabPane, tab, "prefsGeneral");

    // ---------- audio pane ----------

    prefs   = app.getUserPrefs().node( PrefsUtil.NODE_AUDIO );
    audioPrefs  = prefs;
    abPrefs  = audioPrefs.node( PrefsUtil.NODE_AUDIOBOXES );
    tab    = createTab();

    row    = 0;
    key    = PrefsUtil.KEY_SUPERCOLLIDERAPP;
    key2  = "prefsSuperColliderApp";
    lb    = new JLabel( getResourceString( key2 ), TRAILING );
    tab.gridAdd( lb, 0, row );
    ggPath = new BasicPathField( PathField.TYPE_INPUTFILE, getResourceString( key2 ));
    ggPath.setPreferences( prefs, key );
//    HelpGlassPane.setHelp( ggPath, key2 );
    tab.gridAdd( ggPath, 1, row );

//    row++;
//    key    = PrefsUtil.KEY_SUPERCOLLIDEROSC;
//    key2  = "prefsSuperColliderOSC";
//    lb    = new JLabel( getResourceString( key2 ), JLabel.TRAILING );
//    tab.gridAdd( lb, 0, row );
//    ggText  = new PrefTextField( 32 );
//    ggText.setPreferences( prefs, key );
//    tab.gridAdd( ggText, 1, row, -1, 1 );

        row++;
        key    = PrefsUtil.KEY_AUTOBOOT;
        key2  = "prefsAutoBoot";
//    lb    = new JLabel( getResourceString( key2 ), JLabel.TRAILING );
//    tab.gridAdd( lb, 0, row );
        ggCheckBox  = new PrefCheckBox( getResourceString( key2 ));
        ggCheckBox.setPreferences( prefs, key );
//    HelpGlassPane.setHelp( ggCheckBox, key2 );
        tab.gridAdd( ggCheckBox, 1, row, -1, 1 );

     row++;
        key    = PrefsUtil.KEY_AUTOPLAYFROMFINDER;
    key2  = "prefsAutoPlayFromFinder";
    lb    = new JLabel( getResourceString( key2 ), JLabel.TRAILING );
    tab.gridAdd( lb, 0, row );
        ggChoice = new PrefComboBox();
        ggChoice.addItem( new StringItem( PrefsUtil.AUTOPLAYFROMFINDER_NONE, getResourceString( key2 + "." + PrefsUtil.AUTOPLAYFROMFINDER_NONE )));
        ggChoice.addItem( new StringItem( PrefsUtil.AUTOPLAYFROMFINDER_PLAY, getResourceString( key2 + "." + PrefsUtil.AUTOPLAYFROMFINDER_PLAY )));
        ggChoice.addItem( new StringItem( PrefsUtil.AUTOPLAYFROMFINDER_LOOP, getResourceString( key2 + "." + PrefsUtil.AUTOPLAYFROMFINDER_LOOP )));
        ggChoice.setPreferences( prefs, key );
        tab.gridAdd( ggChoice, 1, row, -1, 1 );

    row++;
    lb    = new JLabel( getResourceString( "labelAudioIFs" ), TRAILING );
    tab.gridAdd( lb, 0, row );
    tab.gridAdd( createAudioBoxGUI(), 1, row, 1, -1 );

    row++;
    key    = PrefsUtil.KEY_AUDIORATE;
    key2  = "prefsAudioRate";
    lb    = new JLabel( getResourceString( key2 ), TRAILING );
    tab.gridAdd( lb, 0, row );
    ggParam  = new PrefParamField();
    ggParam.addSpace( ParamSpace.spcFreqHertz );
    ggCombo = new JComboBox();
    for( int i = 0; i < RATE_ITEMS.length; i++ ) {
      ggCombo.addItem( RATE_ITEMS[ i ]);
    }
    ggParam.setBorder( new ComboBoxEditorBorder() );
    ggCombo.setEditor( ggParam );
    ggCombo.setEditable( true );
    ggParam.setPreferences( prefs, key ); // important to be _afer_ setEditor because otherwise prefs get overwritten!
//    ggCombo.setSelectedIndex( 0 ); // DEFAULT_RATE
//ggParam.setPreferredSize( new Dimension( ggParam.getPreferredSize().width, Math.max( 24, ggParam.getPreferredSize().height )));
//ggCombo.setPreferredSize( new Dimension( ggCombo.getPreferredSize().width, Math.max( 24, ggCombo.getPreferredSize().height )));
    tab.gridAdd( ggCombo, 1, row, -1, 1 );

    row++;
    b  = Box.createHorizontalBox();
    b.add( Box.createHorizontalGlue() );
    ggTreeAudio  = new TreeExpanderButton();
    b.add( ggTreeAudio );
    b.add( new JLabel( getResourceString( "prefsAdvanced" )));
    tab.gridAdd( b, 0, row );

    collAudioAdvanced = new ArrayList();

    row++;
    key2  = "prefsSuperColliderOSC";
    lb    = new JLabel( getResourceString( key2 ), TRAILING );
    lb.setVisible( false );
    collAudioAdvanced.add( lb );
    tab.gridAdd( lb, 0, row );
    key    = PrefsUtil.KEY_SCPROTOCOL;
    key2  = "prefsOSCProtocol";
    lb    = new JLabel( getResourceString( key2 ), TRAILING );
//    tab.gridAdd( lb, 2, row );
    b    = Box.createHorizontalBox();
    b.add( Box.createHorizontalStrut( 4 ));
    b.add( lb );
    ggChoice = new PrefComboBox();
    ggChoice.addItem( new StringItem( OSCChannel.TCP, "TCP" ));
    ggChoice.addItem( new StringItem( OSCChannel.UDP, "UDP" ));
    ggChoice.setPreferences( prefs, key );
//    tab.gridAdd( ggChoice, 3, row, -1, 1 );
    b.add( ggChoice );

    key    = PrefsUtil.KEY_SCPORT;
    key2  = "prefsOSCPort";
    lb    = new JLabel( getResourceString( key2 ), TRAILING );
//    tab.gridAdd( lb, 4, row );
    b.add( Box.createHorizontalStrut( 16 ));
    b.add( lb );
    ggParam  = new PrefParamField();
    ggParam.addSpace( spcIntegerFromZero );
    ggParam.setPreferences( prefs, key );
//    tab.gridAdd( ggParam, 5, row, -1, 1 );
    b.add( ggParam );
    b.setVisible( false );
    collAudioAdvanced.add( b );
    tab.gridAdd( b, 1, row, -1, 1 );

    row++;
    key    = PrefsUtil.KEY_SCBLOCKSIZE;
    key2  = "prefsSCBlockSize";
    lb    = new JLabel( getResourceString( key2 ), TRAILING );
    lb.setVisible( false );
    collAudioAdvanced.add( lb );
    tab.gridAdd( lb, 0, row );
    ggParam  = new PrefParamField();
    ggParam.addSpace( spcIntegerFromOne );
    ggParam.setPreferences( prefs, key );
    ggParam.setVisible( false );
    collAudioAdvanced.add( ggParam );
    tab.gridAdd( ggParam, 1, row, -1, 1 );

    row++;
    key    = PrefsUtil.KEY_AUDIOBUSSES;
    key2  = "prefsAudioBusses";
    lb    = new JLabel( getResourceString( key2 ), TRAILING );
    lb.setVisible( false );
    collAudioAdvanced.add( lb );
    tab.gridAdd( lb, 0, row );
    ggParam  = new PrefParamField();
    ggParam.addSpace( spcIntegerFromOne );
    ggParam.setPreferences( prefs, key );
    ggParam.setVisible( false );
    collAudioAdvanced.add( ggParam );
    tab.gridAdd( ggParam, 1, row, -1, 1 );
//    pAudio.makeCompactGrid();
//    pAudio.setVisible( false );

    row++;
    key    = PrefsUtil.KEY_SCMEMSIZE;
    key2  = "prefsSCMemSize";
    lb    = new JLabel( getResourceString( key2 ), TRAILING );
    lb.setVisible( false );
    collAudioAdvanced.add( lb );
    tab.gridAdd( lb, 0, row );
    ggParam  = new PrefParamField();
    ggParam.addSpace( spcIntegerFromOne );
    ggParam.setPreferences( prefs, key );
    ggParam.setVisible( false );
    collAudioAdvanced.add( ggParam );
    tab.gridAdd( ggParam, 1, row, -1, 1 );

    row++;
    key    = PrefsUtil.KEY_SCRENDEZVOUS;
    key2  = "prefsSCRendezvous";
    lb    = new JLabel( getResourceString( key2 ), TRAILING );
    lb.setVisible( false );
    collAudioAdvanced.add( lb );
    tab.gridAdd( lb, 0, row );
    ggCheckBox  = new PrefCheckBox();
    ggCheckBox.setPreferences( prefs, key );
    ggCheckBox.setVisible( false );
    collAudioAdvanced.add( ggCheckBox );
    tab.gridAdd( ggCheckBox, 1, row, -1, 1 );

final SpringPanel tabAudio = tab;
    ggTreeAudio.addActionListener( new ActionListener() {
      public void actionPerformed( ActionEvent e )
      {
        final int    width  = getWindow().getWidth();
        final int    height  = getWindow().getHeight();
        final boolean  visible  = ggTreeAudio.isExpanded();
        int        delta  = 0;
        int        d2;
       
        for( int i = 0; i < collAudioAdvanced.size(); ) {
          d2 = 0;
          for( int j = i + 2; i < j; i++ ) {
            d2 = Math.max( d2, ((JComponent) collAudioAdvanced.get( i )).getPreferredSize().height );
          }
          delta = delta + d2 + 2;
        }

        for( int i = 0; i < collAudioAdvanced.size(); i++ ) {
          ((JComponent) collAudioAdvanced.get( i )).setVisible( visible );
        }
        tabAudio.makeCompactGrid();
        getWindow().setSize( width, height + (visible ? delta : -delta ));
      }
    });

    addTab( ggTabPane, tab, "prefsAudio" );
View Full Code Here

    app.addComponent( Main.COMP_PREFS, this );
    }
   
    private SpringPanel createTab()
    {
      return new SpringPanel( 2, 1, 4, 2 );
    }
View Full Code Here

    final Flag          threadRunning    = new Flag( true );
//    final JOptionPane      op;
//    final JDialog        dlg;
//    final SpringPanel      pane;
    final JPanel        pane;
    final SpringPanel      pane2;
    final Thread        testThread;
    final Runnable        runResult;
    final IndeterminateSpinner  ggSpinner;
    final JLabel        ggLabel;
    final JList          ggListAdd, ggListActivate, ggListRemove;
    final Box          b;
    final JComboBox        ggComboAdd, ggComboActivate, ggComboRemove;
    final int          result;
    JScrollPane          ggScroll;
//    JSeparator          ggSep;
    int              row, action;
    AudioBoxConfig        cfg;
   
    final List          collDetected    = Collections.synchronizedList( new ArrayList() );
    final List           collAdd        = new ArrayList();
    final List           collActivate    = new ArrayList();
    final List           collRemove      = new ArrayList();
   
    // this doesn't show up obivously, so we add it manually...
    collDetected.add( new AudioBoxConfig( AudioBoxConfig.ID_DEFAULT, "Default", 8, 8, true ));
   
    scsynthPath = audioPrefs.get( PrefsUtil.KEY_SUPERCOLLIDERAPP, null );
    if( scsynthPath == null ) {
      System.err.println( getResourceString( "errSCSynthAppNotFound" ));
      return;
    }
   
    pane = new JPanel( new BorderLayout() );
//pane.setBackground( Color.white );
    ggSpinner = new IndeterminateSpinner( 24 );
    b = Box.createHorizontalBox();
//    pane.gridAdd( ggSpinner, 0, 0 );
    b.add( ggSpinner );
    b.add( Box.createHorizontalStrut( 4 ));
    ggLabel = new JLabel( "Searching for Audio Devices..." );
//    ggLabel.setBorder( BorderFactory.createEmptyBorder( 0, 4, 0, 0 ));
//    pane.gridAdd( ggLabel, 1, 0 );
    b.add( ggLabel );
    pane.add( b, BorderLayout.NORTH );
   
    pane2 = new SpringPanel( 0, 0, 4, 2 );
    row = 0;
    ggListAdd = new JList();
    ggScroll = new JScrollPane( ggListAdd );
    pane2.gridAdd( new JLabel( "Detected new devices:" ), 0, row++, 2, 1 );
    pane2.gridAdd( ggScroll, 0, row++, 2, 1 );
    pane2.gridAdd( new JLabel( "Action:", RIGHT ), 0, row );
    ggComboAdd = new JComboBox( new Object[] { "Ignore", "Add to list" });
    pane2.gridAdd( ggComboAdd, 1, row++ );
    pane2.gridAdd( createVSep(), 0, row++, 2, 1 );

    ggListActivate = new JList();
    ggScroll = new JScrollPane( ggListActivate );
    pane2.gridAdd( new JLabel( "Detected deactivated devices:" ), 0, row++, 2, 1 );
    pane2.gridAdd( ggScroll, 0, row++, 2, 1 );
    pane2.gridAdd( new JLabel( "Action:", RIGHT ), 0, row );
    ggComboActivate = new JComboBox( new Object[] { "Ignore", "Make active" });
    pane2.gridAdd( ggComboActivate, 1, row++ );
    pane2.gridAdd( createVSep(), 0, row++, 2, 1 );

//    ggSep  = new JSeparator();
//    ggSep.setBorder( BorderFactory.createEmptyBorder( 8, 0, 8, 0 ));
//    pane2.gridAdd( ggSep, 0, row++, 2, 1 );
    ggListRemove = new JList();
    ggScroll = new JScrollPane( ggListRemove );
    pane2.gridAdd( new JLabel( "Devices not found:" ), 0, row++, 2, 1 );
    pane2.gridAdd( ggScroll, 0, row++, 2, 1 );
    pane2.gridAdd( new JLabel( "Action:", RIGHT ), 0, row );
    ggComboRemove = new JComboBox( new Object[] { "Ignore", "Make inactive", "Remove from list" });   
    pane2.gridAdd( ggComboRemove, 1, row++ );
    pane2.setVisible( false );
    pane.add( pane2, BorderLayout.CENTER );
    AbstractWindowHandler.setDeepFont( pane );
   
//    op = new JOptionPane( pane, JOptionPane.PLAIN_MESSAGE, JOptionPane.OK_CANCEL_OPTION,
//        new ImageIcon( GUIUtil.class.getResource( "assistent_64x64.png" )));
//    dlg = op.createDialog( getWindow(), getResourceString( "prefsAudioDevicesAssistent" ) );

    runResult = new Runnable() {
      public void run()
      {
//        String      name;
        AudioBoxConfig  cfg3, cfg2;

        for( Iterator iter = collDetected.iterator(); iter.hasNext(); ) {
          cfg2 = (AudioBoxConfig) iter.next();
          if( !setAudioBoxNames.contains( cfg2.name )) {
            collAdd.add( cfg2 );
          } else {
            cfg3 = boxForName( cfg2.name );
            if( (cfg3 != null) && !cfg3.active ) collActivate.add( cfg3 );
          }
        }
iterRemove:    for( Iterator iter = collAudioBoxConfigs.iterator(); iter.hasNext(); ) {
          cfg3 = (AudioBoxConfig) iter.next();
          for( Iterator iter2 = collDetected.iterator(); iter2.hasNext(); ) {
            cfg2 = (AudioBoxConfig) iter2.next();
            if( cfg2.name.equals( cfg3.name )) continue iterRemove;
          }
          collRemove.add( cfg3 );
        }
       
        Collections.sort( collAdd );
        Collections.sort( collActivate );
        Collections.sort( collRemove );
       
        ggListAdd.setListData( collAdd.toArray() );
        ggListAdd.setVisibleRowCount( Math.max( 1, Math.min( collAdd.size(), 6 )));
        if( collAdd.isEmpty() ) {
          ggComboAdd.setEnabled( false );
        } else {
          ggComboAdd.setSelectedIndex( 1 );
        }
        ggListActivate.setListData( collActivate.toArray() );
        ggListActivate.setVisibleRowCount( Math.max( 1, Math.min( collActivate.size(), 6 )));
        ggListAdd.setVisibleRowCount( Math.max( 1, Math.min( collAdd.size(), 6 )));
        if( collActivate.isEmpty() ) {
          ggComboActivate.setEnabled( false );
        } else {
          ggComboActivate.setSelectedIndex( 1 );
        }
        ggListRemove.setListData( collRemove.toArray() );
        ggListRemove.setVisibleRowCount( Math.max( 1, Math.min( collRemove.size(), 6 )));
        if( collRemove.isEmpty() ) {
          ggComboRemove.setEnabled( false );
        } else {
          ggComboRemove.setSelectedIndex( 1 );
        }
        pane2.makeCompactGrid();
        b.setVisible( false );
        pane2.setVisible( true );
//        pane.makeCompactGrid();
       
//        dlg.pack();
        ((JDialog) SwingUtilities.getAncestorOfClass( JDialog.class, pane2 )).pack();
      }
View Full Code Here

    final JPanel      b2        = new JPanel( new BorderLayout() ); // Box.createHorizontalBox();
    final MultiStateButton  ggLimiter;
    audioPrefs                = app.getUserPrefs().node( PrefsUtil.NODE_AUDIO );
    final Object      comboProto    = "XXXXXXXX";

    b1        = new SpringPanel( 2, 4, 2, 4 );
    lmm.setDynamicComponent( b1 );
    ggVolume    = new VolumeFader();
    ggOutputConfig  = new PrefComboBox();
    ggOutputConfig.putClientProperty( "JComboBox.isSquare", Boolean.TRUE );
    ggAudioBox    = new PrefComboBox();
View Full Code Here

      editIdx = -(editIdx + 2);
      if( editIdx == -1 ) return;
    }
 
    if( editMarkerPane == null ) {
      final SpringPanel    spring;
      final ActionMap      amap;
      final InputMap      imap;
      JLabel          lb;
      KeyStroke        ks;
      Action          a;

      spring      = new SpringPanel( 4, 2, 4, 2 );
      ggMarkName    = new JTextField( 24 );
//      GUIUtil.setInitialDialogFocus( ggMarkName );  // removes itself automatically
      ggMarkName.addAncestorListener( new AncestorAdapter() {
        public void ancestorAdded( AncestorEvent e ) {
          ggMarkName.requestFocusInWindow();
          ggMarkName.selectAll();
//          c.removeAncestorListener( this );
        }
      });

      // XXX sync
      timeTrans    = new DefaultUnitTranslator();
      ggMarkPos    = new ParamField( timeTrans );
      ggMarkPos.addSpace( ParamSpace.spcTimeHHMMSS );
      ggMarkPos.addSpace( ParamSpace.spcTimeSmps );
      ggMarkPos.addSpace( ParamSpace.spcTimeMillis );
      ggMarkPos.addSpace( ParamSpace.spcTimePercentF );

      lb        = new JLabel( getResourceString( "labelName" ));
//      lb.setLabelFor( ggMarkName );
      spring.gridAdd( lb, 0, 0 );
      spring.gridAdd( ggMarkName, 1, 0 );
      lb        = new JLabel( getResourceString( "labelPosition" ));
//      lb.setLabelFor( ggMarkPos );
      spring.gridAdd( lb, 0, 1 );
      spring.gridAdd( ggMarkPos, 1, 1, -1, 1 );
//      GUIUtil.setDeepFont( spring, null );
      spring.makeCompactGrid();
      editMarkerPane  = new JPanel( new BorderLayout() );
      editMarkerPane.add( spring, BorderLayout.NORTH );
     
      amap      = spring.getActionMap();
      imap      = spring.getInputMap( JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT );
      ks        = KeyStroke.getKeyStroke( KeyEvent.VK_LEFT, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask() );
// XXX DOESN'T WORK ;-(
//      ggMarkName.getInputMap().remove( ks );
      imap.put( ks, "prev" );
      a        = new ActionEditPrev();
View Full Code Here

TOP

Related Classes of de.sciss.gui.SpringPanel

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.