* Bug: save error prompt twice

* Fixed custom messagebox compatibility with 3.5.1
This commit is contained in:
Heng Sin Low 2008-10-10 07:57:31 +00:00
parent 67e4671e36
commit faef3f0217
4 changed files with 39 additions and 9 deletions

View File

@ -31,6 +31,7 @@ import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Enumeration;
import java.util.List;
import java.util.Properties;
import java.util.logging.Level;
import javax.servlet.ServletRequest;
@ -783,4 +784,31 @@ public final class AEnv
}
document.close();
}
/**
* Get window title
* @param ctx context
* @param WindowNo window
* @return Header String
*/
public static String getWindowHeader(Properties ctx, int WindowNo)
{
StringBuffer sb = new StringBuffer();
if (WindowNo > 0){
sb.append(Env.getContext(ctx, WindowNo, "WindowName", false)).append(" ");
final String documentNo = Env.getContext(ctx, WindowNo, "DocumentNo", false);
final String value = Env.getContext(ctx, WindowNo, "Value", false);
final String name = Env.getContext(ctx, WindowNo, "Name", false);
if(!"".equals(documentNo)) {
sb.append(documentNo).append(" ");
}
if(!"".equals(value)) {
sb.append(value).append(" ");
}
if(!"".equals(name)) {
sb.append(name).append(" ");
}
}
return sb.toString();
} // getHeader
} // AEnv

View File

@ -78,16 +78,16 @@ public class Messagebox extends Window implements EventListener
public static final int IGNORE = 0x0400;
/** A symbol consisting of a question mark in a circle. */
public static final String QUESTION = "~./zul/img/question.gif";
public static final String QUESTION = "~./zul/img/msgbox/question.gif";
/** A symbol consisting of an exclamation point in a triangle with a yellow background. */
public static final String EXCLAMATION = "~./zul/img/exclamation.gif";
public static final String EXCLAMATION = "~./zul/img/msgbox/exclamation.gif";
/** A symbol of a lowercase letter i in a circle. */
public static final String INFORMATION = "~./zul/img/information.gif";
public static final String INFORMATION = "~./zul/img/msgbox/information.gif";
/** A symbol consisting of a white X in a circle with a red background. */
public static final String ERROR = "~./zul/img/error.gif";
public static final String ERROR = "~./zul/img/msgbox/error.gif";
/** Contains no symbols. */
public static final String NONE = null;
@ -169,7 +169,7 @@ public class Messagebox extends Window implements EventListener
this.setWidth("100%");
this.setBorder("normal");
this.setContentStyle("background-color:#c0d1d2");
this.setContentStyle("background-color:#ffffff");
this.setPosition("left, top");
Separator blank = new Separator();

View File

@ -926,7 +926,8 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
if (!retValue)
{
FDialog.error(curWindowNo, parent, "SaveIgnored");
//actual error will prompt in the dataStatusChanged event
// FDialog.error(curWindowNo, parent, "SaveIgnored");
statusBar.setStatusLine(Msg.getMsg(Env.getCtx(), "SaveIgnored"), true);
}
curTabpanel.dynamicDisplay(0);

View File

@ -26,6 +26,7 @@ import org.compiere.util.Msg;
import org.compiere.util.Trace;
import org.zkoss.zk.ui.Component;
import org.adempiere.webui.apps.AEnv;
import org.adempiere.webui.component.Messagebox;
/**
@ -132,7 +133,7 @@ public class FDialog
if (title == null)
{
newTitle = windowNo > 0 ? Env.getHeader(ctx, windowNo) : null;
newTitle = windowNo > 0 ? AEnv.getWindowHeader(ctx, windowNo) : null;
}
else
{
@ -241,7 +242,7 @@ public class FDialog
try
{
String s = out.toString().replace("\n", "<br>");
Messagebox.showDialog(s, (windowNo > 0 ? Env.getHeader(ctx, windowNo) : null), Messagebox.OK, Messagebox.ERROR);
Messagebox.showDialog(s, (windowNo > 0 ? AEnv.getWindowHeader(ctx, windowNo) : null), Messagebox.OK, Messagebox.ERROR);
}
catch (InterruptedException exception)
{
@ -348,7 +349,7 @@ public class FDialog
try
{
String s = out.toString().replace("\n", "<br>");
Messagebox.showDialog(s, Env.getHeader(ctx, windowNo), Messagebox.OK, Messagebox.INFORMATION);
Messagebox.showDialog(s, AEnv.getWindowHeader(ctx, windowNo), Messagebox.OK, Messagebox.INFORMATION);
}
catch (InterruptedException exception)
{