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

View differences:

LineCADToolContext.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";
......
81 89
        protected void Entry(LineCADToolContext context) {}
82 90
        protected void Exit(LineCADToolContext context) {}
83 91

  
92
        protected void addOption(LineCADToolContext context, String s)
93
        {
94
            Default(context);
95
        }
96

  
84 97
        protected void addPoint(LineCADToolContext context, double pointX, double pointY)
85 98
        {
86 99
            Default(context);
......
146 159
            super (name, id);
147 160
        }
148 161

  
162
        protected void addOption(LineCADToolContext context, String s)
163
        {
164
            LineCADTool ctxt = context.getOwner();
165

  
166
            if (s.equals("Cancelar"))
167
            {
168
                boolean loopbackFlag =
169
                    context.getState().getName().equals(
170
                        ExecuteMap.Initial.getName());
171

  
172
                if (loopbackFlag == false)
173
                {
174
                    (context.getState()).Exit(context);
175
                }
176

  
177
                context.clearState();
178
                try
179
                {
180
                    ctxt.end();
181
                }
182
                finally
183
                {
184
                    context.setState(ExecuteMap.Initial);
185

  
186
                    if (loopbackFlag == false)
187
                    {
188
                        (context.getState()).Entry(context);
189
                    }
190

  
191
                }
192
            }
193
            else
194
            {
195
                super.addOption(context, s);
196
            }
197

  
198
            return;
199
        }
200

  
149 201
    //-----------------------------------------------------------
150 202
    // Inner classse.
151 203
    //
......
167 219
            {
168 220
                LineCADTool ctxt = context.getOwner();
169 221

  
170
                ctxt.init();
171 222
                ctxt.setQuestion("LINEA" + "\n" +
172 223
		"Insertar primer punto");
224
                ctxt.setDescription(new String[]{"Cancelar"});
173 225
                return;
174 226
            }
175 227

  
176
            protected void Exit(LineCADToolContext context)
177
            {
178
                LineCADTool ctxt = context.getOwner();
179

  
180
                ctxt.end();
181
                return;
182
            }
183

  
184 228
            protected void addPoint(LineCADToolContext context, double pointX, double pointY)
185 229
            {
186 230
                LineCADTool ctxt = context.getOwner();
......
191 235
                try
192 236
                {
193 237
                    ctxt.setQuestion("Insertar segundo punto o angulo");
238
                    ctxt.setDescription(new String[]{"Cancelar"});
194 239
                    ctxt.addPoint(pointX, pointY);
195 240
                }
196 241
                finally
......
228 273
                try
229 274
                {
230 275
                    ctxt.setQuestion("Insertar segundo punto o angulo");
276
                    ctxt.setDescription(new String[]{"Cancelar"});
231 277
                    ctxt.addPoint(pointX, pointY);
232 278
                }
233 279
                finally
......
247 293
                try
248 294
                {
249 295
                    ctxt.setQuestion("Insertar longitud o punto");
296
                    ctxt.setDescription(new String[]{"Cancelar"});
250 297
                    ctxt.addValue(d);
251 298
                }
252 299
                finally
......
284 331
                try
285 332
                {
286 333
                    ctxt.setQuestion("Insertar segundo punto o angulo");
334
                    ctxt.setDescription(new String[]{"Cancelar"});
287 335
                    ctxt.addPoint(pointX, pointY);
288 336
                }
289 337
                finally
......
304 352
                try
305 353
                {
306 354
                    ctxt.setQuestion("Insertar segundo punto o angulo");
355
                    ctxt.setDescription(new String[]{"Cancelar"});
307 356
                    ctxt.addValue(d);
308 357
                }
309 358
                finally

Also available in: Unified diff