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 r runnable object
* @throws RuntimeException or {@link AdempiereException}
*/
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.WPayment;
import org.adempiere.webui.component.Listbox;
import org.adempiere.webui.component.ToolBarButton;
import org.adempiere.webui.component.Window;
import org.adempiere.webui.editor.IProcessButton;
import org.adempiere.webui.editor.WButtonEditor;
@ -107,6 +106,7 @@ import org.zkoss.zul.Hbox;
import org.zkoss.zul.Listitem;
import org.zkoss.zul.Menuitem;
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();
onModalClose(dialog.getProcessInfo());
String s = breadCrumb.getStatusLine();
onRefresh(true, false);
breadCrumb.setStatusLine(s);
}
else if (ADTabpanel.ON_DYNAMIC_DISPLAY_EVENT.equals(event.getName()))
{
@ -1617,7 +1619,7 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
@Override
public void onCallback(Boolean result) {
onRefresh(false, false);
onRefresh(true, false);
}
});
@ -2273,7 +2275,7 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
@Override
public void onCallback(Boolean result) {
onRefresh(false, false);
onRefresh(true, false);
}
});
@ -2331,7 +2333,7 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
@Override
public void onEvent(Event event) throws Exception {
if (!window.isCancel()) {
adtabPanel.getGridTab().dataRefresh();
onRefresh(true, false);
}
}
});
@ -2403,7 +2405,7 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
if (error != null)
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));
ADForm form = ADForm.openForm(adFormID);
form.setProcessInfo(pi);
Mode mode = form.getWindowMode();
form.setAttribute(Window.MODE_KEY, form.getWindowMode());
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);
onRefresh(false, false);
}
else
{
@ -2487,7 +2497,7 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
}
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.EventListener;
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.Vlayout;
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));
upcLabel.setText(Msg.getElement(Env.getCtx(), "UPC", false));
Borderlayout parameterLayout = new Borderlayout();
parameterLayout.setHeight("110px");
parameterLayout.setWidth("100%");
Vlayout vlayout = new Vlayout();
vlayout.setVflex("1");
vlayout.setWidth("100%");
Panel parameterPanel = window.getParameterPanel();
parameterPanel.appendChild(parameterLayout);
parameterPanel.appendChild(vlayout);
Grid parameterStdLayout = GridFactory.newGridLayout();
Panel parameterStdPanel = new Panel();
parameterStdPanel.appendChild(parameterStdLayout);
Center center = new Center();
parameterLayout.appendChild(center);
center.appendChild(parameterStdPanel);
vlayout.appendChild(parameterStdLayout);
parameterStdPanel.appendChild(parameterStdLayout);
Rows rows = (Rows) parameterStdLayout.newRows();
Row row = rows.newRow();
row.appendChild(bPartnerLabel.rightAlign());
if (bPartnerField != null)
if (bPartnerField != null) {
row.appendChild(bPartnerField.getComponent());
bPartnerField.fillHorizontal();
}
if (! isRMAWindow) {
row.appendChild(orderLabel.rightAlign());
row.appendChild(orderField);
orderField.setHflex("1");
}
row = rows.newRow();
@ -182,7 +178,8 @@ public class WCreateFromShipmentUI extends CreateFromShipment implements EventLi
row.appendChild(locatorField.getComponent());
if (! isRMAWindow) {
row.appendChild(invoiceLabel.rightAlign());
row.appendChild(invoiceField);
row.appendChild(invoiceField);
invoiceField.setHflex("1");
}
row = rows.newRow();
@ -196,6 +193,7 @@ public class WCreateFromShipmentUI extends CreateFromShipment implements EventLi
// Add RMA document selection to panel
row.appendChild(rmaLabel.rightAlign());
row.appendChild(rmaField);
rmaField.setHflex("1");
}
}

View File

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

View File

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