IDEMPIERE-761 New record on role is showing role 0 info on detail.

This commit is contained in:
Heng Sin Low 2013-03-19 17:20:36 +08:00
parent 2cab3c4c33
commit 013487eecb
4 changed files with 56 additions and 2 deletions

View File

@ -989,5 +989,24 @@ public class ADSortTab extends Panel implements IADTabpanel
public DetailPane getDetailPane() { public DetailPane getDetailPane() {
return null; return null;
} }
@Override
public void resetDetailForNewParentRecord() {
yesModel.removeAllElements();
noModel.removeAllElements();
setIsChanged(false);
bAdd.setEnabled(false);
bRemove.setEnabled(false);
bUp.setEnabled(false);
bDown.setEnabled(false);
yesList.setEnabled(false);
noList.setEnabled(false);
yesList.setItemRenderer(yesModel);
yesList.setModel(yesModel);
noList.setItemRenderer(noModel);
noList.setModel(noModel);
}
} //ADSortTab } //ADSortTab

View File

@ -233,6 +233,7 @@ DataStatusListener, IADTabpanel, IdSpace, IFieldEditorContainer
listPanel.getListbox().addEventListener(Events.ON_DOUBLE_CLICK, this); listPanel.getListbox().addEventListener(Events.ON_DOUBLE_CLICK, this);
} }
@Override
public void setDetailPane(DetailPane component) { public void setDetailPane(DetailPane component) {
detailPane = component; detailPane = component;
@ -272,6 +273,7 @@ DataStatusListener, IADTabpanel, IdSpace, IFieldEditorContainer
south.setSclass("adwindow-gridview-detail"); south.setSclass("adwindow-gridview-detail");
} }
@Override
public DetailPane getDetailPane() { public DetailPane getDetailPane() {
return detailPane; return detailPane;
} }
@ -389,6 +391,7 @@ DataStatusListener, IADTabpanel, IdSpace, IFieldEditorContainer
/** /**
* Create UI components if not already created * Create UI components if not already created
*/ */
@Override
public void createUI() public void createUI()
{ {
if (uiCreated) return; if (uiCreated) return;
@ -649,6 +652,7 @@ DataStatusListener, IADTabpanel, IdSpace, IFieldEditorContainer
* Validate display properties of fields of current row * Validate display properties of fields of current row
* @param col * @param col
*/ */
@Override
public void dynamicDisplay (int col) public void dynamicDisplay (int col)
{ {
if (!gridTab.isOpen()) if (!gridTab.isOpen())
@ -796,6 +800,7 @@ DataStatusListener, IADTabpanel, IdSpace, IFieldEditorContainer
/** /**
* @return String * @return String
*/ */
@Override
public String getDisplayLogic() public String getDisplayLogic()
{ {
return gridTab.getDisplayLogic(); return gridTab.getDisplayLogic();
@ -804,6 +809,7 @@ DataStatusListener, IADTabpanel, IdSpace, IFieldEditorContainer
/** /**
* @return String * @return String
*/ */
@Override
public String getTitle() public String getTitle()
{ {
return gridTab.getName(); return gridTab.getName();
@ -812,6 +818,7 @@ DataStatusListener, IADTabpanel, IdSpace, IFieldEditorContainer
/** /**
* @param variableName * @param variableName
*/ */
@Override
public String get_ValueAsString(String variableName) public String get_ValueAsString(String variableName)
{ {
return Env.getContext(Env.getCtx(), windowNo, variableName); return Env.getContext(Env.getCtx(), windowNo, variableName);
@ -820,6 +827,7 @@ DataStatusListener, IADTabpanel, IdSpace, IFieldEditorContainer
/** /**
* @return The tab level of this Tabpanel * @return The tab level of this Tabpanel
*/ */
@Override
public int getTabLevel() public int getTabLevel()
{ {
return gridTab.getTabLevel(); return gridTab.getTabLevel();
@ -828,6 +836,7 @@ DataStatusListener, IADTabpanel, IdSpace, IFieldEditorContainer
/** /**
* @return The tablename of this Tabpanel * @return The tablename of this Tabpanel
*/ */
@Override
public String getTableName() public String getTableName()
{ {
return gridTab.getTableName(); return gridTab.getTableName();
@ -836,6 +845,7 @@ DataStatusListener, IADTabpanel, IdSpace, IFieldEditorContainer
/** /**
* @return The record ID of this Tabpanel * @return The record ID of this Tabpanel
*/ */
@Override
public int getRecord_ID() public int getRecord_ID()
{ {
return gridTab.getRecord_ID(); return gridTab.getRecord_ID();
@ -845,6 +855,7 @@ DataStatusListener, IADTabpanel, IdSpace, IFieldEditorContainer
* Is panel need refresh * Is panel need refresh
* @return boolean * @return boolean
*/ */
@Override
public boolean isCurrent() public boolean isCurrent()
{ {
return gridTab != null ? gridTab.isCurrent() : false; return gridTab != null ? gridTab.isCurrent() : false;
@ -862,6 +873,7 @@ DataStatusListener, IADTabpanel, IdSpace, IFieldEditorContainer
/** /**
* Retrieve from db * Retrieve from db
*/ */
@Override
public void query() public void query()
{ {
boolean open = gridTab.isOpen(); boolean open = gridTab.isOpen();
@ -876,6 +888,7 @@ DataStatusListener, IADTabpanel, IdSpace, IFieldEditorContainer
* @param onlyCurrentDays * @param onlyCurrentDays
* @param maxRows * @param maxRows
*/ */
@Override
public void query (boolean onlyCurrentRows, int onlyCurrentDays, int maxRows) public void query (boolean onlyCurrentRows, int onlyCurrentDays, int maxRows)
{ {
boolean open = gridTab.isOpen(); boolean open = gridTab.isOpen();
@ -884,6 +897,19 @@ DataStatusListener, IADTabpanel, IdSpace, IFieldEditorContainer
gridTab.getTableModel().fireTableDataChanged(); gridTab.getTableModel().fireTableDataChanged();
} }
/**
* clear data grid for new parent record that's not saved yet
*/
@Override
public void resetDetailForNewParentRecord ()
{
boolean open = gridTab.isOpen();
if (open)
{
gridTab.clearForNewParentRecord();
}
}
/** /**
* @return GridTab * @return GridTab
*/ */

View File

@ -729,7 +729,11 @@ public class CompositeADTabbox extends AbstractADTabbox
private void onActivateDetail(IADTabpanel tabPanel) { private void onActivateDetail(IADTabpanel tabPanel) {
tabPanel.createUI(); tabPanel.createUI();
if (headerTab.getGridTab().isNew()) {
tabPanel.resetDetailForNewParentRecord();
} else {
tabPanel.query(false, 0, 0); tabPanel.query(false, 0, 0);
}
if (!tabPanel.isVisible()) if (!tabPanel.isVisible())
tabPanel.setVisible(true); tabPanel.setVisible(true);
if (!tabPanel.isGridView()) { if (!tabPanel.isGridView()) {

View File

@ -180,4 +180,9 @@ public interface IADTabpanel extends Component, Evaluatee {
* @return detailpane * @return detailpane
*/ */
public DetailPane getDetailPane(); public DetailPane getDetailPane();
/**
* reset detail data grid when parent tab current record is new and not saved yet
*/
public abstract void resetDetailForNewParentRecord();
} }