[2617321] No 'Update' option for business partner context menu

This commit is contained in:
Heng Sin Low 2009-02-20 04:25:04 +00:00
parent 03d627444d
commit 5997b39259
2 changed files with 36 additions and 5 deletions

View File

@ -42,8 +42,10 @@ public class WEditorPopupMenu extends Menupopup implements EventListener
public static final String REQUERY_EVENT = "REQUERY";
public static final String PREFERENCE_EVENT = "VALUE_PREFERENCE";
public static final String NEW_EVENT = "NEW_RECORD";
public static final String UPDATE_EVENT = "UPDATE_RECORD"; // Elaine 2009/02/16 - update record
private boolean newEnabled = true;
private boolean updateEnabled = true; // Elaine 2009/02/16 - update record
private boolean zoomEnabled = true;
private boolean requeryEnabled = true;
private boolean preferencesEnabled = true;
@ -52,22 +54,28 @@ public class WEditorPopupMenu extends Menupopup implements EventListener
private Menuitem requeryItem;
private Menuitem prefItem;
private Menuitem newItem;
private Menuitem updateItem; // Elaine 2009/02/16 - update record
private ArrayList<ContextMenuListener> menuListeners = new ArrayList<ContextMenuListener>();
public WEditorPopupMenu(boolean zoom, boolean requery, boolean preferences)
{
this(zoom, requery, preferences, false);
this(zoom, requery, preferences, false, false);
}
public WEditorPopupMenu(boolean zoom, boolean requery, boolean preferences, boolean newRecord)
{
this(zoom, requery, preferences, newRecord, false);
}
public WEditorPopupMenu(boolean zoom, boolean requery, boolean preferences, boolean newRecord, boolean updateRecord)
{
super();
this.zoomEnabled = zoom;
this.requeryEnabled = requery;
this.preferencesEnabled = preferences;
this.newEnabled = newRecord;
this.updateEnabled = updateRecord; // Elaine 2009/02/16 - update record
init();
}
@ -117,6 +125,18 @@ public class WEditorPopupMenu extends Menupopup implements EventListener
newItem.addEventListener(Events.ON_CLICK, this);
this.appendChild(newItem);
}
// Elaine 2009/02/16 - update record
if (updateEnabled)
{
updateItem = new Menuitem();
updateItem.setAttribute(EVENT_ATTRIBUTE, UPDATE_EVENT);
updateItem.setLabel("Update Record");
updateItem.setImage("/images/InfoBPartner16.png");
updateItem.addEventListener(Events.ON_CLICK, this);
this.appendChild(updateItem);
}
//
}
public void addMenuListener(ContextMenuListener listener)

View File

@ -150,17 +150,17 @@ public class WSearchEditor extends WEditor implements ContextMenuListener, Value
if (columnName.equals("C_BPartner_ID"))
{
popupMenu = new WEditorPopupMenu(true, true, true, true);
popupMenu = new WEditorPopupMenu(true, true, true, true, true);
getComponent().setButtonImage("/images/BPartner10.png");
}
else if (columnName.equals("M_Product_ID"))
{
popupMenu = new WEditorPopupMenu(true, true, true, false);
popupMenu = new WEditorPopupMenu(true, true, true, false, false);
getComponent().setButtonImage("/images/Product10.png");
}
else
{
popupMenu = new WEditorPopupMenu(true, true, true, false);
popupMenu = new WEditorPopupMenu(true, true, true, false, false);
getComponent().setButtonImage("/images/PickOpen10.png");
}
@ -287,6 +287,17 @@ public class WSearchEditor extends WEditor implements ContextMenuListener, Value
}
actionBPartner(true);
}
// Elaine 2009/02/16 - update record
else if (WEditorPopupMenu.UPDATE_EVENT.equals(evt.getContextEvent()))
{
if (infoPanel != null)
{
infoPanel.detach();
infoPanel = null;
}
actionBPartner(false);
}
//
}
private void actionText(String text)