Heng Sin Low 2009-05-19 07:48:43 +00:00
parent bfe8693f98
commit a8793b1fad
2 changed files with 24 additions and 2 deletions

View File

@ -71,7 +71,6 @@ import org.compiere.util.DisplayType;
import org.compiere.util.Env; import org.compiere.util.Env;
import org.compiere.util.Msg; import org.compiere.util.Msg;
import org.compiere.util.WebDoc; import org.compiere.util.WebDoc;
import org.jpedal.parser.Cmd;
import org.zkoss.zk.ui.Component; import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.Executions; import org.zkoss.zk.ui.Executions;
import org.zkoss.zk.ui.HtmlBasedComponent; import org.zkoss.zk.ui.HtmlBasedComponent;
@ -146,6 +145,8 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
private IADTabpanel embeddedTabPanel; private IADTabpanel embeddedTabPanel;
private boolean m_findCreateNew;
/** /**
* Constructor for non-embedded mode * Constructor for non-embedded mode
* @param ctx * @param ctx
@ -407,6 +408,13 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
} }
} }
} }
if (tabIndex == 0) {
if (curTab.isHighVolume() && m_findCreateNew)
onNew();
else if (query == null && curTab.getRowCount() == 0 && Env.isAutoNew(ctx, curWindowNo))
onNew();
}
} }
/** /**
@ -459,6 +467,7 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
if (require) if (require)
{ {
m_findCancelled = false; m_findCancelled = false;
m_findCreateNew = false;
GridField[] findFields = mTab.getFields(); GridField[] findFields = mTab.getFields();
FindWindow find = new FindWindow(curWindowNo, FindWindow find = new FindWindow(curWindowNo,
mTab.getName(), mTab.getAD_Table_ID(), mTab.getTableName(), mTab.getName(), mTab.getAD_Table_ID(), mTab.getTableName(),
@ -468,7 +477,10 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
find.setVisible(true); find.setVisible(true);
AEnv.showWindow(find); AEnv.showWindow(find);
if (!find.isCancel()) if (!find.isCancel())
{
query = find.getQuery(); query = find.getQuery();
m_findCreateNew = find.isCreateNew();
}
else else
m_findCancelled = true; m_findCancelled = true;
find = null; find = null;

View File

@ -159,6 +159,7 @@ public class FindWindow extends Window implements EventListener,ValueChangeListe
private Row pnlDescription; private Row pnlDescription;
private Row pnlValue; private Row pnlValue;
private Row pnlName; private Row pnlName;
private boolean m_createNew = false;
/** Index ColumnName = 0 */ /** Index ColumnName = 0 */
public static final int INDEX_COLUMNNAME = 0; public static final int INDEX_COLUMNNAME = 0;
@ -760,6 +761,7 @@ public class FindWindow extends Window implements EventListener,ValueChangeListe
{ {
m_query = MQuery.getNoRecordQuery(m_tableName, true); m_query = MQuery.getNoRecordQuery(m_tableName, true);
m_total = 0; m_total = 0;
m_createNew = true;
dispose(); dispose();
} }
} }
@ -1688,6 +1690,14 @@ public class FindWindow extends Window implements EventListener,ValueChangeListe
public boolean isCancel() { public boolean isCancel() {
return m_isCancel; return m_isCancel;
} }
/**
* @return true if user press the new button
*/
public boolean isCreateNew() {
return m_createNew;
}
@Override @Override
public boolean setVisible(boolean visible) { public boolean setVisible(boolean visible) {
boolean ret = super.setVisible(visible); boolean ret = super.setVisible(visible);