dataset editor support
authorca
Wed, 10 Jun 2009 18:26:53 +0200
changeset 255904b2605a66b2
parent 2558 1acb2765094d
child 2560 efad0ef440c7
dataset editor support
UIPainter.st
     1.1 --- a/UIPainter.st	Wed Jun 10 17:20:46 2009 +0200
     1.2 +++ b/UIPainter.st	Wed Jun 10 18:26:53 2009 +0200
     1.3 @@ -3169,12 +3169,14 @@
     1.4  
     1.5  !UIPainter methodsFor:'building editors'!
     1.6  
     1.7 -openDataSetColumnEditor
     1.8 +XXopenDataSetColumnEditor
     1.9      "opens a Table Column Editor on current widget"
    1.10  
    1.11 -    |cls editor specTool columnHolder tableSelector columns|
    1.12 -
    1.13 -    self isEditingSpecOnly ifFalse:[
    1.14 +    |cls editor specTool columnHolder tableSelector columns isEditingSpecOnly|
    1.15 +
    1.16 +    isEditingSpecOnly := self isEditingSpecOnly.
    1.17 +
    1.18 +    isEditingSpecOnly ifFalse:[
    1.19          (cls := self resolveName:specClassName) isNil ifTrue:[
    1.20              self askForSaving ifTrue:[cls := self resolveName:specClassName].
    1.21          ].
    1.22 @@ -3187,7 +3189,7 @@
    1.23      editor masterApplication:self.
    1.24      specTool := self specTool.
    1.25  
    1.26 -    self isEditingSpecOnly ifFalse:[
    1.27 +    isEditingSpecOnly ifFalse:[
    1.28          editor specClass: cls.
    1.29          editor rowClassName:(specTool specification rowClassName).
    1.30      ].
    1.31 @@ -3198,7 +3200,7 @@
    1.32                          ifTrue:[tableSelector asSymbol]
    1.33                          ifFalse:[nil].
    1.34  
    1.35 -    (self isEditingSpecOnly not
    1.36 +    (isEditingSpecOnly not
    1.37      and:[tableSelector notNil 
    1.38      and:[cls class includesSelector:tableSelector]]) ifTrue:[
    1.39          editor openModalOnClass:cls andSelector:tableSelector
    1.40 @@ -3213,7 +3215,7 @@
    1.41          ].
    1.42      ].
    1.43  
    1.44 -    self isEditingSpecOnly ifFalse:[
    1.45 +    isEditingSpecOnly ifFalse:[
    1.46          editor hasSaved ifTrue:[
    1.47              specTool specification 
    1.48                  columns:nil;
    1.49 @@ -3241,6 +3243,79 @@
    1.50      "Modified: / 12-01-2008 / 10:31:47 / cg"
    1.51  !
    1.52  
    1.53 +openDataSetColumnEditor
    1.54 +    "opens a Table Column Editor on current widget"
    1.55 +
    1.56 +    |cls editor specTool columnHolder tableSelector columns isEditingSpecOnly|
    1.57 +
    1.58 +    self isModified ifTrue:[
    1.59 +        "/ force editFields to accept
    1.60 +        self acceptChannel value:true; value:false.
    1.61 +    ].
    1.62 +
    1.63 +    specTool := self specTool.
    1.64 +    columnHolder := specTool aspectFor:#columnHolder.
    1.65 +    tableSelector := columnHolder value.
    1.66 +
    1.67 +    tableSelector notEmptyOrNil ifTrue:[
    1.68 +        tableSelector := tableSelector asSymbol.
    1.69 +    ] ifFalse:[
    1.70 +        tableSelector := nil.
    1.71 +    ].
    1.72 +
    1.73 +    isEditingSpecOnly := true.
    1.74 +
    1.75 +    (tableSelector notNil and:[self isEditingSpecOnly not]) ifTrue:[
    1.76 +        (cls := self resolveName:specClassName) notNil ifTrue:[
    1.77 +            isEditingSpecOnly := false.
    1.78 +        ].
    1.79 +    ].
    1.80 +    editor := DataSetBuilder new.
    1.81 +    editor masterApplication:self.
    1.82 +
    1.83 +    isEditingSpecOnly ifFalse:[
    1.84 +        editor specClass:cls.
    1.85 +        editor rowClassName:(specTool specification rowClassName).
    1.86 +    ].
    1.87 +
    1.88 +    isEditingSpecOnly not ifTrue:[
    1.89 +        editor openModalOnClass:cls andSelector:tableSelector.
    1.90 +
    1.91 +        editor hasSaved ifTrue:[
    1.92 +            specTool specification 
    1.93 +                columns:nil;
    1.94 +                rowClassName:(editor rowClassName).
    1.95 +
    1.96 +            tableSelector = editor specSelector ifFalse:[
    1.97 +                columnHolder value:(editor specSelector).
    1.98 +                self accept.
    1.99 +            ].
   1.100 +        ].
   1.101 +        ^ self
   1.102 +    ].
   1.103 +
   1.104 +    editor editingSpecOnly:true.
   1.105 +
   1.106 +    columns := specTool specification columns.
   1.107 +
   1.108 +    columns size ~~ 0 ifTrue:[
   1.109 +        editor openModalOnResourceSpec:columns
   1.110 +    ] ifFalse:[
   1.111 +        editor openModal
   1.112 +    ].
   1.113 +
   1.114 +    editor hasSaved ifTrue:[
   1.115 +        columnHolder value:nil.
   1.116 +
   1.117 +        specTool specification 
   1.118 +            columns:(editor acceptedColumns);
   1.119 +            rowClassName:(editor rowClassName).
   1.120 +
   1.121 +        columnHolder value:nil.
   1.122 +        self modifiedChannel value:true.
   1.123 +    ].
   1.124 +!
   1.125 +
   1.126  openEditMenu
   1.127      "opens a Menu Editor on current widget"
   1.128