Jaxx-commits
Threads by month
- ----- 2026 -----
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
September 2010
- 3 participants
- 46 discussions
r2071 - in trunk/jaxx-widgets/src/main: java/jaxx/runtime/swing/editor/bean resources/icons
by tchemit@users.nuiton.org 07 Sep '10
by tchemit@users.nuiton.org 07 Sep '10
07 Sep '10
Author: tchemit
Date: 2010-09-07 12:45:13 +0200 (Tue, 07 Sep 2010)
New Revision: 2071
Url: http://nuiton.org/repositories/revision/jaxx/2071
Log:
improve bean editors + add missing icons
Added:
trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/bean/BeanUIUtil.java
trunk/jaxx-widgets/src/main/resources/icons/action-combobox-reset.png
trunk/jaxx-widgets/src/main/resources/icons/action-combobox-sort.png
Modified:
trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/bean/BeanComboBox.jaxx
trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/bean/BeanComboBoxHandler.java
trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/bean/BeanListHeader.jaxx
trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/bean/BeanListHeaderHandler.java
Modified: trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/bean/BeanComboBox.jaxx
===================================================================
--- trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/bean/BeanComboBox.jaxx 2010-09-07 10:44:52 UTC (rev 2070)
+++ trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/bean/BeanComboBox.jaxx 2010-09-07 10:45:13 UTC (rev 2071)
@@ -27,6 +27,11 @@
onFocusGained='combobox.requestFocus()'
onFocusLost='hidePopup()'>
+ <import>
+ static org.nuiton.i18n.I18n.n_
+ jaxx.runtime.decorator.JXPathDecorator
+ </import>
+
<!-- auto complete property -->
<Boolean id='autoComplete' javaBean='false'/>
@@ -97,15 +102,6 @@
</JPopupMenu>
<script><![CDATA[
-import static org.nuiton.i18n.I18n.n_;
-import jaxx.runtime.decorator.JXPathDecorator;
-
-public static final String DEFAULT_POPUP_LABEL = n_("bean.popup.label");
-
-public static final String DEFAULT_SELECTED_TOOLTIP = n_("bean.sort.on");
-
-public static final String DEFAULT_NOT_SELECTED_TOOLTIP = n_("bean.sort.off");
-
public void init(JXPathDecorator<O> decorator, java.util.List<O> data) {
handler.init(decorator, data);
}
Modified: trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/bean/BeanComboBoxHandler.java
===================================================================
--- trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/bean/BeanComboBoxHandler.java 2010-09-07 10:44:52 UTC (rev 2070)
+++ trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/bean/BeanComboBoxHandler.java 2010-09-07 10:45:13 UTC (rev 2071)
@@ -26,7 +26,6 @@
package jaxx.runtime.swing.editor.bean;
import jaxx.runtime.SwingUtil;
-import jaxx.runtime.decorator.Decorator;
import jaxx.runtime.decorator.DecoratorUtils;
import jaxx.runtime.decorator.JXPathDecorator;
import jaxx.runtime.decorator.MultiJXPathDecorator;
@@ -35,32 +34,20 @@
import org.apache.commons.beanutils.PropertyUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.jdesktop.swingx.autocomplete.AutoCompleteDecorator;
-import org.jdesktop.swingx.autocomplete.AutoCompletePropertyChangeListener;
import org.jdesktop.swingx.autocomplete.ObjectToStringConverter;
-import javax.swing.JComboBox;
+import javax.swing.JComponent;
import javax.swing.JPopupMenu;
-import javax.swing.JRadioButtonMenuItem;
-import javax.swing.JToggleButton;
-import javax.swing.SwingUtilities;
import javax.swing.text.Document;
import javax.swing.text.JTextComponent;
-import java.awt.Component;
-import java.awt.Dimension;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
-import java.beans.Introspector;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.beans.PropertyDescriptor;
import java.lang.reflect.Method;
-import java.util.Date;
import java.util.List;
-import static org.nuiton.i18n.I18n._;
-import static org.nuiton.i18n.I18n.n_;
-
/**
* Le handler d'un {@link BeanComboBox}.
* <p/>
@@ -74,14 +61,6 @@
public static final Log log = LogFactory.getLog(BeanComboBoxHandler.class);
- public static final String SELECTED_ITEM_PROPERTY = "selectedItem";
-
- public static final String INDEX_PROPERTY = "index";
-
- public static final String AUTO_COMPLETE_PROPERTY = "autoComplete";
-
- public static final String DATA_PROPERTY = "data";
-
/** ui if the handler */
protected BeanComboBox<O> ui;
@@ -118,6 +97,19 @@
}
};
+ private final BeanUIUtil.PopupHandler popupHandler = new BeanUIUtil.PopupHandler() {
+
+ @Override
+ public JPopupMenu getPopup() {
+ return ui.getPopup();
+ }
+
+ @Override
+ public JComponent getInvoker() {
+ return ui.getChangeDecorator();
+ }
+ };
+
/**
* Initialise le handler de l'ui
*
@@ -130,36 +122,30 @@
throw new IllegalStateException("can not init the handler twice");
}
init = true;
- if (decorator == null) {
- throw new NullPointerException("can not have a null decorator as parameter");
- }
JAXXButtonGroup indexes = ui.getIndexes();
- MultiJXPathDecorator<O> d;
- if (decorator instanceof MultiJXPathDecorator<?>) {
- // should clone decorator ?
- d = (MultiJXPathDecorator<O>) decorator;
- } else {
- d = DecoratorUtils.newMultiJXPathDecorator(
- decorator.getInternalClass(),
- decorator.getInitialExpression(),
- "??" + new Date().getTime(),
- " - ");
- }
- this.decorator = d;
+ this.decorator = BeanUIUtil.createDecorator(decorator);
// init combobox renderer base on given decorator
- ui.getCombobox().setRenderer(new DecoratorListCellRenderer(d));
+ ui.getCombobox().setRenderer(new DecoratorListCellRenderer(this.decorator));
- convertor = newDecoratedObjectToStringConverter(d);
+ convertor = BeanUIUtil.newDecoratedObjectToStringConverter(this.decorator);
// keep a trace of original document (to make possible reverse autom-complete)
JTextComponent editorComponent = (JTextComponent) ui.getCombobox().getEditor().getEditorComponent();
originalDocument = editorComponent.getDocument();
// build popup
- preparePopup(d);
+ popupHandler.preparePopup(ui.getSelectedToolTipText(),
+ ui.getNotSelectedToolTipText(),
+ ui.getI18nPrefix(),
+ ui.getPopupTitleText(),
+ indexes,
+ ui.getPopupLabel(),
+ ui.getSortUp(),
+ ui.getSortDown(),
+ this.decorator);
ui.autoComplete = true;
@@ -174,43 +160,9 @@
/** Toggle the popup visible state. */
public void togglePopup() {
- boolean newValue = !ui.getPopup().isVisible();
-
- if (log.isTraceEnabled()) {
- log.trace(newValue);
- }
-
- if (!newValue) {
- if (ui.getPopup() != null) {
- ui.getPopup().setVisible(false);
- }
- return;
- }
- SwingUtilities.invokeLater(new Runnable() {
-
- @Override
- public void run() {
-
- updatePopup();
-
- Dimension dim = ui.getPopup().getPreferredSize();
- JToggleButton invoker = ui.getChangeDecorator();
- ui.getPopup().show(
- invoker,
- (int) (invoker.getPreferredSize().getWidth() - dim.getWidth()),
- invoker.getHeight()
- );
- }
- });
+ popupHandler.togglePopup();
}
-
- protected void updatePopup() {
- JPopupMenu popup = ui.getPopup();
- popup.pack();
-
- }
-
/**
* Modifie l'état autoComplete de l'ui.
*
@@ -220,7 +172,7 @@
protected void setAutoComplete(Boolean oldValue, Boolean newValue) {
oldValue = oldValue != null && oldValue;
newValue = newValue != null && newValue;
- if (oldValue == newValue) {
+ if (oldValue.equals(newValue)) {
return;
}
if (log.isDebugEnabled()) {
@@ -229,9 +181,9 @@
if (!newValue) {
JTextComponent editorComponent = (JTextComponent) ui.getCombobox().getEditor().getEditorComponent();
editorComponent.removeFocusListener(EDITOR_TEXT_COMP0NENT_FOCUSLISTENER);
- undecorate(ui.getCombobox(), originalDocument);
+ BeanUIUtil.undecorate(ui.getCombobox(), originalDocument);
} else {
- decorate(ui.getCombobox(), convertor);
+ BeanUIUtil.decorate(ui.getCombobox(), convertor);
JTextComponent editorComponent = (JTextComponent) ui.getCombobox().getEditor().getEditorComponent();
editorComponent.addFocusListener(EDITOR_TEXT_COMP0NENT_FOCUSLISTENER);
}
@@ -250,7 +202,7 @@
if (log.isDebugEnabled()) {
log.debug("check state : <" + oldValue + " to " + newValue + ">");
}
- updateComboBox(newValue, ui.isReverseSort());
+ updateUI(newValue, ui.isReverseSort());
}
/**
@@ -269,11 +221,11 @@
log.debug("check state : <" + oldValue + " to " + newValue + ">");
}
- updateComboBox(ui.getIndex(), newValue);
+ updateUI(ui.getIndex(), newValue);
}
@SuppressWarnings({"unchecked"})
- protected void updateComboBox(int index, boolean reversesort) {
+ protected void updateUI(int index, boolean reversesort) {
// change decorator context
decorator.setContextIndex(index);
@@ -301,10 +253,8 @@
reversesort
);
- } catch (Exception e) {
- log.warn(e.getMessage(), e);
- //System.out.println("newValue :: "+decorator+" : "+newValue);
- //System.out.println("datas :: "+ui.getData());
+ } catch (Exception eee) {
+ log.warn(eee.getMessage(), eee);
}
// reload the model
@@ -370,73 +320,6 @@
return decorator;
}
- /**
- * Creation de l'ui pour modifier le décorateur.
- *
- * @param decorator le decorateur a utiliser
- */
- protected void preparePopup(MultiJXPathDecorator<?> decorator) {
- String selectedTip = ui.getSelectedToolTipText();
- if (selectedTip == null) {
- // use default selected tip text
- selectedTip = BeanComboBox.DEFAULT_SELECTED_TOOLTIP;
- }
- String notSelectedTip = ui.getNotSelectedToolTipText();
- if (notSelectedTip == null) {
- // use default selected tip text
- notSelectedTip = BeanComboBox.DEFAULT_NOT_SELECTED_TOOLTIP;
- }
- JPopupMenu popup = ui.getPopup();
-
- //Container container = ui.getIndexesContainer();
- for (int i = 0, max = decorator.getNbContext(); i < max; i++) {
- String property = ui.getI18nPrefix() + decorator.getProperty(i);
- String propertyI18n = _(property);
- JRadioButtonMenuItem button = new JRadioButtonMenuItem(propertyI18n);
- button.putClientProperty(JAXXButtonGroup.BUTTON8GROUP_CLIENT_PROPERTY, ui.getIndexes());
- button.putClientProperty(JAXXButtonGroup.VALUE_CLIENT_PROPERTY, i);
- popup.add(button);
- if (selectedTip != null) {
- button.putClientProperty(JAXXButtonGroup.SELECTED_TIP_CLIENT_PROPERTY, _(selectedTip, propertyI18n));
- }
- if (notSelectedTip != null) {
- button.putClientProperty(JAXXButtonGroup.NOT_SELECTED_TIP_CLIENT_PROPERTY, _(notSelectedTip, propertyI18n));
- }
- button.setSelected(false);
- ui.getIndexes().add(button);
- }
- String title = ui.getPopupTitleText();
- if (title == null) {
- // use default popup title
- title = BeanComboBox.DEFAULT_POPUP_LABEL;
-
- Class<?> internalClass = decorator.getInternalClass();
- String beanI18nKey;
- if (internalClass == null) {
- beanI18nKey = n_("bean.unknown.type");
- } else {
- beanI18nKey = ui.getI18nPrefix() + Introspector.decapitalize(internalClass.getSimpleName());
- }
- String beanI18n = _(beanI18nKey);
- title = _(title, beanI18n);
- } else {
- title = _(title);
- }
-
-
- ui.getSortDown().putClientProperty(JAXXButtonGroup.SELECTED_TIP_CLIENT_PROPERTY, _("bean.sort.down.tip"));
- ui.getSortDown().putClientProperty(JAXXButtonGroup.NOT_SELECTED_TIP_CLIENT_PROPERTY, _("bean.sort.down.toSelect.tip"));
-
- ui.getSortUp().putClientProperty(JAXXButtonGroup.SELECTED_TIP_CLIENT_PROPERTY, _("bean.sort.up.tip"));
- ui.getSortUp().putClientProperty(JAXXButtonGroup.NOT_SELECTED_TIP_CLIENT_PROPERTY, _("bean.sort.up.toSelect.tip"));
-
- ui.getPopupLabel().setText(title);
- ui.getPopup().setLabel(title);
- ui.getPopup().invalidate();
-
-
- }
-
public Class<?> getTargetClass() {
Method m = getMutator();
return m == null ? null : m.getParameterTypes()[0];
@@ -466,61 +349,6 @@
return mutator;
}
- /**
- * Encapsule un {@link Decorator} dans un {@link ObjectToStringConverter}.
- *
- * @param decorator le decorateur a encapsuler.
- * @return le converter encapsule dans un {@link ObjectToStringConverter}
- */
- public static ObjectToStringConverter newDecoratedObjectToStringConverter(final Decorator<?> decorator) {
-
- return new ObjectToStringConverter() {
-
- @Override
- public String getPreferredStringForItem(Object item) {
- return item instanceof String ? (String) item : item == null ? "" : decorator.toString(item);
- }
- };
- }
-
- /**
- * Ajout l'auto-complétion sur une liste déroulante, en utilisant le
- * converteur donné pour afficher les données.
- *
- * @param combo la combo à décorer
- * @param convertor le converter utilisé pour afficher les données.
- */
- public static void decorate(JComboBox combo, ObjectToStringConverter convertor) {
-
- AutoCompleteDecorator.decorate(combo, convertor);
- }
-
- /**
- * Désactive l'aut-complétion sur une liste déroulante, en y repositionnant
- * le modèle du document d'édition d'avant auto-complétion.
- *
- * @param combo la liste déroulante à décorer
- * @param originalDocument le document original de l'édtieur de la
- * liste déroulante.
- */
- public static void undecorate(JComboBox combo, Document originalDocument) {
-
- // has not to be editable
- combo.setEditable(false);
-
- // configure the text component=editor component
- Component c = combo.getEditor().getEditorComponent();
- JTextComponent editorComponent = (JTextComponent) c;
- editorComponent.setDocument(originalDocument);
- editorComponent.setText(null);
- //remove old property change listener
- for (PropertyChangeListener l : c.getPropertyChangeListeners("editor")) {
- if (l instanceof AutoCompletePropertyChangeListener) {
- c.removePropertyChangeListener("editor", l);
- }
- }
- }
-
@Override
public void propertyChange(PropertyChangeEvent evt) {
String propertyName = evt.getPropertyName();
Modified: trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/bean/BeanListHeader.jaxx
===================================================================
--- trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/bean/BeanListHeader.jaxx 2010-09-07 10:44:52 UTC (rev 2070)
+++ trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/bean/BeanListHeader.jaxx 2010-09-07 10:45:13 UTC (rev 2071)
@@ -99,12 +99,6 @@
<script><![CDATA[
-public static final String DEFAULT_POPUP_LABEL = n_("bean.popup.label");
-
-public static final String DEFAULT_SELECTED_TOOLTIP = n_("bean.sort.on");
-
-public static final String DEFAULT_NOT_SELECTED_TOOLTIP = n_("bean.sort.off");
-
public void init(JXPathDecorator<O> decorator, java.util.List<O> data) {
handler.init(decorator, data);
}
Modified: trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/bean/BeanListHeaderHandler.java
===================================================================
--- trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/bean/BeanListHeaderHandler.java 2010-09-07 10:44:52 UTC (rev 2070)
+++ trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/bean/BeanListHeaderHandler.java 2010-09-07 10:45:13 UTC (rev 2071)
@@ -35,20 +35,12 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import javax.swing.JComponent;
import javax.swing.JPopupMenu;
-import javax.swing.JRadioButtonMenuItem;
-import javax.swing.JToggleButton;
-import javax.swing.SwingUtilities;
-import java.awt.Dimension;
-import java.beans.Introspector;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
-import java.util.Date;
import java.util.List;
-import static org.nuiton.i18n.I18n._;
-import static org.nuiton.i18n.I18n.n_;
-
/**
* Le handler d'un {@link BeanListHeader}.
* <p/>
@@ -72,6 +64,19 @@
protected boolean init;
+ private final BeanUIUtil.PopupHandler popupHandler = new BeanUIUtil.PopupHandler() {
+
+ @Override
+ public JPopupMenu getPopup() {
+ return ui.getPopup();
+ }
+
+ @Override
+ public JComponent getInvoker() {
+ return ui.getChangeDecorator();
+ }
+ };
+
public BeanListHeaderHandler(BeanListHeader<O> ui) {
this.ui = ui;
}
@@ -88,33 +93,24 @@
throw new IllegalStateException("can not init the handler twice");
}
init = true;
- if (decorator == null) {
- throw new NullPointerException(
- "can not have a null decorator as parameter");
- }
JAXXButtonGroup indexes = ui.getIndexes();
- MultiJXPathDecorator<O> d;
- if (decorator instanceof MultiJXPathDecorator<?>) {
+ this.decorator = BeanUIUtil.createDecorator(decorator);
- // should clone decorator ?
- d = (MultiJXPathDecorator<O>) decorator;
- } else {
- d = DecoratorUtils.newMultiJXPathDecorator(
- decorator.getInternalClass(),
- decorator.getInitialExpression(),
- "??" + new Date().getTime(),
- " - "
- );
- }
- this.decorator = d;
-
// init combobox renderer base on given decorator
- ui.getList().setCellRenderer(new DecoratorListCellRenderer(d));
+ ui.getList().setCellRenderer(new DecoratorListCellRenderer(this.decorator));
// build popup
- preparePopup(d);
+ popupHandler.preparePopup(ui.getSelectedToolTipText(),
+ ui.getNotSelectedToolTipText(),
+ ui.getI18nPrefix(),
+ ui.getPopupTitleText(),
+ indexes,
+ ui.getPopupLabel(),
+ ui.getSortUp(),
+ ui.getSortDown(),
+ this.decorator);
ui.addPropertyChangeListener(this);
@@ -127,42 +123,9 @@
/** Toggle the popup visible state. */
public void togglePopup() {
- boolean newValue = !ui.getPopup().isVisible();
-
- if (log.isTraceEnabled()) {
- log.trace(newValue);
- }
-
- if (!newValue) {
- if (ui.getPopup() != null) {
- ui.getPopup().setVisible(false);
- }
- return;
- }
- SwingUtilities.invokeLater(new Runnable() {
-
- @Override
- public void run() {
-
- updatePopup();
-
- Dimension dim = ui.getPopup().getPreferredSize();
- JToggleButton invoker = ui.getChangeDecorator();
- ui.getPopup().show(
- invoker,
- (int) (invoker.getPreferredSize().getWidth() - dim.getWidth()),
- invoker.getHeight()
- );
- }
- });
+ popupHandler.togglePopup();
}
- protected void updatePopup() {
- JPopupMenu popup = ui.getPopup();
- popup.pack();
-
- }
-
/**
* Modifie l'index du décorateur
*
@@ -176,7 +139,7 @@
if (log.isDebugEnabled()) {
log.debug("check state : <" + oldValue + " to " + newValue + ">");
}
- updateComboBox(newValue, ui.isReverseSort());
+ updateUI(newValue, ui.isReverseSort());
}
/**
@@ -195,17 +158,20 @@
log.debug("check state : <" + oldValue + " to " + newValue + ">");
}
- updateComboBox(ui.getIndex(), newValue);
+ updateUI(ui.getIndex(), newValue);
}
@SuppressWarnings({"unchecked"})
- protected void updateComboBox(int index, boolean reverseSort) {
+ protected void updateUI(int index, boolean reverseSort) {
// change decorator context
decorator.setContextIndex(index);
String expression = decorator.getExpression();
- log.info("will use expression (index = " + index + ") : " + expression);
+ if (log.isDebugEnabled()) {
+ log.debug("will use expression (index = " + index + ") : " +
+ expression);
+ }
// get the current selection in list
Object[] selection = ui.getList().getSelectedValues();
@@ -254,71 +220,6 @@
return decorator;
}
- /**
- * Creation de l'ui pour modifier le décorateur.
- *
- * @param decorator le decorateur a utiliser
- */
- protected void preparePopup(MultiJXPathDecorator<?> decorator) {
- String selectedTip = ui.getSelectedToolTipText();
- if (selectedTip == null) {
- // use default selected tip text
- selectedTip = BeanListHeader.DEFAULT_SELECTED_TOOLTIP;
- }
- String notSelectedTip = ui.getNotSelectedToolTipText();
- if (notSelectedTip == null) {
- // use default selected tip text
- notSelectedTip = BeanListHeader.DEFAULT_NOT_SELECTED_TOOLTIP;
- }
- JPopupMenu popup = ui.getPopup();
-
- //Container container = ui.getIndexesContainer();
- for (int i = 0, max = decorator.getNbContext(); i < max; i++) {
- String property = ui.getI18nPrefix() + decorator.getProperty(i);
- String propertyI18n = _(property);
- JRadioButtonMenuItem button = new JRadioButtonMenuItem(propertyI18n);
- button.putClientProperty(JAXXButtonGroup.BUTTON8GROUP_CLIENT_PROPERTY, ui.getIndexes());
- button.putClientProperty(JAXXButtonGroup.VALUE_CLIENT_PROPERTY, i);
- popup.add(button);
- if (selectedTip != null) {
- button.putClientProperty(JAXXButtonGroup.SELECTED_TIP_CLIENT_PROPERTY, _(selectedTip, propertyI18n));
- }
- if (notSelectedTip != null) {
- button.putClientProperty(JAXXButtonGroup.NOT_SELECTED_TIP_CLIENT_PROPERTY, _(notSelectedTip, propertyI18n));
- }
- button.setSelected(false);
- ui.getIndexes().add(button);
- }
- String title = ui.getPopupTitleText();
- if (title == null) {
- // use default popup title
- title = BeanListHeader.DEFAULT_POPUP_LABEL;
-
- Class<O> internalClass = ui.getBeanType();
- String beanI18nKey;
- if (internalClass == null) {
- beanI18nKey = n_("bean.unknown.type");
- } else {
- beanI18nKey = ui.getI18nPrefix() +
- Introspector.decapitalize(internalClass.getSimpleName());
- }
- String beanI18n = _(beanI18nKey);
- title = _(title, beanI18n);
- } else {
- title = _(title);
- }
-
- ui.getSortDown().putClientProperty(JAXXButtonGroup.SELECTED_TIP_CLIENT_PROPERTY, _("bean.sort.down.tip"));
- ui.getSortDown().putClientProperty(JAXXButtonGroup.NOT_SELECTED_TIP_CLIENT_PROPERTY, _("bean.sort.down.toSelect.tip"));
-
- ui.getSortUp().putClientProperty(JAXXButtonGroup.SELECTED_TIP_CLIENT_PROPERTY, _("bean.sort.up.tip"));
- ui.getSortUp().putClientProperty(JAXXButtonGroup.NOT_SELECTED_TIP_CLIENT_PROPERTY, _("bean.sort.up.toSelect.tip"));
-
- ui.getPopupLabel().setText(title);
- ui.getPopup().setLabel(title);
- ui.getPopup().invalidate();
- }
-
@Override
public void propertyChange(PropertyChangeEvent evt) {
String propertyName = evt.getPropertyName();
Added: trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/bean/BeanUIUtil.java
===================================================================
--- trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/bean/BeanUIUtil.java (rev 0)
+++ trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/bean/BeanUIUtil.java 2010-09-07 10:45:13 UTC (rev 2071)
@@ -0,0 +1,266 @@
+/*
+ * #%L
+ * JAXX :: Widgets
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2008 - 2010 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
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+package jaxx.runtime.swing.editor.bean;
+
+import jaxx.runtime.decorator.Decorator;
+import jaxx.runtime.decorator.DecoratorUtils;
+import jaxx.runtime.decorator.JXPathDecorator;
+import jaxx.runtime.decorator.MultiJXPathDecorator;
+import jaxx.runtime.swing.JAXXButtonGroup;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jdesktop.swingx.autocomplete.AutoCompleteDecorator;
+import org.jdesktop.swingx.autocomplete.AutoCompletePropertyChangeListener;
+import org.jdesktop.swingx.autocomplete.ObjectToStringConverter;
+
+import javax.swing.AbstractButton;
+import javax.swing.ButtonGroup;
+import javax.swing.JComboBox;
+import javax.swing.JComponent;
+import javax.swing.JLabel;
+import javax.swing.JPopupMenu;
+import javax.swing.JRadioButtonMenuItem;
+import javax.swing.SwingUtilities;
+import javax.swing.text.Document;
+import javax.swing.text.JTextComponent;
+import java.awt.Component;
+import java.awt.Dimension;
+import java.beans.Introspector;
+import java.beans.PropertyChangeListener;
+import java.util.Date;
+
+import static org.nuiton.i18n.I18n._;
+import static org.nuiton.i18n.I18n.n_;
+
+/**
+ * Class with usefull methods used in bean uis.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 2.2
+ */
+public class BeanUIUtil {
+
+ public static final String DEFAULT_POPUP_LABEL = n_("bean.popup.label");
+
+ public static final String DEFAULT_SELECTED_TOOLTIP = n_("bean.sort.on");
+
+ public static final String DEFAULT_NOT_SELECTED_TOOLTIP = n_("bean.sort.off");
+
+ /**
+ * Encapsule un {@link Decorator} dans un {@link ObjectToStringConverter}.
+ *
+ * @param decorator le decorateur a encapsuler.
+ * @return le converter encapsule dans un {@link ObjectToStringConverter}
+ */
+ public static ObjectToStringConverter newDecoratedObjectToStringConverter(final Decorator<?> decorator) {
+
+ return new ObjectToStringConverter() {
+
+ @Override
+ public String getPreferredStringForItem(Object item) {
+ return item instanceof String ? (String) item : item == null ? "" : decorator.toString(item);
+ }
+ };
+ }
+
+ /**
+ * Ajout l'auto-complétion sur une liste déroulante, en utilisant le
+ * converteur donné pour afficher les données.
+ *
+ * @param combo la combo à décorer
+ * @param convertor le converter utilisé pour afficher les données.
+ */
+ public static void decorate(JComboBox combo, ObjectToStringConverter convertor) {
+
+ AutoCompleteDecorator.decorate(combo, convertor);
+ }
+
+ /**
+ * Désactive l'aut-complétion sur une liste déroulante, en y repositionnant
+ * le modèle du document d'édition d'avant auto-complétion.
+ *
+ * @param combo la liste déroulante à décorer
+ * @param originalDocument le document original de l'édtieur de la
+ * liste déroulante.
+ */
+ public static void undecorate(JComboBox combo, Document originalDocument) {
+
+ // has not to be editable
+ combo.setEditable(false);
+
+ // configure the text component=editor component
+ Component c = combo.getEditor().getEditorComponent();
+ JTextComponent editorComponent = (JTextComponent) c;
+ editorComponent.setDocument(originalDocument);
+ editorComponent.setText(null);
+ //remove old property change listener
+ for (PropertyChangeListener l : c.getPropertyChangeListeners("editor")) {
+ if (l instanceof AutoCompletePropertyChangeListener) {
+ c.removePropertyChangeListener("editor", l);
+ }
+ }
+ }
+
+ public static <O> MultiJXPathDecorator<O> createDecorator(JXPathDecorator<O> decorator) {
+ if (decorator == null) {
+ throw new NullPointerException(
+ "can not have a null decorator as parameter");
+ }
+ String separator;
+ String separatorReplacement;
+
+ if (decorator instanceof MultiJXPathDecorator<?>) {
+
+ separator = ((MultiJXPathDecorator<?>) decorator).getSeparator();
+ separatorReplacement = ((MultiJXPathDecorator<?>) decorator).getSeparatorReplacement();
+
+ } else {
+
+ separator = "??" + new Date().getTime();
+ separatorReplacement = " - ";
+ }
+
+ return DecoratorUtils.newMultiJXPathDecorator(
+ decorator.getInternalClass(),
+ decorator.getInitialExpression(),
+ separator,
+ separatorReplacement
+ );
+ }
+
+ public static abstract class PopupHandler implements Runnable {
+
+ public static final Log log = LogFactory.getLog(PopupHandler.class);
+
+ public abstract JPopupMenu getPopup();
+
+ public abstract JComponent getInvoker();
+
+ @Override
+ public void run() {
+
+ updatePopup();
+
+ Dimension dim = getPopup().getPreferredSize();
+
+ JComponent invoker = getInvoker();
+ getPopup().show(
+ invoker,
+ (int) (invoker.getPreferredSize().getWidth() - dim.getWidth()),
+ invoker.getHeight()
+ );
+ }
+
+ /** Toggle the popup visible state. */
+ public void togglePopup() {
+ boolean newValue = !getPopup().isVisible();
+
+ if (log.isTraceEnabled()) {
+ log.trace(newValue);
+ }
+
+ if (!newValue) {
+ if (getPopup() != null) {
+ getPopup().setVisible(false);
+ }
+ return;
+ }
+ SwingUtilities.invokeLater(this);
+ }
+
+ protected void updatePopup() {
+ getPopup().pack();
+ }
+
+ /**
+ * Creation de l'ui pour modifier le décorateur.
+ *
+ * @param decorator le decorateur a utiliser
+ */
+ protected void preparePopup(String selectedTip,
+ String notSelectedTip,
+ String i18nPrefix,
+ String title,
+ ButtonGroup indexes,
+ JLabel popupLabel,
+ AbstractButton sortUp,
+ AbstractButton sortDown,
+ MultiJXPathDecorator<?> decorator) {
+ if (selectedTip == null) {
+ // use default selected tip text
+ selectedTip = DEFAULT_SELECTED_TOOLTIP;
+ }
+ if (notSelectedTip == null) {
+ // use default selected tip text
+ notSelectedTip = DEFAULT_NOT_SELECTED_TOOLTIP;
+ }
+ JPopupMenu popup = getPopup();
+
+ //Container container = ui.getIndexesContainer();
+ for (int i = 0, max = decorator.getNbContext(); i < max; i++) {
+ String property = i18nPrefix + decorator.getProperty(i);
+ String propertyI18n = _(property);
+ JRadioButtonMenuItem button = new JRadioButtonMenuItem(propertyI18n);
+ button.putClientProperty(JAXXButtonGroup.BUTTON8GROUP_CLIENT_PROPERTY, indexes);
+ button.putClientProperty(JAXXButtonGroup.VALUE_CLIENT_PROPERTY, i);
+ popup.add(button);
+ if (selectedTip != null) {
+ button.putClientProperty(JAXXButtonGroup.SELECTED_TIP_CLIENT_PROPERTY, _(selectedTip, propertyI18n));
+ }
+ if (notSelectedTip != null) {
+ button.putClientProperty(JAXXButtonGroup.NOT_SELECTED_TIP_CLIENT_PROPERTY, _(notSelectedTip, propertyI18n));
+ }
+ button.setSelected(false);
+ indexes.add(button);
+ }
+ if (title == null) {
+ // use default popup title
+ title = DEFAULT_POPUP_LABEL;
+
+ Class<?> internalClass = decorator.getInternalClass();
+ String beanI18nKey;
+ if (internalClass == null) {
+ beanI18nKey = n_("bean.unknown.type");
+ } else {
+ beanI18nKey = i18nPrefix + Introspector.decapitalize(internalClass.getSimpleName());
+ }
+ String beanI18n = _(beanI18nKey);
+ title = _(title, beanI18n);
+ } else {
+ title = _(title);
+ }
+
+ sortDown.putClientProperty(JAXXButtonGroup.SELECTED_TIP_CLIENT_PROPERTY, _("bean.sort.down.tip"));
+ sortDown.putClientProperty(JAXXButtonGroup.NOT_SELECTED_TIP_CLIENT_PROPERTY, _("bean.sort.down.toSelect.tip"));
+
+ sortUp.putClientProperty(JAXXButtonGroup.SELECTED_TIP_CLIENT_PROPERTY, _("bean.sort.up.tip"));
+ sortUp.putClientProperty(JAXXButtonGroup.NOT_SELECTED_TIP_CLIENT_PROPERTY, _("bean.sort.up.toSelect.tip"));
+
+ popupLabel.setText(title);
+ getPopup().setLabel(title);
+ getPopup().invalidate();
+ }
+ }
+}
Added: trunk/jaxx-widgets/src/main/resources/icons/action-combobox-reset.png
===================================================================
(Binary files differ)
Property changes on: trunk/jaxx-widgets/src/main/resources/icons/action-combobox-reset.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/jaxx-widgets/src/main/resources/icons/action-combobox-sort.png
===================================================================
(Binary files differ)
Property changes on: trunk/jaxx-widgets/src/main/resources/icons/action-combobox-sort.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
1
0
r2070 - trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/nav
by tchemit@users.nuiton.org 07 Sep '10
by tchemit@users.nuiton.org 07 Sep '10
07 Sep '10
Author: tchemit
Date: 2010-09-07 12:44:52 +0200 (Tue, 07 Sep 2010)
New Revision: 2070
Url: http://nuiton.org/repositories/revision/jaxx/2070
Log:
change log level
Modified:
trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/nav/NavNodeChildLoador.java
Modified: trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/nav/NavNodeChildLoador.java
===================================================================
--- trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/nav/NavNodeChildLoador.java 2010-09-06 17:31:55 UTC (rev 2069)
+++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/nav/NavNodeChildLoador.java 2010-09-07 10:44:52 UTC (rev 2070)
@@ -156,8 +156,8 @@
// creation des noeuds fils
if (datas != null) {
for (T o : datas) {
- if (log.isInfoEnabled()) {
- log.info("[" + parentNode + "] Will add child node for " + o);
+ if (log.isDebugEnabled()) {
+ log.debug("[" + parentNode + "] Will add child node for " + o);
}
N node = createNode(o, dataProvider);
parentNode.add(node);
1
0
r2069 - trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/bean
by tchemit@users.nuiton.org 06 Sep '10
by tchemit@users.nuiton.org 06 Sep '10
06 Sep '10
Author: tchemit
Date: 2010-09-06 19:31:55 +0200 (Mon, 06 Sep 2010)
New Revision: 2069
Url: http://nuiton.org/repositories/revision/jaxx/2069
Log:
improve layer
Modified:
trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/bean/BeanListHeader.jaxx
Modified: trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/bean/BeanListHeader.jaxx
===================================================================
--- trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/bean/BeanListHeader.jaxx 2010-09-06 16:36:37 UTC (rev 2068)
+++ trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/bean/BeanListHeader.jaxx 2010-09-06 17:31:55 UTC (rev 2069)
@@ -124,8 +124,8 @@
]]>
</script>
- <JLabel id="label" constraints='BorderLayout.WEST' opaque='false'
- text='{SwingUtil.getStringValue(labelText)}'/>
+ <JLabel id="label" constraints='BorderLayout.CENTER' opaque='false'
+ text='{SwingUtil.getStringValue(getLabelText())}'/>
<JToolBar floatable='false' borderPainted='false'
constraints='BorderLayout.EAST'>
1
0
r2068 - trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/editor
by tchemit@users.nuiton.org 06 Sep '10
by tchemit@users.nuiton.org 06 Sep '10
06 Sep '10
Author: tchemit
Date: 2010-09-06 18:36:37 +0200 (Mon, 06 Sep 2010)
New Revision: 2068
Url: http://nuiton.org/repositories/revision/jaxx/2068
Log:
Evolution #848: Introduce jaxx.runtime.swing.editor.bean package
Added:
trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/editor/bean/
1
0
r2067 - in trunk/jaxx-widgets/src/main: java/jaxx/runtime/swing java/jaxx/runtime/swing/editor/bean resources/i18n resources/icons
by tchemit@users.nuiton.org 06 Sep '10
by tchemit@users.nuiton.org 06 Sep '10
06 Sep '10
Author: tchemit
Date: 2010-09-06 18:36:18 +0200 (Mon, 06 Sep 2010)
New Revision: 2067
Url: http://nuiton.org/repositories/revision/jaxx/2067
Log:
Evolution #848: Introduce jaxx.runtime.swing.editor.bean package
Evolution #851: Introduce BeanListHeader
Anomalie #853: when using MultiJxPathDecorator, can not use extra token formatter in expression
Added:
trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/bean/BeanListHeader.jaxx
trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/bean/BeanListHeaderHandler.java
trunk/jaxx-widgets/src/main/resources/icons/action-bean-sort-down.png
trunk/jaxx-widgets/src/main/resources/icons/action-bean-sort-up.png
trunk/jaxx-widgets/src/main/resources/icons/action-bean-sort.png
Modified:
trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/EntityComboBox.jaxx
trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/EntityComboBoxHandler.java
trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/bean/BeanComboBox.jaxx
trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/bean/BeanComboBoxHandler.java
trunk/jaxx-widgets/src/main/resources/i18n/jaxx-widgets-en_GB.properties
trunk/jaxx-widgets/src/main/resources/i18n/jaxx-widgets-fr_FR.properties
Modified: trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/EntityComboBox.jaxx
===================================================================
--- trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/EntityComboBox.jaxx 2010-09-06 13:01:57 UTC (rev 2066)
+++ trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/EntityComboBox.jaxx 2010-09-06 16:36:18 UTC (rev 2067)
@@ -69,11 +69,11 @@
<String id='popupTitleText' javaBean='null'/>
- <String id='i18nPrefix' javaBean='"entitycombobox.common."'/>
+ <String id='i18nPrefix' javaBean='"beancombobox.common."'/>
<!-- popup to change sorted property-->
<JPopupMenu id='popup'
- border='{new TitledBorder(_("entitycombobox.popup.title"))}'
+ border='{new TitledBorder(_("beancombobox.popup.title"))}'
onPopupMenuWillBecomeInvisible='getChangeDecorator().setSelected(false)'
onPopupMenuCanceled='getChangeDecorator().setSelected(false)'>
<JLabel id='popupLabel'/>
@@ -84,11 +84,11 @@
import static org.nuiton.i18n.I18n.n_;
import jaxx.runtime.decorator.JXPathDecorator;
-public static final String DEFAULT_POPUP_LABEL = n_("entitycombobox.popup.label");
+public static final String DEFAULT_POPUP_LABEL = n_("bean.popup.label");
-public static final String DEFAULT_SELECTED_TOOLTIP = n_("entitycombobox.sort.on");
+public static final String DEFAULT_SELECTED_TOOLTIP = n_("bean.sort.on");
-public static final String DEFAULT_NOT_SELECTED_TOOLTIP = n_("entitycombobox.sort.off");
+public static final String DEFAULT_NOT_SELECTED_TOOLTIP = n_("bean.sort.off");
public void init(JXPathDecorator<O> decorator, java.util.List<O> data) {
handler.init(decorator, data);
@@ -106,7 +106,7 @@
<!-- le boutton pour reinitialiser la valeur sélectionnée -->
<JToolBar floatable='false' borderPainted='false' visible='{isShowReset()}'>
<JButton actionIcon='combobox-reset'
- toolTipText='entitycombobox.action.reset.tip'
+ toolTipText='beancombobox.action.reset.tip'
focusable='false'
focusPainted='false'
enabled='{isEditable() && isEnabled()}'
@@ -129,7 +129,7 @@
<JToolBar floatable='false' borderPainted='false' visible='{isShowDecorator()}'>
<JToggleButton id='changeDecorator'
actionIcon='combobox-sort'
- toolTipText='entitycombobox.action.sort.tip'
+ toolTipText='beancombobox.action.sort.tip'
focusable='false'
focusPainted='false'
onActionPerformed='getHandler().togglePopup()'/>
Modified: trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/EntityComboBoxHandler.java
===================================================================
--- trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/EntityComboBoxHandler.java 2010-09-06 13:01:57 UTC (rev 2066)
+++ trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/EntityComboBoxHandler.java 2010-09-06 16:36:18 UTC (rev 2067)
@@ -359,7 +359,7 @@
Class<?> internalClass = decorator.getInternalClass();
String beanI18nKey;
if (internalClass == null) {
- beanI18nKey = n_("entitycombobox.unknown.type");
+ beanI18nKey = n_("bean.unknown.type");
} else {
beanI18nKey = ui.getI18nPrefix() + Introspector.decapitalize(internalClass.getSimpleName());
}
Modified: trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/bean/BeanComboBox.jaxx
===================================================================
--- trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/bean/BeanComboBox.jaxx 2010-09-06 13:01:57 UTC (rev 2066)
+++ trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/bean/BeanComboBox.jaxx 2010-09-06 16:36:18 UTC (rev 2067)
@@ -26,67 +26,85 @@
<Table fill='both' insets='0' genericType='O'
onFocusGained='combobox.requestFocus()'
onFocusLost='hidePopup()'>
-
- <!-- auto complete property -->
- <Boolean id='autoComplete' javaBean='false'/>
- <!-- show reset property -->
- <Boolean id='showReset' javaBean='false'/>
+ <!-- auto complete property -->
+ <Boolean id='autoComplete' javaBean='false'/>
- <!-- show decorator property -->
- <Boolean id='showDecorator' javaBean='true'/>
+ <!-- flag to reverse the sort -->
+ <Boolean id='reverseSort' javaBean='false'/>
+
+ <!-- show reset property -->
+ <Boolean id='showReset' javaBean='false'/>
- <!-- editable combo property -->
- <Boolean id='editable' javaBean='true'/>
+ <!-- show decorator property -->
+ <Boolean id='showDecorator' javaBean='true'/>
- <!-- bean property linked state -->
- <String id='property' javaBean='""'/>
+ <!-- editable combo property -->
+ <Boolean id='editable' javaBean='true'/>
- <!-- bean property -->
- <Object id='bean' javaBean='null'/>
+ <!-- bean property linked state -->
+ <String id='property' javaBean='""'/>
- <!-- selectedItem property -->
- <Object id='selectedItem' javaBean='null'/>
+ <!-- bean property -->
+ <Object id='bean' javaBean='null'/>
- <!-- sort index property -->
- <Integer id='index' javaBean='0'/>
+ <!-- selectedItem property -->
+ <Object id='selectedItem' javaBean='null'/>
- <!-- datas of the combo-box -->
- <java.util.List id='data' genericType='O' javaBean='null'/>
+ <!-- sort index property -->
+ <Integer id='index' javaBean='0'/>
- <!-- model of sorted property -->
- <ButtonGroup id='indexes' useToolTipText='true'
- onStateChanged='setIndex((Integer)indexes.getSelectedValue())'/>
+ <!-- datas of the combo-box -->
+ <java.util.List id='data' genericType='O' javaBean='null'/>
- <!-- ui handler -->
- <BeanComboBoxHandler id='handler' genericType='O' constructorParams='this'/>
+ <!-- model of sorted property -->
+ <ButtonGroup id='indexes' useToolTipText='true'
+ onStateChanged='setIndex((Integer)indexes.getSelectedValue())'/>
- <String id='selectedToolTipText' javaBean='null'/>
+ <ButtonGroup id='sortGroup' useToolTipText='true'
+ selectedValue='{isReverseSort()}'
+ onStateChanged='setReverseSort((Boolean)sortGroup.getSelectedValue())'/>
+
+ <!-- ui handler -->
+ <BeanComboBoxHandler id='handler' genericType='O' constructorParams='this'/>
- <String id='notSelectedToolTipText' javaBean='null'/>
+ <String id='selectedToolTipText' javaBean='null'/>
- <String id='popupTitleText' javaBean='null'/>
-
- <String id='i18nPrefix' javaBean='"entitycombobox.common."'/>
+ <String id='notSelectedToolTipText' javaBean='null'/>
- <!-- popup to change sorted property-->
- <JPopupMenu id='popup'
- border='{new TitledBorder(_("entitycombobox.popup.title"))}'
- onPopupMenuWillBecomeInvisible='getChangeDecorator().setSelected(false)'
- onPopupMenuCanceled='getChangeDecorator().setSelected(false)'>
- <JLabel id='popupLabel'/>
- <JSeparator/>
- </JPopupMenu>
+ <String id='popupTitleText' javaBean='null'/>
- <script><![CDATA[
+ <String id='i18nPrefix' javaBean='"entitycombobox.common."'/>
+
+ <!-- popup to change sorted property-->
+ <JPopupMenu id='popup'
+ border='{new TitledBorder(_("beancombobox.popup.title"))}'
+ onPopupMenuWillBecomeInvisible='getChangeDecorator().setSelected(false)'
+ onPopupMenuCanceled='getChangeDecorator().setSelected(false)'>
+ <JLabel id='popupSortLabel' actionIcon="bean-sort" text="bean.sort.label"/>
+
+ <JRadioButtonMenuItem id='sortUp' buttonGroup="sortGroup" value='{false}'
+ actionIcon="bean-sort-up" text='bean.sort.up'
+ selected='{!isReverseSort()}'/>
+
+ <JRadioButtonMenuItem id='sortDown' buttonGroup="sortGroup" value='{true}'
+ actionIcon="bean-sort-down" text='bean.sort.down'
+ selected='{isReverseSort()}'/>
+
+ <JSeparator/>
+ <JLabel id='popupLabel'/>
+ <JSeparator/>
+ </JPopupMenu>
+
+ <script><![CDATA[
import static org.nuiton.i18n.I18n.n_;
import jaxx.runtime.decorator.JXPathDecorator;
-public static final String DEFAULT_POPUP_LABEL = n_("entitycombobox.popup.label");
+public static final String DEFAULT_POPUP_LABEL = n_("bean.popup.label");
-public static final String DEFAULT_SELECTED_TOOLTIP = n_("entitycombobox.sort.on");
+public static final String DEFAULT_SELECTED_TOOLTIP = n_("bean.sort.on");
-public static final String DEFAULT_NOT_SELECTED_TOOLTIP = n_("entitycombobox.sort.off");
+public static final String DEFAULT_NOT_SELECTED_TOOLTIP = n_("bean.sort.off");
public void init(JXPathDecorator<O> decorator, java.util.List<O> data) {
handler.init(decorator, data);
@@ -98,40 +116,42 @@
}
}
]]>
- </script>
- <row>
- <cell anchor='west'>
- <!-- le boutton pour reinitialiser la valeur sélectionnée -->
- <JToolBar floatable='false' borderPainted='false' visible='{isShowReset()}'>
- <JButton actionIcon='combobox-reset'
- toolTipText='entitycombobox.action.reset.tip'
- focusable='false'
- focusPainted='false'
- enabled='{isEditable() && isEnabled()}'
- onActionPerformed='setSelectedItem(null)'/>
- </JToolBar>
+ </script>
+ <row>
+ <cell anchor='west'>
+ <!-- le boutton pour reinitialiser la valeur sélectionnée -->
+ <JToolBar floatable='false' borderPainted='false'
+ visible='{isShowReset()}'>
+ <JButton actionIcon='combobox-reset'
+ toolTipText='beancombobox.action.reset.tip'
+ focusable='false'
+ focusPainted='false'
+ enabled='{isEditable() && isEnabled()}'
+ onActionPerformed='setSelectedItem(null)'/>
+ </JToolBar>
- </cell>
- <cell weightx='1'>
- <!-- la liste déroulante -->
- <JComboBox id='combobox'
- selectedItem='{getSelectedItem()}'
- enabled='{isEnabled()}'
- editable='{isEditable()}'
- focusable='{isEnabled() && isEditable()}'
- onFocusGained='hidePopup()'
- onItemStateChanged='setSelectedItem(combobox.getSelectedItem())'/>
- </cell>
- <cell anchor='east' fill='both' insets='0'>
- <!-- le boutton pour changer le tri -->
- <JToolBar floatable='false' borderPainted='false' visible='{isShowDecorator()}'>
- <JToggleButton id='changeDecorator'
- actionIcon='combobox-sort'
- toolTipText='entitycombobox.action.sort.tip'
- focusable='false'
- focusPainted='false'
- onActionPerformed='getHandler().togglePopup()'/>
- </JToolBar>
- </cell>
- </row>
+ </cell>
+ <cell weightx='1'>
+ <!-- la liste déroulante -->
+ <JComboBox id='combobox'
+ selectedItem='{getSelectedItem()}'
+ enabled='{isEnabled()}'
+ editable='{isEditable()}'
+ focusable='{isEnabled() && isEditable()}'
+ onFocusGained='hidePopup()'
+ onItemStateChanged='setSelectedItem(combobox.getSelectedItem())'/>
+ </cell>
+ <cell anchor='east' fill='both' insets='0'>
+ <!-- le boutton pour changer le tri -->
+ <JToolBar floatable='false' borderPainted='false'
+ visible='{isShowDecorator()}'>
+ <JToggleButton id='changeDecorator'
+ actionIcon='combobox-sort'
+ toolTipText='beancombobox.action.sort.tip'
+ focusable='false'
+ focusPainted='false'
+ onActionPerformed='getHandler().togglePopup()'/>
+ </JToolBar>
+ </cell>
+ </row>
</Table>
Modified: trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/bean/BeanComboBoxHandler.java
===================================================================
--- trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/bean/BeanComboBoxHandler.java 2010-09-06 13:01:57 UTC (rev 2066)
+++ trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/bean/BeanComboBoxHandler.java 2010-09-06 16:36:18 UTC (rev 2067)
@@ -55,6 +55,7 @@
import java.beans.PropertyChangeListener;
import java.beans.PropertyDescriptor;
import java.lang.reflect.Method;
+import java.util.Date;
import java.util.List;
import static org.nuiton.i18n.I18n._;
@@ -63,7 +64,7 @@
/**
* Le handler d'un {@link BeanComboBox}.
* <p/>
- * Note: ce handler n'est pas staeless et n'est donc pas partageable entre plusieurs ui.
+ * Note: ce handler n'est pas stateless et n'est donc pas partageable entre plusieurs ui.
*
* @author tchemit <chemit(a)codelutin.com>
* @param <O> le type des objet contenus dans le modèle du composant.
@@ -140,7 +141,11 @@
// should clone decorator ?
d = (MultiJXPathDecorator<O>) decorator;
} else {
- d = DecoratorUtils.newMultiJXPathDecorator(decorator.getInternalClass(), decorator.getInitialExpression(), " - ");
+ d = DecoratorUtils.newMultiJXPathDecorator(
+ decorator.getInternalClass(),
+ decorator.getInitialExpression(),
+ "??" + new Date().getTime(),
+ " - ");
}
this.decorator = d;
@@ -185,14 +190,27 @@
@Override
public void run() {
- ui.getPopup().pack();
+
+ updatePopup();
+
Dimension dim = ui.getPopup().getPreferredSize();
JToggleButton invoker = ui.getChangeDecorator();
- ui.getPopup().show(invoker, (int) (invoker.getPreferredSize().getWidth() - dim.getWidth()), invoker.getHeight());
+ ui.getPopup().show(
+ invoker,
+ (int) (invoker.getPreferredSize().getWidth() - dim.getWidth()),
+ invoker.getHeight()
+ );
}
});
}
+
+ protected void updatePopup() {
+ JPopupMenu popup = ui.getPopup();
+ popup.pack();
+
+ }
+
/**
* Modifie l'état autoComplete de l'ui.
*
@@ -225,17 +243,40 @@
* @param oldValue l'ancienne valeur
* @param newValue la nouvelle valeur
*/
- @SuppressWarnings({"unchecked"})
protected void setIndex(Integer oldValue, Integer newValue) {
- if (newValue.equals(oldValue)) {
+ if (newValue == null || newValue.equals(oldValue)) {
return;
}
if (log.isDebugEnabled()) {
log.debug("check state : <" + oldValue + " to " + newValue + ">");
}
+ updateComboBox(newValue, ui.isReverseSort());
+ }
+ /**
+ * Modifie l'index du décorateur
+ *
+ * @param oldValue l'ancienne valeur
+ * @param newValue la nouvelle valeur
+ */
+
+ protected void setSortOrder(Boolean oldValue, Boolean newValue) {
+
+ if (newValue == null || newValue.equals(oldValue)) {
+ return;
+ }
+ if (log.isDebugEnabled()) {
+ log.debug("check state : <" + oldValue + " to " + newValue + ">");
+ }
+
+ updateComboBox(ui.getIndex(), newValue);
+ }
+
+ @SuppressWarnings({"unchecked"})
+ protected void updateComboBox(int index, boolean reversesort) {
+
// change decorator context
- decorator.setContextIndex(newValue);
+ decorator.setContextIndex(index);
// keep selected item
Object previousSelectedItem = ui.getSelectedItem();
@@ -251,10 +292,15 @@
ui.selectedItem = null;
}
-
+ List<O> data = ui.getData();
try {
// Sort data with the decorator jxpath tokens.
- DecoratorUtils.sort(decorator, ui.getData(), newValue);
+ DecoratorUtils.sort(decorator,
+ data,
+ index,
+ reversesort
+ );
+
} catch (Exception e) {
log.warn(e.getMessage(), e);
//System.out.println("newValue :: "+decorator+" : "+newValue);
@@ -262,7 +308,7 @@
}
// reload the model
- SwingUtil.fillComboBox(ui.getCombobox(), ui.getData(), null);
+ SwingUtil.fillComboBox(ui.getCombobox(), data, null);
if (wasAutoComplete) {
ui.setAutoComplete(true);
@@ -367,7 +413,7 @@
Class<?> internalClass = decorator.getInternalClass();
String beanI18nKey;
if (internalClass == null) {
- beanI18nKey = n_("entitycombobox.unknown.type");
+ beanI18nKey = n_("bean.unknown.type");
} else {
beanI18nKey = ui.getI18nPrefix() + Introspector.decapitalize(internalClass.getSimpleName());
}
@@ -376,9 +422,19 @@
} else {
title = _(title);
}
+
+
+ ui.getSortDown().putClientProperty(JAXXButtonGroup.SELECTED_TIP_CLIENT_PROPERTY, _("bean.sort.down.tip"));
+ ui.getSortDown().putClientProperty(JAXXButtonGroup.NOT_SELECTED_TIP_CLIENT_PROPERTY, _("bean.sort.down.toSelect.tip"));
+
+ ui.getSortUp().putClientProperty(JAXXButtonGroup.SELECTED_TIP_CLIENT_PROPERTY, _("bean.sort.up.tip"));
+ ui.getSortUp().putClientProperty(JAXXButtonGroup.NOT_SELECTED_TIP_CLIENT_PROPERTY, _("bean.sort.up.toSelect.tip"));
+
ui.getPopupLabel().setText(title);
ui.getPopup().setLabel(title);
ui.getPopup().invalidate();
+
+
}
public Class<?> getTargetClass() {
@@ -469,23 +525,37 @@
public void propertyChange(PropertyChangeEvent evt) {
String propertyName = evt.getPropertyName();
- if (SELECTED_ITEM_PROPERTY.equals(propertyName)) {
+ if (BeanComboBox.PROPERTY_SELECTED_ITEM.equals(propertyName)) {
setSelectedItem(evt.getOldValue(), evt.getNewValue());
return;
}
- if (INDEX_PROPERTY.equals(propertyName)) {
- setIndex((Integer) evt.getOldValue(), (Integer) evt.getNewValue());
+ if (BeanComboBox.PROPERTY_AUTO_COMPLETE.equals(propertyName)) {
+
+ setAutoComplete((Boolean) evt.getOldValue(), (Boolean) evt.getNewValue());
return;
}
- if (AUTO_COMPLETE_PROPERTY.equals(propertyName)) {
- setAutoComplete((Boolean) evt.getOldValue(), (Boolean) evt.getNewValue());
+
+ if (BeanListHeader.PROPERTY_INDEX.equals(propertyName)) {
+
+ // decorator index has changed, force reload of data in ui
+ setIndex((Integer) evt.getOldValue(),
+ (Integer) evt.getNewValue());
return;
}
- if (DATA_PROPERTY.equals(propertyName)) {
+
+ if (BeanListHeader.PROPERTY_REVERSE_SORT.equals(propertyName)) {
+
+ // sort order has changed, force reload of data in ui
+ setSortOrder((Boolean) evt.getOldValue(),
+ (Boolean) evt.getNewValue());
+ return;
+ }
+
+ if (BeanListHeader.PROPERTY_DATA.equals(propertyName)) {
+
// list has changed, force reload of index
setIndex(-1, ui.getIndex());
}
-
}
}
Added: trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/bean/BeanListHeader.jaxx
===================================================================
--- trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/bean/BeanListHeader.jaxx (rev 0)
+++ trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/bean/BeanListHeader.jaxx 2010-09-06 16:36:18 UTC (rev 2067)
@@ -0,0 +1,153 @@
+<!--
+ #%L
+ JAXX :: Widgets
+
+ $Id$
+ $HeadURL$
+ %%
+ Copyright (C) 2008 - 2010 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
+ <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ #L%
+ -->
+
+<JPanel id='top' layout='{new BorderLayout()}' genericType='O'>
+
+ <import>
+ static org.nuiton.i18n.I18n.n_
+ jaxx.runtime.decorator.JXPathDecorator
+ </import>
+
+ <!-- show reset property -->
+ <Boolean id='showReset' javaBean='false'/>
+
+ <!-- show decorator property -->
+ <Boolean id='showDecorator' javaBean='true'/>
+
+ <!-- flag to reverse the sort -->
+ <Boolean id='reverseSort' javaBean='false'/>
+
+ <!-- editable combo property -->
+ <Boolean id='editable' javaBean='true'/>
+
+ <!-- bean property -->
+ <Class genericType='O' id='beanType' javaBean='null'/>
+
+ <!-- label -->
+ <String id='labelText' javaBean='null'/>
+
+ <!-- sort index property -->
+ <Integer id='index' javaBean='0'/>
+
+ <!-- datas of the combo-box -->
+ <java.util.List id='data' genericType='O' javaBean='null'/>
+
+ <!-- model of sorted property -->
+ <ButtonGroup id='indexes' useToolTipText='true'
+ onStateChanged='setIndex((Integer)indexes.getSelectedValue())'/>
+
+ <ButtonGroup id='sortGroup' useToolTipText='true'
+ selectedValue='{isReverseSort()}'
+ onStateChanged='setReverseSort((Boolean)sortGroup.getSelectedValue())'/>
+
+ <!-- ui handler -->
+ <BeanListHeaderHandler id='handler' genericType='O' constructorParams='this'/>
+
+ <String id='selectedToolTipText' javaBean='null'/>
+
+ <String id='notSelectedToolTipText' javaBean='null'/>
+
+ <String id='popupTitleText' javaBean='null'/>
+
+ <String id='i18nPrefix' javaBean='"beanlist.common."'/>
+
+ <!-- popup to change sorted property-->
+ <JPopupMenu id='popup'
+ border='{new TitledBorder(_("beanlist.popup.title"))}'
+ onPopupMenuWillBecomeInvisible='getChangeDecorator().setSelected(false)'
+ onPopupMenuCanceled='getChangeDecorator().setSelected(false)'>
+
+ <JLabel id='popupSortLabel' actionIcon="bean-sort" text="bean.sort.label"/>
+
+ <JRadioButtonMenuItem id='sortUp' buttonGroup="sortGroup" value='{false}'
+ actionIcon="bean-sort-up" text='bean.sort.up'
+ selected='{!isReverseSort()}'/>
+
+ <JRadioButtonMenuItem id='sortDown' buttonGroup="sortGroup" value='{true}'
+ actionIcon="bean-sort-down" text='bean.sort.down'
+ selected='{isReverseSort()}'/>
+
+ <JSeparator/>
+
+ <JLabel id='popupLabel'/>
+
+ </JPopupMenu>
+
+ <JList id='list' javaBean="new JList()"/>
+
+ <script><![CDATA[
+
+public static final String DEFAULT_POPUP_LABEL = n_("bean.popup.label");
+
+public static final String DEFAULT_SELECTED_TOOLTIP = n_("bean.sort.on");
+
+public static final String DEFAULT_NOT_SELECTED_TOOLTIP = n_("bean.sort.off");
+
+public void init(JXPathDecorator<O> decorator, java.util.List<O> data) {
+ handler.init(decorator, data);
+}
+
+protected void hidePopup() {
+ if (popup.isVisible()) {
+ popup.setVisible(false);
+ }
+}
+
+protected Object updateSort(boolean reverseSort) {
+ if (reverseSort) {
+ return sortDown;
+ }
+ return sortUp;
+}
+]]>
+ </script>
+
+ <JLabel id="label" constraints='BorderLayout.WEST' opaque='false'
+ text='{SwingUtil.getStringValue(labelText)}'/>
+
+ <JToolBar floatable='false' borderPainted='false'
+ constraints='BorderLayout.EAST'>
+
+ <!-- le boutton pour reinitialiser la valeur sélectionnée -->
+
+ <JButton actionIcon='combobox-reset'
+ toolTipText='beanlist.action.reset.tip'
+ focusable='false'
+ focusPainted='false'
+ visible='{isShowReset()}'
+ enabled='{isEnabled()}'
+ onActionPerformed='getList().getSelectionModel().clearSelection()'/>
+
+ <!-- le boutton pour changer le tri -->
+ <JToggleButton id='changeDecorator'
+ actionIcon='combobox-sort'
+ toolTipText='beanlist.action.sort.tip'
+ focusable='false'
+ focusPainted='false'
+ visible='{isShowDecorator()}'
+ onActionPerformed='getHandler().togglePopup()'/>
+ </JToolBar>
+</JPanel>
+
Added: trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/bean/BeanListHeaderHandler.java
===================================================================
--- trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/bean/BeanListHeaderHandler.java (rev 0)
+++ trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/bean/BeanListHeaderHandler.java 2010-09-06 16:36:18 UTC (rev 2067)
@@ -0,0 +1,349 @@
+/*
+ * #%L
+ * JAXX :: Widgets
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2008 - 2010 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
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+package jaxx.runtime.swing.editor.bean;
+
+import jaxx.runtime.decorator.DecoratorUtils;
+import jaxx.runtime.decorator.JXPathDecorator;
+import jaxx.runtime.decorator.MultiJXPathDecorator;
+import jaxx.runtime.swing.JAXXButtonGroup;
+import jaxx.runtime.swing.renderer.DecoratorListCellRenderer;
+import org.apache.commons.collections.primitives.ArrayIntList;
+import org.apache.commons.collections.primitives.IntList;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.swing.JPopupMenu;
+import javax.swing.JRadioButtonMenuItem;
+import javax.swing.JToggleButton;
+import javax.swing.SwingUtilities;
+import java.awt.Dimension;
+import java.beans.Introspector;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.util.Date;
+import java.util.List;
+
+import static org.nuiton.i18n.I18n._;
+import static org.nuiton.i18n.I18n.n_;
+
+/**
+ * Le handler d'un {@link BeanListHeader}.
+ * <p/>
+ * Note: ce handler n'est pas stateless et n'est donc pas partageable entre
+ * plusieurs ui.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @param <O> le type des objet contenus dans le modèle du composant.
+ * @see BeanListHeader
+ * @since 2.2
+ */
+public class BeanListHeaderHandler<O> implements PropertyChangeListener {
+
+ public static final Log log = LogFactory.getLog(BeanListHeaderHandler.class);
+
+ /** ui if the handler */
+ protected BeanListHeader<O> ui;
+
+ /** the decorator of data */
+ protected MultiJXPathDecorator<O> decorator;
+
+ protected boolean init;
+
+ public BeanListHeaderHandler(BeanListHeader<O> ui) {
+ this.ui = ui;
+ }
+
+ /**
+ * Initialise le handler de l'ui
+ *
+ * @param decorator le decorateur a utiliser
+ * @param data la liste des données a gérer
+ */
+ public void init(JXPathDecorator<O> decorator, List<O> data) {
+
+ if (init) {
+ throw new IllegalStateException("can not init the handler twice");
+ }
+ init = true;
+ if (decorator == null) {
+ throw new NullPointerException(
+ "can not have a null decorator as parameter");
+ }
+
+ JAXXButtonGroup indexes = ui.getIndexes();
+
+ MultiJXPathDecorator<O> d;
+ if (decorator instanceof MultiJXPathDecorator<?>) {
+
+ // should clone decorator ?
+ d = (MultiJXPathDecorator<O>) decorator;
+ } else {
+ d = DecoratorUtils.newMultiJXPathDecorator(
+ decorator.getInternalClass(),
+ decorator.getInitialExpression(),
+ "??" + new Date().getTime(),
+ " - "
+ );
+ }
+ this.decorator = d;
+
+ // init combobox renderer base on given decorator
+ ui.getList().setCellRenderer(new DecoratorListCellRenderer(d));
+
+ // build popup
+ preparePopup(d);
+
+ ui.addPropertyChangeListener(this);
+
+ // set datas
+ ui.setData(data);
+
+ // select sort button
+ indexes.setSelectedButton(ui.getIndex());
+ }
+
+ /** Toggle the popup visible state. */
+ public void togglePopup() {
+ boolean newValue = !ui.getPopup().isVisible();
+
+ if (log.isTraceEnabled()) {
+ log.trace(newValue);
+ }
+
+ if (!newValue) {
+ if (ui.getPopup() != null) {
+ ui.getPopup().setVisible(false);
+ }
+ return;
+ }
+ SwingUtilities.invokeLater(new Runnable() {
+
+ @Override
+ public void run() {
+
+ updatePopup();
+
+ Dimension dim = ui.getPopup().getPreferredSize();
+ JToggleButton invoker = ui.getChangeDecorator();
+ ui.getPopup().show(
+ invoker,
+ (int) (invoker.getPreferredSize().getWidth() - dim.getWidth()),
+ invoker.getHeight()
+ );
+ }
+ });
+ }
+
+ protected void updatePopup() {
+ JPopupMenu popup = ui.getPopup();
+ popup.pack();
+
+ }
+
+ /**
+ * Modifie l'index du décorateur
+ *
+ * @param oldValue l'ancienne valeur
+ * @param newValue la nouvelle valeur
+ */
+ protected void setIndex(Integer oldValue, Integer newValue) {
+ if (newValue == null || newValue.equals(oldValue)) {
+ return;
+ }
+ if (log.isDebugEnabled()) {
+ log.debug("check state : <" + oldValue + " to " + newValue + ">");
+ }
+ updateComboBox(newValue, ui.isReverseSort());
+ }
+
+ /**
+ * Modifie l'index du décorateur
+ *
+ * @param oldValue l'ancienne valeur
+ * @param newValue la nouvelle valeur
+ */
+
+ protected void setSortOrder(Boolean oldValue, Boolean newValue) {
+
+ if (newValue == null || newValue.equals(oldValue)) {
+ return;
+ }
+ if (log.isDebugEnabled()) {
+ log.debug("check state : <" + oldValue + " to " + newValue + ">");
+ }
+
+ updateComboBox(ui.getIndex(), newValue);
+ }
+
+ @SuppressWarnings({"unchecked"})
+ protected void updateComboBox(int index, boolean reverseSort) {
+
+ // change decorator context
+ decorator.setContextIndex(index);
+
+ String expression = decorator.getExpression();
+ log.info("will use expression (index = " + index + ") : " + expression);
+
+ // get the current selection in list
+ Object[] selection = ui.getList().getSelectedValues();
+
+ List<O> datas = ui.getData();
+ try {
+
+ // Sort data with the decorator jxpath tokens.
+ DecoratorUtils.sort(decorator,
+ datas,
+ index,
+ reverseSort);
+ } catch (Exception e) {
+ log.warn(e.getMessage(), e);
+ }
+
+ // reload the model
+ ui.getList().setListData(datas.toArray(new Object[datas.size()]));
+
+ // re-apply selection
+ if (selection.length > 0) {
+
+ // re compute selection (the new data could not contains some
+ // previously selected items)
+ IntList newSelection = new ArrayIntList();
+ for (Object o : selection) {
+ if (datas.contains(o)) {
+
+ newSelection.add(datas.indexOf(o));
+ }
+ }
+
+ if (!newSelection.isEmpty()) {
+
+ // there is still a selection to re-apply
+ int[] ints = newSelection.toArray(new int[newSelection.size()]);
+ newSelection.clear();
+ ui.getList().setSelectedIndices(ints);
+ }
+ }
+
+ ui.getList().requestFocus();
+ }
+
+ public MultiJXPathDecorator<O> getDecorator() {
+ return decorator;
+ }
+
+ /**
+ * Creation de l'ui pour modifier le décorateur.
+ *
+ * @param decorator le decorateur a utiliser
+ */
+ protected void preparePopup(MultiJXPathDecorator<?> decorator) {
+ String selectedTip = ui.getSelectedToolTipText();
+ if (selectedTip == null) {
+ // use default selected tip text
+ selectedTip = BeanListHeader.DEFAULT_SELECTED_TOOLTIP;
+ }
+ String notSelectedTip = ui.getNotSelectedToolTipText();
+ if (notSelectedTip == null) {
+ // use default selected tip text
+ notSelectedTip = BeanListHeader.DEFAULT_NOT_SELECTED_TOOLTIP;
+ }
+ JPopupMenu popup = ui.getPopup();
+
+ //Container container = ui.getIndexesContainer();
+ for (int i = 0, max = decorator.getNbContext(); i < max; i++) {
+ String property = ui.getI18nPrefix() + decorator.getProperty(i);
+ String propertyI18n = _(property);
+ JRadioButtonMenuItem button = new JRadioButtonMenuItem(propertyI18n);
+ button.putClientProperty(JAXXButtonGroup.BUTTON8GROUP_CLIENT_PROPERTY, ui.getIndexes());
+ button.putClientProperty(JAXXButtonGroup.VALUE_CLIENT_PROPERTY, i);
+ popup.add(button);
+ if (selectedTip != null) {
+ button.putClientProperty(JAXXButtonGroup.SELECTED_TIP_CLIENT_PROPERTY, _(selectedTip, propertyI18n));
+ }
+ if (notSelectedTip != null) {
+ button.putClientProperty(JAXXButtonGroup.NOT_SELECTED_TIP_CLIENT_PROPERTY, _(notSelectedTip, propertyI18n));
+ }
+ button.setSelected(false);
+ ui.getIndexes().add(button);
+ }
+ String title = ui.getPopupTitleText();
+ if (title == null) {
+ // use default popup title
+ title = BeanListHeader.DEFAULT_POPUP_LABEL;
+
+ Class<O> internalClass = ui.getBeanType();
+ String beanI18nKey;
+ if (internalClass == null) {
+ beanI18nKey = n_("bean.unknown.type");
+ } else {
+ beanI18nKey = ui.getI18nPrefix() +
+ Introspector.decapitalize(internalClass.getSimpleName());
+ }
+ String beanI18n = _(beanI18nKey);
+ title = _(title, beanI18n);
+ } else {
+ title = _(title);
+ }
+
+ ui.getSortDown().putClientProperty(JAXXButtonGroup.SELECTED_TIP_CLIENT_PROPERTY, _("bean.sort.down.tip"));
+ ui.getSortDown().putClientProperty(JAXXButtonGroup.NOT_SELECTED_TIP_CLIENT_PROPERTY, _("bean.sort.down.toSelect.tip"));
+
+ ui.getSortUp().putClientProperty(JAXXButtonGroup.SELECTED_TIP_CLIENT_PROPERTY, _("bean.sort.up.tip"));
+ ui.getSortUp().putClientProperty(JAXXButtonGroup.NOT_SELECTED_TIP_CLIENT_PROPERTY, _("bean.sort.up.toSelect.tip"));
+
+ ui.getPopupLabel().setText(title);
+ ui.getPopup().setLabel(title);
+ ui.getPopup().invalidate();
+ }
+
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ String propertyName = evt.getPropertyName();
+
+ if (BeanListHeader.PROPERTY_INDEX.equals(propertyName)) {
+
+ // decorator index has changed, force reload of data in ui
+ setIndex((Integer) evt.getOldValue(),
+ (Integer) evt.getNewValue());
+ return;
+ }
+
+ if (BeanListHeader.PROPERTY_REVERSE_SORT.equals(propertyName)) {
+
+ // sort order has changed, force reload of data in ui
+ setSortOrder((Boolean) evt.getOldValue(),
+ (Boolean) evt.getNewValue());
+ return;
+ }
+
+ if (BeanListHeader.PROPERTY_DATA.equals(propertyName)) {
+
+ // list has changed, force reload of index
+ setIndex(-1, ui.getIndex());
+ }
+
+ }
+}
Modified: trunk/jaxx-widgets/src/main/resources/i18n/jaxx-widgets-en_GB.properties
===================================================================
--- trunk/jaxx-widgets/src/main/resources/i18n/jaxx-widgets-en_GB.properties 2010-09-06 13:01:57 UTC (rev 2066)
+++ trunk/jaxx-widgets/src/main/resources/i18n/jaxx-widgets-en_GB.properties 2010-09-06 16:36:18 UTC (rev 2067)
@@ -2,6 +2,23 @@
aboutframe.license=License
aboutframe.ok=OK
aboutframe.thirdparty=Third party
+bean.popup.label=Object '%1$s'
+bean.sort.down=Descending sort
+bean.sort.down.tip=Actually, sort order is descending
+bean.sort.down.toSelect.tip=To sort in Descending order
+bean.sort.label=Sort order
+bean.sort.off=Click to activate the sort on this property
+bean.sort.on=This is the property actually used
+bean.sort.up=Ascending sort
+bean.sort.up.tip=Actually, sort order is acending
+bean.sort.up.toSelect.tip=Click here to sort in ascending order
+bean.unknown.type=Object of unkown type
+beancombobox.action.reset.tip=Reset the selected value
+beancombobox.action.sort.tip=Change the sorted property
+beancombobox.popup.title=Change the sorted property
+beanlist.action.reset.tip=Reset the selected selection
+beanlist.action.sort.tip=Change the sorted property
+beanlist.popup.title=Change the sorted property
columnselector.action.tip=Select the columns
config.action.quit=Quit
config.action.quit.tip=Quit the configuration editor
@@ -36,13 +53,6 @@
config.unvalid=Option is not valid \! (previous value \: %1$s, required type \: %2$s)
config.value=Value
config.value.tip=Value of the option
-entitycombobox.action.reset.tip=Reset the selected value
-entitycombobox.action.sort.tip=Change the sorted property
-entitycombobox.popup.label=Object '%1$s'
-entitycombobox.popup.title=Change the sorted property
-entitycombobox.sort.off=Click to activate the sort on this property
-entitycombobox.sort.on=This is the property actually used
-entitycombobox.unknown.type=Object of unkown type
errorUI.action.close=Close
errorUI.message=An error wad detected...
errorUI.title=Error...
Modified: trunk/jaxx-widgets/src/main/resources/i18n/jaxx-widgets-fr_FR.properties
===================================================================
--- trunk/jaxx-widgets/src/main/resources/i18n/jaxx-widgets-fr_FR.properties 2010-09-06 13:01:57 UTC (rev 2066)
+++ trunk/jaxx-widgets/src/main/resources/i18n/jaxx-widgets-fr_FR.properties 2010-09-06 16:36:18 UTC (rev 2067)
@@ -2,6 +2,23 @@
aboutframe.license=Licence
aboutframe.ok=OK
aboutframe.thirdparty=Tierce partie
+bean.popup.label=Objet '%1$s'
+bean.sort.down=Tri d\u00E9croissant
+bean.sort.down.tip=Tri d\u00E9croissant actuellement utilis\u00E9
+bean.sort.down.toSelect.tip=Cliquer pour trier selon l'ordre d\u00E9croissant
+bean.sort.label=Ordre de tri
+bean.sort.off=Cliquer pour activer le tri sur la propri\u00E9t\u00E9 '%1$s'
+bean.sort.on=Le tri est effectu\u00E9 sur la propri\u00E9t\u00E9 '%1$s'
+bean.sort.up=Tri croissant
+bean.sort.up.tip=Tri croissant actuellement utilis\u00E9
+bean.sort.up.toSelect.tip=Cliquer pour trier selon l'ordre croissant
+bean.unknown.type=Objet de type inconnu
+beancombobox.action.reset.tip=R\u00E9initialiser la valeur de la liste d\u00E9roulante
+beancombobox.action.sort.tip=Modifier le tri de la liste d\u00E9roulante
+beancombobox.popup.title=Modifier le tri
+beanlist.action.reset.tip=R\u00E9initialiser la valeur de la liste d\u00E9roulante
+beanlist.action.sort.tip=Modifier le tri de la liste d\u00E9roulante
+beanlist.popup.title=Modifier le tri
columnselector.action.tip=S\u00E9lectionner les colonnes
config.action.quit=Quitter
config.action.quit.tip=Quitter l'\u00E9diteur de configuration
@@ -36,13 +53,6 @@
config.unvalid=Option non valide (valeur originale \: %1$s, type requis \: %2$s)
config.value=Valeur
config.value.tip=Valeur de l'option
-entitycombobox.action.reset.tip=R\u00E9initialiser la valeur de la liste d\u00E9roulante
-entitycombobox.action.sort.tip=Modifier le tri de la liste d\u00E9roulante
-entitycombobox.popup.label=Objet '%1$s'
-entitycombobox.popup.title=Modifier le tri
-entitycombobox.sort.off=Cliquer pour activer le tri sur la propri\u00E9t\u00E9 '%1$s'
-entitycombobox.sort.on=Le tri est effectu\u00E9 sur la propri\u00E9t\u00E9 '%1$s'
-entitycombobox.unknown.type=Objet de type inconnu
errorUI.action.close=Fermer
errorUI.message=Une erreur est survenue \!
errorUI.title=Erreur...
Added: trunk/jaxx-widgets/src/main/resources/icons/action-bean-sort-down.png
===================================================================
(Binary files differ)
Property changes on: trunk/jaxx-widgets/src/main/resources/icons/action-bean-sort-down.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/jaxx-widgets/src/main/resources/icons/action-bean-sort-up.png
===================================================================
(Binary files differ)
Property changes on: trunk/jaxx-widgets/src/main/resources/icons/action-bean-sort-up.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/jaxx-widgets/src/main/resources/icons/action-bean-sort.png
===================================================================
(Binary files differ)
Property changes on: trunk/jaxx-widgets/src/main/resources/icons/action-bean-sort.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
1
0
r2066 - trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/renderer
by tchemit@users.nuiton.org 06 Sep '10
by tchemit@users.nuiton.org 06 Sep '10
06 Sep '10
Author: tchemit
Date: 2010-09-06 15:01:57 +0200 (Mon, 06 Sep 2010)
New Revision: 2066
Url: http://nuiton.org/repositories/revision/jaxx/2066
Log:
reformat code
Modified:
trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/renderer/DecoratorListCellRenderer.java
Modified: trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/renderer/DecoratorListCellRenderer.java
===================================================================
--- trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/renderer/DecoratorListCellRenderer.java 2010-09-06 13:01:38 UTC (rev 2065)
+++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/renderer/DecoratorListCellRenderer.java 2010-09-06 13:01:57 UTC (rev 2066)
@@ -24,11 +24,12 @@
*/
package jaxx.runtime.swing.renderer;
-import jaxx.runtime.decorator.*;
-import java.awt.Component;
+import jaxx.runtime.decorator.Decorator;
+
import javax.swing.DefaultListCellRenderer;
import javax.swing.JList;
import javax.swing.ListCellRenderer;
+import java.awt.Component;
/**
* A {@link ListCellRenderer} which compute text with the given {@link #decorator}
@@ -39,32 +40,39 @@
*/
public class DecoratorListCellRenderer implements ListCellRenderer {
- /**
- * Delegate cell renderer
- */
+ /** Delegate cell renderer */
protected ListCellRenderer delegate;
- /**
- * Decorator to produce text to render
- */
+
+ /** Decorator to produce text to render */
protected Decorator<?> decorator;
public DecoratorListCellRenderer(Decorator<?> decorator) {
this(new DefaultListCellRenderer(), decorator);
}
- public DecoratorListCellRenderer(ListCellRenderer delegate, Decorator<?> decorator) {
+ public DecoratorListCellRenderer(ListCellRenderer delegate,
+ Decorator<?> decorator) {
this.delegate = delegate;
this.decorator = decorator;
}
@Override
- public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
+ public Component getListCellRendererComponent(JList list,
+ Object value,
+ int index,
+ boolean isSelected,
+ boolean cellHasFocus) {
if (value == null) {
value = " ";
}
if (!(value instanceof String)) {
value = decorator.toString(value);
}
- return delegate.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
+ return delegate.getListCellRendererComponent(list,
+ value,
+ index,
+ isSelected,
+ cellHasFocus
+ );
}
}
1
0
r2065 - in trunk/jaxx-compiler/src/main/java/jaxx/compiler: . tags/swing
by tchemit@users.nuiton.org 06 Sep '10
by tchemit@users.nuiton.org 06 Sep '10
06 Sep '10
Author: tchemit
Date: 2010-09-06 15:01:38 +0200 (Mon, 06 Sep 2010)
New Revision: 2065
Url: http://nuiton.org/repositories/revision/jaxx/2065
Log:
Evolution #854: Can add the columnHeaderView component in the tag JScrollPane
+ reformat code
Modified:
trunk/jaxx-compiler/src/main/java/jaxx/compiler/CompiledObject.java
trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JScrollPaneHandler.java
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/CompiledObject.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/CompiledObject.java 2010-09-06 12:55:58 UTC (rev 2064)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/CompiledObject.java 2010-09-06 13:01:38 UTC (rev 2065)
@@ -31,6 +31,8 @@
import jaxx.compiler.tags.DefaultComponentHandler;
import jaxx.compiler.tags.TagHandler;
import jaxx.compiler.tags.TagManager;
+import jaxx.compiler.types.TypeManager;
+import org.apache.commons.lang.StringUtils;
import java.awt.Container;
import java.lang.reflect.Method;
@@ -39,9 +41,6 @@
import java.util.List;
import java.util.Map;
-import jaxx.compiler.types.TypeManager;
-import org.apache.commons.lang.StringUtils;
-
/**
* Represents an object in the <code>.java</code> file being generated during compilation. There is
* a <code>CompiledObject</code> for each class tag encountered, and certain tags may generate
@@ -49,94 +48,91 @@
*/
public class CompiledObject {
- /**
- * The object's id.
- */
+ /** The object's id. */
private String id;
- /**
- * Java code referring to the object.
- */
+
+ /** Java code referring to the object. */
private String javaCode;
- /**
- * The object's class.
- */
+
+ /** The object's class. */
private ClassDescriptor objectClass;
- /**
- * The style class.
- */
+
+ /** The style class. */
private String styleClass;
- /**
- * The container containing this CompiledObject.
- */
+
+ /** The container containing this CompiledObject. */
private CompiledObject parent;
+
/**
* true if this object overrides an object of the same id in a superclass
* of the object being compiled
*/
private boolean override;
+
/**
- * Comma-separated Java code snippets representing the parameters that
+ * Comma-separated Java code snippets representing the parameters that
* should be passed to the object's constructor.
*/
private String constructorParams;
+
/**
* Java code snippet which performs basic initialization of the object (after it has already been constructed).
* Because CompiledObject initialization order cannot be guaranteed, it is not safe to refer to other
* CompiledObjects from initializationCode -- you must refer to them from additionCode instead.
*/
private StringBuffer initializationCode = new StringBuffer();
+
/**
* Java code snippet which completes setup by adding any child objects, or otherwise manipulates any refererenced
* objects. Because CompiledObject initialization order cannot be guaranteed, it is not safe to refer to other
* CompiledObjects from initializationCode -- you must refer to them from additionCode instead.
*/
private StringBuffer additionCode = new StringBuffer();
- /**
- * List of all registered event handlers.
- */
+
+ /** List of all registered event handlers. */
private List<EventHandler> eventHandlers = new ArrayList<EventHandler>();
- /**
- * All properties that have been applied to this CompiledObject.
- */
+
+ /** All properties that have been applied to this CompiledObject. */
private Map<String, String> properties = new HashMap<String, String>();
- /**
- * generic types of the compiled object
- */
+
+ /** generic types of the compiled object */
private String[] genericTypes;
+
/**
* a flag to indicate if javaBean full support must be support for this
* object by root object
*/
private boolean javaBean;
- /**
- * code to initialize the bean (can be null)
- */
+
+ /** code to initialize the bean (can be null) */
private String javaBeanInitCode;
- /**
- * the type of the override object (can be null if no overide)
- */
+
+ /** the type of the override object (can be null if no overide) */
private ClassDescriptor overrideType;
- /**
- * the decorator
- */
+
+ /** the decorator */
private CompiledObjectDecorator decorator;
- /**
- * client properties
- */
+
+ /** client properties */
private Map<String, String> clientProperties;
- /**
- * initializer of the object
- */
+
+ /** initializer of the object */
private String initializer;
public class ChildRef {
CompiledObject child;
+
String constraints;
+
String childJavaCode;
+
private String delegateCode;
- public ChildRef(CompiledObject child, String constraints, String childJavaCode, String delegateCode) {
+ public ChildRef(CompiledObject child,
+ String constraints,
+ String childJavaCode,
+ String delegateCode) {
this.child = child;
this.constraints = constraints;
this.childJavaCode = childJavaCode;
@@ -155,7 +151,8 @@
this.childJavaCode = childJavaCode;
}
- public void addToAdditionCode(StringBuffer buffer, boolean isRootObject) {
+ public void addToAdditionCode(StringBuffer buffer,
+ boolean isRootObject) {
//TC-20091026 do not prefix if on root object
String prefix;
if (isRootObject) {
@@ -164,18 +161,30 @@
prefix = javaCode + delegateCode + ".";
}
if (constraints != null) {
- buffer.append(prefix).append("add(").append(childJavaCode).append(", ").append(constraints).append(");");
+ buffer.append(prefix);
+ buffer.append("add(");
+ buffer.append(childJavaCode);
+ buffer.append(", ");
+ buffer.append(constraints);
+ buffer.append(");");
} else {
- buffer.append(prefix).append("add(").append(childJavaCode).append(");");
+ buffer.append(prefix);
+ buffer.append("add(");
+ buffer.append(childJavaCode);
+ buffer.append(");");
}
buffer.append(JAXXCompiler.getLineSeparator());
}
}
+
private List<ChildRef> childs;
/**
- * Creates a new <code>CompiledObject</code>. To be useful, the object should be registered with a
- * <code>JAXXCompiler</code> using {@link JAXXCompiler#registerCompiledObject registerCompiledObject}.
+ * Creates a new <code>CompiledObject</code>.
+ * <p/>
+ * To be useful, the object should be registered with a
+ * <code>JAXXCompiler</code> using
+ * {@link JAXXCompiler#registerCompiledObject registerCompiledObject}.
*
* @param id the object's id
* @param objectClass the object's class
@@ -260,7 +269,7 @@
}
/**
- * True if this object overrides an object in the superclass of the class
+ * True if this object overrides an object in the superclass of the class
* being compiled. For this to be true, the class currently being compiled
* must be a subclass of another <code>JAXXObject</code> which has an
* identically-named object.
@@ -325,7 +334,7 @@
* Sets this object's parent container.
*
* @param parent the parent container
- * @throws IllegalArgumentException if parent is not a {@link Container}
+ * @throws IllegalArgumentException if parent is not a {@link Container}
*/
public void setParent(CompiledObject parent) throws IllegalArgumentException {
if (!ClassDescriptorHelper.getClassDescriptor(Container.class).isAssignableFrom(parent.getObjectClass())) {
@@ -347,7 +356,7 @@
}
/**
- * Returns the name of the method that should be generated in the compiled
+ * Returns the name of the method that should be generated in the compiled
* <code>.java</code> file in order to add children to this object. This
* is just a suggestion and may be ignored.
*
@@ -378,7 +387,7 @@
}
/**
- * Returns Java code used to refer to this object in the compiled Java file.
+ * Returns Java code used to refer to this object in the compiled Java file.
* This is usually the same as its id.
*
* @return the Java code for this object
@@ -415,7 +424,7 @@
}
/**
- * Returns a list of comma-separated Java code snippets that represent the
+ * Returns a list of comma-separated Java code snippets that represent the
* parameters to pass to this object's constructor.
*
* @return the raw constructor params
@@ -429,7 +438,7 @@
* Sets the parameters to pass to this object's constructor.
*
* @param constructorParams comma-separated Java code snippets representing
- * constructor params
+ * constructor params
* @see #getConstructorParams
*/
public void setConstructorParams(String constructorParams) {
@@ -447,7 +456,7 @@
/**
* Returns the code that performs basic initialization of this object,
* after it has already been constructed.
- * This basic code should not reference any other
+ * This basic code should not reference any other
* <code>CompiledObjects</code> as they may not have been created yet.
*
* @param compiler compiler to use
@@ -468,8 +477,8 @@
//TC-20091026 use 'this' instead of root object javaCode
//TC-20091105 JAXXUtil.getEventListener is generic, no more need cast and use simple name
return getJavaCode() + '.' + addMethod.getName() + "(JAXXUtil.getEventListener(" + listenerClass.getSimpleName() + ".class, " +
- TypeManager.getJavaCode(handler.getListenerMethod().getName()) + ", this, " +
- TypeManager.getJavaCode(compiler.getEventHandlerMethodName(handler)) + "));" + JAXXCompiler.getLineSeparator();
+ TypeManager.getJavaCode(handler.getListenerMethod().getName()) + ", this, " +
+ TypeManager.getJavaCode(compiler.getEventHandlerMethodName(handler)) + "));" + JAXXCompiler.getLineSeparator();
}
/**
@@ -512,7 +521,7 @@
}
/**
- * Stores a property for this object. The only effect of calling this
+ * Stores a property for this object. The only effect of calling this
* method is that the property will be returned by {@code getProperties()}.
*
* @param property the name of the property
@@ -556,7 +565,12 @@
}
// TODO: remove this temporary method and complete switchover to MethodDescriptors
- public void addEventHandler(String eventId, Method addMethod, Method listenerMethod, String code, JAXXCompiler compiler) {
+
+ public void addEventHandler(String eventId,
+ Method addMethod,
+ Method listenerMethod,
+ String code,
+ JAXXCompiler compiler) {
try {
ClassDescriptor descriptor = ClassDescriptorHelper.getClassDescriptor(getObjectClass().getName());
String listenerClassName = addMethod.getParameterTypes()[0].getName();
@@ -580,14 +594,26 @@
* @param compiler the current <code>JAXXCompiler</code>
* @see #getInitializationCode
*/
- public void addEventHandler(String eventId, MethodDescriptor addMethod, MethodDescriptor listenerMethod, String code, JAXXCompiler compiler) {
- EventHandler handler = new EventHandler(getId() + "." + eventId, getJavaCode(), addMethod, addMethod.getParameterTypes()[0], listenerMethod, code);
+ public void addEventHandler(String eventId,
+ MethodDescriptor addMethod,
+ MethodDescriptor listenerMethod,
+ String code,
+ JAXXCompiler compiler) {
+ EventHandler handler = new EventHandler(
+ getId() + "." + eventId,
+ getJavaCode(),
+ addMethod,
+ addMethod.getParameterTypes()[0],
+ listenerMethod,
+ code
+ );
compiler.registerEventHandler(handler);
eventHandlers.add(handler);
if (getJavaCode().contains(".")) {
// object lives in another JAXX file and consequently its initialization code won't be output
- compiler.appendInitializerCode(getInitializationCode(handler, compiler));
+ compiler.appendInitializerCode(
+ getInitializationCode(handler, compiler));
}
}
@@ -600,12 +626,13 @@
* @throws CompilerException if this object is not a container
* @see #addChild(CompiledObject, String, JAXXCompiler)
*/
- public void addChild(CompiledObject child, JAXXCompiler compiler) throws CompilerException {
+ public void addChild(CompiledObject child,
+ JAXXCompiler compiler) throws CompilerException {
addChild(child, null, compiler);
}
/**
- * Adds a child component to this container. This variant allows the Java
+ * Adds a child component to this container. This variant allows the Java
* code for a layout constraints object to be specified.
*
* @param child the component to add
@@ -614,28 +641,38 @@
* @throws CompilerException if this object is not a container
* @see #addChild(CompiledObject, JAXXCompiler)
*/
- public void addChild(CompiledObject child, String constraints, JAXXCompiler compiler) throws CompilerException {
+ public void addChild(CompiledObject child,
+ String constraints,
+ JAXXCompiler compiler) throws CompilerException {
try {
if (constraints != null) {
constraints = compiler.checkJavaCode(constraints);
}
} catch (CompilerException e) {
- compiler.reportError("While parsing 'constraints' attribute: " + e.getMessage());
+ compiler.reportError(
+ "While parsing 'constraints' attribute: " + e.getMessage());
}
if (!child.isOverride()) {
TagHandler tagHandler = TagManager.getTagHandler(getObjectClass());
if (tagHandler instanceof DefaultComponentHandler &&
- !((DefaultComponentHandler) tagHandler).isContainer()) {
+ !((DefaultComponentHandler) tagHandler).isContainer()) {
compiler.reportError("component " + this + " may not have children");
}
String containerDelegate = ((DefaultComponentHandler) tagHandler).getContainerDelegate();
- String delegateCode = containerDelegate != null ? "." + containerDelegate + "()" : "";
+ String delegateCode = containerDelegate != null ?
+ "." + containerDelegate + "()" :
+ "";
child.setParent(this);
- childs.add(new ChildRef(child, constraints, child.getJavaCode(), delegateCode));
+ ChildRef ref = new ChildRef(child,
+ constraints,
+ child.getJavaCode(),
+ delegateCode
+ );
+ childs.add(ref);
}
}
@@ -710,7 +747,8 @@
// compute additionCode for all childs
StringBuffer buffer = new StringBuffer();
for (ChildRef childRef : refList) {
- childRef.addToAdditionCode(buffer, equals(compiler.getRootObject()));
+ childRef.addToAdditionCode(buffer,
+ equals(compiler.getRootObject()));
}
additionCode = buffer.append(additionCode);
}
@@ -721,6 +759,6 @@
}
public String getGetterName() {
- return "get"+StringUtils.capitalize(id);
+ return "get" + StringUtils.capitalize(id);
}
}
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JScrollPaneHandler.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JScrollPaneHandler.java 2010-09-06 12:55:58 UTC (rev 2064)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JScrollPaneHandler.java 2010-09-06 13:01:38 UTC (rev 2065)
@@ -25,39 +25,80 @@
package jaxx.compiler.tags.swing;
+import jaxx.compiler.CompiledObject;
import jaxx.compiler.CompilerException;
-import jaxx.compiler.CompiledObject;
import jaxx.compiler.JAXXCompiler;
import jaxx.compiler.reflect.ClassDescriptor;
import jaxx.compiler.reflect.ClassDescriptorHelper;
import jaxx.compiler.tags.DefaultComponentHandler;
+import org.apache.commons.lang.StringUtils;
import javax.swing.JScrollPane;
public class JScrollPaneHandler extends DefaultComponentHandler {
- public JScrollPaneHandler(ClassDescriptor beanClass) {
- super(beanClass);
- ClassDescriptorHelper.checkSupportClass(getClass(), beanClass, JScrollPane.class);
- }
+ public static class JScrollPaneCompiledObject extends CompiledObject {
- @Override
- public CompiledObject createCompiledObject(String id, JAXXCompiler compiler) throws CompilerException {
- return new CompiledObject(id, getBeanClass(), compiler) {
+ boolean hasChild;
- boolean hasChild;
+ boolean hasColumnViewHeader;
- @Override
- public void addChild(CompiledObject child, String constraints, JAXXCompiler compiler) throws CompilerException {
- if (constraints != null) {
- compiler.reportError("JScrollPane does not accept constraints");
- }
- if (hasChild) {
- compiler.reportError("JScrollPane may only have one child");
- }
+ public static final String COLUMN_HEADER_VIEW = "columnHeaderView";
+
+ public JScrollPaneCompiledObject(String id,
+ ClassDescriptor beanclass,
+ JAXXCompiler compiler) {
+ super(id, beanclass, compiler);
+ }
+
+ @Override
+ public void addChild(CompiledObject child,
+ String constraints,
+ JAXXCompiler compiler) throws CompilerException {
+ if (constraints != null) {
+ compiler.reportError("JScrollPane does not accept constraints");
+ }
+
+ if (!hasChild) {
+ // first child is always the view port component
super.addChild(child, constraints, compiler);
hasChild = true;
+ return;
}
- };
+
+ if (!hasColumnViewHeader) {
+
+ // try to add a column view header
+ String property =
+ (String) getProperties().get(COLUMN_HEADER_VIEW);
+
+ if (log.isDebugEnabled()) {
+ log.info("property to match " + property + " against child " + child.getId());
+ }
+ if (!StringUtils.isEmpty(property) &&
+ ("{" + child.getId() + "}").equals(property)) {
+ hasColumnViewHeader = true;
+ return;
+ }
+ }
+
+ compiler.reportError(
+ "JScrollPane may only have one child (found another child : " + child.getId() + ").");
+
+ }
}
+
+ public JScrollPaneHandler(ClassDescriptor beanClass) {
+ super(beanClass);
+ ClassDescriptorHelper.checkSupportClass(getClass(),
+ beanClass,
+ JScrollPane.class
+ );
+ }
+
+ @Override
+ public CompiledObject createCompiledObject(String id,
+ JAXXCompiler compiler) throws CompilerException {
+ return new JScrollPaneCompiledObject(id, getBeanClass(), compiler);
+ }
}
1
0
r2064 - in trunk/jaxx-runtime/src: main/java/jaxx/runtime/decorator test/java/jaxx/runtime/decorator
by tchemit@users.nuiton.org 06 Sep '10
by tchemit@users.nuiton.org 06 Sep '10
06 Sep '10
Author: tchemit
Date: 2010-09-06 14:55:58 +0200 (Mon, 06 Sep 2010)
New Revision: 2064
Url: http://nuiton.org/repositories/revision/jaxx/2064
Log:
Anomalie #853: when using MultiJxPathDecorator, can not use extra token formatter in expression
Evolution #850: Can sort in reverse order in DecoratorUtils
+ reformat code, fix test
Modified:
trunk/jaxx-runtime/src/main/java/jaxx/runtime/decorator/DecoratorUtils.java
trunk/jaxx-runtime/src/main/java/jaxx/runtime/decorator/JXPathDecorator.java
trunk/jaxx-runtime/src/main/java/jaxx/runtime/decorator/MultiJXPathDecorator.java
trunk/jaxx-runtime/src/main/java/jaxx/runtime/decorator/PropertyDecorator.java
trunk/jaxx-runtime/src/test/java/jaxx/runtime/decorator/Data.java
trunk/jaxx-runtime/src/test/java/jaxx/runtime/decorator/DecoratorProviderTest.java
trunk/jaxx-runtime/src/test/java/jaxx/runtime/decorator/MultiJXPathDecoratorTest.java
Modified: trunk/jaxx-runtime/src/main/java/jaxx/runtime/decorator/DecoratorUtils.java
===================================================================
--- trunk/jaxx-runtime/src/main/java/jaxx/runtime/decorator/DecoratorUtils.java 2010-09-04 23:22:35 UTC (rev 2063)
+++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/decorator/DecoratorUtils.java 2010-09-06 12:55:58 UTC (rev 2064)
@@ -26,8 +26,16 @@
import jaxx.runtime.decorator.JXPathDecorator.Context;
import jaxx.runtime.decorator.JXPathDecorator.JXPathComparator;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+import java.util.StringTokenizer;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
/**
* Some usefull methods on {@link Decorator} to create, and sort data with
@@ -49,6 +57,10 @@
*/
public class DecoratorUtils {
+ /** Logger */
+ private static final Log log = LogFactory.getLog(DecoratorUtils.class);
+
+
/**
* Factory method to instanciate a new {@link PropertyDecorator} for the
* given class {@code internlaClass} and a readable property name.
@@ -146,6 +158,25 @@
public static <O> void sort(JXPathDecorator<O> decorator,
List<O> datas,
int pos) {
+ sort(decorator, datas, pos, false);
+ }
+
+ /**
+ * Sort a list of data based on the first token property of a given context
+ * in a given decorator.
+ *
+ * @param <O> type of data to sort
+ * @param decorator the decorator to use to sort
+ * @param datas the list of data to sort
+ * @param pos the index of context to used in decorator to obtain
+ * sorted property.
+ * @param reverse flag to sort in reverse order if sets to {@code true}
+ * @since 2.2
+ */
+ public static <O> void sort(JXPathDecorator<O> decorator,
+ List<O> datas,
+ int pos,
+ boolean reverse) {
Comparator<O> c = null;
boolean cachedComparator = false;
try {
@@ -156,6 +187,11 @@
((JXPathComparator<O>) c).init(decorator, datas);
}
Collections.sort(datas, c);
+ if (reverse) {
+
+ // reverse order
+ Collections.reverse(datas);
+ }
} finally {
if (cachedComparator) {
((JXPathComparator<?>) c).clear();
@@ -171,9 +207,11 @@
int start;
while ((start = expression.indexOf("${", end + 1)) > -1) {
if (start > end + 1) {
+
// prefix of next jxpath token
buffer.append(expression.substring(end + 1, start));
}
+
// seek end of jxpath
end = expression.indexOf("}", start + 1);
if (end == -1) {
@@ -182,23 +220,27 @@
start + " : " + expression.substring(start + 2));
}
String jxpath = expression.substring(start + 2, end);
+
// not allowed ${ inside a jxpath token
- if (jxpath.indexOf("${") > -1) {
+ if (jxpath.contains("${")) {
throw new IllegalArgumentException(
"could not find a ${ inside a jxpath expression at " +
"car " + (start + 2) + " : " + jxpath);
}
+
// save the jxpath token
lTokens.add(jxpath);
+
// replace jxpath token in expresion with a string format variable
buffer.append('%').append(lTokens.size());
}
- if (size > (end + 1)) {
+ if (size > end + 1) {
+
// suffix after end jxpath (or all expression if no jxpath)
buffer.append(expression.substring(end + 1));
}
- return new Context<O>(buffer.toString(), lTokens.toArray(
- new String[lTokens.size()]));
+ String[] tokens = lTokens.toArray(new String[lTokens.size()]);
+ return new Context<O>(buffer.toString(), tokens);
}
public static <O> Context<O>[] createMultiJXPathContext(
@@ -220,16 +262,32 @@
int nbTokens = tokens.size();
Context<O>[] contexts = newInstance(nbTokens);
+ if (log.isDebugEnabled()) {
+ log.debug("Will prepare " + nbTokens + " contexts from [" + expression + "]");
+ }
for (int i = 0; i < nbTokens; i++) {
StringBuilder buffer = new StringBuilder(expression.length());
for (int j = 0; j < nbTokens; j++) {
int index = (i + j) % nbTokens;
String str = tokens.get(index);
- //todo replace %index with %j
- buffer.append(separatorReplacement).append(str);
+
+ //replace all '%(index+1)$' pattern with '%(j+1)$'
+ Pattern p = Pattern.compile("\\%(" + (index + 1) + ")\\$");
+ Matcher matcher = p.matcher(str);
+ String safeStr = matcher.replaceAll("\\%" + (j + 1) + "\\$");
+
+ if (log.isDebugEnabled()) {
+ log.debug("[" + (index + 1) + "-->" + (j + 1) + "] " + str +
+ " transformed to " + safeStr);
+ }
+ buffer.append(separatorReplacement).append(safeStr);
}
+ String expr = buffer.substring(separatorReplacement.length());
+ if (log.isDebugEnabled()) {
+ log.debug("context [" + i + "] : " + expr);
+ }
contexts[i] = createJXPathContext(
- buffer.substring(separatorReplacement.length()));
+ expr);
}
return contexts;
}
Modified: trunk/jaxx-runtime/src/main/java/jaxx/runtime/decorator/JXPathDecorator.java
===================================================================
--- trunk/jaxx-runtime/src/main/java/jaxx/runtime/decorator/JXPathDecorator.java 2010-09-04 23:22:35 UTC (rev 2063)
+++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/decorator/JXPathDecorator.java 2010-09-06 12:55:58 UTC (rev 2064)
@@ -29,7 +29,11 @@
import org.apache.commons.logging.LogFactory;
import java.io.Serializable;
-import java.util.*;
+import java.util.Arrays;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
/**
* JXPath decorator based on {@link String#format(String, Object...)} method.
@@ -58,21 +62,17 @@
public class JXPathDecorator<O> extends Decorator<O> {
private static final long serialVersionUID = 1L;
- /**
- * Logger
- */
+
+ /** Logger */
private static final Log log = LogFactory.getLog(JXPathDecorator.class);
- /**
- * the computed context of the decorator
- */
+
+ /** the computed context of the decorator */
protected Context<O> context;
- /**
- * nb jxpath tokens to compute
- */
+
+ /** nb jxpath tokens to compute */
protected int nbToken;
- /**
- * the initial expression used to compute the decorator context.
- */
+
+ /** the initial expression used to compute the decorator context. */
protected String initialExpression;
protected JXPathDecorator(Class<O> internalClass,
@@ -99,13 +99,20 @@
args[i] = getTokenValue(jxcontext, context.tokens[i]);
} catch (Exception e) {
log.error("can not obtain token " + context.tokens[i]
- + "on object " + bean + " for reason " +
- e.getMessage(), e);
+ + "on object " + bean + " for reason " +
+ e.getMessage(), e);
}
}
- return String.format(context.expression, args);
+ String result;
+ try {
+ result = String.format(context.expression, args);
+ } catch (Exception eee) {
+ log.error("Could not format " + context.expression + " with args : " + Arrays.toString(args), eee);
+ result = "";
+ }
+ return result;
}
public String getProperty(int pos) {
@@ -159,6 +166,7 @@
public static class JXPathComparator<O> implements Comparator<O> {
protected Map<O, Comparable<Comparable<?>>> valueCache;
+
private final String expression;
public JXPathComparator(String expression) {
@@ -204,11 +212,12 @@
* all variables are compute using using the jxpath tokens.
*/
protected String expression;
- /**
- * list of jxpath tokens to apply on expression
- */
+
+ /** list of jxpath tokens to apply on expression */
protected String[] tokens;
+
protected transient Comparator<O> comparator;
+
private static final long serialVersionUID = 1L;
public Context(String expression, String[] tokens) {
@@ -234,15 +243,15 @@
@Override
public String toString() {
return "<expression:" + expression + ", tokens:" +
- Arrays.toString(tokens) + '>';
+ Arrays.toString(tokens) + '>';
}
}
protected static void ensureTokenIndex(JXPathDecorator<?> decorator, int pos) {
if (pos < -1 || pos > decorator.getNbToken()) {
throw new ArrayIndexOutOfBoundsException("token index " + pos +
- " is out of bound, can be inside [" +
- 0 + ',' + decorator.nbToken + ']');
+ " is out of bound, can be inside [" +
+ 0 + ',' + decorator.nbToken + ']');
}
}
}
Modified: trunk/jaxx-runtime/src/main/java/jaxx/runtime/decorator/MultiJXPathDecorator.java
===================================================================
--- trunk/jaxx-runtime/src/main/java/jaxx/runtime/decorator/MultiJXPathDecorator.java 2010-09-04 23:22:35 UTC (rev 2063)
+++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/decorator/MultiJXPathDecorator.java 2010-09-06 12:55:58 UTC (rev 2064)
@@ -60,7 +60,7 @@
String separator,
String separatorReplacement,
Context<O>[] contexts) throws IllegalArgumentException,
- NullPointerException {
+ NullPointerException {
super(internalClass, expression, null);
this.separator = separator;
this.separatorReplacement = separatorReplacement;
Modified: trunk/jaxx-runtime/src/main/java/jaxx/runtime/decorator/PropertyDecorator.java
===================================================================
--- trunk/jaxx-runtime/src/main/java/jaxx/runtime/decorator/PropertyDecorator.java 2010-09-04 23:22:35 UTC (rev 2063)
+++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/decorator/PropertyDecorator.java 2010-09-06 12:55:58 UTC (rev 2064)
@@ -39,7 +39,7 @@
* <p/>
* For example :
* <pre>
- * Decorator<Object> d = DecoratorUtils.newPropertyDecorator(PropertyDecorator.class,"expressions");
+ * Decorator<Object> d = DecoratorUtils.newPropertyDecorator(PropertyDecorator.class,"property");
* </pre>
*
* @author tchemit <chemit(a)codelutin.com>
Modified: trunk/jaxx-runtime/src/test/java/jaxx/runtime/decorator/Data.java
===================================================================
--- trunk/jaxx-runtime/src/test/java/jaxx/runtime/decorator/Data.java 2010-09-04 23:22:35 UTC (rev 2063)
+++ trunk/jaxx-runtime/src/test/java/jaxx/runtime/decorator/Data.java 2010-09-06 12:55:58 UTC (rev 2064)
@@ -41,7 +41,6 @@
}
Data(int pos, String name) {
- super();
this.pos = pos;
this.name = name;
}
Modified: trunk/jaxx-runtime/src/test/java/jaxx/runtime/decorator/DecoratorProviderTest.java
===================================================================
--- trunk/jaxx-runtime/src/test/java/jaxx/runtime/decorator/DecoratorProviderTest.java 2010-09-04 23:22:35 UTC (rev 2063)
+++ trunk/jaxx-runtime/src/test/java/jaxx/runtime/decorator/DecoratorProviderTest.java 2010-09-06 12:55:58 UTC (rev 2064)
@@ -46,7 +46,6 @@
registerPropertyDecorator(File.class, "name");
registerPropertyDecorator(File.class, BY_NAME, "parent");
-
registerJXPathDecorator(Class.class, "${simpleName}$s");
registerJXPathDecorator(Class.class, BY_NAME, "${name}$s");
Modified: trunk/jaxx-runtime/src/test/java/jaxx/runtime/decorator/MultiJXPathDecoratorTest.java
===================================================================
--- trunk/jaxx-runtime/src/test/java/jaxx/runtime/decorator/MultiJXPathDecoratorTest.java 2010-09-04 23:22:35 UTC (rev 2063)
+++ trunk/jaxx-runtime/src/test/java/jaxx/runtime/decorator/MultiJXPathDecoratorTest.java 2010-09-06 12:55:58 UTC (rev 2064)
@@ -189,14 +189,14 @@
assertEquals(expected, result);
decorator.setContextIndex(1);
- assertEquals("%1$d - %2$s %3$s - %3$s", decorator.getExpression());
+ assertEquals("%1$d - %2$s %2$s - %3$s", decorator.getExpression());
assertTokens("nbToken", "separator", "expression");
expected = String.format(decorator.getExpression(), decorator.getNbToken(), decorator.getSeparator(), decorator.getExpression());
result = decorator.toString(decorator);
assertEquals(expected, result);
decorator.setContextIndex(2);
- assertEquals("%1$s %3$s - %2$s - %3$d", decorator.getExpression());
+ assertEquals("%1$s %1$s - %2$s - %3$d", decorator.getExpression());
assertTokens("separator", "expression", "nbToken");
expected = String.format(decorator.getExpression(), decorator.getSeparator(), decorator.getExpression(), decorator.getNbToken());
1
0
r2063 - in trunk/jaxx-demo/src/main: filters java/jaxx/demo/component/jaxx java/jaxx/demo/component/jaxx/editor
by tchemit@users.nuiton.org 04 Sep '10
by tchemit@users.nuiton.org 04 Sep '10
04 Sep '10
Author: tchemit
Date: 2010-09-05 01:22:35 +0200 (Sun, 05 Sep 2010)
New Revision: 2063
Url: http://nuiton.org/repositories/revision/jaxx/2063
Log:
add headers + fix jaxx-demo site url
Modified:
trunk/jaxx-demo/src/main/filters/jaxx-demo.properties
trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/BoxedDecoratorDemo.css
trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/editor/TimeEditorDemo.css
trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/editor/TimeEditorDemo.jaxx
trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/editor/TimeEditorDemoModel.java
Modified: trunk/jaxx-demo/src/main/filters/jaxx-demo.properties
===================================================================
--- trunk/jaxx-demo/src/main/filters/jaxx-demo.properties 2010-09-04 21:14:57 UTC (rev 2062)
+++ trunk/jaxx-demo/src/main/filters/jaxx-demo.properties 2010-09-04 23:22:35 UTC (rev 2063)
@@ -1,6 +1,6 @@
application.name=${project.name}
application.version=${project.version}
-application.site.url=http://maven-site.nuiton.org/jaxx/jaxx-example
+application.site.url=http://maven-site.nuiton.org/jaxx/jaxx-demo
application.icon.path=/icons/jaxx.png
application.license.path=META-INF/${project.artifactId}-LICENSE.txt
application.third-party.path=META-INF/${project.artifactId}-THIRD-PARTY.txt
Modified: trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/BoxedDecoratorDemo.css
===================================================================
--- trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/BoxedDecoratorDemo.css 2010-09-04 21:14:57 UTC (rev 2062)
+++ trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/BoxedDecoratorDemo.css 2010-09-04 23:22:35 UTC (rev 2063)
@@ -1,3 +1,27 @@
+/*
+ * #%L
+ * JAXX :: Demo
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2008 - 2010 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
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
#layerUI {
blockIcon:{SwingUtil.createImageIcon("action-block.png")};
acceptIcon:{SwingUtil.createImageIcon("action-accept.png")};
Modified: trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/editor/TimeEditorDemo.css
===================================================================
--- trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/editor/TimeEditorDemo.css 2010-09-04 21:14:57 UTC (rev 2062)
+++ trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/editor/TimeEditorDemo.css 2010-09-04 23:22:35 UTC (rev 2063)
@@ -1,3 +1,27 @@
+/*
+ * #%L
+ * JAXX :: Demo
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2008 - 2010 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
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
#configPanel {
border:{new TitledBorder(_("jaxxdemo.numbereditor.configuration"))};
layout:{new GridLayout(0,1)};
Modified: trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/editor/TimeEditorDemo.jaxx
===================================================================
--- trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/editor/TimeEditorDemo.jaxx 2010-09-04 21:14:57 UTC (rev 2062)
+++ trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/editor/TimeEditorDemo.jaxx 2010-09-04 23:22:35 UTC (rev 2063)
@@ -1,3 +1,27 @@
+<!--
+ #%L
+ JAXX :: Demo
+
+ $Id$
+ $HeadURL$
+ %%
+ Copyright (C) 2008 - 2010 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
+ <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ #L%
+ -->
<jaxx.demo.DemoPanel layout='{new BorderLayout()}'>
<import>
Modified: trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/editor/TimeEditorDemoModel.java
===================================================================
--- trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/editor/TimeEditorDemoModel.java 2010-09-04 21:14:57 UTC (rev 2062)
+++ trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/editor/TimeEditorDemoModel.java 2010-09-04 23:22:35 UTC (rev 2063)
@@ -1,3 +1,27 @@
+/*
+ * #%L
+ * JAXX :: Demo
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2008 - 2010 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
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
package jaxx.demo.component.jaxx.editor;
import jaxx.runtime.swing.editor.TimeEditor;
1
0
Author: tchemit
Date: 2010-09-04 23:14:57 +0200 (Sat, 04 Sep 2010)
New Revision: 2062
Url: http://nuiton.org/repositories/revision/jaxx/2062
Log:
add header
Modified:
trunk/src/site/rst/spec-validator2.rst
Modified: trunk/src/site/rst/spec-validator2.rst
===================================================================
--- trunk/src/site/rst/spec-validator2.rst 2010-09-04 21:14:18 UTC (rev 2061)
+++ trunk/src/site/rst/spec-validator2.rst 2010-09-04 21:14:57 UTC (rev 2062)
@@ -1,3 +1,27 @@
+.. -
+.. * #%L
+.. * JAXX
+.. *
+.. * $Id$
+.. * $HeadURL$
+.. * %%
+.. * Copyright (C) 2008 - 2010 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
+.. * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+.. * #L%
+.. -
=========================================================================
Amelioration de la gestion des validateurs dans les interfaces graphiques
=========================================================================
1
0