[Commits] (jed) First pass at EmbeddedContainers.
commits at osafoundation.org
commits at osafoundation.org
Thu Jan 15 13:37:19 PST 2004
Commit by: jed
Modified files:
osaf/chandler/Chandler/parcels/OSAF/templates/top/parcel.xml 1.23 1.24
osaf/chandler/Chandler/parcels/OSAF/framework/blocks/parcel.xml 1.25 1.26
osaf/chandler/Chandler/parcels/OSAF/framework/blocks/ContainerBlocks.py 1.30 1.31
Log message:
First pass at EmbeddedContainers.
Also changed content-spec to be contentSpec since the repository does not deal well with hyphens.
ViewCVS links:
http://cvs.osafoundation.org/index.cgi/osaf/chandler/Chandler/parcels/OSAF/templates/top/parcel.xml.diff?r1=text&tr1=1.23&r2=text&tr2=1.24
http://cvs.osafoundation.org/index.cgi/osaf/chandler/Chandler/parcels/OSAF/framework/blocks/parcel.xml.diff?r1=text&tr1=1.25&r2=text&tr2=1.26
http://cvs.osafoundation.org/index.cgi/osaf/chandler/Chandler/parcels/OSAF/framework/blocks/ContainerBlocks.py.diff?r1=text&tr1=1.30&r2=text&tr2=1.31
Index: osaf/chandler/Chandler/parcels/OSAF/framework/blocks/ContainerBlocks.py
diff -u osaf/chandler/Chandler/parcels/OSAF/framework/blocks/ContainerBlocks.py:1.30 osaf/chandler/Chandler/parcels/OSAF/framework/blocks/ContainerBlocks.py:1.31
--- osaf/chandler/Chandler/parcels/OSAF/framework/blocks/ContainerBlocks.py:1.30 Tue Jan 13 14:04:19 2004
+++ osaf/chandler/Chandler/parcels/OSAF/framework/blocks/ContainerBlocks.py Thu Jan 15 13:36:48 2004
@@ -59,10 +59,19 @@
for child in self.childrenBlocks:
child.render (parent, parentWindow)
self.handleChildren(window)
+ return window, parent, parentWindow
+ def getParentBlock(self, parentWindow):
+ if self.parentBlock:
+ return self.parentBlock
+ return Globals.repository.find (parentWindow.counterpartUUID)
+
def addToContainer(self, parent, child, id, flag, border):
pass
+ def removeFromContainer(self, childToRemove):
+ pass
+
def handleChildren(self, window):
pass
@@ -127,7 +136,7 @@
if self.parentBlock:
panel = wxPanel(parentWindow, -1)
panel.SetSizer(sizer)
- self.parentBlock.addToContainer(parent, panel, 1,
+ self.getParentBlock(parentWindow).addToContainer(parent, panel, 1,
self.Calculate_wxFlag(),
self.Calculate_wxBorder())
return panel, sizer, panel
@@ -137,8 +146,33 @@
def addToContainer(self, parent, child, weight, flag, border):
parent.Add(child, weight, flag, border)
+
+ def removeFromContainer(self, parent, child):
+ parent.Remove(child)
+ child.Destroy()
+ parent.Layout()
+
-
+class EmbeddedContainer(RectangularChild):
+ def renderOneBlock (self, parent, parentWindow):
+ self.wxParent = parent
+ self.wxParentWindow = parentWindow
+ newChild = Globals.repository.find (self.contentSpec.data)
+ if newChild:
+ return newChild.render (parent, parentWindow)
+ return None, None, None
+
+ def on_chandler_SwitchEmbeddedChild (self, notification):
+ oldChild = Globals.repository.find (self.contentSpec.data)
+ wxOldChild = Globals.association[oldChild.getUUID()]
+ self.getParentBlock(self.wxParentWindow).removeFromContainer(self.wxParent, wxOldChild)
+
+ self.contentSpec.data = notification.data['event'].choice
+ newChild = Globals.repository.find (self.contentSpec.data)
+ if newChild:
+ newChild.render (self.wxParent, self.wxParentWindow)
+
+
class Button(RectangularChild):
def renderOneBlock(self, parent, parentWindow):
id = 0
@@ -167,7 +201,7 @@
elif __debug__:
assert (False)
- self.parentBlock.addToContainer(parent, button, int(self.stretchFactor),
+ self.getParentBlock(parentWindow).addToContainer(parent, button, int(self.stretchFactor),
self.Calculate_wxFlag(), self.Calculate_wxBorder())
return button, None, None
@@ -178,7 +212,7 @@
wxDefaultPosition,
(self.minimumSize.width, self.minimumSize.height),
self.choices)
- self.parentBlock.addToContainer(parent, choice, int(self.stretchFactor),
+ self.getParentBlock(parentWindow).addToContainer(parent, choice, int(self.stretchFactor),
self.Calculate_wxFlag(), self.Calculate_wxBorder())
return choice, None, None
@@ -189,7 +223,7 @@
wxDefaultPosition,
(self.minimumSize.width, self.minimumSize.height),
self.choices)
- self.parentBlock.addToContainer(parent, comboBox, int(self.stretchFactor),
+ self.getParentBlock(parentWindow).addToContainer(parent, comboBox, int(self.stretchFactor),
self.Calculate_wxFlag(), self.Calculate_wxBorder())
return comboBox, None, None
@@ -224,7 +258,7 @@
style, name=self._name)
editText.SetFont(Font (self.characterStyle))
- self.parentBlock.addToContainer(parent, editText, int(self.stretchFactor),
+ self.getParentBlock(parentWindow).addToContainer(parent, editText, int(self.stretchFactor),
self.Calculate_wxFlag(), self.Calculate_wxBorder())
return editText, None, None
@@ -240,7 +274,7 @@
if self.url:
htmlWindow.LoadPage(self.url)
- self.parentBlock.addToContainer(parent, htmlWindow, int(self.stretchFactor),
+ self.getParentBlock(parentWindow).addToContainer(parent, htmlWindow, int(self.stretchFactor),
self.Calculate_wxFlag(), self.Calculate_wxBorder())
return htmlWindow, None, None
@@ -267,7 +301,7 @@
wxDefaultPosition,
(self.minimumSize.width, self.minimumSize.height),
self.choices, self.itemsPerLine, dimension)
- self.parentBlock.addToContainer(parent, radioBox, int(self.stretchFactor),
+ self.getParentBlock(parentWindow).addToContainer(parent, radioBox, int(self.stretchFactor),
self.Calculate_wxFlag(), self.Calculate_wxBorder())
return radioBox, None, None
@@ -312,7 +346,7 @@
wxDefaultPosition,
(self.size.width, self.size.height),
style=wxSP_3D|wxSP_LIVE_UPDATE|wxNO_FULL_REPAINT_ON_RESIZE)
- self.parentBlock.addToContainer(parent, splitWindow, int(self.stretchFactor),
+ self.getParentBlock(parentWindow).addToContainer(parent, splitWindow, int(self.stretchFactor),
self.Calculate_wxFlag(), self.Calculate_wxBorder())
"""
Wire up onSize after __init__ has been called, otherwise it will
@@ -325,6 +359,10 @@
if not hasattr(self, 'childrenToAdd'):
self.childrenToAdd = []
self.childrenToAdd.append(child)
+
+ def removeFromContainer(self, childToRemove):
+ # @@@ Must be implemented
+ pass
def handleChildren(self, window):
children = window.GetChildren()
@@ -364,8 +402,10 @@
style)
staticText.SetFont(Font (self.characterStyle))
- self.parentBlock.addToContainer(parent, staticText, int(self.stretchFactor),
- self.Calculate_wxFlag(), self.Calculate_wxBorder())
+ self.getParentBlock(parentWindow).addToContainer(parent, staticText,
+ int(self.stretchFactor),
+ self.Calculate_wxFlag(),
+ self.Calculate_wxBorder())
return staticText, None, None
@@ -390,7 +430,7 @@
wxDefaultPosition,
(self.minimumSize.width, self.minimumSize.height),
style = style)
- self.parentBlock.addToContainer(parent, tabbedContainer, int(self.stretchFactor),
+ self.getParentBlock(parentWindow).addToContainer(parent, tabbedContainer, int(self.stretchFactor),
self.Calculate_wxFlag(), self.Calculate_wxBorder())
return tabbedContainer, tabbedContainer, tabbedContainer
@@ -398,6 +438,10 @@
if not hasattr(self, 'childrenToAdd'):
self.childrenToAdd = []
self.childrenToAdd.append(child)
+
+ def removeFromContainer(self, childToRemove):
+ # @@@ Must be implemented
+ pass
def handleChildren(self, window):
if len (self.childrenToAdd) > 0:
@@ -495,7 +539,7 @@
notification.SetData(arguments)
Globals.topView.dispatchEvent(notification)
- self.parentBlock.addToContainer(parent, treeList, 1, self.Calculate_wxFlag(), self.Calculate_wxBorder())
+ self.getParentBlock(parentWindow).addToContainer(parent, treeList, 1, self.Calculate_wxFlag(), self.Calculate_wxBorder())
return treeList, None, None
Index: osaf/chandler/Chandler/parcels/OSAF/framework/blocks/parcel.xml
diff -u osaf/chandler/Chandler/parcels/OSAF/framework/blocks/parcel.xml:1.25 osaf/chandler/Chandler/parcels/OSAF/framework/blocks/parcel.xml:1.26
--- osaf/chandler/Chandler/parcels/OSAF/framework/blocks/parcel.xml:1.25 Tue Jan 13 12:46:15 2004
+++ osaf/chandler/Chandler/parcels/OSAF/framework/blocks/parcel.xml Thu Jan 15 13:36:48 2004
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.25 $ -->
-<!-- $Date: 2004/01/13 20:46:15 $ -->
+<!-- $Revision: 1.26 $ -->
+<!-- $Date: 2004/01/15 21:36:48 $ -->
<!-- Copyright (c) 2003 Open Source Applications Foundation -->
<!-- License: http://osafoundation.org/Chandler_0.1_license_terms.htm -->
@@ -95,7 +95,7 @@
<Attribute itemName="usedInBlocks">
<type itemref="docSchema:Block"/>
<cardinality>list</cardinality>
- <inverseAttribute itemref="docSchema:Block/content-spec"/>
+ <inverseAttribute itemref="docSchema:Block/contentSpec"/>
</Attribute>
<Enumeration itemName="queryEnumType">
@@ -191,7 +191,7 @@
<Kind itemName="Block">
<classes key="python">OSAF.framework.blocks.Block.Block</classes>
- <Attribute itemName="content-spec">
+ <Attribute itemName="contentSpec">
<type itemref="docSchema:Query"/>
<inverseAttribute itemref="docSchema:Query/usedInBlocks"/>
</Attribute>
@@ -218,7 +218,7 @@
<type itemref="Boolean"/>
</Attribute>
- <attributes itemref="docSchema:Block/content-spec"/>
+ <attributes itemref="docSchema:Block/contentSpec"/>
<attributes itemref="docSchema:Block/childrenBlocks"/>
<attributes itemref="docSchema:Block/parentBlock"/>
<attributes itemref="docSchema:Block/styles"/>
@@ -297,6 +297,14 @@
<superKinds itemref="docSchema:RectangularChild"/>
<attributes itemref="docSchema:orientationEnum"/>
+ </Kind>
+
+ <!--
+ EmbeddedContainer
+ -->
+ <Kind itemName="EmbeddedContainer">
+ <classes key="python">OSAF.framework.blocks.ContainerBlocks.EmbeddedContainer</classes>
+ <superKinds itemref="docSchema:RectangularChild"/>
</Kind>
<!--
Index: osaf/chandler/Chandler/parcels/OSAF/templates/top/parcel.xml
diff -u osaf/chandler/Chandler/parcels/OSAF/templates/top/parcel.xml:1.23 osaf/chandler/Chandler/parcels/OSAF/templates/top/parcel.xml:1.24
--- osaf/chandler/Chandler/parcels/OSAF/templates/top/parcel.xml:1.23 Tue Jan 13 14:04:17 2004
+++ osaf/chandler/Chandler/parcels/OSAF/templates/top/parcel.xml Thu Jan 15 13:36:48 2004
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.23 $ -->
-<!-- $Date: 2004/01/13 22:04:17 $ -->
+<!-- $Revision: 1.24 $ -->
+<!-- $Date: 2004/01/15 21:36:48 $ -->
<!-- Copyright (c) 2003 Open Source Applications Foundation -->
<!-- License: http://osafoundation.org/Chandler_0.1_license_terms.htm -->
@@ -168,6 +168,13 @@
<choice>Data</choice>
</ChoiceEvent>
+ <ChoiceEvent itemName="ChooseEmbedded">
+ <name>chandler/TabChoice</name>
+ <dispatchEnum>SendToBlock</dispatchEnum>
+ <dispatchToBlock itemref="doc:Tabs"/>
+ <choice>Embedded</choice>
+ </ChoiceEvent>
+
<MenuItem itemName="ButtonsMenuItem">
<title>Buttons Tab</title>
<operation>InsertBefore</operation>
@@ -201,6 +208,45 @@
<helpString></helpString>
</MenuItem>
+ <MenuItem itemName="EmbeddedMenuItem">
+ <title>Embedded Tab</title>
+ <operation>InsertBefore</operation>
+ <menuLocation>DemoMenu</menuLocation>
+ <itemLocation></itemLocation>
+ <menuItemKind>Radio</menuItemKind>
+ <accel></accel>
+ <event itemref="doc:ChooseEmbedded"/>
+ <helpString></helpString>
+ </MenuItem>
+
+ <MenuItem itemName="DemoSeparatorItem">
+ <title></title>
+ <operation>InsertBefore</operation>
+ <menuLocation>DemoMenu</menuLocation>
+ <itemLocation></itemLocation>
+ <menuItemKind>Separator</menuItemKind>
+ <accel></accel>
+ <helpString></helpString>
+ </MenuItem>
+
+ <ChoiceEvent itemName="SwitchEmbeddedChild">
+ <name>chandler/SwitchEmbeddedChild</name>
+ <dispatchEnum>SendToBlock</dispatchEnum>
+ <dispatchToBlock itemref="doc:EmbeddedTitle"/>
+ <choice>parcels/OSAF/templates/top/LeftText</choice>
+ </ChoiceEvent>
+
+ <MenuItem itemName="SwitchViewItem">
+ <title>Switch Embedded View</title>
+ <operation>InsertBefore</operation>
+ <menuLocation>DemoMenu</menuLocation>
+ <itemLocation></itemLocation>
+ <menuItemKind>Radio</menuItemKind>
+ <accel></accel>
+ <event itemref="doc:SwitchEmbeddedChild"/>
+ <helpString></helpString>
+ </MenuItem>
+
<CharacterStyle itemName="HeaderCharacterStyle">
<fontFamily>DefaultUIFont</fontFamily>
<fontSize>12.0</fontSize>
@@ -304,7 +350,7 @@
<Button itemName="TextButton">
<title>Add Text</title>
<buttonKind>Text</buttonKind>
- <content-spec itemref="doc:myQuery"/>
+ <contentSpec itemref="doc:myQuery"/>
<open>True</open>
@@ -318,7 +364,7 @@
<Button itemName="ImageButton">
<buttonKind>Image</buttonKind>
<icon>application/images/Reload.png</icon>
- <content-spec itemref="doc:myQuery"/>
+ <contentSpec itemref="doc:myQuery"/>
<open>True</open>
@@ -332,7 +378,7 @@
<Button itemName="ToggleButton">
<title>Toggle</title>
<buttonKind>Toggle</buttonKind>
- <content-spec itemref="doc:myQuery"/>
+ <contentSpec itemref="doc:myQuery"/>
<open>True</open>
@@ -344,7 +390,7 @@
</Button>
<BoxContainer itemName="ButtonsSizer">
- <content-spec itemref="doc:myQuery"/>
+ <contentSpec itemref="doc:myQuery"/>
<childrenBlocks itemref="doc:ImageButton"/>
<childrenBlocks itemref="doc:ToggleButton"/>
<childrenBlocks itemref="doc:TextButton"/>
@@ -378,7 +424,7 @@
</EditText>
<BoxContainer itemName="ButtonsTab">
- <content-spec itemref="doc:myQuery"/>
+ <contentSpec itemref="doc:myQuery"/>
<childrenBlocks itemref="doc:ButtonHeader"/>
<childrenBlocks itemref="doc:ButtonsSizer"/>
<childrenBlocks itemref="doc:ButtonText"/>
@@ -403,7 +449,7 @@
<radioAlignEnum>Down</radioAlignEnum>
<itemsPerLine>3</itemsPerLine>
- <content-spec itemref="doc:myQuery"/>
+ <contentSpec itemref="doc:myQuery"/>
<open>True</open>
<size>200,200</size>
@@ -418,7 +464,7 @@
<choices>Second</choices>
<choices>Third</choices>
- <content-spec itemref="doc:myQuery"/>
+ <contentSpec itemref="doc:myQuery"/>
<open>True</open>
<size>200,200</size>
@@ -434,7 +480,7 @@
<choices>Second</choices>
<choices>Third</choices>
- <content-spec itemref="doc:myQuery"/>
+ <contentSpec itemref="doc:myQuery"/>
<open>True</open>
<size>200,200</size>
@@ -445,7 +491,7 @@
</ComboBox>
<BoxContainer itemName="RadioSizer">
- <content-spec itemref="doc:myQuery"/>
+ <contentSpec itemref="doc:myQuery"/>
<childrenBlocks itemref="doc:RadioExample"/>
<open>True</open>
@@ -459,7 +505,7 @@
</BoxContainer>
<BoxContainer itemName="ChoiceSizer">
- <content-spec itemref="doc:myQuery"/>
+ <contentSpec itemref="doc:myQuery"/>
<childrenBlocks itemref="doc:ChoiceExample"/>
<open>True</open>
@@ -473,7 +519,7 @@
</BoxContainer>
<BoxContainer itemName="ComboSizer">
- <content-spec itemref="doc:myQuery"/>
+ <contentSpec itemref="doc:myQuery"/>
<childrenBlocks itemref="doc:ComboExample"/>
<open>True</open>
@@ -487,7 +533,7 @@
</BoxContainer>
<BoxContainer itemName="ControlsTab">
- <content-spec itemref="doc:myQuery"/>
+ <contentSpec itemref="doc:myQuery"/>
<childrenBlocks itemref="doc:RadioSizer"/>
<childrenBlocks itemref="doc:ComboSizer"/>
<open>True</open>
@@ -506,7 +552,7 @@
<columnWidths>200</columnWidths>
- <content-spec itemref="doc:myQuery"/>
+ <contentSpec itemref="doc:myQuery"/>
<open>True</open>
<size>200,200</size>
@@ -517,7 +563,7 @@
</TreeList>
<BoxContainer itemName="TreeSizer">
- <content-spec itemref="doc:myQuery"/>
+ <contentSpec itemref="doc:myQuery"/>
<childrenBlocks itemref="doc:TreeExample"/>
<open>True</open>
@@ -532,7 +578,7 @@
<HTML itemName="HTMLExample">
<url>http://www.osafoundation.org</url>
- <content-spec itemref="doc:myQuery"/>
+ <contentSpec itemref="doc:myQuery"/>
<open>True</open>
<size>200,200</size>
@@ -543,7 +589,7 @@
</HTML>
<BoxContainer itemName="HTMLSizer">
- <content-spec itemref="doc:myQuery"/>
+ <contentSpec itemref="doc:myQuery"/>
<childrenBlocks itemref="doc:HTMLExample"/>
<open>True</open>
@@ -557,7 +603,7 @@
</BoxContainer>
<BoxContainer itemName="DataTab">
- <content-spec itemref="doc:myQuery"/>
+ <contentSpec itemref="doc:myQuery"/>
<childrenBlocks itemref="doc:TreeSizer"/>
<childrenBlocks itemref="doc:HTMLSizer"/>
<open>True</open>
@@ -571,15 +617,60 @@
<orientationEnum>Vertical</orientationEnum>
</BoxContainer>
+ <StaticText itemName="Footer">
+ <open>True</open>
+
+ <size>100,20</size>
+ <minimumSize>100,20</minimumSize>
+ <border>3.0, 3.0, 3.0, 3.0</border>
+ <alignmentEnum>grow</alignmentEnum>
+ <stretchFactor>0.0</stretchFactor>
+ <textAlignmentEnum>Left</textAlignmentEnum>
+ <characterStyle itemref="doc:HeaderCharacterStyle"/>
+ <title>My Repository Viewer</title>
+ </StaticText>
+
+ <Query itemName="embeddedQuery">
+ <queryEnum>listOfItems</queryEnum>
+ <data>parcels/OSAF/templates/top/Footer</data>
+ </Query>
+
+ <EmbeddedContainer itemName="EmbeddedTitle">
+ <contentSpec itemref="doc:embeddedQuery"/>
+ <open>True</open>
+
+ <size>100,20</size>
+ <minimumSize>100,20</minimumSize>
+ <border>3.0, 3.0, 3.0, 3.0</border>
+ <alignmentEnum>grow</alignmentEnum>
+ <stretchFactor>0.0</stretchFactor>
+ </EmbeddedContainer>
+
+ <BoxContainer itemName="EmbeddedTab">
+ <contentSpec itemref="doc:myQuery"/>
+ <childrenBlocks itemref="doc:EmbeddedTitle"/>
+ <open>True</open>
+
+ <size>200,100</size>
+ <minimumSize>200,100</minimumSize>
+ <border>2.0, 2.0, 2.0, 2.0</border>
+ <alignmentEnum>grow</alignmentEnum>
+ <stretchFactor>1.0</stretchFactor>
+
+ <orientationEnum>Vertical</orientationEnum>
+ </BoxContainer>
+
<TabbedContainer itemName="Tabs">
<childrenBlocks itemref="doc:ButtonsTab"/>
<childrenBlocks itemref="doc:ControlsTab"/>
<childrenBlocks itemref="doc:DataTab"/>
+ <childrenBlocks itemref="doc:EmbeddedTab"/>
<tabPosEnum>Top</tabPosEnum>
<tabNames>Buttons</tabNames>
<tabNames>Controls</tabNames>
- <tabNames>Data</tabNames>
+ <tabNames>Data</tabNames>
+ <tabNames>Embedded</tabNames>
<size>600,200</size>
@@ -590,11 +681,14 @@
</TabbedContainer>
<BoxContainer itemName="TabBox">
- <content-spec itemref="doc:myQuery"/>
+ <contentSpec itemref="doc:myQuery"/>
<childrenBlocks itemref="doc:DemoMenu"/>
<childrenBlocks itemref="doc:ButtonsMenuItem"/>
<childrenBlocks itemref="doc:ControlsMenuItem"/>
<childrenBlocks itemref="doc:DataMenuItem"/>
+ <childrenBlocks itemref="doc:EmbeddedMenuItem"/>
+ <childrenBlocks itemref="doc:DemoSeparatorItem"/>
+ <childrenBlocks itemref="doc:SwitchViewItem"/>
<childrenBlocks itemref="doc:Tabs"/>
<open>True</open>
@@ -631,7 +725,7 @@
<HTML itemName="HTML">
<url></url>
- <content-spec itemref="doc:myQuery"/>
+ <contentSpec itemref="doc:myQuery"/>
<open>True</open>
<size>100,50</size>
@@ -642,7 +736,7 @@
</HTML>
<SplitWindow itemName="RepositoryBox">
- <content-spec itemref="doc:myQuery"/>
+ <contentSpec itemref="doc:myQuery"/>
<childrenBlocks itemref="doc:TreeList"/>
<childrenBlocks itemref="doc:HTML"/>
<open>True</open>
@@ -658,7 +752,7 @@
</SplitWindow>
<SplitWindow itemName="ContentBox">
- <content-spec itemref="doc:myQuery"/>
+ <contentSpec itemref="doc:myQuery"/>
<childrenBlocks itemref="doc:RepositoryBox"/>
<childrenBlocks itemref="doc:TabBox"/>
<open>True</open>
@@ -674,7 +768,7 @@
</SplitWindow>
<View itemName="TopView">
- <content-spec itemref="doc:myQuery"/>
+ <contentSpec itemref="doc:myQuery"/>
<childrenBlocks itemref="doc:FileMenu"/>
<childrenBlocks itemref="doc:QuitItem"/>
More information about the Commits
mailing list