![]() |
It must be specified as being a Bean in the JAR's manifest. The manifest entry for a Bean might look like this:Name: de/muntjak/datebean/DateBean.class
|
![]() |
It must be prepared to be instantiated with java.beans.Beans.instantiate(ClassLoader, String) . This means, the Bean must at least have a public default (no-arguments) constructor.
|
Tutorial/Examples/customcomponents.jar
. The
dialog opens where you choose which Beans to import.
NoClassDefFoundError
s when trying to import Beans, read the next section about specifying libraries.
Note: Imported Beans which were not added to a layout are not saved and will not be present once you quit and restart RADi. |
activation.jar
or infobus.jar
). Libraries may be either JAR
or ZIP
files.
BeanContextServices
implementation per layout. Beans implementing either BeanContextChild
or BeanContextProxy
are automatically added to the bean context. Service providing Beans are responsible for registering their service(s) with the context.BeanContext
is valid only while the test frame is displayed and will be cleared when the test frame is closed.
BeanContext
aware Beans can get design time information from the enclosing bean context by calling getBeanContext().isDesignTime()
, other Beans may call java.beans.Beans.isDesignTime()
. While no test frame is displayed, both methods will return true
, else both methods will return false
.
Note: Especially Beans performing automated tasks should make sure that such tasks are not performed at design time, if possible. (As stated above, RADi might create any number of Bean instances existing simultaneously and several Beans performing some expensive task might noticeably decrease performance.) |
java.awt.Component
and encapsulate some application logic. Though non-component Beans have a visual representation inside RADi, you cannot add them to the GUI and they are not visible in a running application.
java.awt.Component
but, for some reason, you want it to be treated as non-component Bean, you can achieve this by implementing java.beans.Visibility
and let the implementation return true
for avoidingGui()
.
list.addListSelectionListener(new ListSelectionListener() {
|
listSelection
item from the
combo box. A ListSelectionListener
has only one method, so the selected listener method is okay.
ListSelectionEvent
's properties are displayed. Click inside the 'source' row.
Object
, RADi knows that the event source is the list, so the
displays all of an AList
's (non-deprecated) public methods which have a non-void return type and take no arguments. Scroll to the 'getSelectedValue()' row and select it.
getSelectedValue()
has a return type of Object
, so the
now displays public Object
methods. Search for the 'toString()' row and click choose.
String
. Because we want to display the selected item as the text field's text, we choose setText(String)
. To test the new event handler, display a test frame and select items from the list.
![]() | If the target method takes no arguments, you should choose 'this' (the event) from the first table. |
![]() | You can specify a constant to provide arguments to the target method. |
![]() | The dialog allows to remove entries and to change target methods. |
![]() |
Copy and paste issues: If you copy and paste an event source, the event handler will not be copied. If you copy and paste an event target, the copied component will still be an event target (and the event handler will contain one more entry). |
Note: You should know that, when propagating the same kind of event several times (for one event source), the order of propagation is the reverse order of handler definitions. |
![]() |
Propagate some property from a source Bean to a target Bean. The property is set on the target Bean immediately as the property handler is defined and, if the property is bound, on future changes of the property value (if a bound property changes, the Bean will fire a PropertyChangeEvent ).
|
![]() | Propagate the return value of some arbitrary method of a source Bean to a target Bean. |
![]() |
JTextField.setEditable(JLabel.getBorder().isBorderOpaque())
null
(just to demonstrate how easy it is, to force exceptions).
![]() |
FocusListener
:JTabbedPane.setSelectedComponent(FocusEvent.getOppositeComponent())
.java.lang.IllegalArgumentException: component not found in tabbed pane
(wrapped in an InvocationTargetException
because RADi executed a reflective call).
Note: As is true with RADi, the RADi runtime library will catch all exceptions thrown while executing handlers. If RadiLoader was set to silent mode, a user will not notice anything about exceptions thrown, else a
will pop up (allowing you to either continue or exit) or the exception will be reported via
.
|
BeanInfo
specifies any custom property editors (with PropertyDescriptor.setPropertyEditorClass(Class)
), RADi instantiates the editor class and attaches the editor to the specified property. The custom editor will be displayed in a modal
, together with a "Close" button.
Note: Also custom editors registered with the PropertyEditorManager will be recognized. (If, for a property type of XYZ , there exists a class named XYZEditor , Java will automatically register the XYZEditor class as the editor for all properties of type XYZ ).
|
BeanInfo
's BeanDescriptor
specifies a Customizer
, the first row of the
shows the customizer class and a "Customize..." label. Clicking the label will open the
, displaying the customizer component and a "Close" button.
XMLEncoder
(which also stores only public properties). If this fails (for example because the property type provides no default constructor) and the property class implements Serializable
, it will be stored using object serialization.
BeanInfo
class and either
![]() |
let the BeanDescriptor return true for isHidden() , or
|
![]() |
set the BeanDescriptor 's "hidden-state" attribut to a value of Boolean.TRUE ,
|
![]() |
is a togglebutton combining an icon with a (multi-line) label. In contrast to the Swing JToggleButton , the selected state is visualized by selecting the button label and, if you define a multi-line label, the button will have a reliable preferred width (with LabelButton you separate lines with the 'plus' sign, e.g. "Line1+Line2" ).
|
![]() |
is an opaque label with a gradient background and a line border. The gradient is defined by properties startColor , endColor and bias (between 1 and 100), additinally you can specify the borderColor and margin . Use a GradientLabel to divide and name sections of a layout.
|
![]() |
is a label whose text is always underlined and changes color on rollover. Its default cursor is the hand cursor. If you want an action to be performed as the user clicks the label, attach an ActionListener .
|
RADi/Tutorial/cc_sources
.