IDEMPIERE-5489 - Allow to Start Drill Assistant from Window Field Menu (#1580)
* IDEMPIERE-5489 - Allow to Start Drill Assistant from Window Field Menu * IDEMPIERE-5489 - fixes * IDEMPIERE-5489 - fixes * IDEMPIERE-5489 - remove setting width to 42%
This commit is contained in:
parent
ea092b56ff
commit
931687169a
|
@ -34,14 +34,20 @@ import java.util.logging.Level;
|
||||||
import javax.servlet.ServletRequest;
|
import javax.servlet.ServletRequest;
|
||||||
|
|
||||||
import org.adempiere.webui.ClientInfo;
|
import org.adempiere.webui.ClientInfo;
|
||||||
|
import org.adempiere.webui.ISupportMask;
|
||||||
|
import org.adempiere.webui.LayoutUtils;
|
||||||
import org.adempiere.webui.adwindow.ADWindow;
|
import org.adempiere.webui.adwindow.ADWindow;
|
||||||
|
import org.adempiere.webui.component.Mask;
|
||||||
import org.adempiere.webui.component.Window;
|
import org.adempiere.webui.component.Window;
|
||||||
import org.adempiere.webui.editor.WTableDirEditor;
|
import org.adempiere.webui.editor.WTableDirEditor;
|
||||||
|
import org.adempiere.webui.event.DialogEvents;
|
||||||
|
import org.adempiere.webui.event.DrillEvent.DrillData;
|
||||||
import org.adempiere.webui.info.InfoWindow;
|
import org.adempiere.webui.info.InfoWindow;
|
||||||
import org.adempiere.webui.session.SessionManager;
|
import org.adempiere.webui.session.SessionManager;
|
||||||
import org.adempiere.webui.theme.ThemeManager;
|
import org.adempiere.webui.theme.ThemeManager;
|
||||||
import org.adempiere.webui.util.IServerPushCallback;
|
import org.adempiere.webui.util.IServerPushCallback;
|
||||||
import org.adempiere.webui.util.ServerPushTemplate;
|
import org.adempiere.webui.util.ServerPushTemplate;
|
||||||
|
import org.adempiere.webui.window.Dialog;
|
||||||
import org.compiere.acct.Doc;
|
import org.compiere.acct.Doc;
|
||||||
import org.compiere.model.GridWindowVO;
|
import org.compiere.model.GridWindowVO;
|
||||||
import org.compiere.model.I_AD_Window;
|
import org.compiere.model.I_AD_Window;
|
||||||
|
@ -52,6 +58,7 @@ import org.compiere.model.MLookup;
|
||||||
import org.compiere.model.MLookupFactory;
|
import org.compiere.model.MLookupFactory;
|
||||||
import org.compiere.model.MQuery;
|
import org.compiere.model.MQuery;
|
||||||
import org.compiere.model.MReference;
|
import org.compiere.model.MReference;
|
||||||
|
import org.compiere.model.MRole;
|
||||||
import org.compiere.model.MSession;
|
import org.compiere.model.MSession;
|
||||||
import org.compiere.model.MSysConfig;
|
import org.compiere.model.MSysConfig;
|
||||||
import org.compiere.model.MTable;
|
import org.compiere.model.MTable;
|
||||||
|
@ -71,6 +78,8 @@ import org.zkoss.zk.ui.Component;
|
||||||
import org.zkoss.zk.ui.Desktop;
|
import org.zkoss.zk.ui.Desktop;
|
||||||
import org.zkoss.zk.ui.Execution;
|
import org.zkoss.zk.ui.Execution;
|
||||||
import org.zkoss.zk.ui.Executions;
|
import org.zkoss.zk.ui.Executions;
|
||||||
|
import org.zkoss.zk.ui.event.Event;
|
||||||
|
import org.zkoss.zk.ui.event.EventListener;
|
||||||
|
|
||||||
import com.lowagie.text.DocumentException;
|
import com.lowagie.text.DocumentException;
|
||||||
|
|
||||||
|
@ -429,6 +438,47 @@ public final class AEnv
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Opens the Drill Assistant
|
||||||
|
* @param data query
|
||||||
|
* @param component
|
||||||
|
*/
|
||||||
|
public static void actionDrill(DrillData data, int windowNo) {
|
||||||
|
int AD_Table_ID = MTable.getTable_ID(data.getQuery().getTableName());
|
||||||
|
if (!MRole.getDefault().isCanReport(AD_Table_ID))
|
||||||
|
{
|
||||||
|
Dialog.error(windowNo, "AccessCannotReport", data.getQuery().getTableName());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (AD_Table_ID > 0) {
|
||||||
|
WDrillReport drillReport = new WDrillReport(data, windowNo);
|
||||||
|
|
||||||
|
Object window = SessionManager.getAppDesktop().findWindow(windowNo);
|
||||||
|
if (window != null && window instanceof Component && window instanceof ISupportMask){
|
||||||
|
final ISupportMask parent = LayoutUtils.showWindowWithMask(drillReport, (Component)window, LayoutUtils.OVERLAP_PARENT);
|
||||||
|
drillReport.addEventListener(DialogEvents.ON_WINDOW_CLOSE, new EventListener<Event>() {
|
||||||
|
@Override
|
||||||
|
public void onEvent(Event event) throws Exception {
|
||||||
|
parent.hideMask();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}else if (window != null && window instanceof Component){
|
||||||
|
final Mask mask = LayoutUtils.showWindowWithMask(drillReport, (Component)window, null);
|
||||||
|
drillReport.addEventListener(DialogEvents.ON_WINDOW_CLOSE, new EventListener<Event>() {
|
||||||
|
@Override
|
||||||
|
public void onEvent(Event event) throws Exception {
|
||||||
|
mask.hideMask();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}else{
|
||||||
|
drillReport.setAttribute(Window.MODE_KEY, Window.MODE_HIGHLIGHTED);
|
||||||
|
AEnv.showWindow(drillReport);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
log.warning("No Table found for " + data.getQuery().getWhereClause(true));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* open zoom window with query
|
* open zoom window with query
|
||||||
* @param AD_Window_ID
|
* @param AD_Window_ID
|
||||||
|
|
|
@ -62,7 +62,6 @@ import org.zkoss.zhtml.Table;
|
||||||
import org.zkoss.zhtml.Td;
|
import org.zkoss.zhtml.Td;
|
||||||
import org.zkoss.zhtml.Text;
|
import org.zkoss.zhtml.Text;
|
||||||
import org.zkoss.zhtml.Tr;
|
import org.zkoss.zhtml.Tr;
|
||||||
import org.zkoss.zk.ui.Component;
|
|
||||||
import org.zkoss.zk.ui.HtmlNativeComponent;
|
import org.zkoss.zk.ui.HtmlNativeComponent;
|
||||||
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;
|
||||||
|
@ -100,10 +99,9 @@ public class WDrillReport extends Window implements EventListener<Event> {
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param data
|
* @param data
|
||||||
* @param parent
|
|
||||||
* @param WindowNo
|
* @param WindowNo
|
||||||
*/
|
*/
|
||||||
public WDrillReport(DrillData data, Component parent, int WindowNo) {
|
public WDrillReport(DrillData data, int WindowNo) {
|
||||||
super();
|
super();
|
||||||
this.windowNo = WindowNo;
|
this.windowNo = WindowNo;
|
||||||
drillReportCtl = new DrillReportCtl(data.getQuery().getTableName(), data.getQuery(), data.getColumnName(), data.getValue(), data.getDisplayValue(), WindowNo);
|
drillReportCtl = new DrillReportCtl(data.getQuery().getTableName(), data.getQuery(), data.getColumnName(), data.getValue(), data.getDisplayValue(), WindowNo);
|
||||||
|
|
|
@ -64,6 +64,7 @@ public class WEditorPopupMenu extends Menupopup implements EventListener<Event>
|
||||||
public static final String EDITOR_EVENT = "EDITOR";
|
public static final String EDITOR_EVENT = "EDITOR";
|
||||||
public static final String RESET_EVENT = "RESET";
|
public static final String RESET_EVENT = "RESET";
|
||||||
public static final String ASSISTANT_EVENT = "ASSISTANT";
|
public static final String ASSISTANT_EVENT = "ASSISTANT";
|
||||||
|
public static final String DRILL_EVENT = "DRILL";
|
||||||
|
|
||||||
private boolean newEnabled = true;
|
private boolean newEnabled = true;
|
||||||
private boolean updateEnabled = true; // Elaine 2009/02/16 - update record
|
private boolean updateEnabled = true; // Elaine 2009/02/16 - update record
|
||||||
|
@ -71,6 +72,7 @@ public class WEditorPopupMenu extends Menupopup implements EventListener<Event>
|
||||||
private boolean requeryEnabled = true;
|
private boolean requeryEnabled = true;
|
||||||
private boolean preferencesEnabled = true;
|
private boolean preferencesEnabled = true;
|
||||||
private boolean showLocation = true;
|
private boolean showLocation = true;
|
||||||
|
private boolean drillEnabled = true;
|
||||||
|
|
||||||
private Menuitem zoomItem;
|
private Menuitem zoomItem;
|
||||||
private Menuitem requeryItem;
|
private Menuitem requeryItem;
|
||||||
|
@ -78,12 +80,13 @@ public class WEditorPopupMenu extends Menupopup implements EventListener<Event>
|
||||||
private Menuitem newItem;
|
private Menuitem newItem;
|
||||||
private Menuitem updateItem; // Elaine 2009/02/16 - update record
|
private Menuitem updateItem; // Elaine 2009/02/16 - update record
|
||||||
private Menuitem showLocationItem;
|
private Menuitem showLocationItem;
|
||||||
|
private Menuitem drillItem;
|
||||||
|
|
||||||
private ArrayList<ContextMenuListener> menuListeners = new ArrayList<ContextMenuListener>();
|
private ArrayList<ContextMenuListener> menuListeners = new ArrayList<ContextMenuListener>();
|
||||||
|
|
||||||
public WEditorPopupMenu(boolean zoom, boolean requery, boolean preferences)
|
public WEditorPopupMenu(boolean zoom, boolean requery, boolean preferences)
|
||||||
{
|
{
|
||||||
this(zoom, requery, preferences, false, false, false, null); // no check zoom
|
this(zoom, requery, preferences, false, false, false, false, null); // no check zoom
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
|
@ -104,6 +107,11 @@ public class WEditorPopupMenu extends Menupopup implements EventListener<Event>
|
||||||
this(zoom, requery, preferences, newRecord, updateRecord, false, null);
|
this(zoom, requery, preferences, newRecord, updateRecord, false, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public WEditorPopupMenu(boolean zoom, boolean requery, boolean preferences, boolean newRecord, boolean updateRecord, boolean showLocation, Lookup lookup)
|
||||||
|
{
|
||||||
|
this(zoom, requery, preferences, newRecord, updateRecord, showLocation, false, lookup);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param zoom - enable zoom in menu - disabled if the lookup cannot zoom
|
* @param zoom - enable zoom in menu - disabled if the lookup cannot zoom
|
||||||
* @param requery - enable requery in menu
|
* @param requery - enable requery in menu
|
||||||
|
@ -113,7 +121,7 @@ public class WEditorPopupMenu extends Menupopup implements EventListener<Event>
|
||||||
* @param showLocation - enable show location in menu
|
* @param showLocation - enable show location in menu
|
||||||
* @param lookup - when this parameter is received then new and update are calculated based on the zoom and quickentry
|
* @param lookup - when this parameter is received then new and update are calculated based on the zoom and quickentry
|
||||||
*/
|
*/
|
||||||
public WEditorPopupMenu(boolean zoom, boolean requery, boolean preferences, boolean newRecord, boolean updateRecord, boolean showLocation, Lookup lookup)
|
public WEditorPopupMenu(boolean zoom, boolean requery, boolean preferences, boolean newRecord, boolean updateRecord, boolean showLocation, boolean drillEnabled, Lookup lookup)
|
||||||
{
|
{
|
||||||
super();
|
super();
|
||||||
this.zoomEnabled = zoom;
|
this.zoomEnabled = zoom;
|
||||||
|
@ -122,6 +130,7 @@ public class WEditorPopupMenu extends Menupopup implements EventListener<Event>
|
||||||
this.newEnabled = newRecord;
|
this.newEnabled = newRecord;
|
||||||
this.updateEnabled = updateRecord; // Elaine 2009/02/16 - update record
|
this.updateEnabled = updateRecord; // Elaine 2009/02/16 - update record
|
||||||
this.showLocation = showLocation;
|
this.showLocation = showLocation;
|
||||||
|
this.drillEnabled = drillEnabled;
|
||||||
|
|
||||||
String tableName = null;
|
String tableName = null;
|
||||||
if (lookup != null && lookup.getColumnName() != null)
|
if (lookup != null && lookup.getColumnName() != null)
|
||||||
|
@ -274,6 +283,18 @@ public class WEditorPopupMenu extends Menupopup implements EventListener<Event>
|
||||||
this.appendChild(showLocationItem);
|
this.appendChild(showLocationItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(drillEnabled)
|
||||||
|
{
|
||||||
|
drillItem = new Menuitem();
|
||||||
|
drillItem.setAttribute(EVENT_ATTRIBUTE, DRILL_EVENT);
|
||||||
|
drillItem.setLabel(Util.cleanAmp(Msg.getMsg(Env.getCtx(), "DrillAssistant")).intern());
|
||||||
|
if (ThemeManager.isUseFontIconForImage())
|
||||||
|
drillItem.setIconSclass("z-icon-Window");
|
||||||
|
else
|
||||||
|
drillItem.setImage(ThemeManager.getThemeResource("images/Window16.png"));
|
||||||
|
drillItem.addEventListener(Events.ON_CLICK, this);
|
||||||
|
this.appendChild(drillItem);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addMenuListener(ContextMenuListener listener)
|
public void addMenuListener(ContextMenuListener listener)
|
||||||
|
|
|
@ -35,6 +35,7 @@ import org.adempiere.webui.component.ComboEditorBox;
|
||||||
import org.adempiere.webui.event.ContextMenuEvent;
|
import org.adempiere.webui.event.ContextMenuEvent;
|
||||||
import org.adempiere.webui.event.ContextMenuListener;
|
import org.adempiere.webui.event.ContextMenuListener;
|
||||||
import org.adempiere.webui.event.DialogEvents;
|
import org.adempiere.webui.event.DialogEvents;
|
||||||
|
import org.adempiere.webui.event.DrillEvent.DrillData;
|
||||||
import org.adempiere.webui.event.ValueChangeEvent;
|
import org.adempiere.webui.event.ValueChangeEvent;
|
||||||
import org.adempiere.webui.event.ValueChangeListener;
|
import org.adempiere.webui.event.ValueChangeListener;
|
||||||
import org.adempiere.webui.factory.InfoManager;
|
import org.adempiere.webui.factory.InfoManager;
|
||||||
|
@ -50,6 +51,7 @@ import org.compiere.model.Lookup;
|
||||||
import org.compiere.model.MColumn;
|
import org.compiere.model.MColumn;
|
||||||
import org.compiere.model.MLookup;
|
import org.compiere.model.MLookup;
|
||||||
import org.compiere.model.MLookupFactory;
|
import org.compiere.model.MLookupFactory;
|
||||||
|
import org.compiere.model.MQuery;
|
||||||
import org.compiere.model.MRole;
|
import org.compiere.model.MRole;
|
||||||
import org.compiere.model.MSysConfig;
|
import org.compiere.model.MSysConfig;
|
||||||
import org.compiere.model.MTable;
|
import org.compiere.model.MTable;
|
||||||
|
@ -196,9 +198,14 @@ public class WSearchEditor extends WEditor implements ContextMenuListener, Value
|
||||||
if (Util.isEmpty(m_tableName))
|
if (Util.isEmpty(m_tableName))
|
||||||
setTableAndKeyColumn();
|
setTableAndKeyColumn();
|
||||||
|
|
||||||
|
boolean enableDrill = false;
|
||||||
|
if(getGridField() != null && getGridField().getGridTab() != null && getGridField().getColumnName().endsWith("_ID")
|
||||||
|
&& MRole.getDefault().isCanReport(getGridField().getGridTab().getAD_Table_ID()))
|
||||||
|
enableDrill = true;
|
||||||
|
|
||||||
if (m_tableName.equals("C_BPartner"))
|
if (m_tableName.equals("C_BPartner"))
|
||||||
{
|
{
|
||||||
popupMenu = new WEditorPopupMenu(true, true, isShowPreference(), true, true, false, lookup);
|
popupMenu = new WEditorPopupMenu(true, true, isShowPreference(), true, true, false, enableDrill, lookup);
|
||||||
if (ThemeManager.isUseFontIconForImage())
|
if (ThemeManager.isUseFontIconForImage())
|
||||||
imageUrl = "z-icon-BPartner";
|
imageUrl = "z-icon-BPartner";
|
||||||
else
|
else
|
||||||
|
@ -206,7 +213,7 @@ public class WSearchEditor extends WEditor implements ContextMenuListener, Value
|
||||||
}
|
}
|
||||||
else if (m_tableName.equals("M_Product"))
|
else if (m_tableName.equals("M_Product"))
|
||||||
{
|
{
|
||||||
popupMenu = new WEditorPopupMenu(true, true, isShowPreference(), false, false, false, lookup);
|
popupMenu = new WEditorPopupMenu(true, true, isShowPreference(), false, false, false, enableDrill, lookup);
|
||||||
if (ThemeManager.isUseFontIconForImage())
|
if (ThemeManager.isUseFontIconForImage())
|
||||||
imageUrl = "z-icon-Product";
|
imageUrl = "z-icon-Product";
|
||||||
else
|
else
|
||||||
|
@ -214,7 +221,7 @@ public class WSearchEditor extends WEditor implements ContextMenuListener, Value
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
popupMenu = new WEditorPopupMenu(true, true, isShowPreference(), false, false, false, lookup);
|
popupMenu = new WEditorPopupMenu(true, true, isShowPreference(), false, false, false, enableDrill, lookup);
|
||||||
if (ThemeManager.isUseFontIconForImage())
|
if (ThemeManager.isUseFontIconForImage())
|
||||||
imageUrl = "z-icon-More";
|
imageUrl = "z-icon-More";
|
||||||
else
|
else
|
||||||
|
@ -434,6 +441,10 @@ public class WSearchEditor extends WEditor implements ContextMenuListener, Value
|
||||||
{
|
{
|
||||||
WFieldRecordInfo.start(gridField);
|
WFieldRecordInfo.start(gridField);
|
||||||
}
|
}
|
||||||
|
else if (WEditorPopupMenu.DRILL_EVENT.equals(evt.getContextEvent()))
|
||||||
|
{
|
||||||
|
actionDrill();
|
||||||
|
}
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -493,7 +504,20 @@ public class WSearchEditor extends WEditor implements ContextMenuListener, Value
|
||||||
resetButtonState();
|
resetButtonState();
|
||||||
} // actionText
|
} // actionText
|
||||||
|
|
||||||
|
protected void actionDrill() {
|
||||||
|
if(getGridField() == null || getGridField().getGridTab() == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if(!m_keyColumnName.endsWith("_ID"))
|
||||||
|
return;
|
||||||
|
MQuery query = new MQuery(m_tableName);
|
||||||
|
query.addRestriction(m_keyColumnName, MQuery.EQUAL, value);
|
||||||
|
int windowNo = getGridField().getGridTab().getWindowNo();
|
||||||
|
DrillData data = new DrillData(query, m_keyColumnName, value, null, null);
|
||||||
|
|
||||||
|
AEnv.actionDrill(data, windowNo);
|
||||||
|
}
|
||||||
|
|
||||||
protected void resetButtonState() {
|
protected void resetButtonState() {
|
||||||
getComponent().getButton().setEnabled(true);
|
getComponent().getButton().setEnabled(true);
|
||||||
if (ThemeManager.isUseFontIconForImage())
|
if (ThemeManager.isUseFontIconForImage())
|
||||||
|
|
|
@ -37,6 +37,7 @@ import org.adempiere.webui.component.Combobox;
|
||||||
import org.adempiere.webui.event.ContextMenuEvent;
|
import org.adempiere.webui.event.ContextMenuEvent;
|
||||||
import org.adempiere.webui.event.ContextMenuListener;
|
import org.adempiere.webui.event.ContextMenuListener;
|
||||||
import org.adempiere.webui.event.DialogEvents;
|
import org.adempiere.webui.event.DialogEvents;
|
||||||
|
import org.adempiere.webui.event.DrillEvent.DrillData;
|
||||||
import org.adempiere.webui.event.ValueChangeEvent;
|
import org.adempiere.webui.event.ValueChangeEvent;
|
||||||
import org.adempiere.webui.grid.AbstractWQuickEntry;
|
import org.adempiere.webui.grid.AbstractWQuickEntry;
|
||||||
import org.adempiere.webui.theme.ThemeManager;
|
import org.adempiere.webui.theme.ThemeManager;
|
||||||
|
@ -51,6 +52,7 @@ import org.compiere.model.MColumn;
|
||||||
import org.compiere.model.MLocation;
|
import org.compiere.model.MLocation;
|
||||||
import org.compiere.model.MLocator;
|
import org.compiere.model.MLocator;
|
||||||
import org.compiere.model.MLookup;
|
import org.compiere.model.MLookup;
|
||||||
|
import org.compiere.model.MQuery;
|
||||||
import org.compiere.model.MRole;
|
import org.compiere.model.MRole;
|
||||||
import org.compiere.model.MSysConfig;
|
import org.compiere.model.MSysConfig;
|
||||||
import org.compiere.model.MTable;
|
import org.compiere.model.MTable;
|
||||||
|
@ -108,6 +110,8 @@ ContextMenuListener, IZoomableEditor
|
||||||
|
|
||||||
private Lookup lookup;
|
private Lookup lookup;
|
||||||
private Object oldValue;
|
private Object oldValue;
|
||||||
|
private String m_tableName = null;
|
||||||
|
private String m_keyColumnName = null;
|
||||||
|
|
||||||
public static final String SHORT_LIST_EVENT = "SHORT_LIST"; // IDEMPIERE 90
|
public static final String SHORT_LIST_EVENT = "SHORT_LIST"; // IDEMPIERE 90
|
||||||
protected boolean onlyShortListItems; // IDEMPIERE 90
|
protected boolean onlyShortListItems; // IDEMPIERE 90
|
||||||
|
@ -249,11 +253,15 @@ ContextMenuListener, IZoomableEditor
|
||||||
int posPoint = tableName_temp.indexOf(".");
|
int posPoint = tableName_temp.indexOf(".");
|
||||||
String tableName = tableName_temp.substring(0, posPoint);
|
String tableName = tableName_temp.substring(0, posPoint);
|
||||||
|
|
||||||
|
boolean enableDrill = false;
|
||||||
|
if(getGridField() != null && getGridField().getGridTab() != null && getGridField().getColumnName().endsWith("_ID")
|
||||||
|
&& MRole.getDefault().isCanReport(getGridField().getGridTab().getAD_Table_ID()))
|
||||||
|
enableDrill = true;
|
||||||
if (tableName.toUpperCase().equals("C_BPARTNER_LOCATION"))
|
if (tableName.toUpperCase().equals("C_BPARTNER_LOCATION"))
|
||||||
{
|
{
|
||||||
popupMenu = new WEditorPopupMenu(true, true, isShowPreference(), false, false, true, lookup);
|
popupMenu = new WEditorPopupMenu(true, true, isShowPreference(), false, false, true, enableDrill, lookup);
|
||||||
} else {
|
} else {
|
||||||
popupMenu = new WEditorPopupMenu(zoom, true, isShowPreference(), false, false, false, lookup);
|
popupMenu = new WEditorPopupMenu(zoom, true, isShowPreference(), false, false, false, enableDrill, lookup);
|
||||||
}
|
}
|
||||||
addChangeLogMenu(popupMenu);
|
addChangeLogMenu(popupMenu);
|
||||||
|
|
||||||
|
@ -655,6 +663,49 @@ ContextMenuListener, IZoomableEditor
|
||||||
return lookup;
|
return lookup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void actionDrill() {
|
||||||
|
if(getGridField() == null || getGridField().getGridTab() == null)
|
||||||
|
return;
|
||||||
|
if(m_tableName == null)
|
||||||
|
setTableAndKeyColumn();
|
||||||
|
if(m_keyColumnName == null)
|
||||||
|
m_keyColumnName = getGridField().getColumnName();
|
||||||
|
if(!m_keyColumnName.endsWith("_ID"))
|
||||||
|
return;
|
||||||
|
MQuery query = new MQuery(m_tableName);
|
||||||
|
query.addRestriction(m_keyColumnName, MQuery.EQUAL, oldValue);
|
||||||
|
int windowNo = getGridField().getGridTab().getWindowNo();
|
||||||
|
DrillData data = new DrillData(query, m_keyColumnName, oldValue, null, null);
|
||||||
|
|
||||||
|
AEnv.actionDrill(data, windowNo);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets m_tableName and m_keyColumnName
|
||||||
|
*/
|
||||||
|
private void setTableAndKeyColumn() {
|
||||||
|
if (lookup != null && lookup instanceof MLookup) {
|
||||||
|
// foreign table defined in lookup
|
||||||
|
m_keyColumnName = ((MLookup)lookup).getColumnName();
|
||||||
|
if (m_keyColumnName.contains(".")) {
|
||||||
|
m_tableName = m_keyColumnName.substring(0, m_keyColumnName.indexOf("."));
|
||||||
|
m_keyColumnName = m_keyColumnName.substring(m_keyColumnName.indexOf(".")+1);
|
||||||
|
} else {
|
||||||
|
m_tableName = m_keyColumnName.substring(0, m_keyColumnName.length()-3);
|
||||||
|
}
|
||||||
|
} else if (getGridField() != null && getGridField().getGridTab() != null && getGridField().getAD_Column_ID() > 0) {
|
||||||
|
// field - this editor comes from a window, when it comes from process parameter it doesn't have a gridtab
|
||||||
|
MColumn column = MColumn.get(Env.getCtx(), getGridField().getAD_Column_ID());
|
||||||
|
m_tableName = column.getReferenceTableName();
|
||||||
|
MTable table = MTable.get(Env.getCtx(), m_tableName);
|
||||||
|
m_keyColumnName = table.getKeyColumns()[0];
|
||||||
|
} else {
|
||||||
|
// no field - the search editor is defined programatically
|
||||||
|
m_keyColumnName = getColumnName();
|
||||||
|
m_tableName = m_keyColumnName.substring(0, m_keyColumnName.length()-3);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Action - Special Quick Entry Screen
|
* Action - Special Quick Entry Screen
|
||||||
* @param newRecord true if new record should be created
|
* @param newRecord true if new record should be created
|
||||||
|
@ -775,6 +826,10 @@ ContextMenuListener, IZoomableEditor
|
||||||
getLabel().setText(">" + champ + "<");
|
getLabel().setText(">" + champ + "<");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (WEditorPopupMenu.DRILL_EVENT.equals(evt.getContextEvent()))
|
||||||
|
{
|
||||||
|
actionDrill();
|
||||||
|
}
|
||||||
// IDEMPIERE 90
|
// IDEMPIERE 90
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -41,12 +41,10 @@ import org.adempiere.util.Callback;
|
||||||
import org.adempiere.util.ContextRunnable;
|
import org.adempiere.util.ContextRunnable;
|
||||||
import org.adempiere.webui.ClientInfo;
|
import org.adempiere.webui.ClientInfo;
|
||||||
import org.adempiere.webui.Extensions;
|
import org.adempiere.webui.Extensions;
|
||||||
import org.adempiere.webui.ISupportMask;
|
|
||||||
import org.adempiere.webui.LayoutUtils;
|
import org.adempiere.webui.LayoutUtils;
|
||||||
import org.adempiere.webui.apps.AEnv;
|
import org.adempiere.webui.apps.AEnv;
|
||||||
import org.adempiere.webui.apps.BusyDialog;
|
import org.adempiere.webui.apps.BusyDialog;
|
||||||
import org.adempiere.webui.apps.ProcessModalDialog;
|
import org.adempiere.webui.apps.ProcessModalDialog;
|
||||||
import org.adempiere.webui.apps.WDrillReport;
|
|
||||||
import org.adempiere.webui.apps.WReport;
|
import org.adempiere.webui.apps.WReport;
|
||||||
import org.adempiere.webui.apps.form.WReportCustomization;
|
import org.adempiere.webui.apps.form.WReportCustomization;
|
||||||
import org.adempiere.webui.component.Checkbox;
|
import org.adempiere.webui.component.Checkbox;
|
||||||
|
@ -816,7 +814,7 @@ public class ZkReportViewer extends Window implements EventListener<Event>, ITab
|
||||||
DrillEvent de = (DrillEvent) event;
|
DrillEvent de = (DrillEvent) event;
|
||||||
if (de.getData() != null && de.getData() instanceof DrillData) {
|
if (de.getData() != null && de.getData() instanceof DrillData) {
|
||||||
DrillData data = (DrillData) de.getData();
|
DrillData data = (DrillData) de.getData();
|
||||||
executeDrill(data, event.getTarget());
|
AEnv.actionDrill(data, m_WindowNo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1247,52 +1245,6 @@ public class ZkReportViewer extends Window implements EventListener<Event>, ITab
|
||||||
private void cmd_render() {
|
private void cmd_render() {
|
||||||
postRenderReportEvent();
|
postRenderReportEvent();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Execute Drill to Query
|
|
||||||
* @param data query
|
|
||||||
* @param component
|
|
||||||
*/
|
|
||||||
private void executeDrill (DrillData data, Component component)
|
|
||||||
{
|
|
||||||
int AD_Table_ID = MTable.getTable_ID(data.getQuery().getTableName());
|
|
||||||
if (!MRole.getDefault().isCanReport(AD_Table_ID))
|
|
||||||
{
|
|
||||||
Dialog.error(m_WindowNo, "AccessCannotReport", data.getQuery().getTableName());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (AD_Table_ID != 0) {
|
|
||||||
WDrillReport drillReport = new WDrillReport(data, component, m_WindowNo);
|
|
||||||
|
|
||||||
Object window = SessionManager.getAppDesktop().findWindow(m_WindowNo);
|
|
||||||
if (window != null && window instanceof Component && window instanceof ISupportMask){
|
|
||||||
final ISupportMask parent = LayoutUtils.showWindowWithMask(drillReport, (Component)window, LayoutUtils.OVERLAP_PARENT);
|
|
||||||
drillReport.addEventListener(DialogEvents.ON_WINDOW_CLOSE, new EventListener<Event>() {
|
|
||||||
@Override
|
|
||||||
public void onEvent(Event event) throws Exception {
|
|
||||||
parent.hideMask();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}else if (window != null && window instanceof Component){
|
|
||||||
final Mask mask = LayoutUtils.showWindowWithMask(drillReport, (Component)window, null);
|
|
||||||
drillReport.addEventListener(DialogEvents.ON_WINDOW_CLOSE, new EventListener<Event>() {
|
|
||||||
@Override
|
|
||||||
public void onEvent(Event event) throws Exception {
|
|
||||||
mask.hideMask();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}else{
|
|
||||||
// Add proper width width
|
|
||||||
int width = SessionManager.getAppDesktop().getClientInfo().screenWidth * 42 / 100;
|
|
||||||
drillReport.setWidth(width + "px");
|
|
||||||
drillReport.setPosition("center");
|
|
||||||
drillReport.setAttribute(Window.MODE_KEY, Window.MODE_MODAL);
|
|
||||||
AEnv.showWindow(drillReport);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
log.warning("No Table found for " + data.getQuery().getWhereClause(true));
|
|
||||||
} // executeDrill
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Execute Drill to Query
|
* Execute Drill to Query
|
||||||
|
@ -1584,7 +1536,7 @@ public class ZkReportViewer extends Window implements EventListener<Event>, ITab
|
||||||
} // cmd_reRun
|
} // cmd_reRun
|
||||||
|
|
||||||
protected void setLanguage (){
|
protected void setLanguage (){
|
||||||
if (MClient.get(m_ctx).isMultiLingualDocument() && wLanguage.getValue() != null){
|
if (MClient.get(m_ctx).isMultiLingualDocument() && wLanguage != null && wLanguage.getValue() != null){
|
||||||
MLanguage language = new MLanguage (m_ctx, (int)wLanguage.getValue(), null);
|
MLanguage language = new MLanguage (m_ctx, (int)wLanguage.getValue(), null);
|
||||||
Language lang = new Language(language.getName(), language.getAD_Language(), language.getLocale());
|
Language lang = new Language(language.getName(), language.getAD_Language(), language.getLocale());
|
||||||
m_reportEngine.setLanguageID(language.getAD_Language_ID());
|
m_reportEngine.setLanguageID(language.getAD_Language_ID());
|
||||||
|
|
|
@ -370,10 +370,11 @@ public class DrillReportCtl {
|
||||||
if (m_Query.getColumnName(0).equals(m_Query.getTableName()+"_ID")) {
|
if (m_Query.getColumnName(0).equals(m_Query.getTableName()+"_ID")) {
|
||||||
Object vrec = m_Query.getCode(0);
|
Object vrec = m_Query.getCode(0);
|
||||||
if (vrec instanceof Integer) {
|
if (vrec instanceof Integer) {
|
||||||
Record_ID = ((Integer)m_Query.getCode(0)).intValue();
|
Record_ID = ((Integer)vrec).intValue();
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
Record_ID = Integer.parseInt(m_Query.getCode(0).toString());
|
if(vrec != null)
|
||||||
|
Record_ID = Integer.parseInt(m_Query.getCode(0).toString());
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
log.info(e.getMessage());
|
log.info(e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue