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.
93 lines
2.0 KiB
93 lines
2.0 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.dataui.*;
|
|
import com.evolute.utils.documents.*;
|
|
import com.evolute.utils.metadb.*;
|
|
|
|
import siprp.*;
|
|
/**
|
|
*
|
|
* @author fpalma
|
|
*/
|
|
public class ObservacoesPanel extends JPanel
|
|
implements ControllableComponent
|
|
{
|
|
private JTextField observacoesText;
|
|
|
|
private FichaDataProvider provider;
|
|
|
|
/** Creates a new instance of ObservacoesPanel */
|
|
public ObservacoesPanel()
|
|
throws Exception
|
|
{
|
|
provider = (FichaDataProvider)FichaDataProvider.getProvider();
|
|
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
|
|
{
|
|
MetaObject trabalhador = provider.load( provider.TRABALHADORES, new DBKey( trabalhadorID ) );
|
|
String observacoes = (String) trabalhador.getProperty( provider.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 );
|
|
}
|
|
}
|