IDEMPIERE-382 Prevent users to go to detail tabs if link fields are not filled (zk)
This commit is contained in:
parent
a2cd4a1326
commit
dcc0773920
|
@ -122,7 +122,7 @@ public abstract class AbstractADTab extends AbstractUIPart implements IADTab
|
||||||
|
|
||||||
if (newIndex != oldIndex)
|
if (newIndex != oldIndex)
|
||||||
{
|
{
|
||||||
canJump = canNavigateTo(oldIndex, newIndex);
|
canJump = canNavigateTo(oldIndex, newIndex, true);
|
||||||
if (canJump)
|
if (canJump)
|
||||||
{
|
{
|
||||||
prepareContext(newIndex, newTab);
|
prepareContext(newIndex, newTab);
|
||||||
|
@ -204,8 +204,12 @@ public abstract class AbstractADTab extends AbstractUIPart implements IADTab
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canNavigateTo(int fromIndex, int toIndex) {
|
public boolean canNavigateTo(int fromIndex, int toIndex) {
|
||||||
|
return canNavigateTo(fromIndex, toIndex, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean canNavigateTo(int fromIndex, int toIndex, boolean checkRecordID) {
|
||||||
IADTabpanel newTab = tabPanelList.get(toIndex);
|
IADTabpanel newTab = tabPanelList.get(toIndex);
|
||||||
if (newTab instanceof ADTabpanel)
|
if (newTab instanceof ADTabpanel)
|
||||||
{
|
{
|
||||||
|
@ -222,8 +226,7 @@ public abstract class AbstractADTab extends AbstractUIPart implements IADTab
|
||||||
IADTabpanel oldTabpanel = fromIndex >= 0 ? tabPanelList.get(fromIndex) : null;
|
IADTabpanel oldTabpanel = fromIndex >= 0 ? tabPanelList.get(fromIndex) : null;
|
||||||
if (oldTabpanel != null)
|
if (oldTabpanel != null)
|
||||||
{
|
{
|
||||||
IADTabpanel oldTab = oldTabpanel;
|
if (newTab.getTabLevel() > oldTabpanel.getTabLevel())
|
||||||
if (newTab.getTabLevel() > oldTab.getTabLevel())
|
|
||||||
{
|
{
|
||||||
int currentLevel = newTab.getTabLevel();
|
int currentLevel = newTab.getTabLevel();
|
||||||
for (int i = toIndex - 1; i >= 0; i--)
|
for (int i = toIndex - 1; i >= 0; i--)
|
||||||
|
@ -239,8 +242,10 @@ public abstract class AbstractADTab extends AbstractUIPart implements IADTab
|
||||||
currentLevel = tabPanel.getTabLevel();
|
currentLevel = tabPanel.getTabLevel();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (canJump && checkRecordID && oldTabpanel.getRecord_ID() <= 0)
|
||||||
|
canJump = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return canJump;
|
return canJump;
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,9 +68,10 @@ import org.zkoss.zul.event.ListDataEvent;
|
||||||
*/
|
*/
|
||||||
public class ADSortTab extends Panel implements IADTabpanel
|
public class ADSortTab extends Panel implements IADTabpanel
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
private static final long serialVersionUID = 4289328613547509587L;
|
*
|
||||||
private int m_AD_ColumnSortOrder_ID;
|
*/
|
||||||
|
private static final long serialVersionUID = 4461514427222034848L;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sort Tab Constructor
|
* Sort Tab Constructor
|
||||||
|
@ -869,6 +870,10 @@ public class ADSortTab extends Panel implements IADTabpanel
|
||||||
return gridTab.getTabLevel();
|
return gridTab.getTabLevel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getRecord_ID() {
|
||||||
|
return gridTab.getRecord_ID();
|
||||||
|
}
|
||||||
|
|
||||||
public String getTitle() {
|
public String getTitle() {
|
||||||
return gridTab.getName();
|
return gridTab.getName();
|
||||||
}
|
}
|
||||||
|
|
|
@ -98,7 +98,7 @@ DataStatusListener, IADTabpanel
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = -975129028953555569L;
|
private static final long serialVersionUID = -6082680802978974909L;
|
||||||
|
|
||||||
private static final String ON_DEFER_SET_SELECTED_NODE = "onDeferSetSelectedNode";
|
private static final String ON_DEFER_SET_SELECTED_NODE = "onDeferSetSelectedNode";
|
||||||
|
|
||||||
|
@ -670,6 +670,14 @@ DataStatusListener, IADTabpanel
|
||||||
return gridTab.getTabLevel();
|
return gridTab.getTabLevel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return The record ID of this Tabpanel
|
||||||
|
*/
|
||||||
|
public int getRecord_ID()
|
||||||
|
{
|
||||||
|
return gridTab.getRecord_ID();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Is panel need refresh
|
* Is panel need refresh
|
||||||
* @return boolean
|
* @return boolean
|
||||||
|
|
|
@ -1025,6 +1025,7 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
|
||||||
FDialog.warn(curWindowNo, "TabSwitchJumpGo", title);
|
FDialog.warn(curWindowNo, "TabSwitchJumpGo", title);
|
||||||
if (callback != null)
|
if (callback != null)
|
||||||
callback.onCallback(false);
|
callback.onCallback(false);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
IADTabpanel oldTabpanel = curTabpanel;
|
IADTabpanel oldTabpanel = curTabpanel;
|
||||||
|
|
|
@ -33,6 +33,11 @@ public interface IADTabpanel extends Component, Evaluatee {
|
||||||
*/
|
*/
|
||||||
public int getTabLevel();
|
public int getTabLevel();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return record ID
|
||||||
|
*/
|
||||||
|
public int getRecord_ID();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return true if refresh is not needed
|
* @return true if refresh is not needed
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue