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

View differences:

PointCADToolContext.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(PointCADToolContext context) {}
74 82
        protected void Exit(PointCADToolContext context) {}
75 83

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

  
76 89
        protected void addPoint(PointCADToolContext context, double pointX, double pointY)
77 90
        {
78 91
            Default(context);
......
131 144
            super (name, id);
132 145
        }
133 146

  
147
        protected void addOption(PointCADToolContext context, String s)
148
        {
149
            PointCADTool ctxt = context.getOwner();
150

  
151
            if (s.equals("Cancelar"))
152
            {
153
                boolean loopbackFlag =
154
                    context.getState().getName().equals(
155
                        ExecuteMap.Initial.getName());
156

  
157
                if (loopbackFlag == false)
158
                {
159
                    (context.getState()).Exit(context);
160
                }
161

  
162
                context.clearState();
163
                try
164
                {
165
                    ctxt.end();
166
                }
167
                finally
168
                {
169
                    context.setState(ExecuteMap.Initial);
170

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

  
176
                }
177
            }
178
            else
179
            {
180
                super.addOption(context, s);
181
            }
182

  
183
            return;
184
        }
185

  
134 186
    //-----------------------------------------------------------
135 187
    // Inner classse.
136 188
    //
......
152 204
            {
153 205
                PointCADTool ctxt = context.getOwner();
154 206

  
155
                ctxt.init();
156 207
                ctxt.setQuestion("PUNTO" + "\n" +
157 208
		"Defina el punto");
209
                ctxt.setDescription(new String[]{"Cancelar"});
158 210
                return;
159 211
            }
160 212

  
......
168 220
                try
169 221
                {
170 222
                    ctxt.setQuestion("Insertar punto");
223
                    ctxt.setDescription(new String[]{"Cancelar"});
171 224
                    ctxt.addPoint(pointX, pointY);
172 225
                }
173 226
                finally
......
205 258
                try
206 259
                {
207 260
                    ctxt.setQuestion("Insertar punto");
261
                    ctxt.setDescription(new String[]{"Cancelar"});
208 262
                    ctxt.addPoint(pointX, pointY);
209 263
                }
210 264
                finally

Also available in: Unified diff