Exemple #1
0
 /**
  * *** Constructor ***
  *
  * @param m_ctx
  * @param m_TabParam
  * @param m_TabInfo
  * @author Yamel Senih, [email protected], ERPCyA http://www.erpcya.com 19/05/2014, 11:47:36
  */
 public GridTab(Context m_ctx, TabParameter m_TabParam, InfoTab m_TabInfo, DB conn) {
   this.m_ctx = m_ctx;
   this.m_TabParam = m_TabParam;
   this.m_TabInfo = m_TabInfo;
   this.conn = conn;
   m_fields = new ArrayList<GridField>();
   //	Set Identifiers
   m_Record_ID = Env.getTabRecord_ID(m_TabParam.getActivityNo(), m_TabParam.getTabNo());
   m_KeyColums = Env.getTabKeyColumns(m_TabParam.getActivityNo(), m_TabParam.getTabNo());
   //	Parent
   int[] parent = Env.getTabRecord_ID(m_TabParam.getActivityNo(), m_TabParam.getParentTabNo());
   m_Parent_Record_ID = parent[0];
   loadPO();
 }
Exemple #2
0
 /**
  * valid and save data
  *
  * @author Yamel Senih, [email protected], ERPCyA http://www.erpcya.com 25/02/2014, 14:07:20
  * @see https://adempiere.atlassian.net/browse/SPIN-5
  * @return
  * @return boolean
  */
 public boolean save() {
   boolean ok = true;
   m_Record_ID = Env.getTabRecord_ID(m_TabParam.getActivityNo(), m_TabParam.getTabNo());
   m_KeyColums = Env.getTabKeyColumns(m_TabParam.getActivityNo(), m_TabParam.getTabNo());
   //	Error
   if (model == null) {
     m_ErrorMsg = "@NoModelClass@";
     return false;
   }
   //	Get Values
   for (GridField vField : m_fields) {
     if ((vField.isMandatory() || vField.isParent())
         && vField.isEmpty()
         && !PO.isSkipColumn(vField.getColumnName())) {
       m_ErrorMsg = "@MustFillField@ \"@" + vField.getName() + "@\"";
       //	Set ok to false
       ok = false;
       break;
     }
     //	Changed
     if (!vField.isChanged(model.isNew()) && !(vField instanceof VLookupSpinner)) continue;
     //	Set to model
     model.set_Value(vField.getColumnName(), vField.getValue());
     //	Set on Context
     DisplayType.setContextValue(
         m_ctx,
         m_TabParam.getActivityNo(),
         m_TabParam.getTabNo(),
         vField.getField(),
         vField.getValue());
     //
   }
   //	Set Record Identifier
   model.set_Value(m_TabInfo.getTableKeyName(), m_Record_ID[0]);
   //	No saved
   if (!ok) return ok;
   //	Save
   ok = modelSave();
   //	Return
   return ok;
 }
Exemple #3
0
 /**
  * Refresh
  *
  * @author Yamel Senih, [email protected], ERPCyA http://www.erpcya.com 18/10/2014, 13:36:09
  * @param record_ID
  * @param keyColumn
  * @param parentChanged
  * @return
  * @return boolean
  */
 public boolean refresh(int[] record_ID, String[] keyColumn, boolean parentChanged) {
   this.m_Record_ID = record_ID;
   //	Set record Identifier in context
   Env.setTabRecord_ID(m_TabParam.getActivityNo(), m_TabParam.getTabNo(), m_Record_ID);
   Env.setTabKeyColumns(m_TabParam.getActivityNo(), m_TabParam.getTabNo(), m_KeyColums);
   //	Parent changed
   if (parentChanged || record_ID[0] <= 0) model.clear(false);
   //
   model.loadData(record_ID, keyColumn);
   //	Refresh
   loadData();
   //	Set Identifier
   Env.setContext(
       m_TabParam.getActivityNo(),
       m_TabParam.getTabNo(),
       m_TabInfo.getTableKeyName(),
       model.getID());
   //	Set Parent Record Identifier
   int[] parent = Env.getTabRecord_ID(m_TabParam.getActivityNo(), m_TabParam.getParentTabNo());
   m_Parent_Record_ID = parent[0];
   //	Return
   return !isEmpty();
 }