borland.jbcl Packages  borland.jbcl Class Hierarchy  borland.jbcl.view 

FieldView component

java.lang.Object
   +----java.awt.Component
           +----java.awt.Container
                   +----java.awt.Panel
                           +----borland.jbcl.view.BeanPanel
                                   +----borland.jbcl.view.FieldView
                                           +----borland.jbcl.control.FieldControl

About the FieldView component

Variables  Constructors  Properties  Methods  Event Listeners

Implements ItemEditSite, ItemPaintSite, SingletonModelListener, SingletonView, MenuContainer, FocusListener, KeyListener, ImageObserver, Serializable, EventListener

The FieldView component is a field view element for developing new composite components. It requires a SingletonModel data model and a SingletonViewManager view manager.

See also: Understanding model-view component architecture.


FieldView variables

Variables implemented in borland.jbcl.view.BeanPanel

Variables implemented in java.awt.Component

FieldView constructors

FieldView properties

*Read-only properties **Write-only properties

Properties implemented in this class

Properties implemented in borland.jbcl.view.BeanPanel

Properties implemented in java.awt.Component

Properties implemented in java.awt.Container

Properties implemented in java.lang.Object

FieldView methods

Methods implemented in this class

Methods implemented in borland.jbcl.view.BeanPanel

Methods implemented in java.awt.Component

Methods implemented in java.awt.Container

Methods implemented in java.awt.Panel

Methods implemented in java.lang.Object

FieldView event listeners


FieldView constructors

FieldView()

  public FieldView()
Constructs a FieldView component with the background color set to SystemColor.window.


FieldView properties

alignment

 public int getAlignment()
 public void setAlignment(int align)
Stores the alignment of the items in the FieldView, both horizontal and vertical. To set a new value for both horizontal and vertical alignment, separate the values with a vertical bar (|). Acceptable values for newAlignment are defined in borland.jbcl.util.Alignment.

autoEdit

 public boolean isAutoEdit()
 public void setAutoEdit(boolean edit)
The autoEdit property enables or disables automatic item editing in the field. By default, this property is true, meaning that a user can edit values in any item on the list by typing a character on the keyboard. If set to false, the user must press F2, press Ctrl+Enter, or double-click, to start an edit session.

editClickPoint

 public Point getEditClickPoint()
The editClickPoint property stores the point where the user clicked to initiate the edit session for this field. This is used to determine where to place the text cursor in the text field.

editInPlace

 public boolean isEditInPlace()
 public void setEditInPlace(boolean editInPlace)
The editInPlace property enables or disables item editing in the field. By default, this property is true, meaning that a user can edit the value. If set to false, the field data cannot by modified by the user; the data can only be changed through programmatic access to the field's model.

editing

 public boolean isEditing()
The editing property (read-only) returns true if an item is currently being edited in the field.

enabled

 public boolean isEnabled()
 public void setEnabled(boolean enabled)
The enabled property specifies the enabled state of this component. If enabled is true, the component can be navigated to and can have focus. If false, the component cannot be navigated to, cannot have focus, and may be dimmed.

itemMargins

 public Insets getItemMargins()
 public void setItemMargins(java.awt.Insets margins)
The itemMargins property specifies the amount of space between the text and the edge of the field.

model

 public SingletonModel getModel()
 public void setModel(borland.jbcl.model.SingletonModel sm)
Specifies the data model object that provides the single item for this component. FieldView requires a SingletonModel data model.

If an edit is in progress when the setModel() method is called, the edit is ended prior to setting the data model.

See also: postOnEndEdit

postOnEndEdit

 public boolean isPostOnEndEdit()
 public void setPostOnEndEdit(boolean post)
Specifies whether a pending edit on the data provided by the SingletonModel should be saved or discarded when the edit is ended. This can happen, for example, when calling setModel() when an edit is in progress. When postOnEndEdit is true, changes are saved. When false, changes are discarded. The value of postOnEndEdit defaults to true.

See also: model

preferredHeight

 public int getPreferredHeight()
 public void setPreferredHeight(int preferredHeight)
The preferredHeight property specifies the vertical size that you would prefer layout managers to use for this field.

preferredSize

 public Dimension getPreferredSize()
The preferredSize property specifies the size that you would prefer layout managers to use for this field.

preferredWidth

 public int getPreferredWidth()
 public void setPreferredWidth(int preferredWidth)
The preferredWidth property specifies the horizontal size that you would prefer layout managers to use for this field.

readOnly

 public boolean isReadOnly()
 public void setReadOnly(boolean ro)
Specifies whether the FieldView can be edited. The readOnly property returns false only if the component user sets it to false and a WriteableSingletonModel is being used. Otherwise, isReadOnly () returns true regardless of how it has been set and the writable data model for this component is set to null.

See also: writeModel

selectable

 public boolean isSelectable()
 public void setSelectable(boolean select)
Specifies whether the FieldView is selectable (true) or not (false). If setSelectable() is successful, the FieldView is repainted.

selected

 public boolean isSelected()
 public void setSelected(boolean selected)
Specifies the selected state of the FieldView. The isSelected() method returns true if selected, or false if not. If setSelected() is successful, it repaints the FieldView.

