Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.jgoodies.binding.tutorial.basics
Class CommitStylesExample  view CommitStylesExample download CommitStylesExample.java

java.lang.Object
  extended bycom.jgoodies.binding.tutorial.basics.CommitStylesExample

public final class CommitStylesExample
extends java.lang.Object

Demonstrates three different styles when to commit changes: on key typed, on focus lost, on OK/Apply pressed. Therefore we bind 3 JTextFields to 3 String typed ValueModels that honor the commit style. And we bind 3 JLabels directly to these ValueModels that display the current value.

The ValueModels used in this example are requested from a PresentationModel that adapts text properties of a TextBean. This is just to demonstrate a consistent binding style. The same techniques work with any ValueModel.

Version:
$Revision: 1.2 $

Nested Class Summary
private  class CommitStylesExample.ApplyAction
           
static class CommitStylesExample.TextBean
           
 
Field Summary
private  javax.swing.JButton applyButton
           
private  javax.swing.text.JTextComponent onApplyField
           
private  javax.swing.JLabel onApplyLabel
           
private  javax.swing.text.JTextComponent onFocusLostField
           
private  javax.swing.JLabel onFocusLostLabel
           
private  javax.swing.text.JTextComponent onKeyTypedField
           
private  javax.swing.JLabel onKeyTypedLabel
           
private  PresentationModel presentationModel
          Holds a TextBean and vends ValueModels that adapt TextBean properties.
 
Constructor Summary
CommitStylesExample()
          Constructs the example with a PresentationModel on the a TextBean.
 
Method Summary
 javax.swing.JComponent build()
          Builds the pane.
private  javax.swing.JComponent buildButtonBar()
           
private  void initComponents()
          Creates,binds and configures the UI components.
static void main(java.lang.String[] args)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

presentationModel

private final PresentationModel presentationModel
Holds a TextBean and vends ValueModels that adapt TextBean properties. As an alternative to this PresentationModel we could use 3 ValueModels, for example 3 ValueHolders, or any other ValueModel implementation.


onKeyTypedField

private javax.swing.text.JTextComponent onKeyTypedField

onFocusLostField

private javax.swing.text.JTextComponent onFocusLostField

onApplyField

private javax.swing.text.JTextComponent onApplyField

onKeyTypedLabel

private javax.swing.JLabel onKeyTypedLabel

onFocusLostLabel

private javax.swing.JLabel onFocusLostLabel

onApplyLabel

private javax.swing.JLabel onApplyLabel

applyButton

private javax.swing.JButton applyButton
Constructor Detail

CommitStylesExample

public CommitStylesExample()
Constructs the example with a PresentationModel on the a TextBean.

Method Detail

main

public static void main(java.lang.String[] args)

initComponents

private void initComponents()
Creates,binds and configures the UI components.


build

public javax.swing.JComponent build()
Builds the pane.


buildButtonBar

private javax.swing.JComponent buildButtonBar()