Author: tchemit Date: 2010-03-27 17:12:27 +0100 (Sat, 27 Mar 2010) New Revision: 1816 Log: Evolution #420: Nettoyer les listeners qui ne servent plus Modified: trunk/jaxx-runtime/src/main/java/jaxx/runtime/JAXXUtil.java trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardModel.java trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/AboutPanel.jaxx trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/ErrorDialogUI.jaxx trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/ConfigUI.jaxx trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/ConfigUIBuilder.java trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/model/CategoryModel.java trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/model/ConfigTableModel.java trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/model/ConfigUIModel.java trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/model/ConfigUIModelBuilder.java trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/model/OptionModel.java trunk/jaxx-widgets/src/test/java/jaxx/runtime/swing/editor/config/model/ConfigUIModelBuilderTest.java Modified: trunk/jaxx-runtime/src/main/java/jaxx/runtime/JAXXUtil.java =================================================================== --- trunk/jaxx-runtime/src/main/java/jaxx/runtime/JAXXUtil.java 2010-03-26 18:15:08 UTC (rev 1815) +++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/JAXXUtil.java 2010-03-27 16:12:27 UTC (rev 1816) @@ -25,8 +25,11 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import javax.swing.*; +import java.awt.*; import java.beans.PropertyChangeListener; import java.beans.PropertyChangeListenerProxy; +import java.beans.PropertyChangeSupport; import java.io.IOException; import java.lang.ref.WeakReference; import java.lang.reflect.InvocationHandler; @@ -34,6 +37,7 @@ import java.lang.reflect.Method; import java.lang.reflect.Proxy; import java.util.*; +import java.util.List; public class JAXXUtil { @@ -290,6 +294,46 @@ return listener; } + /** + * Remove all listeners registred in given {@code pcs}. + * + * @param pcs the pcs to clean + */ + public static void destroy(PropertyChangeSupport pcs) { + PropertyChangeListener[] listeners = pcs.getPropertyChangeListeners(); + for (PropertyChangeListener l : listeners) { + if (log.isInfoEnabled()) { + if (l instanceof PropertyChangeListenerProxy) { + PropertyChangeListenerProxy ll = (PropertyChangeListenerProxy) l; + log.info("remove property change listener " + ll.getPropertyName() + " : " + l); + } else { + log.info("remove property change listener " + l); + } + } + pcs.removePropertyChangeListener(l); + } + } + + /** + * Remove all listeners registred in given {@code component}. + * + * @param component the pcs to clean + */ + public static void destroy(Component component) { + PropertyChangeListener[] listeners = component.getPropertyChangeListeners(); + for (PropertyChangeListener l : listeners) { + if (log.isInfoEnabled()) { + if (l instanceof PropertyChangeListenerProxy) { + PropertyChangeListenerProxy ll = (PropertyChangeListenerProxy) l; + log.info("remove property change listener " + ll.getPropertyName() + " : " + l); + } else { + log.info("remove property change listener " + l); + } + } + component.removePropertyChangeListener(l); + } + } + public static boolean assignment(boolean value, String name, JAXXObject src) { Modified: trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardModel.java =================================================================== --- trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardModel.java 2010-03-26 18:15:08 UTC (rev 1815) +++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardModel.java 2010-03-27 16:12:27 UTC (rev 1816) @@ -20,6 +20,8 @@ */ package jaxx.runtime.swing.wizard; +import jaxx.runtime.JAXXUtil; + import java.beans.PropertyChangeListener; import java.beans.PropertyChangeSupport; import java.util.ArrayList; @@ -98,6 +100,11 @@ setStep(startStep); } + public void destroy() { + // suppression de tous les listeners + JAXXUtil.destroy(pcs); + } + public void gotoNextStep() { E nextStep = getNextStep(); if (nextStep == null) { @@ -224,11 +231,15 @@ } public void removePropertyChangeListeners() { - for (PropertyChangeListener l : pcs.getPropertyChangeListeners()) { - pcs.removePropertyChangeListener(l); - } + JAXXUtil.destroy(pcs); } + @Override + protected void finalize() throws Throwable { + super.finalize(); + destroy(); + } + public void validate() { if (step == null) { // pas de validation quand aucune etape n'est sélectionnée Modified: trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/AboutPanel.jaxx =================================================================== --- trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/AboutPanel.jaxx 2010-03-26 18:15:08 UTC (rev 1815) +++ trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/AboutPanel.jaxx 2010-03-27 16:12:27 UTC (rev 1816) @@ -124,6 +124,17 @@ rootPane.setDefaultButton(close); rootPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke("ESCAPE"), "close"); rootPane.getActionMap().put("close", closeAction); + f.addWindowListener(new WindowAdapter() { + @Override + public void windowClosed(WindowEvent e) { + Component ui = (Component) e.getSource(); + if (log.isInfoEnabled()) { + log.info("destroy ui "+ ui); + } + JAXXUtil.destroy(ui); + JAXXUtil.destroy(AboutPanel.this); + } + }); SwingUtil.center(ui, f); f.setVisible(true); } Modified: trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/ErrorDialogUI.jaxx =================================================================== --- trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/ErrorDialogUI.jaxx 2010-03-26 18:15:08 UTC (rev 1815) +++ trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/ErrorDialogUI.jaxx 2010-03-27 16:12:27 UTC (rev 1816) @@ -42,6 +42,9 @@ instance.setVisible(true); } public static void disposeUI() { + if (instance != null) { + JAXXUtil.destroy(instance); + } instance=null; } Modified: trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/ConfigUI.jaxx =================================================================== --- trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/ConfigUI.jaxx 2010-03-26 18:15:08 UTC (rev 1815) +++ trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/ConfigUI.jaxx 2010-03-27 16:12:27 UTC (rev 1816) @@ -3,35 +3,47 @@ <style source='ConfigUI.css'/> <script><![CDATA[ - import jaxx.runtime.swing.editor.config.model.ConfigUIModel; +import jaxx.runtime.swing.editor.config.model.ConfigUIModel; - categories.setModel(new DefaultSingleSelectionModel() { +categories.setModel(new DefaultSingleSelectionModel() { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 1L; - @Override - public void setSelectedIndex(int index) { - // check if catgeory can be quit - boolean canContinue = !isSelected() || ConfigUIBuilder.canQuitCategory(ConfigUI.this); - if (canContinue) { - if (log.isDebugEnabled()) { - log.debug("new index : " + index); - } - // was authorized to continue - super.setSelectedIndex(index); + @Override + public void setSelectedIndex(int index) { + // check if catgeory can be quit + boolean canContinue = !isSelected() || ConfigUIBuilder.canQuitCategory(ConfigUI.this); + if (canContinue) { + if (log.isDebugEnabled()) { + log.debug("new index : " + index); } + // was authorized to continue + super.setSelectedIndex(index); } - }); + } +}); - protected void changeCategory(ChangeEvent e) { - JPanel p = (JPanel) getCategories().getSelectedComponent(); - if (p == null) { - // pas de selection - return; - } - getModel().setCategory(p.getName()); - getCategories().invalidate(); +public void destroy() { + log.info("destroy ui " + getName()); + JAXXUtil.destroy(this); + model.destroy(); +} + +@Override +protected void finalize() throws Throwable { + super.finalize(); + destroy(); +} + +protected void changeCategory(ChangeEvent e) { + JPanel p = (JPanel) getCategories().getSelectedComponent(); + if (p == null) { + // pas de selection + return; } + getModel().setCategory(p.getName()); + getCategories().invalidate(); +} ]]> </script> Modified: trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/ConfigUIBuilder.java =================================================================== --- trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/ConfigUIBuilder.java 2010-03-26 18:15:08 UTC (rev 1815) +++ trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/ConfigUIBuilder.java 2010-03-27 16:12:27 UTC (rev 1816) @@ -85,6 +85,8 @@ // just quit, no callBack can be apply here + ui.destroy(); + // close the configu ui parentWindow.dispose(); return; @@ -96,6 +98,8 @@ if (forSaved.isEmpty()) { // just quit, no callBack to call + ui.destroy(); + // close the configu ui parentWindow.dispose(); return; @@ -297,159 +301,4 @@ return response; } - - /** - * // prepare quit action - Action quitAction = new AbstractAction(quitButton.getText(), - quitButton.getIcon()) { - - private static final long serialVersionUID = 1L; - - @Override public void actionPerformed(ActionEvent e) { - if (!canQuitCategory(ui)) { - return; - } - - boolean needReloadUI = false; - boolean needReloadApplication = false; - - StringBuilder reloadUIBuffer = new StringBuilder(); - - StringBuilder reloadApplicationBuffer = new StringBuilder(); - - if (model.isSaved() && !model.isStandalone()) { - - - StringBuilder buffer = new StringBuilder(); - - // on doit verifier si des options sauvees necessite - // un redemarrage de l'application - for (CategoryModel cat : model) { - List<OptionModel> savedOptions = cat.getSavedOptions(); - List<OptionModel> needReloadUIOptions = new ArrayList<OptionModel>(); - List<OptionModel> needReloadApplicationOptions = new ArrayList<OptionModel>(); - if (!savedOptions.isEmpty()) { - Iterator<OptionModel> itr = savedOptions.iterator(); - buffer.append("\n").append(_("config.category.saved", _(cat.getCategory()))).append("\n"); - while (itr.hasNext()) { - OptionModel option = itr.next(); - buffer.append("\n- ").append(option.getKey()); - if (option.isNeedReloadApplication()) { - needReloadApplication = true; - needReloadApplicationOptions.add(option); - continue; - } - if (option.isNeedReloadUI()) { - needReloadUI = true; - needReloadUIOptions.add(option); - continue; - } - itr.remove(); - - } - if (!savedOptions.isEmpty()) { - - if (!needReloadApplicationOptions.isEmpty()) { - reloadApplicationBuffer.append("\n"); - reloadApplicationBuffer.append(_("config.category.needReloadApplication", _(cat.getCategory()))); - reloadApplicationBuffer.append("\n"); - // second pass to obtain needReloadUI - for (OptionModel option : needReloadApplicationOptions) { - reloadApplicationBuffer.append("\n- ").append(option.getKey()); - } - } - - if (!needReloadUIOptions.isEmpty()) { - reloadUIBuffer.append("\n"); - reloadUIBuffer.append(_("config.category.needReloadUI", _(cat.getCategory()))); - reloadUIBuffer.append("\n"); - // second pass to obtain needReloadUI - for (OptionModel option : needReloadUIOptions) { - reloadUIBuffer.append("\n- ").append(option.getKey()); - } - } - } - - } - } - - if (log.isInfoEnabled()) { - log.info("save options :\n" + buffer.toString()); - } - - if (needReloadApplication) { - - // reloading application implies reloading ui - needReloadUI = false; - - askUser(ui, - _("config.title.will.reload.application"), - _("config.model.needReloadApplication") + - reloadApplicationBuffer.toString(), - JOptionPane.INFORMATION_MESSAGE, - new Object[]{_("config.choice.ok")}, - 0); - } - - if (needReloadUI) { - askUser(ui, - _("config.title.will.reload.ui"), - _("config.model.needReloadUI") + - reloadUIBuffer.toString(), - JOptionPane.INFORMATION_MESSAGE, - new Object[]{_("config.choice.ok")}, - 0); - } - } - - // close the configu ui - ui.getParentContainer(Window.class).dispose(); - - if (needReloadApplication) { - - Runnable callback = model.getReloadApplicationCallback(); - if (callback == null) { - throw new IllegalStateException( - "No reloadApplicationCallback found in model"); - } - - SwingUtilities.invokeLater(callback); - } else if (needReloadUI) { - - Runnable callback = model.getReloadUICallback(); - if (callback == null) { - throw new IllegalStateException( - "No reloadUICallback found in model"); - } - SwingUtilities.invokeLater(callback); - } - - - } - }; - String tip = quitButton.getToolTipText(); - quitButton.setAction(quitAction); - quitButton.setToolTipText(tip); - - // build categories tabs - for (CategoryModel categoryModel : model) { - String category = categoryModel.getCategory(); - String categoryLabel = _(categoryModel.getCategoryLabel()); - ConfigCategoryUI p = new ConfigCategoryUI(new - JAXXInitialContext().add(ui).add(categoryModel)); - p.getCategoryLabel().setText(categoryLabel); - p.setName(category); - ui.getCategories().addTab(_(category), null, p, categoryLabel); - } - - model.setCategory(defaultCategory); - int categoryIndex = model.getCategoryIndex(defaultCategory); - if (log.isDebugEnabled()) { - log.debug("index of default category (" + defaultCategory + ") : " - + categoryIndex); - } - ui.getCategories().setSelectedIndex(categoryIndex); - return ui; - } - */ } Modified: trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/model/CategoryModel.java =================================================================== --- trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/model/CategoryModel.java 2010-03-26 18:15:08 UTC (rev 1815) +++ trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/model/CategoryModel.java 2010-03-27 16:12:27 UTC (rev 1816) @@ -20,6 +20,8 @@ */ package jaxx.runtime.swing.editor.config.model; +import jaxx.runtime.JAXXUtil; + import java.beans.PropertyChangeListener; import java.beans.PropertyChangeSupport; import java.util.ArrayList; @@ -50,10 +52,9 @@ protected PropertyChangeSupport pcs = new PropertyChangeSupport(this); protected CategoryModel(String category, String categoryLabel) { - super(); this.category = category; this.categoryLabel = categoryLabel; - this.entries = new ArrayList<OptionModel>(); + entries = new ArrayList<OptionModel>(); } protected void addOption(OptionModel option) { @@ -62,7 +63,6 @@ @Deprecated public CategoryModel(String category, String categoryLabel, OptionModel[] entries) { - super(); this.category = category; this.categoryLabel = categoryLabel; this.entries = Collections.unmodifiableList(Arrays.asList(entries)); @@ -186,4 +186,14 @@ public synchronized PropertyChangeListener[] getPropertyChangeListeners() { return pcs.getPropertyChangeListeners(); } + + public void destroy() { + JAXXUtil.destroy(pcs); + } + + @Override + protected void finalize() throws Throwable { + super.finalize(); + destroy(); + } } Modified: trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/model/ConfigTableModel.java =================================================================== --- trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/model/ConfigTableModel.java 2010-03-26 18:15:08 UTC (rev 1815) +++ trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/model/ConfigTableModel.java 2010-03-27 16:12:27 UTC (rev 1816) @@ -20,24 +20,26 @@ */ package jaxx.runtime.swing.editor.config.model; +import org.nuiton.util.ConverterUtil; + +import javax.swing.table.AbstractTableModel; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; -import javax.swing.table.AbstractTableModel; -import org.nuiton.util.ConverterUtil; /** * le modele du tableau d'options pour une categorie donnee. - * + * <p/> * Le modele se base sur le modele d'une categorie d'option. * * @author tchemit - * * @see CategoryModel */ public class ConfigTableModel extends AbstractTableModel { private static final long serialVersionUID = 1L; + private static final Class<?>[] columnClass = {String.class, Object.class, String.class}; + /** le modele d'une categorie */ protected final CategoryModel categoryModel; @@ -115,7 +117,7 @@ } OptionModel key = getEntry(row); Object val; - if (aValue == null || key.getType() == aValue.getClass()) { + if (aValue == null || key.getType().equals(aValue.getClass())) { val = aValue; } else { String valStr = String.valueOf(aValue).trim(); @@ -133,4 +135,17 @@ categoryModel.setValue(key, val); fireTableRowsUpdated(row, row); } + + + public void destroy() { + if (categoryModel != null) { + categoryModel.destroy(); + } + } + + @Override + protected void finalize() throws Throwable { + super.finalize(); + destroy(); + } } Modified: trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/model/ConfigUIModel.java =================================================================== --- trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/model/ConfigUIModel.java 2010-03-26 18:15:08 UTC (rev 1815) +++ trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/model/ConfigUIModel.java 2010-03-27 16:12:27 UTC (rev 1816) @@ -20,16 +20,17 @@ */ package jaxx.runtime.swing.editor.config.model; +import jaxx.runtime.JAXXUtil; import org.apache.commons.beanutils.PropertyUtils; -import static org.nuiton.i18n.I18n._; import org.nuiton.util.ApplicationConfig; -import org.nuiton.util.ApplicationConfig.OptionDef; import javax.swing.*; import java.beans.PropertyChangeListener; import java.beans.PropertyChangeSupport; import java.util.*; +import static org.nuiton.i18n.I18n._; + /** * Le modele de l'ui des preferences. * <p/> @@ -72,16 +73,6 @@ * Callbacks manager */ protected CallBacksManager callBacksManager; - /** - * call back when reload ui is necessary - */ - @Deprecated - protected Runnable reloadUICallback; - /** - * call back when reload application is necessary - */ - @Deprecated - protected Runnable reloadApplicationCallback; /** * suport of modification @@ -90,43 +81,13 @@ public ConfigUIModel(ApplicationConfig config) { this.config = config; - this.categories = new LinkedHashMap<String, CategoryModel>(); - this.callBacksManager = new CallBacksManager(); + categories = new LinkedHashMap<String, CategoryModel>(); + callBacksManager = new CallBacksManager(); } /** * Ajoute une categorie dans le modele. * - * @param category l'id de la categorie (la clef de traduction du nom - * de la categorie) - * @param categoryLabel la clef de traduction de la description de - * la categorie - * @param keys les options de la categorie - * @deprecated since 2.0.0 prefer use the - * {@link #addCategory(CategoryModel)} - */ - @Deprecated - public void addCategory(String category, - String categoryLabel, - OptionDef... keys) { - if (categories.containsKey(category)) { - throw new IllegalArgumentException( - _("config.error.category.already.exists", category)); - } - OptionModel[] entries = new OptionModel[keys.length]; - int index = 0; - for (OptionDef d : keys) { - Object value = config.getOption(d); - OptionModel e = new OptionModel(d, value); - entries[index++] = e; - } - CategoryModel m = new CategoryModel(category, categoryLabel, entries); - categories.put(category, m); - } - - /** - * Ajoute une categorie dans le modele. - * * @param category la categorie a ajouter au modèle. */ public void addCategory(CategoryModel category) { @@ -222,16 +183,6 @@ this.standalone = standalone; } - @Deprecated - public Runnable getReloadApplicationCallback() { - return reloadApplicationCallback; - } - - @Deprecated - public Runnable getReloadUICallback() { - return reloadUICallback; - } - public void saveModified() { // compute transients keys (to never be saved) List<String> transients = new ArrayList<String>(); @@ -360,15 +311,14 @@ return pcs.getPropertyChangeListeners(); } - @Deprecated - protected void setReloadApplicationCallback( - Runnable reloadApplicationCallback) { - this.reloadApplicationCallback = reloadApplicationCallback; + public void destroy() { + JAXXUtil.destroy(pcs); } - @Deprecated - protected void setReloadUICallback(Runnable reloadUICallback) { - this.reloadUICallback = reloadUICallback; + @Override + protected void finalize() throws Throwable { + super.finalize(); + destroy(); } protected ApplicationConfig getConfig() { Modified: trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/model/ConfigUIModelBuilder.java =================================================================== --- trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/model/ConfigUIModelBuilder.java 2010-03-26 18:15:08 UTC (rev 1815) +++ trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/model/ConfigUIModelBuilder.java 2010-03-27 16:12:27 UTC (rev 1816) @@ -8,7 +8,7 @@ import javax.swing.table.TableCellEditor; /** - * A builder of {@link jaxx.runtime.swing.editor.config.model.ConfigUIModel} + * A builder of {@link ConfigUIModel} * Created: 22 déc. 2009 * * @author Tony Chemit <chemit@codelutin.com> Copyright Code Lutin @@ -55,37 +55,6 @@ } /** - * Set the {@code reloadApplicationCallback} of the current model. - * - * @param callback the call back to set - * @throws IllegalStateException if there is not a current model - * @throws NullPointerException if any of parameter is {@code null} - * @see ConfigUIModel#setReloadApplicationCallback(Runnable) - */ - @Deprecated - public void setReloadApplicationCallback(Runnable callback) - throws IllegalStateException, NullPointerException { - checkCurrent(model, "model"); - checkNotNull(callback, "setReloadApplicationCallback", "callback"); - model.setReloadApplicationCallback(callback); - } - - /** - * Set the {@code reloadUICallback} of the current model. - * - * @param callback the call back to set - * @throws IllegalStateException if there is not a current model - * @throws NullPointerException if any of parameter is {@code null} - * @see ConfigUIModel#setReloadUICallback(Runnable) - */ - @Deprecated - public void setReloadUICallback(Runnable callback) { - checkCurrent(model, "model"); - checkNotNull(callback, "setReloadUICallback", "callback"); - model.setReloadUICallback(callback); - } - - /** * Add a new category, and set it as current. * <p/> * <b>Note:</b> As side effets, if a previous category, then store it to @@ -179,7 +148,7 @@ * @param editor the editor to set in the current option. * @throws IllegalStateException if there is not a current option set. * @throws NullPointerException if any of parameter is {@code null} - * @see OptionModel#setEditor(javax.swing.table.TableCellEditor) + * @see OptionModel#setEditor(TableCellEditor) */ public void setOptionEditor(TableCellEditor editor) throws IllegalStateException, NullPointerException { @@ -222,33 +191,6 @@ } /** - * Set the needReloadUI flag on the current option. - * - * @param needReload new value to set - * @throws IllegalStateException if there is not a current option set. - * @see OptionModel#setNeedReloadUI(boolean) - */ - @Deprecated - public void setOptionNeedReloadUI(boolean needReload) - throws IllegalStateException { - checkCurrent(option, "option"); - option.setNeedReloadUI(needReload); - } - - /** - * Set the needReloadApplication flag on the current option. - * - * @param needReload new value to set - * @throws IllegalStateException if there is not a current option set. - * @see OptionModel#setNeedReloadUI(boolean) - */ - public void setOptionNeedReloadApplication(boolean needReload) - throws IllegalStateException { - checkCurrent(option, "option"); - option.setNeedReloadApplication(needReload); - } - - /** * Flush the model and return it. * <p/> * <b>Note:</b> As a side effect, nothing is available in the builder Modified: trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/model/OptionModel.java =================================================================== --- trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/model/OptionModel.java 2010-03-26 18:15:08 UTC (rev 1815) +++ trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/model/OptionModel.java 2010-03-27 16:12:27 UTC (rev 1816) @@ -42,18 +42,9 @@ /** * un drapeau pour savoir si l'option a été sauvée */ - protected boolean saved = false; + protected boolean saved; + /** - * un drapeau pour savoir si le changement de l'option nécessite un redémarrage de l'ui. - */ - @Deprecated - protected boolean needReloadUI = false; - /** - * un drapeau pour savoir si le changement de l'option nécessite un redémarrage de l'application. - */ - @Deprecated - protected boolean needReloadApplication = false; - /** * la valeur non modifié de l'option */ protected Object originalValue; @@ -105,16 +96,6 @@ return def.isFinal(); } - @Deprecated - public boolean isNeedReloadUI() { - return needReloadUI; - } - - @Deprecated - public boolean isNeedReloadApplication() { - return needReloadApplication; - } - public Object getOriginalValue() { return originalValue; } @@ -149,7 +130,7 @@ public void initValue(Object originalValue) { this.originalValue = originalValue; - this.value = originalValue; + value = originalValue; } public String getPropertyName() { @@ -164,16 +145,6 @@ this.editor = editor; } - @Deprecated - protected void setNeedReloadUI(boolean needReloadUI) { - this.needReloadUI = needReloadUI; - } - - @Deprecated - protected void setNeedReloadApplication(boolean needReloadApplication) { - this.needReloadApplication = needReloadApplication; - } - protected void setPropertyName(String propertyName) { this.propertyName = propertyName; } Modified: trunk/jaxx-widgets/src/test/java/jaxx/runtime/swing/editor/config/model/ConfigUIModelBuilderTest.java =================================================================== --- trunk/jaxx-widgets/src/test/java/jaxx/runtime/swing/editor/config/model/ConfigUIModelBuilderTest.java 2010-03-26 18:15:08 UTC (rev 1815) +++ trunk/jaxx-widgets/src/test/java/jaxx/runtime/swing/editor/config/model/ConfigUIModelBuilderTest.java 2010-03-27 16:12:27 UTC (rev 1816) @@ -210,7 +210,6 @@ Assert.assertNotNull(optionModel); Assert.assertEquals(MyConfig.Option.LOCALE, optionModel.def); Assert.assertEquals(MyConfig.PROPERTY_LOCALE, optionModel.propertyName); -// Assert.assertEquals(false, optionModel.needReloadUI); Assert.assertNull(optionModel.editor); } @@ -252,7 +251,6 @@ Assert.assertNotNull(optionModel); Assert.assertEquals(MyConfig.Option.LOCALE, optionModel.def); Assert.assertNull(optionModel.propertyName); -// Assert.assertEquals(false, optionModel.needReloadUI); Assert.assertEquals(cellEditor, optionModel.editor); }