diff --git a/client/src/org/compiere/apps/APanel.java b/client/src/org/compiere/apps/APanel.java
index e8b5118c63..7b0486140f 100644
--- a/client/src/org/compiere/apps/APanel.java
+++ b/client/src/org/compiere/apps/APanel.java
@@ -50,6 +50,8 @@ import org.compiere.util.*;
* Colin Rooney 2007/03/20 RFE#1670185 & related BUG#1684142 - Extend Sec to Info Queries
* @contributor Victor Perez , e-Evolution.SC FR [ 1757088 ]
* @contributor fer_luck@centuryon.com , FR [ 1757088 ]
+ * @author Teo Sarca, SC ARHIPAC SERVICE SRL
+ *
BF [ 1824621 ] History button can't be canceled
*/
public final class APanel extends CPanel
implements DataStatusListener, ChangeListener, ActionListener, ASyncProcess
@@ -1996,23 +1998,30 @@ public final class APanel extends CPanel
Point pt = new Point (0, aHistory.getButton().getBounds().height);
SwingUtilities.convertPointToScreen(pt, aHistory.getButton());
VOnlyCurrentDays ocd = new VOnlyCurrentDays(Env.getFrame(this), pt);
- m_onlyCurrentDays = ocd.getCurrentDays();
- if (m_onlyCurrentDays == 1) // Day
- {
- m_onlyCurrentRows = true;
- m_onlyCurrentDays = 0; // no Created restriction
+ if (!ocd.isCancel()) {
+ m_onlyCurrentDays = ocd.getCurrentDays();
+ if (m_onlyCurrentDays == 1) // Day
+ {
+ m_onlyCurrentRows = true;
+ m_onlyCurrentDays = 0; // no Created restriction
+ }
+ else
+ m_onlyCurrentRows = false;
+ //
+ m_curTab.setQuery(null); // reset previous queries
+ MRole role = MRole.getDefault();
+ int maxRows = role.getMaxQueryRecords();
+ //
+ log.config("OnlyCurrent=" + m_onlyCurrentRows
+ + ", Days=" + m_onlyCurrentDays
+ + ", MaxRows=" + maxRows);
+ m_curGC.query(m_onlyCurrentRows, m_onlyCurrentDays, maxRows ); // autoSize
+ }
+ // Restore history button's pressed status
+ else {
+ if (isFirstTab())
+ aHistory.setPressed(!m_curTab.isOnlyCurrentRows());
}
- else
- m_onlyCurrentRows = false;
- //
- m_curTab.setQuery(null); // reset previous queries
- MRole role = MRole.getDefault();
- int maxRows = role.getMaxQueryRecords();
- //
- log.config("OnlyCurrent=" + m_onlyCurrentRows
- + ", Days=" + m_onlyCurrentDays
- + ", MaxRows=" + maxRows);
- m_curGC.query(m_onlyCurrentRows, m_onlyCurrentDays, maxRows ); // autoSize
}
} // cmd_history
diff --git a/client/src/org/compiere/grid/VOnlyCurrentDays.java b/client/src/org/compiere/grid/VOnlyCurrentDays.java
index 965c48cb7c..63c3d0f399 100644
--- a/client/src/org/compiere/grid/VOnlyCurrentDays.java
+++ b/client/src/org/compiere/grid/VOnlyCurrentDays.java
@@ -28,6 +28,9 @@ import org.compiere.util.*;
*
* @author Jorg Janke
* @version $Id: VOnlyCurrentDays.java,v 1.2 2006/07/30 00:51:28 jjanke Exp $
+ *
+ * @author Teo Sarca, SC ARHIPAC SERVICE SRL
+ * BF [ 1824621 ] History button can't be canceled
*/
public class VOnlyCurrentDays extends CDialog
implements ActionListener
@@ -64,6 +67,8 @@ public class VOnlyCurrentDays extends CDialog
/** Days (0=all) */
private int m_days = 0;
+ /** Is cancel */
+ private boolean m_isCancel = false;
/** Margin */
private static Insets s_margin = new Insets (2, 2, 2, 2);
/** Logger */
@@ -102,6 +107,13 @@ public class VOnlyCurrentDays extends CDialog
mainPanel.setToolTipText(Msg.getMsg(Env.getCtx(), "VOnlyCurrentDays", false));
this.getContentPane().add(mainPanel, BorderLayout.CENTER);
this.getRootPane().setDefaultButton(bShowDay);
+ //
+ addWindowListener(new WindowAdapter() {
+ @Override
+ public void windowClosing(WindowEvent e) {
+ m_isCancel = true;
+ }
+ });
} // jbInit
/**
@@ -132,4 +144,10 @@ public class VOnlyCurrentDays extends CDialog
return m_days;
} // getCurrentDays
+ /**
+ * @return true if user has canceled this form
+ */
+ public boolean isCancel() {
+ return m_isCancel;
+ }
} // VOnlyCurrentDays