IDEMPIERE-1087 Process Parameters don't have contextual menu (right click) / based on patch from Juliana Corredor

This commit is contained in:
Carlos Ruiz 2013-06-21 19:57:56 -05:00
parent 0e80967351
commit 339d10e787
3 changed files with 52 additions and 13 deletions

View File

@ -450,6 +450,7 @@ public class GridField
keyColumn = "AD_EntityType_ID";
if (!keyColumn.endsWith("_ID"))
keyColumn += "_ID"; // AD_Language_ID
if (getGridTab() != null) {
int Record_ID = Env.getContextAsInt(ctx, m_vo.WindowNo, m_vo.TabNo, keyColumn);
int AD_Table_ID = m_vo.AD_Table_ID;
if (!MRole.getDefault(ctx, false).canUpdate(
@ -458,6 +459,7 @@ public class GridField
if (!MRole.getDefault(ctx, false).isColumnAccess(AD_Table_ID, m_vo.AD_Column_ID, false))
return false;
}
}
// Do we have a readonly rule
if (checkContext && m_vo.ReadOnlyLogic.length() > 0)
@ -487,7 +489,7 @@ public class GridField
return true;
// BF [ 2910368 ]
// Record is not Active
if (checkContext && !Env.getContext(ctx, m_vo.WindowNo,m_vo.TabNo, "IsActive").equals("Y"))
if (checkContext && getGridTab() != null && !Env.getContext(ctx, m_vo.WindowNo,m_vo.TabNo, "IsActive").equals("Y"))
return false;
// ultimately visibility decides

View File

@ -29,6 +29,7 @@ import org.adempiere.webui.component.GridFactory;
import org.adempiere.webui.component.Panel;
import org.adempiere.webui.component.Row;
import org.adempiere.webui.component.Rows;
import org.adempiere.webui.editor.IZoomableEditor;
import org.adempiere.webui.editor.WEditor;
import org.adempiere.webui.editor.WEditorPopupMenu;
import org.adempiere.webui.editor.WebEditorFactory;
@ -54,6 +55,7 @@ import org.zkoss.zk.ui.event.Events;
import org.zkoss.zul.Div;
import org.zkoss.zul.Hbox;
import org.zkoss.zul.Label;
import org.zkoss.zul.impl.XulElement;
/**
* Process Parameter Panel, based on existing ProcessParameter dialog. -
@ -68,7 +70,8 @@ public class ProcessParameterPanel extends Panel implements
/**
*
*/
private static final long serialVersionUID = 7163263872945366389L;
private static final long serialVersionUID = -5996487688479454715L;
private String width;
/**
@ -291,9 +294,25 @@ public class ProcessParameterPanel extends Panel implements
editor.fillHorizontal();
// setup editor context menu
WEditorPopupMenu popupMenu = editor.getPopupMenu();
if (popupMenu != null) {
if (popupMenu != null)
{
popupMenu.addMenuListener((ContextMenuListener)editor);
popupMenu.setId(mField.getColumnName()+"-popup");
this.appendChild(popupMenu);
if (!mField.isFieldOnly())
{
Label label = editor.getLabel();
if (popupMenu.isZoomEnabled() && editor instanceof IZoomableEditor)
{
label.addEventListener(Events.ON_CLICK, new ZoomListener((IZoomableEditor) editor));
}
popupMenu.addContextElement(label);
if (editor.getComponent() instanceof XulElement)
{
popupMenu.addContextElement((XulElement) editor.getComponent());
}
}
}
//
m_wEditors.add(editor); // add to Editors
@ -634,6 +653,7 @@ public class ProcessParameterPanel extends Panel implements
m_wEditors2.get(i).setVisible(false);
}
}
editor.updateLabelStyle();
}
}
@ -661,5 +681,21 @@ public class ProcessParameterPanel extends Panel implements
m_processInfo = processInfo;
}
} // ProcessParameterPanel
static class ZoomListener implements EventListener<Event> {
private IZoomableEditor searchEditor;
ZoomListener(IZoomableEditor editor) {
searchEditor = editor;
}
public void onEvent(Event event) throws Exception {
if (Events.ON_CLICK.equals(event.getName())) {
searchEditor.actionZoom();
}
}
}
} // ProcessParameterPanel

View File

@ -566,7 +566,8 @@ public abstract class WEditor implements EventListener<Event>, PropertyChangeLis
* @return boolean
*/
protected boolean isShowPreference() {
return MRole.getDefault().isShowPreference() && gridField != null && !gridField.isEncrypted() && !gridField.isEncryptedColumn();
return MRole.getDefault().isShowPreference() && gridField != null && !gridField.isEncrypted() && !gridField.isEncryptedColumn()
&& gridTab != null; // don't show preference for process parameters
}
/**