Author: tchemit Date: 2008-01-22 09:36:23 +0000 (Tue, 22 Jan 2008) New Revision: 400 Modified: trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/action/pagination/ChangePageAction.java Log: m?\195?\169thode jetComboBox devient getChangeComboBox et est maintenant ind?\195?\169pendante de l'action r?\195?\169elle ==> on peut r?\195?\169utiliser l'action Modified: trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/action/pagination/ChangePageAction.java =================================================================== --- trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/action/pagination/ChangePageAction.java 2008-01-22 09:07:39 UTC (rev 399) +++ trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/action/pagination/ChangePageAction.java 2008-01-22 09:36:23 UTC (rev 400) @@ -19,6 +19,7 @@ package fr.cemagref.simexplorer.is.ui.swing.action.pagination; import fr.cemagref.simexplorer.is.entities.metadata.MetaDataEntity; +import fr.cemagref.simexplorer.is.ui.swing.SimExplorerActionManager; import fr.cemagref.simexplorer.is.ui.swing.action.SimExplorerAbstractTabAction; import fr.cemagref.simexplorer.is.ui.swing.model.JApplicationTableModel; import fr.cemagref.simexplorer.is.ui.swing.model.ListTabModel; @@ -26,8 +27,11 @@ import fr.cemagref.simexplorer.is.ui.swing.panel.JApplicationTable; import fr.cemagref.simexplorer.is.ui.swing.tab.JApplicationListTab; +import javax.swing.AbstractAction; +import javax.swing.AbstractButton; import javax.swing.Action; import javax.swing.JComboBox; +import javax.swing.JComponent; import java.awt.event.ActionEvent; /** @@ -54,7 +58,7 @@ @Override protected boolean beforeAction(ActionEvent e) throws Exception { - JComboBox jComboBox = getComboBox(); + JComboBox jComboBox = getChangePageComboBox(); if (!jComboBox.isEnabled()) { return false; } @@ -64,7 +68,7 @@ if (o != null) { newPage = Integer.valueOf(o + ""); } - return o!=null && !oldPage.equals(newPage); + return o != null && !oldPage.equals(newPage); } @Override @@ -82,7 +86,7 @@ //long oldLastIndex = oldFirstindex + model.size(); //TODO optimiser l'algo - data = getData(false,width, newFirstIndex,-1); + data = getData(false, width, newFirstIndex, -1); // save in model model.setList(data); @@ -105,7 +109,17 @@ newPage = null; } - protected JComboBox getComboBox() { - return (JComboBox) getUIObject((String) getValue(Action.ACTION_COMMAND_KEY)); + protected JComboBox getChangePageComboBox() { + JComponent uiObject = getUIObject((String) getValue(Action.ACTION_COMMAND_KEY)); + if (uiObject instanceof JComboBox) { + return (JComboBox) uiObject; + } + // find with hard name + AbstractAction action = SimExplorerActionManager.newAction("goPage", (AbstractButton) null); + uiObject = getUIObject((String) action.getValue(Action.ACTION_COMMAND_KEY)); + if (uiObject instanceof JComboBox) { + return (JComboBox) uiObject; + } + throw new IllegalStateException("could not find ChangePageComboBox for action " + this); } } \ No newline at end of file