UIPainterView.st
changeset 1173 7b5f40822819
parent 1092 60e029255679
child 1191 32bb9f029ad2
equal deleted inserted replaced
1172:e22253cb348f 1173:7b5f40822819
  1637 
  1637 
  1638 
  1638 
  1639 
  1639 
  1640 !
  1640 !
  1641 
  1641 
  1642 rebuildView:aView fromSpec:aSpec withBuilder:aBuilder
  1642 rebuildView:aView fromSpec:aSpec withBuilder:aBuilderOrNil
  1643     |v|
  1643     |v builder|
       
  1644 
       
  1645     (builder := aBuilderOrNil) isNil ifTrue:[
       
  1646         "/ create a dummy builder
       
  1647         builder := UIBuilder new isEditing:true.
       
  1648         className notNil ifTrue:[
       
  1649             builder applicationClass:(self resolveName:className).
       
  1650         ].
       
  1651     ].
  1644 
  1652 
  1645     aSpec needsRebuildForAttributes ifTrue:[
  1653     aSpec needsRebuildForAttributes ifTrue:[
  1646         v := aSpec buildViewWithLayoutFor:aBuilder in:(self findContainerOfView:aView).
  1654         "/ needs a full rebuild (in case view class depends upon spec-attribute)
       
  1655         v := aSpec buildViewWithLayoutFor:builder in:(self findContainerOfView:aView).
  1647         v realize.    
  1656         v realize.    
  1648         aView destroy.
  1657         aView destroy.
  1649         device sync.
  1658         device sync.
  1650         device flush.
  1659         device flush.
  1651         aView becomeSameAs:v.
  1660         aView becomeSameAs:v.
  1652         inputView raise.
  1661         inputView raise.
  1653     ] ifFalse:[
  1662     ] ifFalse:[
  1654         aSpec setAttributesIn:aView with:aBuilder.
  1663         aSpec setAttributesIn:aView with:builder.
  1655         self elementChangedSize:aView.
  1664         self elementChangedSize:aView.
  1656     ].
  1665     ].
  1657 
  1666 
  1658 !
  1667 !
  1659 
  1668 
  1681 !
  1690 !
  1682 
  1691 
  1683 updateFromSpec:aSpec
  1692 updateFromSpec:aSpec
  1684     "update current selected view from specification
  1693     "update current selected view from specification
  1685     "
  1694     "
  1686     |props name builder|
  1695     |props name|
  1687 
  1696 
  1688     aSpec class == WindowSpec ifTrue:[
  1697     aSpec class == WindowSpec ifTrue:[
  1689          ^ treeView canvasSpec:aSpec
  1698          ^ treeView canvasSpec:aSpec
  1690     ].
  1699     ].
  1691 
  1700 
  1692     self singleSelection notNil ifTrue:[
  1701     self singleSelection notNil ifTrue:[
  1693         self withSelectionHiddenDo:[
  1702         self withSelectionHiddenDo:[
  1694             self transaction:#specification selectionDo:[:aView|
  1703             self transaction:#specification selectionDo:[:aView|
  1695                 builder := UIBuilder new isEditing:true.
       
  1696                 className notNil ifTrue:[
       
  1697                     builder applicationClass:(self resolveName:className).
       
  1698                 ].
       
  1699                 props   := self propertyOfView:aView.
  1704                 props   := self propertyOfView:aView.
  1700                 name    := (aSpec name) withoutSeparators.
  1705                 name    := (aSpec name) withoutSeparators.
  1701 
  1706 
  1702                 name = props name ifFalse:[
  1707                 name = props name ifFalse:[
  1703                     (self propertyOfName:name) notNil ifTrue:[
  1708                     (self propertyOfName:name) notNil ifTrue:[
  1704                         name := props name
  1709                         name := props name
  1705                     ]
  1710                     ]
  1706                 ].
  1711                 ].
  1707                 aSpec name:name.
  1712                 aSpec name:name.
  1708                 self createUndoSpecModify:props.
  1713                 self createUndoSpecModify:props.
  1709                 self rebuildView:aView fromSpec:aSpec withBuilder:builder.
  1714                 self rebuildView:aView fromSpec:aSpec withBuilder:nil.
  1710                 props spec:(aSpec copy).
  1715                 props spec:(aSpec copy).
  1711                 treeView propertyChanged:props.
  1716                 treeView propertyChanged:props.
  1712             ]
  1717             ]
  1713         ]
  1718         ]
  1714     ]
  1719     ]
  1890 !
  1895 !
  1891 
  1896 
  1892 undoSpecModify:args
  1897 undoSpecModify:args
  1893     "undo method when changing a spec; see 'createUndoSpecModify:'
  1898     "undo method when changing a spec; see 'createUndoSpecModify:'
  1894     "
  1899     "
  1895     |builder view spec props|
  1900     |view spec props|
  1896 
  1901 
  1897     props := self propertyOfIdentifier:(args at:2).
  1902     props := self propertyOfIdentifier:(args at:2).
  1898 
  1903 
  1899     props notNil ifTrue:[
  1904     props notNil ifTrue:[
  1900         view    := props view.
  1905         view    := props view.
  1901         spec    := args at:1.
  1906         spec    := args at:1.
  1902         builder := UIBuilder new isEditing:true.
  1907 
  1903 
       
  1904         className notNil ifTrue:[
       
  1905             builder applicationClass:(self resolveName:className).
       
  1906         ].
       
  1907         props spec:spec.
  1908         props spec:spec.
  1908         self rebuildView:view fromSpec:spec withBuilder:builder.
  1909         self rebuildView:view fromSpec:spec withBuilder:nil.
  1909         treeView propertyChanged:props.
  1910         treeView propertyChanged:props.
  1910     ]
  1911     ]
  1911 ! !
  1912 ! !
  1912 
  1913 
  1913 !UIPainterView::ViewProperty class methodsFor:'instance creation'!
  1914 !UIPainterView::ViewProperty class methodsFor:'instance creation'!