IDEMPIERE-4085 Search in toolbar
This commit is contained in:
parent
156c9f5ab5
commit
a3f0681d23
|
@ -90,4 +90,8 @@ public class MToolBarButton extends X_AD_ToolBarButton {
|
||||||
|
|
||||||
return buttons;
|
return buttons;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isSearchQueryComponent() {
|
||||||
|
return "b01e8ec6-1a3c-4f94-928b-4582e2c33f81".equals(getAD_ToolBarButton_UU());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,6 +30,7 @@ import org.adempiere.webui.ClientInfo;
|
||||||
import org.adempiere.webui.LayoutUtils;
|
import org.adempiere.webui.LayoutUtils;
|
||||||
import org.adempiere.webui.action.Actions;
|
import org.adempiere.webui.action.Actions;
|
||||||
import org.adempiere.webui.action.IAction;
|
import org.adempiere.webui.action.IAction;
|
||||||
|
import org.adempiere.webui.component.Combobox;
|
||||||
import org.adempiere.webui.component.FToolbar;
|
import org.adempiere.webui.component.FToolbar;
|
||||||
import org.adempiere.webui.component.Menupopup;
|
import org.adempiere.webui.component.Menupopup;
|
||||||
import org.adempiere.webui.component.Tabpanel;
|
import org.adempiere.webui.component.Tabpanel;
|
||||||
|
@ -43,6 +44,7 @@ import org.adempiere.webui.window.FDialog;
|
||||||
import org.compiere.model.GridTab;
|
import org.compiere.model.GridTab;
|
||||||
import org.compiere.model.MRole;
|
import org.compiere.model.MRole;
|
||||||
import org.compiere.model.MToolBarButton;
|
import org.compiere.model.MToolBarButton;
|
||||||
|
import org.compiere.model.MUserQuery;
|
||||||
import org.compiere.util.CLogger;
|
import org.compiere.util.CLogger;
|
||||||
import org.compiere.util.DB;
|
import org.compiere.util.DB;
|
||||||
import org.compiere.util.Env;
|
import org.compiere.util.Env;
|
||||||
|
@ -62,6 +64,7 @@ import org.zkoss.zk.ui.event.KeyEvent;
|
||||||
import org.zkoss.zk.ui.event.OpenEvent;
|
import org.zkoss.zk.ui.event.OpenEvent;
|
||||||
import org.zkoss.zk.ui.util.Clients;
|
import org.zkoss.zk.ui.util.Clients;
|
||||||
import org.zkoss.zul.A;
|
import org.zkoss.zul.A;
|
||||||
|
import org.zkoss.zul.Comboitem;
|
||||||
import org.zkoss.zul.Menuitem;
|
import org.zkoss.zul.Menuitem;
|
||||||
import org.zkoss.zul.Popup;
|
import org.zkoss.zul.Popup;
|
||||||
import org.zkoss.zul.Separator;
|
import org.zkoss.zul.Separator;
|
||||||
|
@ -91,6 +94,10 @@ public class ADWindowToolbar extends FToolbar implements EventListener<Event>
|
||||||
|
|
||||||
private static final CLogger log = CLogger.getCLogger(ADWindowToolbar.class);
|
private static final CLogger log = CLogger.getCLogger(ADWindowToolbar.class);
|
||||||
|
|
||||||
|
private Combobox fQueryName;
|
||||||
|
private MUserQuery[] userQueries;
|
||||||
|
private MUserQuery selectedUserQuery;
|
||||||
|
|
||||||
private ToolBarButton btnIgnore;
|
private ToolBarButton btnIgnore;
|
||||||
|
|
||||||
private ToolBarButton btnHelp, btnNew, btnCopy, btnDelete, btnSave;
|
private ToolBarButton btnHelp, btnNew, btnCopy, btnDelete, btnSave;
|
||||||
|
@ -182,6 +189,14 @@ public class ADWindowToolbar extends FToolbar implements EventListener<Event>
|
||||||
menupopup = new Menupopup();
|
menupopup = new Menupopup();
|
||||||
this.appendChild(menupopup);
|
this.appendChild(menupopup);
|
||||||
|
|
||||||
|
//IDEMPIERE-4085
|
||||||
|
fQueryName = new Combobox();
|
||||||
|
fQueryName.setTooltiptext(Msg.getMsg(Env.getCtx(),"QueryName"));
|
||||||
|
fQueryName.setPlaceholder(Msg.getMsg(Env.getCtx(),"QueryName"));
|
||||||
|
fQueryName.setId(BTNPREFIX + "SearchQuery");
|
||||||
|
fQueryName.addEventListener(Events.ON_SELECT, this);
|
||||||
|
LayoutUtils.addSclass("toolbar-searchbox", fQueryName);
|
||||||
|
|
||||||
btnIgnore = createButton("Ignore", "Ignore", "Ignore");
|
btnIgnore = createButton("Ignore", "Ignore", "Ignore");
|
||||||
btnIgnore.setTooltiptext(btnIgnore.getTooltiptext()+ " Alt+Z");
|
btnIgnore.setTooltiptext(btnIgnore.getTooltiptext()+ " Alt+Z");
|
||||||
btnHelp = createButton("Help", "Help","Help");
|
btnHelp = createButton("Help", "Help","Help");
|
||||||
|
@ -309,7 +324,8 @@ public class ADWindowToolbar extends FToolbar implements EventListener<Event>
|
||||||
this.appendChild(new Separator("vertical"));
|
this.appendChild(new Separator("vertical"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else if (button.isSearchQueryComponent())
|
||||||
|
this.appendChild(fQueryName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!ClientInfo.isMobile() && !menuItems.isEmpty()) {
|
if (!ClientInfo.isMobile() && !menuItems.isEmpty()) {
|
||||||
|
@ -492,14 +508,30 @@ public class ADWindowToolbar extends FToolbar implements EventListener<Event>
|
||||||
}
|
}
|
||||||
this.onCtrlKeyEvent(keyEvent);
|
this.onCtrlKeyEvent(keyEvent);
|
||||||
}
|
}
|
||||||
|
} else if (Events.ON_SELECT.equals(eventName))
|
||||||
|
{
|
||||||
|
int index = fQueryName.getSelectedIndex();
|
||||||
|
if (index < 0) return;
|
||||||
|
if (index == 0) // no query - refresh
|
||||||
|
setSelectedUserQuery(null);
|
||||||
|
else
|
||||||
|
setSelectedUserQuery(userQueries[index-1]);
|
||||||
|
|
||||||
|
doOnClick(event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void doOnClick(Event event) {
|
private void doOnClick(Event event) {
|
||||||
this.event = event;
|
this.event = event;
|
||||||
ToolBarButton cComponent = (ToolBarButton) event.getTarget();
|
String compName;
|
||||||
String compName = cComponent.getName();
|
String methodName;
|
||||||
String methodName = "on" + compName.substring(3);
|
if (event.getTarget() == fQueryName) {
|
||||||
|
methodName = "onSearchQuery";
|
||||||
|
} else {
|
||||||
|
ToolBarButton cComponent = (ToolBarButton) event.getTarget();
|
||||||
|
compName = cComponent.getName();
|
||||||
|
methodName = "on" + compName.substring(3);
|
||||||
|
}
|
||||||
Iterator<ToolbarListener> listenerIter = listeners.iterator();
|
Iterator<ToolbarListener> listenerIter = listeners.iterator();
|
||||||
while(listenerIter.hasNext())
|
while(listenerIter.hasNext())
|
||||||
{
|
{
|
||||||
|
@ -1107,4 +1139,31 @@ public class ADWindowToolbar extends FToolbar implements EventListener<Event>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void refreshUserQuery(int AD_Tab_ID, int AD_UserQuery_ID) {
|
||||||
|
fQueryName.getItems().clear();
|
||||||
|
userQueries = MUserQuery.get(Env.getCtx(), AD_Tab_ID);
|
||||||
|
fQueryName.appendItem("");
|
||||||
|
for (int i = 0; i < userQueries.length; i++) {
|
||||||
|
Comboitem li = fQueryName.appendItem(userQueries[i].getName());
|
||||||
|
li.setValue(userQueries[i].getAD_UserQuery_ID());
|
||||||
|
if (AD_UserQuery_ID == userQueries[i].getAD_UserQuery_ID())
|
||||||
|
fQueryName.setSelectedItem(li);
|
||||||
|
}
|
||||||
|
if (AD_UserQuery_ID <= 0 || fQueryName.getItemCount() <= 1)
|
||||||
|
fQueryName.setValue("");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSelectedUserQuery(MUserQuery selectedUserQuery) {
|
||||||
|
this.selectedUserQuery = selectedUserQuery;
|
||||||
|
if (selectedUserQuery != null)
|
||||||
|
fQueryName.setValue(selectedUserQuery.getName());
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getAD_UserQuery_ID() {
|
||||||
|
if (selectedUserQuery == null)
|
||||||
|
return 0;
|
||||||
|
return selectedUserQuery.getAD_UserQuery_ID();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,9 +17,9 @@
|
||||||
|
|
||||||
package org.adempiere.webui.adwindow;
|
package org.adempiere.webui.adwindow;
|
||||||
|
|
||||||
|
import static org.compiere.model.MSysConfig.ZK_GRID_AFTER_FIND;
|
||||||
import static org.compiere.model.SystemIDs.PROCESS_AD_CHANGELOG_REDO;
|
import static org.compiere.model.SystemIDs.PROCESS_AD_CHANGELOG_REDO;
|
||||||
import static org.compiere.model.SystemIDs.PROCESS_AD_CHANGELOG_UNDO;
|
import static org.compiere.model.SystemIDs.PROCESS_AD_CHANGELOG_UNDO;
|
||||||
import static org.compiere.model.MSysConfig.ZK_GRID_AFTER_FIND;
|
|
||||||
|
|
||||||
import java.text.MessageFormat;
|
import java.text.MessageFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -1365,6 +1365,7 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
|
||||||
toolbar.setPressed("Find",adTabbox.getSelectedGridTab().isQueryActive() ||
|
toolbar.setPressed("Find",adTabbox.getSelectedGridTab().isQueryActive() ||
|
||||||
(!isNewRow && (m_onlyCurrentRows || m_onlyCurrentDays > 0)));
|
(!isNewRow && (m_onlyCurrentRows || m_onlyCurrentDays > 0)));
|
||||||
|
|
||||||
|
toolbar.refreshUserQuery(adTabbox.getSelectedGridTab().getAD_Tab_ID(), findWindow != null ? findWindow.getAD_UserQuery_ID() : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1730,6 +1731,7 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
|
||||||
toolbar.enableRequests(!isNewRow);
|
toolbar.enableRequests(!isNewRow);
|
||||||
toolbar.setPressed("Find", adTabbox.getSelectedGridTab().isQueryActive() ||
|
toolbar.setPressed("Find", adTabbox.getSelectedGridTab().isQueryActive() ||
|
||||||
(!isNewRow && (m_onlyCurrentRows || m_onlyCurrentDays > 0)));
|
(!isNewRow && (m_onlyCurrentRows || m_onlyCurrentDays > 0)));
|
||||||
|
toolbar.refreshUserQuery(adTabbox.getSelectedGridTab().getAD_Tab_ID(), findWindow != null ? findWindow.getAD_UserQuery_ID() : 0);
|
||||||
|
|
||||||
toolbar.enablePrint(adTabbox.getSelectedGridTab().isPrinted() && !isNewRow);
|
toolbar.enablePrint(adTabbox.getSelectedGridTab().isPrinted() && !isNewRow);
|
||||||
toolbar.enableReport(!isNewRow);
|
toolbar.enableReport(!isNewRow);
|
||||||
|
@ -2092,6 +2094,7 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
|
||||||
adTabbox.getSelectedTabpanel().switchRowPresentation();
|
adTabbox.getSelectedTabpanel().switchRowPresentation();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
toolbar.refreshUserQuery(adTabbox.getSelectedGridTab().getAD_Tab_ID(), findWindow.getAD_UserQuery_ID());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -2758,6 +2761,67 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
|
||||||
action.fileImport();
|
action.fileImport();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSearchQuery() {
|
||||||
|
if (adTabbox.getSelectedGridTab() == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
clearTitleRelatedContext();
|
||||||
|
|
||||||
|
// The record was not changed locally
|
||||||
|
if (adTabbox.getDirtyADTabpanel() == null) {
|
||||||
|
doOnQueryChange();
|
||||||
|
} else {
|
||||||
|
onSave(false, false, new Callback<Boolean>() {
|
||||||
|
@Override
|
||||||
|
public void onCallback(Boolean result) {
|
||||||
|
if (result) {
|
||||||
|
doOnQueryChange();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Simulate opening the Find Window, selecting a user query and click ok
|
||||||
|
*/
|
||||||
|
public void doOnQueryChange() {
|
||||||
|
// Gets Fields from AD_Field_v
|
||||||
|
GridField[] findFields = adTabbox.getSelectedGridTab().getFields();
|
||||||
|
if (findWindow == null || !findWindow.validate(adTabbox.getSelectedGridTab().getWindowNo(), adTabbox.getSelectedGridTab().getName(),
|
||||||
|
adTabbox.getSelectedGridTab().getAD_Table_ID(), adTabbox.getSelectedGridTab().getTableName(),
|
||||||
|
adTabbox.getSelectedGridTab().getWhereExtended(), findFields, 1, adTabbox.getSelectedGridTab().getAD_Tab_ID())) {
|
||||||
|
findWindow = new FindWindow (adTabbox.getSelectedGridTab().getWindowNo(), adTabbox.getSelectedGridTab().getName(),
|
||||||
|
adTabbox.getSelectedGridTab().getAD_Table_ID(), adTabbox.getSelectedGridTab().getTableName(),
|
||||||
|
adTabbox.getSelectedGridTab().getWhereExtended(), findFields, 1, adTabbox.getSelectedGridTab().getAD_Tab_ID());
|
||||||
|
|
||||||
|
setupEmbeddedFindwindow();
|
||||||
|
if (!findWindow.initialize()) {
|
||||||
|
if (findWindow.getTotalRecords() == 0) {
|
||||||
|
FDialog.info(curWindowNo, getComponent(), "NoRecordsFound");
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
findWindow.setAD_UserQuery_ID(toolbar.getAD_UserQuery_ID());
|
||||||
|
findWindow.advancedOkClick();
|
||||||
|
MQuery query = findWindow.getQuery();
|
||||||
|
|
||||||
|
// Confirmed query
|
||||||
|
if (query != null) {
|
||||||
|
m_onlyCurrentRows = false;
|
||||||
|
adTabbox.getSelectedGridTab().setQuery(query);
|
||||||
|
adTabbox.getSelectedTabpanel().query(m_onlyCurrentRows, m_onlyCurrentDays, MRole.getDefault().getMaxQueryRecords()); // autoSize
|
||||||
|
}
|
||||||
|
|
||||||
|
adTabbox.getSelectedGridTab().dataRefresh(false);
|
||||||
|
|
||||||
|
focusToActivePanel();
|
||||||
|
findWindow.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
* Start Button Process
|
* Start Button Process
|
||||||
* @param vButton button
|
* @param vButton button
|
||||||
|
|
|
@ -176,4 +176,9 @@ public interface ToolbarListener
|
||||||
public void onCustomize();
|
public void onCustomize();
|
||||||
|
|
||||||
public void onProcess();
|
public void onProcess();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Select query from the user query list
|
||||||
|
*/
|
||||||
|
public void onSearchQuery();
|
||||||
}
|
}
|
||||||
|
|
|
@ -248,6 +248,9 @@ public class FindWindow extends Window implements EventListener<Event>, ValueCha
|
||||||
private String m_whereUserQuery;
|
private String m_whereUserQuery;
|
||||||
private ToolBar advancedPanelToolBar;
|
private ToolBar advancedPanelToolBar;
|
||||||
|
|
||||||
|
/**IDEMPIERE-4085*/
|
||||||
|
private int m_AD_UserQuery_ID = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FindPanel Constructor
|
* FindPanel Constructor
|
||||||
* @param targetWindowNo targetWindowNo
|
* @param targetWindowNo targetWindowNo
|
||||||
|
@ -619,7 +622,7 @@ public class FindWindow extends Window implements EventListener<Event>, ValueCha
|
||||||
//user query
|
//user query
|
||||||
userQueries = MUserQuery.get(Env.getCtx(), m_AD_Tab_ID);
|
userQueries = MUserQuery.get(Env.getCtx(), m_AD_Tab_ID);
|
||||||
for (int i = 0; i < userQueries.length; i++)
|
for (int i = 0; i < userQueries.length; i++)
|
||||||
fQueryName.appendItem(userQueries[i].getName());
|
fQueryName.appendItem(userQueries[i].getName(), userQueries[i].getAD_UserQuery_ID());
|
||||||
fQueryName.setValue("");
|
fQueryName.setValue("");
|
||||||
fQueryName.addEventListener(Events.ON_SELECT, this);
|
fQueryName.addEventListener(Events.ON_SELECT, this);
|
||||||
|
|
||||||
|
@ -1255,7 +1258,7 @@ public class FindWindow extends Window implements EventListener<Event>, ValueCha
|
||||||
|
|
||||||
public void onEvent(Event event) throws Exception
|
public void onEvent(Event event) throws Exception
|
||||||
{
|
{
|
||||||
m_createNew = false;
|
m_createNew = false;
|
||||||
if (Events.ON_CHANGE.equals(event.getName()))
|
if (Events.ON_CHANGE.equals(event.getName()))
|
||||||
{
|
{
|
||||||
if (event.getTarget() == historyCombo)
|
if (event.getTarget() == historyCombo)
|
||||||
|
@ -1320,41 +1323,7 @@ public class FindWindow extends Window implements EventListener<Event>, ValueCha
|
||||||
}
|
}
|
||||||
else if (event.getTarget() == fQueryName)
|
else if (event.getTarget() == fQueryName)
|
||||||
{
|
{
|
||||||
m_whereUserQuery = null;
|
onSelectedQueryChanged();
|
||||||
showAdvanced();
|
|
||||||
btnSave.setDisabled(false);
|
|
||||||
btnShare.setDisabled(false);
|
|
||||||
int index = fQueryName.getSelectedIndex();
|
|
||||||
if(index < 0) return;
|
|
||||||
if (winMain.getComponent().getSelectedIndex() != 1)
|
|
||||||
{
|
|
||||||
winMain.getComponent().setSelectedIndex(1);
|
|
||||||
btnSave.setDisabled(m_AD_Tab_ID <= 0);
|
|
||||||
btnShare.setDisabled(m_AD_Tab_ID <= 0);
|
|
||||||
historyCombo.setSelectedItem(null);
|
|
||||||
fQueryName.setReadonly(false);
|
|
||||||
}
|
|
||||||
msgLabel.setText("");
|
|
||||||
|
|
||||||
if(index == 0)
|
|
||||||
{ // no query - wipe and start over.
|
|
||||||
List<?> rowList = advancedPanel.getChildren();
|
|
||||||
for (int rowIndex = rowList.size() - 1; rowIndex >= 1; rowIndex--)
|
|
||||||
rowList.remove(rowIndex);
|
|
||||||
createFields();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
MUserQuery uq = userQueries[index-1];
|
|
||||||
// If global query do not allow other users to save the query
|
|
||||||
if (uq.getAD_User_ID() != Env.getAD_User_ID(Env.getCtx())) {
|
|
||||||
if (!MRole.PREFERENCETYPE_Client.equals(MRole.getDefault().getPreferenceType()) ||
|
|
||||||
uq.getAD_Client_ID() != Env.getAD_Client_ID(Env.getCtx())) {
|
|
||||||
btnSave.setDisabled(true);
|
|
||||||
btnShare.setDisabled(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
parseUserQuery(userQueries[index-1]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if (event.getTarget() instanceof Tab) {
|
else if (event.getTarget() instanceof Tab) {
|
||||||
if (winMain.getComponent().getSelectedIndex() == 1) {
|
if (winMain.getComponent().getSelectedIndex() == 1) {
|
||||||
|
@ -1404,8 +1373,8 @@ public class FindWindow extends Window implements EventListener<Event>, ValueCha
|
||||||
|
|
||||||
if ("btnOkSimple".equals(btn.getName()))
|
if ("btnOkSimple".equals(btn.getName()))
|
||||||
{
|
{
|
||||||
|
fQueryName.setSelectedIndex(0);
|
||||||
cmd_ok_Simple();
|
cmd_ok_Simple();
|
||||||
fQueryName.setValue("");
|
|
||||||
if (advancedPanel != null) {
|
if (advancedPanel != null) {
|
||||||
advancedPanel.getItems().clear();
|
advancedPanel.getItems().clear();
|
||||||
}
|
}
|
||||||
|
@ -1478,6 +1447,44 @@ public class FindWindow extends Window implements EventListener<Event>, ValueCha
|
||||||
|
|
||||||
} // onEvent
|
} // onEvent
|
||||||
|
|
||||||
|
public void onSelectedQueryChanged() {
|
||||||
|
m_whereUserQuery = null;
|
||||||
|
showAdvanced();
|
||||||
|
btnSave.setDisabled(false);
|
||||||
|
btnShare.setDisabled(false);
|
||||||
|
int index = fQueryName.getSelectedIndex();
|
||||||
|
if(index < 0) return;
|
||||||
|
if (winMain.getComponent().getSelectedIndex() != 1)
|
||||||
|
{
|
||||||
|
winMain.getComponent().setSelectedIndex(1);
|
||||||
|
btnSave.setDisabled(m_AD_Tab_ID <= 0);
|
||||||
|
btnShare.setDisabled(m_AD_Tab_ID <= 0);
|
||||||
|
historyCombo.setSelectedItem(null);
|
||||||
|
fQueryName.setReadonly(false);
|
||||||
|
}
|
||||||
|
msgLabel.setText("");
|
||||||
|
|
||||||
|
if(index == 0)
|
||||||
|
{ // no query - wipe and start over.
|
||||||
|
List<?> rowList = advancedPanel.getChildren();
|
||||||
|
for (int rowIndex = rowList.size() - 1; rowIndex >= 1; rowIndex--)
|
||||||
|
rowList.remove(rowIndex);
|
||||||
|
createFields();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
MUserQuery uq = userQueries[index-1];
|
||||||
|
// If global query do not allow other users to save the query
|
||||||
|
if (uq.getAD_User_ID() != Env.getAD_User_ID(Env.getCtx())) {
|
||||||
|
if (!MRole.PREFERENCETYPE_Client.equals(MRole.getDefault().getPreferenceType()) ||
|
||||||
|
uq.getAD_Client_ID() != Env.getAD_Client_ID(Env.getCtx())) {
|
||||||
|
btnSave.setDisabled(true);
|
||||||
|
btnShare.setDisabled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
parseUserQuery(userQueries[index-1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void onSimpleTabSelected() {
|
private void onSimpleTabSelected() {
|
||||||
historyCombo.setDisabled(false);
|
historyCombo.setDisabled(false);
|
||||||
}
|
}
|
||||||
|
@ -1491,6 +1498,9 @@ public class FindWindow extends Window implements EventListener<Event>, ValueCha
|
||||||
|
|
||||||
private void parseUserQuery(MUserQuery userQuery)
|
private void parseUserQuery(MUserQuery userQuery)
|
||||||
{
|
{
|
||||||
|
if (userQuery == null)
|
||||||
|
return;
|
||||||
|
|
||||||
String code = userQuery.getCode();
|
String code = userQuery.getCode();
|
||||||
if (code.startsWith("@SQL=")) {
|
if (code.startsWith("@SQL=")) {
|
||||||
m_whereUserQuery = "(" + code.substring(code.indexOf("=")+1, code.length()) + ")";
|
m_whereUserQuery = "(" + code.substring(code.indexOf("=")+1, code.length()) + ")";
|
||||||
|
@ -1992,10 +2002,11 @@ public class FindWindow extends Window implements EventListener<Event>, ValueCha
|
||||||
userQueries = MUserQuery.get(Env.getCtx(), m_AD_Tab_ID);
|
userQueries = MUserQuery.get(Env.getCtx(), m_AD_Tab_ID);
|
||||||
fQueryName.getItems().clear();
|
fQueryName.getItems().clear();
|
||||||
boolean selected = false;
|
boolean selected = false;
|
||||||
fQueryName.appendItem(m_sNew);
|
fQueryName.appendItem(m_sNew, 0);
|
||||||
for (int i = 0; i < userQueries.length; i++)
|
for (int i = 0; i < userQueries.length; i++)
|
||||||
{
|
{
|
||||||
Comboitem ci = fQueryName.appendItem(userQueries[i].getName());
|
Comboitem ci = fQueryName.appendItem(userQueries[i].getName());
|
||||||
|
ci.setValue(userQueries[i].getAD_UserQuery_ID());
|
||||||
if(value.equals(userQueries[i].getName()))
|
if(value.equals(userQueries[i].getName()))
|
||||||
{
|
{
|
||||||
fQueryName.setSelectedItem(ci);
|
fQueryName.setSelectedItem(ci);
|
||||||
|
@ -2306,6 +2317,13 @@ public class FindWindow extends Window implements EventListener<Event>, ValueCha
|
||||||
dispose();
|
dispose();
|
||||||
} // cmd_ok_Advanced
|
} // cmd_ok_Advanced
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Simulate the user query selection and click ok
|
||||||
|
*/
|
||||||
|
public void advancedOkClick() {
|
||||||
|
onSelectedQueryChanged();
|
||||||
|
cmd_ok_Advanced();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the number of records of target tab
|
* Get the number of records of target tab
|
||||||
|
@ -2737,4 +2755,21 @@ public class FindWindow extends Window implements EventListener<Event>, ValueCha
|
||||||
advancedPanel.setVisible(true);
|
advancedPanel.setVisible(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getAD_UserQuery_ID() {
|
||||||
|
if (fQueryName.getSelectedIndex() <= 0 || userQueries[fQueryName.getSelectedIndex()-1] == null)
|
||||||
|
m_AD_UserQuery_ID = 0;
|
||||||
|
else if (m_AD_UserQuery_ID != userQueries[fQueryName.getSelectedIndex()-1].getAD_UserQuery_ID())
|
||||||
|
m_AD_UserQuery_ID = userQueries[fQueryName.getSelectedIndex()-1].getAD_UserQuery_ID();
|
||||||
|
return m_AD_UserQuery_ID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAD_UserQuery_ID(int AD_UserQuery_ID) {
|
||||||
|
m_AD_UserQuery_ID = AD_UserQuery_ID;
|
||||||
|
for (Comboitem li : fQueryName.getItems()) {
|
||||||
|
if (m_AD_UserQuery_ID == (Integer) li.getValue()) {
|
||||||
|
fQueryName.setSelectedItem(li);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
} // FindPanel
|
} // FindPanel
|
||||||
|
|
|
@ -95,3 +95,15 @@
|
||||||
.font-icon-menuitem i {
|
.font-icon-menuitem i {
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
}
|
}
|
||||||
|
.toolbar-searchbox {
|
||||||
|
margin-right: 10px;
|
||||||
|
margin-left: 10px;
|
||||||
|
border: 1px;
|
||||||
|
padding: 1px;
|
||||||
|
}
|
||||||
|
@media screen and (max-width: 768px) {
|
||||||
|
.toolbar-searchbox {
|
||||||
|
display: none;
|
||||||
|
width: 0px;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue