From bc047d7eb4817ecca00825cd78d89ef13c5e9fbb Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Wed, 29 Aug 2012 13:00:57 -0500 Subject: [PATCH] IDEMPIERE-377 Improve current search dialog box / Peer review and tests --- .../oracle/895_IDEMPIERE-377_History_Trl.sql | 7 +++- .../895_IDEMPIERE-377_History_Trl.sql | 7 +++- .../webui/panel/AbstractADWindowPanel.java | 6 ++-- .../adempiere/webui/window/FindWindow.java | 36 ++++++++++--------- 4 files changed, 36 insertions(+), 20 deletions(-) diff --git a/migration/360lts-release/oracle/895_IDEMPIERE-377_History_Trl.sql b/migration/360lts-release/oracle/895_IDEMPIERE-377_History_Trl.sql index 5cda43f166..dcfd00538a 100644 --- a/migration/360lts-release/oracle/895_IDEMPIERE-377_History_Trl.sql +++ b/migration/360lts-release/oracle/895_IDEMPIERE-377_History_Trl.sql @@ -8,8 +8,13 @@ UPDATE AD_Message SET MsgText='History records',Updated=TO_DATE('2012-08-27 21:4 UPDATE AD_Message_Trl SET IsTranslated='N' WHERE AD_Message_ID=292 ; +-- Aug 29, 2012 12:04:13 PM COT +-- IDEMPIERE-377 Improve current search dialog box +UPDATE AD_ToolBarButton SET Name='zk Window - History (deprecated with IDEMPIERE-377)', IsActive='N',Updated=TO_DATE('2012-08-29 12:04:13','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_ToolBarButton_ID=200042 +; + UPDATE AD_System SET LastMigrationScriptApplied='895_IDEMPIERE-377_History_Trl.sql' WHERE LastMigrationScriptApplied<'895_IDEMPIERE-377_History_Trl.sql' OR LastMigrationScriptApplied IS NULL -; \ No newline at end of file +; diff --git a/migration/360lts-release/postgresql/895_IDEMPIERE-377_History_Trl.sql b/migration/360lts-release/postgresql/895_IDEMPIERE-377_History_Trl.sql index b3759a8351..4401d44369 100644 --- a/migration/360lts-release/postgresql/895_IDEMPIERE-377_History_Trl.sql +++ b/migration/360lts-release/postgresql/895_IDEMPIERE-377_History_Trl.sql @@ -8,8 +8,13 @@ UPDATE AD_Message SET MsgText='History records',Updated=TO_TIMESTAMP('2012-08-27 UPDATE AD_Message_Trl SET IsTranslated='N' WHERE AD_Message_ID=292 ; +-- Aug 29, 2012 12:04:13 PM COT +-- IDEMPIERE-377 Improve current search dialog box +UPDATE AD_ToolBarButton SET Name='zk Window - History (deprecated with IDEMPIERE-377)', IsActive='N',Updated=TO_TIMESTAMP('2012-08-29 12:04:13','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_ToolBarButton_ID=200042 +; + UPDATE AD_System SET LastMigrationScriptApplied='895_IDEMPIERE-377_History_Trl.sql' WHERE LastMigrationScriptApplied<'895_IDEMPIERE-377_History_Trl.sql' OR LastMigrationScriptApplied IS NULL -; \ No newline at end of file +; diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/AbstractADWindowPanel.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/AbstractADWindowPanel.java index cbabac810c..f6af0c27da 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/AbstractADWindowPanel.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/AbstractADWindowPanel.java @@ -160,6 +160,8 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To private boolean boolChanges = false; + private int m_onlyCurrentDays = 0; + private Component parent; private boolean m_findCancelled; @@ -639,7 +641,7 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To } private void initFirstTabpanel() { - curTabpanel.query(m_onlyCurrentRows, 0, MRole.getDefault().getMaxQueryRecords()); + curTabpanel.query(m_onlyCurrentRows, m_onlyCurrentDays, MRole.getDefault().getMaxQueryRecords()); curTabpanel.activate(true); } @@ -1586,7 +1588,7 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To { m_onlyCurrentRows = false; // search history too curTab.setQuery(query); - curTabpanel.query(m_onlyCurrentRows, 0, MRole.getDefault().getMaxQueryRecords()); // autoSize + curTabpanel.query(m_onlyCurrentRows, m_onlyCurrentDays, MRole.getDefault().getMaxQueryRecords()); // autoSize } if (findWindow.isCreateNew()) diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/FindWindow.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/FindWindow.java index b1aa39ea77..440960e5f1 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/FindWindow.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/FindWindow.java @@ -17,6 +17,8 @@ package org.adempiere.webui.window; +import static org.compiere.model.SystemIDs.REFERENCE_YESNO; + import java.math.BigDecimal; import java.sql.PreparedStatement; import java.sql.ResultSet; @@ -34,8 +36,6 @@ import java.util.Vector; import java.util.logging.Level; import java.util.regex.Pattern; -import jxl.biff.drawing.ComboBox; - import org.adempiere.webui.AdempiereIdGenerator; import org.adempiere.webui.LayoutUtils; import org.adempiere.webui.component.Button; @@ -74,7 +74,6 @@ import org.compiere.model.MQuery; import org.compiere.model.MRole; import org.compiere.model.MTable; import org.compiere.model.MUserQuery; -import static org.compiere.model.SystemIDs.*; import org.compiere.model.X_AD_Column; import org.compiere.util.AdempiereSystemError; import org.compiere.util.CLogger; @@ -93,10 +92,11 @@ import org.zkoss.zk.ui.event.Events; import org.zkoss.zk.ui.util.Clients; import org.zkoss.zul.Borderlayout; import org.zkoss.zul.Center; -import org.zkoss.zul.Div; -import org.zkoss.zul.South; import org.zkoss.zul.Comboitem; +import org.zkoss.zul.Div; import org.zkoss.zul.Hbox; +import org.zkoss.zul.South; +import org.zkoss.zul.Space; import org.zkoss.zul.Tab; import org.zkoss.zul.Vlayout; @@ -482,13 +482,6 @@ public class FindWindow extends Window implements EventListener, ValueCha fQueryName.setValue(""); fQueryName.addEventListener(Events.ON_SELECT, this); - // adding history combo - prepareHistoryCombo(); - Label labelHistory = new Label(Msg.getMsg(Env.getCtx(), HISTORY_LABEL)); - div.appendChild(labelHistory); - div.appendChild(historyCombo); - historyCombo.setStyle("margin-left: 3px; margin-right: 3px; position: relative;"); - Label label = new Label(Msg.getMsg(Env.getCtx(), "SavedQuery")); div.appendChild(label); div.appendChild(fQueryName); @@ -497,9 +490,16 @@ public class FindWindow extends Window implements EventListener, ValueCha fQueryName.setStyle("margin-left: 3px; margin-right: 3px; position: relative;"); msgLabel = new Label(""); - msgLabel.setStyle("margin-left: 10px"); + msgLabel.setStyle("margin-left: 10px; margin-right: 20px;"); div.appendChild(msgLabel); - + + // adding history combo + prepareHistoryCombo(); + Label labelHistory = new Label(Msg.getMsg(Env.getCtx(), HISTORY_LABEL)); + div.appendChild(labelHistory); + div.appendChild(historyCombo); + historyCombo.setStyle("margin-left: 3px; margin-right: 3px; position: relative;"); + winMain = new MultiTabPart(); winMain.createPart(layout); winMain.getComponent().setStyle("width: 100%; position: relative;"); @@ -530,6 +530,7 @@ public class FindWindow extends Window implements EventListener, ValueCha historyCombo.setAutocomplete(false); historyCombo.setButtonVisible(true); historyCombo.setReadonly(true); + historyCombo.appendItem(" ", ""); historyCombo.appendItem((Msg.getMsg(Env.getCtx(), HISTORY_DAY_ALL)),HISTORY_DAY_ALL); historyCombo.appendItem((Msg.getMsg(Env.getCtx(), HISTORY_DAY_YEAR)), HISTORY_DAY_YEAR); historyCombo.appendItem((Msg.getMsg(Env.getCtx(), HISTORY_DAY_MONTH)), HISTORY_DAY_MONTH); @@ -853,6 +854,8 @@ public class FindWindow extends Window implements EventListener, ValueCha if (winMain.getComponent().getSelectedIndex() != 1) { winMain.getComponent().setSelectedIndex(1); btnSave.setDisabled(m_AD_Tab_ID <= 0); + historyCombo.setDisabled(true); + historyCombo.setSelectedItem(null); fQueryName.setReadonly(false); } msgLabel.setText(""); @@ -862,9 +865,12 @@ public class FindWindow extends Window implements EventListener, ValueCha if (winMain.getComponent().getSelectedIndex() == 1) { fQueryName.setReadonly(false); btnSave.setDisabled(m_AD_Tab_ID <= 0); + historyCombo.setDisabled(true); + historyCombo.setSelectedItem(null); } else { fQueryName.setReadonly(true); btnSave.setDisabled(true); + historyCombo.setDisabled(false); } } } // @@ -1232,8 +1238,6 @@ public class FindWindow extends Window implements EventListener, ValueCha FDialog.warn (m_targetWindowNo, this, "DeleteError", name); return; } - else - return; uq.setCode (code.toString()); uq.setAD_Table_ID (m_AD_Table_ID); //