use of org.zkoss.zul.Menuitem in project adempiere by adempiere.
the class WReport method onEvent.
// getAD_Table_ID
public void onEvent(Event event) {
if (event.getTarget() instanceof Menuitem) {
Menuitem mi = (Menuitem) event.getTarget();
launchReport(m_list.get(Integer.parseInt(mi.getValue().toString())));
}
}
use of org.zkoss.zul.Menuitem in project adempiere by adempiere.
the class AbstractADWindowPanel method onLock.
/**
* @see ToolbarListener#onLock()
*/
public void onLock() {
if (!toolbar.isPersonalLock)
return;
final int record_ID = curTab.getRecord_ID();
if (// No Key
record_ID == -1)
return;
if (m_popup == null) {
m_popup = new Menupopup();
m_lock = new Menuitem(Msg.translate(Env.getCtx(), "Lock"));
m_popup.appendChild(m_lock);
m_lock.addEventListener(Events.ON_CLICK, new EventListener() {
public void onEvent(Event event) throws Exception {
curTab.lock(Env.getCtx(), curTab.getRecord_ID(), !toolbar.getButton("Lock").isPressed());
// reload
curTab.loadAttachments();
toolbar.lock(curTab.isLocked());
}
});
m_access = new Menuitem(Msg.translate(Env.getCtx(), "RecordAccessDialog"));
m_popup.appendChild(m_access);
m_access.addEventListener(Events.ON_CLICK, new EventListener() {
public void onEvent(Event event) throws Exception {
new WRecordAccessDialog(null, curTab.getAD_Table_ID(), curTab.getRecord_ID());
toolbar.lock(curTab.isLocked());
}
});
m_popup.setPage(toolbar.getButton("Lock").getPage());
}
m_popup.open(toolbar.getButton("Lock"));
}
use of org.zkoss.zul.Menuitem in project adempiere by adempiere.
the class WStringEditor method init.
private void init(String obscureType) {
if (gridField != null) {
getComponent().setMaxlength(gridField.getFieldLength());
int displayLength = gridField.getDisplayLength();
if (displayLength <= 0 || displayLength > MAX_DISPLAY_LENGTH) {
displayLength = MAX_DISPLAY_LENGTH;
}
getComponent().setCols(displayLength);
if (gridField.getDisplayType() == DisplayType.Text) {
getComponent().setMultiline(true);
getComponent().setRows(3);
((HtmlBasedComponent) getComponent()).setSclass("field-text");
} else if (gridField.getDisplayType() == DisplayType.TextLong) {
getComponent().setMultiline(true);
getComponent().setRows(5);
((HtmlBasedComponent) getComponent()).setSclass("field-textlong");
} else if (gridField.getDisplayType() == DisplayType.Memo) {
getComponent().setMultiline(true);
getComponent().setRows(8);
((HtmlBasedComponent) getComponent()).setSclass("field-memo");
}
if (getComponent() instanceof org.zkoss.zul.api.Textbox)
((StringBox) component).setObscureType(obscureType);
popupMenu = new WEditorPopupMenu(false, false, true);
Menuitem editor = new Menuitem(Msg.getMsg(Env.getCtx(), "Editor"), "images/Editor16.png");
editor.setAttribute("EVENT", EDITOR_EVENT);
editor.addEventListener(Events.ON_CLICK, popupMenu);
popupMenu.appendChild(editor);
if (gridField != null && gridField.getGridTab() != null) {
WRecordInfo.addMenu(popupMenu);
}
getComponent().setContext(popupMenu.getId());
if (gridField.isAutocomplete()) {
Combobox combo = (Combobox) getComponent();
combo.setAutodrop(true);
combo.setAutocomplete(true);
combo.setButtonVisible(false);
List<String> items = gridField.getEntries();
for (String s : items) {
combo.appendItem(s);
}
}
}
}
use of org.zkoss.zul.Menuitem in project adempiere by adempiere.
the class WEditorPopupMenu method init.
private void init() {
if (zoomEnabled) {
zoomItem = new Menuitem();
zoomItem.setAttribute(EVENT_ATTRIBUTE, ZOOM_EVENT);
zoomItem.setLabel(Util.cleanAmp(Msg.getMsg(Env.getCtx(), "Zoom")));
zoomItem.setImage(ServletFns.resolveThemeURL("~./images/Zoom16.png"));
zoomItem.addEventListener(Events.ON_CLICK, this);
this.appendChild(zoomItem);
}
if (requeryEnabled) {
requeryItem = new Menuitem();
requeryItem.setAttribute(EVENT_ATTRIBUTE, REQUERY_EVENT);
requeryItem.setLabel(Util.cleanAmp(Msg.getMsg(Env.getCtx(), "Refresh")));
requeryItem.setImage(ServletFns.resolveThemeURL("~./images/Refresh16.png"));
requeryItem.addEventListener(Events.ON_CLICK, this);
this.appendChild(requeryItem);
}
if (preferencesEnabled) {
prefItem = new Menuitem();
prefItem.setAttribute(EVENT_ATTRIBUTE, PREFERENCE_EVENT);
prefItem.setLabel(Util.cleanAmp(Msg.getMsg(Env.getCtx(), "ValuePreference")));
prefItem.setImage(ServletFns.resolveThemeURL("~./images/VPreference16.png"));
prefItem.addEventListener(Events.ON_CLICK, this);
this.appendChild(prefItem);
}
if (newEnabled) {
newItem = new Menuitem();
newItem.setAttribute(EVENT_ATTRIBUTE, NEW_EVENT);
newItem.setLabel(Util.cleanAmp(Msg.getMsg(Env.getCtx(), "New")));
newItem.setImage(ServletFns.resolveThemeURL("~./images/New16.png"));
newItem.addEventListener(Events.ON_CLICK, this);
this.appendChild(newItem);
}
// Elaine 2009/02/16 - update record
if (updateEnabled) {
updateItem = new Menuitem();
updateItem.setAttribute(EVENT_ATTRIBUTE, UPDATE_EVENT);
updateItem.setLabel(Util.cleanAmp(Msg.getMsg(Env.getCtx(), "Update")));
updateItem.setImage(ServletFns.resolveThemeURL("~./images/InfoBPartner16.png"));
updateItem.addEventListener(Events.ON_CLICK, this);
this.appendChild(updateItem);
}
//
updateItemsDyn();
}
use of org.zkoss.zul.Menuitem in project adempiere by adempiere.
the class WRecordInfo method addMenu.
/**
* Add change log menu item
* @param popupMenu
*/
public static void addMenu(WEditorPopupMenu popupMenu) {
Menuitem changeLogItem = new Menuitem();
changeLogItem.setLabel(Msg.getElement(Env.getCtx(), "AD_ChangeLog_ID"));
changeLogItem.setImage("/images/ChangeLog16.png");
changeLogItem.setAttribute(WEditorPopupMenu.EVENT_ATTRIBUTE, WEditorPopupMenu.CHANGE_LOG_EVENT);
changeLogItem.addEventListener(Events.ON_CLICK, popupMenu);
// Add
popupMenu.appendChild(changeLogItem);
}
Aggregations