IDEMPIERE-17 Value Preference window showing encrypted content to user. Obscure and encrypted field shouldn't have value preference menu. Refactor context menu implementation for field editor.
(transplanted from ac1d6dccd43a8fd11c5d4d30572990614209c1a2)
This commit is contained in:
parent
97896c1550
commit
8c13dbc2fb
|
@ -45,8 +45,6 @@ public class WAccountEditor extends WEditor implements ContextMenuListener
|
|||
|
||||
private Object m_value;
|
||||
|
||||
private WEditorPopupMenu popupMenu;
|
||||
|
||||
/** Logger */
|
||||
private static CLogger log = CLogger.getCLogger(WAccountEditor.class);
|
||||
|
||||
|
@ -59,10 +57,7 @@ public class WAccountEditor extends WEditor implements ContextMenuListener
|
|||
|
||||
popupMenu = new WEditorPopupMenu(false, false, true);
|
||||
popupMenu.addMenuListener(this);
|
||||
if (gridField != null && gridField.getGridTab() != null)
|
||||
{
|
||||
WFieldRecordInfo.addMenu(popupMenu);
|
||||
}
|
||||
addChangeLogMenu(popupMenu);
|
||||
getComponent().setContext(popupMenu.getId());
|
||||
}
|
||||
|
||||
|
@ -90,7 +85,7 @@ public class WAccountEditor extends WEditor implements ContextMenuListener
|
|||
{
|
||||
return getComponent().getText();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Button - Start Dialog
|
||||
*/
|
||||
|
|
|
@ -6,10 +6,14 @@ import java.text.DateFormat;
|
|||
import java.text.NumberFormat;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.adempiere.webui.apps.AEnv;
|
||||
import org.adempiere.webui.component.EditorBox;
|
||||
import org.adempiere.webui.event.ContextMenuEvent;
|
||||
import org.adempiere.webui.event.ContextMenuListener;
|
||||
import org.adempiere.webui.event.ValueChangeEvent;
|
||||
import org.adempiere.webui.window.InfoSchedule;
|
||||
import org.adempiere.webui.window.WAssignmentDialog;
|
||||
import org.adempiere.webui.window.WFieldRecordInfo;
|
||||
import org.compiere.model.GridField;
|
||||
import org.compiere.model.MResourceAssignment;
|
||||
import org.compiere.util.CLogger;
|
||||
|
@ -19,7 +23,7 @@ import org.compiere.util.Env;
|
|||
import org.zkoss.zk.ui.event.Event;
|
||||
import org.zkoss.zk.ui.event.Events;
|
||||
|
||||
public class WAssignmentEditor extends WEditor {
|
||||
public class WAssignmentEditor extends WEditor implements ContextMenuListener {
|
||||
|
||||
private final static CLogger log = CLogger.getCLogger(WAssignmentEditor.class);
|
||||
|
||||
|
@ -31,7 +35,7 @@ public class WAssignmentEditor extends WEditor {
|
|||
|
||||
private DateFormat m_dateFormat = DisplayType.getDateFormat(DisplayType.DateTime);
|
||||
private NumberFormat m_qtyFormat = DisplayType.getNumberFormat(DisplayType.Quantity);
|
||||
|
||||
|
||||
public WAssignmentEditor(GridField gridField) {
|
||||
super(new EditorBox(), gridField);
|
||||
|
||||
|
@ -41,6 +45,11 @@ public class WAssignmentEditor extends WEditor {
|
|||
private void initComponents() {
|
||||
getComponent().getTextbox().setReadonly(true);
|
||||
getComponent().setButtonImage("images/Assignment10.png");
|
||||
|
||||
popupMenu = new WEditorPopupMenu(true, false, false);
|
||||
popupMenu.addMenuListener(this);
|
||||
addChangeLogMenu(popupMenu);
|
||||
getComponent().setContext(popupMenu.getId());
|
||||
}
|
||||
|
||||
|
||||
|
@ -123,7 +132,7 @@ public class WAssignmentEditor extends WEditor {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void onEvent(Event event) throws Exception {
|
||||
//
|
||||
if (Events.ON_CLICK.equalsIgnoreCase(event.getName()))
|
||||
|
@ -163,4 +172,20 @@ public class WAssignmentEditor extends WEditor {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMenu(ContextMenuEvent evt) {
|
||||
if (WEditorPopupMenu.CHANGE_LOG_EVENT.equals(evt.getContextEvent()))
|
||||
{
|
||||
WFieldRecordInfo.start(gridField);
|
||||
} else if (WEditorPopupMenu.ZOOM_EVENT.equals(evt.getContextEvent()))
|
||||
{
|
||||
actionZoom();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void actionZoom() {
|
||||
AEnv.zoom(gridField.getGridTab().getAD_Table_ID(), (Integer)getValue());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ package org.adempiere.webui.editor;
|
|||
import java.sql.Timestamp;
|
||||
import java.util.Date;
|
||||
|
||||
import org.adempiere.webui.apps.AEnv;
|
||||
import org.adempiere.webui.ValuePreference;
|
||||
import org.adempiere.webui.component.Datebox;
|
||||
import org.adempiere.webui.event.ContextMenuEvent;
|
||||
import org.adempiere.webui.event.ContextMenuListener;
|
||||
|
@ -28,8 +28,6 @@ import org.adempiere.webui.event.ValueChangeEvent;
|
|||
import org.adempiere.webui.window.WFieldRecordInfo;
|
||||
import org.compiere.model.GridField;
|
||||
import org.compiere.util.CLogger;
|
||||
import org.compiere.util.DisplayType;
|
||||
import org.compiere.util.Env;
|
||||
import org.zkoss.zk.ui.event.Event;
|
||||
import org.zkoss.zk.ui.event.Events;
|
||||
|
||||
|
@ -51,8 +49,7 @@ public class WDateEditor extends WEditor implements ContextMenuListener
|
|||
}
|
||||
|
||||
private Timestamp oldValue = new Timestamp(0);
|
||||
private WEditorPopupMenu popupMenu;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param gridField
|
||||
|
@ -106,15 +103,13 @@ public class WDateEditor extends WEditor implements ContextMenuListener
|
|||
|
||||
private void init()
|
||||
{
|
||||
popupMenu = new WEditorPopupMenu(false, false, true);
|
||||
popupMenu = new WEditorPopupMenu(false, false, isShowPreference());
|
||||
popupMenu.addMenuListener(this);
|
||||
if (gridField != null && gridField.getGridTab() != null)
|
||||
{
|
||||
WFieldRecordInfo.addMenu(popupMenu);
|
||||
}
|
||||
addChangeLogMenu(popupMenu);
|
||||
getComponent().setContext(popupMenu.getId());
|
||||
}
|
||||
|
||||
|
||||
public void onEvent(Event event)
|
||||
{
|
||||
if (Events.ON_CHANGE.equalsIgnoreCase(event.getName()) || Events.ON_OK.equalsIgnoreCase(event.getName()))
|
||||
|
@ -209,6 +204,12 @@ public class WDateEditor extends WEditor implements ContextMenuListener
|
|||
{
|
||||
WFieldRecordInfo.start(gridField);
|
||||
}
|
||||
else if (WEditorPopupMenu.PREFERENCE_EVENT.equals(evt.getContextEvent()) && gridField != null)
|
||||
{
|
||||
if (isShowPreference())
|
||||
ValuePreference.start (this.getGridField(), getValue());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@ package org.adempiere.webui.editor;
|
|||
import java.sql.Timestamp;
|
||||
import java.util.Date;
|
||||
|
||||
import org.adempiere.webui.ValuePreference;
|
||||
import org.adempiere.webui.component.DatetimeBox;
|
||||
import org.adempiere.webui.event.ContextMenuEvent;
|
||||
import org.adempiere.webui.event.ContextMenuListener;
|
||||
|
@ -22,7 +23,6 @@ import org.adempiere.webui.event.ValueChangeEvent;
|
|||
import org.adempiere.webui.window.WFieldRecordInfo;
|
||||
import org.compiere.model.GridField;
|
||||
import org.compiere.util.CLogger;
|
||||
import org.compiere.util.DisplayType;
|
||||
import org.zkoss.zk.ui.event.Event;
|
||||
import org.zkoss.zk.ui.event.Events;
|
||||
|
||||
|
@ -42,7 +42,6 @@ public class WDatetimeEditor extends WEditor implements ContextMenuListener
|
|||
}
|
||||
|
||||
private Timestamp oldValue = new Timestamp(0);
|
||||
private WEditorPopupMenu popupMenu;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -98,12 +97,9 @@ public class WDatetimeEditor extends WEditor implements ContextMenuListener
|
|||
|
||||
private void init()
|
||||
{
|
||||
popupMenu = new WEditorPopupMenu(false, false, true);
|
||||
popupMenu = new WEditorPopupMenu(false, false, isShowPreference());
|
||||
popupMenu.addMenuListener(this);
|
||||
if (gridField != null && gridField.getGridTab() != null)
|
||||
{
|
||||
WFieldRecordInfo.addMenu(popupMenu);
|
||||
}
|
||||
addChangeLogMenu(popupMenu);
|
||||
getComponent().setContext(popupMenu.getId());
|
||||
}
|
||||
|
||||
|
@ -200,6 +196,12 @@ public class WDatetimeEditor extends WEditor implements ContextMenuListener
|
|||
if (WEditorPopupMenu.CHANGE_LOG_EVENT.equals(evt.getContextEvent()))
|
||||
{
|
||||
WFieldRecordInfo.start(gridField);
|
||||
}
|
||||
else if (WEditorPopupMenu.PREFERENCE_EVENT.equals(evt.getContextEvent()))
|
||||
{
|
||||
if (isShowPreference())
|
||||
ValuePreference.start (this.getGridField(), getValue());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -29,15 +29,20 @@ import org.adempiere.webui.component.Datebox;
|
|||
import org.adempiere.webui.component.Label;
|
||||
import org.adempiere.webui.event.ValueChangeEvent;
|
||||
import org.adempiere.webui.event.ValueChangeListener;
|
||||
import org.adempiere.webui.window.WFieldRecordInfo;
|
||||
import org.compiere.model.GridField;
|
||||
import org.compiere.model.GridTab;
|
||||
import org.compiere.model.MRole;
|
||||
import org.compiere.util.DisplayType;
|
||||
import org.compiere.util.Env;
|
||||
import org.compiere.util.Msg;
|
||||
import org.zkoss.zk.ui.Component;
|
||||
import org.zkoss.zk.ui.HtmlBasedComponent;
|
||||
import org.zkoss.zk.ui.event.Event;
|
||||
import org.zkoss.zk.ui.event.EventListener;
|
||||
import org.zkoss.zk.ui.event.Events;
|
||||
import org.zkoss.zul.Image;
|
||||
import org.zkoss.zul.Menuitem;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -74,6 +79,8 @@ public abstract class WEditor implements EventListener, PropertyChangeListener
|
|||
private String columnName;
|
||||
|
||||
protected boolean hasFocus;
|
||||
|
||||
protected WEditorPopupMenu popupMenu;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -293,7 +300,7 @@ public abstract class WEditor implements EventListener, PropertyChangeListener
|
|||
*/
|
||||
public WEditorPopupMenu getPopupMenu()
|
||||
{
|
||||
return null;
|
||||
return popupMenu;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -511,7 +518,34 @@ public abstract class WEditor implements EventListener, PropertyChangeListener
|
|||
}
|
||||
}
|
||||
|
||||
private static final String STYLE_ZOOMABLE_LABEL = "cursor: pointer; text-decoration: underline;";
|
||||
/**
|
||||
* @return boolean
|
||||
*/
|
||||
protected boolean isShowPreference() {
|
||||
return MRole.getDefault().isShowPreference() && gridField != null && !gridField.isEncrypted() && !gridField.isEncryptedColumn();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param popupMenu
|
||||
*/
|
||||
protected void addChangeLogMenu(WEditorPopupMenu popupMenu) {
|
||||
if (popupMenu != null && gridField != null && gridField.getGridTab() != null)
|
||||
{
|
||||
WFieldRecordInfo.addMenu(popupMenu);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param popupMenu
|
||||
*/
|
||||
protected void addTextEditorMenu(WEditorPopupMenu popupMenu) {
|
||||
Menuitem editor = new Menuitem(Msg.getMsg(Env.getCtx(), "Editor"), "images/Editor16.png");
|
||||
editor.setAttribute("EVENT", WEditorPopupMenu.EDITOR_EVENT);
|
||||
editor.addEventListener(Events.ON_CLICK, popupMenu);
|
||||
popupMenu.appendChild(editor);
|
||||
}
|
||||
|
||||
private static final String STYLE_ZOOMABLE_LABEL = "cursor: pointer; text-decoration: underline;";
|
||||
private static final String STYLE_NORMAL_LABEL = "color: black;";
|
||||
private static final String STYLE_EMPTY_MANDATORY_LABEL = "color: red;";
|
||||
}
|
||||
|
|
|
@ -49,6 +49,7 @@ public class WEditorPopupMenu extends Menupopup implements EventListener
|
|||
public static final String NEW_EVENT = "NEW_RECORD";
|
||||
public static final String UPDATE_EVENT = "UPDATE_RECORD"; // Elaine 2009/02/16 - update record
|
||||
public static final String CHANGE_LOG_EVENT = "CHANGE_LOG";
|
||||
public static final String EDITOR_EVENT = "EDITOR";
|
||||
|
||||
private boolean newEnabled = true;
|
||||
private boolean updateEnabled = true; // Elaine 2009/02/16 - update record
|
||||
|
|
|
@ -20,6 +20,7 @@ package org.adempiere.webui.editor;
|
|||
import java.beans.PropertyChangeEvent;
|
||||
import java.beans.PropertyChangeListener;
|
||||
|
||||
import org.adempiere.webui.ValuePreference;
|
||||
import org.adempiere.webui.apps.AEnv;
|
||||
import org.adempiere.webui.component.Locationbox;
|
||||
import org.adempiere.webui.event.ContextMenuEvent;
|
||||
|
@ -51,8 +52,6 @@ public class WLocationEditor extends WEditor implements EventListener, PropertyC
|
|||
private MLocationLookup m_Location;
|
||||
private MLocation m_value;
|
||||
|
||||
private WEditorPopupMenu popupMenu;
|
||||
|
||||
/**
|
||||
* Constructor without GridField
|
||||
* @param columnName column name
|
||||
|
@ -85,12 +84,9 @@ public class WLocationEditor extends WEditor implements EventListener, PropertyC
|
|||
{
|
||||
getComponent().setButtonImage("/images/Location10.png");
|
||||
|
||||
popupMenu = new WEditorPopupMenu(false, false, true);
|
||||
popupMenu = new WEditorPopupMenu(false, false, isShowPreference());
|
||||
popupMenu.addMenuListener(this);
|
||||
if (gridField != null && gridField.getGridTab() != null)
|
||||
{
|
||||
WFieldRecordInfo.addMenu(popupMenu);
|
||||
}
|
||||
addChangeLogMenu(popupMenu);
|
||||
getComponent().setContext(popupMenu.getId());
|
||||
}
|
||||
|
||||
|
@ -207,5 +203,10 @@ public class WLocationEditor extends WEditor implements EventListener, PropertyC
|
|||
{
|
||||
WFieldRecordInfo.start(gridField);
|
||||
}
|
||||
else if (WEditorPopupMenu.PREFERENCE_EVENT.equals(evt.getContextEvent()))
|
||||
{
|
||||
if (isShowPreference())
|
||||
ValuePreference.start (this.getGridField(), getValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@ import java.sql.ResultSet;
|
|||
import java.sql.SQLException;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.adempiere.webui.ValuePreference;
|
||||
import org.adempiere.webui.apps.AEnv;
|
||||
import org.adempiere.webui.component.EditorBox;
|
||||
import org.adempiere.webui.event.ContextMenuEvent;
|
||||
|
@ -61,8 +62,6 @@ public class WLocatorEditor extends WEditor implements EventListener, PropertyCh
|
|||
private Object m_value;
|
||||
private int m_WindowNo;
|
||||
|
||||
private WEditorPopupMenu popupMenu;
|
||||
|
||||
private static CLogger log = CLogger.getCLogger(WLocatorEditor.class);
|
||||
/**
|
||||
* IDE Constructor
|
||||
|
@ -113,11 +112,8 @@ public class WLocatorEditor extends WEditor implements EventListener, PropertyCh
|
|||
|
||||
if (gridField != null)
|
||||
{
|
||||
popupMenu = new WEditorPopupMenu(true, true, false);
|
||||
if (gridField != null && gridField.getGridTab() != null)
|
||||
{
|
||||
WFieldRecordInfo.addMenu(popupMenu);
|
||||
}
|
||||
popupMenu = new WEditorPopupMenu(true, true, isShowPreference());
|
||||
addChangeLogMenu(popupMenu);
|
||||
getComponent().setContext(popupMenu.getId());
|
||||
}
|
||||
}
|
||||
|
@ -254,11 +250,6 @@ public class WLocatorEditor extends WEditor implements EventListener, PropertyCh
|
|||
}
|
||||
}
|
||||
|
||||
public WEditorPopupMenu getPopupMenu()
|
||||
{
|
||||
return popupMenu;
|
||||
}
|
||||
|
||||
public void actionRefresh()
|
||||
{
|
||||
if (m_mLocator != null)
|
||||
|
@ -302,6 +293,11 @@ public class WLocatorEditor extends WEditor implements EventListener, PropertyCh
|
|||
else if (WEditorPopupMenu.CHANGE_LOG_EVENT.equals(evt.getContextEvent()))
|
||||
{
|
||||
WFieldRecordInfo.start(gridField);
|
||||
}
|
||||
else if (WEditorPopupMenu.PREFERENCE_EVENT.equals(evt.getContextEvent()))
|
||||
{
|
||||
if (isShowPreference())
|
||||
ValuePreference.start (this.getGridField(), getValue());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -28,7 +28,6 @@ import org.adempiere.webui.event.ContextMenuListener;
|
|||
import org.adempiere.webui.event.ValueChangeEvent;
|
||||
import org.adempiere.webui.window.WFieldRecordInfo;
|
||||
import org.compiere.model.GridField;
|
||||
import org.compiere.model.MRole;
|
||||
import org.compiere.util.DisplayType;
|
||||
import org.compiere.util.Env;
|
||||
import org.zkoss.zk.ui.event.Event;
|
||||
|
@ -56,8 +55,6 @@ public class WNumberEditor extends WEditor implements ContextMenuListener
|
|||
|
||||
private int displayType;
|
||||
|
||||
private WEditorPopupMenu popupMenu;
|
||||
|
||||
public WNumberEditor()
|
||||
{
|
||||
this("Number", false, false, true, DisplayType.Number, "");
|
||||
|
@ -123,25 +120,11 @@ public class WNumberEditor extends WEditor implements ContextMenuListener
|
|||
DecimalFormat format = DisplayType.getNumberFormat(displayType, AEnv.getLanguage(Env.getCtx()));
|
||||
getComponent().getDecimalbox().setFormat(format.toPattern());
|
||||
|
||||
boolean valuePreference = false;
|
||||
if (gridField != null && !gridField.isEncrypted() && !gridField.isEncryptedColumn())
|
||||
{
|
||||
valuePreference = true;
|
||||
}
|
||||
popupMenu = new WEditorPopupMenu(false, false, valuePreference);
|
||||
if (gridField != null && gridField.getGridTab() != null)
|
||||
{
|
||||
WFieldRecordInfo.addMenu(popupMenu);
|
||||
}
|
||||
popupMenu = new WEditorPopupMenu(false, false, isShowPreference());
|
||||
addChangeLogMenu(popupMenu);
|
||||
getComponent().setContext(popupMenu.getId());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public WEditorPopupMenu getPopupMenu() {
|
||||
return popupMenu;
|
||||
}
|
||||
|
||||
/**
|
||||
* Event handler
|
||||
* @param event
|
||||
|
@ -228,9 +211,9 @@ public class WNumberEditor extends WEditor implements ContextMenuListener
|
|||
*/
|
||||
public void onMenu(ContextMenuEvent evt)
|
||||
{
|
||||
if (WEditorPopupMenu.PREFERENCE_EVENT.equals(evt.getContextEvent()) && gridField != null)
|
||||
if (WEditorPopupMenu.PREFERENCE_EVENT.equals(evt.getContextEvent()))
|
||||
{
|
||||
if (MRole.getDefault().isShowPreference() && !gridField.isEncrypted() && !gridField.isEncryptedColumn())
|
||||
if (isShowPreference())
|
||||
ValuePreference.start (this.getGridField(), getValue());
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -49,8 +49,6 @@ public class WPAttributeEditor extends WEditor implements ContextMenuListener
|
|||
|
||||
private int m_C_BPartner_ID;
|
||||
|
||||
private WEditorPopupMenu popupMenu;
|
||||
|
||||
private Object m_value;
|
||||
|
||||
private GridTab m_GridTab;
|
||||
|
@ -76,19 +74,11 @@ public class WPAttributeEditor extends WEditor implements ContextMenuListener
|
|||
// Popup
|
||||
popupMenu = new WEditorPopupMenu(true, false, false);
|
||||
getComponent().getTextbox().setContext(popupMenu.getId());
|
||||
if (gridField != null && gridField.getGridTab() != null)
|
||||
{
|
||||
WFieldRecordInfo.addMenu(popupMenu);
|
||||
}
|
||||
addChangeLogMenu(popupMenu);
|
||||
|
||||
getComponent().getTextbox().setReadonly(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public WEditorPopupMenu getPopupMenu() {
|
||||
return popupMenu;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PAttributebox getComponent()
|
||||
{
|
||||
|
|
|
@ -61,7 +61,6 @@ public class WSearchEditor extends WEditor implements ContextMenuListener, Value
|
|||
private String m_tableName = null;
|
||||
private String m_keyColumnName = null;
|
||||
private String columnName;
|
||||
private WEditorPopupMenu popupMenu;
|
||||
private Object value;
|
||||
private InfoPanel infoPanel = null;
|
||||
|
||||
|
@ -147,41 +146,28 @@ public class WSearchEditor extends WEditor implements ContextMenuListener, Value
|
|||
{
|
||||
|
||||
columnName = this.getColumnName();
|
||||
boolean valuePreference = false;
|
||||
if (gridField != null && !gridField.isEncrypted() && !gridField.isEncryptedColumn())
|
||||
{
|
||||
valuePreference = true;
|
||||
}
|
||||
if (columnName.equals("C_BPartner_ID"))
|
||||
{
|
||||
popupMenu = new WEditorPopupMenu(true, true, valuePreference, true, true);
|
||||
popupMenu = new WEditorPopupMenu(true, true, isShowPreference(), true, true);
|
||||
getComponent().setButtonImage("/images/BPartner10.png");
|
||||
}
|
||||
else if (columnName.equals("M_Product_ID"))
|
||||
{
|
||||
popupMenu = new WEditorPopupMenu(true, true, valuePreference, false, false);
|
||||
popupMenu = new WEditorPopupMenu(true, true, isShowPreference(), false, false);
|
||||
getComponent().setButtonImage("/images/Product10.png");
|
||||
}
|
||||
else
|
||||
{
|
||||
popupMenu = new WEditorPopupMenu(true, true, valuePreference, false, false);
|
||||
popupMenu = new WEditorPopupMenu(true, true, isShowPreference(), false, false);
|
||||
getComponent().setButtonImage("/images/PickOpen10.png");
|
||||
}
|
||||
|
||||
getComponent().getTextbox().setContext(popupMenu.getId());
|
||||
if (gridField != null && gridField.getGridTab() != null)
|
||||
{
|
||||
WFieldRecordInfo.addMenu(popupMenu);
|
||||
}
|
||||
addChangeLogMenu(popupMenu);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
public WEditorPopupMenu getPopupMenu()
|
||||
{
|
||||
return popupMenu;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setValue(Object value)
|
||||
{
|
||||
|
@ -282,7 +268,7 @@ public class WSearchEditor extends WEditor implements ContextMenuListener, Value
|
|||
}
|
||||
else if (WEditorPopupMenu.PREFERENCE_EVENT.equals(evt.getContextEvent()))
|
||||
{
|
||||
if (MRole.getDefault().isShowPreference() && gridField != null && !gridField.isEncrypted() && !gridField.isEncryptedColumn())
|
||||
if (isShowPreference())
|
||||
ValuePreference.start (this.getGridField(), getValue());
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -30,13 +30,9 @@ import org.adempiere.webui.session.SessionManager;
|
|||
import org.adempiere.webui.window.WFieldRecordInfo;
|
||||
import org.adempiere.webui.window.WTextEditorDialog;
|
||||
import org.compiere.model.GridField;
|
||||
import org.compiere.model.MRole;
|
||||
import org.compiere.util.DisplayType;
|
||||
import org.compiere.util.Env;
|
||||
import org.compiere.util.Msg;
|
||||
import org.zkoss.zk.ui.event.Event;
|
||||
import org.zkoss.zk.ui.event.Events;
|
||||
import org.zkoss.zul.Menuitem;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -46,14 +42,10 @@ import org.zkoss.zul.Menuitem;
|
|||
*/
|
||||
public class WStringEditor extends WEditor implements ContextMenuListener
|
||||
{
|
||||
private static final String EDITOR_EVENT = "EDITOR";
|
||||
|
||||
private static final String[] LISTENER_EVENTS = {Events.ON_CHANGE, Events.ON_OK};
|
||||
|
||||
private String oldValue;
|
||||
|
||||
private WEditorPopupMenu popupMenu;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private boolean tableEditor = false;
|
||||
|
||||
|
@ -141,21 +133,9 @@ public class WStringEditor extends WEditor implements ContextMenuListener
|
|||
if (getComponent() instanceof Textbox)
|
||||
((Textbox)getComponent()).setObscureType(obscureType);
|
||||
|
||||
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");
|
||||
editor.setAttribute("EVENT", EDITOR_EVENT);
|
||||
editor.addEventListener(Events.ON_CLICK, popupMenu);
|
||||
popupMenu.appendChild(editor);
|
||||
|
||||
if (gridField != null && gridField.getGridTab() != null)
|
||||
{
|
||||
WFieldRecordInfo.addMenu(popupMenu);
|
||||
}
|
||||
popupMenu = new WEditorPopupMenu(false, false, isShowPreference());
|
||||
addTextEditorMenu(popupMenu);
|
||||
addChangeLogMenu(popupMenu);
|
||||
|
||||
getComponent().setContext(popupMenu.getId());
|
||||
|
||||
|
@ -172,7 +152,7 @@ public class WStringEditor extends WEditor implements ContextMenuListener
|
|||
}
|
||||
}
|
||||
|
||||
public void onEvent(Event event)
|
||||
public void onEvent(Event event)
|
||||
{
|
||||
if (Events.ON_CHANGE.equals(event.getName()) || Events.ON_OK.equals(event.getName()))
|
||||
{
|
||||
|
@ -233,20 +213,15 @@ public class WStringEditor extends WEditor implements ContextMenuListener
|
|||
return LISTENER_EVENTS;
|
||||
}
|
||||
|
||||
public WEditorPopupMenu getPopupMenu()
|
||||
{
|
||||
return popupMenu;
|
||||
}
|
||||
|
||||
public void onMenu(ContextMenuEvent evt)
|
||||
{
|
||||
if (WEditorPopupMenu.PREFERENCE_EVENT.equals(evt.getContextEvent()))
|
||||
{
|
||||
if (MRole.getDefault().isShowPreference() && gridField != null && !gridField.isEncrypted() && !gridField.isEncryptedColumn())
|
||||
if (isShowPreference())
|
||||
ValuePreference.start (this.getGridField(), getValue());
|
||||
return;
|
||||
}
|
||||
else if (EDITOR_EVENT.equals(evt.getContextEvent()))
|
||||
else if (WEditorPopupMenu.EDITOR_EVENT.equals(evt.getContextEvent()))
|
||||
{
|
||||
WTextEditorDialog dialog = new WTextEditorDialog(this.getColumnName(), getDisplay(),
|
||||
isReadWrite(), gridField.getFieldLength());
|
||||
|
|
|
@ -31,7 +31,6 @@ import org.adempiere.webui.event.ValueChangeEvent;
|
|||
import org.adempiere.webui.window.WFieldRecordInfo;
|
||||
import org.compiere.model.GridField;
|
||||
import org.compiere.model.Lookup;
|
||||
import org.compiere.model.MRole;
|
||||
import org.compiere.util.CLogger;
|
||||
import org.compiere.util.DisplayType;
|
||||
import org.compiere.util.Env;
|
||||
|
@ -63,7 +62,6 @@ ContextMenuListener, IZoomableEditor
|
|||
|
||||
private Lookup lookup;
|
||||
private Object oldValue;
|
||||
private WEditorPopupMenu popupMenu;
|
||||
|
||||
public WTableDirEditor(GridField gridField)
|
||||
{
|
||||
|
@ -144,16 +142,8 @@ ContextMenuListener, IZoomableEditor
|
|||
|
||||
if (gridField != null)
|
||||
{
|
||||
boolean valuePreference = false;
|
||||
if (!gridField.isEncrypted() && !gridField.isEncryptedColumn())
|
||||
{
|
||||
valuePreference = true;
|
||||
}
|
||||
popupMenu = new WEditorPopupMenu(zoom, true, valuePreference);
|
||||
if (gridField != null && gridField.getGridTab() != null)
|
||||
{
|
||||
WFieldRecordInfo.addMenu(popupMenu);
|
||||
}
|
||||
popupMenu = new WEditorPopupMenu(zoom, true, isShowPreference());
|
||||
addChangeLogMenu(popupMenu);
|
||||
getComponent().setContext(popupMenu.getId());
|
||||
}
|
||||
}
|
||||
|
@ -364,11 +354,6 @@ ContextMenuListener, IZoomableEditor
|
|||
public void intervalRemoved(ListDataEvent e)
|
||||
{}
|
||||
|
||||
public WEditorPopupMenu getPopupMenu()
|
||||
{
|
||||
return popupMenu;
|
||||
}
|
||||
|
||||
public void actionRefresh()
|
||||
{
|
||||
if (lookup != null)
|
||||
|
@ -405,7 +390,7 @@ ContextMenuListener, IZoomableEditor
|
|||
}
|
||||
else if (WEditorPopupMenu.PREFERENCE_EVENT.equals(evt.getContextEvent()))
|
||||
{
|
||||
if (MRole.getDefault().isShowPreference() && gridField != null && !gridField.isEncrypted() && !gridField.isEncryptedColumn())
|
||||
if (isShowPreference())
|
||||
ValuePreference.start (this.getGridField(), getValue());
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -17,6 +17,7 @@ import java.sql.Timestamp;
|
|||
import java.util.Date;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.adempiere.webui.ValuePreference;
|
||||
import org.adempiere.webui.event.ContextMenuEvent;
|
||||
import org.adempiere.webui.event.ContextMenuListener;
|
||||
import org.adempiere.webui.event.ValueChangeEvent;
|
||||
|
@ -42,7 +43,6 @@ public class WTimeEditor extends WEditor implements ContextMenuListener
|
|||
}
|
||||
|
||||
private Timestamp oldValue = new Timestamp(0);
|
||||
private WEditorPopupMenu popupMenu;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -98,12 +98,9 @@ public class WTimeEditor extends WEditor implements ContextMenuListener
|
|||
|
||||
private void init()
|
||||
{
|
||||
popupMenu = new WEditorPopupMenu(false, false, true);
|
||||
popupMenu = new WEditorPopupMenu(false, false, isShowPreference());
|
||||
popupMenu.addMenuListener(this);
|
||||
if (gridField != null && gridField.getGridTab() != null)
|
||||
{
|
||||
WFieldRecordInfo.addMenu(popupMenu);
|
||||
}
|
||||
addChangeLogMenu(popupMenu);
|
||||
getComponent().setContext(popupMenu.getId());
|
||||
}
|
||||
|
||||
|
@ -200,5 +197,12 @@ public class WTimeEditor extends WEditor implements ContextMenuListener
|
|||
{
|
||||
WFieldRecordInfo.start(gridField);
|
||||
}
|
||||
else if (WEditorPopupMenu.PREFERENCE_EVENT.equals(evt.getContextEvent()))
|
||||
{
|
||||
if (isShowPreference())
|
||||
ValuePreference.start (this.getGridField(), getValue());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
|
||||
package org.adempiere.webui.editor;
|
||||
|
||||
import org.adempiere.webui.ValuePreference;
|
||||
import org.adempiere.webui.component.Urlbox;
|
||||
import org.adempiere.webui.event.ContextMenuEvent;
|
||||
import org.adempiere.webui.event.ContextMenuListener;
|
||||
|
@ -32,19 +33,15 @@ public class WUrlEditor extends WEditor implements ContextMenuListener
|
|||
{
|
||||
private static final String[] LISTENER_EVENTS = {Events.ON_CLICK, Events.ON_CHANGE, Events.ON_OK};
|
||||
private String oldValue;
|
||||
private WEditorPopupMenu popupMenu;
|
||||
|
||||
public WUrlEditor(GridField gridField)
|
||||
{
|
||||
super(new Urlbox(), gridField);
|
||||
getComponent().setButtonImage("/images/Online10.png");
|
||||
|
||||
popupMenu = new WEditorPopupMenu(false, false, true);
|
||||
popupMenu = new WEditorPopupMenu(false, false, isShowPreference());
|
||||
popupMenu.addMenuListener(this);
|
||||
if (gridField != null && gridField.getGridTab() != null)
|
||||
{
|
||||
WFieldRecordInfo.addMenu(popupMenu);
|
||||
}
|
||||
addChangeLogMenu(popupMenu);
|
||||
getComponent().setContext(popupMenu.getId());
|
||||
}
|
||||
|
||||
|
@ -143,6 +140,11 @@ public class WUrlEditor extends WEditor implements ContextMenuListener
|
|||
{
|
||||
WFieldRecordInfo.start(gridField);
|
||||
}
|
||||
else if (WEditorPopupMenu.PREFERENCE_EVENT.equals(evt.getContextEvent()))
|
||||
{
|
||||
if (isShowPreference())
|
||||
ValuePreference.start(getGridField(), getValue());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@ package org.adempiere.webui.editor;
|
|||
import java.beans.PropertyChangeEvent;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.adempiere.webui.ValuePreference;
|
||||
import org.adempiere.webui.component.Checkbox;
|
||||
import org.adempiere.webui.event.ContextMenuEvent;
|
||||
import org.adempiere.webui.event.ContextMenuListener;
|
||||
|
@ -49,7 +50,6 @@ public class WYesNoEditor extends WEditor implements ContextMenuListener
|
|||
}
|
||||
|
||||
private boolean oldValue = false;
|
||||
private WEditorPopupMenu popupMenu;
|
||||
|
||||
public WYesNoEditor(GridField gridField)
|
||||
{
|
||||
|
@ -73,16 +73,13 @@ public class WYesNoEditor extends WEditor implements ContextMenuListener
|
|||
label.setValue("");
|
||||
label.setTooltiptext("");
|
||||
|
||||
popupMenu = new WEditorPopupMenu(false, false, true);
|
||||
popupMenu = new WEditorPopupMenu(false, false, isShowPreference());
|
||||
popupMenu.addMenuListener(this);
|
||||
if (gridField != null && gridField.getGridTab() != null)
|
||||
{
|
||||
WFieldRecordInfo.addMenu(popupMenu);
|
||||
}
|
||||
addChangeLogMenu(popupMenu);
|
||||
getComponent().setContext(popupMenu.getId());
|
||||
}
|
||||
|
||||
public void onEvent(Event event)
|
||||
public void onEvent(Event event)
|
||||
{
|
||||
if (Events.ON_CHECK.equalsIgnoreCase(event.getName()))
|
||||
{
|
||||
|
@ -167,6 +164,11 @@ public class WYesNoEditor extends WEditor implements ContextMenuListener
|
|||
{
|
||||
WFieldRecordInfo.start(gridField);
|
||||
}
|
||||
else if (WEditorPopupMenu.PREFERENCE_EVENT.equals(evt.getContextEvent()))
|
||||
{
|
||||
if (isShowPreference())
|
||||
ValuePreference.start(getGridField(), getValue());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue