IDEMPIERE-4811 Custom Toolbar Buttons Dynamic Validation Fix (#704)
* IDEMPIERE-4811 Custom Tolbar Buttons Dynamic Validation on Detail Pane Fix * IDEMPIERE-4811 ToolbarCustomButton - update old constructor
This commit is contained in:
parent
d45ee838e3
commit
5f2406695d
|
@ -477,8 +477,8 @@ public class DetailPane extends Panel implements EventListener<Event>, IdSpace {
|
||||||
btn.setLabel(label);
|
btn.setLabel(label);
|
||||||
}
|
}
|
||||||
|
|
||||||
ToolbarCustomButton toolbarCustomBtn = new ToolbarCustomButton(toolbarButton, btn, actionId, tabPanel.getGridTab().getWindowNo());
|
ToolbarCustomButton toolbarCustomBtn = new ToolbarCustomButton(toolbarButton, btn, actionId, tabPanel.getGridTab().getWindowNo(), tabPanel.getGridTab().getTabNo());
|
||||||
tp.toolbarCustomButtons.add(toolbarCustomBtn);
|
tp.toolbarCustomButtons.put(btn, toolbarCustomBtn);
|
||||||
|
|
||||||
toolbar.appendChild(btn);
|
toolbar.appendChild(btn);
|
||||||
}
|
}
|
||||||
|
@ -877,7 +877,10 @@ public class DetailPane extends Panel implements EventListener<Event>, IdSpace {
|
||||||
btn.setVisible(false);
|
btn.setVisible(false);
|
||||||
} else if (tabRestrictList.contains(btn.getId())) {
|
} else if (tabRestrictList.contains(btn.getId())) {
|
||||||
btn.setVisible(false);
|
btn.setVisible(false);
|
||||||
} else {
|
} else if (tabpanel.toolbarCustomButtons.containsKey(btn)) {
|
||||||
|
ToolbarCustomButton customButton = tabpanel.toolbarCustomButtons.get(btn);
|
||||||
|
customButton.dynamicDisplay();
|
||||||
|
}else {
|
||||||
btn.setVisible(true);
|
btn.setVisible(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1090,7 +1093,7 @@ public class DetailPane extends Panel implements EventListener<Event>, IdSpace {
|
||||||
|
|
||||||
private IADTabpanel adTabPanel;
|
private IADTabpanel adTabPanel;
|
||||||
|
|
||||||
private List<ToolbarCustomButton> toolbarCustomButtons = new ArrayList<ToolbarCustomButton>();
|
private HashMap<ToolBarButton, ToolbarCustomButton> toolbarCustomButtons = new HashMap<ToolBarButton, ToolbarCustomButton>();
|
||||||
|
|
||||||
private A overflowButton;
|
private A overflowButton;
|
||||||
|
|
||||||
|
|
|
@ -30,12 +30,18 @@ public class ToolbarCustomButton implements EventListener<Event>, Evaluatee {
|
||||||
private Toolbarbutton toolbarButton;
|
private Toolbarbutton toolbarButton;
|
||||||
private String actionId;
|
private String actionId;
|
||||||
private int windowNo;
|
private int windowNo;
|
||||||
|
private int tabNo = -1;
|
||||||
private MToolBarButton mToolbarButton;
|
private MToolBarButton mToolbarButton;
|
||||||
|
|
||||||
public ToolbarCustomButton(MToolBarButton mToolbarButton, Toolbarbutton btn, String actionId, int windowNo) {
|
public ToolbarCustomButton(MToolBarButton mToolbarButton, Toolbarbutton btn, String actionId, int windowNo) {
|
||||||
|
this(mToolbarButton, btn, actionId, windowNo, -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ToolbarCustomButton(MToolBarButton mToolbarButton, Toolbarbutton btn, String actionId, int windowNo, int tabNo) {
|
||||||
toolbarButton = btn;
|
toolbarButton = btn;
|
||||||
this.actionId = actionId;
|
this.actionId = actionId;
|
||||||
this.windowNo = windowNo;
|
this.windowNo = windowNo;
|
||||||
|
this.tabNo = tabNo;
|
||||||
this.mToolbarButton = mToolbarButton;
|
this.mToolbarButton = mToolbarButton;
|
||||||
|
|
||||||
toolbarButton.addEventListener(Events.ON_CLICK, this);
|
toolbarButton.addEventListener(Events.ON_CLICK, this);
|
||||||
|
@ -62,7 +68,7 @@ public class ToolbarCustomButton implements EventListener<Event>, Evaluatee {
|
||||||
if (adTabpanel == null)
|
if (adTabpanel == null)
|
||||||
return "";
|
return "";
|
||||||
|
|
||||||
int tabNo = adTabpanel.getTabNo();
|
int tabNo = this.tabNo >= 0 ? this.tabNo : adTabpanel.getTabNo();
|
||||||
if( tabNo == 0)
|
if( tabNo == 0)
|
||||||
return adTabpanel.get_ValueAsString(variableName);
|
return adTabpanel.get_ValueAsString(variableName);
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue