use of org.adempiere.webui.window.ADWindow in project adempiere by adempiere.
the class GridTabListItemRenderer method getEditorCell.
private Listcell getEditorCell(GridField gridField, Object object, int i) {
Listcell cell = new Listcell("", null);
WEditor editor = editors.get(gridField);
if (editor != null) {
if (editor instanceof WButtonEditor) {
Object window = SessionManager.getAppDesktop().findWindow(windowNo);
if (window != null && window instanceof ADWindow) {
AbstractADWindowPanel windowPanel = ((ADWindow) window).getADWindowPanel();
((WButtonEditor) editor).addActionListener(windowPanel);
}
} else {
editor.addValueChangeListener(dataBinder);
}
cell.appendChild(editor.getComponent());
if (editor.getComponent() instanceof Checkbox || editor.getComponent() instanceof Image) {
cell.setStyle("text-align:center");
} else if (DisplayType.isNumeric(gridField.getDisplayType())) {
cell.setStyle("text-align:right");
}
gridField.addPropertyChangeListener(editor);
editor.setValue(gridField.getValue());
WEditorPopupMenu popupMenu = editor.getPopupMenu();
if (popupMenu != null) {
popupMenu.addMenuListener((ContextMenuListener) editor);
cell.appendChild(popupMenu);
}
//streach component to fill grid cell
editor.fillHorizontal();
}
return cell;
}
use of org.adempiere.webui.window.ADWindow in project adempiere by adempiere.
the class GridTabRowRenderer method getEditorCell.
/**
*
* @param gridField
* @param object
* @param i
* @return
*/
private WEditor getEditorCell(GridField gridField, Object object, int i) {
WEditor editor = editors.get(gridField);
if (editor != null) {
if (editor instanceof WButtonEditor) {
if (m_windowPanel != null) {
((WButtonEditor) editor).addActionListener(m_windowPanel);
} else {
Object window = SessionManager.getAppDesktop().findWindow(windowNo);
if (window != null && window instanceof ADWindow) {
AbstractADWindowPanel windowPanel = ((ADWindow) window).getADWindowPanel();
((WButtonEditor) editor).addActionListener(windowPanel);
}
}
} else {
editor.addValueChangeListener(dataBinder);
}
gridField.removePropertyChangeListener(editor);
gridField.addPropertyChangeListener(editor);
editor.setValue(gridField.getValue());
//streach component to fill grid cell
if (editor.getComponent() instanceof Textbox)
((HtmlBasedComponent) editor.getComponent()).setWidth("98%");
else
editor.fillHorizontal();
}
return editor;
}
use of org.adempiere.webui.window.ADWindow in project adempiere by adempiere.
the class TabbedDesktop method openWindow.
/**
*
* @param windowId
* @param query
* @return ADWindow
*/
public ADWindow openWindow(int windowId, MQuery query) {
ADWindow adWindow = new ADWindow(Env.getCtx(), windowId, query);
DesktopTabpanel tabPanel = new DesktopTabpanel();
if (adWindow.createPart(tabPanel) != null) {
preOpenNewTab();
windowContainer.addWindow(tabPanel, adWindow.getTitle(), true);
return adWindow;
} else {
//user cancel
return null;
}
}
use of org.adempiere.webui.window.ADWindow in project adempiere by adempiere.
the class TabbedDesktop method openWindow.
/**
*
* @param windowId
* @return ADWindow
*/
public ADWindow openWindow(int windowId) {
ADWindow adWindow = new ADWindow(Env.getCtx(), windowId);
DesktopTabpanel tabPanel = new DesktopTabpanel();
if (adWindow.createPart(tabPanel) != null) {
preOpenNewTab();
windowContainer.addWindow(tabPanel, adWindow.getTitle(), true);
return adWindow;
} else {
//user cancel
return null;
}
}
use of org.adempiere.webui.window.ADWindow in project adempiere by adempiere.
the class WRequest method onEvent.
// getZoomTargets
public void onEvent(Event e) throws Exception {
if (e.getTarget() instanceof Menuitem) {
MQuery query = null;
if (e.getTarget() == m_active) {
query = new MQuery("");
String where = "(" + m_where + ") AND Processed='N'";
query.addRestriction(where);
query.setRecordCount(0);
} else if (e.getTarget() == m_all) {
query = new MQuery("");
query.addRestriction(m_where.toString());
query.setRecordCount(0);
} else if (e.getTarget() == m_new) {
query = new MQuery("");
query.addRestriction("1=2");
query.setRecordCount(0);
}
// 232=all - 201=my
int AD_Window_ID = 232;
ADWindow frame = SessionManager.getAppDesktop().openWindow(AD_Window_ID, query);
if (frame == null)
return;
// New - set Table/Record
if (e.getTarget() == m_new) {
GridTab tab = frame.getADWindowPanel().getActiveGridTab();
tab.dataNew(false);
tab.setValue("AD_Table_ID", new Integer(m_AD_Table_ID));
tab.setValue("Record_ID", new Integer(m_Record_ID));
//
if (m_C_BPartner_ID != 0)
tab.setValue("C_BPartner_ID", new Integer(m_C_BPartner_ID));
//
if (m_AD_Table_ID == I_C_BPartner.Table_ID)
tab.setValue("C_BPartner_ID", new Integer(m_Record_ID));
else if (m_AD_Table_ID == I_AD_User.Table_ID)
tab.setValue("AD_User_ID", new Integer(m_Record_ID));
else //
if (m_AD_Table_ID == I_C_Project.Table_ID)
tab.setValue("C_Project_ID", new Integer(m_Record_ID));
else if (m_AD_Table_ID == I_A_Asset.Table_ID)
tab.setValue("A_Asset_ID", new Integer(m_Record_ID));
else //
if (m_AD_Table_ID == I_C_Order.Table_ID)
tab.setValue("C_Order_ID", new Integer(m_Record_ID));
else if (m_AD_Table_ID == I_C_Invoice.Table_ID)
tab.setValue("C_Invoice_ID", new Integer(m_Record_ID));
else //
if (m_AD_Table_ID == I_M_Product.Table_ID)
tab.setValue("M_Product_ID", new Integer(m_Record_ID));
else if (m_AD_Table_ID == I_C_Payment.Table_ID)
tab.setValue("C_Payment_ID", new Integer(m_Record_ID));
else //
if (m_AD_Table_ID == I_M_InOut.Table_ID)
tab.setValue("M_InOut_ID", new Integer(m_Record_ID));
else if (m_AD_Table_ID == I_M_RMA.Table_ID)
tab.setValue("M_RMA_ID", new Integer(m_Record_ID));
else //
if (m_AD_Table_ID == I_C_Campaign.Table_ID)
tab.setValue("C_Campaign_ID", new Integer(m_Record_ID));
else //
if (m_AD_Table_ID == I_R_Request.Table_ID)
tab.setValue(I_R_Request.COLUMNNAME_R_RequestRelated_ID, new Integer(m_Record_ID));
else // FR [2842165] - Order Ref link from SO line creating new request
if (m_AD_Table_ID == I_C_OrderLine.Table_ID) {
MOrderLine oLine = new MOrderLine(Env.getCtx(), m_Record_ID, null);
if (oLine != null) {
tab.setValue(I_C_OrderLine.COLUMNNAME_C_Order_ID, new Integer(oLine.getC_Order_ID()));
}
}
}
frame = null;
}
}
Aggregations