avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From l...@apache.org
Subject cvs commit: jakarta-avalon-excalibur/instrument-client/src/java/org/apache/excalibur/instrument/client StatusBar.java AbstractInternalFrame.java InstrumentClientFrame.java
Date Fri, 25 Oct 2002 19:07:59 GMT
leif        2002/10/25 12:07:59

  Modified:    instrument-client/src/java/org/apache/excalibur/instrument/client
                        AbstractInternalFrame.java
                        InstrumentClientFrame.java
  Added:       instrument-client/src/java/org/apache/excalibur/instrument/client
                        StatusBar.java
  Log:
  Add a status bar which shows the title of the currently active inner frame.
  Makes it possible to see what the long titles of the frames are.
  
  Revision  Changes    Path
  1.3       +15 -1     jakarta-avalon-excalibur/instrument-client/src/java/org/apache/excalibur/instrument/client/AbstractInternalFrame.java
  
  Index: AbstractInternalFrame.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/instrument-client/src/java/org/apache/excalibur/instrument/client/AbstractInternalFrame.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- AbstractInternalFrame.java	22 Aug 2002 16:50:38 -0000	1.2
  +++ AbstractInternalFrame.java	25 Oct 2002 19:07:58 -0000	1.3
  @@ -30,6 +30,7 @@
       private InstrumentClientFrame m_frame;
       private JInternalFrame m_nextFrame;
       private boolean m_loaded;
  +    private boolean m_active;
   
       /*---------------------------------------------------------------
        * Constructors
  @@ -193,6 +194,15 @@
       {
           return m_frame;
       }
  +    
  +    public void setTitle( String title )
  +    {
  +        super.setTitle( title );
  +        if ( m_active )
  +        {
  +            m_frame.setStatusMessage( getTitle() );
  +        }
  +    }
   
       /*---------------------------------------------------------------
        * InternalFrameListener Methods
  @@ -264,10 +274,14 @@
   
       public void internalFrameActivated( InternalFrameEvent event )
       {
  +        m_active = true;
  +        m_frame.setStatusMessage( getTitle() );
       }
   
       public void internalFrameDeactivated( InternalFrameEvent event )
       {
  +        m_active = false;
  +        m_frame.setStatusMessage( "" );
       }
   }
   
  
  
  
  1.7       +34 -19    jakarta-avalon-excalibur/instrument-client/src/java/org/apache/excalibur/instrument/client/InstrumentClientFrame.java
  
  Index: InstrumentClientFrame.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/instrument-client/src/java/org/apache/excalibur/instrument/client/InstrumentClientFrame.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- InstrumentClientFrame.java	25 Oct 2002 16:45:03 -0000	1.6
  +++ InstrumentClientFrame.java	25 Oct 2002 19:07:58 -0000	1.7
  @@ -66,6 +66,7 @@
       private JDesktopPane m_desktopPane;
       private JSplitPane m_splitPane;
       private MenuBar m_menuBar;
  +    private StatusBar m_statusBar;
   
       private File m_desktopFile;
       private File m_desktopFileDir;
  @@ -667,6 +668,9 @@
           // Create a Menu Bar
           m_menuBar = new MenuBar( this );
           setJMenuBar( m_menuBar );
  +        
  +        m_statusBar = new StatusBar();
  +        getContentPane().add( m_statusBar, BorderLayout.SOUTH );
   
           Toolkit toolkit = getToolkit();
           Dimension screenSize = toolkit.getScreenSize();
  @@ -687,6 +691,11 @@
           }
       }
       
  +    void setStatusMessage( String message )
  +    {
  +        m_statusBar.setStatusMessage( message );
  +    }
  +    
       JDesktopPane getDesktopPane()
       {
           return m_desktopPane;
  @@ -707,9 +716,9 @@
        */
       void tileFrames()
       {
  -        ArrayList openframes = getOpenFrames();
  +        JInternalFrame[] openFrames = getOpenFrames();
           
  -        int count = openframes.size();
  +        int count = openFrames.length;
           if ( count == 0)
           {
               return;
  @@ -737,15 +746,15 @@
               ratio = (float)frameWidth / frameHeight;
           }
           
  -        reorganizeFrames( rows, cols, openframes );
  +        reorganizeFrames( rows, cols, openFrames );
       }
       
       /**
        * Get a list with all open frames. 
        *
  -     * @return ArrayList with references to all open internal frames
  +     * @return Array of all open internal frames
        */
  -    ArrayList getOpenFrames()
  +    JInternalFrame[] getOpenFrames()
       {
           JInternalFrame[] frames = m_desktopPane.getAllFrames();
           int count = frames.length;
  @@ -753,20 +762,26 @@
           // No frames
           if (count == 0) 
           {
  -            return new ArrayList();
  +            // Array is empty, so it is safe to return.
  +            return frames;
           }
       
           // add only open frames to the list
  -        ArrayList openframes = new ArrayList();
  +        ArrayList openFrames = new ArrayList();
           for ( int i = 0; i < count; i++ )
           {
               JInternalFrame f = frames[i];
               if( ( f.isClosed() == false ) && ( f.isIcon() == false ) )
               {
  -                openframes.add( f );
  +                openFrames.add( f );
               }
           }
  -        return openframes;
  +        
  +        // Create a simple array to be returned
  +        frames = new JInternalFrame[ openFrames.size() ];
  +        openFrames.toArray( frames );
  +        
  +        return frames;
       }
       
       /**
  @@ -777,7 +792,7 @@
        * @param cols number of columns to use
        * @param frames list with <code>JInternalFrames</code>
        */  
  -    void reorganizeFrames( int rows, int cols, ArrayList frames )
  +    void reorganizeFrames( int rows, int cols, JInternalFrame[] frames )
       {
           // Determine the size of one windows
           Dimension desktopsize = m_desktopPane.getSize();
  @@ -785,13 +800,13 @@
           int h = desktopsize.height / rows;
           int x = 0;
           int y = 0;
  -        int count = frames.size();
  +        int count = frames.length;
   
           for ( int i = 0; i < rows; ++i)
           {
               for ( int j = 0; j < cols && ( ( i * cols ) + j < count ); ++j
) 
               {
  -                JInternalFrame f = (JInternalFrame) frames.get( ( i * cols ) + j );
  +                JInternalFrame f = frames[ ( i * cols ) + j ];
                   m_desktopPane.getDesktopManager().resizeFrame( f, x, y, w, h );
                   x += w;
               }
  @@ -805,14 +820,14 @@
        */
       void tileFramesH()
       {
  -        ArrayList openframes=getOpenFrames();
  +        JInternalFrame[] openFrames = getOpenFrames();
           
  -        int count = openframes.size();
  +        int count = openFrames.length;
           if ( count == 0 )
           {
               return;
           }
  -        reorganizeFrames( count, 1, openframes );
  +        reorganizeFrames( count, 1, openFrames );
       }
       
       /**
  @@ -820,14 +835,14 @@
        */
       void tileFramesV()
       {
  -        ArrayList openframes = getOpenFrames();
  +        JInternalFrame[] openFrames = getOpenFrames();
           
  -        int count=openframes.size();
  +        int count=openFrames.length;
           if ( count == 0)
           {
               return;
           }
  -        reorganizeFrames( 1, count, openframes );
  +        reorganizeFrames( 1, count, openFrames );
       }
       
       InstrumentManagerConnection[] getInstrumentManagerConnections()
  
  
  
  1.1                  jakarta-avalon-excalibur/instrument-client/src/java/org/apache/excalibur/instrument/client/StatusBar.java
  
  Index: StatusBar.java
  ===================================================================
  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included with this distribution in
   * the LICENSE.txt file.
   */
  package org.apache.excalibur.instrument.client;
  
  import java.awt.BorderLayout;
  
  import javax.swing.JLabel;
  import javax.swing.JPanel;
  
  /**
   * This class defines the status bar at the bottom of the main frame.
   *  It is used to display information to the user.
   *
   * @author <a href="mailto:leif@tanukisoftware.com">Leif Mortenson</a>
   * @version CVS $Revision: 1.1 $ $Date: 2002/10/25 19:07:58 $
   * @since 4.1
   */
  class StatusBar extends JPanel
  {
      private JLabel m_statusLabel;
      
      /*---------------------------------------------------------------
       * Constructors
       *-------------------------------------------------------------*/
      StatusBar()
      {
          setLayout( new BorderLayout() );
          m_statusLabel = new JLabel( " " );
          add( m_statusLabel, BorderLayout.CENTER );
      }
      
      /*---------------------------------------------------------------
       * Methods
       *-------------------------------------------------------------*/
      void setStatusMessage( String message )
      {
          // If the message is of 0 length, then the status bar will collapse.
          if ( ( message == null ) || ( message.length() < 1 ) )
          {
              message = " ";
          }
          
          if ( !message.equals( m_statusLabel.getText() ) )
          {
              m_statusLabel.setText( message );
              m_statusLabel.invalidate();
              validate();
          }
      }
  }
  
  
  

--
To unsubscribe, e-mail:   <mailto:avalon-cvs-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:avalon-cvs-help@jakarta.apache.org>


Mime
View raw message