IDEMPIERE-370 - Removed link shown when there is no table and record id, Also fixed shrinking of messages

This commit is contained in:
Deepak Pansheriya 2012-10-11 14:21:00 +05:30
parent dba1c54c91
commit e41477ec3a
2 changed files with 119 additions and 70 deletions

View File

@ -42,6 +42,7 @@ import org.compiere.util.Env;
import org.compiere.util.Msg; import org.compiere.util.Msg;
import org.zkoss.zhtml.Table; import org.zkoss.zhtml.Table;
import org.zkoss.zhtml.Td; import org.zkoss.zhtml.Td;
import org.zkoss.zhtml.Text;
import org.zkoss.zhtml.Tr; import org.zkoss.zhtml.Tr;
import org.zkoss.zk.au.out.AuEcho; import org.zkoss.zk.au.out.AuEcho;
import org.zkoss.zk.ui.Component; import org.zkoss.zk.ui.Component;
@ -466,9 +467,10 @@ public class ProcessDialog extends Window implements EventListener<Event>, IProc
private void appendRecordLogInfo(ProcessInfoLog[] m_logs) { private void appendRecordLogInfo(ProcessInfoLog[] m_logs) {
if (m_logs == null) if (m_logs == null)
return ; return;
SimpleDateFormat dateFormat = DisplayType.getDateFormat(DisplayType.Date); SimpleDateFormat dateFormat = DisplayType
.getDateFormat(DisplayType.Date);
logMessageTable = new Table(); logMessageTable = new Table();
logMessageTable.setId("logrecords"); logMessageTable.setId("logrecords");
@ -476,51 +478,73 @@ public class ProcessDialog extends Window implements EventListener<Event>, IProc
logMessageTable.setDynamicProperty("cellpadding", "0"); logMessageTable.setDynamicProperty("cellpadding", "0");
logMessageTable.setDynamicProperty("cellspacing", "0"); logMessageTable.setDynamicProperty("cellspacing", "0");
logMessageTable.setDynamicProperty("width", "100%"); logMessageTable.setDynamicProperty("width", "100%");
this.appendChild(logMessageTable);
for (int i = 0; i < m_logs.length; i++) this.appendChild(logMessageTable);
{
Tr tr = new Tr();
logMessageTable.appendChild(tr);
ProcessInfoLog log = m_logs[i];
if (log.getP_Date() != null){
Label label = new Label(dateFormat.format(log.getP_Date()));
//label.setStyle("padding-right:100px");
Td td = new Td();
td = new Td();
td.appendChild(label);
tr.appendChild(td);
}
if (log.getP_Number() != null){
Label labelPno= new Label(""+log.getP_Number());
Td td = new Td();
td.appendChild(labelPno);
tr.appendChild(td);
}
A recordLink = null;
if (log.getP_Msg() != null){
recordLink = new A();
recordLink.setLabel(log.getP_Msg());
if (log.getAD_Table_ID() > 0 && log.getRecord_ID()> 0) { boolean datePresents = false;
recordLink.setAttribute("Record_ID", String.valueOf(log.getRecord_ID())); boolean numberPresents = false;
recordLink.setAttribute("AD_Table_ID", String.valueOf(log.getAD_Table_ID())); boolean msgPresents = false;
recordLink.addEventListener(Events.ON_CLICK, this);
for (ProcessInfoLog log : m_logs) {
if (log.getP_Date() != null)
datePresents = true;
if (log.getP_Number() != null)
numberPresents = true;
if (log.getP_Msg() != null)
msgPresents = true;
}
for (int i = 0; i < m_logs.length; i++) {
Tr tr = new Tr();
logMessageTable.appendChild(tr);
ProcessInfoLog log = m_logs[i];
if (datePresents) {
Td td = new Td();
if (log.getP_Date() != null) {
Label label = new Label(dateFormat.format(log.getP_Date()));
td.appendChild(label);
// label.setStyle("padding-right:100px");
} }
tr.appendChild(td);
}
if (numberPresents) {
Td td = new Td(); Td td = new Td();
td.appendChild(recordLink); if (log.getP_Number() != null) {
tr.appendChild(td); Label labelPno = new Label("" + log.getP_Number());
td.appendChild(labelPno);
}
tr.appendChild(td);
}
if (msgPresents) {
Td td = new Td();
if (log.getP_Msg() != null) {
if (log.getAD_Table_ID() > 0 && log.getRecord_ID() > 0) {
A recordLink = new A();
recordLink.setLabel(log.getP_Msg());
recordLink.setAttribute("Record_ID",
String.valueOf(log.getRecord_ID()));
recordLink.setAttribute("AD_Table_ID",
String.valueOf(log.getAD_Table_ID()));
recordLink.addEventListener(Events.ON_CLICK, this);
td.appendChild(recordLink);
} else {
Text t = new Text();
t.setEncode(false);
t.setValue(log.getP_Msg());
td.appendChild(t);
}
}
tr.appendChild(td);
} }
} }
messageDiv.appendChild(logMessageTable); messageDiv.appendChild(logMessageTable);
} }
private void restart() { private void restart() {

View File

@ -58,6 +58,7 @@ import org.compiere.util.Env;
import org.compiere.util.Msg; import org.compiere.util.Msg;
import org.zkoss.zhtml.Table; import org.zkoss.zhtml.Table;
import org.zkoss.zhtml.Td; import org.zkoss.zhtml.Td;
import org.zkoss.zhtml.Text;
import org.zkoss.zhtml.Tr; import org.zkoss.zhtml.Tr;
import org.zkoss.zk.au.out.AuEcho; import org.zkoss.zk.au.out.AuEcho;
import org.zkoss.zk.ui.event.Event; import org.zkoss.zk.ui.event.Event;
@ -484,6 +485,20 @@ public class WGenForm extends ADForm implements EventListener, WTableModelListen
this.appendChild(logMessageTable); this.appendChild(logMessageTable);
boolean datePresents = false;
boolean numberPresents = false;
boolean msgPresents = false;
for (ProcessInfoLog log : m_logs) {
if (log.getP_Date() != null)
datePresents = true;
if (log.getP_Number() != null)
numberPresents = true;
if (log.getP_Msg() != null)
msgPresents = true;
}
for (int i = 0; i < m_logs.length; i++) for (int i = 0; i < m_logs.length; i++)
{ {
@ -492,37 +507,47 @@ public class WGenForm extends ADForm implements EventListener, WTableModelListen
ProcessInfoLog log = m_logs[i]; ProcessInfoLog log = m_logs[i];
if (log.getP_Date() != null){ if (datePresents) {
Label label = new Label(dateFormat.format(log.getP_Date()));
//label.setStyle("padding-right:100px");
Td td = new Td(); Td td = new Td();
td = new Td(); if (log.getP_Date() != null) {
td.appendChild(label); Label label = new Label(dateFormat.format(log.getP_Date()));
tr.appendChild(td); td.appendChild(label);
// label.setStyle("padding-right:100px");
}
if (log.getP_Number() != null){
Label labelPno= new Label(""+log.getP_Number());
Td td = new Td();
td.appendChild(labelPno);
tr.appendChild(td);
}
A recordLink = null;
if (log.getP_Msg() != null){
recordLink = new A();
recordLink.setLabel(log.getP_Msg());
if (log.getAD_Table_ID() > 0 && log.getRecord_ID()> 0) {
recordLink.setAttribute("Record_ID", String.valueOf(log.getRecord_ID()));
recordLink.setAttribute("AD_Table_ID", String.valueOf(log.getAD_Table_ID()));
recordLink.addEventListener(Events.ON_CLICK, this);
} }
tr.appendChild(td);
}
if (numberPresents) {
Td td = new Td(); Td td = new Td();
td.appendChild(recordLink); if (log.getP_Number() != null) {
tr.appendChild(td); Label labelPno = new Label("" + log.getP_Number());
td.appendChild(labelPno);
}
tr.appendChild(td);
}
if (msgPresents) {
Td td = new Td();
if (log.getP_Msg() != null) {
if (log.getAD_Table_ID() > 0 && log.getRecord_ID() > 0) {
A recordLink = new A();
recordLink.setLabel(log.getP_Msg());
recordLink.setAttribute("Record_ID",
String.valueOf(log.getRecord_ID()));
recordLink.setAttribute("AD_Table_ID",
String.valueOf(log.getAD_Table_ID()));
recordLink.addEventListener(Events.ON_CLICK, this);
td.appendChild(recordLink);
} else {
Text t = new Text();
t.setEncode(false);
t.setValue(log.getP_Msg());
td.appendChild(t);
}
}
tr.appendChild(td);
} }
} }
messageDiv.appendChild(logMessageTable); messageDiv.appendChild(logMessageTable);