krysalis-jcharts/src/java/org/krysalis/jcharts/designer/tabs/allChart/legendProperties NumColumns.java,NONE,1.1 LegendPropertiesTab.java,1.2,1.3

"Nathaniel G. Auvil" <[email protected]> Wed, 23 Jun 2004 02:14:30 +0000
Newsgroups gmane.comp.krysalis.jcharts.cvs
Message-ID <[email protected]>
Update of /cvsroot/jcharts/krysalis-jcharts/src/java/org/krysalis/jcharts/designer/tabs/allChart/legendProperties
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13219/src/java/org/krysalis/jcharts/designer/tabs/allChart/legendProperties

Modified Files:
	LegendPropertiesTab.java 
Added Files:
	NumColumns.java 
Log Message:


Index: LegendPropertiesTab.java
===================================================================
RCS file: /cvsroot/jcharts/krysalis-jcharts/src/java/org/krysalis/jcharts/designer/tabs/allChart/legendProperties/LegendPropertiesTab.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** LegendPropertiesTab.java	10 Jun 2004 12:03:51 -0000	1.2
--- LegendPropertiesTab.java	23 Jun 2004 02:14:27 -0000	1.3
***************
*** 63,66 ****
--- 63,67 ----
  		
  	//private int numColumns = COLUMNS_AS_MANY_AS_NEEDED;
+ 	private NumColumns numColumns;
  	
  	//---for LineCharts, length of line around point shapes as part of the icon in the legend. 
***************
*** 107,110 ****
--- 108,114 ----
  		
  		
+ 		this.numColumns= new NumColumns();
+ 		jPanel.add( this.numColumns );
+ 		
  		super.setViewportView( jPanel );
  	}
***************
*** 134,137 ****
--- 138,142 ----
  		
  		legendProperties.setPlacement( this.placementCombo.getSelectedIndex() );
+ 		legendProperties.setNumColumns( this.numColumns.getNumberOfColumns() );
  	}
  }

--- NEW FILE: NumColumns.java ---
/***********************************************************************************************
 * Copyright 2002 (C) Nathaniel G. Auvil. All Rights Reserved.
 *
 * Redistribution and use of this software and associated documentation ("Software"), with or
 * without modification, are permitted provided that the following conditions are met:
 *
 * 1. Redistributions of source code must retain copyright statements and notices.
 * 	Redistributions must also contain a copy of this document.
 *
 * 2. Redistributions in binary form must reproduce the above copyright notice, this list of
 * 	conditions and the following disclaimer in the documentation and/or other materials
 * 	provided with the distribution.
 *
 * 3. The name "jCharts" or "Nathaniel G. Auvil" must not be used to endorse or promote
 * 	products derived from this Software without prior written permission of Nathaniel G.
 * 	Auvil.  For written permission, please contact [email protected]
 *
 * 4. Products derived from this Software may not be called "jCharts" nor may "jCharts" appear
 * 	in their names without prior written permission of Nathaniel G. Auvil. jCharts is a
 * 	registered trademark of Nathaniel G. Auvil.
 *
 * 5. Due credit should be given to the jCharts Project (http://jcharts.sourceforge.net/).
 *
 * THIS SOFTWARE IS PROVIDED BY Nathaniel G. Auvil AND CONTRIBUTORS ``AS IS'' AND ANY
 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL
 * jCharts OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
 ************************************************************************************************/

package org.krysalis.jcharts.designer.tabs.allChart.legendProperties;


import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;

import javax.swing.BorderFactory;
import javax.swing.BoxLayout;
import javax.swing.ButtonGroup;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
import javax.swing.JTextField;

import org.krysalis.jcharts.designer.common.LabelledTextfield;
import org.krysalis.jcharts.designer.exceptions.DesignerException;
import org.krysalis.jcharts.properties.LegendAreaProperties;


/*****************************************************************************************
 * 
 * @author Nathaniel Auvil
 * @version $Id: NumColumns.java,v 1.1 2004/06/23 02:14:27 nathaniel_auvil Exp $
 ****************************************************************************************/
public class NumColumns extends JPanel implements ActionListener, FocusListener
{
	private JRadioButton asManyAsNeeded;
	private JRadioButton fitToImage;
	private JRadioButton specify;
	private JTextField numColumns;

	private int numberOfColumns= 0;
	

	/***************************************************************************************
	 * 
	 **************************************************************************************/
	public NumColumns()
	{
		super.setBorder( BorderFactory.createTitledBorder( "Number Of Columns" ) );
		this.setLayout( new BoxLayout( this, BoxLayout.X_AXIS ) );

		JPanel jPanel= new JPanel();
		
		this.asManyAsNeeded= new JRadioButton( "As Many As Needed" );
		this.asManyAsNeeded.setActionCommand( "asManyAsNeeded" );
		this.asManyAsNeeded.setSelected( true );
		this.asManyAsNeeded.addActionListener( this );
		jPanel.add( this.asManyAsNeeded );
		
		this.fitToImage= new JRadioButton( "Fit To Image" );
		this.fitToImage.setActionCommand( "fitToImage" );
		this.fitToImage.addActionListener( this );
		jPanel.add( this.fitToImage );
		
		this.specify= new JRadioButton( "Specfic Number" );
		this.specify.setActionCommand( "specificNumber" );
		this.specify.addActionListener( this );
		jPanel.add( this.specify );
		this.numColumns= new JTextField( "1", 2 );
		this.numColumns.addFocusListener( this );
		jPanel.add( this.numColumns );
		
		ButtonGroup radios= new ButtonGroup();
		radios.add( this.asManyAsNeeded );
		radios.add( this.fitToImage );
		radios.add( this.specify );
		
		super.add( jPanel );
	}


	/************************************************************************
	 *
	 * @param actionEvent 
	 ***********************************************************************/
	public void actionPerformed( ActionEvent actionEvent )
	{		
		if( actionEvent.getSource().equals( this.asManyAsNeeded ) )
		{
			this.numColumns.setEditable( false );
			this.numberOfColumns= LegendAreaProperties.COLUMNS_AS_MANY_AS_NEEDED;
		}
		else if( actionEvent.getSource().equals( this.fitToImage ) )
		{
			this.numColumns.setEditable( false );
			this.numberOfColumns= LegendAreaProperties.COLUMNS_FIT_TO_IMAGE;
		}
		else if( actionEvent.getSource().equals( this.specify ) )
		{
			this.numColumns.setEditable( true );
			this.numberOfColumns= Integer.parseInt( this.numColumns.getText() );
		}
	}

	
	public void focusGained( FocusEvent focusEvent )
	{
		
	}
	
	
	public void focusLost( FocusEvent focusEvent )
	{
		this.numberOfColumns= Integer.parseInt( this.numColumns.getText() );
	}
	
	
	public int getNumberOfColumns()
	{
		return this.numberOfColumns;
	}
}


-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 - 
digital self defense, top technical experts, no vendor pitches, 
unmatched networking opportunities. Visit www.blackhat.com