IDEMPIERE-29 Improvement on full location / Thanks to Yansolo for the idea and the swing implementation / extended for zkwebui
This commit is contained in:
parent
e34cbee678
commit
cf2bc53017
|
@ -0,0 +1,15 @@
|
|||
-- Aug 29, 2012 9:03:37 AM COT
|
||||
-- IDEMPIERE-29 Improvement on full location
|
||||
INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Client_ID,AD_Org_ID,Created) VALUES ('I','Show Location',200024,'D','9ddf0097-1eb7-4e6f-88a0-1dfdd6334097','ShowLocation','Y',TO_DATE('2012-08-29 09:03:36','YYYY-MM-DD HH24:MI:SS'),100,100,0,0,TO_DATE('2012-08-29 09:03:36','YYYY-MM-DD HH24:MI:SS'))
|
||||
;
|
||||
|
||||
-- Aug 29, 2012 9:03:37 AM COT
|
||||
-- IDEMPIERE-29 Improvement on full location
|
||||
INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Message_Trl_UU ) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=200024 AND NOT EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID)
|
||||
;
|
||||
|
||||
UPDATE AD_System
|
||||
SET LastMigrationScriptApplied='896_IDEMPIERE-29.sql'
|
||||
WHERE LastMigrationScriptApplied<'896_IDEMPIERE-29.sql'
|
||||
OR LastMigrationScriptApplied IS NULL
|
||||
;
|
|
@ -0,0 +1,15 @@
|
|||
-- Aug 29, 2012 9:03:37 AM COT
|
||||
-- IDEMPIERE-29 Improvement on full location
|
||||
INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Client_ID,AD_Org_ID,Created) VALUES ('I','Show Location',200024,'D','9ddf0097-1eb7-4e6f-88a0-1dfdd6334097','ShowLocation','Y',TO_TIMESTAMP('2012-08-29 09:03:36','YYYY-MM-DD HH24:MI:SS'),100,100,0,0,TO_TIMESTAMP('2012-08-29 09:03:36','YYYY-MM-DD HH24:MI:SS'))
|
||||
;
|
||||
|
||||
-- Aug 29, 2012 9:03:37 AM COT
|
||||
-- IDEMPIERE-29 Improvement on full location
|
||||
INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Message_Trl_UU ) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=200024 AND NOT EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID)
|
||||
;
|
||||
|
||||
UPDATE AD_System
|
||||
SET LastMigrationScriptApplied='896_IDEMPIERE-29.sql'
|
||||
WHERE LastMigrationScriptApplied<'896_IDEMPIERE-29.sql'
|
||||
OR LastMigrationScriptApplied IS NULL
|
||||
;
|
|
@ -16,6 +16,10 @@
|
|||
*****************************************************************************/
|
||||
package org.compiere.grid.ed;
|
||||
|
||||
import static org.compiere.model.SystemIDs.COLUMN_AD_WF_ACTIVITY_AD_USER_ID;
|
||||
import static org.compiere.model.SystemIDs.COLUMN_C_INVOICELINE_M_PRODUCT_ID;
|
||||
import static org.compiere.model.SystemIDs.COLUMN_C_INVOICE_C_BPARTNER_ID;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Color;
|
||||
import java.awt.Component;
|
||||
|
@ -54,11 +58,12 @@ import org.compiere.apps.FieldRecordInfo;
|
|||
import org.compiere.apps.search.Info;
|
||||
import org.compiere.model.GridField;
|
||||
import org.compiere.model.Lookup;
|
||||
import org.compiere.model.MBPartnerLocation;
|
||||
import org.compiere.model.MLocation;
|
||||
import org.compiere.model.MLookup;
|
||||
import org.compiere.model.MLookupFactory;
|
||||
import org.compiere.model.MQuery;
|
||||
import org.compiere.model.MRole;
|
||||
import static org.compiere.model.SystemIDs.*;
|
||||
import org.compiere.swing.CButton;
|
||||
import org.compiere.swing.CMenuItem;
|
||||
import org.compiere.swing.CTextField;
|
||||
|
@ -101,7 +106,7 @@ public class VLookup extends JComponent
|
|||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1307112072890929329L;
|
||||
private static final long serialVersionUID = -8609913311212365705L;
|
||||
|
||||
/*****************************************************************************
|
||||
* Mouse Listener for Popup Menu
|
||||
|
@ -315,6 +320,14 @@ public class VLookup extends JComponent
|
|||
mBPartnerUpd.addActionListener(this);
|
||||
popupMenu.add(mBPartnerUpd);
|
||||
}
|
||||
if ((columnName.toUpperCase().equals("C_BPARTNER_LOCATION_ID"))
|
||||
|| (columnName.toUpperCase().equals("BILL_LOCATION_ID"))
|
||||
|| (columnName.toUpperCase().equals("DROPSHIP_LOCATION_ID")))
|
||||
{
|
||||
m_location = new CMenuItem (Msg.getMsg(Env.getCtx(), "ShowLocation"), Env.getImageIcon("InfoBPartner16.gif"));
|
||||
m_location.addActionListener(this);
|
||||
popupMenu.add(m_location);
|
||||
}
|
||||
//
|
||||
if (m_lookup != null && m_lookup.getZoom() == 0)
|
||||
mZoom.setEnabled(false);
|
||||
|
@ -377,6 +390,7 @@ public class VLookup extends JComponent
|
|||
private CMenuItem mRefresh;
|
||||
private CMenuItem mBPartnerNew;
|
||||
private CMenuItem mBPartnerUpd;
|
||||
private CMenuItem m_location;
|
||||
// Mouse Listener
|
||||
private VLookup_mouseAdapter mouseAdapter;
|
||||
|
||||
|
@ -745,6 +759,8 @@ public class VLookup extends JComponent
|
|||
actionBPartner(true);
|
||||
else if (e.getSource() == mBPartnerUpd)
|
||||
actionBPartner(false);
|
||||
else if (e.getSource() == m_location)
|
||||
actionLocation();
|
||||
} // actionPerformed
|
||||
|
||||
/**
|
||||
|
@ -1279,6 +1295,24 @@ public class VLookup extends JComponent
|
|||
actionCombo (new Integer(result)); // data binding
|
||||
} // actionBPartner
|
||||
|
||||
private void actionLocation ()
|
||||
{
|
||||
int BPLocation_ID = 0;
|
||||
if (m_value instanceof Integer)
|
||||
BPLocation_ID = ((Integer)m_value).intValue();
|
||||
else if (m_value != null)
|
||||
BPLocation_ID = Integer.parseInt(m_value.toString());
|
||||
|
||||
if (BPLocation_ID>0)
|
||||
{
|
||||
MBPartnerLocation bpl = new MBPartnerLocation(Env.getCtx(), BPLocation_ID, null);
|
||||
MLocation location= new MLocation(Env.getCtx(), bpl.getC_Location_ID(), null);
|
||||
|
||||
VLocationDialog ld = new VLocationDialog(AEnv.getFrame(this), Msg.getMsg(Env.getCtx(), "C_Location_ID"), location);
|
||||
ld.setVisible(true);
|
||||
}
|
||||
} // actionBPartner
|
||||
|
||||
/**
|
||||
* Action - Zoom
|
||||
* @param selectedItem item
|
||||
|
|
|
@ -41,13 +41,14 @@ public class WEditorPopupMenu extends Menupopup implements EventListener<Event>
|
|||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 8172397145177408454L;
|
||||
private static final long serialVersionUID = 5813878069049398656L;
|
||||
public static final String EVENT_ATTRIBUTE = "EVENT";
|
||||
public static final String ZOOM_EVENT = "ZOOM";
|
||||
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
|
||||
public static final String SHOWLOCATION_EVENT = "SHOW_LOCATION";
|
||||
public static final String CHANGE_LOG_EVENT = "CHANGE_LOG";
|
||||
public static final String EDITOR_EVENT = "EDITOR";
|
||||
|
||||
|
@ -56,26 +57,33 @@ public class WEditorPopupMenu extends Menupopup implements EventListener<Event>
|
|||
private boolean zoomEnabled = true;
|
||||
private boolean requeryEnabled = true;
|
||||
private boolean preferencesEnabled = true;
|
||||
private boolean showLocation = true;
|
||||
|
||||
private Menuitem zoomItem;
|
||||
private Menuitem requeryItem;
|
||||
private Menuitem prefItem;
|
||||
private Menuitem newItem;
|
||||
private Menuitem updateItem; // Elaine 2009/02/16 - update record
|
||||
private Menuitem showLocationItem;
|
||||
|
||||
private ArrayList<ContextMenuListener> menuListeners = new ArrayList<ContextMenuListener>();
|
||||
|
||||
public WEditorPopupMenu(boolean zoom, boolean requery, boolean preferences)
|
||||
{
|
||||
this(zoom, requery, preferences, false, false);
|
||||
this(zoom, requery, preferences, false, false, false);
|
||||
}
|
||||
|
||||
public WEditorPopupMenu(boolean zoom, boolean requery, boolean preferences, boolean newRecord)
|
||||
{
|
||||
this(zoom, requery, preferences, newRecord, false);
|
||||
this(zoom, requery, preferences, newRecord, false, false);
|
||||
}
|
||||
|
||||
public WEditorPopupMenu(boolean zoom, boolean requery, boolean preferences, boolean newRecord, boolean updateRecord)
|
||||
{
|
||||
this(zoom, requery, preferences, newRecord, updateRecord, false);
|
||||
}
|
||||
|
||||
public WEditorPopupMenu(boolean zoom, boolean requery, boolean preferences, boolean newRecord, boolean updateRecord, boolean showLocation)
|
||||
{
|
||||
super();
|
||||
this.zoomEnabled = zoom;
|
||||
|
@ -83,6 +91,7 @@ public class WEditorPopupMenu extends Menupopup implements EventListener<Event>
|
|||
this.preferencesEnabled = preferences;
|
||||
this.newEnabled = newRecord;
|
||||
this.updateEnabled = updateRecord; // Elaine 2009/02/16 - update record
|
||||
this.showLocation = showLocation;
|
||||
init();
|
||||
}
|
||||
|
||||
|
@ -144,6 +153,15 @@ public class WEditorPopupMenu extends Menupopup implements EventListener<Event>
|
|||
this.appendChild(updateItem);
|
||||
}
|
||||
//
|
||||
if (showLocation)
|
||||
{
|
||||
showLocationItem = new Menuitem();
|
||||
showLocationItem.setAttribute(EVENT_ATTRIBUTE, SHOWLOCATION_EVENT);
|
||||
showLocationItem.setLabel(Util.cleanAmp(Msg.getMsg(Env.getCtx(), "ShowLocation")));
|
||||
showLocationItem.setImage("/images/InfoBPartner16.png");
|
||||
showLocationItem.addEventListener(Events.ON_CLICK, this);
|
||||
this.appendChild(showLocationItem);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -29,12 +29,16 @@ import org.adempiere.webui.event.ContextMenuEvent;
|
|||
import org.adempiere.webui.event.ContextMenuListener;
|
||||
import org.adempiere.webui.event.ValueChangeEvent;
|
||||
import org.adempiere.webui.window.WFieldRecordInfo;
|
||||
import org.adempiere.webui.window.WLocationDialog;
|
||||
import org.compiere.model.GridField;
|
||||
import org.compiere.model.Lookup;
|
||||
import org.compiere.model.MBPartnerLocation;
|
||||
import org.compiere.model.MLocation;
|
||||
import org.compiere.util.CLogger;
|
||||
import org.compiere.util.DisplayType;
|
||||
import org.compiere.util.Env;
|
||||
import org.compiere.util.KeyNamePair;
|
||||
import org.compiere.util.Msg;
|
||||
import org.compiere.util.NamePair;
|
||||
import org.compiere.util.ValueNamePair;
|
||||
import org.zkoss.zk.ui.event.Event;
|
||||
|
@ -142,7 +146,15 @@ ContextMenuListener, IZoomableEditor
|
|||
|
||||
if (gridField != null)
|
||||
{
|
||||
String columnName = getColumnName();
|
||||
if ((columnName.toUpperCase().equals("C_BPARTNER_LOCATION_ID"))
|
||||
|| (columnName.toUpperCase().equals("BILL_LOCATION_ID"))
|
||||
|| (columnName.toUpperCase().equals("DROPSHIP_LOCATION_ID")))
|
||||
{
|
||||
popupMenu = new WEditorPopupMenu(true, true, isShowPreference(), false, false, true);
|
||||
} else {
|
||||
popupMenu = new WEditorPopupMenu(zoom, true, isShowPreference());
|
||||
}
|
||||
addChangeLogMenu(popupMenu);
|
||||
}
|
||||
}
|
||||
|
@ -377,6 +389,26 @@ ContextMenuListener, IZoomableEditor
|
|||
AEnv.actionZoom(lookup, getValue());
|
||||
}
|
||||
|
||||
private void actionLocation() {
|
||||
int BPLocation_ID = 0;
|
||||
Object value = getValue();
|
||||
if (value instanceof Integer)
|
||||
BPLocation_ID = ((Integer)value).intValue();
|
||||
else if (value != null)
|
||||
BPLocation_ID = Integer.parseInt(value.toString());
|
||||
|
||||
if (BPLocation_ID>0)
|
||||
{
|
||||
MBPartnerLocation bpl = new MBPartnerLocation(Env.getCtx(), BPLocation_ID, null);
|
||||
MLocation location= new MLocation(Env.getCtx(), bpl.getC_Location_ID(), null);
|
||||
|
||||
final WLocationDialog vbp = new WLocationDialog(Msg.getMsg(Env.getCtx(), "Location"), location);
|
||||
vbp.setVisible(true);
|
||||
AEnv.showWindow(vbp);
|
||||
}
|
||||
|
||||
} // actionLocation
|
||||
|
||||
public void onMenu(ContextMenuEvent evt)
|
||||
{
|
||||
if (WEditorPopupMenu.REQUERY_EVENT.equals(evt.getContextEvent()))
|
||||
|
@ -397,6 +429,10 @@ ContextMenuListener, IZoomableEditor
|
|||
{
|
||||
WFieldRecordInfo.start(gridField);
|
||||
}
|
||||
else if (WEditorPopupMenu.SHOWLOCATION_EVENT.equals(evt.getContextEvent()))
|
||||
{
|
||||
actionLocation();
|
||||
}
|
||||
}
|
||||
|
||||
public void propertyChange(PropertyChangeEvent evt)
|
||||
|
|
Loading…
Reference in New Issue