Statistics
| Revision:

gvsig-scripting / org.gvsig.scripting / trunk / org.gvsig.scripting / org.gvsig.scripting.app / org.gvsig.scripting.app.mainplugin / src / main / resources-plugin / scripting / lib / gvsig / table.py @ 1021

History | View | Annotate | Download (2.58 KB)

1

    
2

    
3

    
4
from org.gvsig.app.project.documents.table import TableDocument as JTableDocument
5

    
6
from org.gvsig.fmap.dal import DALLocator
7

    
8
def _features(self, filter = None, sortby="", asc=True):
9
  return self.getFeatureStore().features(filter,sortby,asc)
10

    
11
def _iter_features(self):
12
  return self.getFeatureStore().getFeatureSet().__iter__()
13

    
14
def _len_features(self):
15
  return self.getFeatureStore().getFeatureSet().getSize()
16

    
17
def _edit(self,mode=1):
18
  self.getFeatureStore().edit(mode)
19

    
20
def _append(self, *valuesList, **values):
21
  self.getFeatureStore().append(*valuesList, **values)
22

    
23
def _updateSchema(self, schema):
24
  self.getFeatureStore().update(schema)
25

    
26
def _update(self, feature):
27
  self.getFeatureStore().update(feature)
28

    
29
def _getSchema(self):
30
  return self.getFeatureStore().getDefaultFeatureType()
31

    
32
def _commit(self):
33
  self.getFeatureStore().finishEditing()
34

    
35
def _abort(self):
36
  self.getFeatureStore().cancelEditing()
37

    
38
def _getSelection(self):
39
  return self.getFeatureStore().getFeatureSelection()
40

    
41
def _select(self, selection):
42
  self.getFeatureStore().getFeatureSelection().select(selection)
43

    
44
def _deselect(self, selection):
45
  self.getFeatureStore().getFeatureSelection().deselect(selection)
46

    
47
def _isSelected(feature):
48
  self.getFeatureStore().getFeatureSelection().isSelect(feature)
49

    
50
def _getFeatureStore(self):
51
  return self.getStore()
52

    
53
def _call(self):
54
  return self
55

    
56
def _createNewFeature(self, feature=None):
57
  if feature == None:
58
    return self.getFeatureStore().createNewFeature()
59
  else:
60
    return self.getFeatureStore().createNewFeature(feature)
61

    
62
def _getWindowOfTable(self):
63
    application = ApplicationLocator.getManager()
64
    projectManager = application.getProjectManager()
65
    tableManager = projectManager.getDocumentManager(TableManager.TYPENAME)
66
    return tableManager.getMainWindow(self,None)
67

    
68

    
69
#
70
# Inject new methods in the class JTableDocument
71
#
72
JTableDocument.createNewFeature = _createNewFeature
73
JTableDocument.getFeatureStore = _getFeatureStore
74
JTableDocument.__iter__ = _iter_features
75
JTableDocument.__len__ = _len_features
76
JTableDocument.__call__ = _call
77
JTableDocument.features = _features
78
JTableDocument.edit = _edit
79
JTableDocument.append = _append
80
JTableDocument.updateSchema = _updateSchema
81
JTableDocument.update = _update
82
JTableDocument.getSchema = _getSchema
83
JTableDocument.commit = _commit
84
JTableDocument.abort = _abort
85
JTableDocument.getSelection = _getSelection
86
JTableDocument.select = _select
87
JTableDocument.deselect = _deselect
88
JTableDocument.isSelected = _isSelected
89
JTableDocument.finishEditing = _commit
90
JTableDocument.cancelEditing = _abort
91
JTableDocument.getWindowOfTable = _getWindowOfTable
92

    
93