IDEMPIERE-1660

This commit is contained in:
Murilo Habermann Torquato 2014-01-02 15:23:02 -02:00
parent 94ddd650a0
commit 534de24de3
4 changed files with 28 additions and 3 deletions

View File

@ -1582,6 +1582,17 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
return m_vo.IsInsertRecord;
} // isInsertRecord
/**
* Can we Delete Records?
* @return true not read only and allowed
*/
public boolean isDeleteRecord()
{
if (isReadOnly())
return false;
return m_vo.IsDeleteable;
} // isDeleteRecord
/**
* Is the Tab Visible.
* Called when constructing the window.

View File

@ -1231,12 +1231,15 @@ public final class APanel extends CPanel
changed = false;
boolean readOnly = m_curTab.isReadOnly();
boolean insertRecord = !readOnly;
boolean deleteRecord = !readOnly;
if (insertRecord)
insertRecord = m_curTab.isInsertRecord();
aNew.setEnabled(!changed && insertRecord);
aCopy.setEnabled(!changed && insertRecord);
aRefresh.setEnabled(!changed);
aDelete.setEnabled(!changed && !readOnly);
if (deleteRecord)
deleteRecord = m_curTab.isDeleteRecord();
aDelete.setEnabled(!changed && deleteRecord);
aDeleteSelection.setEnabled(!changed && !readOnly);
//
if (readOnly && m_curTab.isAlwaysUpdateField())

View File

@ -1532,6 +1532,7 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
boolean readOnly = adTabbox.getSelectedGridTab().isReadOnly();
boolean processed = adTabbox.getSelectedGridTab().isProcessed();
boolean insertRecord = !readOnly;
boolean deleteRecord = !readOnly;
if (!detailTab)
{
// update Change
@ -1544,7 +1545,11 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
toolbar.enableNew(!changed && insertRecord && !tabPanel.getGridTab().isSortTab());
toolbar.enableCopy(!changed && insertRecord && !tabPanel.getGridTab().isSortTab() && adTabbox.getSelectedGridTab().getRowCount()>0);
toolbar.enableRefresh(!changed);
toolbar.enableDelete(!changed && !readOnly && !tabPanel.getGridTab().isSortTab() && !processed);
if (deleteRecord)
{
deleteRecord = tabPanel.getGridTab().isDeleteRecord();
}
toolbar.enableDelete(!changed && deleteRecord && !tabPanel.getGridTab().isSortTab() && !processed);
//
if (readOnly && adTabbox.getSelectedGridTab().isAlwaysUpdateField())
{

View File

@ -664,12 +664,18 @@ public class DetailPane extends Panel implements EventListener<Event>, IdSpace {
readOnly = true;
boolean insertRecord = !readOnly;
boolean deleteRecord = !readOnly;
if (insertRecord)
{
insertRecord = adtab.getGridTab().isInsertRecord();
}
boolean enableNew = !changed && insertRecord && !adtab.getGridTab().isSortTab();
boolean enableDelete = !changed && !readOnly && !adtab.getGridTab().isSortTab();
if (deleteRecord)
{
deleteRecord = adtab.getGridTab().isDeleteRecord();
}
boolean enableDelete = !changed && deleteRecord && !adtab.getGridTab().isSortTab();
ADWindow adwindow = ADWindow.findADWindow(this);
if (adwindow == null)