Merge with ade8e366cf54154e97af42addf956d38229c553c

This commit is contained in:
Elaine Tan 2012-11-16 18:08:19 +08:00
commit 17aeb199ef
7 changed files with 85 additions and 65 deletions

View File

@ -133,3 +133,6 @@ INSERT INTO AD_ToolBarButton (Action,AD_Tab_ID,SeqNo,AD_Process_ID,AD_ToolBarBut
INSERT INTO AD_ToolBarButton (Action,AD_Tab_ID,SeqNo,AD_Process_ID,AD_ToolBarButton_ID,Updated,IsActive,IsCustomization,Name,AD_Client_ID,AD_ToolBarButton_UU,ComponentName,Created,CreatedBy,UpdatedBy,AD_Org_ID) VALUES ('W',692,10,200016,200072,TO_DATE('2012-11-12 18:37:49','YYYY-MM-DD HH24:MI:SS'),'Y','N','Reverse PO Matching',0,'99e7e98d-a600-4174-9b55-923b790d03ba','ReverseMatchPO',TO_DATE('2012-11-12 18:37:49','YYYY-MM-DD HH24:MI:SS'),100,100,0)
;
SELECT register_migration_script('201211140148_IDEMPIERE-378.sql') FROM dual
;

View File

@ -0,0 +1,8 @@
-- IDEMPIERE-457 - hide tab editor for inactive tabs
UPDATE AD_ToolBarButton SET DisplayLogic='@IsSortTab@=N & @IsActive@=Y ',Updated=TO_DATE('2012-11-07 14:29:45','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_ToolBarButton_ID=200068
;
SELECT register_migration_script('201211141558_IDEMPIERE-457.sql') FROM dual
;

View File

@ -133,3 +133,6 @@ INSERT INTO AD_ToolBarButton ("action",AD_Tab_ID,SeqNo,AD_Process_ID,AD_ToolBarB
INSERT INTO AD_ToolBarButton ("action",AD_Tab_ID,SeqNo,AD_Process_ID,AD_ToolBarButton_ID,Updated,IsActive,IsCustomization,Name,AD_Client_ID,AD_ToolBarButton_UU,ComponentName,Created,CreatedBy,UpdatedBy,AD_Org_ID) VALUES ('W',692,10,200016,200072,TO_TIMESTAMP('2012-11-12 18:37:49','YYYY-MM-DD HH24:MI:SS'),'Y','N','Reverse PO Matching',0,'99e7e98d-a600-4174-9b55-923b790d03ba','ReverseMatchPO',TO_TIMESTAMP('2012-11-12 18:37:49','YYYY-MM-DD HH24:MI:SS'),100,100,0)
;
SELECT register_migration_script('201211140148_IDEMPIERE-378.sql') FROM dual
;

View File

@ -0,0 +1,8 @@
-- IDEMPIERE-457 - hide tab editor for inactive tabs
UPDATE AD_ToolBarButton SET DisplayLogic='@IsSortTab@=N & @IsActive@=Y ',Updated=TO_TIMESTAMP('2012-11-07 14:29:45','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_ToolBarButton_ID=200068
;
SELECT register_migration_script('201211141558_IDEMPIERE-457.sql') FROM dual
;

View File

@ -123,6 +123,8 @@ public class WTabEditor extends TabEditor implements IFormController, EventListe
Vlayout centerVLayout;
Vlayout westVLayout ;
private static final int POSSEQMULTIPLIER = 10000000;
public WTabEditor()
{
tabform = new WTabEditorForm(this);
@ -351,7 +353,7 @@ public class WTabEditor extends TabEditor implements IFormController, EventListe
private void setLastCellProps(Cell lastCell, int actualxpos, int seqNo) {
lastCell.setDroppable("true");
lastCell.addEventListener(Events.ON_DROP, this);
int value = (actualxpos+1) * 10000000 + seqNo;
int value = (actualxpos+1) * POSSEQMULTIPLIER + seqNo;
mapEmptyCellField.put(lastCell, value);
}
@ -547,8 +549,8 @@ public class WTabEditor extends TabEditor implements IFormController, EventListe
MField field = getMField(fieldid);
if (field != null) {
setActiveMField(field);
setBackgroundField(field);
setProperties(field);
setBackgroundField(field);
}
}
}
@ -560,13 +562,14 @@ public class WTabEditor extends TabEditor implements IFormController, EventListe
MField field = getMField(gridField.getAD_Field_ID());
if (field != null) {
setActiveMField(field);
setBackgroundField(field);
setProperties(field);
}
setBackgroundField(field);
// select the field on the visible list and set focus
for (Listitem item : visible.getItems()) {
if (field.getAD_Field_ID() == (Integer) item.getValue()) {
visible.setSelectedItem(item);
break;
}
}
}
}
@ -588,22 +591,17 @@ public class WTabEditor extends TabEditor implements IFormController, EventListe
} else {
field.setColumnSpan(field.getColumnSpan()+mult);
}
setProperties(field);
resortArrays();
setProperties(field); // seqno could change
updateLists(field);
repaintGrid();
if (field != null) {
setActiveMField(field);
setBackgroundField(field);
setProperties(field);
}
// select the field on the visible list and set focus
for (Listitem item : visible.getItems()) {
if (field.getAD_Field_ID() == (Integer) item.getValue()) {
visible.setSelectedItem(item);
break;
}
}
setActiveMField(field);
setProperties(field);
repaintGrid();
setBackgroundField(field);
}
}
@ -624,13 +622,12 @@ public class WTabEditor extends TabEditor implements IFormController, EventListe
// check empty cells
Integer posseq = mapEmptyCellField.get(me.getTarget());
if (posseq != null) {
int actualxpos = posseq / 10000000;
int seqno = posseq - (actualxpos * 10000000);
int actualxpos = posseq / POSSEQMULTIPLIER;
int seqno = posseq - (actualxpos * POSSEQMULTIPLIER);
MField field = getMField((Integer) startItem.getValue());
field.setSeqNo(seqno-5);
field.setIsDisplayed(true);
field.setXPosition(actualxpos);
setProperties(field);
resortArrays();
setProperties(field); // seqno could change
updateLists(field);
@ -646,17 +643,16 @@ public class WTabEditor extends TabEditor implements IFormController, EventListe
// item moved from visible to invisible
MField field = getMField((Integer) startItem.getValue());
setActiveMField(field);
setBackgroundField(field);
field.setSeqNo(0);
field.setIsDisplayed(false);
field.setXPosition(1);
setProperties(field);
resortArrays();
setProperties(field); // seqno could change
updateLists(field);
repaintGrid();
setBackgroundField(field);
}
else if (startItem.getListbox() == invisible && endItem.getListbox() == visible)
else if (startItem.getListbox() == invisible && endItem.getListbox() == visible && (Integer) startItem.getValue() != 0)
{
// item moved from invisible to visible
MField field = getMField((Integer) startItem.getValue());
@ -664,7 +660,6 @@ public class WTabEditor extends TabEditor implements IFormController, EventListe
field.setSeqNo(fieldTo.getSeqNo()-5);
field.setIsDisplayed(true);
field.setXPosition(fieldTo.getXPosition());
setProperties(field);
resortArrays();
setProperties(field); // seqno could change
updateLists(field);
@ -680,7 +675,6 @@ public class WTabEditor extends TabEditor implements IFormController, EventListe
field.setSeqNo(fieldTo.getSeqNo()-5);
field.setIsDisplayed(true);
field.setXPosition(fieldTo.getXPosition());
setProperties(field);
resortArrays();
setProperties(field); // seqno could change
updateLists(field);
@ -768,7 +762,8 @@ public class WTabEditor extends TabEditor implements IFormController, EventListe
for (MField field : getMFields())
{
if (!field.isActive())
GridField gridField = getGridField(field);
if (!field.isActive() || gridField.isToolbarButton())
continue;
KeyNamePair pair = new KeyNamePair(field.getAD_Field_ID(), field.getName());
if (field.isDisplayed()) {
@ -781,6 +776,9 @@ public class WTabEditor extends TabEditor implements IFormController, EventListe
invisible.setSelectedKeyNamePair(pair);
}
}
if (invisible.getItems().isEmpty()){
invisible.addItem(new KeyNamePair(0, "..."));
}
}
@Override