showFocus

 public boolean isShowFocus()
 public void setShowFocus(boolean visible)
The showFocus property enables or disables the painting of the focus rectangle on the field. Specifically, the showFocus property turns on or off the FOCUSED bit in the state information that is passed to the ItemPainter when the field is painted. If an ItemPainter ignores the FOCUSED bit, this property will have no effect. By default, showFocus is true.

siteGraphics

 public Graphics getSiteGraphics()
Returns a correctly assembled Graphics object for coordinate comparisons with item painter coordinate calculations.

viewManager

 public SingletonViewManager getViewManager()
 public void setViewManager(borland.jbcl.model.SingletonViewManager viewManager)
Specifies the Singleton data model view manager object that handles viewer and editor selection for this component.

writeModel

 public WritableSingletonModel getWriteModel()
The writeModel property returns the writable data model for the FieldView component. For the FieldView, the writable data model is the WritableSingletonModel. This method returns null if the readOnly property is true.

This is a read-only property.

See also: readOnly


FieldView methods

doLayout()

  public void doLayout()
Forces the field to update the layout of its contained data item.

Overrides: java.awt.Container.doLayout()

endEdit()

  public void endEdit()
Ends the edit of the FieldView component. If changes have been made, endEdit() informs the editor to post the changes.

getInnerRect(java.awt.Graphics)

  public Rectangle getInnerRect(java.awt.Graphics g)

Parameters:

g
The graphics context object to paint.

getPainter(java.lang.Object)

  protected ItemPainter getPainter(java.lang.Object contents)
Returns an appropriate item painter for the type of data in the field. See jbcl.model.SingletonViewManager.getPainter(java.lang.Object, int).

Parameters:

contents
A handle to the data item contained in the field.

paint(java.awt.Graphics)

  public void paint(java.awt.Graphics g)
Paints the FieldView component with a border.

Parameters:

g
The graphics context object to paint.

Overrides: java.awt.Container.paint(Graphics)

paramString()

  protected String paramString()
A protected method that returns the parameter string of the FieldView component. The parameter string represents comma-separated values of this component's container properties such as selectable and focus states.

Overrides: java.awt.Container.paramString()

processFocusEvent(java.awt.event.FocusEvent)

  protected void processFocusEvent(java.awt.event.FocusEvent e)
A protected method that is called when a focus event occurs. This method repaints the FieldView with the appropriate focus state when focus is gained or lost.

Parameters:

e
The focus event.

Overrides: borland.jbcl.view.ViewPanel.processFocusEvent(FocusEvent)

processKeyPressed(java.awt.event.KeyEvent)

  protected void processKeyPressed(java.awt.event.KeyEvent e)
For Ctrl+Enter or F2, starts the edit session.

Parameters:

e
The key event.

Overrides: borland.jbcl.view.ViewPanel.processKeyPressed(KeyEvent)

processKeyTyped(java.awt.event.KeyEvent)

  protected void processKeyTyped(java.awt.event.KeyEvent e)

Parameters:

e
The key event.

Overrides: borland.jbcl.view.BeanPanel.processKeyTyped(KeyEvent)

processMousePressed(java.awt.event.MouseEvent)

  protected void processMousePressed(java.awt.event.MouseEvent e)

Parameters:

e
The key event.

Overrides: borland.jbcl.view.ViewPanel.processMousePressed(MouseEvent)

startEdit()

  public void startEdit()
Starts an edit session in the field, unless edit-in-place is false.

update(java.awt.Graphics)

  public void update(java.awt.Graphics g)
Calls the paint() method.

Parameters:

g
The graphics context.

Overrides: java.awt.Component.update(Graphics)


FieldView event listeners

This component is a source for the following event sets. For information on the standard AWT event sets, see Standard Java events. For information on the JBCL event sets, see Events in JBCL.

action

 public synchronized void addActionListener(java.awt.event.ActionListener l)
 public synchronized void removeActionListener(java.awt.event.ActionListener l)

component

 public synchronized void addComponentListener(java.awt.event.ComponentListener l)
 public synchronized void removeComponentListener(java.awt.event.ComponentListener l)

container

 public synchronized void addContainerListener(java.awt.event.ContainerListener l)
 public void removeContainerListener(java.awt.event.ContainerListener l)

focus

 public synchronized void addFocusListener(java.awt.event.FocusListener l)
 public synchronized void removeFocusListener(java.awt.event.FocusListener l)

key

 public void addKeyListener(java.awt.event.KeyListener l)
 public void removeKeyListener(java.awt.event.KeyListener l)

model

 public void addModelListener(borland.jbcl.model.SingletonModelListener l)
 public void removeModelListener(borland.jbcl.model.SingletonModelListener l)

mouse

 public synchronized void addMouseListener(java.awt.event.MouseListener l)
 public synchronized void removeMouseListener(java.awt.event.MouseListener l)

mouseMotion

 public synchronized void addMouseMotionListener(java.awt.event.MouseMotionListener l)
 public synchronized void removeMouseMotionListener(java.awt.event.MouseMotionListener l)