Search in sources :

Example 1 with WEditorPopupMenu

use of org.adempiere.webui.editor.WEditorPopupMenu in project adempiere by adempiere.

the class WBrowserSearch method formatEditor.

public void formatEditor(CEditor editor1, CEditor editor2) {
    WEditor editor = (WEditor) editor1;
    WEditor editorTo = (WEditor) editor2;
    //	
    configColumns(editor, editorTo);
    WEditorPopupMenu popupMenu;
    // Editor
    //setup editor context menu
    popupMenu = editor.getPopupMenu();
    if (popupMenu != null) {
        popupMenu.addMenuListener((ContextMenuListener) editor);
        mainPanel.appendChild(popupMenu);
    }
    //streach component to fill grid cell
    editor.fillHorizontal();
    Div div = new Div();
    div.setAlign("right");
    Label label = editor.getLabel();
    div.appendChild(label);
    if (label.getDecorator() != null)
        div.appendChild(label.getDecorator());
    //	
    currentRow.appendChild(div);
    //	Add Child
    cols += 2;
    //	
    Hbox box;
    if (editorTo != null) {
        box = new Hbox();
        box.appendChild(editor.getComponent());
    } else {
        currentRow.appendChild(editor.getComponent());
        m_separators.add(null);
        return;
    }
    // EditorTo
    //setup editor context menu
    popupMenu = editorTo.getPopupMenu();
    if (popupMenu != null) {
        popupMenu.addMenuListener((ContextMenuListener) editor2);
        mainPanel.appendChild(popupMenu);
    }
    //
    editorTo.fillHorizontal();
    Label separator = new Label(" - ");
    m_separators.add(separator);
    box.appendChild(separator);
    box.appendChild(editorTo.getComponent());
    //	Add
    currentRow.appendChild(box);
}
Also used : Div(org.zkoss.zul.Div) Hbox(org.zkoss.zul.Hbox) Label(org.adempiere.webui.component.Label) WEditor(org.adempiere.webui.editor.WEditor) WEditorPopupMenu(org.adempiere.webui.editor.WEditorPopupMenu)

Example 2 with WEditorPopupMenu

use of org.adempiere.webui.editor.WEditorPopupMenu 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 3 with WEditorPopupMenu

use of org.adempiere.webui.editor.WEditorPopupMenu in project adempiere by adempiere.

the class GridTabRowRenderer method editCurrentRow.

/**
	 * Enter edit mode
	 */
public void editCurrentRow() {
    if (currentRow != null && currentRow.getParent() != null && currentRow.isVisible() && grid != null && grid.isVisible() && grid.getParent() != null && grid.getParent().isVisible()) {
        int columnCount = gridTab.getTableModel().getColumnCount();
        GridField[] gridField = gridTab.getFields();
        org.zkoss.zul.Columns columns = grid.getColumns();
        int colIndex = -1;
        for (int i = 0; i < columnCount; i++) {
            if (!(gridField[i].isDisplayed() && gridField[i].isDisplayedGrid())) {
                continue;
            }
            colIndex++;
            if (editors.get(gridField[i]) == null) {
                WEditor editor = WebEditorFactory.getEditor(gridField[i], true);
                if (!gridField[i].isUpdateable() && gridTab.getRecord_ID() <= 0) {
                    editor.setReadWrite(true);
                    editor.dynamicDisplay();
                }
                editors.put(gridField[i], editor);
            }
            org.zkoss.zul.Column column = (org.zkoss.zul.Column) columns.getChildren().get(colIndex);
            if (column.isVisible()) {
                Div div = (Div) currentRow.getChildren().get(colIndex);
                WEditor editor = getEditorCell(gridField[i], currentValues[i], i);
                div.appendChild(editor.getComponent());
                WEditorPopupMenu popupMenu = editor.getPopupMenu();
                if (popupMenu != null) {
                    popupMenu.addMenuListener((ContextMenuListener) editor);
                    div.appendChild(popupMenu);
                }
                div.getFirstChild().setVisible(false);
                //check context
                if (!gridField[i].isDisplayed(true)) {
                    editor.setVisible(false);
                }
                editor.setReadWrite(gridField[i].isEditable(true));
            }
        }
        editing = true;
        GridTableListModel model = (GridTableListModel) grid.getModel();
        model.setEditing(true);
    }
}
Also used : GridField(org.compiere.model.GridField) WEditor(org.adempiere.webui.editor.WEditor) WEditorPopupMenu(org.adempiere.webui.editor.WEditorPopupMenu) Div(org.zkoss.zul.Div)

Example 4 with WEditorPopupMenu

use of org.adempiere.webui.editor.WEditorPopupMenu in project adempiere by adempiere.

the class ProcessPanel method formatEditor.

public void formatEditor(CEditor editor1, CEditor editor2) {
    //
    WEditor editor = (WEditor) editor1;
    WEditor editorTo = (WEditor) editor2;
    configColumns(editor, editorTo);
    //	
    if (editor == null) {
        return;
    }
    //streach component to fill grid cell
    editor.fillHorizontal();
    //setup editor context menu
    WEditorPopupMenu popupMenu;
    popupMenu = editor.getPopupMenu();
    if (popupMenu != null) {
        popupMenu.addMenuListener((ContextMenuListener) editor);
        mainPanel.appendChild(popupMenu);
    }
    //	
    Div div = new Div();
    div.setAlign("right");
    Label label = editor.getLabel();
    div.appendChild(label);
    if (label.getDecorator() != null)
        div.appendChild(label.getDecorator());
    //	
    currentRow.appendChild(div);
    //	Add Child
    cols += 2;
    //	
    Hbox box;
    if (editorTo != null) {
        box = new Hbox();
        box.appendChild(editor.getComponent());
    } else {
        currentRow.appendChild(editor.getComponent());
        m_separators.add(null);
        return;
    }
    //	The 2nd range editor
    editorTo.fillHorizontal();
    //setup editor context menu
    popupMenu = editorTo.getPopupMenu();
    if (popupMenu != null) {
        popupMenu.addMenuListener((ContextMenuListener) editorTo);
        mainPanel.appendChild(popupMenu);
    }
    //
    Label separator = new Label(" - ");
    m_separators.add(separator);
    box.appendChild(separator);
    box.appendChild(editorTo.getComponent());
    //	Add
    currentRow.appendChild(box);
}
Also used : Div(org.zkoss.zul.Div) Hbox(org.zkoss.zul.Hbox) Label(org.adempiere.webui.component.Label) WEditor(org.adempiere.webui.editor.WEditor) WEditorPopupMenu(org.adempiere.webui.editor.WEditorPopupMenu)

Aggregations

WEditor (org.adempiere.webui.editor.WEditor)4 WEditorPopupMenu (org.adempiere.webui.editor.WEditorPopupMenu)4 Div (org.zkoss.zul.Div)3 Label (org.adempiere.webui.component.Label)2 Hbox (org.zkoss.zul.Hbox)2 WButtonEditor (org.adempiere.webui.editor.WButtonEditor)1 AbstractADWindowPanel (org.adempiere.webui.panel.AbstractADWindowPanel)1 ADWindow (org.adempiere.webui.window.ADWindow)1 GridField (org.compiere.model.GridField)1 Image (org.zkoss.zul.Image)1 Listcell (org.zkoss.zul.Listcell)1