IDEMPIERE-377 Improve current search dialog box. Change search window from modal to popup. Retain last search crieria. Make saved query always accessible.
This commit is contained in:
parent
2f1aa8ac91
commit
33d893d77c
|
@ -31,6 +31,7 @@ import java.util.Vector;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
import org.adempiere.util.Callback;
|
import org.adempiere.util.Callback;
|
||||||
|
import org.adempiere.webui.LayoutUtils;
|
||||||
import org.adempiere.webui.WArchive;
|
import org.adempiere.webui.WArchive;
|
||||||
import org.adempiere.webui.WRequest;
|
import org.adempiere.webui.WRequest;
|
||||||
import org.adempiere.webui.WZoomAcross;
|
import org.adempiere.webui.WZoomAcross;
|
||||||
|
@ -547,6 +548,7 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
|
||||||
if (tabIndex == 0)
|
if (tabIndex == 0)
|
||||||
{
|
{
|
||||||
m_queryInitiating = true;
|
m_queryInitiating = true;
|
||||||
|
getComponent().setVisible(false);
|
||||||
initialQuery(query, gTab, new Callback<MQuery>() {
|
initialQuery(query, gTab, new Callback<MQuery>() {
|
||||||
@Override
|
@Override
|
||||||
public void onCallback(MQuery result) {
|
public void onCallback(MQuery result) {
|
||||||
|
@ -557,6 +559,9 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!getComponent().isVisible())
|
||||||
|
getComponent().setVisible(true);
|
||||||
|
|
||||||
// Set initial Query on first tab
|
// Set initial Query on first tab
|
||||||
if (result != null)
|
if (result != null)
|
||||||
{
|
{
|
||||||
|
@ -702,19 +707,21 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
|
||||||
m_findCancelled = false;
|
m_findCancelled = false;
|
||||||
m_findCreateNew = false;
|
m_findCreateNew = false;
|
||||||
GridField[] findFields = mTab.getFields();
|
GridField[] findFields = mTab.getFields();
|
||||||
final FindWindow find = new FindWindow(curWindowNo,
|
findWindow = new FindWindow(curWindowNo,
|
||||||
mTab.getName(), mTab.getAD_Table_ID(), mTab.getTableName(),
|
mTab.getName(), mTab.getAD_Table_ID(), mTab.getTableName(),
|
||||||
where.toString(), findFields, 10, mTab.getAD_Tab_ID()); // no query below 10
|
where.toString(), findFields, 10, mTab.getAD_Tab_ID()); // no query below 10
|
||||||
if (find.isValid())
|
if (findWindow.initialize())
|
||||||
{
|
{
|
||||||
find.addEventListener(DialogEvents.ON_WINDOW_CLOSE, new EventListener<Event>() {
|
findWindow.addEventListener(DialogEvents.ON_WINDOW_CLOSE, new EventListener<Event>() {
|
||||||
@Override
|
@Override
|
||||||
public void onEvent(Event event) throws Exception {
|
public void onEvent(Event event) throws Exception {
|
||||||
if (!find.isCancel())
|
if (!findWindow.isCancel())
|
||||||
{
|
{
|
||||||
m_findCreateNew = find.isCreateNew();
|
m_findCreateNew = findWindow.isCreateNew();
|
||||||
MQuery result = find.getQuery();
|
MQuery result = findWindow.getQuery();
|
||||||
callback.onCallback(result);
|
callback.onCallback(result);
|
||||||
|
EventListener<? extends Event> listener = findWindow.getEventListeners(DialogEvents.ON_WINDOW_CLOSE).iterator().next();
|
||||||
|
findWindow.removeEventListener(DialogEvents.ON_WINDOW_CLOSE, listener);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -723,7 +730,14 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
AEnv.showWindow(find);
|
findWindow.setTitle(null);
|
||||||
|
getComponent().addEventListener("onInitialQuery", new EventListener<Event>() {
|
||||||
|
@Override
|
||||||
|
public void onEvent(Event event) throws Exception {
|
||||||
|
LayoutUtils.openPopupWindow(getComponent(), findWindow, "overlap");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Events.echoEvent("onInitialQuery", getComponent(), null);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -850,6 +864,8 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
|
||||||
private Menuitem m_lock = null;
|
private Menuitem m_lock = null;
|
||||||
private Menuitem m_access = null;
|
private Menuitem m_access = null;
|
||||||
|
|
||||||
|
private FindWindow findWindow;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see ToolbarListener#onLock()
|
* @see ToolbarListener#onLock()
|
||||||
*/
|
*/
|
||||||
|
@ -1618,46 +1634,53 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
|
||||||
|
|
||||||
private void doOnFind() {
|
private void doOnFind() {
|
||||||
// Gets Fields from AD_Field_v
|
// Gets Fields from AD_Field_v
|
||||||
GridField[] findFields = GridField.createFields(ctx, curTab.getWindowNo(), 0,curTab.getAD_Tab_ID());
|
GridField[] findFields = curTab.getFields();
|
||||||
final FindWindow find = new FindWindow (curTab.getWindowNo(), curTab.getName(),
|
if (findWindow == null || !findWindow.validate(curTab.getWindowNo(), curTab.getName(),
|
||||||
curTab.getAD_Table_ID(), curTab.getTableName(),
|
curTab.getAD_Table_ID(), curTab.getTableName(),
|
||||||
curTab.getWhereExtended(), findFields, 1, curTab.getAD_Tab_ID());
|
curTab.getWhereExtended(), findFields, 1, curTab.getAD_Tab_ID())) {
|
||||||
|
findWindow = new FindWindow (curTab.getWindowNo(), curTab.getName(),
|
||||||
if (!find.isValid()) {
|
curTab.getAD_Table_ID(), curTab.getTableName(),
|
||||||
if (find.getTotalRecords() == 0) {
|
curTab.getWhereExtended(), findFields, 1, curTab.getAD_Tab_ID());
|
||||||
FDialog.info(curWindowNo, getComponent(), "NoRecordsFound");
|
|
||||||
}
|
if (!findWindow.initialize()) {
|
||||||
return;
|
if (findWindow.getTotalRecords() == 0) {
|
||||||
|
FDialog.info(curWindowNo, getComponent(), "NoRecordsFound");
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
find.addEventListener(DialogEvents.ON_WINDOW_CLOSE, new EventListener<Event>() {
|
if (!findWindow.getEventListeners(DialogEvents.ON_WINDOW_CLOSE).iterator().hasNext()) {
|
||||||
@Override
|
findWindow.addEventListener(DialogEvents.ON_WINDOW_CLOSE, new EventListener<Event>() {
|
||||||
public void onEvent(Event event) throws Exception {
|
@Override
|
||||||
if (!find.isCancel())
|
public void onEvent(Event event) throws Exception {
|
||||||
{
|
if (!findWindow.isCancel())
|
||||||
MQuery query = find.getQuery();
|
|
||||||
|
|
||||||
// Confirmed query
|
|
||||||
if (query != null)
|
|
||||||
{
|
{
|
||||||
m_onlyCurrentRows = false; // search history too
|
MQuery query = findWindow.getQuery();
|
||||||
curTab.setQuery(query);
|
|
||||||
curTabpanel.query(m_onlyCurrentRows, m_onlyCurrentDays, MRole.getDefault().getMaxQueryRecords()); // autoSize
|
// Confirmed query
|
||||||
|
if (query != null)
|
||||||
|
{
|
||||||
|
m_onlyCurrentRows = false; // search history too
|
||||||
|
curTab.setQuery(query);
|
||||||
|
curTabpanel.query(m_onlyCurrentRows, m_onlyCurrentDays, MRole.getDefault().getMaxQueryRecords()); // autoSize
|
||||||
|
}
|
||||||
|
|
||||||
|
if (findWindow.isCreateNew())
|
||||||
|
onNew();
|
||||||
|
else
|
||||||
|
curTab.dataRefresh(false); // Elaine 2008/07/25
|
||||||
}
|
}
|
||||||
|
else
|
||||||
if (find.isCreateNew())
|
{
|
||||||
onNew();
|
toolbar.getButton("Find").setPressed(curTab.isQueryActive());
|
||||||
else
|
}
|
||||||
curTab.dataRefresh(false); // Elaine 2008/07/25
|
focusToActivePanel();
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
toolbar.getButton("Find").setPressed(curTab.isQueryActive());
|
|
||||||
}
|
}
|
||||||
focusToActivePanel();
|
});
|
||||||
}
|
}
|
||||||
});
|
findWindow.setTitle(null);
|
||||||
AEnv.showWindow(find);
|
LayoutUtils.openPopupWindow(toolbar, findWindow, "after_start");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -88,10 +88,12 @@ import org.zkoss.zk.ui.event.Events;
|
||||||
import org.zkoss.zk.ui.util.Clients;
|
import org.zkoss.zk.ui.util.Clients;
|
||||||
import org.zkoss.zul.Borderlayout;
|
import org.zkoss.zul.Borderlayout;
|
||||||
import org.zkoss.zul.Center;
|
import org.zkoss.zul.Center;
|
||||||
import org.zkoss.zul.North;
|
import org.zkoss.zul.Div;
|
||||||
import org.zkoss.zul.South;
|
import org.zkoss.zul.South;
|
||||||
import org.zkoss.zul.Comboitem;
|
import org.zkoss.zul.Comboitem;
|
||||||
import org.zkoss.zul.Hbox;
|
import org.zkoss.zul.Hbox;
|
||||||
|
import org.zkoss.zul.Tab;
|
||||||
|
import org.zkoss.zul.Vlayout;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class is based on org.compiere.apps.search.Find written by Jorg Janke.
|
* This class is based on org.compiere.apps.search.Find written by Jorg Janke.
|
||||||
|
@ -154,6 +156,10 @@ public class FindWindow extends Window implements EventListener<Event>, ValueCha
|
||||||
private Rows contentSimpleRows;
|
private Rows contentSimpleRows;
|
||||||
private boolean m_createNew = false;
|
private boolean m_createNew = false;
|
||||||
private boolean isvalid = true;
|
private boolean isvalid = true;
|
||||||
|
private int m_minRecords;
|
||||||
|
private String m_title;
|
||||||
|
private ToolBarButton btnSave;
|
||||||
|
private Label msgLabel;
|
||||||
|
|
||||||
/** Index ColumnName = 0 */
|
/** Index ColumnName = 0 */
|
||||||
public static final int INDEX_COLUMNNAME = 0;
|
public static final int INDEX_COLUMNNAME = 0;
|
||||||
|
@ -183,13 +189,30 @@ public class FindWindow extends Window implements EventListener<Event>, ValueCha
|
||||||
GridField[] findFields, int minRecords, int adTabId)
|
GridField[] findFields, int minRecords, int adTabId)
|
||||||
{
|
{
|
||||||
m_targetWindowNo = targetWindowNo;
|
m_targetWindowNo = targetWindowNo;
|
||||||
|
m_title = title;
|
||||||
m_AD_Table_ID = AD_Table_ID;
|
m_AD_Table_ID = AD_Table_ID;
|
||||||
m_tableName = tableName;
|
m_tableName = tableName;
|
||||||
m_whereExtended = whereExtended;
|
m_whereExtended = whereExtended;
|
||||||
m_findFields = findFields;
|
m_findFields = findFields;
|
||||||
m_AD_Tab_ID = adTabId;
|
m_AD_Tab_ID = adTabId;
|
||||||
|
m_minRecords = minRecords;
|
||||||
|
m_isCancel = true;
|
||||||
//
|
//
|
||||||
m_query = new MQuery (m_tableName);
|
|
||||||
|
this.setBorder("normal");
|
||||||
|
this.setShadow(false);
|
||||||
|
this.setWidth("750px");
|
||||||
|
this.setHeight("350px");
|
||||||
|
this.setTitle(Msg.getMsg(Env.getCtx(), "Find").replaceAll("&", "") + ": " + title);
|
||||||
|
this.setAttribute(Window.MODE_KEY, Window.MODE_HIGHLIGHTED);
|
||||||
|
this.setClosable(false);
|
||||||
|
this.setSizable(true);
|
||||||
|
this.setMaximizable(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean initialize()
|
||||||
|
{
|
||||||
|
m_query = new MQuery (m_tableName);
|
||||||
m_query.addRestriction(m_whereExtended);
|
m_query.addRestriction(m_whereExtended);
|
||||||
// Required for Column Validation
|
// Required for Column Validation
|
||||||
Env.setContext(Env.getCtx(), m_targetWindowNo, "Find_Table_ID", m_AD_Table_ID);
|
Env.setContext(Env.getCtx(), m_targetWindowNo, "Find_Table_ID", m_AD_Table_ID);
|
||||||
|
@ -200,20 +223,45 @@ public class FindWindow extends Window implements EventListener<Event>, ValueCha
|
||||||
initFind();
|
initFind();
|
||||||
initFindAdvanced();
|
initFindAdvanced();
|
||||||
|
|
||||||
if (m_total < minRecords)
|
if (m_total < m_minRecords)
|
||||||
{
|
{
|
||||||
dispose();
|
return false;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
this.setBorder("normal");
|
return true;
|
||||||
this.setWidth("750px");
|
|
||||||
this.setHeight("350px");
|
|
||||||
this.setTitle(Msg.getMsg(Env.getCtx(), "Find").replaceAll("&", "") + ": " + title);
|
|
||||||
this.setAttribute(Window.MODE_KEY, Window.MODE_HIGHLIGHTED);
|
|
||||||
this.setClosable(false);
|
|
||||||
this.setSizable(true);
|
|
||||||
this.setMaximizable(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean validate(int targetWindowNo, String title,
|
||||||
|
int AD_Table_ID, String tableName, String whereExtended,
|
||||||
|
GridField[] findFields, int minRecords, int adTabId)
|
||||||
|
{
|
||||||
|
if (m_targetWindowNo != targetWindowNo) return false;
|
||||||
|
if ((title == null && m_title != null) || (title != null && m_title == null) || !(title.equals(m_title))) return false;
|
||||||
|
if (AD_Table_ID != m_AD_Table_ID) return false;
|
||||||
|
if ((tableName == null && m_tableName != null) || (tableName != null && m_tableName == null) || !(tableName.equals(m_tableName))) return false;
|
||||||
|
if ((whereExtended == null && m_whereExtended != null) || (whereExtended != null && m_whereExtended == null) || !(whereExtended.equals(m_whereExtended))) return false;
|
||||||
|
if (adTabId != m_AD_Tab_ID) return false;
|
||||||
|
if ((findFields == null && m_findFields != null) || (findFields != null && m_findFields == null) || (findFields.length != m_findFields.length)) return false;
|
||||||
|
if (findFields != null && findFields.length > 0)
|
||||||
|
{
|
||||||
|
for(int i = 0; i < findFields.length; i++)
|
||||||
|
{
|
||||||
|
if (findFields[i].getAD_Field_ID() != m_findFields[i].getAD_Field_ID()) return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
m_minRecords = minRecords;
|
||||||
|
m_total = getNoOfRecords(null, false);
|
||||||
|
if (m_total < m_minRecords)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_query = new MQuery (m_tableName);
|
||||||
|
m_query.addRestriction(m_whereExtended);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* initialise lookup record tab
|
* initialise lookup record tab
|
||||||
*
|
*
|
||||||
|
@ -313,23 +361,6 @@ public class FindWindow extends Window implements EventListener<Event>, ValueCha
|
||||||
btnDelete.setImage("/images/Delete24.png");
|
btnDelete.setImage("/images/Delete24.png");
|
||||||
btnDelete.addEventListener(Events.ON_CLICK, this);
|
btnDelete.addEventListener(Events.ON_CLICK, this);
|
||||||
|
|
||||||
ToolBarButton btnSave = new ToolBarButton();
|
|
||||||
btnSave.setAttribute("name","btnSaveAdv");
|
|
||||||
btnSave.setImage("/images/Save24.png");
|
|
||||||
btnSave.addEventListener(Events.ON_CLICK, this);
|
|
||||||
|
|
||||||
fQueryName = new Combobox();
|
|
||||||
fQueryName.setTooltiptext(Msg.getMsg(Env.getCtx(),"QueryName"));
|
|
||||||
fQueryName.setReadonly(false);
|
|
||||||
|
|
||||||
//user query
|
|
||||||
userQueries = MUserQuery.get(Env.getCtx(), m_AD_Tab_ID);
|
|
||||||
for (int i = 0; i < userQueries.length; i++)
|
|
||||||
fQueryName.appendItem(userQueries[i].getName());
|
|
||||||
fQueryName.setValue("");
|
|
||||||
|
|
||||||
fQueryName.addEventListener(Events.ON_SELECT, this);
|
|
||||||
|
|
||||||
Button btnOk = new Button();
|
Button btnOk = new Button();
|
||||||
btnOk.setName("btnOkAdv");
|
btnOk.setName("btnOkAdv");
|
||||||
btnOk.setImage("/images/Ok24.png");
|
btnOk.setImage("/images/Ok24.png");
|
||||||
|
@ -349,14 +380,9 @@ public class FindWindow extends Window implements EventListener<Event>, ValueCha
|
||||||
|
|
||||||
ToolBar toolBar = new ToolBar();
|
ToolBar toolBar = new ToolBar();
|
||||||
toolBar.appendChild(btnNew);
|
toolBar.appendChild(btnNew);
|
||||||
toolBar.appendChild(btnDelete);
|
toolBar.appendChild(btnDelete);
|
||||||
toolBar.appendChild(fQueryName);
|
|
||||||
toolBar.appendChild(btnSave);
|
|
||||||
toolBar.setWidth("100%");
|
toolBar.setWidth("100%");
|
||||||
fQueryName.setStyle("margin-left: 3px; margin-right: 3px; position: relative; top: 5px;");
|
|
||||||
|
|
||||||
btnSave.setDisabled(m_AD_Tab_ID <= 0);
|
|
||||||
|
|
||||||
Hbox confirmPanel = new Hbox();
|
Hbox confirmPanel = new Hbox();
|
||||||
confirmPanel.appendChild(pnlButtonRight);
|
confirmPanel.appendChild(pnlButtonRight);
|
||||||
confirmPanel.setWidth("100%");
|
confirmPanel.setWidth("100%");
|
||||||
|
@ -389,25 +415,18 @@ public class FindWindow extends Window implements EventListener<Event>, ValueCha
|
||||||
advancedPanel.appendChild(listhead);
|
advancedPanel.appendChild(listhead);
|
||||||
advancedPanel.setVflex(true);
|
advancedPanel.setVflex(true);
|
||||||
|
|
||||||
Borderlayout layout = new Borderlayout();
|
Vlayout vlayout = new Vlayout();
|
||||||
layout.setStyle("height: 100%; width: 99%; position: relative;");
|
vlayout.setStyle("width: 100%; height: 100%; position: relative");
|
||||||
winAdvanced.appendChild(layout);
|
vlayout.setVflex("1");
|
||||||
|
winAdvanced.appendChild(vlayout);
|
||||||
North north = new North();
|
toolBar.setVflex("0");
|
||||||
layout.appendChild(north);
|
vlayout.appendChild(toolBar);
|
||||||
north.appendChild(toolBar);
|
vlayout.appendChild(advancedPanel);
|
||||||
|
confirmPanel.setVflex("0");
|
||||||
Center center = new Center();
|
vlayout.appendChild(confirmPanel);
|
||||||
layout.appendChild(center);
|
|
||||||
center.appendChild(advancedPanel);
|
|
||||||
center.setFlex(true);
|
|
||||||
|
|
||||||
South south = new South();
|
|
||||||
layout.appendChild(south);
|
|
||||||
south.appendChild(confirmPanel);
|
|
||||||
|
|
||||||
winAdvanced.setHeight("100%");
|
winAdvanced.setHeight("100%");
|
||||||
winAdvanced.setWidth("100%");
|
winAdvanced.setWidth("99%");
|
||||||
winAdvanced.addEventListener(Events.ON_OK,this);
|
winAdvanced.addEventListener(Events.ON_OK,this);
|
||||||
|
|
||||||
} // initAdvanced
|
} // initAdvanced
|
||||||
|
@ -418,9 +437,48 @@ public class FindWindow extends Window implements EventListener<Event>, ValueCha
|
||||||
**/
|
**/
|
||||||
private void initPanel()
|
private void initPanel()
|
||||||
{
|
{
|
||||||
|
Vlayout layout = new Vlayout();
|
||||||
|
layout.setStyle("height: 100%; width: 100%; position: relative;");
|
||||||
|
layout.setVflex("1");
|
||||||
|
this.appendChild(layout);
|
||||||
|
|
||||||
|
Div div = new Div();
|
||||||
|
div.setVflex("0");
|
||||||
|
layout.appendChild(div);
|
||||||
|
|
||||||
|
btnSave = new ToolBarButton();
|
||||||
|
btnSave.setAttribute("name","btnSaveAdv");
|
||||||
|
btnSave.setImage("/images/Save24.png");
|
||||||
|
btnSave.addEventListener(Events.ON_CLICK, this);
|
||||||
|
btnSave.setDisabled(true);
|
||||||
|
// LayoutUtils.addSclass("disableFilter", btnSave);
|
||||||
|
|
||||||
|
fQueryName = new Combobox();
|
||||||
|
fQueryName.setTooltiptext(Msg.getMsg(Env.getCtx(),"QueryName"));
|
||||||
|
fQueryName.setReadonly(true);
|
||||||
|
|
||||||
|
//user query
|
||||||
|
userQueries = MUserQuery.get(Env.getCtx(), m_AD_Tab_ID);
|
||||||
|
for (int i = 0; i < userQueries.length; i++)
|
||||||
|
fQueryName.appendItem(userQueries[i].getName());
|
||||||
|
fQueryName.setValue("");
|
||||||
|
fQueryName.addEventListener(Events.ON_SELECT, this);
|
||||||
|
|
||||||
|
Label label = new Label(Msg.getMsg(Env.getCtx(), "SavedQuery"));
|
||||||
|
div.appendChild(label);
|
||||||
|
div.appendChild(fQueryName);
|
||||||
|
div.appendChild(btnSave);
|
||||||
|
// div.appendChild(new Separator());
|
||||||
|
msgLabel = new Label("");
|
||||||
|
msgLabel.setStyle("margin-left: 10px");
|
||||||
|
div.appendChild(msgLabel);
|
||||||
|
fQueryName.setStyle("margin-left: 3px; margin-right: 3px; position: relative;");
|
||||||
|
|
||||||
winMain = new MultiTabPart();
|
winMain = new MultiTabPart();
|
||||||
winMain.createPart(this);
|
winMain.createPart(layout);
|
||||||
winMain.getComponent().setStyle("height: 100%; width: 100%; position: relative;");
|
winMain.getComponent().setStyle("width: 100%; position: relative;");
|
||||||
|
winMain.getComponent().setVflex("1");
|
||||||
|
winMain.getComponent().addEventListener(Events.ON_SELECT, this);
|
||||||
winAdvanced = new Window();
|
winAdvanced = new Window();
|
||||||
winLookupRecord = new Window();
|
winLookupRecord = new Window();
|
||||||
Tabpanel tabPanel = new Tabpanel();
|
Tabpanel tabPanel = new Tabpanel();
|
||||||
|
@ -722,8 +780,23 @@ public class FindWindow extends Window implements EventListener<Event>, ValueCha
|
||||||
{
|
{
|
||||||
int index = fQueryName.getSelectedIndex();
|
int index = fQueryName.getSelectedIndex();
|
||||||
if(index < 0) return;
|
if(index < 0) return;
|
||||||
|
if (winMain.getComponent().getSelectedIndex() != 1) {
|
||||||
|
winMain.getComponent().setSelectedIndex(1);
|
||||||
|
btnSave.setDisabled(m_AD_Tab_ID <= 0);
|
||||||
|
fQueryName.setReadonly(false);
|
||||||
|
}
|
||||||
|
msgLabel.setText("");
|
||||||
parseUserQuery(userQueries[index]);
|
parseUserQuery(userQueries[index]);
|
||||||
}
|
}
|
||||||
|
else if (event.getTarget() instanceof Tab) {
|
||||||
|
if (winMain.getComponent().getSelectedIndex() == 1) {
|
||||||
|
fQueryName.setReadonly(false);
|
||||||
|
btnSave.setDisabled(m_AD_Tab_ID <= 0);
|
||||||
|
} else {
|
||||||
|
fQueryName.setReadonly(true);
|
||||||
|
btnSave.setDisabled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
} //
|
} //
|
||||||
else if (Events.ON_CLICK.equals(event.getName()))
|
else if (Events.ON_CLICK.equals(event.getName()))
|
||||||
{
|
{
|
||||||
|
@ -740,8 +813,11 @@ public class FindWindow extends Window implements EventListener<Event>, ValueCha
|
||||||
else if ("btnDeleteAdv".equals(button.getAttribute("name").toString()))
|
else if ("btnDeleteAdv".equals(button.getAttribute("name").toString()))
|
||||||
{
|
{
|
||||||
int index = advancedPanel.getSelectedIndex();
|
int index = advancedPanel.getSelectedIndex();
|
||||||
advancedPanel.getSelectedItem().detach();
|
if (advancedPanel.getSelectedItem() != null)
|
||||||
advancedPanel.setSelectedIndex(--index);
|
{
|
||||||
|
advancedPanel.getSelectedItem().detach();
|
||||||
|
advancedPanel.setSelectedIndex(--index);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else if ("btnSaveAdv".equals(button.getAttribute("name").toString()))
|
else if ("btnSaveAdv".equals(button.getAttribute("name").toString()))
|
||||||
|
@ -757,6 +833,10 @@ public class FindWindow extends Window implements EventListener<Event>, ValueCha
|
||||||
if ("btnOkSimple".equals(btn.getName()))
|
if ("btnOkSimple".equals(btn.getName()))
|
||||||
{
|
{
|
||||||
cmd_ok_Simple();
|
cmd_ok_Simple();
|
||||||
|
fQueryName.setValue("");
|
||||||
|
if (advancedPanel != null) {
|
||||||
|
advancedPanel.getItems().clear();
|
||||||
|
}
|
||||||
dispose();
|
dispose();
|
||||||
}
|
}
|
||||||
else if ("btnOkAdv".equals(btn.getName()))
|
else if ("btnOkAdv".equals(btn.getName()))
|
||||||
|
@ -774,6 +854,7 @@ public class FindWindow extends Window implements EventListener<Event>, ValueCha
|
||||||
m_query = MQuery.getNoRecordQuery(m_tableName, true);
|
m_query = MQuery.getNoRecordQuery(m_tableName, true);
|
||||||
m_total = 0;
|
m_total = 0;
|
||||||
m_createNew = true;
|
m_createNew = true;
|
||||||
|
m_isCancel = false;
|
||||||
dispose();
|
dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1072,11 +1153,11 @@ public class FindWindow extends Window implements EventListener<Event>, ValueCha
|
||||||
//
|
//
|
||||||
if (uq.save())
|
if (uq.save())
|
||||||
{
|
{
|
||||||
FDialog.info (m_targetWindowNo, this, "Saved", name);
|
msgLabel.setText(Msg.getMsg(Env.getCtx(), "Saved"));
|
||||||
refreshUserQueries();
|
refreshUserQueries();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
FDialog.warn (m_targetWindowNo, this, "SaveError", name);
|
msgLabel.setText(Msg.getMsg(Env.getCtx(), "SaveError"));
|
||||||
}
|
}
|
||||||
} // cmd_save
|
} // cmd_save
|
||||||
|
|
||||||
|
@ -1710,8 +1791,11 @@ public class FindWindow extends Window implements EventListener<Event>, ValueCha
|
||||||
@Override
|
@Override
|
||||||
public boolean setVisible(boolean visible) {
|
public boolean setVisible(boolean visible) {
|
||||||
boolean ret = super.setVisible(visible);
|
boolean ret = super.setVisible(visible);
|
||||||
if (ret && visible) {
|
if (visible) {
|
||||||
Events.echoEvent("OnPostVisible", this, null);
|
Events.echoEvent("OnPostVisible", this, null);
|
||||||
|
} else {
|
||||||
|
//auto detach
|
||||||
|
detach();
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -1726,4 +1810,5 @@ public class FindWindow extends Window implements EventListener<Event>, ValueCha
|
||||||
{
|
{
|
||||||
return isvalid;
|
return isvalid;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // FindPanel
|
} // FindPanel
|
|
@ -30,6 +30,7 @@ import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
import org.adempiere.exceptions.AdempiereException;
|
import org.adempiere.exceptions.AdempiereException;
|
||||||
import org.adempiere.pdf.Document;
|
import org.adempiere.pdf.Document;
|
||||||
|
import org.adempiere.webui.LayoutUtils;
|
||||||
import org.adempiere.webui.apps.AEnv;
|
import org.adempiere.webui.apps.AEnv;
|
||||||
import org.adempiere.webui.apps.WReport;
|
import org.adempiere.webui.apps.WReport;
|
||||||
import org.adempiere.webui.component.Checkbox;
|
import org.adempiere.webui.component.Checkbox;
|
||||||
|
@ -1036,7 +1037,7 @@ public class ZkReportViewer extends Window implements EventListener<Event>, ITab
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
final FindWindow find = new FindWindow(m_WindowNo, title, AD_Table_ID, tableName,m_reportEngine.getWhereExtended(), findFields, 1, AD_Tab_ID);
|
final FindWindow find = new FindWindow(m_WindowNo, title, AD_Table_ID, tableName,m_reportEngine.getWhereExtended(), findFields, 1, AD_Tab_ID);
|
||||||
if (!find.isValid())
|
if (!find.initialize())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
find.addEventListener(DialogEvents.ON_WINDOW_CLOSE, new EventListener<Event>() {
|
find.addEventListener(DialogEvents.ON_WINDOW_CLOSE, new EventListener<Event>() {
|
||||||
|
@ -1054,7 +1055,8 @@ public class ZkReportViewer extends Window implements EventListener<Event>, ITab
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
AEnv.showWindow(find);
|
find.setTitle(null);
|
||||||
|
LayoutUtils.openPopupWindow(toolBar, find, "after_start");
|
||||||
}
|
}
|
||||||
} // cmd_find
|
} // cmd_find
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue