Search in sources :

Example 1 with AbstractADWindowPanel

use of org.adempiere.webui.panel.AbstractADWindowPanel 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;
}
Also used : WButtonEditor(org.adempiere.webui.editor.WButtonEditor) Listcell(org.zkoss.zul.Listcell) ADWindow(org.adempiere.webui.window.ADWindow) AbstractADWindowPanel(org.adempiere.webui.panel.AbstractADWindowPanel) WEditor(org.adempiere.webui.editor.WEditor) Image(org.zkoss.zul.Image) WEditorPopupMenu(org.adempiere.webui.editor.WEditorPopupMenu)

Example 2 with AbstractADWindowPanel

use of org.adempiere.webui.panel.AbstractADWindowPanel 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;
}
Also used : WButtonEditor(org.adempiere.webui.editor.WButtonEditor) ADWindow(org.adempiere.webui.window.ADWindow) AbstractADWindowPanel(org.adempiere.webui.panel.AbstractADWindowPanel) WEditor(org.adempiere.webui.editor.WEditor)

Aggregations

WButtonEditor (org.adempiere.webui.editor.WButtonEditor)2 WEditor (org.adempiere.webui.editor.WEditor)2 AbstractADWindowPanel (org.adempiere.webui.panel.AbstractADWindowPanel)2 ADWindow (org.adempiere.webui.window.ADWindow)2 WEditorPopupMenu (org.adempiere.webui.editor.WEditorPopupMenu)1 Image (org.zkoss.zul.Image)1 Listcell (org.zkoss.zul.Listcell)1