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.select.BeanDoubleList Maven / Gradle / Ivy
package org.nuiton.jaxx.widgets.select;
/*-
* #%L
* JAXX :: Widgets Select
* %%
* Copyright (C) 2008 - 2021 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 io.ultreia.java4all.decoration.Decorator;
import java.awt.BorderLayout;
import java.awt.Container;
import java.awt.GridBagConstraints;
import java.awt.GridLayout;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
import javax.swing.ButtonGroup;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JMenuItem;
import javax.swing.JPanel;
import javax.swing.JPopupMenu;
import javax.swing.JRadioButtonMenuItem;
import javax.swing.JScrollPane;
import javax.swing.JSeparator;
import javax.swing.JTextField;
import javax.swing.JToggleButton;
import javax.swing.JToolBar;
import javax.swing.border.TitledBorder;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.swing.event.PopupMenuEvent;
import javax.swing.event.PopupMenuListener;
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.bean.BeanScopeAware;
import org.nuiton.jaxx.runtime.bean.BeanTypeAware;
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.swing.JAXXButtonGroup;
import org.nuiton.jaxx.runtime.swing.SwingUtil;
import org.nuiton.jaxx.runtime.swing.Table;
import org.nuiton.jaxx.widgets.select.actions.BeanDoubleListAddAction;
import org.nuiton.jaxx.widgets.select.actions.BeanDoubleListRemoveAction;
import static io.ultreia.java4all.i18n.I18n.t;
public class BeanDoubleList extends Table implements BeanTypeAware, BeanScopeAware, JAXXObject {
/*-----------------------------------------------------------------------*/
/*---------------- Constants for all javaBean properties ----------------*/
/*-----------------------------------------------------------------------*/
public static final String PROPERTY_BEAN = "bean";
public static final String PROPERTY_BEAN_TYPE = "beanType";
public static final String PROPERTY_FILTERABLE = "filterable";
public static final String PROPERTY_HIGHLIGHT_FILTER_TEXT = "highlightFilterText";
public static final String PROPERTY_I18N_PREFIX = "i18nPrefix";
public static final String PROPERTY_INDEX = "index";
public static final String PROPERTY_MODEL = "model";
public static final String PROPERTY_PROPERTY = "property";
public static final String PROPERTY_REVERSE_SORT = "reverseSort";
public static final String PROPERTY_SHOW_DECORATOR = "showDecorator";
public static final String PROPERTY_SHOW_RESET = "showReset";
public static final String PROPERTY_SHOW_SELECT_POPUP_ENABLED = "showSelectPopupEnabled";
public static final String PROPERTY_USE_MULTI_SELECT = "useMultiSelect";
/*-----------------------------------------------------------------------*/
/*------------------ Constants for all public bindings ------------------*/
/*-----------------------------------------------------------------------*/
public static final String BINDING_ADD_BUTTON_ENABLED = "addButton.enabled";
public static final String BINDING_CHANGE_DECORATOR_ENABLED = "changeDecorator.enabled";
public static final String BINDING_FILTER_PANEL_VISIBLE = "filterPanel.visible";
public static final String BINDING_REMOVE_BUTTON_ENABLED = "removeButton.enabled";
public static final String BINDING_RESET_BUTTON_ENABLED = "resetButton.enabled";
public static final String BINDING_SELECTED_LIST_COMPONENT_POPUP_MENU = "selectedList.componentPopupMenu";
public static final String BINDING_SELECTED_LIST_MODEL = "selectedList.model";
public static final String BINDING_SELECTED_LIST_MOVE_DOWN_ACTION_ENABLED = "selectedListMoveDownAction.enabled";
public static final String BINDING_SELECTED_LIST_MOVE_UP_ACTION_ENABLED = "selectedListMoveUpAction.enabled";
public static final String BINDING_SELECTED_LIST_REMOVE_ACTION_ENABLED = "selectedListRemoveAction.enabled";
public static final String BINDING_SORT_DOWN_SELECTED = "sortDown.selected";
public static final String BINDING_SORT_UP_SELECTED = "sortUp.selected";
public static final String BINDING_TOOLBAR_LEFT_VISIBLE = "toolbarLeft.visible";
public static final String BINDING_TOOLBAR_RIGHT_VISIBLE = "toolbarRight.visible";
public static final String BINDING_UNIVERSE_LIST_MODEL = "universeList.model";
/*-----------------------------------------------------------------------*/
/*------------------------- Other static fields -------------------------*/
/*-----------------------------------------------------------------------*/
private static final String $jaxxObjectDescriptor = "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";
private static final Logger log = LogManager.getLogger(BeanDoubleList.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 JButton addButton;
protected Object bean;
protected Class beanType;
protected JPanel beforeFilterPanel;
protected JToggleButton changeDecorator;
protected JTextField filterField;
protected JLabel filterFieldLabel;
protected JPanel filterPanel;
protected Boolean filterable;
protected BeanDoubleListHandler handler;
protected Boolean highlightFilterText;
protected String i18nPrefix;
protected Integer index;
protected JAXXButtonGroup indexes;
protected BeanDoubleListModel model;
protected JPopupMenu popup;
protected JLabel popupLabel;
protected JSeparator popupSeparator;
protected JLabel popupSortLabel;
protected String property;
protected JButton removeButton;
protected JButton resetButton;
protected Boolean reverseSort;
protected JList selectedList;
protected JMenuItem selectedListMoveDownAction;
protected JMenuItem selectedListMoveUpAction;
protected JPopupMenu selectedListPopup;
protected JMenuItem selectedListRemoveAction;
protected Boolean showDecorator;
protected Boolean showReset;
protected Boolean showSelectPopupEnabled;
protected JRadioButtonMenuItem sortDown;
protected JAXXButtonGroup sortGroup;
protected JRadioButtonMenuItem sortUp;
protected JToolBar toolbarLeft;
protected JToolBar toolbarRight;
protected JList universeList;
protected Boolean useMultiSelect;
/*-----------------------------------------------------------------------*/
/*------------------------- Private components -------------------------*/
/*-----------------------------------------------------------------------*/
private JPanel $JPanel0;
private JPanel $JPanel1;
private JScrollPane $JScrollPane0;
private JScrollPane $JScrollPane1;
private JSeparator $JSeparator0;
private BeanDoubleList $Table0;
/*-----------------------------------------------------------------------*/
/*---------------------- Raw body code from script ----------------------*/
/*-----------------------------------------------------------------------*/
public void init(Decorator decorator, Decorator decorator2, List universe, List selected) {
handler.init(decorator, decorator2, universe, selected);
}
public void init(Decorator decorator, List universe, List selected) {
handler.init(decorator, universe, selected);
}
/*-----------------------------------------------------------------------*/
/*---------------------------- Constructors ----------------------------*/
/*-----------------------------------------------------------------------*/
public BeanDoubleList() {
$initialize();
}
public BeanDoubleList(JAXXContext parentContext) {
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 doActionPerformed__on__changeDecorator(ActionEvent event) {
if (log.isDebugEnabled()) {
log.debug(event);
}
getHandler().togglePopup();
}
public void doActionPerformed__on__resetButton(ActionEvent event) {
if (log.isDebugEnabled()) {
log.debug(event);
}
filterField.setText("");
}
public void doActionPerformed__on__selectedListMoveDownAction(ActionEvent event) {
if (log.isDebugEnabled()) {
log.debug(event);
}
handler.moveDownSelected( (O) selectedList.getSelectedValue());
}
public void doActionPerformed__on__selectedListMoveUpAction(ActionEvent event) {
if (log.isDebugEnabled()) {
log.debug(event);
}
handler.moveUpSelected( (O) selectedList.getSelectedValue());
}
public void doActionPerformed__on__selectedListRemoveAction(ActionEvent event) {
if (log.isDebugEnabled()) {
log.debug(event);
}
model.removeFromSelected( (O) selectedList.getSelectedValue());
}
public void doMouseClicked__on__selectedList(MouseEvent event) {
if (log.isDebugEnabled()) {
log.debug(event);
}
handler.onSelectedListClicked(event);
}
public void doMouseClicked__on__universeList(MouseEvent event) {
if (log.isDebugEnabled()) {
log.debug(event);
}
handler.onUniverseListClicked(event);
}
public void doPopupMenuCanceled__on__popup(PopupMenuEvent event) {
if (log.isDebugEnabled()) {
log.debug(event);
}
getChangeDecorator().setSelected(false);
}
public void doPopupMenuWillBecomeInvisible__on__popup(PopupMenuEvent event) {
if (log.isDebugEnabled()) {
log.debug(event);
}
getChangeDecorator().setSelected(false);
}
public void doStateChanged__on__indexes(ChangeEvent event) {
if (log.isDebugEnabled()) {
log.debug(event);
}
setIndex((Integer)indexes.getSelectedValue());
}
public void doStateChanged__on__sortGroup(ChangeEvent event) {
if (log.isDebugEnabled()) {
log.debug(event);
}
setReverseSort((Boolean)sortGroup.getSelectedValue());
}
/*-----------------------------------------------------------------------*/
/*----------------------- Public acessor methods -----------------------*/
/*-----------------------------------------------------------------------*/
public JButton getAddButton() {
return addButton;
}
public Object getBean() {
return bean;
}
public Class getBeanType() {
return beanType;
}
public JPanel getBeforeFilterPanel() {
return beforeFilterPanel;
}
public JToggleButton getChangeDecorator() {
return changeDecorator;
}
public JTextField getFilterField() {
return filterField;
}
public JLabel getFilterFieldLabel() {
return filterFieldLabel;
}
public JPanel getFilterPanel() {
return filterPanel;
}
public Boolean getFilterable() {
return filterable;
}
public BeanDoubleListHandler getHandler() {
return handler;
}
public Boolean getHighlightFilterText() {
return highlightFilterText;
}
public String getI18nPrefix() {
return i18nPrefix;
}
public Integer getIndex() {
return index;
}
public JAXXButtonGroup getIndexes() {
return indexes;
}
public BeanDoubleListModel getModel() {
return model;
}
public JPopupMenu getPopup() {
return popup;
}
public JLabel getPopupLabel() {
return popupLabel;
}
public JSeparator getPopupSeparator() {
return popupSeparator;
}
public JLabel getPopupSortLabel() {
return popupSortLabel;
}
public String getProperty() {
return property;
}
public JButton getRemoveButton() {
return removeButton;
}
public JButton getResetButton() {
return resetButton;
}
public Boolean getReverseSort() {
return reverseSort;
}
public JList getSelectedList() {
return selectedList;
}
public JMenuItem getSelectedListMoveDownAction() {
return selectedListMoveDownAction;
}
public JMenuItem getSelectedListMoveUpAction() {
return selectedListMoveUpAction;
}
public JPopupMenu getSelectedListPopup() {
return selectedListPopup;
}
public JMenuItem getSelectedListRemoveAction() {
return selectedListRemoveAction;
}
public Boolean getShowDecorator() {
return showDecorator;
}
public Boolean getShowReset() {
return showReset;
}
public Boolean getShowSelectPopupEnabled() {
return showSelectPopupEnabled;
}
public JRadioButtonMenuItem getSortDown() {
return sortDown;
}
public JAXXButtonGroup getSortGroup() {
return sortGroup;
}
public JRadioButtonMenuItem getSortUp() {
return sortUp;
}
public JToolBar getToolbarLeft() {
return toolbarLeft;
}
public JToolBar getToolbarRight() {
return toolbarRight;
}
public JList getUniverseList() {
return universeList;
}
public Boolean getUseMultiSelect() {
return useMultiSelect;
}
public Boolean isFilterable() {
return filterable !=null && filterable;
}
public Boolean isHighlightFilterText() {
return highlightFilterText !=null && highlightFilterText;
}
public Boolean isReverseSort() {
return reverseSort !=null && reverseSort;
}
public Boolean isShowDecorator() {
return showDecorator !=null && showDecorator;
}
public Boolean isShowReset() {
return showReset !=null && showReset;
}
public Boolean isShowSelectPopupEnabled() {
return showSelectPopupEnabled !=null && showSelectPopupEnabled;
}
public Boolean isUseMultiSelect() {
return useMultiSelect !=null && useMultiSelect;
}
/*-----------------------------------------------------------------------*/
/*----------------------- Public mutator methods -----------------------*/
/*-----------------------------------------------------------------------*/
public void setBean(Object bean) {
Object oldValue = this.bean;
this.bean = bean;
firePropertyChange(PROPERTY_BEAN, oldValue, bean);
}
public void setBeanType(Class beanType) {
Class oldValue = this.beanType;
this.beanType = beanType;
firePropertyChange(PROPERTY_BEAN_TYPE, oldValue, beanType);
}
public void setFilterable(Boolean filterable) {
Boolean oldValue = this.filterable;
this.filterable = filterable;
firePropertyChange(PROPERTY_FILTERABLE, oldValue, filterable);
}
public void setHighlightFilterText(Boolean highlightFilterText) {
Boolean oldValue = this.highlightFilterText;
this.highlightFilterText = highlightFilterText;
firePropertyChange(PROPERTY_HIGHLIGHT_FILTER_TEXT, oldValue, highlightFilterText);
}
public void setI18nPrefix(String i18nPrefix) {
String oldValue = this.i18nPrefix;
this.i18nPrefix = i18nPrefix;
firePropertyChange(PROPERTY_I18N_PREFIX, oldValue, i18nPrefix);
}
public void setIndex(Integer index) {
Integer oldValue = this.index;
this.index = index;
firePropertyChange(PROPERTY_INDEX, oldValue, index);
}
public void setModel(BeanDoubleListModel model) {
BeanDoubleListModel oldValue = this.model;
this.model = model;
firePropertyChange(PROPERTY_MODEL, oldValue, model);
}
public void setProperty(String property) {
String oldValue = this.property;
this.property = property;
firePropertyChange(PROPERTY_PROPERTY, oldValue, property);
}
public void setReverseSort(Boolean reverseSort) {
Boolean oldValue = this.reverseSort;
this.reverseSort = reverseSort;
firePropertyChange(PROPERTY_REVERSE_SORT, oldValue, reverseSort);
}
public void setShowDecorator(Boolean showDecorator) {
Boolean oldValue = this.showDecorator;
this.showDecorator = showDecorator;
firePropertyChange(PROPERTY_SHOW_DECORATOR, oldValue, showDecorator);
}
public void setShowReset(Boolean showReset) {
Boolean oldValue = this.showReset;
this.showReset = showReset;
firePropertyChange(PROPERTY_SHOW_RESET, oldValue, showReset);
}
public void setShowSelectPopupEnabled(Boolean showSelectPopupEnabled) {
Boolean oldValue = this.showSelectPopupEnabled;
this.showSelectPopupEnabled = showSelectPopupEnabled;
firePropertyChange(PROPERTY_SHOW_SELECT_POPUP_ENABLED, oldValue, showSelectPopupEnabled);
}
public void setUseMultiSelect(Boolean useMultiSelect) {
Boolean oldValue = this.useMultiSelect;
this.useMultiSelect = useMultiSelect;
firePropertyChange(PROPERTY_USE_MULTI_SELECT, oldValue, useMultiSelect);
}
/*-----------------------------------------------------------------------*/
/*--------------------- Protected acessors methods ---------------------*/
/*-----------------------------------------------------------------------*/
protected JPanel get$JPanel0() {
return $JPanel0;
}
protected JPanel get$JPanel1() {
return $JPanel1;
}
protected JScrollPane get$JScrollPane0() {
return $JScrollPane0;
}
protected JScrollPane get$JScrollPane1() {
return $JScrollPane1;
}
protected JSeparator get$JSeparator0() {
return $JSeparator0;
}
/*-----------------------------------------------------------------------*/
/*--------------------- Components creation methods ---------------------*/
/*-----------------------------------------------------------------------*/
protected void addChildrenToFilterPanel() {
filterPanel.add($JPanel0, BorderLayout.WEST);
filterPanel.add(filterField, BorderLayout.CENTER);
filterPanel.add(toolbarRight, BorderLayout.EAST);
}
protected void addChildrenToPopup() {
popup.add(popupSortLabel);
popup.add(sortUp);
popup.add(sortDown);
popup.add(popupSeparator);
popup.add(popupLabel);
popup.add($JSeparator0);
}
protected void addChildrenToSelectedListPopup() {
selectedListPopup.add(selectedListMoveUpAction);
selectedListPopup.add(selectedListMoveDownAction);
selectedListPopup.add(selectedListRemoveAction);
}
protected void addChildrenToSortDown() {
{ ButtonGroup $buttonGroup = sortGroup; sortDown.putClientProperty("$buttonGroup", $buttonGroup); $buttonGroup.add(sortDown); }
}
protected void addChildrenToSortUp() {
{ ButtonGroup $buttonGroup = sortGroup; sortUp.putClientProperty("$buttonGroup", $buttonGroup); $buttonGroup.add(sortUp); }
}
protected void addChildrenToToolbarLeft() {
toolbarLeft.add(resetButton);
}
protected void addChildrenToToolbarRight() {
toolbarRight.add(changeDecorator);
}
protected void createAddButton() {
$objectMap.put("addButton", addButton = new JButton());
addButton.setName("addButton");
}
protected void createBean() {
$objectMap.put("bean", bean = null);
}
protected void createBeanType() {
$objectMap.put("beanType", beanType = null);
}
protected void createBeforeFilterPanel() {
$objectMap.put("beforeFilterPanel", beforeFilterPanel = new JPanel());
beforeFilterPanel.setName("beforeFilterPanel");
beforeFilterPanel.setLayout(new BorderLayout());
}
protected void createChangeDecorator() {
$objectMap.put("changeDecorator", changeDecorator = new JToggleButton());
changeDecorator.setName("changeDecorator");
changeDecorator.setFocusable(false);
changeDecorator.setToolTipText(t("beandoublelist.action.sort.tip"));
changeDecorator.setFocusPainted(false);
changeDecorator.addActionListener(JAXXUtil.getEventListener(ActionListener.class, "actionPerformed", this, "doActionPerformed__on__changeDecorator"));
}
protected void createFilterField() {
$objectMap.put("filterField", filterField = new JTextField());
filterField.setName("filterField");
filterField.setColumns(15);
}
protected void createFilterFieldLabel() {
$objectMap.put("filterFieldLabel", filterFieldLabel = new JLabel());
filterFieldLabel.setName("filterFieldLabel");
}
protected void createFilterPanel() {
$objectMap.put("filterPanel", filterPanel = new JPanel());
filterPanel.setName("filterPanel");
filterPanel.setLayout(new BorderLayout());
}
protected void createFilterable() {
$objectMap.put("filterable", filterable = true);
}
protected void createHighlightFilterText() {
$objectMap.put("highlightFilterText", highlightFilterText = false);
}
protected void createI18nPrefix() {
$objectMap.put("i18nPrefix", i18nPrefix = "beanlist.common.");
}
protected void createIndex() {
$objectMap.put("index", index = 0);
}
protected void createIndexes() {
$objectMap.put("indexes", indexes = new JAXXButtonGroup());
indexes.addChangeListener(JAXXUtil.getEventListener(ChangeListener.class, "stateChanged", this, "doStateChanged__on__indexes"));
}
protected void createModel() {
$objectMap.put("model", model = new BeanDoubleListModel());
}
protected void createPopup() {
$objectMap.put("popup", popup = new JPopupMenu());
popup.setName("popup");
popup.addPopupMenuListener(JAXXUtil.getEventListener(PopupMenuListener.class, "popupMenuCanceled", this, "doPopupMenuCanceled__on__popup"));
popup.addPopupMenuListener(JAXXUtil.getEventListener(PopupMenuListener.class, "popupMenuWillBecomeInvisible", this, "doPopupMenuWillBecomeInvisible__on__popup"));
}
protected void createPopupLabel() {
$objectMap.put("popupLabel", popupLabel = new JLabel());
popupLabel.setName("popupLabel");
}
protected void createPopupSeparator() {
$objectMap.put("popupSeparator", popupSeparator = new JSeparator());
popupSeparator.setName("popupSeparator");
}
protected void createPopupSortLabel() {
$objectMap.put("popupSortLabel", popupSortLabel = new JLabel());
popupSortLabel.setName("popupSortLabel");
popupSortLabel.setText(t("bean.sort.label"));
}
protected void createProperty() {
$objectMap.put("property", property = "");
}
protected void createRemoveButton() {
$objectMap.put("removeButton", removeButton = new JButton());
removeButton.setName("removeButton");
}
protected void createResetButton() {
$objectMap.put("resetButton", resetButton = new JButton());
resetButton.setName("resetButton");
resetButton.setFocusable(false);
resetButton.setToolTipText(t("beandoublelist.action.reset.tip"));
resetButton.setFocusPainted(false);
resetButton.addActionListener(JAXXUtil.getEventListener(ActionListener.class, "actionPerformed", this, "doActionPerformed__on__resetButton"));
}
protected void createReverseSort() {
$objectMap.put("reverseSort", reverseSort = false);
}
protected void createSelectedList() {
$objectMap.put("selectedList", selectedList = new JList());
selectedList.setName("selectedList");
selectedList.addMouseListener(JAXXUtil.getEventListener(MouseListener.class, "mouseClicked", this, "doMouseClicked__on__selectedList"));
}
protected void createSelectedListMoveDownAction() {
$objectMap.put("selectedListMoveDownAction", selectedListMoveDownAction = new JMenuItem());
selectedListMoveDownAction.setName("selectedListMoveDownAction");
selectedListMoveDownAction.setText(t("bean.action.selected.move.down"));
selectedListMoveDownAction.setToolTipText(t("bean.action.selected.move.down.tip"));
selectedListMoveDownAction.addActionListener(JAXXUtil.getEventListener(ActionListener.class, "actionPerformed", this, "doActionPerformed__on__selectedListMoveDownAction"));
}
protected void createSelectedListMoveUpAction() {
$objectMap.put("selectedListMoveUpAction", selectedListMoveUpAction = new JMenuItem());
selectedListMoveUpAction.setName("selectedListMoveUpAction");
selectedListMoveUpAction.setText(t("bean.action.selected.move.up"));
selectedListMoveUpAction.setToolTipText(t("bean.action.selected.move.up.tip"));
selectedListMoveUpAction.addActionListener(JAXXUtil.getEventListener(ActionListener.class, "actionPerformed", this, "doActionPerformed__on__selectedListMoveUpAction"));
}
protected void createSelectedListPopup() {
$objectMap.put("selectedListPopup", selectedListPopup = new JPopupMenu());
selectedListPopup.setName("selectedListPopup");
}
protected void createSelectedListRemoveAction() {
$objectMap.put("selectedListRemoveAction", selectedListRemoveAction = new JMenuItem());
selectedListRemoveAction.setName("selectedListRemoveAction");
selectedListRemoveAction.setText(t("bean.action.selected.remove"));
selectedListRemoveAction.setToolTipText(t("bean.action.selected.remove.tip"));
selectedListRemoveAction.addActionListener(JAXXUtil.getEventListener(ActionListener.class, "actionPerformed", this, "doActionPerformed__on__selectedListRemoveAction"));
}
protected void createShowDecorator() {
$objectMap.put("showDecorator", showDecorator = true);
}
protected void createShowReset() {
$objectMap.put("showReset", showReset = true);
}
protected void createShowSelectPopupEnabled() {
$objectMap.put("showSelectPopupEnabled", showSelectPopupEnabled = true);
}
protected void createSortDown() {
$objectMap.put("sortDown", sortDown = new JRadioButtonMenuItem());
sortDown.setName("sortDown");
sortDown.setText(t("bean.sort.down"));
}
protected void createSortGroup() {
$objectMap.put("sortGroup", sortGroup = new JAXXButtonGroup());
sortGroup.addChangeListener(JAXXUtil.getEventListener(ChangeListener.class, "stateChanged", this, "doStateChanged__on__sortGroup"));
}
protected void createSortUp() {
$objectMap.put("sortUp", sortUp = new JRadioButtonMenuItem());
sortUp.setName("sortUp");
sortUp.setText(t("bean.sort.up"));
}
protected void createToolbarLeft() {
$objectMap.put("toolbarLeft", toolbarLeft = new JToolBar());
toolbarLeft.setName("toolbarLeft");
toolbarLeft.setBorderPainted(false);
toolbarLeft.setFloatable(false);
}
protected void createToolbarRight() {
$objectMap.put("toolbarRight", toolbarRight = new JToolBar());
toolbarRight.setName("toolbarRight");
toolbarRight.setBorderPainted(false);
toolbarRight.setFloatable(false);
}
protected void createUniverseList() {
$objectMap.put("universeList", universeList = new JList());
universeList.setName("universeList");
universeList.addMouseListener(JAXXUtil.getEventListener(MouseListener.class, "mouseClicked", this, "doMouseClicked__on__universeList"));
}
protected void createUseMultiSelect() {
$objectMap.put("useMultiSelect", useMultiSelect = false);
}
/*-----------------------------------------------------------------------*/
/*------------------------ Internal jaxx methods ------------------------*/
/*-----------------------------------------------------------------------*/
protected void $initialize() {
if (log.isDebugEnabled()) {
log.debug(this);
}
$Table0 = this;
handler = new BeanDoubleListHandler<>();
handler.beforeInit(this);
$initialize_01_createComponents();
$initialize_02_registerDataBindings();
$initialize_03_finalizeCreateComponents();
$initialize_04_applyDataBindings();
$initialize_05_setProperties();
$initialize_06_finalizeInitialize();
handler.afterInit(this);
}
protected void $initialize_01_createComponents() {
if (log.isDebugEnabled()) {
log.debug(this);
}
$objectMap.put("$Table0", $Table0);
createFilterable();
createReverseSort();
createShowDecorator();
createShowReset();
createUseMultiSelect();
createShowSelectPopupEnabled();
createHighlightFilterText();
createBeanType();
createProperty();
createBean();
createI18nPrefix();
createModel();
createIndex();
createIndexes();
createSortGroup();
createPopup();
createPopupSortLabel();
createSortUp();
createSortDown();
createPopupSeparator();
createPopupLabel();
// inline creation of $JSeparator0
$objectMap.put("$JSeparator0", $JSeparator0 = new JSeparator());
$JSeparator0.setName("$JSeparator0");
createSelectedListPopup();
createSelectedListMoveUpAction();
createSelectedListMoveDownAction();
createSelectedListRemoveAction();
createBeforeFilterPanel();
createFilterPanel();
// inline creation of $JPanel0
$objectMap.put("$JPanel0", $JPanel0 = new JPanel());
$JPanel0.setName("$JPanel0");
$JPanel0.setLayout(new BorderLayout());
createFilterFieldLabel();
createToolbarLeft();
createResetButton();
createFilterField();
createToolbarRight();
createChangeDecorator();
// inline creation of $JScrollPane0
$objectMap.put("$JScrollPane0", $JScrollPane0 = new JScrollPane());
$JScrollPane0.setName("$JScrollPane0");
createUniverseList();
// inline creation of $JPanel1
$objectMap.put("$JPanel1", $JPanel1 = new JPanel());
$JPanel1.setName("$JPanel1");
$JPanel1.setLayout(new GridLayout(0,1));
createAddButton();
createRemoveButton();
// inline creation of $JScrollPane1
$objectMap.put("$JScrollPane1", $JScrollPane1 = new JScrollPane());
$JScrollPane1.setName("$JScrollPane1");
createSelectedList();
// inline creation of $Table0
setName("$Table0");
}
protected void $initialize_02_registerDataBindings() {
if (log.isDebugEnabled()) {
log.debug(this);
}
// register 15 data bindings
registerDataBinding(new SimpleJAXXObjectBinding(this, BINDING_SORT_UP_SELECTED, true ,"reverseSort") {
@Override
public void processDataBinding() {
sortUp.setSelected(!isReverseSort());
}
});
registerDataBinding(new SimpleJAXXObjectBinding(this, BINDING_SORT_DOWN_SELECTED, true ,"reverseSort") {
@Override
public void processDataBinding() {
sortDown.setSelected(isReverseSort());
}
});
registerDataBinding(new DefaultJAXXBinding(this, BINDING_SELECTED_LIST_MOVE_UP_ACTION_ENABLED, true, true) {
@Override
public void applyDataBinding() {
addPropertyChangeListener("model", this);
if (getModel() != null) {
getModel().addPropertyChangeListener("selectedUpEnabled", this);
}
}
@Override
public void processDataBinding() {
if (getModel() != null) {
selectedListMoveUpAction.setEnabled(getModel().isSelectedUpEnabled());
}
}
@Override
public void removeDataBinding() {
removePropertyChangeListener("model", this);
if (getModel() != null) {
getModel().removePropertyChangeListener("selectedUpEnabled", this);
}
}
});
registerDataBinding(new DefaultJAXXBinding(this, BINDING_SELECTED_LIST_MOVE_DOWN_ACTION_ENABLED, true, true) {
@Override
public void applyDataBinding() {
addPropertyChangeListener("model", this);
if (getModel() != null) {
getModel().addPropertyChangeListener("selectedDownEnabled", this);
}
}
@Override
public void processDataBinding() {
if (getModel() != null) {
selectedListMoveDownAction.setEnabled(getModel().isSelectedDownEnabled());
}
}
@Override
public void removeDataBinding() {
removePropertyChangeListener("model", this);
if (getModel() != null) {
getModel().removePropertyChangeListener("selectedDownEnabled", this);
}
}
});
registerDataBinding(new DefaultJAXXBinding(this, BINDING_SELECTED_LIST_REMOVE_ACTION_ENABLED, true, true) {
@Override
public void applyDataBinding() {
addPropertyChangeListener("model", this);
if (getModel() != null) {
getModel().addPropertyChangeListener("removeEnabled", this);
}
}
@Override
public void processDataBinding() {
if (getModel() != null) {
selectedListRemoveAction.setEnabled(getModel().isRemoveEnabled());
}
}
@Override
public void removeDataBinding() {
removePropertyChangeListener("model", this);
if (getModel() != null) {
getModel().removePropertyChangeListener("removeEnabled", this);
}
}
});
registerDataBinding(new SimpleJAXXObjectBinding(this, BINDING_FILTER_PANEL_VISIBLE, true ,"filterable") {
@Override
public void processDataBinding() {
filterPanel.setVisible(isFilterable());
}
});
registerDataBinding(new SimpleJAXXObjectBinding(this, BINDING_TOOLBAR_LEFT_VISIBLE, true ,"showReset") {
@Override
public void processDataBinding() {
toolbarLeft.setVisible(isShowReset());
}
});
registerDataBinding(new SimpleJAXXObjectBinding(this, BINDING_RESET_BUTTON_ENABLED, true ,"showReset" ,"enabled") {
@Override
public void processDataBinding() {
resetButton.setEnabled(isShowReset() && isEnabled());
}
});
registerDataBinding(new SimpleJAXXObjectBinding(this, BINDING_TOOLBAR_RIGHT_VISIBLE, true ,"showDecorator") {
@Override
public void processDataBinding() {
toolbarRight.setVisible(isShowDecorator());
}
});
registerDataBinding(new SimpleJAXXObjectBinding(this, BINDING_CHANGE_DECORATOR_ENABLED, true ,"showDecorator" ,"enabled") {
@Override
public void processDataBinding() {
changeDecorator.setEnabled(isShowDecorator() && isEnabled());
}
});
registerDataBinding(new DefaultJAXXBinding(this, BINDING_UNIVERSE_LIST_MODEL, true, true) {
@Override
public void applyDataBinding() {
addPropertyChangeListener("model", this);
if (getModel() != null) {
getModel().addPropertyChangeListener("universeModel", this);
}
}
@Override
public void processDataBinding() {
if (getModel() != null) {
universeList.setModel(getModel().getUniverseModel());
}
}
@Override
public void removeDataBinding() {
removePropertyChangeListener("model", this);
if (getModel() != null) {
getModel().removePropertyChangeListener("universeModel", this);
}
}
});
registerDataBinding(new DefaultJAXXBinding(this, BINDING_ADD_BUTTON_ENABLED, true, true) {
@Override
public void applyDataBinding() {
addPropertyChangeListener("model", this);
if (getModel() != null) {
getModel().addPropertyChangeListener("addEnabled", this);
}
}
@Override
public void processDataBinding() {
if (getModel() != null) {
addButton.setEnabled(getModel().isAddEnabled());
}
}
@Override
public void removeDataBinding() {
removePropertyChangeListener("model", this);
if (getModel() != null) {
getModel().removePropertyChangeListener("addEnabled", this);
}
}
});
registerDataBinding(new DefaultJAXXBinding(this, BINDING_REMOVE_BUTTON_ENABLED, true, true) {
@Override
public void applyDataBinding() {
addPropertyChangeListener("model", this);
if (getModel() != null) {
getModel().addPropertyChangeListener("removeEnabled", this);
}
}
@Override
public void processDataBinding() {
if (getModel() != null) {
removeButton.setEnabled(getModel().isRemoveEnabled());
}
}
@Override
public void removeDataBinding() {
removePropertyChangeListener("model", this);
if (getModel() != null) {
getModel().removePropertyChangeListener("removeEnabled", this);
}
}
});
registerDataBinding(new SimpleJAXXObjectBinding(this, BINDING_SELECTED_LIST_COMPONENT_POPUP_MENU, true ,"showSelectPopupEnabled") {
@Override
public void processDataBinding() {
selectedList.setComponentPopupMenu(handler.getSelectedListPopup(isShowSelectPopupEnabled()));
}
});
registerDataBinding(new DefaultJAXXBinding(this, BINDING_SELECTED_LIST_MODEL, true, true) {
@Override
public void applyDataBinding() {
addPropertyChangeListener("model", this);
if (getModel() != null) {
getModel().addPropertyChangeListener("selectedModel", this);
}
}
@Override
public void processDataBinding() {
if (getModel() != null) {
selectedList.setModel(getModel().getSelectedModel());
}
}
@Override
public void removeDataBinding() {
removePropertyChangeListener("model", this);
if (getModel() != null) {
getModel().removePropertyChangeListener("selectedModel", this);
}
}
});
}
protected void $initialize_03_finalizeCreateComponents() {
if (log.isDebugEnabled()) {
log.debug(this);
}
// inline complete setup of $Table0
add(beforeFilterPanel, new GridBagConstraints(0, 0, 3, 1, 0.0, 0.0, 10, 1, new Insets(3, 3, 3, 3), 0, 0));
add(filterPanel, new GridBagConstraints(0, 1, 3, 1, 0.0, 0.0, 10, 1, new Insets(3, 3, 3, 3), 0, 0));
add($JScrollPane0, new GridBagConstraints(0, 2, 1, 1, 0.5, 1.0, 10, 1, new Insets(3, 3, 3, 3), 0, 0));
add($JPanel1, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0, 11, 0, new Insets(3, 3, 3, 3), 0, 0));
add($JScrollPane1, new GridBagConstraints(2, 2, 1, 1, 0.5, 1.0, 10, 1, new Insets(3, 3, 3, 3), 0, 0));
addChildrenToPopup();
addChildrenToSortUp();
addChildrenToSortDown();
addChildrenToSelectedListPopup();
addChildrenToFilterPanel();
// inline complete setup of $JPanel0
$JPanel0.add(filterFieldLabel, BorderLayout.WEST);
$JPanel0.add(toolbarLeft, BorderLayout.EAST);
addChildrenToToolbarLeft();
addChildrenToToolbarRight();
// inline complete setup of $JScrollPane0
$JScrollPane0.getViewport().add(universeList);
// inline complete setup of $JPanel1
$JPanel1.add(addButton);
$JPanel1.add(removeButton);
// inline complete setup of $JScrollPane1
$JScrollPane1.getViewport().add(selectedList);
}
protected void $initialize_04_applyDataBindings() {
if (log.isDebugEnabled()) {
log.debug(this);
}
// apply 15 data bindings
JAXXUtil.applyDataBinding(this, $bindings.keySet());
}
protected void $initialize_05_setProperties() {
if (log.isDebugEnabled()) {
log.debug(this);
}
// apply 16 property setters
popup.setBorder(new TitledBorder(t("beandoublelist.popup.title")));
popupSortLabel.setIcon(SwingUtil.getUIManagerActionIcon("bean-sort"));
sortUp.setIcon(SwingUtil.getUIManagerActionIcon("bean-sort-up"));
{ sortUp.putClientProperty("$value", false); Object $buttonGroup = sortUp.getClientProperty("$buttonGroup"); if ($buttonGroup instanceof JAXXButtonGroup) { ((JAXXButtonGroup) $buttonGroup).updateSelectedValue(); } }
sortDown.setIcon(SwingUtil.getUIManagerActionIcon("bean-sort-down"));
{ sortDown.putClientProperty("$value", true); Object $buttonGroup = sortDown.getClientProperty("$buttonGroup"); if ($buttonGroup instanceof JAXXButtonGroup) { ((JAXXButtonGroup) $buttonGroup).updateSelectedValue(); } }
selectedListMoveUpAction.setIcon(SwingUtil.getUIManagerActionIcon("bean-doublelist-up"));
selectedListMoveDownAction.setIcon(SwingUtil.getUIManagerActionIcon("bean-doublelist-down"));
selectedListRemoveAction.setIcon(SwingUtil.getUIManagerActionIcon("bean-doublelist-unselect"));
filterFieldLabel.setIcon(SwingUtil.getUIManagerActionIcon("filter"));
resetButton.setIcon(SwingUtil.getUIManagerActionIcon("doublelist-reset"));
changeDecorator.setIcon(SwingUtil.getUIManagerActionIcon("doublelist-sort"));// late initializer
BeanDoubleListAddAction.init(this, addButton, BeanDoubleListAddAction.class);
BeanDoubleListRemoveAction.init(this, removeButton, BeanDoubleListRemoveAction.class);
}
protected void $initialize_06_finalizeInitialize() {
if (log.isDebugEnabled()) {
log.debug(this);
}
}
}