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);
}
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;
}
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);
}
}
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);
}
Aggregations