use of org.zkoss.zul.Image 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.zkoss.zul.Image in project adempiere by adempiere.
the class DPFavourites method onEvent.
public void onEvent(Event event) {
Component comp = event.getTarget();
String eventName = event.getName();
if (eventName.equals(Events.ON_CLICK)) {
if (comp instanceof Button) {
Button btn = (Button) comp;
int menuId = 0;
try {
menuId = Integer.valueOf(btn.getName());
} catch (NumberFormatException e) {
}
if (menuId > 0)
SessionManager.getAppDesktop().onMenuSelected(menuId);
}
} else // Elaine 2008/07/24
if (eventName.equals(Events.ON_DROP)) {
DropEvent de = (DropEvent) event;
Component dragged = de.getDragged();
if (comp instanceof Panelchildren) {
if (dragged instanceof Treerow) {
Treerow treerow = (Treerow) dragged;
Treeitem treeitem = (Treeitem) treerow.getParent();
addItem(treeitem);
}
} else if (comp instanceof Image) {
if (dragged instanceof Button) {
Button btn = (Button) dragged;
removeLink(btn);
}
}
}
//
}
use of org.zkoss.zul.Image in project adempiere by adempiere.
the class WEditor method fillHorizontal.
/**
* Stretch editor component to fill container
*/
public void fillHorizontal() {
//streach component to fill grid cell
if (getComponent() instanceof HtmlBasedComponent) {
//can't stretch bandbox & datebox
if (!(getComponent() instanceof Bandbox) && !(getComponent() instanceof Datebox)) {
String width = "100%";
if (getComponent() instanceof Button) {
Button btn = (Button) getComponent();
String zclass = btn.getZclass();
if (gridField.getDisplayType() == DisplayType.Image) {
if (!zclass.contains("image-button-field ")) {
btn.setZclass("image-button-field " + zclass);
}
} else if (!zclass.contains("form-button ")) {
btn.setZclass("form-button " + zclass);
}
} else if (getComponent() instanceof Image) {
Image image = (Image) getComponent();
image.setWidth("48px");
image.setHeight("48px");
} else {
((HtmlBasedComponent) getComponent()).setWidth(width);
}
}
}
}
use of org.zkoss.zul.Image in project adempiere by adempiere.
the class LoginPanel method init.
private void init() {
//this.setContentSclass(ITheme.LOGIN_WINDOW_CLASS);
Div div = new Div();
ThemeUtils.addSclass("ad-loginpanel-header", div);
// TODO - localization
Label label = new Label("Login");
ThemeUtils.addSclass("ad-loginpanel-header-text", label);
div.appendChild(label);
this.appendChild(div);
Table table = new Table();
table.setId("grdLogin");
ThemeUtils.addSclass("ad-loginpanel-body", table);
this.appendChild(table);
Tr tr = new Tr();
table.appendChild(tr);
Td td = new Td();
ThemeUtils.addSclass("ad-loginpanel-header-logo", td);
tr.appendChild(td);
td.setDynamicProperty("colspan", "2");
Image image = new Image();
image.setSrc(ThemeUtils.getLargeLogo());
ThemeUtils.addSclass("ad-loginpanel-header-logo", image);
td.appendChild(image);
tr = new Tr();
tr.setId("rowUser");
table.appendChild(tr);
td = new Td();
tr.appendChild(td);
ThemeUtils.addSclass("login-label", td);
td.appendChild(lblUserId);
td = new Td();
ThemeUtils.addSclass("login-field", td);
tr.appendChild(td);
td.appendChild(txtUserId);
tr = new Tr();
tr.setId("rowPassword");
table.appendChild(tr);
td = new Td();
tr.appendChild(td);
ThemeUtils.addSclass("login-label", td);
td.appendChild(lblPassword);
td = new Td();
ThemeUtils.addSclass("login-field", td);
tr.appendChild(td);
td.appendChild(txtPassword);
tr = new Tr();
tr.setId("rowLanguage");
table.appendChild(tr);
td = new Td();
tr.appendChild(td);
ThemeUtils.addSclass("login-label", td);
td.appendChild(lblLanguage);
td = new Td();
ThemeUtils.addSclass("login-field", td);
tr.appendChild(td);
td.appendChild(lstLanguage);
if (MSystem.isZKRememberUserAllowed()) {
tr = new Tr();
tr.setId("rowRememberMe");
table.appendChild(tr);
td = new Td();
tr.appendChild(td);
ThemeUtils.addSclass("login-label", td);
td.appendChild(new Label(""));
td = new Td();
ThemeUtils.addSclass("login-field", td);
tr.appendChild(td);
td.appendChild(chkRememberMe);
}
div = new Div();
ThemeUtils.addSclass("ad-loginpanel-footer", div);
ConfirmPanel pnlButtons = new ConfirmPanel(false);
pnlButtons.addActionListener(this);
ThemeUtils.addSclass("ad-loginpanel-footer-pnl", pnlButtons);
pnlButtons.getButton(ConfirmPanel.A_OK).setSclass("login-btn");
div.appendChild(pnlButtons);
this.appendChild(div);
this.addEventListener(TokenEvent.ON_USER_TOKEN, new EventListener<Event>() {
@Override
public void onEvent(Event event) throws Exception {
String[] data = (String[]) event.getData();
try {
int AD_Session_ID = Integer.parseInt(data[0]);
MSession session = new MSession(Env.getCtx(), AD_Session_ID, null);
if (session.get_ID() == AD_Session_ID) {
int AD_User_ID = session.getCreatedBy();
MUser user = MUser.get(Env.getCtx(), AD_User_ID);
if (user != null && user.get_ID() == AD_User_ID) {
String token = data[1];
if (BrowserToken.validateToken(session, user, token)) {
if (MSystem.isZKRememberUserAllowed()) {
txtUserId.setValue(user.getName());
onUserIdChange();
chkRememberMe.setChecked(true);
}
if (MSystem.isZKRememberPasswordAllowed()) {
txtPassword.setValue(token);
txtPassword.setAttribute("user.token.hash", token);
txtPassword.setAttribute("user.token.sid", AD_Session_ID);
}
}
}
}
} catch (Exception e) {
//safe to ignore
logger.log(Level.INFO, e.getLocalizedMessage(), e);
}
}
});
}
use of org.zkoss.zul.Image in project adempiere by adempiere.
the class LogoPanel method init.
private void init() {
// TODO - add this to the Theme model
imgLogo = new Image(ServletFns.resolveThemeURL("~./images/logo.png"));
this.appendChild(imgLogo);
this.setWidth("250px");
}
Aggregations