use of org.adempiere.webui.editor.WEditor 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.WEditor in project adempiere by adempiere.
the class ListPanel method dynamicDisplay.
/**
* validate the display properties of fields of current row
* @param col
*/
public void dynamicDisplay(int col) {
if (!gridTab.isOpen()) {
return;
}
// Selective
if (col > 0)
return;
boolean noData = gridTab.getRowCount() == 0;
List<WEditor> list = renderer.getEditors();
for (WEditor comp : list) {
GridField mField = comp.getGridField();
if (mField != null && mField.getIncluded_Tab_ID() <= 0) {
if (noData) {
comp.setReadWrite(false);
} else {
// r/w - check Context
boolean rw = mField.isEditable(true);
comp.setReadWrite(rw);
comp.dynamicDisplay();
}
}
}
// all components
}
use of org.adempiere.webui.editor.WEditor 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.WEditor 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.editor.WEditor in project adempiere by adempiere.
the class FindWindow method addSelectionColumn.
// setValues
/**
* Add Selection Column to first Tab
* @param mField field
**/
public void addSelectionColumn(GridField mField) {
log.config(mField.getHeader());
int displayLength = mField.getDisplayLength();
if (displayLength <= 0 || displayLength > FIELDLENGTH)
mField.setDisplayLength(FIELDLENGTH);
else
displayLength = 0;
// Editor
WEditor editor = null;
Label label = null;
if (mField.isRangeLookup()) {
Hbox box = new Hbox();
editor = WebEditorFactory.getEditor(mField, false);
label = editor.getLabel();
editor.setMandatory(false);
editor.setReadWrite(true);
editor.dynamicDisplay();
Component fieldLabel = editor.getComponent();
box.appendChild(editor.getComponent());
rangeFirstEditor.add(mField.getColumnName());
// The Editor
WEditor toRangeEditor = WebEditorFactory.getEditor(mField, false);
// New Field value to be updated to editor
toRangeEditor.setMandatory(false);
toRangeEditor.setReadWrite(true);
toRangeEditor.dynamicDisplay();
//
m_sEditors2.add(toRangeEditor);
Label separator = new Label(" - ");
box.appendChild(separator);
Component fieldLabel1 = toRangeEditor.getComponent();
box.appendChild(toRangeEditor.getComponent());
if (// set it back
displayLength > 0)
mField.setDisplayLength(displayLength);
//
if (isTwoColumns) {
if (!isPair)
panel = new Row();
} else
panel = new Row();
panel.appendChild(LayoutUtils.makeRightAlign(label));
panel.appendChild(box);
contentSimpleRows.appendChild(panel);
fieldLabel.addEventListener(Events.ON_OK, this);
fieldLabel1.addEventListener(Events.ON_OK, this);
} else {
editor = WebEditorFactory.getEditor(mField, false);
label = editor.getLabel();
editor.setMandatory(false);
editor.setReadWrite(true);
editor.dynamicDisplay();
Component fieldLabel = editor.getComponent();
if (// set it back
displayLength > 0)
mField.setDisplayLength(displayLength);
//
if (isTwoColumns) {
if (!isPair)
panel = new Row();
} else
panel = new Row();
panel.appendChild(LayoutUtils.makeRightAlign(label));
panel.appendChild(fieldLabel);
contentSimpleRows.appendChild(panel);
fieldLabel.addEventListener(Events.ON_OK, this);
m_sEditors2.add(null);
}
m_sEditors.add(editor);
}
Aggregations