Package muntjac :: Package ui :: Module split_panel
[hide private]
[frames] | no frames]

Source Code for Module muntjac.ui.split_panel

 1  # Copyright (C) 2012 Vaadin Ltd.  
 2  # Copyright (C) 2012 Richard Lincoln 
 3  #  
 4  # Licensed under the Apache License, Version 2.0 (the "License");  
 5  # you may not use this file except in compliance with the License.  
 6  # You may obtain a copy of the License at  
 7  #  
 8  #     http://www.apache.org/licenses/LICENSE-2.0  
 9  #  
10  # Unless required by applicable law or agreed to in writing, software  
11  # distributed under the License is distributed on an "AS IS" BASIS,  
12  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
13  # See the License for the specific language governing permissions and  
14  # limitations under the License. 
15   
16  """Defines a component container, that can contain two components which are 
17  split by divider element.""" 
18   
19  from muntjac.ui.abstract_split_panel import AbstractSplitPanel 
20   
21   
22 -class SplitPanel(AbstractSplitPanel):
23 """SplitPanel. 24 25 C{SplitPanel} is a component container, that can contain two 26 components (possibly containers) which are split by divider element. 27 28 @author: Vaadin Ltd. 29 @author: Richard Lincoln 30 @version: 1.1.2 31 @deprecated: Use L{HorizontalSplitPanel} or L{VerticalSplitPanel} instead. 32 """ 33 34 CLIENT_WIDGET = None #ClientWidget(VSplitPanelHorizontal, LoadStyle.EAGER) 35 36 #: Components are to be laid out vertically. 37 ORIENTATION_VERTICAL = 0 38 39 #: Components are to be laid out horizontally. 40 ORIENTATION_HORIZONTAL = 1 41 42
43 - def __init__(self, orientation=None):
44 """Creates a new split panel. The orientation of the panels is 45 C{ORIENTATION_VERTICAL} by default. 46 47 @param orientation: 48 the orientation of the layout. 49 """ 50 super(SplitPanel, self).__init__() 51 52 # Orientation of the layout. 53 if orientation is None: 54 self._orientation = self.ORIENTATION_VERTICAL 55 else: 56 self.setOrientation(orientation) 57 58 self.setSizeFull()
59 60
61 - def paintContent(self, target):
62 """Paints the content of this component. 63 64 @param target: 65 the Paint Event. 66 @raise PaintException: 67 if the paint operation failed. 68 """ 69 super(SplitPanel, self).paintContent(target) 70 if self._orientation == self.ORIENTATION_VERTICAL: 71 target.addAttribute('vertical', True)
72 73
74 - def getOrientation(self):
75 """Gets the orientation of the split panel. 76 77 @return: the Value of property orientation. 78 """ 79 return self._orientation
80 81
82 - def setOrientation(self, orientation):
83 """Sets the orientation of the split panel. 84 85 @param orientation: 86 the New value of property orientation. 87 """ 88 # Checks the validity of the argument 89 if (orientation < self.ORIENTATION_VERTICAL 90 or orientation > self.ORIENTATION_HORIZONTAL): 91 raise ValueError 92 93 self._orientation = orientation 94 self.requestRepaint()
95