View File

@ -155,6 +155,8 @@ public class WPaymentEditor extends WEditor implements ListDataListener {
@Override
public void setReadWrite(boolean readWrite) {
GridTab m_mTab = gridField.getGridTab();
boolean m_onlyRule = false;
if (m_mTab != null) {
String m_DocStatus = (String) m_mTab.getValue("DocStatus");
// DocStatus
if (m_DocStatus == null)
@ -166,7 +168,6 @@ public class WPaymentEditor extends WEditor implements ListDataListener {
return;
}
boolean m_onlyRule = false;
// Document is not complete - allow to change the Payment Rule only
if (m_DocStatus.equals("CO") || m_DocStatus.equals("WP"))
m_onlyRule = false;
@ -178,6 +179,7 @@ public class WPaymentEditor extends WEditor implements ListDataListener {
if (!m_onlyRule // Only order has Warehouse
&& !m_isSOTrx && m_mTab.getValue("M_Warehouse_ID") != null)
m_onlyRule = true;
}
getComponent().setEnabled(readWrite, readWrite && !m_onlyRule);
}

View File

@ -17,7 +17,9 @@ package org.compiere.apps.form;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.compiere.model.GridField;
import org.compiere.model.MField;
@ -41,9 +43,13 @@ public class TabEditor
private List<MField> fields = new ArrayList<MField>();
private List<GridField> gridFields = new ArrayList<GridField>();
private MField m_activeField;
private List<GridField> gridFields = new ArrayList<GridField>();
private Map<Integer, MField> mapField = new HashMap<Integer, MField>();
private Map<Integer, GridField> mapGridField = new HashMap<Integer, GridField>();
public List<GridField> getGridFields() {
return gridFields;
@ -62,8 +68,10 @@ public class TabEditor
GridField[] l_gridFields = GridField.createFields(Env.getCtx(), windowNo, 0, tabid);
for (GridField gridField : l_gridFields) {
gridFields.add(gridField);
mapGridField.put(gridField.getAD_Field_ID(), gridField);
MField field = new MField(Env.getCtx(), gridField.getAD_Field_ID(), null);
fields.add(field);
mapField.put(field.getAD_Field_ID(), field);
gridField.getVO().IsReadOnly = true;
gridField.getVO().IsMandatory = false;
gridField.getVO().IsUpdateable = false;
@ -81,21 +89,11 @@ public class TabEditor
}
protected MField getMField(int fieldid) {
for (MField field : fields) {
if (field.getAD_Field_ID() == fieldid) {
return field;
}
}
return null;
return mapField.get(fieldid);
}
protected GridField getGridField(MField field) {
for (GridField gridfield : gridFields) {
if (gridfield.getAD_Field_ID() == field.getAD_Field_ID()) {
return gridfield;
}
}
return null;
return mapGridField.get( field.getAD_Field_ID());
}
public MField getActiveMField() {