{@link IPreferenceStore}
to an object.
@author alruiz@google.com (Alex Ruiz)
IMPT: This construct currently does not support adding or removing relational type properties! In other words, the assumption in this class' logic is always a non-null
ref on bound properties.
@author jpk
buttonLeft
binding in the example above would be read, "my left edge is 12 pixels to the right of the left edge of frame
".Binding rightOfLabel = new Binding(Edge.LEFT, 8, Direction.RIGHT, Edge.RIGHT, label); RelativeConstraints fieldConstraints = new RelativeConstraints(); fieldConstraints.addBinding(rightOfLabel); frame.add(field, fieldConstraints);Bindings can also be used to make components dynamically resize themselves. To make a component resize horizontally, simply make a Binding for the component's left edge and another for the component's right edge. For example:
JFrame frame = new JFrame(); frame.setLayout(new {@link RelativeLayout}()); JTextArea area = new JTextArea("Hello, world!"); // Create three Bindings, one for the area's left edge, another for its top edge, and another for its right edge: Binding areaLeft = new Binding( {@link Edge}.LEFT, 12, {@link Direction}.RIGHT, {@link Edge}.LEFT, frame); Binding areaTop = new Binding( {@link Edge}.TOP, 12, {@link Direction}.BELOW, {@link Edge}.TOP, frame); Binding areaRight = new Binding( {@link Edge}.RIGHT, 12, {@link Direction}.LEFT, {@link Edge}.RIGHT, frame); // Now, create a RelativeConstraints object and add the bindings to it: {@link RelativeConstraints} areaConstraints = new {@link RelativeConstraints}(); areaConstraints.addBindings(areaLeft, areaTop, areaRight); // Lastly, add the area to the frame with the constraints: frame.add(area, areaConstraints); frame.setVisible(true);The
area
component above will now always keep a 12 pixel margin on both the left and right, regardless of how big the window is.Binding instances are not supposed to be used in a multithreaded context. @author James Strachan @version $Revision: 21659 $
A context consists of name-to-object bindings. The Binding class represents such a binding. It consists of a name and an object. The Context.listBindings()
method returns an enumeration of Binding.
Use subclassing for naming systems that generate contents of a binding dynamically.
A Binding instance is not synchronized against concurrent access by multiple threads. Threads that need to access a Binding concurrently should synchronize amongst themselves and provide the necessary locking. @author Rosanna Lee @author Scott Seligman @since 1.3
Binding
interface is the base interface for JAX-WS protocol bindings.
@since JAX-WS 2.0
Note that the address
property is of {@link java.net.SocketAddress}type. Use {@link InetSocketAddressEditor} or {@link VmPipeAddressEditor} inyour Spring configuration file to simply the creation of {@link java.net.SocketAddress} instances using Spring.
This class also allows for an optional service configuration using {@link #setServiceConfig(IoServiceConfig)} to be specified. If the bindingspecifies an {@link IoServiceConfig} {@link IoAcceptorFactoryBean} willuse {@link IoAcceptor#bind(SocketAddress,IoHandler,IoServiceConfig)} insteadof {@link IoAcceptor#bind(SocketAddress,IoHandler)} when binding. The{@link IoServiceConfig} object lets you specify transport specificconfiuration options and define port specific filters. This makes it possible to specify different filters depending on the port the client is connecting on (e.g. using an {@link org.apache.mina.filter.SSLFilter} when connectingon port 443 but not on port 80).
@author The Apache Directory Project (mina-dev@directory.apache.org) @version $Rev: 555855 $, $Date: 2007-07-13 12:19:00 +0900 (Fri, 13 Jul 2007) $A binding ultimately must provide access to the underlying annotations. In most cases, there are no annotations, but bindings that ultimate invoke methods or read and update fields must provide access to those annotations.
The {@link Binding} abstraction is key to the inner workings of the {@link org.codehaus.preon.codec.ObjectCodecFactory}. The reason why it is a public interface instead of an internal one is to allow you to plugin in other kinds of Binding. The typical example here is the {@link ConditionalBindingFactory}. This {@link BindingFactory} creates {@link Binding Binding} instances that respect conditions set as annotations on {@link Fields}.
@author Wilfred SpringerA binding is a link between user input and the triggering of a particular command. The most common example of a binding is a keyboard shortcut, but there are also mouse and gesture bindings.
Bindings are linked to particular conditions within the application. Some of these conditions change infrequently (e.g., locale, scheme), while some will tend to change quite frequently (e.g., context). This allows the bindings to be tailored to particular situations. For example, a set of bindings may be appropriate only inside a text editor. Or, perhaps, a set of bindings might be appropriate only for a given locale, such as bindings that coexist with the Input Method Editor (IME) on Chinese locales.
It is also possible to remove a particular binding. This is typically done as part of user configuration (e.g., user changing keyboard shortcuts). However, it can also be helpful when trying to change a binding on a particular locale or platform. An "unbinding" is really just a binding with no command identifier. For it to unbind a particular binding, it must match that binding in its context identifier and scheme identifier. Subclasses (e.g., KeyBinding
) may require other properties to match (e.g., keySequence
). If these properties match, then this is an unbinding. Note: the locale and platform can be different.
For example, imagine you have a key binding that looks like this:
KeyBinding(command, scheme, context, "Ctrl+Shift+F")
On GTK+, the "Ctrl+Shift+F" interferes with some native behaviour. To change the binding, we first unbind the "Ctrl+Shift+F" key sequence by assigning it a null command on the gtk platform. We then create a new binding that maps the command to the "Esc Ctrl+F" key sequence.
KeyBinding("Ctrl+Shift+F",null,scheme,context,null,gtk,null,SYSTEM) KeyBinding("Esc Ctrl+F",parameterizedCommand,scheme,context,null,gtk,SYSTEM)
Bindings are intended to be immutable objects.
@since 3.1The following features are supported:
The upshot is that whenever an element or attribute is encountered in an instance document that is of type xsd:string, this binding will be used to turn the string into an object representation.
And on the other side of coin, when an instanceof String is encountered when serializing an object model, the binding will be used to encode the string as xml.
<xs:simpleType name="decimal" id="decimal"> <xs:annotation> <xs:appinfo> <hfp:hasFacet name="totalDigits"/> <hfp:hasFacet name="fractionDigits"/> <hfp:hasFacet name="pattern"/> <hfp:hasFacet name="whiteSpace"/> <hfp:hasFacet name="enumeration"/> <hfp:hasFacet name="maxInclusive"/> <hfp:hasFacet name="maxExclusive"/> <hfp:hasFacet name="minInclusive"/> <hfp:hasFacet name="minExclusive"/> <hfp:hasProperty name="ordered" value="total"/> <hfp:hasProperty name="bounded" value="false"/> <hfp:hasProperty name="cardinality" value="countably infinite"/> <hfp:hasProperty name="numeric" value="true"/> </xs:appinfo> <xs:documentation source="http://www.w3.org/TR/xmlschema-2/#decimal"/> </xs:annotation> <xs:restriction base="xs:anySimpleType"> <xs:whiteSpace fixed="true" value="collapse" id="decimal.whiteSpace"/> </xs:restriction> </xs:simpleType> <xs:simpleType name="integer" id="integer"> <xs:annotation> <xs:documentation source="http://www.w3.org/TR/xmlschema-2/#integer"/> </xs:annotation> <xs:restriction base="xs:decimal"> <xs:fractionDigits fixed="true" value="0" id="integer.fractionDigits"/> <xs:pattern value="[\-+]?[0-9]+"/> </xs:restriction> </xs:simpleType>
The above types define an inheiretance hierarcy. To model this relationship among the corresponding binding objects, an execution mode must be declared by each binding. The execution mode specifies wether a binding should be executed before, after, or totally override the binding for a direct parent.
class DecimalBinding implements Binding { ... int getExecutionMode() { return OVERRIDE; } ... } class IntegerBinding implemnts Binding { ... int getExecutionMode() { return AFTER; } ... }
In the above example, the decimal bidning declares its execution mode to be override. This means that no bindings for any of the base types of decimal will be executed. The integer binding declares its execution mode as AFTER. This means that the integer binding will be executed after the decimal strategy.
<xsd:complexType name="collection"> <xsd:sequence> <xsd:element name="item" type="xsd:any" minOccurs="0" maxOccurs="unbounded"/> </xsd:sequence> </xsd:complexType>
The associated binding must turn instances of this type into objects of type {@link java.util.Collection}. However, the question remains what concrete subclass of Collection to use. And perhaps we need this type to vary in different situations. The solution is to take the decision out of the hands of this binding, and into the hands of someone else. To acheive this the collection binding adds a dependency of type Collection. class CollectionStrategy implements ComplexBinding { Collection collection; CollectionStrategy(Collection collection) { this.collection = collection; } QName getTarget() { return new QName("http://org/geotools/","collection"); } int getExecutionMode() { return OVERRIDE; } Object parse(Element instance, Node[] children, Node[] atts, Object value) throws Exception { for (int i = 0; i < children.length; i++) { collection.add(children[i].getValue()); } return collection; } }
In such occasions, binding implementations must implement the {@link Comparable} interface,in case of doubt the bindings associated to a specific class will be sorted and the first element in the resulting {@link List} will be used. @author Justin Deoliveira,Refractions Research Inc.,jdeolive@refractions.net @source $URL$
Some {@code Bindings} are managed, often by another {@code Binding}. A managed {@code Binding} does not allow certain methods to be called by theuser. These methods are identified in their documentation. Subclasses should call {@code setManaged(true)} to make themselves managed. {@code Binding}provides protected versions of the managed methods with the suffix {@code "Unmanaged"} for subclasses to use internally without checking whetheror not they are managed.
Any {@code PropertyResolutionExceptions} thrown by {@code Property} objectsused by this binding are allowed to flow through to the caller of the {@code Binding} methods. @param < SS> the type of source object @param < SV> the type of value that the source property represents @param < TS> the type of target object @param < TV> the type of value that the target property represents @author Shannon Hickey @author Georgios J. Geprgopoulos
Property
and a UI control. The binding is responsible for syncing the property (the model) and the UI (the view): Changes made to the property are automatically reflected in the UI, and vice versa.
@author Torgil Zethson
@since 3.6.1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|