Revision 3883 trunk/extensions/extCAD/src/com/iver/cit/gvsig/gui/cad/tools/smc/ArcCADToolContext.java

View differences:

ArcCADToolContext.java
23 23
        ExecuteMap.Initial.Entry(this);
24 24
    }
25 25

  
26
    public void addOption(String s)
27
    {
28
        _transition = "addOption";
29
        getState().addOption(this, s);
30
        _transition = "";
31
        return;
32
    }
33

  
26 34
    public void addPoint(double pointX, double pointY)
27 35
    {
28 36
        _transition = "addPoint";
......
73 81
        protected void Entry(ArcCADToolContext context) {}
74 82
        protected void Exit(ArcCADToolContext context) {}
75 83

  
84
        protected void addOption(ArcCADToolContext context, String s)
85
        {
86
            Default(context);
87
        }
88

  
76 89
        protected void addPoint(ArcCADToolContext context, double pointX, double pointY)
77 90
        {
78 91
            Default(context);
......
135 148
            super (name, id);
136 149
        }
137 150

  
151
        protected void addOption(ArcCADToolContext context, String s)
152
        {
153
            ArcCADTool ctxt = context.getOwner();
154

  
155
            if (s.equals("Cancelar"))
156
            {
157
                boolean loopbackFlag =
158
                    context.getState().getName().equals(
159
                        ExecuteMap.Initial.getName());
160

  
161
                if (loopbackFlag == false)
162
                {
163
                    (context.getState()).Exit(context);
164
                }
165

  
166
                context.clearState();
167
                try
168
                {
169
                    ctxt.end();
170
                }
171
                finally
172
                {
173
                    context.setState(ExecuteMap.Initial);
174

  
175
                    if (loopbackFlag == false)
176
                    {
177
                        (context.getState()).Entry(context);
178
                    }
179

  
180
                }
181
            }
182
            else
183
            {
184
                super.addOption(context, s);
185
            }
186

  
187
            return;
188
        }
189

  
138 190
    //-----------------------------------------------------------
139 191
    // Inner classse.
140 192
    //
......
156 208
            {
157 209
                ArcCADTool ctxt = context.getOwner();
158 210

  
159
                ctxt.init();
160 211
                ctxt.setQuestion("ARCO" + "\n"+
161 212
		"Insertar primer punto");
213
                ctxt.setDescription(new String[]{"Cancelar"});
162 214
                return;
163 215
            }
164 216

  
......
172 224
                try
173 225
                {
174 226
                    ctxt.setQuestion("Insertar segundo punto");
227
                    ctxt.setDescription(new String[]{"Cancelar"});
175 228
                    ctxt.addPoint(pointX, pointY);
176 229
                }
177 230
                finally
......
209 262
                try
210 263
                {
211 264
                    ctxt.setQuestion("Insertar ultimo punto");
265
                    ctxt.setDescription(new String[]{"Cancelar"});
212 266
                    ctxt.addPoint(pointX, pointY);
213 267
                }
214 268
                finally

Also available in: Unified diff