Home | Trees | Indices | Help |
|
---|
|
object --+ | util.IEventListener --+ | terminal.paintable.IPaintable --+ | object --+ | | | terminal.variable_owner.IVariableOwner --+ | object --+ | | | terminal.sizeable.ISizeable --+ | component.IComponent --+ | object --+ | | | event.method_event_source.IMethodEventSource --+ | AbstractComponent
An abstract class that defines default implementation for the IComponent interface. Basic UI components that are not derived from an external component can inherit this class to easily qualify as Muntjac components. Most components in Muntjac do just that.
Version: 1.1.2
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
Inherited from |
|
|||
SIZE_PATTERN = '^(-?\\d+(\\.\\d+)?)(%|px|em|ex|in|cm|mm|pt|pc)?$'
|
|||
Inherited from |
|
|||
Inherited from |
|
Constructs a new IComponent.
|
Adds an unique id for component that get's transferred to terminal for testing purposes. Keeping identifiers unique throughout the Application instance is on programmers responsibility. Note, that with the current terminal implementation the identifier cannot be changed while the component is visible. This means that the identifier should be set before the component is painted for the first time and kept the same while visible in the client.
|
Get's currently set debug identifier
|
Gets style for component. Multiple styles are joined with spaces.
Deprecated: Use getStyleName() instead; renamed for consistency and to indicate that "style" should not be used to switch client side implementation, only to style the component. |
Sets and replaces all previous style names of the component. This method will trigger a RepaintRequestEvent.
Deprecated: Use setStyleName() instead; renamed for consistency and to indicate that "style" should not be used to switch client side implementation, only to style the component. |
Gets all user-defined CSS style names of a component. If the component has multiple style names defined, the return string is a space-separated list of style names. Built-in style names defined in Muntjac or GWT are not returned. The style names are returned only in the basic form in which they were added; each user-defined style name shows as two CSS style class names in the rendered HTML: one as it was given and one prefixed with the component-specific style name. Only the former is returned.
|
Sets one or more user-defined style names of the component, replacing any previous user-defined styles. Multiple styles can be specified as a space-separated list of style names. The style names must be valid CSS class names and should not conflict with any built-in style names in Muntjac or GWT: label = new Label("This text has a lot of style") label.setStyleName("myonestyle myotherstyle") Each style name will occur in two versions: one as specified and one
that is prefixed with the style name of the component. For example, if
you have a .myonestyle {background: blue;} or: .v-button-myonestyle {background: blue;} It is normally a good practice to use addStyleName rather than this setter, as different software abstraction layers can then add their own styles without accidentally removing those defined in other layers. This method will trigger a RepaintRequestEvent.
|
Adds a style name to component. The style name will be rendered as a HTML class name, which can be used in a CSS definition: label = new Label("This text has style") label.addStyleName("mystyle") Each style name will occur in two versions: one as specified and one
that is prefixed wil the style name of the component. For example, if you
have a .mystyle {font-style: italic;} or: .v-button-mystyle {font-style: italic;} This method will trigger a RepaintRequestEvent.
|
Removes one or more style names from component. Multiple styles can be specified as a space-separated list of style names. The parameter must be a valid CSS style name. Only user-defined style names added with addStyleName or setStyleName can be removed; built-in style names defined in Muntjac or GWT can not be removed. This method will trigger a RepaintRequestEvent.
|
Gets the caption of the component. See setCaption for a detailed description of the caption.
|
Sets the component's caption string. Caption is the visible name of the component. This method will trigger a RepaintRequestEvent.
|
Gets the locale of the component. If a component does not have a locale set, the locale of its parent is
returned, and so on. Eventually, if no parent has locale set, the locale
of the application is returned. If the application does not have a locale
set, it is determined by As the component must be attached before its locale can be acquired, using this method in the internationalization of component captions, etc. is generally not feasible. For such use case, we recommend using an otherwise acquired reference to the application locale.
|
Sets the locale of this component: # IComponent for which the locale is meaningful date = InlineDateField("Datum") # German language specified with ISO 639-1 language # code and ISO 3166-1 alpha-2 country code. date.setLocale(Locale("de", "DE")) date.setResolution(DateField.RESOLUTION_DAY) layout.addComponent(date)
|
Gets the icon resource of the component. See setIcon for a detailed description of the icon.
|
Sets the component's icon. This method will trigger a RepaintRequestEvent.
|
Tests whether the component is enabled or not. A user can not interact with disabled components. Disabled components are rendered in a style that indicates the status, usually in gray color. Children of a disabled component are also disabled. Components are enabled by default. As a security feature, all variable change events for disabled components are blocked on the server-side.
|
Enables or disables the component. The user can not interact disabled components, which are shown with a style that indicates the status, usually shaded in light gray color. Components are enabled by default. Children of a disabled component are automatically disabled; if a child component is explicitly set as disabled, changes in the disabled status of its parents do not change its status: enabled = new Button("Enabled") enabled.setEnabled(True) # the default layout.addComponent(enabled) disabled = Button("Disabled") disabled.setEnabled(False) layout.addComponent(disabled) This method will trigger a RepaintRequestEvent for the component and, if it is a
|
Tests if the variable owner is in immediate mode or not. Being in immediate mode means that all variable changes are required to be sent back from the terminal immediately when they occur. Note:
|
Sets the component's immediate mode to the specified status. This method will trigger a RepaintRequestEvent.
See Also:
|
Tests the visibility property of the component. Visible components are drawn in the user interface, while invisible ones are not. The effect is not merely a cosmetic CSS change, but the entire HTML element will be empty. Making a component invisible through this property can alter the positioning of other components. A component is visible only if all its parents are also visible. Notice that if a child component is explicitly set as invisible, changes in the visibility status of its parents do not change its status. This method does not check whether the component is attached (see attach). The component and all its parents may be
considered "visible", but not necessarily attached to
application. To test if component will actually be drawn, check both its
visibility and that getApplication does not return
|
Sets the visibility of the component. Visible components are drawn in the user interface, while invisible ones are not. The effect is not merely a cosmetic CSS change, but the entire HTML element will be empty: readonly = TextField("Read-Only") readonly.setValue("You can't see this!") readonly.setVisible(False) layout.addComponent(readonly) A component is visible only if all of its parents are also visible. If a component is explicitly set to be invisible, changes in the visibility of its parents will not change the visibility of the component.
|
Gets the component's description, used in tooltips and can be displayed directly in certain other components such as forms. The description can be used to briefly describe the state of the component to the user. The description string may contain certain XML tags: <table border=1> <tr> <td width=120><b>Tag</b></td> <td width=120><b>Description</b></td> <td width=120><b>Example</b></td> </tr> <tr> <td><b></td> <td>bold</td> <td><b>bold text</b></td> </tr> <tr> <td><i></td> <td>italic</td> <td><i>italic text</i></td> </tr> <tr> <td><u></td> <td>underlined</td> <td><u>underlined text</u></td> </tr> <tr> <td><br></td> <td>linebreak</td> <td>N/A</td> </tr> <tr> <td><ul><br> <li>item1<br> <li>item1<br> </ul></td> <td>item list</td> <td> <ul> <li>item1 <li>item2 </ul> </td> </tr> </table> These tags may be nested.
|
Sets the component's description. See getDescription for more information on what the description is. This method will trigger a RepaintRequestEvent. The description is displayed as HTML/XHTML in tooltips or directly in certain components so care should be taken to avoid creating the possibility for HTML injection and possibly XSS vulnerabilities.
|
Gets the parent component of the component. Components can be nested but a component can have only one parent. A
component that contains other components, that is, can be a parent,
should usually inherit the
|
Sets the parent component of the component. This method automatically calls attach if the parent becomes attached to the
application, regardless of whether it was attached previously.
Conversely, if the parent is This method is rarely called directly. The It is not possible to change the parent without first setting the
parent to
|
Gets the error message for this component.
|
Gets the component's error message.
|
Sets the component's error message. The message may contain certain XML tags.
|
Tests whether the component is in the read-only mode. The user can not change the value of a read-only component. As only IField components normally have a value that can be input or changed by the user, this is mostly relevant only to field components, though not restricted to them. Notice that the read-only mode only affects whether the user can change the value of the component; it is possible to, for example, scroll a read-only table. The read-only status affects only the user; the value can still be
changed programmatically, for example, with The method will return
|
Sets the read-only mode of the component to the specified mode. The user can not change the value of a read-only component. As only IField components normally have a value that can be input or changed by the user, this is mostly relevant only to field components, though not restricted to them. Notice that the read-only mode only affects whether the user can change the value of the component; it is possible to, for example, scroll a read-only table. The read-only status affects only the user; the value can still be
changed programmatically, for example, with This method will trigger a RepaintRequestEvent.
|
Gets the parent window of the component. If the component is not attached to a window through a component
containment hierarchy, The window can be either an application-level window or a sub-window. If the component is itself a window, it returns a reference to itself, not to its containing window (of a sub-window).
|
Notifies the component that it is connected to an application. The caller of this method is setParent if the parent is itself already attached to the application. If not, the parent will call the attach for all its children when it is attached to the application. This method is always called before the component is painted for the first time. Reimplementing the class AttachExample(CustomComponent): def __init__(self): # ERROR: We can't access the application object yet. r = ClassResource("smiley.jpg", getApplication()) image = Embedded("Image:", r) setCompositionRoot(image) Adding a component to an application triggers calling the attach method for the component. Correspondingly,
removing a component from a container triggers calling the detach method. If the parent of an added component is
already connected to the application, the class AttachExample(CustomComponent): def __init__(self): pass def attach(self): super(AttachExample, self).attach() # must call # Now we know who ultimately owns us. r = ClassResource("smiley.jpg", self.getApplication()) image = Embedded("Image", r) self.setCompositionRoot(image) The attachment logic is implemented in AbstractComponent.
|
Notifies the component that it is detached from the application. The getApplication and getWindow methods might return The caller of this method is setParent if the parent is in the application. When the parent is detached from the application it is its response to call detach for all the children and to detach itself from the terminal.
|
Gets the application object to which the component is attached. The method will return This method is not meant to be overridden.
See Also: attach |
Request sending of repaint events on any further visible changes. Normally the paintable only send up to one repaint request for listeners after paint as the paintable as the paintable assumes that the listeners already know about the repaint need. This method resets the assumtion. Paint implicitly does the assumtion reset functionality implemented by this method. This method is normally used only by the terminals to note paintables about implicit repaints (painting the component without actually invoking paint method).
|
Paints the Paintable into a UIDL stream. This method creates the UIDL sequence describing it and outputs it to the given UIDL stream. It is called when the contents of the component should be painted in response to the component first being shown or having been altered so that its visual representation is changed. Do not override this to paint your component. Override paintContent instead.
|
Build CSS compatible string representation of height.
|
Build CSS compatible string representation of width.
|
Paints any needed component-specific things to the given UIDL stream. The more general paint method handles all general attributes common to all components, and it calls this method to paint any component-specific attributes to the UIDL stream.
|
Requests that the paintable should be repainted as soon as possible.
|
The child components of the component must call this method when they need repainting. The call must be made even in the case in which the children sent the repaint request themselves. A repaint request is ignored if the component is invisible. This method is called automatically by AbstractComponent, which also provides a default implementation of it. As this is a somewhat internal feature, it is rarely necessary to reimplement this or call it explicitly.
|
Registers a new (generic) component event listener for the component: class Listening(CustomComponent, IListener): # Stored for determining the source of an event ok = None status = None # For displaying info about the event def __init__(self): layout = VerticalLayout() # Some miscellaneous component name = TextField("Say it all here") name.addListener(self) name.setImmediate(true) layout.addComponent(name) # Handle button clicks as generic events instead # of Button.ClickEvent events ok = new Button("OK") ok.addListener(self) layout.addComponent(ok) # For displaying information about an event status = new Label("") layout.addComponent(status) setCompositionRoot(layout) def componentEvent(event): # Act according to the source of the event if (event.getSource() == ok): getWindow().showNotification("Click!") status.setValue("Event from " + event.getSource().__class__.__name__ + ": " + event.__class__.__name__) listening = Listening() layout.addComponent(listening)
|
|
Registers a new listener with the specified activation method to listen events generated by this component. If the activation method does not have any arguments the event object will not be passed to it when it's called. This method additionally informs the event-api to route events with the given eventIdentifier to the components handleEvent function call. For more information on the inheritable event mechanism see the muntjac.event package documentation.
|
Removes a previously registered component event listener from this component.
|
|
Removes all registered listeners matching the given parameters. Since
this method receives the event type and the listener object as
parameters, it will unregister all This method additionally informs the event-api to stop routing events with the given eventIdentifier to the components handleEvent function call. For more information on the inheritable event mechanism see the muntjac.event package documentation.
|
Called when one or more variables handled by the implementing class are changed.
|
Checks if the given Event type is listened for this component.
|
Returns all listeners that are registered for the given event type or one of its subclasses.
|
Sends the event to all listeners.
|
Emits the component event. It is transmitted to all registered listeners interested in such events. |
Emits the component error event. It is transmitted to all registered listeners interested in such events. |
Sets the data object, that can be used for any application specific data. The component does not use or modify this data.
|
Gets the application specific data. See setData.
|
Gets the height of the object. Negative number implies unspecified size (terminal is free to set the size).
|
Gets the height property units.
|
Gets the width of the object. Negative number implies unspecified size (terminal is free to set the size).
|
Gets the width property units.
|
Sets the height of the object. Negative number implies unspecified size (terminal is free to set the size).
|
Sets the height property units.
|
Sets the size to 100% x 100%.
|
Clears any size settings.
|
Sets the width of the object. Negative number implies unspecified size (terminal is free to set the size).
|
Sets the width property units.
|
Returns array with size in index 0 unit in index 1. Null or empty string will produce {-1,UNITS_PIXELS}. |
Gets the error handler for the component. The error handler is dispatched whenever there is an error processing the data coming from the client. |
Sets the error handler for the component. The error handler is dispatched whenever there is an error processing the data coming from the client. If the error handler is not set, the application error handler is used to handle the exception.
|
Handle the component error event.
|
Home | Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Sat Jul 6 13:40:54 2013 | http://epydoc.sourceforge.net |