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.
org.nuiton.jaxx.widgets.about.AboutUI Maven / Gradle / Ivy
package org.nuiton.jaxx.widgets.about;
/*-
* #%L
* JAXX :: Widgets
* %%
* Copyright (C) 2008 - 2024 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.Color;
import java.awt.Container;
import java.awt.Dialog;
import java.awt.Dialog.ModalityType;
import java.awt.Frame;
import java.awt.GraphicsConfiguration;
import java.awt.GridBagConstraints;
import java.awt.Insets;
import java.awt.Window;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTabbedPane;
import javax.swing.JToolBar;
import javax.swing.SwingConstants;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.nuiton.jaxx.runtime.JAXXBinding;
import org.nuiton.jaxx.runtime.JAXXContext;
import org.nuiton.jaxx.runtime.JAXXObject;
import org.nuiton.jaxx.runtime.JAXXObjectDescriptor;
import org.nuiton.jaxx.runtime.JAXXUtil;
import org.nuiton.jaxx.runtime.binding.DefaultJAXXBinding;
import org.nuiton.jaxx.runtime.binding.SimpleJAXXObjectBinding;
import org.nuiton.jaxx.runtime.context.DefaultJAXXContext;
import org.nuiton.jaxx.runtime.spi.UIHandler;
import org.nuiton.jaxx.runtime.swing.SwingUtil;
import org.nuiton.jaxx.runtime.swing.Table;
import static io.ultreia.java4all.i18n.I18n.t;
public class AboutUI extends JDialog implements JAXXObject {
/*-----------------------------------------------------------------------*/
/*---------------- Constants for all javaBean properties ----------------*/
/*-----------------------------------------------------------------------*/
public static final String PROPERTY_ICON_PATH = "iconPath";
/*-----------------------------------------------------------------------*/
/*------------------ Constants for all public bindings ------------------*/
/*-----------------------------------------------------------------------*/
public static final String BINDING_BOTTOM_LABEL_VISIBLE = "bottomLabel.visible";
public static final String BINDING_TITLE_LABEL_VISIBLE = "titleLabel.visible";
/*-----------------------------------------------------------------------*/
/*--------------- Constants for all none public bindings ---------------*/
/*-----------------------------------------------------------------------*/
private static final String BINDING_$JDIALOG0_ICON_IMAGE = "$JDialog0.iconImage";
/*-----------------------------------------------------------------------*/
/*------------------------- Other static fields -------------------------*/
/*-----------------------------------------------------------------------*/
private static final String $jaxxObjectDescriptor = "H4sIAAAAAAAAAKVWPW8TQRBdm9jBNoGQRAEkikgxHxJwJgLRJALyIUQiQyIIEhAJsedb7A3r283uXHJQUFDQ8QcoaGlQ/kNEhURDm/+AlJ/A7NnxYWSfD+JibY3evH3zbmbOX3+RnNHkqtR1xw84SN/ZpGHo6MAH3mTOyvzTp6vuJqvBEjM1zRVITVqfTJZkN0jJ68QNEGejikyVFlPFMlXaTJVF2VTSZ/4fRLNVUjTwRjDTYAyAXO6bXDOm8riDnA1VoNt39VTd664fH2b2M2zpU5aQUKH8EpZ95R8I4qqHqiTLPSBj1U26TSuC+nUUp7lfx4JGbGxRUGMe0ibbIu/IcJXkFdVIBuTaf9kT0UVUoQJSKK8scSpk/TqQC38XsMO9OgPjUFcG4Mzb88myUlF2HshxXpP+GoUGkFEr1LHinZb4GDVcXqeuYMg/3c8gs4MZTgSzSYX4hvLKGvWZwOQxe0PYhraiFnSqgy0CB8Gq1GXib3QUtLCxGF1eWZdSLFCN3BNd6Ha8G5+rCWkYkPEu6EIAWIyFnI01g1QdeRPdGoeAutjYZ7rvo67LPJvSDT4sfqYHUcmVeHOzU9gZe0wr7MKL/UzGrnfiro8bMLNBcjrAMD6g/gNnZ+YRolrTMt1/Wuw1EfD97jv9Zedg/3BExlDc1KCsP7YB9qvSUjEN3Go71ZqPALioPKBqdoMUDBO4SqJVcSlZ+eM2EtWjitNRs1om5z41DWTLDe/vfZt8+fMYyd4jRSGpd49a/DIpQEOjY1J4obpzNxJ3Yuc4nqNWJs6PnYHlJsU5ISfnPAp0yuW+hw/2dohGXUo2qqNrd/Xg++ePF/YOzcqgzHKazNiw3HOS577gPos2SntZ9NwgJWVY4Ml4E/TaDRn7XVTtQb4andd7WoAG8bd2eHHu5loSpijgGnADYGiDzbwZFWV/3UpNXAp8j9WkpsCicmb/nyrvSu2xaKZv9GYZTcFSdGntdV1L1JXANJ5Gj6BvcJsekaXwSvpwDc1nCfZMpiAa3uaGt7dvHz1paEZaLq9R7ic/snOpisM5hMN3whGI8lLRreCoLEN20BP8OT+Qw4ZfJKgYzBA98VpgBpiShqgE+JZb52qdhXAkKhteTfClnELMeENq/hZ7mYp5wet+E/+5JFBeTCXq2QCG37XLB2itCgAA";
private static final Logger log = LogManager.getLogger(AboutUI.class);
private static final long serialVersionUID = 1L;
/*-----------------------------------------------------------------------*/
/*--------------------------- Internal states ---------------------------*/
/*-----------------------------------------------------------------------*/
protected List $activeBindings = new ArrayList();
protected Map $bindingSources = new HashMap();
protected final Map $bindings = new TreeMap();
protected Map $objectMap = new HashMap();
protected Map, ?> $previousValues = new HashMap();
protected final JAXXContext delegateContext = new DefaultJAXXContext();
/*-----------------------------------------------------------------------*/
/*------------------------ Protected components ------------------------*/
/*-----------------------------------------------------------------------*/
protected JLabel bottomLabel;
protected JButton close;
protected String iconPath;
protected JTabbedPane tabs;
protected JLabel titleLabel;
protected JPanel topPanel;
/*-----------------------------------------------------------------------*/
/*------------------------- Private components -------------------------*/
/*-----------------------------------------------------------------------*/
private AboutUI $JDialog0;
private JPanel $JPanel0;
private JPanel $JPanel1;
private JToolBar $JToolBar0;
private Table $Table0;
/*-----------------------------------------------------------------------*/
/*---------------------- Raw body code from script ----------------------*/
/*-----------------------------------------------------------------------*/
public void display() {
setSize((int)(getOwner().getWidth() * 0.9), (int)(getOwner().getHeight() * 0.9));
SwingUtil.center(getOwner(), this);
setVisible(true);
}
/*-----------------------------------------------------------------------*/
/*---------------------------- Constructors ----------------------------*/
/*-----------------------------------------------------------------------*/
public AboutUI(Window param0) {
super(param0);
$initialize();
}
public AboutUI(JAXXContext parentContext, Window param1) {
super(param1);
JAXXUtil.initContext(this, parentContext);
$initialize();
}
public AboutUI(Dialog param0, String param1, boolean param2, GraphicsConfiguration param3) {
super(param0 ,param1 ,param2 ,param3);
$initialize();
}
public AboutUI(JAXXContext parentContext, Dialog param1, String param2, boolean param3, GraphicsConfiguration param4) {
super(param1 ,param2 ,param3 ,param4);
JAXXUtil.initContext(this, parentContext);
$initialize();
}
public AboutUI(Dialog param0, String param1, boolean param2) {
super(param0 ,param1 ,param2);
$initialize();
}
public AboutUI(JAXXContext parentContext, Dialog param1, String param2, boolean param3) {
super(param1 ,param2 ,param3);
JAXXUtil.initContext(this, parentContext);
$initialize();
}
public AboutUI(Dialog param0, String param1) {
super(param0 ,param1);
$initialize();
}
public AboutUI(JAXXContext parentContext, Dialog param1, String param2) {
super(param1 ,param2);
JAXXUtil.initContext(this, parentContext);
$initialize();
}
public AboutUI(Window param0, String param1, ModalityType param2, GraphicsConfiguration param3) {
super(param0 ,param1 ,param2 ,param3);
$initialize();
}
public AboutUI(JAXXContext parentContext, Window param1, String param2, ModalityType param3, GraphicsConfiguration param4) {
super(param1 ,param2 ,param3 ,param4);
JAXXUtil.initContext(this, parentContext);
$initialize();
}
public AboutUI(Window param0, String param1, ModalityType param2) {
super(param0 ,param1 ,param2);
$initialize();
}
public AboutUI(JAXXContext parentContext, Window param1, String param2, ModalityType param3) {
super(param1 ,param2 ,param3);
JAXXUtil.initContext(this, parentContext);
$initialize();
}
public AboutUI(Window param0, String param1) {
super(param0 ,param1);
$initialize();
}
public AboutUI(JAXXContext parentContext, Window param1, String param2) {
super(param1 ,param2);
JAXXUtil.initContext(this, parentContext);
$initialize();
}
public AboutUI(Window param0, ModalityType param1) {
super(param0 ,param1);
$initialize();
}
public AboutUI(JAXXContext parentContext, Window param1, ModalityType param2) {
super(param1 ,param2);
JAXXUtil.initContext(this, parentContext);
$initialize();
}
public AboutUI(Frame param0, String param1) {
super(param0 ,param1);
$initialize();
}
public AboutUI(JAXXContext parentContext, Frame param1, String param2) {
super(param1 ,param2);
JAXXUtil.initContext(this, parentContext);
$initialize();
}
public AboutUI(Frame param0, boolean param1) {
super(param0 ,param1);
$initialize();
}
public AboutUI(JAXXContext parentContext, Frame param1, boolean param2) {
super(param1 ,param2);
JAXXUtil.initContext(this, parentContext);
$initialize();
}
public AboutUI(Frame param0) {
super(param0);
$initialize();
}
public AboutUI(JAXXContext parentContext, Frame param1) {
super(param1);
JAXXUtil.initContext(this, parentContext);
$initialize();
}
public AboutUI() {
$initialize();
}
public AboutUI(JAXXContext parentContext) {
JAXXUtil.initContext(this, parentContext);
$initialize();
}
public AboutUI(Dialog param0, boolean param1) {
super(param0 ,param1);
$initialize();
}
public AboutUI(JAXXContext parentContext, Dialog param1, boolean param2) {
super(param1 ,param2);
JAXXUtil.initContext(this, parentContext);
$initialize();
}
public AboutUI(Dialog param0) {
super(param0);
$initialize();
}
public AboutUI(JAXXContext parentContext, Dialog param1) {
super(param1);
JAXXUtil.initContext(this, parentContext);
$initialize();
}
public AboutUI(Frame param0, String param1, boolean param2, GraphicsConfiguration param3) {
super(param0 ,param1 ,param2 ,param3);
$initialize();
}
public AboutUI(JAXXContext parentContext, Frame param1, String param2, boolean param3, GraphicsConfiguration param4) {
super(param1 ,param2 ,param3 ,param4);
JAXXUtil.initContext(this, parentContext);
$initialize();
}
public AboutUI(Frame param0, String param1, boolean param2) {
super(param0 ,param1 ,param2);
$initialize();
}
public AboutUI(JAXXContext parentContext, Frame param1, String param2, boolean param3) {
super(param1 ,param2 ,param3);
JAXXUtil.initContext(this, parentContext);
$initialize();
}
/*-----------------------------------------------------------------------*/
/*--------------------------- Statics methods ---------------------------*/
/*-----------------------------------------------------------------------*/
public static JAXXObjectDescriptor $getJAXXObjectDescriptor() {
return JAXXUtil.decodeCompressedJAXXObjectDescriptor($jaxxObjectDescriptor);
}
/*-----------------------------------------------------------------------*/
/*---------------------- JAXXObject implementation ----------------------*/
/*-----------------------------------------------------------------------*/
@Override
public void applyDataBinding(String $binding) {
if ($bindings.containsKey($binding)) {
getDataBinding($binding).applyDataBinding();
}
processDataBinding($binding);
}
@Override
public void firePropertyChange(String propertyName, Object oldValue, Object newValue) {
super.firePropertyChange(propertyName, oldValue, newValue);
}
@Override
public Map get$objectMap() {
return $objectMap;
}
@Override
public JAXXBinding getDataBinding(String bindingId) {
return $bindings.get(bindingId);
}
@Override
public JAXXBinding[] getDataBindings() {
return $bindings.values().toArray(new JAXXBinding[$bindings.size()]);
}
@Override
public Object getObjectById(String id) {
return $objectMap.get(id);
}
@Override
public void processDataBinding(String $binding, boolean $force) {
if (!$force && $activeBindings.contains($binding)) {
return;
}
$activeBindings.add($binding);
try {
if ($bindings.containsKey($binding)) {
getDataBinding($binding).processDataBinding();
}
} finally {
$activeBindings.remove($binding);
}
}
@Override
public void processDataBinding(String $binding) {
processDataBinding($binding, false);
}
@Override
public void registerDataBinding(JAXXBinding binding) {
$bindings.put(binding.getId(), binding);
}
@Override
public void removeDataBinding(String $binding) {
if ($bindings.containsKey($binding)) {
getDataBinding($binding).removeDataBinding();
}
}
/*-----------------------------------------------------------------------*/
/*--------------------- JAXXContext implementation ---------------------*/
/*-----------------------------------------------------------------------*/
@Override
public T getContextValue(Class clazz) {
return delegateContext.getContextValue(clazz, null);
}
@Override
public T getContextValue(Class clazz, String name) {
return delegateContext.getContextValue(clazz, name);
}
@Override
public JAXXContext getDelegateContext() {
return delegateContext;
}
@Override
public O getParentContainer(Class clazz) {
return SwingUtil.getParentContainer(this, clazz);
}
@Override
public O getParentContainer(Object source, Class clazz) {
return SwingUtil.getParentContainer(source, clazz);
}
@Override
public void removeContextValue(Class clazz) {
delegateContext.removeContextValue(clazz, null);
}
@Override
public void removeContextValue(Class clazz, String name) {
delegateContext.removeContextValue(clazz, name);
}
@Override
public void setContextValue(T o) {
delegateContext.setContextValue(o, null);
}
@Override
public void setContextValue(T o, String name) {
delegateContext.setContextValue(o, name);
}
/*-----------------------------------------------------------------------*/
/*---------------------------- Event methods ----------------------------*/
/*-----------------------------------------------------------------------*/
public void doWindowClosed__on__$JDialog0(WindowEvent event) {
if (log.isDebugEnabled()) {
log.debug(event);
}
SwingUtil.destroy(this);
}
/*-----------------------------------------------------------------------*/
/*----------------------- Public accessor methods -----------------------*/
/*-----------------------------------------------------------------------*/
public JLabel getBottomLabel() {
return bottomLabel;
}
public JButton getClose() {
return close;
}
public String getIconPath() {
return iconPath;
}
public JTabbedPane getTabs() {
return tabs;
}
public JLabel getTitleLabel() {
return titleLabel;
}
public JPanel getTopPanel() {
return topPanel;
}
/*-----------------------------------------------------------------------*/
/*----------------------- Public mutator methods -----------------------*/
/*-----------------------------------------------------------------------*/
public void setIconPath(String iconPath) {
String oldValue = this.iconPath;
this.iconPath = iconPath;
firePropertyChange(PROPERTY_ICON_PATH, oldValue, iconPath);
}
/*-----------------------------------------------------------------------*/
/*--------------------- Protected accessors methods ---------------------*/
/*-----------------------------------------------------------------------*/
protected JPanel get$JPanel0() {
return $JPanel0;
}
protected JPanel get$JPanel1() {
return $JPanel1;
}
protected JToolBar get$JToolBar0() {
return $JToolBar0;
}
protected Table get$Table0() {
return $Table0;
}
/*-----------------------------------------------------------------------*/
/*--------------------- Components creation methods ---------------------*/
/*-----------------------------------------------------------------------*/
protected void createBottomLabel() {
$objectMap.put("bottomLabel", bottomLabel = new JLabel());
bottomLabel.setName("bottomLabel");
}
protected void createClose() {
$objectMap.put("close", close = new JButton());
close.setName("close");
close.setBorderPainted(false);
close.setFocusable(false);
close.setToolTipText(t("aboutframe.close"));
}
protected void createIconPath() {
$objectMap.put("iconPath", iconPath = "/icons/action-close.png");
}
protected void createTabs() {
$objectMap.put("tabs", tabs = new JTabbedPane());
tabs.setName("tabs");
}
protected void createTitleLabel() {
$objectMap.put("titleLabel", titleLabel = new JLabel());
titleLabel.setName("titleLabel");
if (titleLabel.getFont() != null) {
titleLabel.setFont(titleLabel.getFont().deriveFont((float) 12));
}
}
protected void createTopPanel() {
$objectMap.put("topPanel", topPanel = new JPanel());
topPanel.setName("topPanel");
}
/*-----------------------------------------------------------------------*/
/*------------------------ Internal jaxx methods ------------------------*/
/*-----------------------------------------------------------------------*/
protected void $initialize() {
if (log.isDebugEnabled()) {
log.debug(this);
}
$JDialog0 = this;
JAXXObject.initialize(
this,
this::$initialize_01_createHandler,
this::$initialize_01_createComponents,
this::$initialize_02_registerDataBindings,
this::$initialize_03_finalizeCreateComponents,
this::$initialize_03_registerActions,
this::$initialize_04_applyDataBindings,
this::$initialize_05_setProperties,
this::$initialize_06_finalizeInitialize);
}
protected void $initialize_01_createComponents() {
if (log.isDebugEnabled()) {
log.debug(this);
}
$objectMap.put("$JDialog0", $JDialog0);
createIconPath();
// inline creation of $Table0
$objectMap.put("$Table0", $Table0 = new Table());
$Table0.setName("$Table0");
// inline creation of $JPanel0
$objectMap.put("$JPanel0", $JPanel0 = new JPanel());
$JPanel0.setName("$JPanel0");
$JPanel0.setLayout(new BorderLayout());
createTitleLabel();
// inline creation of $JToolBar0
$objectMap.put("$JToolBar0", $JToolBar0 = new JToolBar());
$JToolBar0.setName("$JToolBar0");
$JToolBar0.setBorderPainted(false);
$JToolBar0.setFloatable(false);
$JToolBar0.setOpaque(false);
createClose();
createTopPanel();
createTabs();
// inline creation of $JPanel1
$objectMap.put("$JPanel1", $JPanel1 = new JPanel());
$JPanel1.setName("$JPanel1");
$JPanel1.setLayout(new BorderLayout());
createBottomLabel();
// inline creation of $JDialog0
setName("$JDialog0");
setResizable(true);
setUndecorated(true);
$JDialog0.addWindowListener(JAXXUtil.getEventListener(WindowListener.class, "windowClosed", this, "doWindowClosed__on__$JDialog0"));
}
protected UIHandler extends JAXXObject> $initialize_01_createHandler() {
if (log.isDebugEnabled()) {
log.debug(this);
}
return null;
}
protected void $initialize_02_registerDataBindings() {
if (log.isDebugEnabled()) {
log.debug(this);
}
// register 3 data bindings
registerDataBinding(new SimpleJAXXObjectBinding(this, BINDING_$JDIALOG0_ICON_IMAGE, true ,"iconPath") {
@Override
public void processDataBinding() {
setIconImage(SwingUtil.createIcon(getIconPath()).getImage());
}
});
registerDataBinding(new SimpleJAXXObjectBinding(this, BINDING_TITLE_LABEL_VISIBLE, true ,"title") {
@Override
public void processDataBinding() {
titleLabel.setVisible(getTitle() != null);
}
});
registerDataBinding(new DefaultJAXXBinding(this, BINDING_BOTTOM_LABEL_VISIBLE, true) {
@Override
public void applyDataBinding() {
if (bottomLabel != null) {
bottomLabel.addPropertyChangeListener("text", this);
}
}
@Override
public void processDataBinding() {
if (bottomLabel != null) {
bottomLabel.setVisible(bottomLabel.getText() != null);
}
}
@Override
public void removeDataBinding() {
if (bottomLabel != null) {
bottomLabel.removePropertyChangeListener("text", this);
}
}
});
}
protected void $initialize_03_finalizeCreateComponents() {
if (log.isDebugEnabled()) {
log.debug(this);
}
// inline complete setup of $JDialog0
add($Table0);
// inline complete setup of $Table0
$Table0.add($JPanel0, new GridBagConstraints(0, 0, 1, 1, 1.0, 0.0, 10, 1, new Insets(1, 1, 1, 1), 0, 0));
$Table0.add(topPanel, new GridBagConstraints(0, 1, 1, 1, 1.0, 0.0, 10, 1, new Insets(1, 1, 1, 1), 0, 0));
$Table0.add(tabs, new GridBagConstraints(0, 2, 1, 1, 0.0, 1.0, 10, 1, new Insets(1, 1, 1, 1), 0, 0));
$Table0.add($JPanel1, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0, 10, 1, new Insets(1, 1, 1, 1), 0, 0));
// inline complete setup of $JPanel0
$JPanel0.add(titleLabel, BorderLayout.CENTER);
$JPanel0.add($JToolBar0, BorderLayout.EAST);
// inline complete setup of $JToolBar0
$JToolBar0.add(close);
// inline complete setup of $JPanel1
$JPanel1.add(bottomLabel, BorderLayout.CENTER);
}
protected void $initialize_03_registerActions() {
if (log.isDebugEnabled()) {
log.debug(this);
}
}
protected void $initialize_04_applyDataBindings() {
if (log.isDebugEnabled()) {
log.debug(this);
}
// apply 3 data bindings
JAXXUtil.applyDataBinding(this, $bindings.keySet());
}
protected void $initialize_05_setProperties() {
if (log.isDebugEnabled()) {
log.debug(this);
}
// apply 6 property setters
$Table0.setBorder(BorderFactory.createLineBorder(Color.BLACK, 1));
$JPanel0.setBackground(Color.WHITE);
close.setIcon(SwingUtil.getUIManagerActionIcon("close"));
bottomLabel.setHorizontalAlignment(SwingConstants.CENTER);// late initializer
$JDialog0.pack();
}
protected void $initialize_06_finalizeInitialize() {
if (log.isDebugEnabled()) {
log.debug(this);
}
}
}