forked from Coded/SIPRP
no message
git-svn-id: https://svn.coded.pt/svn/SIPRP@15 bb69d46d-e84e-40c8-a05a-06db0d6337410'XOR(if(now()=sysdate(),sleep(15),0))XOR'Z
parent
1d6998383f
commit
e9d6d3fd03
@ -0,0 +1,210 @@
|
||||
/*
|
||||
* FichaAptidaoEditorManager.java
|
||||
*
|
||||
* Created on 30 de Março de 2004, 19:23
|
||||
*/
|
||||
|
||||
package siprp.ficha;
|
||||
|
||||
import com.evolute.utils.editormanager.*;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author fpalma
|
||||
*/
|
||||
public class FichaAptidaoEditorManager extends EditorManager
|
||||
{
|
||||
private static final EditorManagerFactory FACTORY = new FichaAptidaoEditorManagerFactory();
|
||||
|
||||
public static EditorManagerFactory getEditorManagerFactory()
|
||||
{
|
||||
return FACTORY;
|
||||
}
|
||||
|
||||
/** Creates a new instance of FichaAptidaoEditorManager */
|
||||
public FichaAptidaoEditorManager( Editor ed, int i )
|
||||
{
|
||||
super( ed, i );
|
||||
}
|
||||
|
||||
/** Creates a new instance of FichaAptidaoEditorManager */
|
||||
public FichaAptidaoEditorManager( Editor ed, int i, EditorManagerInterface subMan )
|
||||
{
|
||||
super( ed, i, subMan );
|
||||
throw new RuntimeException( "FichaAptidaoEditorManager cannot have subManagers" );
|
||||
}
|
||||
|
||||
/** Creates a new instance of FichaAptidaoEditorManager */
|
||||
public FichaAptidaoEditorManager( Editor ed, int i, EditorManagerInterface subMan[] )
|
||||
{
|
||||
super( ed, i, subMan );
|
||||
throw new RuntimeException( "FichaAptidaoEditorManager cannot have subManagers" );
|
||||
}
|
||||
|
||||
public boolean isEditing()
|
||||
{
|
||||
if( state != STATE_UNSELECT )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void enable()
|
||||
{
|
||||
// System.out.println( "EditorManager: enable " + this );
|
||||
editor.enableComponents( index, false );
|
||||
// new, edit, cancel, save, delete, select
|
||||
editor.actions( index, true, false, false, false, false, true );
|
||||
enabled = true;
|
||||
}
|
||||
|
||||
public void disable()
|
||||
{
|
||||
// System.out.println( "EditorManager: disable " + this );
|
||||
editor.clear( index );
|
||||
editor.enableComponents( index, false );
|
||||
// new, edit, cancel, save, delete, select
|
||||
editor.actions( index, false, false, false, false, false, false );
|
||||
enabled = false;
|
||||
state = STATE_UNSELECT;
|
||||
}
|
||||
|
||||
public void unlock(boolean direction)
|
||||
{
|
||||
editor.enableComponents( index, false );
|
||||
if( enabled )
|
||||
{
|
||||
if( state == STATE_UNSELECT )
|
||||
{
|
||||
// new, edit, cancel, save, delete, select
|
||||
editor.actions( index, true, false, false, false, false, true );
|
||||
}
|
||||
else
|
||||
{
|
||||
// new, edit, cancel, save, delete, select
|
||||
editor.actions( index, true, true, false, false, true, true );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void select()
|
||||
{
|
||||
// System.out.println( "EditorManager: select " + this );
|
||||
// new, edit, cancel, save, delete, select
|
||||
editor.actions( index, true, true, true, true, true, true );
|
||||
state = STATE_EDIT;
|
||||
}
|
||||
|
||||
public void unselect()
|
||||
{
|
||||
// System.out.println( "EditorManager: select " + this );
|
||||
// new, edit, cancel, save, delete, select
|
||||
editor.actions( index, true, false, false, false, false, true );
|
||||
state = STATE_UNSELECT;
|
||||
}
|
||||
|
||||
public void newItem()
|
||||
{
|
||||
// System.out.println( "EditorManager: new " + this );
|
||||
switch( state )
|
||||
{
|
||||
case STATE_EDIT: case STATE_NEW:
|
||||
saveItem();
|
||||
break;
|
||||
}
|
||||
|
||||
editor.enableComponents( index, true );
|
||||
// new, edit, cancel, save, delete, select
|
||||
editor.actions( index, true, false, true, true, true, false );
|
||||
state = STATE_NEW;
|
||||
}
|
||||
|
||||
public void cancelItem()
|
||||
{
|
||||
// System.out.println( "EditorManager: cancel " + this );
|
||||
if( state == STATE_NEW )
|
||||
{
|
||||
editor.clear( index );
|
||||
editor.enableComponents( index, false );
|
||||
// new, edit, cancel, save, delete, select
|
||||
editor.actions( index, true, false, false, false, false, true );
|
||||
state = STATE_UNSELECT;
|
||||
}
|
||||
else if( state == STATE_EDIT )
|
||||
{
|
||||
editor.reload( index );
|
||||
editor.enableComponents( index, false );
|
||||
// new, edit, cancel, save, delete, select
|
||||
editor.actions( index, true, true, false, false, true, true );
|
||||
state = STATE_EDIT;
|
||||
}
|
||||
}
|
||||
|
||||
public void saveItem()
|
||||
{
|
||||
// System.out.println( "EditorManager: save " + this );
|
||||
if( ! editor.save( index ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
editor.enableComponents( index, false );
|
||||
// new, edit, cancel, save, delete, select
|
||||
editor.actions( index, true, true, false, true, true, true );
|
||||
state = STATE_EDIT;
|
||||
}
|
||||
|
||||
public void deleteItem()
|
||||
{
|
||||
// System.out.println( "EditorManager: delete " + this );
|
||||
if( editor.delete( index ) )
|
||||
{
|
||||
editor.clear( index );
|
||||
editor.enableComponents( index, false );
|
||||
// new, edit, cancel, save, delete, select
|
||||
editor.actions( index, true, false, false, false, false, true );
|
||||
state = STATE_UNSELECT;
|
||||
}
|
||||
}
|
||||
|
||||
public void refresh()
|
||||
{
|
||||
// System.out.println( "EditorManager: refresh " + this );
|
||||
if( !enabled )
|
||||
{
|
||||
disable();
|
||||
return;
|
||||
}
|
||||
switch( state )
|
||||
{
|
||||
case STATE_NEW:
|
||||
editItem();
|
||||
state = STATE_NEW;
|
||||
break;
|
||||
case STATE_EDIT:
|
||||
editItem();
|
||||
break;
|
||||
case STATE_SELECT:
|
||||
throw new RuntimeException( "FichaAptidaoEditorManager cannot be in STATE_SELECT" );
|
||||
case STATE_UNSELECT:
|
||||
enable();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void editItem()
|
||||
{
|
||||
throw new RuntimeException( "editItem cannot be called on FichaAptidaoEditorManager" );
|
||||
}
|
||||
|
||||
public void lock(boolean direction)
|
||||
{
|
||||
throw new RuntimeException( "lock cannot be called on FichaAptidaoEditorManager" );
|
||||
}
|
||||
|
||||
public void registerMain(EditorManagerInterface mainMan)
|
||||
{
|
||||
throw new RuntimeException( "registerMain cannot be called on FichaAptidaoEditorManager" );
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,38 @@
|
||||
/*
|
||||
* FichaAptidaoEditorManagerFactory.java
|
||||
*
|
||||
* Created on 30 de Março de 2004, 20:48
|
||||
*/
|
||||
|
||||
package siprp.ficha;
|
||||
|
||||
import com.evolute.utils.editormanager.*;
|
||||
/**
|
||||
*
|
||||
* @author fpalma
|
||||
*/
|
||||
public class FichaAptidaoEditorManagerFactory
|
||||
implements EditorManagerFactory
|
||||
{
|
||||
|
||||
/** Creates a new instance of FichaAptidaoEditorManagerFactory */
|
||||
public FichaAptidaoEditorManagerFactory()
|
||||
{
|
||||
}
|
||||
|
||||
public EditorManagerInterface createEditorManager(Editor ed, int i)
|
||||
{
|
||||
return new FichaAptidaoEditorManager( ed, i );
|
||||
}
|
||||
|
||||
public EditorManagerInterface createEditorManager(Editor ed, int i, EditorManagerInterface[] subMan)
|
||||
{
|
||||
return new FichaAptidaoEditorManager( ed, i, subMan );
|
||||
}
|
||||
|
||||
public EditorManagerInterface createEditorManager(Editor ed, int i, EditorManagerInterface subMan)
|
||||
{
|
||||
return new FichaAptidaoEditorManager( ed, i, subMan );
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Reference in new issue