# HG changeset patch # User ca # Date 1244651213 -7200 # Node ID 04b2605a66b2cf06da7c97fe9ae5b03175499387 # Parent 1acb2765094d9f76367b4fc18fdc685fcb751071 dataset editor support diff -r 1acb2765094d -r 04b2605a66b2 UIPainter.st --- a/UIPainter.st Wed Jun 10 17:20:46 2009 +0200 +++ b/UIPainter.st Wed Jun 10 18:26:53 2009 +0200 @@ -3169,12 +3169,14 @@ !UIPainter methodsFor:'building editors'! -openDataSetColumnEditor +XXopenDataSetColumnEditor "opens a Table Column Editor on current widget" - |cls editor specTool columnHolder tableSelector columns| - - self isEditingSpecOnly ifFalse:[ + |cls editor specTool columnHolder tableSelector columns isEditingSpecOnly| + + isEditingSpecOnly := self isEditingSpecOnly. + + isEditingSpecOnly ifFalse:[ (cls := self resolveName:specClassName) isNil ifTrue:[ self askForSaving ifTrue:[cls := self resolveName:specClassName]. ]. @@ -3187,7 +3189,7 @@ editor masterApplication:self. specTool := self specTool. - self isEditingSpecOnly ifFalse:[ + isEditingSpecOnly ifFalse:[ editor specClass: cls. editor rowClassName:(specTool specification rowClassName). ]. @@ -3198,7 +3200,7 @@ ifTrue:[tableSelector asSymbol] ifFalse:[nil]. - (self isEditingSpecOnly not + (isEditingSpecOnly not and:[tableSelector notNil and:[cls class includesSelector:tableSelector]]) ifTrue:[ editor openModalOnClass:cls andSelector:tableSelector @@ -3213,7 +3215,7 @@ ]. ]. - self isEditingSpecOnly ifFalse:[ + isEditingSpecOnly ifFalse:[ editor hasSaved ifTrue:[ specTool specification columns:nil; @@ -3241,6 +3243,79 @@ "Modified: / 12-01-2008 / 10:31:47 / cg" ! +openDataSetColumnEditor + "opens a Table Column Editor on current widget" + + |cls editor specTool columnHolder tableSelector columns isEditingSpecOnly| + + self isModified ifTrue:[ + "/ force editFields to accept + self acceptChannel value:true; value:false. + ]. + + specTool := self specTool. + columnHolder := specTool aspectFor:#columnHolder. + tableSelector := columnHolder value. + + tableSelector notEmptyOrNil ifTrue:[ + tableSelector := tableSelector asSymbol. + ] ifFalse:[ + tableSelector := nil. + ]. + + isEditingSpecOnly := true. + + (tableSelector notNil and:[self isEditingSpecOnly not]) ifTrue:[ + (cls := self resolveName:specClassName) notNil ifTrue:[ + isEditingSpecOnly := false. + ]. + ]. + editor := DataSetBuilder new. + editor masterApplication:self. + + isEditingSpecOnly ifFalse:[ + editor specClass:cls. + editor rowClassName:(specTool specification rowClassName). + ]. + + isEditingSpecOnly not ifTrue:[ + editor openModalOnClass:cls andSelector:tableSelector. + + editor hasSaved ifTrue:[ + specTool specification + columns:nil; + rowClassName:(editor rowClassName). + + tableSelector = editor specSelector ifFalse:[ + columnHolder value:(editor specSelector). + self accept. + ]. + ]. + ^ self + ]. + + editor editingSpecOnly:true. + + columns := specTool specification columns. + + columns size ~~ 0 ifTrue:[ + editor openModalOnResourceSpec:columns + ] ifFalse:[ + editor openModal + ]. + + editor hasSaved ifTrue:[ + columnHolder value:nil. + + specTool specification + columns:(editor acceptedColumns); + rowClassName:(editor rowClassName). + + columnHolder value:nil. + self modifiedChannel value:true. + ]. +! + openEditMenu "opens a Menu Editor on current widget"