- Implemented autoNew
- Pending user preference page, would have to use the Preference window for now ( not user friendly but work )
This commit is contained in:
Heng Sin Low 2009-05-19 07:16:22 +00:00
parent 372304bb7f
commit 88abc8db4d
3 changed files with 19 additions and 0 deletions

View File

@ -163,9 +163,14 @@ public class AdempiereWebUI extends Window implements EventListener, IWebClient
Env.setContext(ctx, "#ShowAcct", true);
Env.setContext(ctx, "#ShowAdvanced", true);
//auto commit user preference
String autoCommit = userPreference.getProperty(UserPreference.P_AUTO_COMMIT);
Env.setAutoCommit(ctx, "true".equalsIgnoreCase(autoCommit) || "y".equalsIgnoreCase(autoCommit));
//auto new user preference
String autoNew = userPreference.getProperty(UserPreference.P_AUTO_NEW);
Env.setAutoNew(ctx, "true".equalsIgnoreCase(autoNew) || "y".equalsIgnoreCase(autoNew));
IDesktop d = (IDesktop) currSess.getAttribute("application.desktop");
if (d != null && d instanceof IDesktop)
{

View File

@ -71,6 +71,7 @@ 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;
@ -836,6 +837,13 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
{
((ADSortTab)curTabpanel).registerAPanel(this);
}
else
{
if (curTab.getRowCount() == 0 && Env.isAutoNew(ctx, getWindowNo()))
{
onNew();
}
}
updateToolbar();

View File

@ -67,6 +67,10 @@ public final class UserPreference implements Serializable {
public static final String P_WINDOW_TAB_COLLAPSIBLE = "WindowTabCollapsible";
public static final String DEFAULT_WINDOW_TAB_COLLAPSIBLE = "N";
/** Auto New **/
public static final String P_AUTO_NEW = "AutoNew";
public static final String DEFAULT_AUTO_NEW = "Y";
/** Ini Properties */
private static final String[] PROPERTIES = new String[] {
P_LANGUAGE,
@ -75,6 +79,7 @@ public final class UserPreference implements Serializable {
P_ORG,
P_WAREHOUSE,
P_AUTO_COMMIT,
P_AUTO_NEW,
P_WINDOW_TAB_PLACEMENT,
P_WINDOW_TAB_COLLAPSIBLE};
/** Ini Property Values */
@ -85,6 +90,7 @@ public final class UserPreference implements Serializable {
DEFAULT_ORG,
DEFAULT_WAREHOUSE,
DEFAULT_AUTO_COMMIT,
DEFAULT_AUTO_NEW,
DEFAULT_WINDOW_TAB_PLACEMENT,
DEFAULT_WINDOW_TAB_COLLAPSIBLE};