forked from Coded/SIPRP
				
			
			You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							99 lines
						
					
					
						
							2.2 KiB
						
					
					
				
			
		
		
	
	
							99 lines
						
					
					
						
							2.2 KiB
						
					
					
				/*
 | 
						|
 * ObservacoesPanel.java
 | 
						|
 *
 | 
						|
 * Created on 29 de Março de 2004, 11:56
 | 
						|
 */
 | 
						|
 | 
						|
package siprp.ficha;
 | 
						|
 | 
						|
import java.awt.*;
 | 
						|
import javax.swing.*;
 | 
						|
 | 
						|
import com.evolute.utils.*;
 | 
						|
import com.evolute.utils.dataui.*;
 | 
						|
import com.evolute.utils.documents.*;
 | 
						|
import com.evolute.utils.jdo.*;
 | 
						|
import com.evolute.utils.metadb.*;
 | 
						|
 | 
						|
import siprp.*;
 | 
						|
import siprp.data.*;
 | 
						|
/**
 | 
						|
 *
 | 
						|
 * @author  fpalma
 | 
						|
 */
 | 
						|
public class ObservacoesPanel extends JPanel
 | 
						|
	implements ControllableComponent
 | 
						|
{
 | 
						|
	private JDOProvider JDO;
 | 
						|
	
 | 
						|
	private JTextField observacoesText;
 | 
						|
	
 | 
						|
	private FichaDataProvider provider;
 | 
						|
	
 | 
						|
	/** Creates a new instance of ObservacoesPanel */
 | 
						|
	public ObservacoesPanel()
 | 
						|
		throws Exception
 | 
						|
	{
 | 
						|
		provider = (FichaDataProvider)FichaDataProvider.getProvider();
 | 
						|
		JDO = ( JDOProvider ) Singleton.getInstance( Singleton.DEFAULT_JDO_PROVIDER );
 | 
						|
		setupComponents();
 | 
						|
	}
 | 
						|
	
 | 
						|
	private void setupComponents()
 | 
						|
	{
 | 
						|
		setBorder( BorderFactory.createTitledBorder(
 | 
						|
					BorderFactory.createEtchedBorder(),
 | 
						|
					"Observa\u00e7\u00f5es" ) );
 | 
						|
		
 | 
						|
//		JScrollPane scp = new JScrollPane();
 | 
						|
//		scp.setHorizontalScrollBarPolicy( JScrollPane.HORIZONTAL_SCROLLBAR_NEVER );
 | 
						|
//		scp.setVerticalScrollBarPolicy( JScrollPane.VERTICAL_SCROLLBAR_ALWAYS );
 | 
						|
		observacoesText = new JTextField();
 | 
						|
		observacoesText.setDocument( new MaximumLengthDocument( 150 ) );
 | 
						|
//		observacoesText.setLineWrap( true );
 | 
						|
//		observacoesText.setWrapStyleWord( true );
 | 
						|
//		scp.setViewportView( observacoesText );
 | 
						|
		
 | 
						|
		setLayout( new GridLayout( 1, 1, 0, 0 ) );
 | 
						|
		add( observacoesText );
 | 
						|
	}
 | 
						|
	
 | 
						|
	public void fill(Object value)
 | 
						|
	{
 | 
						|
		clear();
 | 
						|
		Integer trabalhadorID = (Integer)value;
 | 
						|
		if( trabalhadorID != null )
 | 
						|
		{
 | 
						|
			
 | 
						|
			try
 | 
						|
			{
 | 
						|
				TrabalhadorData trabalhador = (TrabalhadorData)JDO.load( TrabalhadorData.class, trabalhadorID );
 | 
						|
				String observacoes = (String) trabalhador.get( TrabalhadorData.OBSERVACOES );
 | 
						|
				if( observacoes != null )
 | 
						|
				{
 | 
						|
					observacoesText.setText( observacoes );
 | 
						|
				}
 | 
						|
			}
 | 
						|
			catch( Exception ex )
 | 
						|
			{
 | 
						|
				ex.printStackTrace();
 | 
						|
			}
 | 
						|
		}
 | 
						|
	}
 | 
						|
	
 | 
						|
	public Object save()
 | 
						|
	{
 | 
						|
		return observacoesText.getText();
 | 
						|
	}
 | 
						|
	
 | 
						|
	public void clear()
 | 
						|
	{
 | 
						|
		observacoesText.setText( "" );
 | 
						|
	}
 | 
						|
	
 | 
						|
	public void setEnabled( boolean enable )
 | 
						|
	{
 | 
						|
		observacoesText.setEnabled( enable );
 | 
						|
	}
 | 
						|
}
 |