Message box enhancement:
* Follow standard UI convention - icon on the left, message on the right and button at bottom. * Set max-height and overflow:auto for the message content to make the messagebox usable even for very long message content. * Use shorter title text Link to SF Tracker: http://sourceforge.net/support/tracker.php?aid=2979504
This commit is contained in:
parent
ba938efa6b
commit
37f28623cc
|
@ -38,12 +38,12 @@ import javax.servlet.ServletRequest;
|
|||
|
||||
import org.adempiere.webui.component.Window;
|
||||
import org.adempiere.webui.session.SessionManager;
|
||||
import org.adempiere.webui.theme.ThemeManager;
|
||||
import org.compiere.acct.Doc;
|
||||
import org.compiere.model.GridWindowVO;
|
||||
import org.compiere.model.Lookup;
|
||||
import org.compiere.model.MAcctSchema;
|
||||
import org.compiere.model.MQuery;
|
||||
import org.compiere.process.DocumentEngine;
|
||||
import org.compiere.util.CCache;
|
||||
import org.compiere.util.CLogger;
|
||||
import org.compiere.util.CacheMgt;
|
||||
|
@ -699,4 +699,33 @@ public final class AEnv
|
|||
|
||||
return locale;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get title for dialog window
|
||||
* @param ctx
|
||||
* @param windowNo
|
||||
* @return dialog header
|
||||
*/
|
||||
public static String getDialogHeader(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(" ");
|
||||
}
|
||||
}
|
||||
String header = sb.toString().trim();
|
||||
if (header.length() == 0)
|
||||
header = ThemeManager.getBrowserTitle();
|
||||
return header;
|
||||
}
|
||||
} // AEnv
|
||||
|
|
|
@ -42,13 +42,13 @@ import org.zkoss.zul.Separator;
|
|||
public class Messagebox extends Window implements EventListener
|
||||
{
|
||||
/**
|
||||
*
|
||||
* generated serial version ID
|
||||
*/
|
||||
private static final long serialVersionUID = -4957498533838144942L;
|
||||
private static final String MESSAGE_PANEL_STYLE = "text-align:left; word-break: break-all; overflow: auto; max-height: 350pt; min-width: 230pt; max-width: 450pt;";
|
||||
private String msg = new String("");
|
||||
private String imgSrc = new String("");
|
||||
|
||||
// private Label lblMsg = new Label();
|
||||
private Text lblMsg = new Text();
|
||||
|
||||
private Button btnOk = new Button();
|
||||
|
@ -130,12 +130,10 @@ public class Messagebox extends Window implements EventListener
|
|||
LayoutUtils.addSclass("action-text-button", btnNo);
|
||||
|
||||
btnAbort.setLabel("Abort");
|
||||
//btnAbort.setImage("/images/");
|
||||
btnAbort.addEventListener(Events.ON_CLICK, this);
|
||||
LayoutUtils.addSclass("action-text-button", btnAbort);
|
||||
|
||||
btnRetry.setLabel("Retry");
|
||||
//btnRetry.setImage("/images/");
|
||||
btnRetry.addEventListener(Events.ON_CLICK, this);
|
||||
LayoutUtils.addSclass("action-text-button", btnRetry);
|
||||
|
||||
|
@ -145,28 +143,29 @@ public class Messagebox extends Window implements EventListener
|
|||
LayoutUtils.addSclass("action-text-button", btnIgnore);
|
||||
|
||||
Panel pnlMessage = new Panel();
|
||||
pnlMessage.setWidth("100%");
|
||||
pnlMessage.setStyle("text-align:left");
|
||||
pnlMessage.setStyle(MESSAGE_PANEL_STYLE);
|
||||
pnlMessage.appendChild(lblMsg);
|
||||
|
||||
Panel pnlImage = new Panel();
|
||||
|
||||
Hbox pnlImage = new Hbox();
|
||||
|
||||
img.setSrc(imgSrc);
|
||||
|
||||
pnlImage.setWidth("100%");
|
||||
pnlImage.setStyle("text-align:center");
|
||||
pnlImage.setWidth("72px");
|
||||
pnlImage.setAlign("center");
|
||||
pnlImage.setPack("center");
|
||||
pnlImage.appendChild(img);
|
||||
|
||||
Hbox hbox = new Hbox();
|
||||
hbox.setWidth("100%");
|
||||
hbox.setWidths("10%, 90%");
|
||||
|
||||
hbox.appendChild(pnlImage);
|
||||
hbox.appendChild(pnlMessage);
|
||||
|
||||
Hbox north = new Hbox();
|
||||
north.setAlign("center");
|
||||
north.setStyle("margin: 20pt 10pt 20pt 10pt;"); //trbl
|
||||
this.appendChild(north);
|
||||
north.appendChild(pnlImage);
|
||||
north.appendChild(pnlMessage);
|
||||
|
||||
Hbox pnlButtons = new Hbox();
|
||||
pnlButtons.setWidth("100%");
|
||||
pnlButtons.setStyle("text-align:center");
|
||||
pnlButtons.setHeight("52px");
|
||||
pnlButtons.setAlign("center");
|
||||
pnlButtons.setPack("end");
|
||||
pnlButtons.appendChild(btnOk);
|
||||
pnlButtons.appendChild(btnCancel);
|
||||
pnlButtons.appendChild(btnYes);
|
||||
|
@ -175,19 +174,20 @@ public class Messagebox extends Window implements EventListener
|
|||
pnlButtons.appendChild(btnRetry);
|
||||
pnlButtons.appendChild(btnIgnore);
|
||||
|
||||
this.setWidth("100%");
|
||||
Separator separator = new Separator();
|
||||
separator.setWidth("100%");
|
||||
separator.setBar(true);
|
||||
this.appendChild(separator);
|
||||
|
||||
Hbox south = new Hbox();
|
||||
south.setPack("end");
|
||||
south.setWidth("100%");
|
||||
this.appendChild(south);
|
||||
south.appendChild(pnlButtons);
|
||||
|
||||
this.setBorder("normal");
|
||||
this.setContentStyle("background-color:#ffffff");
|
||||
this.setContentStyle("background-color:#ffffff;");
|
||||
this.setPosition("left, top");
|
||||
|
||||
Separator blank = new Separator();
|
||||
blank.setOrient("vertical");
|
||||
blank.setHeight("5px");
|
||||
|
||||
hbox.appendChild(blank);
|
||||
hbox.appendChild(pnlButtons);
|
||||
|
||||
this.appendChild(hbox);
|
||||
}
|
||||
|
||||
public int show(String message, String title, int buttons, String icon)
|
||||
|
@ -227,7 +227,6 @@ public class Messagebox extends Window implements EventListener
|
|||
init();
|
||||
|
||||
this.setTitle(title);
|
||||
this.setWidth("500px");
|
||||
this.setPosition("center");
|
||||
this.setClosable(true);
|
||||
if (Events.inEventListener())
|
||||
|
|
Loading…
Reference in New Issue