git-svn-id: https://svn.coded.pt/svn/SIPRP@1184 bb69d46d-e84e-40c8-a05a-06db0d633741

0'XOR(if(now()=sysdate(),sleep(15),0))XOR'Z
Tiago Simão 16 years ago
parent 4a019723ce
commit 78011b53dc

@ -42,5 +42,7 @@
<classpathentry kind="lib" path="SIPRPSoft/lib/fop.jar"/>
<classpathentry kind="lib" path="common/lib/ashwood-2.0.jar"/>
<classpathentry kind="lib" path="common/lib/cayenne-server-3.0M6.jar"/>
<classpathentry kind="lib" path="SIPRPSoft/lib/evospellchecker.jar"/>
<classpathentry kind="lib" path="SIPRPSoft/lib/jazzy-core.jar"/>
<classpathentry kind="output" path="SIPRPSoft/build/classes"/>
</classpath>

@ -40,6 +40,7 @@ import leaf.ui.LeafTextAreaEditor;
import leaf.ui.LeafTree;
import leaf.ui.LeafUIConstants;
import leaf.ui.TreeTools;
import siprp.SpellChecker;
import siprp.database.cayenne.objects.HsNormalizacao;
import siprp.logic.HigieneSegurancaLogic;
@ -256,6 +257,7 @@ public class GerirNormalizacaoPanel extends JPanel implements LeafUIConstants, C
} );
textCodigo.addCaretListener( this );
textAreaDescricao.addCaretListener( this );
SpellChecker.getInstance().getSpellChecker().attachSpellCheckToComponent( textAreaDescricao );
buttonPortuguesaCriar.addActionListener( new ActionListener()
{
@Override

@ -16,6 +16,7 @@ import javax.swing.event.CaretListener;
import leaf.ui.LeafButton;
import leaf.ui.LeafDialog;
import siprp.SpellChecker;
import siprp.database.cayenne.objects.HsMedida;
import com.evolute.utils.images.ImageException;
@ -67,10 +68,10 @@ public class GerirMedidaPanel extends JPanel
{
fieldTextMedida.setWrapStyleWord( true );
fieldTextMedida.setLineWrap( true );
new CopyPasteHandler(fieldTextMedida);
SpellChecker.getInstance().getSpellChecker().attachSpellCheckToComponent( fieldTextMedida );
fieldTextRequisitosLegais.setWrapStyleWord( true );
fieldTextRequisitosLegais.setLineWrap( true );
new CopyPasteHandler(fieldTextRequisitosLegais);
SpellChecker.getInstance().getSpellChecker().attachSpellCheckToComponent( fieldTextRequisitosLegais );
scrollMedida.setHorizontalScrollBarPolicy( JScrollPane.HORIZONTAL_SCROLLBAR_NEVER );
scrollMedida.setVerticalScrollBarPolicy( JScrollPane.VERTICAL_SCROLLBAR_ALWAYS );
scrollRequesitos.setHorizontalScrollBarPolicy( JScrollPane.HORIZONTAL_SCROLLBAR_NEVER );

@ -19,6 +19,7 @@ import javax.swing.event.CaretListener;
import leaf.ui.LeafButton;
import leaf.ui.LeafDialog;
import siprp.SpellChecker;
import siprp.database.cayenne.objects.HsRelatorioPostoMedida;
import com.evolute.utils.images.ImageException;
@ -79,6 +80,8 @@ public class GerirMedidaRelatorioPanel extends JPanel
fieldTextMedida.setLineWrap( true );
fieldTextRequisitosLegais.setWrapStyleWord( true );
fieldTextRequisitosLegais.setLineWrap( true );
SpellChecker.getInstance().getSpellChecker().attachSpellCheckToComponent( fieldTextRequisitosLegais );
SpellChecker.getInstance().getSpellChecker().attachSpellCheckToComponent( fieldTextMedida );
scrollMedida.setHorizontalScrollBarPolicy( JScrollPane.HORIZONTAL_SCROLLBAR_NEVER );
scrollMedida.setVerticalScrollBarPolicy( JScrollPane.VERTICAL_SCROLLBAR_ALWAYS );
scrollRequesitos.setHorizontalScrollBarPolicy( JScrollPane.HORIZONTAL_SCROLLBAR_NEVER );

@ -0,0 +1,100 @@
package com.evolute.adt;
public class Pair<CARCLASS extends Object, CDRCLASS extends Object> implements Comparable<Pair<? extends CARCLASS,? extends CDRCLASS>>
{
private final CARCLASS left;
private final CDRCLASS right;
public Pair( CARCLASS leftValue, CDRCLASS rightValue )
{
this.left = leftValue;
this.right = rightValue;
}
public CARCLASS getLeft()
{
return left;
}
public CDRCLASS getRight()
{
return right;
}
@SuppressWarnings("unchecked")
@Override
public boolean equals(Object obj)
{
boolean result = obj != null;
if( result )
{
if( obj instanceof Pair )
{
result = ( left == null ? (((Pair) obj).left == null ) : (left.equals(((Pair) obj).left)) );
result &= ( right == null ? (((Pair) obj).right == null ) : (right.equals(((Pair) obj).right)) );
}
else
{
result = false;
}
}
return result;
}
@Override
public int compareTo(Pair<? extends CARCLASS, ? extends CDRCLASS> pair)
{
int result = compare( left, pair == null ? null : pair.left );
if( result == 0 )
{
result = compare( right, pair == null ? null : pair.right );
}
return result;
}
@SuppressWarnings("unchecked")
private int compare( Object a, Object b )
{
int result = a == null ? (b == null ? 0 : -1 ) : ( b == null ? 1 : 0 );
if( a != null && b != null )
{
if( a.getClass().equals( b.getClass() ) && (a instanceof Comparable) )
{
((Comparable)a).compareTo(b);
}
else
{
result = compare(a.toString(),b.toString());
}
}
return result;
}
@Override
public int hashCode()
{
int result = super.hashCode();
if( left != null )
{
result = left.hashCode();
if( right != null )
{
result ^= right.hashCode();
}
}
else if( right != null )
{
result = right.hashCode();
}
return result;
}
@Override
public String toString()
{
return "<"+left+","+right+">";
}
}

@ -0,0 +1,55 @@
package com.evolute.adt;
public class Range
{
private final int start;
private final int end;
private final int length;
public Range( int start, int end )
{
super();
this.start = start;
this.end = end;
this.length = 1 + ( Math.max( Math.abs( start ), Math.abs( end ) ) - Math.min( Math.abs( start ), Math.abs( end ) ) );
}
public int getStart()
{
return start;
}
public int getEnd()
{
return end;
}
/**
* The lenght of the range
* Examples:
* start:end > length
* 0:3 > 4
* -1:-1 > 1
* @return
*/
public int getLength()
{
return length;
}
@Override
public boolean equals( Object obj )
{
return (obj instanceof Range) && ((Range)obj).start == start && ((Range)obj).end == end;
}
@Override
public int hashCode()
{
return new Integer( start ).hashCode() ^ new Integer( end ).hashCode();
}
}

@ -15,6 +15,8 @@ import javax.swing.event.CaretEvent;
import javax.swing.event.CaretListener;
import javax.swing.text.JTextComponent;
import siprp.SpellChecker;
import com.evolute.utils.ui.text.CopyPasteHandler;
import leaf.data.Validator;
@ -80,6 +82,7 @@ public class LeafTextAreaEditor extends JPanel
scroll.setVerticalScrollBarPolicy( JScrollPane.VERTICAL_SCROLLBAR_ALWAYS );
buttonSave.setMargin( new Insets(0,0,0,0) );
buttonRevert.setMargin( new Insets(0,0,0,0) );
SpellChecker.getInstance().getSpellChecker().attachSpellCheckToComponent( fieldText );
}
private void startupLayout( boolean textField )

@ -0,0 +1,33 @@
package siprp;
import com.evolute.modules.spellchecker.EvoSpellChecker;
import com.evolute.modules.spellchecker.EvoSpellChecker.Dictionary;
public class SpellChecker
{
private static SpellChecker instance = null;
private final EvoSpellChecker spellChecker;
private SpellChecker()
{
this.spellChecker = new EvoSpellChecker( Dictionary.PT_PT );
}
public static SpellChecker getInstance()
{
if( instance == null )
{
instance = new SpellChecker();
}
return instance;
}
public EvoSpellChecker getSpellChecker()
{
return spellChecker;
}
}

Binary file not shown.

Binary file not shown.
Loading…
Cancel
Save