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 --+ | abstract_component.AbstractComponent --+ | object --+ | | | data.buffered.IBuffered --+ | | | object --+ | | | | | data.validatable.IValidatable --+ | | | data.buffered.IBufferedValidatable --+ | | | object --+ | | | | | data.property.IValueChangeNotifier --+ | | | object --+ | | | | | data.property.IValueChangeListener --+ | | | object --+ | | | | | data.property.IViewer --+ | | | | | data.property.IEditor --+ | | | object --+ | | | | | util.IEventListener --+ | | | | | terminal.paintable.IPaintable --+ | | | | | object --+ | | | | | | | terminal.variable_owner.IVariableOwner --+ | | | | | object --+ | | | | | | | terminal.sizeable.ISizeable --+ | | | | | component.IComponent --+ | | | | | component.IFocusable --+ | | | field.IField --+ | object --+ | | | event.action.IShortcutNotifier --+ | object --+ | | | data.property.IReadOnlyStatusChangeNotifier --+ | object --+ | | | data.property.IReadOnlyStatusChangeListener --+ | AbstractField
Abstract field component for implementing buffered property editors.
The field may hold an internal value, or it may be connected to any data
source that implements the IPropertyinterface. AbstractField
implements that interface itself, too, so accessing the IProperty value
represented by it is straightforward.
AbstractField also provides the IBuffered interface for buffering the data source value. By default the IField is in write through-mode and setWriteThroughshould be called to enable buffering.
The class also supports validators to make sure the value contained in the field is valid.
Version: 1.1.2
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
Inherited from Inherited from |
|
|||
|
|
|||
Inherited from Inherited from |
|
|||
Inherited from |
|
Constructs a new IComponent.
|
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.
|
Returns true if the error indicator be hidden when painting the component even when there are errors. This is a mostly internal method, but can be overridden in subclasses e.g. if the error indicator should also be shown for empty fields in some cases.
|
The abstract field is read only also if the data source is in read only mode.
|
Changes the readonly state and throw read-only status change events.
See Also: IComponent.setReadOnly |
Tests if the invalid data is committed to datasource. See Also:
|
Sets if the invalid data should be committed to datasource. See Also:
|
Updates all changes since the previous commit to the data source. The
value stored in the object will always be updated into the data source
when
|
Discards all changes since last commit. The object updates its value from the data source.
|
Tests if the value stored in the object has been modified since it was last updated from the data source.
|
Tests if the object is in write-through mode. If the object is in
write-through mode, all modifications to it will result in
|
Sets the object's write-through mode to the specified status. When
switching the write-through mode on, the
|
Tests if the object is in read-through mode. If the object is in read-through mode, retrieving its value will result in the value being first updated from the data source to the object. The only exception to this rule is that when the object is not in write-through mode and it's buffer contains a modified value, the value retrieved from the object will be the locally modified value in the buffer which may differ from the value in the data source.
|
Sets the object's read-through mode to the specified status. When switching read-through mode on, the object's value is updated from the data source.
|
Returns the value of the IProperty in human readable textual format.
|
Gets the current value of the field. This is the visible, modified and possible invalid value the user have entered to the field. In the read-through mode, the abstract buffer is also updated and validation is performed. Note that the object returned is compatible with getType(). For example, if the type is String, this returns Strings even when the underlying datasource is of some other type. In order to access the datasources native type, use getPropertyDatasource().getValue() instead. Note that when you extend AbstractField, you must reimplement this method if datasource.getValue() is not assignable to class returned by getType() AND getType() is not String. In case of Strings, getValue() calls datasource.toString() instead of datasource.getValue().
|
Sets the value of the field.
|
Gets the current data source of the field, if any.
|
Sets the specified IProperty as the data source for the field. All uncommitted changes are replaced with a value from the new data source. If the datasource has any validators, the same validators are added to the field. Because the default behavior of the field is to allow invalid values, but not to allow committing them, this only adds visual error messages to fields and do not allow committing them as long as the value is invalid. After the value is valid, the error message is not shown and the commit can be done normally. Note: before 6.5 we actually called discard() method in the beginning of the method. This was removed to simplify implementation, avoid excess calls to backing property and to avoid odd value change events that were previously fired (developer expects 0-1 value change events if this method is called). Some complex field implementations might now need to override this method to do housekeeping similar to discard().
|
Adds a new validator for the field's value. All validators added to a field are checked each time the its value changes.
|
Gets the validators of the field.
|
Removes the validator from the field.
|
Tests the current value against registered validators if the field is not empty. If the field is empty it is considered valid if it is not required and invalid otherwise. Validators are never checked for empty fields.
|
Checks the validity of the IValidatable by validating the field with all attached validators except when the field is empty. An empty field is invalid if it is required and valid otherwise. The "required" validation is a built-in validation feature. If the field is required, but empty, validation will throw an EmptyValueException with the error message set with setRequiredError().
See Also: IValidatable.validate |
Fields allow invalid values by default. In most cases this is wanted, because the field otherwise visually forget the user input immediately.
See Also: IValidatable.isInvalidAllowed |
Fields allow invalid values by default. In most cases this is wanted, because the field otherwise visually forget the user input immediately. In common setting where the user wants to assure the correctness of the datasource, but allow temporarily invalid contents in the field, the user should add the validators to datasource, that should not allow invalid values. The validators are automatically copied to the field when the datasource is set.
See Also: IValidatable.setInvalidAllowed |
Error messages shown by the fields are composites of the error message thrown by the superclasses (that is the component error message), validation errors and buffered source errors.
See Also: AbstractComponent.getErrorMessage |
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)
|
|
Removes a previously registered component event listener from this component.
|
|
Emits the value change event. The value contained in the field is validated before the event is created. |
React to read only status changes of the property by requesting a repaint.
See Also: IReadOnlyStatusChangeListener |
Emits the read-only status change event. The value contained in the field is validated before the event is created. |
This method listens to data source value changes and passes the changes forwards. Changes are not forwarded to the listeners of the field during internal operations of the field to avoid duplicate notifications.
|
Called when one or more variables handled by the implementing class are changed.
|
Sets the focus for this component if the component is IFocusable.
|
Creates abstract field by the type of the property. This returns most suitable field type for editing property of given type.
Deprecated:
use e.g. |
Gets the tabulator index of the
|
Sets the tabulator index of the loginBox = Form() loginBox.setCaption("Login") layout.addComponent(loginBox) # Create the first field which will be focused username = TextField("User name") loginBox.addField("username", username) # Set focus to the user name username.focus() password = TextField("Password") loginBox.addField("password", password) login = Button("Login") loginBox.getFooter().addComponent(login) # An additional component which natural focus order would # be after the button. remember = CheckBox("Remember me") loginBox.getFooter().addComponent(remember) username.setTabIndex(1) password.setTabIndex(2) remember.setTabIndex(3) # Different than natural place login.setTabIndex(4) After all focusable user interface components are done, the browser can begin again from the component with the smallest tab index, or it can take the focus out of the page, for example, to the location bar. If the tab index is not set (is set to zero), the default tab order is used. The order is somewhat browser-dependent, but generally follows the HTML structure of the page. A negative value means that the component is completely removed from the tabulation order and can not be reached by pressing the Tab key at all.
|
Sets the internal field value. This is purely used by AbstractField to change the internal IField value. It does not trigger valuechange events. It can be overridden by the inheriting classes to update all dependent variables.
|
Notifies the component that it is connected to an application.
See Also: IComponent.attach |
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.
|
Is this field required. Required fields must filled by the user. If the field is required, it is visually indicated in the user interface. Furthermore, setting field to be required implicitly adds "non-empty" validator and thus isValid() == false or any isEmpty() fields. In those cases validation errors are not painted as it is obvious that the user must fill in the required fields. On the other hand, for the non-required fields isValid() == true if the field isEmpty() regardless of any attached validators.
|
Sets the field required. Required fields must filled by the user. If the field is required, it is visually indicated in the user interface. Furthermore, setting field to be required implicitly adds "non-empty" validator and thus isValid() == false or any isEmpty() fields. In those cases validation errors are not painted as it is obvious that the user must fill in the required fields. On the other hand, for the non-required fields isValid() == true if the field isEmpty() regardless of any attached validators.
|
Set the error that is show if this field is required, but empty. When setting requiredMessage to be "" or null, no error pop-up or exclamation mark is shown for a empty required field. This faults to "". Even in those cases isValid() returns false for empty required fields.
|
Gets the error message that is to be displayed if a required field is empty.
|
Is the field empty? In general, "empty" state is same as null. As an exception, TextField also treats empty string as "empty". |
Is automatic, visible validation enabled? If automatic validation is enabled, any validators connected to this component are evaluated while painting the component and potential error messages are sent to client. If the automatic validation is turned off, isValid() and validate() methods still work, but one must show the validation in their own code.
|
Enable or disable automatic, visible validation. If automatic validation is enabled, any validators connected to this component are evaluated while painting the component and potential error messages are sent to client. If the automatic validation is turned off, isValid() and validate() methods still work, but one must show the validation in their own code.
|
Gets the ActionManager used to manage the ShortcutListeners added to this IField.
|
|
|
Home | Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Sat Apr 20 16:01:22 2013 | http://epydoc.sourceforge.net |