Statistics
| Revision:

svn-gvsig-desktop / trunk / applications / appgvSIG / src / com / iver / cit / gvsig / Tabla.java @ 312

History | View | Annotate | Download (2.53 KB)

1
/*
2
 * Created on 02-mar-2004
3
 *
4
 * To change the template for this generated file go to
5
 * Window>Preferences>Java>Code Generation>Code and Comments
6
 */
7
package com.iver.cit.gvsig;
8

    
9
import java.util.ArrayList;
10

    
11
import com.iver.cit.gvsig.fmap.layers.CommonOperations;
12
import com.iver.cit.gvsig.fmap.layers.FLayer;
13
import com.iver.cit.gvsig.fmap.layers.FLyrVect;
14
import com.iver.cit.gvsig.gui.Table;
15
import com.iver.cit.gvsig.gui.View;
16
import com.iver.cit.gvsig.project.ProjectFactory;
17
import com.iver.mdiApp.App;
18
import com.iver.mdiApp.AppStatus;
19
import com.iver.mdiApp.plugins.AbstractExtension;
20

    
21
/**
22
 * DOCUMENT ME!
23
 *
24
 * @author vcn To change the template for this generated type comment go to
25
 *         Window>Preferences>Java>Code Generation>Code and
26
 *         Comments
27
 */
28
public class Tabla extends AbstractExtension {
29
    /**
30
     * DOCUMENT ME!
31
     *
32
     * @return DOCUMENT ME!
33
     */
34
    public boolean isEnabled() {
35
        View f = (View) App.instance.getMDIContext().getActiveView();
36

    
37
        if (f == null) {
38
            return false;
39
        }
40

    
41
        FLayer[] selected = f.getModel().getMapContext().getLayers().getActives();
42

    
43
        return selected.length > 0;
44
    }
45

    
46
    /**
47
     * DOCUMENT ME!
48
     *
49
     * @return DOCUMENT ME!
50
     */
51
    public boolean isVisible() {
52
        com.iver.mdiApp.ui.MDIManager.View f = App.instance.getMDIContext().getActiveView();
53

    
54
        if (f == null) {
55
            return false;
56
        }
57

    
58
        return (f.getClass() == View.class);
59
    }
60

    
61
    /**
62
     * DOCUMENT ME!
63
     *
64
     * @param s DOCUMENT ME!
65
     */
66
    public void updateUI(AppStatus status, String s) {
67
        View vista = (View) status.getActiveView();
68
        FLayer[] actives = ((View) vista).getModel().getMapContext().getLayers().getActives();
69

    
70
        for (int i = 0; i < actives.length; i++) {
71
                if (actives[i] instanceof CommonOperations){
72
                        CommonOperations co = (CommonOperations)actives[i];
73

    
74
                        //TODO implementar bien
75
                        /*
76
                        Table t = new Table();
77
            FTable ftable = new FTable(seleccionada.getRecordset()); 
78
            t.setModel(ftable);
79
            t.getViewInfo().setTitle("Tabla: " + seleccionada.getName());
80
            
81
            //Se a?ade la tabla al modelo
82
            ProjectExtension ext = (ProjectExtension) App.instance.getPc().getExtension(ProjectExtension.class);
83
            ext.getProject().addTable(ProjectFactory.createTable(seleccionada.getName(), ftable));
84
            
85
            //Se a?ade la vista
86
                        App.instance.getMDIContext().addView(t);
87
                        */
88
                }
89
        }
90

    
91
    }
92
}