diff --git a/trunk/SIPRPSoft/src/siprp/database/cayenne/objects/Trabalhadores.java b/trunk/SIPRPSoft/src/siprp/database/cayenne/objects/Trabalhadores.java index 3eb0685c..ec6f9d9d 100755 --- a/trunk/SIPRPSoft/src/siprp/database/cayenne/objects/Trabalhadores.java +++ b/trunk/SIPRPSoft/src/siprp/database/cayenne/objects/Trabalhadores.java @@ -4,44 +4,83 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; +import com.evolute.utils.strings.StringConverter; +import com.evolute.utils.strings.UnicodeChecker; + import siprp.database.cayenne.objects.auto._Trabalhadores; public class Trabalhadores extends _Trabalhadores { private static final long serialVersionUID = 1L; + + private String name = null; + + private String convertedName = null; - private String getCapitalizedName() - { - String result = ""; - String[] names = getNomePlain().split( " " ); - if( names != null && names.length > 0 ) - { - for( String name : names ) - { - if( name != null && name.length() > 0 ) - { - result += ("" + name.charAt( 0 )).toUpperCase(); - if( name.length() > 1 ) - { - result += name.substring( 1 ); - } - result += " "; - } - } - } - return result.trim(); - } +// private String getCapitalizedName() +// { +// String result = ""; +// String[] names = getNomePlain().split( " " ); +// if( names != null && names.length > 0 ) +// { +// for( String name : names ) +// { +// if( name != null && name.length() > 0 ) +// { +// result += ("" + name.charAt( 0 )).toUpperCase(); +// if( name.length() > 1 ) +// { +// result += name.substring( 1 ); +// } +// result += " "; +// } +// } +// } +// return result.trim(); +// } public String getDataNascimentoString() { return getDataNascimento() == null ? "" : sdf.format( getDataNascimento() ); } - public String getNomePlainCapital() +// public String getNomePlainCapital() +// { +// return getNomePlain() == null ? "" : getCapitalizedName(); +// } + + @Override + public String getNome() { - return getNomePlain() == null ? "" : getCapitalizedName(); + String currentName = super.getNome(); + if( name == null || !name.equals( currentName )) + { + name = currentName; + convertedName = null; + } + return convertName(); + } + + @Override + public void setNome( String nome ) + { + super.setNome( nome ); + getNome(); } + private String convertName() + { + if( name == null ) + { + convertedName = null; + } + else + { + convertedName = UnicodeChecker.parseFromUnicode( name ); + } + return convertedName; + } + public HashMap getSexos() { HashMap result = new HashMap(); diff --git a/trunk/SIPRPSoft/src/siprp/database/cayenne/providers/MedicinaDAO.java b/trunk/SIPRPSoft/src/siprp/database/cayenne/providers/MedicinaDAO.java index 3c8b2ba0..32e5d632 100644 --- a/trunk/SIPRPSoft/src/siprp/database/cayenne/providers/MedicinaDAO.java +++ b/trunk/SIPRPSoft/src/siprp/database/cayenne/providers/MedicinaDAO.java @@ -67,7 +67,7 @@ public class MedicinaDAO extends MainDAO for( Trabalhadores currentTrabalhador : allTrabalhadores ) { Integer id = currentTrabalhador.getId(); - String designacao = currentTrabalhador.getNomePlainCapital(); + String designacao = currentTrabalhador.getNome(); result.add( new ColumnizedMappable( id, designacao ) ); } return result; diff --git a/trunk/SIPRPSoft/src/siprp/medicina/processo/ui/LeafInputField.java b/trunk/SIPRPSoft/src/siprp/medicina/processo/ui/LeafInputField.java index 5fe0ca02..0a07f1f2 100644 --- a/trunk/SIPRPSoft/src/siprp/medicina/processo/ui/LeafInputField.java +++ b/trunk/SIPRPSoft/src/siprp/medicina/processo/ui/LeafInputField.java @@ -133,21 +133,6 @@ public class LeafInputField extends JPanel implements F return null; } - /** - * Sets the component to an error state appearance - * - * @param error - */ - public void setError( boolean error ) - { - isError = error; - } - - public boolean isError() - { - return isError; - } - protected void paintComponent( Graphics g ) { Graphics2D g2d = (Graphics2D) g; @@ -198,9 +183,38 @@ public class LeafInputField extends JPanel implements F return getParent() != null ? getParent().getBackground() : startColor; } + /** + * Sets the component to an error state appearance + * + * @param error + */ + public void setError( boolean error ) + { + isError = error; + repaint(); + } + + public boolean isError() + { + return isError; + } + + public boolean getSelected() + { + return highLighted; + } + + public void setSelected( boolean selected ) + { + highLighted = selected; + background = selected ? highLightColor : cold; + repaint(); + } + public void setEditable( boolean editable ) { isEditable = editable; + repaint(); } public boolean isEditable() @@ -211,6 +225,7 @@ public class LeafInputField extends JPanel implements F public void setClickable( boolean clickable ) { isClickable = clickable; + repaint(); } public boolean isClickable() @@ -440,36 +455,6 @@ public class LeafInputField extends JPanel implements F @Override public void mousePressed( MouseEvent e ) - { - } - - @Override - public void mouseExited( MouseEvent e ) - { - background = (!highLighted && (isEditable || isClickable)) ? cold : background; - repaint(); - } - - @Override - public void mouseEntered( MouseEvent e ) - { - background = (!highLighted && (isEditable || isClickable)) ? hot : background; - repaint(); - } - - public boolean getSelected() - { - return highLighted; - } - - public void setSelected( boolean selected ) - { - highLighted = selected; - background = selected ? highLightColor : cold; - } - - @Override - public void mouseClicked( MouseEvent e ) { ObjClass obj = object; if( obj != null && isEditable ) @@ -503,4 +488,23 @@ public class LeafInputField extends JPanel implements F firePropertyChange( PROPERTY_CHANGED_CLICK, false, true ); } } + + @Override + public void mouseExited( MouseEvent e ) + { + background = (!highLighted && (isEditable || isClickable)) ? cold : background; + repaint(); + } + + @Override + public void mouseEntered( MouseEvent e ) + { + background = (!highLighted && (isEditable || isClickable)) ? hot : background; + repaint(); + } + + @Override + public void mouseClicked( MouseEvent e ) + { + } } \ No newline at end of file