IDEMPIERE-3917: add sql logic for display logic of field, process button, customize button
This commit is contained in:
parent
322a2413d7
commit
59655e3324
|
@ -1192,6 +1192,9 @@ public class GridField
|
||||||
// ** dynamic content **
|
// ** dynamic content **
|
||||||
if (checkContext)
|
if (checkContext)
|
||||||
{
|
{
|
||||||
|
if (m_vo.DisplayLogic.startsWith("@SQL=")) {
|
||||||
|
return Evaluator.parseSQLLogic(m_vo.DisplayLogic, m_vo.ctx, m_vo.WindowNo, m_vo.TabNo, m_vo.ColumnName);
|
||||||
|
}
|
||||||
Evaluatee evaluatee = new Evaluatee() {
|
Evaluatee evaluatee = new Evaluatee() {
|
||||||
public String get_ValueAsString(String variableName) {
|
public String get_ValueAsString(String variableName) {
|
||||||
return GridField.this.get_ValueAsString(ctx, variableName);
|
return GridField.this.get_ValueAsString(ctx, variableName);
|
||||||
|
|
|
@ -76,8 +76,22 @@ public class ToolbarCustomButton implements EventListener<Event>, Evaluatee {
|
||||||
String displayLogic = mToolbarButton.getDisplayLogic();
|
String displayLogic = mToolbarButton.getDisplayLogic();
|
||||||
if (displayLogic == null || displayLogic.trim().length() == 0)
|
if (displayLogic == null || displayLogic.trim().length() == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
boolean visible = Evaluator.evaluateLogic(this, displayLogic);
|
boolean visible = true;
|
||||||
|
if (displayLogic.startsWith("@SQL=")) {
|
||||||
|
ADWindow adwindow = ADWindow.get(windowNo);
|
||||||
|
if (adwindow == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
IADTabpanel adTabpanel = adwindow.getADWindowContent().getADTab().getSelectedTabpanel();
|
||||||
|
if (adTabpanel == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
visible = Evaluator.parseSQLLogic(displayLogic, Env.getCtx(), windowNo, adTabpanel.getTabNo(), mToolbarButton.getActionName());
|
||||||
|
}else {
|
||||||
|
visible = Evaluator.evaluateLogic(this, displayLogic);
|
||||||
|
}
|
||||||
|
|
||||||
toolbarButton.setVisible(visible);
|
toolbarButton.setVisible(visible);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -119,7 +119,13 @@ public class ToolbarProcessButton implements IProcessButton, Evaluatee {
|
||||||
if (displayLogic == null || displayLogic.trim().length() == 0)
|
if (displayLogic == null || displayLogic.trim().length() == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
boolean visible = Evaluator.evaluateLogic(this, displayLogic);
|
boolean visible = true;
|
||||||
|
if (displayLogic.startsWith("@SQL=")) {
|
||||||
|
visible = Evaluator.parseSQLLogic(displayLogic, Env.getCtx(), windowNo, adTabpanel.getTabNo(), mToolbarButton.getActionName());
|
||||||
|
}else {
|
||||||
|
visible = Evaluator.evaluateLogic(this, displayLogic);
|
||||||
|
}
|
||||||
|
|
||||||
button.setVisible(visible);
|
button.setVisible(visible);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue