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.Msg;
import org.compiere.util.WebDoc;
import org.jpedal.parser.Cmd;
import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.Executions;
import org.zkoss.zk.ui.HtmlBasedComponent;
@ -146,6 +145,8 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
private IADTabpanel embeddedTabPanel;
private boolean m_findCreateNew;
/**
* Constructor for non-embedded mode
* @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)
{
m_findCancelled = false;
m_findCreateNew = false;
GridField[] findFields = mTab.getFields();
FindWindow find = new FindWindow(curWindowNo,
mTab.getName(), mTab.getAD_Table_ID(), mTab.getTableName(),
@ -468,7 +477,10 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
find.setVisible(true);
AEnv.showWindow(find);
if (!find.isCancel())
{
query = find.getQuery();
m_findCreateNew = find.isCreateNew();
}
else
m_findCancelled = true;
find = null;

View File

@ -92,7 +92,7 @@ import org.zkoss.zul.Vbox;
public class FindWindow extends Window implements EventListener,ValueChangeListener
{
/**
*
*
*/
private static final long serialVersionUID = 7893948607004510173L;
/** Main Window for the Lookup Panel */
@ -159,6 +159,7 @@ public class FindWindow extends Window implements EventListener,ValueChangeListe
private Row pnlDescription;
private Row pnlValue;
private Row pnlName;
private boolean m_createNew = false;
/** 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_total = 0;
m_createNew = true;
dispose();
}
}
@ -1688,6 +1690,14 @@ public class FindWindow extends Window implements EventListener,ValueChangeListe
public boolean isCancel() {
return m_isCancel;
}
/**
* @return true if user press the new button
*/
public boolean isCreateNew() {
return m_createNew;
}
@Override
public boolean setVisible(boolean visible) {
boolean ret = super.setVisible(visible);