All Downloads are FREE. Search and download functionalities are using the official Maven repository.
Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
jaxx.demo.component.swing.JRadioButtonDemo Maven / Gradle / Ivy
package jaxx.demo.component.swing;
/*-
* #%L
* JAXX :: Demo
* %%
* Copyright (C) 2008 - 2016 CodeLutin
* %%
* 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.LayoutManager;
import javax.swing.ButtonGroup;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JRadioButton;
import jaxx.demo.DemoPanel;
import jaxx.runtime.JAXXContext;
import jaxx.runtime.JAXXObjectDescriptor;
import jaxx.runtime.JAXXUtil;
import jaxx.runtime.binding.DefaultJAXXBinding;
import jaxx.runtime.swing.HBox;
import jaxx.runtime.swing.JAXXButtonGroup;
import jaxx.runtime.swing.VBox;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import static org.nuiton.i18n.I18n.t;
public class JRadioButtonDemo extends DemoPanel {
/*-----------------------------------------------------------------------*/
/*--------------- Constants for all none public bindings ---------------*/
/*-----------------------------------------------------------------------*/
private static final String BINDING_$JLABEL0_ICON = "$JLabel0.icon";
/*-----------------------------------------------------------------------*/
/*------------------------- Other static fields -------------------------*/
/*-----------------------------------------------------------------------*/
private static final String $jaxxObjectDescriptor = "H4sIAAAAAAAAAKVUu24TQRS9NrFjx3mQGEKAIIXgAgFaAw1FopCXTIjMQ4kURbhh7B3FG613hpnZZKFAfAKfAD0NEh0VoqCmoEH8AkIUtIg7s7bXJhvHkl3sWjP3nHvO9bl+9xNSUsDlfRIElvA95TSotbmyu/uouk9rap3KmnC4YgLCTyIJyQrk7Pa5VHClUtbwYhNeXGMNzjzqdaAXyjAi1XOXyjqlSsGlbkRNyuJ2+3oh4L5osbZFxbG++f0r+dp+9TYJEHBUl0ErcyehIidDZUg6toIp7HRAii7x9lCGcLw91Dumz9ZcIuVD0qDP4CUMlyHNiUAyBfP9WzYcBh9wBbnCOm2wx8Sj7k0F14xYG0+sWovCkoeowNrcIrbDVn2lmKchnBuStIJ0YWOVBYg+12U1hOkrXZftKN85vnynWT7aLh8vdHZG2IweRBCjSgMmjsHd0qdnelXcjqnIFDbLpGomM9XV1Zx26xwVEReGcD7GnM5xWHBPMJ/jBAVc7KrD4FlR8KJkJCqQEj4eo/3K0axu4VWY0pn/UqoJze3f6fy3jz8+lFrRHMPeZ2NLOzYLI8MF41QoR7eeCHPpK8ctPiB8oQJZSV1cS7N2szHCtpvXKA77TWq4peHWBpF1pEgNf//0efrp11OQLMGIy4hdIrr+PmRVXeAUmGsH/O6yUTR6mMHnaa1NQb7OhPOCeYq4K66z5zXMGkwtOp7reHSOKNybqq/oUoBTmY2ZSltaNfvlT377/XJrMglUev7Y8mg6qSeQDruZtW1uZOya5rikvs2izYvbxYR+j/HmXhXM82qc9ckD/YPUOozr0uuBr183jAP9zeqbMFeNQtmDKt8HVSYMBLUH5BlSNOhlqx+O1AFxfToQiT6+04Nhui+GlYEZSgMz9HIxM7CL/hh6uTiZAUPh1HDhYXzRJorMVR3Pxn/VpXi+C8j3D1JiULxNCAAA";
private static final Log log = LogFactory.getLog(JRadioButtonDemo.class);
private static final long serialVersionUID = 1L;
/*-----------------------------------------------------------------------*/
/*--------------------------- Internal states ---------------------------*/
/*-----------------------------------------------------------------------*/
private boolean allComponentsCreated;
/*-----------------------------------------------------------------------*/
/*------------------------ Protected components ------------------------*/
/*-----------------------------------------------------------------------*/
protected JAXXButtonGroup radioButtons;
/*-----------------------------------------------------------------------*/
/*------------------------- Private components -------------------------*/
/*-----------------------------------------------------------------------*/
private JRadioButtonDemo $DemoPanel0 = this;
private HBox $HBox0;
private JLabel $JLabel0;
private JRadioButton $JRadioButton0;
private JRadioButton $JRadioButton1;
private JRadioButton $JRadioButton2;
private VBox $VBox0;
/*-----------------------------------------------------------------------*/
/*---------------------------- Constructors ----------------------------*/
/*-----------------------------------------------------------------------*/
public JRadioButtonDemo(LayoutManager param0, boolean param1) {
super(param0 ,param1);
$initialize();
}
public JRadioButtonDemo(JAXXContext param0, LayoutManager param1, boolean param2) {
super(param0 ,param1 ,param2);
$initialize();
}
public JRadioButtonDemo(LayoutManager param0) {
super(param0);
$initialize();
}
public JRadioButtonDemo(JAXXContext param0, LayoutManager param1) {
super(param0 ,param1);
$initialize();
}
public JRadioButtonDemo() {
$initialize();
}
public JRadioButtonDemo(JAXXContext param0) {
super(param0);
$initialize();
}
public JRadioButtonDemo(boolean param0) {
super(param0);
$initialize();
}
public JRadioButtonDemo(JAXXContext param0, boolean param1) {
super(param0 ,param1);
$initialize();
}
/*-----------------------------------------------------------------------*/
/*--------------------------- Statics methods ---------------------------*/
/*-----------------------------------------------------------------------*/
public static JAXXObjectDescriptor $getJAXXObjectDescriptor() {
return JAXXUtil.decodeCompressedJAXXObjectDescriptor($jaxxObjectDescriptor);
}
/*-----------------------------------------------------------------------*/
/*----------------------- Public acessor methods -----------------------*/
/*-----------------------------------------------------------------------*/
public JAXXButtonGroup getRadioButtons() {
return radioButtons;
}
/*-----------------------------------------------------------------------*/
/*--------------------- Protected acessors methods ---------------------*/
/*-----------------------------------------------------------------------*/
protected HBox get$HBox0() {
return $HBox0;
}
protected JLabel get$JLabel0() {
return $JLabel0;
}
protected JRadioButton get$JRadioButton0() {
return $JRadioButton0;
}
protected JRadioButton get$JRadioButton1() {
return $JRadioButton1;
}
protected JRadioButton get$JRadioButton2() {
return $JRadioButton2;
}
protected VBox get$VBox0() {
return $VBox0;
}
/*-----------------------------------------------------------------------*/
/*--------------------- Components creation methods ---------------------*/
/*-----------------------------------------------------------------------*/
protected void create$JRadioButton0() {
$objectMap.put("$JRadioButton0", $JRadioButton0 = new JRadioButton());
$JRadioButton0.setName("$JRadioButton0");
$JRadioButton0.setSelected(true);
$JRadioButton0.setText(t("Animal"));
{ $JRadioButton0.putClientProperty("$value", "Lynx.jpg"); Object $buttonGroup = $JRadioButton0.getClientProperty("$buttonGroup"); if ($buttonGroup instanceof JAXXButtonGroup) { ((JAXXButtonGroup) $buttonGroup).updateSelectedValue(); } }
}
protected void create$JRadioButton1() {
$objectMap.put("$JRadioButton1", $JRadioButton1 = new JRadioButton());
$JRadioButton1.setName("$JRadioButton1");
$JRadioButton1.setText(t("Vegetable"));
{ $JRadioButton1.putClientProperty("$value", "Tomato.jpg"); Object $buttonGroup = $JRadioButton1.getClientProperty("$buttonGroup"); if ($buttonGroup instanceof JAXXButtonGroup) { ((JAXXButtonGroup) $buttonGroup).updateSelectedValue(); } }
}
protected void create$JRadioButton2() {
$objectMap.put("$JRadioButton2", $JRadioButton2 = new JRadioButton());
$JRadioButton2.setName("$JRadioButton2");
$JRadioButton2.setText(t("Mineral"));
{ $JRadioButton2.putClientProperty("$value", "Amethyst.jpg"); Object $buttonGroup = $JRadioButton2.getClientProperty("$buttonGroup"); if ($buttonGroup instanceof JAXXButtonGroup) { ((JAXXButtonGroup) $buttonGroup).updateSelectedValue(); } }
}
protected void createRadioButtons() {
$objectMap.put("radioButtons", radioButtons = new JAXXButtonGroup());
}
/*-----------------------------------------------------------------------*/
/*------------------------ Internal jaxx methods ------------------------*/
/*-----------------------------------------------------------------------*/
private void $completeSetup() {
allComponentsCreated = true;
if (log.isDebugEnabled()) {
log.debug(this);
}
// inline complete setup of $DemoPanel0
add($HBox0);
// inline complete setup of $HBox0
$HBox0.add($VBox0);
$HBox0.add($JLabel0);
// inline complete setup of $VBox0
$VBox0.add($JRadioButton0);
$VBox0.add($JRadioButton1);
$VBox0.add($JRadioButton2);
// inline complete setup of $JRadioButton0
{ ButtonGroup $buttonGroup = radioButtons; $JRadioButton0.putClientProperty("$buttonGroup", $buttonGroup); $buttonGroup.add($JRadioButton0); }
// inline complete setup of $JRadioButton1
{ ButtonGroup $buttonGroup = radioButtons; $JRadioButton1.putClientProperty("$buttonGroup", $buttonGroup); $buttonGroup.add($JRadioButton1); }
// inline complete setup of $JRadioButton2
{ ButtonGroup $buttonGroup = radioButtons; $JRadioButton2.putClientProperty("$buttonGroup", $buttonGroup); $buttonGroup.add($JRadioButton2); }
// apply 1 data bindings
JAXXUtil.applyDataBinding(this, $bindings.keySet());
}
private void $initialize() {
if (allComponentsCreated) {
return;
}
if (log.isDebugEnabled()) {
log.debug(this);
}
$objectMap.put("$DemoPanel0", $DemoPanel0);
// inline creation of $HBox0
$objectMap.put("$HBox0", $HBox0 = new HBox());
$HBox0.setName("$HBox0");
$HBox0.setHorizontalAlignment(0);
$HBox0.setVerticalAlignment(0);
// inline creation of $VBox0
$objectMap.put("$VBox0", $VBox0 = new VBox());
$VBox0.setName("$VBox0");
create$JRadioButton0();
create$JRadioButton1();
create$JRadioButton2();
// inline creation of $JLabel0
$objectMap.put("$JLabel0", $JLabel0 = new JLabel());
$JLabel0.setName("$JLabel0");
createRadioButtons();
// inline creation of $DemoPanel0
setName("$DemoPanel0");
// registers 1 data bindings
$registerDefaultBindings();
$completeSetup();
}
private void $registerDefaultBindings() {
// register 1 data bindings
registerDataBinding(new DefaultJAXXBinding(this, BINDING_$JLABEL0_ICON, true) {
@Override
public void applyDataBinding() {
if (radioButtons != null) {
radioButtons.addPropertyChangeListener("selectedValue", this);
}
}
@Override
public void processDataBinding() {
if (radioButtons != null) {
$JLabel0.setIcon(new ImageIcon(getClass().getResource("/jaxx/demo/images/" + radioButtons.getSelectedValue())));
}
}
@Override
public void removeDataBinding() {
if (radioButtons != null) {
radioButtons.removePropertyChangeListener("selectedValue", this);
}
}
});
}
}