IDEMPIERE-17 Value Preference window showing encrypted content to user. Obscure and encrypted field shouldn't have value preference menu.
(transplanted from f3bb9e2b0eafdd35ec559162fd88d7e1f346a078)
This commit is contained in:
parent
51ed00a1ec
commit
97896c1550
|
@ -23,6 +23,7 @@ import org.adempiere.webui.event.ContextMenuEvent;
|
||||||
import org.adempiere.webui.event.ContextMenuListener;
|
import org.adempiere.webui.event.ContextMenuListener;
|
||||||
import org.compiere.util.Env;
|
import org.compiere.util.Env;
|
||||||
import org.compiere.util.Msg;
|
import org.compiere.util.Msg;
|
||||||
|
import org.compiere.util.Util;
|
||||||
import org.zkoss.zk.ui.event.Event;
|
import org.zkoss.zk.ui.event.Event;
|
||||||
import org.zkoss.zk.ui.event.EventListener;
|
import org.zkoss.zk.ui.event.EventListener;
|
||||||
import org.zkoss.zk.ui.event.Events;
|
import org.zkoss.zk.ui.event.Events;
|
||||||
|
@ -94,7 +95,7 @@ public class WEditorPopupMenu extends Menupopup implements EventListener
|
||||||
{
|
{
|
||||||
zoomItem = new Menuitem();
|
zoomItem = new Menuitem();
|
||||||
zoomItem.setAttribute(EVENT_ATTRIBUTE, ZOOM_EVENT);
|
zoomItem.setAttribute(EVENT_ATTRIBUTE, ZOOM_EVENT);
|
||||||
zoomItem.setLabel(Msg.getMsg(Env.getCtx(), "Zoom"));
|
zoomItem.setLabel(Util.cleanAmp(Msg.getMsg(Env.getCtx(), "Zoom")));
|
||||||
zoomItem.setImage("/images/Zoom16.png");
|
zoomItem.setImage("/images/Zoom16.png");
|
||||||
zoomItem.addEventListener(Events.ON_CLICK, this);
|
zoomItem.addEventListener(Events.ON_CLICK, this);
|
||||||
|
|
||||||
|
@ -105,7 +106,7 @@ public class WEditorPopupMenu extends Menupopup implements EventListener
|
||||||
{
|
{
|
||||||
requeryItem = new Menuitem();
|
requeryItem = new Menuitem();
|
||||||
requeryItem.setAttribute(EVENT_ATTRIBUTE, REQUERY_EVENT);
|
requeryItem.setAttribute(EVENT_ATTRIBUTE, REQUERY_EVENT);
|
||||||
requeryItem.setLabel(Msg.getMsg(Env.getCtx(), "Refresh"));
|
requeryItem.setLabel(Util.cleanAmp(Msg.getMsg(Env.getCtx(), "Refresh")));
|
||||||
requeryItem.setImage("/images/Refresh16.png");
|
requeryItem.setImage("/images/Refresh16.png");
|
||||||
requeryItem.addEventListener(Events.ON_CLICK, this);
|
requeryItem.addEventListener(Events.ON_CLICK, this);
|
||||||
this.appendChild(requeryItem);
|
this.appendChild(requeryItem);
|
||||||
|
@ -115,7 +116,7 @@ public class WEditorPopupMenu extends Menupopup implements EventListener
|
||||||
{
|
{
|
||||||
prefItem = new Menuitem();
|
prefItem = new Menuitem();
|
||||||
prefItem.setAttribute(EVENT_ATTRIBUTE, PREFERENCE_EVENT);
|
prefItem.setAttribute(EVENT_ATTRIBUTE, PREFERENCE_EVENT);
|
||||||
prefItem.setLabel(Msg.getMsg(Env.getCtx(), "ValuePreference"));
|
prefItem.setLabel(Util.cleanAmp(Msg.getMsg(Env.getCtx(), "ValuePreference")));
|
||||||
prefItem.setImage("/images/VPreference16.png");
|
prefItem.setImage("/images/VPreference16.png");
|
||||||
prefItem.addEventListener(Events.ON_CLICK, this);
|
prefItem.addEventListener(Events.ON_CLICK, this);
|
||||||
this.appendChild(prefItem);
|
this.appendChild(prefItem);
|
||||||
|
@ -125,7 +126,7 @@ public class WEditorPopupMenu extends Menupopup implements EventListener
|
||||||
{
|
{
|
||||||
newItem = new Menuitem();
|
newItem = new Menuitem();
|
||||||
newItem.setAttribute(EVENT_ATTRIBUTE, NEW_EVENT);
|
newItem.setAttribute(EVENT_ATTRIBUTE, NEW_EVENT);
|
||||||
newItem.setLabel(Msg.getMsg(Env.getCtx(), "New"));
|
newItem.setLabel(Util.cleanAmp(Msg.getMsg(Env.getCtx(), "New")));
|
||||||
newItem.setImage("/images/New16.png");
|
newItem.setImage("/images/New16.png");
|
||||||
newItem.addEventListener(Events.ON_CLICK, this);
|
newItem.addEventListener(Events.ON_CLICK, this);
|
||||||
this.appendChild(newItem);
|
this.appendChild(newItem);
|
||||||
|
@ -136,7 +137,7 @@ public class WEditorPopupMenu extends Menupopup implements EventListener
|
||||||
{
|
{
|
||||||
updateItem = new Menuitem();
|
updateItem = new Menuitem();
|
||||||
updateItem.setAttribute(EVENT_ATTRIBUTE, UPDATE_EVENT);
|
updateItem.setAttribute(EVENT_ATTRIBUTE, UPDATE_EVENT);
|
||||||
updateItem.setLabel(Msg.getMsg(Env.getCtx(), "Update"));
|
updateItem.setLabel(Util.cleanAmp(Msg.getMsg(Env.getCtx(), "Update")));
|
||||||
updateItem.setImage("/images/InfoBPartner16.png");
|
updateItem.setImage("/images/InfoBPartner16.png");
|
||||||
updateItem.addEventListener(Events.ON_CLICK, this);
|
updateItem.addEventListener(Events.ON_CLICK, this);
|
||||||
this.appendChild(updateItem);
|
this.appendChild(updateItem);
|
||||||
|
|
|
@ -123,7 +123,12 @@ public class WNumberEditor extends WEditor implements ContextMenuListener
|
||||||
DecimalFormat format = DisplayType.getNumberFormat(displayType, AEnv.getLanguage(Env.getCtx()));
|
DecimalFormat format = DisplayType.getNumberFormat(displayType, AEnv.getLanguage(Env.getCtx()));
|
||||||
getComponent().getDecimalbox().setFormat(format.toPattern());
|
getComponent().getDecimalbox().setFormat(format.toPattern());
|
||||||
|
|
||||||
popupMenu = new WEditorPopupMenu(true, true, false);
|
boolean valuePreference = false;
|
||||||
|
if (gridField != null && !gridField.isEncrypted() && !gridField.isEncryptedColumn())
|
||||||
|
{
|
||||||
|
valuePreference = true;
|
||||||
|
}
|
||||||
|
popupMenu = new WEditorPopupMenu(false, false, valuePreference);
|
||||||
if (gridField != null && gridField.getGridTab() != null)
|
if (gridField != null && gridField.getGridTab() != null)
|
||||||
{
|
{
|
||||||
WFieldRecordInfo.addMenu(popupMenu);
|
WFieldRecordInfo.addMenu(popupMenu);
|
||||||
|
@ -131,6 +136,12 @@ public class WNumberEditor extends WEditor implements ContextMenuListener
|
||||||
getComponent().setContext(popupMenu.getId());
|
getComponent().setContext(popupMenu.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public WEditorPopupMenu getPopupMenu() {
|
||||||
|
return popupMenu;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Event handler
|
* Event handler
|
||||||
* @param event
|
* @param event
|
||||||
|
@ -219,7 +230,7 @@ public class WNumberEditor extends WEditor implements ContextMenuListener
|
||||||
{
|
{
|
||||||
if (WEditorPopupMenu.PREFERENCE_EVENT.equals(evt.getContextEvent()) && gridField != null)
|
if (WEditorPopupMenu.PREFERENCE_EVENT.equals(evt.getContextEvent()) && gridField != null)
|
||||||
{
|
{
|
||||||
if (MRole.getDefault().isShowPreference())
|
if (MRole.getDefault().isShowPreference() && !gridField.isEncrypted() && !gridField.isEncryptedColumn())
|
||||||
ValuePreference.start (this.getGridField(), getValue());
|
ValuePreference.start (this.getGridField(), getValue());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -147,20 +147,24 @@ public class WSearchEditor extends WEditor implements ContextMenuListener, Value
|
||||||
{
|
{
|
||||||
|
|
||||||
columnName = this.getColumnName();
|
columnName = this.getColumnName();
|
||||||
|
boolean valuePreference = false;
|
||||||
|
if (gridField != null && !gridField.isEncrypted() && !gridField.isEncryptedColumn())
|
||||||
|
{
|
||||||
|
valuePreference = true;
|
||||||
|
}
|
||||||
if (columnName.equals("C_BPartner_ID"))
|
if (columnName.equals("C_BPartner_ID"))
|
||||||
{
|
{
|
||||||
popupMenu = new WEditorPopupMenu(true, true, true, true, true);
|
popupMenu = new WEditorPopupMenu(true, true, valuePreference, true, true);
|
||||||
getComponent().setButtonImage("/images/BPartner10.png");
|
getComponent().setButtonImage("/images/BPartner10.png");
|
||||||
}
|
}
|
||||||
else if (columnName.equals("M_Product_ID"))
|
else if (columnName.equals("M_Product_ID"))
|
||||||
{
|
{
|
||||||
popupMenu = new WEditorPopupMenu(true, true, true, false, false);
|
popupMenu = new WEditorPopupMenu(true, true, valuePreference, false, false);
|
||||||
getComponent().setButtonImage("/images/Product10.png");
|
getComponent().setButtonImage("/images/Product10.png");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
popupMenu = new WEditorPopupMenu(true, true, true, false, false);
|
popupMenu = new WEditorPopupMenu(true, true, valuePreference, false, false);
|
||||||
getComponent().setButtonImage("/images/PickOpen10.png");
|
getComponent().setButtonImage("/images/PickOpen10.png");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -278,7 +282,7 @@ public class WSearchEditor extends WEditor implements ContextMenuListener, Value
|
||||||
}
|
}
|
||||||
else if (WEditorPopupMenu.PREFERENCE_EVENT.equals(evt.getContextEvent()))
|
else if (WEditorPopupMenu.PREFERENCE_EVENT.equals(evt.getContextEvent()))
|
||||||
{
|
{
|
||||||
if (MRole.getDefault().isShowPreference())
|
if (MRole.getDefault().isShowPreference() && gridField != null && !gridField.isEncrypted() && !gridField.isEncryptedColumn())
|
||||||
ValuePreference.start (this.getGridField(), getValue());
|
ValuePreference.start (this.getGridField(), getValue());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,7 +54,8 @@ public class WStringEditor extends WEditor implements ContextMenuListener
|
||||||
|
|
||||||
private WEditorPopupMenu popupMenu;
|
private WEditorPopupMenu popupMenu;
|
||||||
|
|
||||||
private boolean tableEditor = false;
|
@SuppressWarnings("unused")
|
||||||
|
private boolean tableEditor = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* to ease porting of swing form
|
* to ease porting of swing form
|
||||||
|
@ -140,7 +141,12 @@ public class WStringEditor extends WEditor implements ContextMenuListener
|
||||||
if (getComponent() instanceof Textbox)
|
if (getComponent() instanceof Textbox)
|
||||||
((Textbox)getComponent()).setObscureType(obscureType);
|
((Textbox)getComponent()).setObscureType(obscureType);
|
||||||
|
|
||||||
popupMenu = new WEditorPopupMenu(false, false, true);
|
boolean valuePreference = false;
|
||||||
|
if (gridField != null && !gridField.isEncrypted() && !gridField.isEncryptedColumn())
|
||||||
|
{
|
||||||
|
valuePreference = true;
|
||||||
|
}
|
||||||
|
popupMenu = new WEditorPopupMenu(false, false, valuePreference);
|
||||||
Menuitem editor = new Menuitem(Msg.getMsg(Env.getCtx(), "Editor"), "images/Editor16.png");
|
Menuitem editor = new Menuitem(Msg.getMsg(Env.getCtx(), "Editor"), "images/Editor16.png");
|
||||||
editor.setAttribute("EVENT", EDITOR_EVENT);
|
editor.setAttribute("EVENT", EDITOR_EVENT);
|
||||||
editor.addEventListener(Events.ON_CLICK, popupMenu);
|
editor.addEventListener(Events.ON_CLICK, popupMenu);
|
||||||
|
@ -236,7 +242,7 @@ public class WStringEditor extends WEditor implements ContextMenuListener
|
||||||
{
|
{
|
||||||
if (WEditorPopupMenu.PREFERENCE_EVENT.equals(evt.getContextEvent()))
|
if (WEditorPopupMenu.PREFERENCE_EVENT.equals(evt.getContextEvent()))
|
||||||
{
|
{
|
||||||
if (MRole.getDefault().isShowPreference())
|
if (MRole.getDefault().isShowPreference() && gridField != null && !gridField.isEncrypted() && !gridField.isEncryptedColumn())
|
||||||
ValuePreference.start (this.getGridField(), getValue());
|
ValuePreference.start (this.getGridField(), getValue());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -144,7 +144,12 @@ ContextMenuListener, IZoomableEditor
|
||||||
|
|
||||||
if (gridField != null)
|
if (gridField != null)
|
||||||
{
|
{
|
||||||
popupMenu = new WEditorPopupMenu(zoom, true, true);
|
boolean valuePreference = false;
|
||||||
|
if (!gridField.isEncrypted() && !gridField.isEncryptedColumn())
|
||||||
|
{
|
||||||
|
valuePreference = true;
|
||||||
|
}
|
||||||
|
popupMenu = new WEditorPopupMenu(zoom, true, valuePreference);
|
||||||
if (gridField != null && gridField.getGridTab() != null)
|
if (gridField != null && gridField.getGridTab() != null)
|
||||||
{
|
{
|
||||||
WFieldRecordInfo.addMenu(popupMenu);
|
WFieldRecordInfo.addMenu(popupMenu);
|
||||||
|
@ -400,7 +405,7 @@ ContextMenuListener, IZoomableEditor
|
||||||
}
|
}
|
||||||
else if (WEditorPopupMenu.PREFERENCE_EVENT.equals(evt.getContextEvent()))
|
else if (WEditorPopupMenu.PREFERENCE_EVENT.equals(evt.getContextEvent()))
|
||||||
{
|
{
|
||||||
if (MRole.getDefault().isShowPreference())
|
if (MRole.getDefault().isShowPreference() && gridField != null && !gridField.isEncrypted() && !gridField.isEncryptedColumn())
|
||||||
ValuePreference.start (this.getGridField(), getValue());
|
ValuePreference.start (this.getGridField(), getValue());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue