|
Oracle ADF Model and Business Components API Reference 10.1.2 B14022-01 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.util.AbstractMap oracle.jbo.common.JboAbstractMap oracle.adf.model.binding.DCControlBinding oracle.jbo.uicli.binding.JUControlBinding oracle.jbo.uicli.binding.JUCtrlValueBinding oracle.jbo.uicli.binding.JUCtrlAttrsBinding oracle.jbo.uicli.jui.JUTextFieldBinding
JUTextFieldBinding is a lightweight Document model that implements
binding a javax.swing.JTextComponent
to an attribute in
a row of a BC4J ViewObject.
Row
,
JTextField
,
javax.swing.JTextComponent
Nested Class Summary |
Nested classes inherited from class java.util.Map |
java.util.Map.Entry |
Field Summary |
Fields inherited from class oracle.jbo.uicli.binding.JUCtrlValueBinding |
ATTR_ATTRIBUTE, ATTR_ATTRIBUTE_DEF, ATTR_ATTRIBUTE_DEFS, ATTR_ATTRIBUTE_VALUE, ATTR_ATTRIBUTE_VALUES, ATTR_ATTRIBUTES, ATTR_DISPLAY_HINT, ATTR_INPUT_VALUE, ATTR_LABEL, ATTR_LABELS, ATTR_LABELSET, ATTR_MANDATORY, ATTR_PATH, ATTR_TOOLTIP, ATTR_UPDATEABLE, mHasInputVal, mInputVal, SEP_LIST_DISPLAY |
Fields inherited from class oracle.adf.model.binding.DCControlBinding |
ATTR_CURRENTROW, ATTR_DEF, ATTR_ERROR, ATTR_ERRORS, ATTR_FULLNAME, ATTR_ITER, ATTR_NAME, mInternalGet_KeyResolved, ROW_KEY_STR |
Fields inherited from interface javax.swing.text.Document |
StreamDescriptionProperty, TitleProperty |
Constructor Summary | |
JUTextFieldBinding(javax.swing.text.JTextComponent control,
JUIteratorBinding iterBinding,
java.lang.String attrName)
Creates an instance of this binding object that binds a swing JTextComponent with an attribute for rows in a given Iterator binding. |
Method Summary | |
void |
actionPerformed(java.awt.event.ActionEvent e)
Handles the actionPerformed event generated by the associated TextControl. |
void |
addControlToPanel(java.lang.Object panel,
java.lang.Object layoutObject,
java.lang.Object layoutCons)
*** For internal framework use only *** |
void |
addDocumentListener(javax.swing.event.DocumentListener listener)
Delegates to the Swing Document object of the associated text component. |
void |
addUndoableEditListener(javax.swing.event.UndoableEditListener listener)
Delegates to the Swing Document object of the associated text component. |
static javax.swing.text.Document |
createAttributeBinding(JUFormBinding formBinding,
javax.swing.text.JTextComponent control,
java.lang.String voInstanceName,
java.lang.String voIterName,
java.lang.String voIterBindingName,
java.lang.String attrName)
This method is used by the JDeveloper designtime wizards for binding a text component with an attribute of rows of a ViewObject/RowIterator. |
javax.swing.text.Position |
createPosition(int offs)
Delegates to the swing Document object of the associated text component. |
java.lang.Object |
getControlModel(java.lang.Object control)
Gets the associated View's model object. |
javax.swing.text.Element |
getDefaultRootElement()
Delegates to the Swing Document object of the associated text component. |
javax.swing.text.Position |
getEndPosition()
Delegates to the Swing Document object of the associated text component. |
static javax.swing.text.Document |
getInstance(JUFormBinding formBinding,
javax.swing.text.JTextComponent control,
java.lang.String voInstanceName,
java.lang.String voIterName,
java.lang.String voIterBindingName,
java.lang.String attrName)
Deprecated. since JDeveloper 9.0.2 |
int |
getLength()
Delegates to the Swing Document object of the associated text component. |
protected javax.swing.text.Document |
getModelImpl(javax.swing.text.JTextComponent control)
Returns the Document object that provides data for the given control. |
java.lang.Object |
getProperty(java.lang.Object key)
Delegates to the Swing Document object of the associated text component. |
javax.swing.text.Element[] |
getRootElements()
Delegates to the Swing Document object of the associated text component. |
javax.swing.text.Position |
getStartPosition()
Method delegates to the swing Document object of the associated text component. |
java.lang.String |
getText(int offset,
int length)
Method delegates to the swing Document object of the associated text component. |
void |
getText(int offset,
int length,
javax.swing.text.Segment txt)
Method delegates to the swing Document object of the associated text component. |
java.lang.Object |
getValueAt(int attrIndex)
Fetches the text contained in the associated control. |
void |
insertString(int offset,
java.lang.String str,
javax.swing.text.AttributeSet a)
Method delegates to the swing Document object of the associated text component. |
protected boolean |
isControlQueriable()
Returns true, so that JTextComponents can participate in a query in the Find Mode of the containing panel. |
void |
putProperty(java.lang.Object key,
java.lang.Object value)
Method delegates to the swing Document object of the associated text component. |
void |
remove(int offs,
int len)
Method delegates to the swing Document object of the associated text component. |
void |
removeDocumentListener(javax.swing.event.DocumentListener listener)
Method delegates to the swing Document object of the associated text component. |
void |
removeUndoableEditListener(javax.swing.event.UndoableEditListener listener)
Method delegates to the swing Document object of the associated text component. |
void |
render(java.lang.Runnable r)
Method delegates to the swing Document object of the associated text component. |
void |
setControl(java.lang.Object ctrl)
Bind this binding to a control. |
void |
setDataValueAt(java.lang.Object value,
int attrIndex)
Applications should call this method to update the value of an attribute using this binding such that both the associated text control and the associated row attribute gets updated. |
void |
setValueAt(java.lang.Object value,
int attrIndex)
Sets the given String representation of value (using value.toString()) into the associated text control. |
Methods inherited from class oracle.jbo.uicli.binding.JUCtrlAttrsBinding |
createAttributeBinding, refreshControl, setControlEnabled, toString, updateNavigated, updateRangeScrolled, updateValuesFromRow, updateValuesFromRows |
Methods inherited from class oracle.jbo.uicli.binding.JUControlBinding |
getFormBinding, getIteratorBinding, reportException, setFormBinding |
Methods inherited from class oracle.adf.model.binding.DCControlBinding |
addToDCExceptions, executeQuery, executeQueryIfNeeded, get, getAllRowsInRange, getApplicationModule, getBindingContainer, getControl, getCurrentRow, getDCIteratorBinding, getDef, getDefFullName, getDefName, getFullName, getLayoutObject, getName, getRowAtRangeIndex, getRowIterator, getTransaction, getViewObject, hashCode, internalSetName, needsEstimatedRowCount, removeFromDCExceptions, reportException, resetAttributeExceptionInRow, setBindingContainer, setName |
Methods inherited from class oracle.jbo.common.JboAbstractMap |
entrySet, equals |
Methods inherited from class java.util.AbstractMap |
clear, clone, containsKey, containsValue, isEmpty, keySet, putAll, remove, size, values |
Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface oracle.jbo.StructureDef |
getDefFullName, getDefName, getFullName, getName |
Constructor Detail |
public JUTextFieldBinding(javax.swing.text.JTextComponent control, JUIteratorBinding iterBinding, java.lang.String attrName)
If this control is a JTextField, then this binding object also registers itself as an ActionListener so that when return key is pressed on the JTextField or whenever an ActionEvent is raised by the JTextField, this binding object responds by saving the text in the control into the BC4J Row object. The same save operation occurs on focus out from the control, as it also registers a FocusAdapter that performs the set operation on the BC4J Row object for the given attribute when focus moves out of this control.
JDeveloper wizards use the createAttributeBinding() method that returns a Document object to
bind a ViewObject and attribute to a text control. An example usage for binding to
Deptno attribute of DeptView ViewObject instance is like:
jTextField2.setDocument(JUTextFieldBinding.createAttributeBinding(panelBinding, jTextField2, "DeptView", null, "DeptViewIter", "Deptno"));
More details on the arguments can be found in the javadoc for the above method.
control
- JTextComponent which should be bound to an attribute of a BC4J row.iterBinding
- JUIteratorBinding object that contains a reference to the RowIterator that contains Rows to display.attrName
- Name of the attribute in the BC4J Row object to display.Method Detail |
public void setControl(java.lang.Object ctrl)
setControl
in class DCControlBinding
protected javax.swing.text.Document getModelImpl(javax.swing.text.JTextComponent control)
protected boolean isControlQueriable()
An application could create a subclass of this binding object and return false from this method to prevent the associated control from participating in find mode. Additionally, a BC4J attribute itself can control whether that attribute can participate in Query or not. That property takes precedence over this method's return, if this method returns true. In other words, if this binding is bound to a CLOB attribute type and the attribute definition for that attribute indicates that it is not queriable, then the default behavior of JUPanelBinding in Find mode will be to disable this binding's control, even though this method returns true.
isControlQueriable
in class JUCtrlAttrsBinding
public void addControlToPanel(java.lang.Object panel, java.lang.Object layoutObject, java.lang.Object layoutCons)
addControlToPanel
in class JUCtrlAttrsBinding
public java.lang.Object getValueAt(int attrIndex)
getValueAt
in class JUCtrlAttrsBinding
attrIndex
- ignored for this control binding.javax.swing.JTextComponent#getText
public void setValueAt(java.lang.Object value, int attrIndex)
setValueAt
in class JUCtrlAttrsBinding
value
- The value to display in the associated text control.attrIndex
- Ignored for this control binding.javax.swing.JTextComponent#setText
public void setDataValueAt(java.lang.Object value, int attrIndex)
setDataValueAt
in class JUCtrlAttrsBinding
value
- Value to display in the associated text control and to set in the attribute.attrIndex
- Ignored for this control binding.public void actionPerformed(java.awt.event.ActionEvent e)
actionPerformed
in interface java.awt.event.ActionListener
public void addDocumentListener(javax.swing.event.DocumentListener listener)
Registers the given observer to begin receiving notifications when changes are made to the document.
addDocumentListener
in interface javax.swing.text.Document
listener
- The observer to register.Document.removeDocumentListener(javax.swing.event.DocumentListener)
,
Document
public void addUndoableEditListener(javax.swing.event.UndoableEditListener listener)
Registers the given observer to begin receiving notifications when undoable edits are made to the document.
addUndoableEditListener
in interface javax.swing.text.Document
listener
- The observer to register.UndoableEditEvent
,
Document
public javax.swing.text.Position createPosition(int offs) throws javax.swing.text.BadLocationException
This method allows an application to mark a place in a sequence of character content. This mark can then be used to tracks change as insertions and removals are made in the content. The policy is that insertions always occur prior to the current position (the most common case) unless the insertion location is zero, in which case the insertion is forced to a position that follows the original position.
createPosition
in interface javax.swing.text.Document
offs
- The offset from the start of the document >= 0.
javax.swing.text.BadLocationException
- If the given position does not
represent a valid location in the associated document.Document
public javax.swing.text.Element getDefaultRootElement()
Returns the root element that views should be based upon, unless some other mechanism for assigning views to element structures is provided.
getDefaultRootElement
in interface javax.swing.text.Document
Document
public javax.swing.text.Position getEndPosition()
Returns a position that represents the end of the document. The position returned can be counted on to track change and stay located at the end of the document.
getEndPosition
in interface javax.swing.text.Document
Document
public int getLength()
Returns number of characters of content currently in the document.
getLength
in interface javax.swing.text.Document
Document
public java.lang.Object getProperty(java.lang.Object key)
Gets properties associated with the document. Allows one to store things like the document title, author, etc.
getProperty
in interface javax.swing.text.Document
key
- A non-null property.
Document
public javax.swing.text.Element[] getRootElements()
Returns all of the root elements that are defined.
Typically there will be only one document structure, but the interface supports building an arbitrary number of structural projections over the text data. The document can have multiple root elements to support multiple document structures. Some examples might be:
getRootElements
in interface javax.swing.text.Document
Document
public javax.swing.text.Position getStartPosition()
Returns a position that represents the start of the document. The position returned can be counted on to track change and stay located at the beginning of the document.
getStartPosition
in interface javax.swing.text.Document
Document
public java.lang.String getText(int offset, int length) throws javax.swing.text.BadLocationException
Fetches the text contained within the given portion of the document.
getText
in interface javax.swing.text.Document
offset
- the offset into the document representing the desired
start of the text >= 0length
- the length of the desired string >= 0
javax.swing.text.BadLocationException
- some portion of the given range
was not a valid part of the document. The location in the exception
is the first bad position encountered.Document
public void getText(int offset, int length, javax.swing.text.Segment txt) throws javax.swing.text.BadLocationException
Fetches the text contained within the given portion of the document.
getText
in interface javax.swing.text.Document
offset
- the offset into the document representing the desired
start of the text >= 0length
- the length of the desired string >= 0txt
- the Segment object to return the text in
javax.swing.text.BadLocationException
- Some portion of the given range
was not a valid part of the document. The location in the exception
is the first bad position encountered.Document
public void insertString(int offset, java.lang.String str, javax.swing.text.AttributeSet a) throws javax.swing.text.BadLocationException
Inserts a string of content. This will cause a DocumentEvent of type DocumentEvent.EventType.INSERT to be sent to the registered DocumentListers, unless an exception is thrown. The DocumentEvent will be delivered by calling the insertUpdate method on the DocumentListener. The offset and length of the generated DocumentEvent will indicate what change was actually made to the Document.
If the Document structure changed as result of the insertion, the details of what Elements were inserted and removed in response to the change will also be contained in the generated DocumentEvent. It is up to the implementation of a Document to decide how the structure should change in response to an insertion.
If the Document supports undo/redo, an UndoableEditEvent will also be generated.
insertString
in interface javax.swing.text.Document
offset
- the offset into the document to insert the content >= 0.
All positions that track change at or after the given location
will move.str
- the string to inserta
- the attributes to associate with the inserted
content. This may be null if there are no attributes.
javax.swing.text.BadLocationException
- the given insert position is not a valid
position within the documentDocument
,
DocumentEvent
,
DocumentListener
,
UndoableEditEvent
,
UndoableEditListener
public void putProperty(java.lang.Object key, java.lang.Object value)
Puts a new property on the list.
putProperty
in interface javax.swing.text.Document
key
- the non-null property keyvalue
- the property valueDocument
public void remove(int offs, int len) throws javax.swing.text.BadLocationException
Removes a portion of the content of the document. This will cause a DocumentEvent of type DocumentEvent.EventType.REMOVE to be sent to the registered DocumentListeners, unless an exception is thrown. The notification will be sent to the listeners by calling the removeUpdate method on the DocumentListeners.
To ensure reasonable behavior in the face of concurrency, the event is dispatched after the mutation has occurred. This means that by the time a notification of removal is dispatched, the document has already been updated and any marks created by createPosition have already changed. For a removal, the end of the removal range is collapsed down to the start of the range, and any marks in the removal range are collapsed down to the start of the range.
If the Document structure changed as result of the removal, the details of what Elements were inserted and removed in response to the change will also be contained in the generated DocumentEvent. It is up to the implementation of a Document to decide how the structure should change in response to a remove.
If the Document supports undo/redo, an UndoableEditEvent will also be generated.
remove
in interface javax.swing.text.Document
offs
- the offset from the begining >= 0len
- the number of characters to remove >= 0
javax.swing.text.BadLocationException
- some portion of the removal range
was not a valid part of the document. The location in the exception
is the first bad position encountered.Document
,
DocumentEvent
,
DocumentListener
,
UndoableEditEvent
,
UndoableEditListener
public void removeDocumentListener(javax.swing.event.DocumentListener listener)
Unregisters the given observer from the notification list so it will no longer receive change updates.
removeDocumentListener
in interface javax.swing.text.Document
listener
- the observer to registerDocument.addDocumentListener(javax.swing.event.DocumentListener)
,
Document
public void removeUndoableEditListener(javax.swing.event.UndoableEditListener listener)
Unregisters the given observer from the notification list so it will no longer receive updates.
removeUndoableEditListener
in interface javax.swing.text.Document
listener
- the observer to registerUndoableEditEvent
,
Document
public void render(java.lang.Runnable r)
This allows the model to be safely rendered in the presence of currency, if the model supports being updated asynchronously. The given runnable will be executed in a way that allows it to safely read the model with no changes while the runnable is being executed. The runnable itself may not make any mutations.
render
in interface javax.swing.text.Document
r
- a Runnable used to render the modelDocument
public java.lang.Object getControlModel(java.lang.Object control)
getControlModel
in class DCControlBinding
public static javax.swing.text.Document createAttributeBinding(JUFormBinding formBinding, javax.swing.text.JTextComponent control, java.lang.String voInstanceName, java.lang.String voIterName, java.lang.String voIterBindingName, java.lang.String attrName)
formBinding
- The containing JUPanelBinding in which the given iterator binding
would be found/created.control
- The control instance to bind to a ViewObject's attribute.voInstanceName
- Name of the instance of the ViewObject in a BC4J ApplicationModule.voIterName
- Runtime instance name of the iterator in the ViewObject (optional).voIterBindingName
- Instance name of the iterator binding that uniquely identifies an
iterator binding object used to read/write data in this given JUPanelBinding instance.attrName
- The name of the attribute of this ViewObject rows that contains data
to display/edit in the associated text control.
public static javax.swing.text.Document getInstance(JUFormBinding formBinding, javax.swing.text.JTextComponent control, java.lang.String voInstanceName, java.lang.String voIterName, java.lang.String voIterBindingName, java.lang.String attrName)
|
Oracle ADF Model and Business Components API Reference 10.1.2 B14022-01 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright © 1997, 2004, Oracle. All rights reserved.