use of org.adempiere.webui.editor.WTableDirEditor in project adempiere by adempiere.
the class FindWindow method getEditorComponent.
// addOperators
/**
* Get Editor
* @param row row
* @return Editor component
**/
public Component getEditorComponent(ListItem row, boolean to) {
String columnName = getColumnName(row);
boolean between = false;
Listbox listOp = (Listbox) row.getFellow("listOperator" + row.getId());
String betweenValue = listOp.getSelectedItem().getValue().toString();
String opValue = MQuery.OPERATORS[MQuery.BETWEEN_INDEX].getValue();
if (to && betweenValue != null && betweenValue.equals(opValue))
between = true;
boolean enabled = !to || (to && between);
// Create Editor
GridField field = getTargetMField(columnName);
if (field == null)
return new Label("");
WEditor editor = null;
if (field.isKey())
editor = new WNumberEditor(field);
else
editor = WebEditorFactory.getEditor(field, true);
if (editor == null)
editor = new WStringEditor(field);
field.addPropertyChangeListener(editor);
editor.addValueChangeListener(this);
editor.setValue(null);
editor.setReadWrite(enabled);
editor.setVisible(enabled);
editor.dynamicDisplay();
// So we have to do this after setting the ReadWrite
if (enabled && editor instanceof WTableDirEditor) {
((WTableDirEditor) editor).actionRefresh();
}
//
return editor.getComponent();
}
use of org.adempiere.webui.editor.WTableDirEditor in project adempiere by adempiere.
the class WTrxMaterial method dynParameter.
// jbInit
/**
* Initialize Parameter fields
* @throws Exception if Lookups cannot be initialized
*/
private void dynParameter() throws Exception {
Properties ctx = Env.getCtx();
// Organization
MLookup orgLookup = MLookupFactory.get(ctx, m_WindowNo, 0, 3660, DisplayType.TableDir);
orgField = new WTableDirEditor("AD_Org_ID", false, false, true, orgLookup);
// orgField.addVetoableChangeListener(this);
// Locator
MLocatorLookup locatorLookup = new MLocatorLookup(ctx, m_WindowNo);
locatorField = new WLocatorEditor("M_Locator_ID", false, false, true, locatorLookup, m_WindowNo);
// locatorField.addVetoableChangeListener(this);
// Product
MLookup productLookup = MLookupFactory.get(ctx, m_WindowNo, 0, 3668, DisplayType.Search);
productField = new WSearchEditor("M_Product_ID", false, false, true, productLookup);
productField.addValueChangeListener(this);
// Movement Type
MLookup mtypeLookup = MLookupFactory.get(ctx, m_WindowNo, 0, 3666, DisplayType.List);
mtypeField = new WTableDirEditor("MovementType", false, false, true, mtypeLookup);
// Dates
dateFField = new WDateEditor("DateFrom", false, false, true, Msg.getMsg(Env.getCtx(), "DateFrom"));
dateTField = new WDateEditor("DateTo", false, false, true, Msg.getMsg(Env.getCtx(), "DateTo"));
//
confirmPanel.addActionListener(this);
statusBar.setStatusLine("");
}
use of org.adempiere.webui.editor.WTableDirEditor in project adempiere by adempiere.
the class WStocktake method dynParameter.
// jbInit
/**
* Initialize Parameter fields
* @throws Exception if Lookups cannot be initialized
*/
private void dynParameter() throws Exception {
Properties ctx = Env.getCtx();
// Physical Inventory
String vcode = "M_Inventory.IsStocktake='Y' ";
MLookup inventoryLookup = MLookupFactory.get(ctx, m_WindowNo, 3563, DisplayType.TableDir, Env.getLanguage(Env.getCtx()), "M_Inventory_ID", 53249, true, vcode);
inventoryField = new WTableDirEditor("M_Inventory_ID", false, false, true, inventoryLookup);
// Locator
MLocatorLookup locatorLookup = new MLocatorLookup(ctx, m_WindowNo);
locatorField = new WLocatorEditor("M_Locator_ID", false, false, true, locatorLookup, m_WindowNo);
// locatorField.addVetoableChangeListener(this);
// Product
MLookup productLookup = MLookupFactory.get(ctx, m_WindowNo, 0, 3668, DisplayType.Search);
productField = new WSearchEditor("M_Product_ID", false, false, true, productLookup);
productField.addValueChangeListener(this);
// Aisle(X)
MLookup aislexLookup = MLookupFactory.get(ctx, m_WindowNo, 1399, DisplayType.Table, Env.getLanguage(Env.getCtx()), "X", 53562, false, null);
aislexField = new WTableDirEditor("X", false, false, true, aislexLookup);
// Dates
lineFField = new WNumberEditor();
lineTField = new WNumberEditor();
//
confirmPanel.addActionListener(this);
statusBar.setStatusLine("");
}
use of org.adempiere.webui.editor.WTableDirEditor in project adempiere by adempiere.
the class InfoAssignmentPanel method statInit.
// InfoAssignmentPanel
/**
* Static Setup - add fields to parameterPanel.
* <pre>
* ResourceType Resource DateTimeFrom DateTimeTo New
* </pre>
*/
private void statInit() {
fieldResourceType = new WTableDirEditor(MLookupFactory.get(Env.getCtx(), p_WindowNo, 0, MColumn.getColumn_ID(MResourceType.Table_Name, MResourceType.COLUMNNAME_S_ResourceType_ID), DisplayType.TableDir), Msg.translate(Env.getCtx(), "S_ResourceType_ID"), "", false, false, true);
fieldResourceType.getComponent().addEventListener(Events.ON_CHANGE, this);
;
fieldResourceType.getComponent().setAttribute("zk_component_ID", "Lookup_Criteria_S_ResourceType_ID");
fieldResource = new WTableDirEditor(MLookupFactory.get(Env.getCtx(), p_WindowNo, 0, MColumn.getColumn_ID(MResource.Table_Name, MResource.COLUMNNAME_S_Resource_ID), DisplayType.TableDir), Msg.translate(Env.getCtx(), "S_Resource_ID"), "", false, false, true);
fieldResource.getComponent().addEventListener(Events.ON_CHANGE, this);
fieldResource.getComponent().setAttribute("zk_component_ID", "Lookup_Criteria_S_Resource_ID");
bNew.setImage(ServletFns.resolveThemeURL("~./images/New16.png"));
fieldFrom.setWidth("180px");
fieldTo.setWidth("180px");
fieldFrom.setAttribute("zk_component_ID", "Lookup_Criteria_fieldFrom");
fieldFrom.addEventListener(Events.ON_CHANGE, this);
fieldTo.setAttribute("zk_component_ID", "Lookup_Criteria_fieldTo");
fieldTo.addEventListener(Events.ON_CHANGE, this);
SimpleDateFormat dateFormat = DisplayType.getDateFormat(DisplayType.Date, AEnv.getLanguage(Env.getCtx()));
fieldFrom.setFormat(dateFormat.toPattern());
fieldTo.setFormat(dateFormat.toPattern());
bNew.addEventListener(Events.ON_CLICK, this);
bNew.setAttribute("zk_component_ID", "Lookup_Criteria_bNew");
Rows rows = new Rows();
Row row = new Row();
rows.appendChild(row);
row.appendChild(fieldResourceType.getLabel().rightAlign());
row.appendChild(fieldResource.getLabel().rightAlign());
row.appendChild(labelFrom.rightAlign());
row.appendChild(labelTo.rightAlign());
row.appendChild(new Label());
row = new Row();
rows.appendChild(row);
row.appendChild(fieldResourceType.getComponent());
row.appendChild(fieldResource.getComponent());
Div div = new Div();
div.setAlign("right");
div.appendChild(fieldFrom);
row.appendChild(div);
div = new Div();
div.setAlign("right");
div.appendChild(fieldTo);
row.appendChild(div);
row.appendChild(bNew);
p_criteriaGrid.appendChild(rows);
super.setSizes();
}
use of org.adempiere.webui.editor.WTableDirEditor in project adempiere by adempiere.
the class WPreference method init.
private void init() {
ThemeUtils.addSclass("ad-wpreference", this);
Div div = new Div();
autoCommit = new WYesNoEditor("AutoCommit", Msg.getMsg(Env.getCtx(), "AutoCommit", true), null, false, false, true);
div.appendChild(autoCommit.getComponent());
autoCommit.getComponent().setTooltiptext(Msg.getMsg(Env.getCtx(), "AutoCommit", false));
autoCommit.getComponent().setAttribute("zk_component_ID", "Preference_autoCommit");
autoCommit.getComponent().setAttribute("zk_component_prefix", "Preference_");
this.appendChild(div);
autoNew = new WYesNoEditor("AutoNew", Msg.getMsg(Env.getCtx(), "AutoNew", true), null, false, false, true);
autoNew.getComponent().setTooltiptext(Msg.getMsg(Env.getCtx(), "AutoNew", false));
autoNew.getComponent().setAttribute("zk_component_ID", "Preference_autoNew");
autoNew.getComponent().setAttribute("zk_component_prefix", "Preference_");
div = new Div();
div.appendChild(autoNew.getComponent());
this.appendChild(div);
tabCollapsible = new WYesNoEditor("WindowTabCollapsible", Msg.getMsg(Env.getCtx(), "WindowTabCollapsible", true), null, false, false, true);
tabCollapsible.getComponent().setTooltiptext(Msg.getMsg(Env.getCtx(), "WindowTabCollapsible", false));
tabCollapsible.getComponent().setAttribute("zk_component_ID", "Preference_tabCollapsible");
tabCollapsible.getComponent().setAttribute("zk_component_prefix", "Preference_");
div = new Div();
div.appendChild(tabCollapsible.getComponent());
this.appendChild(div);
div = new Div();
Label label = new Label(Msg.getMsg(Env.getCtx(), "WindowTabPlacement", true));
label.setTooltiptext(Msg.getMsg(Env.getCtx(), "WindowTabPlacement", false));
div.appendChild(label);
div.appendChild(new Space());
tabPlacement = new Combobox();
tabPlacement.appendItem(Msg.getMsg(Env.getCtx(), "Left", true), "Left");
tabPlacement.appendItem(Msg.getMsg(Env.getCtx(), "Right", true), "Right");
tabPlacement.setAttribute("zk_component_ID", "Preference_tabPlacement");
tabPlacement.setAttribute("zk_component_prefix", "Preference_");
div.appendChild(tabPlacement);
this.appendChild(div);
div = new Div();
label = new Label(Msg.getMsg(Env.getCtx(), "Theme", true));
label.setTooltiptext(Msg.getMsg(Env.getCtx(), "SelectTheme", false));
div.appendChild(label);
div.appendChild(new Space());
selectedTheme = new WTableDirEditor("AD_Theme_ID", true, false, true, MLookupFactory.get(Env.getCtx(), 0, 0, MColumn.getColumn_ID(MTheme.Table_Name, MTheme.COLUMNNAME_AD_Theme_ID), DisplayType.TableDir));
selectedTheme.getComponent().addEventListener(Events.ON_CHANGE, this);
selectedTheme.getComponent().setAttribute("zk_component_ID", "Preference_SetTheme");
selectedTheme.getComponent().setAttribute("zk_component_prefix", "Preference_");
div.appendChild(selectedTheme.getComponent());
this.appendChild(div);
Separator separator = new Separator();
separator.setSpacing("20px");
div = new Div();
div.appendChild(separator);
this.appendChild(div);
ToolBar toolbar = new ToolBar();
toolbar.setAlign("end");
this.appendChild(toolbar);
ToolBarButton btn = new ToolBarButton("");
btn.setName("btnSave");
btn.setImage(ServletFns.resolveThemeURL("~./images/Save24.png"));
btn.setTooltiptext(Msg.getMsg(Env.getCtx(), "Save"));
btn.addEventListener(Events.ON_CLICK, this);
toolbar.appendChild(btn);
UserPreference preference = SessionManager.getSessionApplication().getUserPreference();
if (Integer.parseInt(preference.getProperty(UserPreference.P_ZK_THEME_PREFERENCE)) > 0) {
m_preferredTheme_ID = Integer.parseInt(preference.getProperty(UserPreference.P_ZK_THEME_PREFERENCE));
}
autoCommit.setValue(preference.getProperty(UserPreference.P_AUTO_COMMIT));
autoNew.setValue(preference.getProperty(UserPreference.P_AUTO_NEW));
tabCollapsible.setValue(preference.getProperty(UserPreference.P_WINDOW_TAB_COLLAPSIBLE));
tabPlacement.setValue(preference.getProperty(UserPreference.P_WINDOW_TAB_PLACEMENT));
selectedTheme.setValue(m_preferredTheme_ID);
}
Aggregations