diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/ToolBarButton.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/ToolBarButton.java index 356fb40998..1e380f521f 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/ToolBarButton.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/ToolBarButton.java @@ -51,11 +51,15 @@ public class ToolBarButton extends org.zkoss.zul.Toolbarbutton public void setPressed(boolean pressed) { this.pressed = pressed; // Elaine 2008/12/09 - if (!getMode().equals("toggle")) - setMode("toggle"); - - if (!isDisabled()) - setChecked(pressed); + if (!isDisabled()) { + if (pressed) { + setMode("toggle"); + setChecked(true); + } else { + setMode("default"); + setChecked(false); + } + } } // Elaine 2008/12/09 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 ed486ae8a6..a0ef3b59ab 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 @@ -705,23 +705,30 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To final FindWindow find = new FindWindow(curWindowNo, mTab.getName(), mTab.getAD_Table_ID(), mTab.getTableName(), where.toString(), findFields, 10, mTab.getAD_Tab_ID()); // no query below 10 - find.addEventListener(DialogEvents.ON_MODAL_CLOSE, new EventListener() { - @Override - public void onEvent(Event event) throws Exception { - if (!find.isCancel()) - { - m_findCreateNew = find.isCreateNew(); - MQuery result = m_findCreateNew ? query : find.getQuery(); - callback.onCallback(result); - } - else - { - m_findCancelled = true; - callback.onCallback(null); - } - } - }); - AEnv.showWindow(find); + if (find.isValid()) + { + find.addEventListener(DialogEvents.ON_MODAL_CLOSE, new EventListener() { + @Override + public void onEvent(Event event) throws Exception { + if (!find.isCancel()) + { + m_findCreateNew = find.isCreateNew(); + MQuery result = m_findCreateNew ? query : find.getQuery(); + callback.onCallback(result); + } + else + { + m_findCancelled = true; + callback.onCallback(null); + } + } + }); + AEnv.showWindow(find); + } + else + { + callback.onCallback(query); + } } else { @@ -1530,6 +1537,13 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To curTab.getAD_Table_ID(), curTab.getTableName(), curTab.getWhereExtended(), findFields, 1, curTab.getAD_Tab_ID()); + if (!find.isValid()) { + if (find.getTotalRecords() == 0) { + FDialog.info(curWindowNo, getComponent(), "NoRecordsFound"); + } + return; + } + find.addEventListener(DialogEvents.ON_MODAL_CLOSE, new EventListener() { @Override public void onEvent(Event event) throws Exception { @@ -1547,6 +1561,10 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To curTab.dataRefresh(false); // Elaine 2008/07/25 } + else + { + toolbar.getButton("Find").setPressed(curTab.isQueryActive()); + } focusToActivePanel(); } }); 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 7ea62c0144..b180a944ea 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 @@ -153,6 +153,7 @@ public class FindWindow extends Window implements EventListener, ValueCha private MUserQuery[] userQueries; private Rows contentSimpleRows; private boolean m_createNew = false; + private boolean isvalid = true; /** Index ColumnName = 0 */ public static final int INDEX_COLUMNNAME = 0; @@ -1328,6 +1329,7 @@ public class FindWindow extends Window implements EventListener, ValueCha // super.dispose(); + isvalid = false; Events.sendEvent(this, new Event(ON_MODAL_CLOSE, this, null)); } // dispose @@ -1726,4 +1728,8 @@ public class FindWindow extends Window implements EventListener, ValueCha && MColumn.isSuggestSelectionColumn(field.getColumnName(), true); } + public boolean isValid() + { + return isvalid; + } } // FindPanel \ No newline at end of file diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/ZkReportViewer.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/ZkReportViewer.java index efa77d20b8..33ffa847bd 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/ZkReportViewer.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/ZkReportViewer.java @@ -1026,6 +1026,9 @@ public class ZkReportViewer extends Window implements EventListener, ITab else { final FindWindow find = new FindWindow(m_WindowNo, title, AD_Table_ID, tableName,m_reportEngine.getWhereExtended(), findFields, 1, AD_Tab_ID); + if (!find.isValid()) + return; + find.addEventListener(DialogEvents.ON_MODAL_CLOSE, new EventListener() { @Override public void onEvent(Event event) throws Exception {