org.nuiton.jaxx.demo.feature.databinding.BeanDataBindingDemo Maven / Gradle / Ivy
package org.nuiton.jaxx.demo.feature.databinding;
/*-
* #%L
* JAXX :: Demo
* %%
* Copyright (C) 2008 - 2019 Code Lutin, Ultreia.io
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* .
* #L%
*/
import java.awt.BorderLayout;
import java.awt.GridBagConstraints;
import java.awt.Insets;
import java.awt.LayoutManager;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.nuiton.jaxx.runtime.JAXXContext;
import org.nuiton.jaxx.runtime.JAXXObjectDescriptor;
import org.nuiton.jaxx.runtime.JAXXUtil;
import org.nuiton.jaxx.runtime.binding.SimpleJAXXObjectBinding;
import org.nuiton.jaxx.runtime.swing.SwingUtil;
import org.nuiton.jaxx.runtime.swing.Table;
import static io.ultreia.java4all.i18n.I18n.t;
public class BeanDataBindingDemo extends BaseBeanDataBinding {
/*-----------------------------------------------------------------------*/
/*---------------- Constants for all javaBean properties ----------------*/
/*-----------------------------------------------------------------------*/
public static final String PROPERTY_EDITING3 = "editing3";
/*-----------------------------------------------------------------------*/
/*------------------ Constants for all public bindings ------------------*/
/*-----------------------------------------------------------------------*/
public static final String BINDING_EDIT3_ENABLED = "edit3.enabled";
public static final String BINDING_EDIT3_TEXT = "edit3.text";
/*-----------------------------------------------------------------------*/
/*--------------- Constants for all none public bindings ---------------*/
/*-----------------------------------------------------------------------*/
private static final String BINDING_$JBUTTON0_VISIBLE = "$JButton0.visible";
private static final String BINDING_$JBUTTON1_VISIBLE = "$JButton1.visible";
private static final String BINDING_$JBUTTON2_VISIBLE = "$JButton2.visible";
private static final String BINDING_$JBUTTON3_VISIBLE = "$JButton3.visible";
private static final String BINDING_$JBUTTON4_VISIBLE = "$JButton4.visible";
private static final String BINDING_$JBUTTON5_VISIBLE = "$JButton5.visible";
private static final String BINDING_$JLABEL0_TEXT = "$JLabel0.text";
private static final String BINDING_$JTEXT_FIELD0_ENABLED = "$JTextField0.enabled";
private static final String BINDING_$JTEXT_FIELD1_ENABLED = "$JTextField1.enabled";
/*-----------------------------------------------------------------------*/
/*------------------------- Other static fields -------------------------*/
/*-----------------------------------------------------------------------*/
private static final String $jaxxObjectDescriptor = "H4sIAAAAAAAAAKWUz08TQRTHp5W2FFAUBKMx2oQiJMiugBwMFbQ0BJsiRjgQenHKjrBku7vOzMJy4eDBm/+AB69eDP8D8WTixSv/gwl/gm9ml/6A7XZ1e2ibN9/5vO97u+99/4NSjKLHFt1VTEfnlqnsY9dVqGNyvU6U8sutrfXaPtnhJcJ2qG5ziyLvk0iiZBX1a40440ipVoCkeiRVkFSfpC5bddsyidkCWqigPsaPDML2COEcTXa8vMOYutFQLri2Q/1cga6Dcv36NHOWIKUvSYRcG+zfhLKn/gHQrLqngpK6xtFQZR8fYNXA5i6Yo7q5CwVdF7FlAzP2GtfJB3SMMhWUtjEFGEfT/9UeiZMo1+ZoJF/EjBQJNkuY46JuapD5CUeFy8VopG4p7wnmDiWKBtqap1Uu3S2BzrZlgjRHvUTTOUTnOLolalFEfUrRsgy41ZRl8pu4ZhDIO9apiexQJJMycSnbTJEvV3CNGHB5SKRwfakXFaLBVu0bbAZoZbRdm82Xiw4HHyAebhN7YSEbuaqeEYF77YcD+fImcfmKTgwNaKNttMZJsFXJu9PB2mwjWe7q4VzAYasTSX4YnHU2LOvTBnjy6uF8wGFKvAVzrekoetTpQcN0Ks3pbA5KoopS1IEwvCSdF4OY7beg8qZ6rPNUizRS+PHkmH47PD+7GOXbYC7X7VbL1oK5sqllE8p14W3Qm2OH64a6hu2FKsoyYsDKkyttItz5hq8E9+DCmxhBUlYx2wNaKnN2+mP03e9rKLmC+gwLaytY6F+hLN+j0DHL0Fx76YU0N3DYKzaTsMlR2sBHFjwgdKMghjfnT++iC12aCO9Sw9TJ+vnPr5/HTy86lQCP+Sg3m91KbaO0bhq6SeTa8zda4JrrtxlxNKu5roIWWEL89tn+JpmX38+C6u/h8NqL04LriJ/n0r/4tyQZw10ZIrwMe6Pg+c9hDlu65nCyGEy8G8FV5kBnur/ROhjrjpHGxNdqMOF+JMJaiIfuBCiFmGI3ayGYB7FLiU8Yi92MaIQwD+OxPUQjbIcQJmJXEZ8wFbsP0QhhHqZje4hGCHsWavQqQgh/AfYglhZ9CwAA";
private static final Logger log = LogManager.getLogger(BeanDataBindingDemo.class);
private static final long serialVersionUID = 1L;
/*-----------------------------------------------------------------------*/
/*------------------------ Protected components ------------------------*/
/*-----------------------------------------------------------------------*/
protected JTextField edit3;
protected Boolean editing3;
/*-----------------------------------------------------------------------*/
/*------------------------- Private components -------------------------*/
/*-----------------------------------------------------------------------*/
private BeanDataBindingDemo $BaseBeanDataBinding0;
private JButton $JButton0;
private JButton $JButton1;
private JButton $JButton2;
private JButton $JButton3;
private JButton $JButton4;
private JButton $JButton5;
private JLabel $JLabel0;
private JPanel $JPanel0;
private JPanel $JPanel1;
private JPanel $JPanel2;
private JTextField $JTextField0;
private JTextField $JTextField1;
private Table $Table0;
/*-----------------------------------------------------------------------*/
/*---------------------- Raw body code from script ----------------------*/
/*-----------------------------------------------------------------------*/
@Override
protected String[] getSources() {
return addDefaultSources( "BaseBeanDataBinding.jaxx" );
}
/*-----------------------------------------------------------------------*/
/*---------------------------- Constructors ----------------------------*/
/*-----------------------------------------------------------------------*/
public BeanDataBindingDemo(LayoutManager param0, boolean param1) {
super(param0 ,param1);
}
public BeanDataBindingDemo(JAXXContext param0, LayoutManager param1, boolean param2) {
super(param0 ,param1 ,param2);
}
public BeanDataBindingDemo(LayoutManager param0) {
super(param0);
}
public BeanDataBindingDemo(JAXXContext param0, LayoutManager param1) {
super(param0 ,param1);
}
public BeanDataBindingDemo() {
}
public BeanDataBindingDemo(JAXXContext param0) {
super(param0);
}
public BeanDataBindingDemo(boolean param0) {
super(param0);
}
public BeanDataBindingDemo(JAXXContext param0, boolean param1) {
super(param0 ,param1);
}
/*-----------------------------------------------------------------------*/
/*--------------------------- Statics methods ---------------------------*/
/*-----------------------------------------------------------------------*/
public static JAXXObjectDescriptor $getJAXXObjectDescriptor() {
return JAXXUtil.decodeCompressedJAXXObjectDescriptor($jaxxObjectDescriptor);
}
/*-----------------------------------------------------------------------*/
/*---------------------------- Event methods ----------------------------*/
/*-----------------------------------------------------------------------*/
public void doActionPerformed__on__$JButton0(ActionEvent event) {
if (log.isDebugEnabled()) {
log.debug(event);
}
setEditing(true);
}
public void doActionPerformed__on__$JButton1(ActionEvent event) {
if (log.isDebugEnabled()) {
log.debug(event);
}
setEditing(false);
}
public void doActionPerformed__on__$JButton2(ActionEvent event) {
if (log.isDebugEnabled()) {
log.debug(event);
}
setEditing2(true);
}
public void doActionPerformed__on__$JButton3(ActionEvent event) {
if (log.isDebugEnabled()) {
log.debug(event);
}
setEditing2(false);
}
public void doActionPerformed__on__$JButton4(ActionEvent event) {
if (log.isDebugEnabled()) {
log.debug(event);
}
setEditing3(true);
}
public void doActionPerformed__on__$JButton5(ActionEvent event) {
if (log.isDebugEnabled()) {
log.debug(event);
}
setEditing3(false);
}
public void doKeyReleased__on__edit3(KeyEvent event) {
if (log.isDebugEnabled()) {
log.debug(event);
}
setContentMessage(edit3.getText());
}
/*-----------------------------------------------------------------------*/
/*----------------------- Public acessor methods -----------------------*/
/*-----------------------------------------------------------------------*/
public JTextField getEdit3() {
return edit3;
}
public Boolean getEditing3() {
return editing3;
}
public Boolean isEditing3() {
return editing3 !=null && editing3;
}
/*-----------------------------------------------------------------------*/
/*----------------------- Public mutator methods -----------------------*/
/*-----------------------------------------------------------------------*/
public void setEditing3(Boolean editing3) {
Boolean oldValue = this.editing3;
this.editing3 = editing3;
firePropertyChange(PROPERTY_EDITING3, oldValue, editing3);
}
/*-----------------------------------------------------------------------*/
/*--------------------- Protected acessors methods ---------------------*/
/*-----------------------------------------------------------------------*/
protected JButton get$JButton0() {
return $JButton0;
}
protected JButton get$JButton1() {
return $JButton1;
}
protected JButton get$JButton2() {
return $JButton2;
}
protected JButton get$JButton3() {
return $JButton3;
}
protected JButton get$JButton4() {
return $JButton4;
}
protected JButton get$JButton5() {
return $JButton5;
}
protected JLabel get$JLabel0() {
return $JLabel0;
}
protected JPanel get$JPanel0() {
return $JPanel0;
}
protected JPanel get$JPanel1() {
return $JPanel1;
}
protected JPanel get$JPanel2() {
return $JPanel2;
}
protected JTextField get$JTextField0() {
return $JTextField0;
}
protected JTextField get$JTextField1() {
return $JTextField1;
}
protected Table get$Table0() {
return $Table0;
}
/*-----------------------------------------------------------------------*/
/*--------------------- Components creation methods ---------------------*/
/*-----------------------------------------------------------------------*/
protected void createEdit3() {
$objectMap.put("edit3", edit3 = new JTextField());
edit3.setName("edit3");
edit3.setColumns(15);
edit3.addKeyListener(JAXXUtil.getEventListener(KeyListener.class, "keyReleased", this, "doKeyReleased__on__edit3"));
}
protected void createEditing3() {
$objectMap.put("editing3", editing3 = true);
}
/*-----------------------------------------------------------------------*/
/*------------------------ Internal jaxx methods ------------------------*/
/*-----------------------------------------------------------------------*/
@Override
protected void $initialize() {
if (log.isDebugEnabled()) {
log.debug(this);
}
$BaseBeanDataBinding0 = this;
super.$initialize();
}
@Override
protected void $initialize_01_createComponents() {
if (log.isDebugEnabled()) {
log.debug(this);
}
super.$initialize_01_createComponents();
$objectMap.put("$BaseBeanDataBinding0", $BaseBeanDataBinding0);
createEditing3();
// inline creation of $Table0
$objectMap.put("$Table0", $Table0 = new Table());
$Table0.setName("$Table0");
// inline creation of $JLabel0
$objectMap.put("$JLabel0", $JLabel0 = new JLabel());
$JLabel0.setName("$JLabel0");
// inline creation of $JPanel0
$objectMap.put("$JPanel0", $JPanel0 = new JPanel());
$JPanel0.setName("$JPanel0");
// inline creation of $JButton0
$objectMap.put("$JButton0", $JButton0 = new JButton());
$JButton0.setName("$JButton0");
$JButton0.setText(t("edit"));
$JButton0.addActionListener(JAXXUtil.getEventListener(ActionListener.class, "actionPerformed", this, "doActionPerformed__on__$JButton0"));
// inline creation of $JButton1
$objectMap.put("$JButton1", $JButton1 = new JButton());
$JButton1.setName("$JButton1");
$JButton1.setText(t("close"));
$JButton1.addActionListener(JAXXUtil.getEventListener(ActionListener.class, "actionPerformed", this, "doActionPerformed__on__$JButton1"));
// inline creation of $JTextField0
$objectMap.put("$JTextField0", $JTextField0 = new JTextField());
$JTextField0.setName("$JTextField0");
$JTextField0.setColumns(15);
SwingUtil.setText($JTextField0, "to edit");
// inline creation of $JPanel1
$objectMap.put("$JPanel1", $JPanel1 = new JPanel());
$JPanel1.setName("$JPanel1");
// inline creation of $JButton2
$objectMap.put("$JButton2", $JButton2 = new JButton());
$JButton2.setName("$JButton2");
$JButton2.setText(t("edit2"));
$JButton2.addActionListener(JAXXUtil.getEventListener(ActionListener.class, "actionPerformed", this, "doActionPerformed__on__$JButton2"));
// inline creation of $JButton3
$objectMap.put("$JButton3", $JButton3 = new JButton());
$JButton3.setName("$JButton3");
$JButton3.setText(t("close2"));
$JButton3.addActionListener(JAXXUtil.getEventListener(ActionListener.class, "actionPerformed", this, "doActionPerformed__on__$JButton3"));
// inline creation of $JTextField1
$objectMap.put("$JTextField1", $JTextField1 = new JTextField());
$JTextField1.setName("$JTextField1");
$JTextField1.setColumns(15);
SwingUtil.setText($JTextField1, "to edit 2");
// inline creation of $JPanel2
$objectMap.put("$JPanel2", $JPanel2 = new JPanel());
$JPanel2.setName("$JPanel2");
// inline creation of $JButton4
$objectMap.put("$JButton4", $JButton4 = new JButton());
$JButton4.setName("$JButton4");
$JButton4.setText(t("edit3"));
$JButton4.addActionListener(JAXXUtil.getEventListener(ActionListener.class, "actionPerformed", this, "doActionPerformed__on__$JButton4"));
// inline creation of $JButton5
$objectMap.put("$JButton5", $JButton5 = new JButton());
$JButton5.setName("$JButton5");
$JButton5.setText(t("close3"));
$JButton5.addActionListener(JAXXUtil.getEventListener(ActionListener.class, "actionPerformed", this, "doActionPerformed__on__$JButton5"));
createEdit3();
// inline creation of $BaseBeanDataBinding0
setName("$BaseBeanDataBinding0");
setLayout(new BorderLayout());
}
@Override
protected void $initialize_02_registerDataBindings() {
if (log.isDebugEnabled()) {
log.debug(this);
}
super.$initialize_02_registerDataBindings();
// register 11 data bindings
registerDataBinding(new SimpleJAXXObjectBinding(this, BINDING_$JLABEL0_TEXT, true ,"contentMessage") {
@Override
public void processDataBinding() {
$JLabel0.setText(getContentMessage());
}
});
registerDataBinding(new SimpleJAXXObjectBinding(this, BINDING_$JBUTTON0_VISIBLE, true ,"editing") {
@Override
public void processDataBinding() {
$JButton0.setVisible(!isEditing());
}
});
registerDataBinding(new SimpleJAXXObjectBinding(this, BINDING_$JBUTTON1_VISIBLE, true ,"editing") {
@Override
public void processDataBinding() {
$JButton1.setVisible(isEditing());
}
});
registerDataBinding(new SimpleJAXXObjectBinding(this, BINDING_$JTEXT_FIELD0_ENABLED, true ,"editing") {
@Override
public void processDataBinding() {
$JTextField0.setEnabled(isEditing());
}
});
registerDataBinding(new SimpleJAXXObjectBinding(this, BINDING_$JBUTTON2_VISIBLE, true ,"editing2") {
@Override
public void processDataBinding() {
$JButton2.setVisible(!isEditing2());
}
});
registerDataBinding(new SimpleJAXXObjectBinding(this, BINDING_$JBUTTON3_VISIBLE, true ,"editing2") {
@Override
public void processDataBinding() {
$JButton3.setVisible(isEditing2());
}
});
registerDataBinding(new SimpleJAXXObjectBinding(this, BINDING_$JTEXT_FIELD1_ENABLED, true ,"editing2") {
@Override
public void processDataBinding() {
$JTextField1.setEnabled(isEditing2());
}
});
registerDataBinding(new SimpleJAXXObjectBinding(this, BINDING_$JBUTTON4_VISIBLE, true ,"editing3") {
@Override
public void processDataBinding() {
$JButton4.setVisible(!isEditing3());
}
});
registerDataBinding(new SimpleJAXXObjectBinding(this, BINDING_$JBUTTON5_VISIBLE, true ,"editing3") {
@Override
public void processDataBinding() {
$JButton5.setVisible(isEditing3());
}
});
registerDataBinding(new SimpleJAXXObjectBinding(this, BINDING_EDIT3_ENABLED, true ,"editing3") {
@Override
public void processDataBinding() {
edit3.setEnabled(isEditing3());
}
});
registerDataBinding(new SimpleJAXXObjectBinding(this, BINDING_EDIT3_TEXT, true ,"contentMessage") {
@Override
public void processDataBinding() {
SwingUtil.setText(edit3, getContentMessage());
}
});
}
@Override
protected void $initialize_03_finalizeCreateComponents() {
if (log.isDebugEnabled()) {
log.debug(this);
}
super.$initialize_03_finalizeCreateComponents();
// inline complete setup of $BaseBeanDataBinding0
add($Table0);
// inline complete setup of $Table0
$Table0.add($JLabel0, new GridBagConstraints(0, 0, 2, 1, 0.0, 0.0, 10, 0, new Insets(3, 3, 3, 3), 0, 0));
$Table0.add($JPanel0, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, 10, 0, new Insets(3, 3, 3, 3), 0, 0));
$Table0.add($JTextField0, new GridBagConstraints(1, 1, 1, 1, 1.0, 0.0, 10, 1, new Insets(3, 3, 3, 3), 0, 0));
$Table0.add($JPanel1, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, 10, 0, new Insets(3, 3, 3, 3), 0, 0));
$Table0.add($JTextField1, new GridBagConstraints(1, 2, 1, 1, 1.0, 0.0, 10, 1, new Insets(3, 3, 3, 3), 0, 0));
$Table0.add($JPanel2, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0, 10, 0, new Insets(3, 3, 3, 3), 0, 0));
$Table0.add(edit3, new GridBagConstraints(1, 3, 1, 1, 1.0, 0.0, 10, 1, new Insets(3, 3, 3, 3), 0, 0));
// inline complete setup of $JPanel0
$JPanel0.add($JButton0);
$JPanel0.add($JButton1);
// inline complete setup of $JPanel1
$JPanel1.add($JButton2);
$JPanel1.add($JButton3);
// inline complete setup of $JPanel2
$JPanel2.add($JButton4);
$JPanel2.add($JButton5);
}
@Override
protected void $initialize_04_applyDataBindings() {
if (log.isDebugEnabled()) {
log.debug(this);
}
super.$initialize_04_applyDataBindings();
}
@Override
protected void $initialize_05_setProperties() {
if (log.isDebugEnabled()) {
log.debug(this);
}
super.$initialize_05_setProperties();
}
@Override
protected void $initialize_06_finalizeInitialize() {
if (log.isDebugEnabled()) {
log.debug(this);
}
super.$initialize_06_finalizeInitialize();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy