List of usage examples for com.jgoodies.binding.adapter TextComponentConnector connect
@SuppressWarnings("unused") public static void connect(ValueModel subject, JTextField textField)
From source file:com.songbook.pc.ui.view.TextDialogView.java
License:Open Source License
/** * Creates new form TextDialog with the specified parameters. * @param parent Parent frame * @param presentationModel Presentation model displayed by this view *///from w w w . j a va 2s .c o m public TextDialogView(Frame parent, TextDialogPresentationModel presentationModel) { super(parent, true); setResizable(false); setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); // Bind title & visibility PropertyConnector.connectAndUpdate(presentationModel.getTitleModel(), this, "title"); // Description label descriptionLabel = new JLabel(); PropertyConnector.connectAndUpdate(presentationModel.getDescriptionModel(), descriptionLabel, "text"); // Text field textField = new JTextField(); TextComponentConnector.connect(presentationModel.getTextValueModel(), textField); // Status label statusLabel = new JLabel(); PropertyConnector.connectAndUpdate(presentationModel.getStatusMessageModel(), statusLabel, "text"); // Buttons okButton = new JButton(presentationModel.getOkAction()); cancelButton = new JButton(presentationModel.getCancelAction()); // Handle OPEN/CLOSE events from presentation-model presentationModel.addEventListener(new TextDialogPresentationModel.EventListener() { @Override public void onEvent(Object eventType) { if (TextDialogPresentationModel.Event.VIEW_OPEN.equals(eventType)) { setVisible(true); } else if (TextDialogPresentationModel.Event.VIEW_CLOSE.equals(eventType)) { setVisible(false); } } }); initLayout(); }