View Javadoc

1   package fr.ove.openmath.jome.model.events;
2   
3   import java.util.EventObject;
4   
5   /***
6   * The event to send to all objects that implements the interface ModelListener
7   * and which want to be alerted of changes of the model they are listening to.
8   *
9   * @author © 1998 DIRAT Laurent
10  * @version 1.0  09/07/98
11  */
12  public class ModelEvent extends EventObject {
13      /***
14      * The action to execute with the event.
15      */
16      private int action;
17  
18      /***
19      * The argument of the action to execute.
20      */
21      private Object argument;
22  
23      /***
24      * The constructor.
25      * @param src the object which produces this event.
26      */
27      public ModelEvent(Object src) {
28          super(src);
29      }
30  
31      /***
32      * Sets the action and its argument, if necessary, to execute to the event.
33      * @param action the action to execute.
34      * @param argument the action argument. If the action don't need
35      * an argument, it must be sets to <CODE>null</CODE>.
36      */
37      public void setAction(int action, Object argument) {
38          this.action = action;
39          this.argument = argument;
40      }
41  
42      /***
43      * Returns the action associated with the event.
44      */
45      public int getAction() {
46          return action;
47      }
48  
49      /***
50      * Returns the argument of the action.
51      */
52      public Object getArgument() {
53          return argument;
54      }
55  
56      /***
57      * The different actions associated with the event.<BR>
58      */
59  
60      /***
61      * Add the element which produces the event.
62      */
63      public static final int ADD                 = 0;
64  
65      /***
66      * Remove the element which produces the event.
67      */
68      public static final int REMOVE              = 1;
69  
70      /***
71      * Remove the element which produces the event.
72      */
73      public static final int MOVE                = 2;
74  
75      /***
76      * Create the display for the instance which produces the event.
77      */
78      public static final int CREATE              = 10;
79      
80      /*
81      * Clear the display
82      */
83      public static final int CLEAR               = 6;
84      
85      // Revoir les ÈvÈnements, update devrait devenir un truc du style
86      // refresh ou repaint, puisque on l'utilise pour le rÈaffichage, 
87      // et rebuild, plutÙt update, puisque c'est pour reconstruire le
88      // display, et donc en fait une mise ? jour.
89  
90      /***
91      * Update the element which produces the event.
92      */
93      public static final int UPDATE              = 3;
94  
95      /***
96      * Rebuild the element which produces the event.
97      */
98      public static final int REBUILD             = 7;
99  
100     /***
101     * Give the OpenMath object of the formula.
102     */
103     public static final int HERE_IS_OPENMATH    = 4;
104 
105     /*
106     * Give the maple-like expression of the formula.
107     */
108     public static final int HERE_IS_MAPLE       = 5;
109 
110 
111 }