Package de.sciss.gui

Examples of de.sciss.gui.TreeExpanderButton


    final Box            boxStatus1    = Box.createHorizontalBox();
    final JPanel          bottomPane    = new JPanel( new BorderLayout( 4, 2 ));
    final JScrollPane        ggScroll;
//    final JButton          ggBoot;
    final AbstractWindow.Listener  winListener;
    final TreeExpanderButton    ggStatusExp;
//    String[]            cfgNames    = null;
    final String[]          fntNames;
 
    lta        = new LogTextArea( 16, 40, false, null );
    ggScroll    = lta.placeMeInAPane();
    lta.makeSystemOutput();
   
    actionBoot    = new ActionBoot();
//    ggBoot      = new JButton( actionBoot );
    ggBoot      = new MultiStateButton();
    ggBoot.setFocusable( false )// prevent user from accidentally starting/stopping server
    ggBoot.setAutoStep( false );
    ggBoot.addActionListener( actionBoot );
   
//    ggDumpOSC    = new JCheckBox( getResourceString( "labelDumpOSC" ));
//    ggDumpOSC.addItemListener( new ItemListener() {
//      public void itemStateChanged( ItemEvent e ) {
//        root.superCollider.dumpOSC( ggDumpOSC.isSelected() ? kDumpText : kDumpOff );
//      }
//    });
    ggDumpOSC    = new MultiStateButton();
    ggDumpOSC.setFocusable( false );
    ggDumpOSC.addActionListener( new ActionListener() {
      public void actionPerformed( ActionEvent e ) {
        superCollider.dumpOSC( ggDumpOSC.getSelectedIndex() );
      }
    });
//    ggDumpOSC.addItem( getResourceString( "labelDumpOff" ), null, null );
//    ggDumpOSC.addItem( getResourceString( "labelDumpText" ), null, new Color( 0xFF, 0xFA, 0x9D ), new Color( 0xFA, 0xE7, 0x9D ));
//    ggDumpOSC.addItem( getResourceString( "labelDumpHex" ), null, new Color( 0xFA, 0x9D, 0xFF ), new Color( 0xE7, 0x9D, 0xFA ));

        JLabel ggImport = new JLabel("<html><body><i>Drop</i></body>", null, SwingConstants.CENTER);
        ggImport.setForeground(Color.darkGray);
        ggImport.setTransferHandler(new TransferHandler() {
            @Override
            public boolean canImport(TransferSupport support) {
                return support.isDataFlavorSupported(DataFlavor.javaFileListFlavor);
            }

            @Override
            public boolean importData(TransferSupport support) {
                if (support.isDataFlavorSupported(DataFlavor.javaFileListFlavor)) {
                    try {
                        java.util.List fs = (java.util.List)
                                support.getTransferable().getTransferData(DataFlavor.javaFileListFlavor);
                        for (int i = 0; i < fs.size(); i++) {
                            File f = (File) fs.get(i);
                            // System.out.println(f);
                            ((BasicApplication) app).getMenuFactory().openDocument(f);
                        }
                        return true;
                    } catch (IOException e) {
                        return false;
                    } catch (UnsupportedFlavorException e) {
                        return false;
                    }
                } else {
                    return false;
                }
            }
        });
        ggImport.setToolTipText("Drop audio files here to open them");
        ggImport.setBorder(new AbstractBorder() {
            @Override public Insets getBorderInsets(Component c, Insets insets) {
                insets.top  = insets.bottom = 5;
                insets.left = insets.right  = 8;
                return insets;
            }

            private final Stroke strk = new BasicStroke(1.5f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_MITER,
                    10.0f, new float[] { 3f, 3f }, 0.0f);

            @Override
            public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
                Graphics2D g2 = (Graphics2D) g;
                g2.setColor(Color.darkGray);
                g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
                // g2.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_PURE);
                g2.setStroke(strk);
                g2.drawRoundRect(x + 1, y + 1, width - 3, height - 3, 8, 8);
            }
        });
        Dimension importPref = ggImport.getPreferredSize();
        // importPref.width = 100;
        ggImport.setPreferredSize(importPref);
        ggImport.setMaximumSize  (importPref);

    boxStatus2    = Box.createHorizontalBox();
    msgStatus1    = new MessageFormat( getResourceString( "ptrnServerStatus1" ), Locale.US );
    msgStatus2    = new MessageFormat( getResourceString( "ptrnServerStatus2" ), Locale.US );
    unknownStatus  = getResourceString( "labelServerNotRunning" );
    lbStatus1    = new JLabel( unknownStatus );
    lbStatus2    = new JLabel();

    ggStatusExp  = new TreeExpanderButton();
    ggStatusExp.setExpandedToolTip( getResourceString( "buttonExpStatsTT" ));
    ggStatusExp.setCollapsedToolTip( getResourceString( "buttonCollStatsTT" ));
    ggStatusExp.addActionListener( new ActionListener() {
      public void actionPerformed( ActionEvent e )
      {
        final Dimension  d  = getSize();

        if( ggStatusExp.isExpanded() ) {
          boxStatus2.setVisible( true );
          setSize( new Dimension( d.width, d.height + boxStatus2.getPreferredSize().height + 2 ));
        } else {
          boxStatus2.setVisible( false );
          setSize( new Dimension( d.width, d.height - (boxStatus2.getPreferredSize().height + 2) ));
View Full Code Here


    topPane.add( timeTB );
    transTB.setOpaque( false );
    topPane.add( transTB );
    topPane.add( Box.createHorizontalGlue() );
    cbr      = new ComponentBoundsRestrictor();
    ggTreeExp  = new TreeExpanderButton();
    ggTreeExp.setExpandedToolTip( getResourceString( "buttonExpWaveTT" ));
    ggTreeExp.setCollapsedToolTip( getResourceString( "buttonCollWaveTT" ));
    ggTreeExp.setExpanded( true );
    ggTreeExp.addActionListener( new ActionListener() {
      public void actionPerformed( ActionEvent e )
View Full Code Here

    final OSCRoot          osc;
    final PrefCacheManager      cm;
    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;
View Full Code Here

    topPane.add( timeTB );
//    transTB.setOpaque( false );
//    topPane.add( transTB );
    topPane.add( Box.createHorizontalGlue() );
    cbr      = new ComponentBoundsRestrictor();
    ggTreeExp  = new TreeExpanderButton();
    ggTreeExp.setExpandedToolTip( getResourceString( "buttonExpWaveTT" ));
    ggTreeExp.setCollapsedToolTip( getResourceString( "buttonCollWaveTT" ));
    ggTreeExp.setExpanded( true );
    ggTreeExp.addActionListener( new ActionListener() {
      public void actionPerformed( ActionEvent e )
View Full Code Here

TOP

Related Classes of de.sciss.gui.TreeExpanderButton

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.