IDEMPIERE-493 Add validation for matching. Fixed layout and refresh issue.

This commit is contained in:
Heng Sin Low 2012-11-08 13:26:30 +08:00
parent 59edefdd6b
commit 3d865703f1
5 changed files with 35 additions and 30 deletions

View File

@ -536,6 +536,7 @@ public class Trx implements VetoableChangeListener
* *
* @param trxName transaction name (if null, a new transaction will be created) * @param trxName transaction name (if null, a new transaction will be created)
* @param r runnable object * @param r runnable object
* @throws RuntimeException or {@link AdempiereException}
*/ */
public static void run(String trxName, TrxRunnable r) public static void run(String trxName, TrxRunnable r)
{ {

View File

@ -45,7 +45,6 @@ import org.adempiere.webui.apps.form.WCreateFromFactory;
import org.adempiere.webui.apps.form.WCreateFromWindow; import org.adempiere.webui.apps.form.WCreateFromWindow;
import org.adempiere.webui.apps.form.WPayment; import org.adempiere.webui.apps.form.WPayment;
import org.adempiere.webui.component.Listbox; import org.adempiere.webui.component.Listbox;
import org.adempiere.webui.component.ToolBarButton;
import org.adempiere.webui.component.Window; import org.adempiere.webui.component.Window;
import org.adempiere.webui.editor.IProcessButton; import org.adempiere.webui.editor.IProcessButton;
import org.adempiere.webui.editor.WButtonEditor; import org.adempiere.webui.editor.WButtonEditor;
@ -107,6 +106,7 @@ import org.zkoss.zul.Hbox;
import org.zkoss.zul.Listitem; import org.zkoss.zul.Listitem;
import org.zkoss.zul.Menuitem; import org.zkoss.zul.Menuitem;
import org.zkoss.zul.Menupopup; import org.zkoss.zul.Menupopup;
import org.zkoss.zul.Window.Mode;
/** /**
* *
@ -948,7 +948,9 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
{ {
ProcessModalDialog dialog = (ProcessModalDialog) event.getTarget(); ProcessModalDialog dialog = (ProcessModalDialog) event.getTarget();
onModalClose(dialog.getProcessInfo()); onModalClose(dialog.getProcessInfo());
String s = breadCrumb.getStatusLine();
onRefresh(true, false); onRefresh(true, false);
breadCrumb.setStatusLine(s);
} }
else if (ADTabpanel.ON_DYNAMIC_DISPLAY_EVENT.equals(event.getName())) else if (ADTabpanel.ON_DYNAMIC_DISPLAY_EVENT.equals(event.getName()))
{ {
@ -1617,7 +1619,7 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
@Override @Override
public void onCallback(Boolean result) { public void onCallback(Boolean result) {
onRefresh(false, false); onRefresh(true, false);
} }
}); });
@ -2273,7 +2275,7 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
@Override @Override
public void onCallback(Boolean result) { public void onCallback(Boolean result) {
onRefresh(false, false); onRefresh(true, false);
} }
}); });
@ -2331,7 +2333,7 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
@Override @Override
public void onEvent(Event event) throws Exception { public void onEvent(Event event) throws Exception {
if (!window.isCancel()) { if (!window.isCancel()) {
adtabPanel.getGridTab().dataRefresh(); onRefresh(true, false);
} }
} }
}); });
@ -2403,7 +2405,7 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
if (error != null) if (error != null)
breadCrumb.setStatusLine(error, true); breadCrumb.setStatusLine(error, true);
onRefresh(false, false); onRefresh(true, false);
} }
} }
}); });
@ -2468,10 +2470,18 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
pi.setAD_Client_ID (Env.getAD_Client_ID(ctx)); pi.setAD_Client_ID (Env.getAD_Client_ID(ctx));
ADForm form = ADForm.openForm(adFormID); ADForm form = ADForm.openForm(adFormID);
form.setProcessInfo(pi); form.setProcessInfo(pi);
Mode mode = form.getWindowMode();
form.setAttribute(Window.MODE_KEY, form.getWindowMode()); form.setAttribute(Window.MODE_KEY, form.getWindowMode());
form.setAttribute(Window.INSERT_POSITION_KEY, Window.INSERT_NEXT); form.setAttribute(Window.INSERT_POSITION_KEY, Window.INSERT_NEXT);
if (mode == Mode.HIGHLIGHTED || mode == Mode.MODAL) {
form.addEventListener(DialogEvents.ON_WINDOW_CLOSE, new EventListener<Event>() {
@Override
public void onEvent(Event event) throws Exception {
onRefresh(true, false);
}
});
}
SessionManager.getAppDesktop().showWindow(form); SessionManager.getAppDesktop().showWindow(form);
onRefresh(false, false);
} }
else else
{ {
@ -2487,7 +2497,7 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
} }
else else
{ {
onRefresh(false, false); onRefresh(true, false);
} }
} }
} }

View File

@ -52,9 +52,8 @@ import org.compiere.util.Msg;
import org.zkoss.zk.ui.event.Event; import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.event.EventListener; import org.zkoss.zk.ui.event.EventListener;
import org.zkoss.zk.ui.event.Events; import org.zkoss.zk.ui.event.Events;
import org.zkoss.zul.Borderlayout;
import org.zkoss.zul.Center;
import org.zkoss.zul.Space; import org.zkoss.zul.Space;
import org.zkoss.zul.Vlayout;
public class WCreateFromShipmentUI extends CreateFromShipment implements EventListener<Event>, ValueChangeListener public class WCreateFromShipmentUI extends CreateFromShipment implements EventListener<Event>, ValueChangeListener
{ {
@ -152,29 +151,26 @@ public class WCreateFromShipmentUI extends CreateFromShipment implements EventLi
sameWarehouseCb.setTooltiptext(Msg.getMsg(Env.getCtx(), "FromSameWarehouseOnly", false)); sameWarehouseCb.setTooltiptext(Msg.getMsg(Env.getCtx(), "FromSameWarehouseOnly", false));
upcLabel.setText(Msg.getElement(Env.getCtx(), "UPC", false)); upcLabel.setText(Msg.getElement(Env.getCtx(), "UPC", false));
Borderlayout parameterLayout = new Borderlayout(); Vlayout vlayout = new Vlayout();
parameterLayout.setHeight("110px"); vlayout.setVflex("1");
parameterLayout.setWidth("100%"); vlayout.setWidth("100%");
Panel parameterPanel = window.getParameterPanel(); Panel parameterPanel = window.getParameterPanel();
parameterPanel.appendChild(parameterLayout); parameterPanel.appendChild(vlayout);
Grid parameterStdLayout = GridFactory.newGridLayout(); Grid parameterStdLayout = GridFactory.newGridLayout();
Panel parameterStdPanel = new Panel(); vlayout.appendChild(parameterStdLayout);
parameterStdPanel.appendChild(parameterStdLayout);
Center center = new Center();
parameterLayout.appendChild(center);
center.appendChild(parameterStdPanel);
parameterStdPanel.appendChild(parameterStdLayout);
Rows rows = (Rows) parameterStdLayout.newRows(); Rows rows = (Rows) parameterStdLayout.newRows();
Row row = rows.newRow(); Row row = rows.newRow();
row.appendChild(bPartnerLabel.rightAlign()); row.appendChild(bPartnerLabel.rightAlign());
if (bPartnerField != null) if (bPartnerField != null) {
row.appendChild(bPartnerField.getComponent()); row.appendChild(bPartnerField.getComponent());
bPartnerField.fillHorizontal();
}
if (! isRMAWindow) { if (! isRMAWindow) {
row.appendChild(orderLabel.rightAlign()); row.appendChild(orderLabel.rightAlign());
row.appendChild(orderField); row.appendChild(orderField);
orderField.setHflex("1");
} }
row = rows.newRow(); row = rows.newRow();
@ -182,7 +178,8 @@ public class WCreateFromShipmentUI extends CreateFromShipment implements EventLi
row.appendChild(locatorField.getComponent()); row.appendChild(locatorField.getComponent());
if (! isRMAWindow) { if (! isRMAWindow) {
row.appendChild(invoiceLabel.rightAlign()); row.appendChild(invoiceLabel.rightAlign());
row.appendChild(invoiceField); row.appendChild(invoiceField);
invoiceField.setHflex("1");
} }
row = rows.newRow(); row = rows.newRow();
@ -196,6 +193,7 @@ public class WCreateFromShipmentUI extends CreateFromShipment implements EventLi
// Add RMA document selection to panel // Add RMA document selection to panel
row.appendChild(rmaLabel.rightAlign()); row.appendChild(rmaLabel.rightAlign());
row.appendChild(rmaField); row.appendChild(rmaField);
rmaField.setHflex("1");
} }
} }

View File

@ -31,7 +31,6 @@ import org.compiere.util.Trx;
import org.compiere.util.TrxRunnable; import org.compiere.util.TrxRunnable;
import org.zkoss.zk.ui.event.Event; import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.event.EventListener; import org.zkoss.zk.ui.event.EventListener;
import org.zkoss.zk.ui.event.Events;
import org.zkoss.zul.Borderlayout; import org.zkoss.zul.Borderlayout;
import org.zkoss.zul.Center; import org.zkoss.zul.Center;
import org.zkoss.zul.North; import org.zkoss.zul.North;
@ -125,12 +124,10 @@ public class WCreateFromWindow extends Window implements EventListener<Event>, W
{ {
public void run(String trxName) public void run(String trxName)
{ {
if (save(trxName)) save(trxName);
{
dispose();
}
} }
}); });
dispose();
} }
catch (Exception ex) catch (Exception ex)
{ {

View File

@ -659,10 +659,9 @@ public abstract class CreateFromShipment extends CreateFrom
} }
// Set locator // Set locator
iol.setM_Locator_ID(M_Locator_ID); iol.setM_Locator_ID(M_Locator_ID);
if (!iol.save()) iol.saveEx();
log.log(Level.SEVERE, "Line NOT created #" + i);
// Create Invoice Line Link // Create Invoice Line Link
else if (il != null) if (il != null)
{ {
il.setM_InOutLine_ID(iol.getM_InOutLine_ID()); il.setM_InOutLine_ID(iol.getM_InOutLine_ID());
il.saveEx(); il.saveEx();