Search in sources :

Example 1 with Image

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;
}
Also used : WButtonEditor(org.adempiere.webui.editor.WButtonEditor) Listcell(org.zkoss.zul.Listcell) ADWindow(org.adempiere.webui.window.ADWindow) AbstractADWindowPanel(org.adempiere.webui.panel.AbstractADWindowPanel) WEditor(org.adempiere.webui.editor.WEditor) Image(org.zkoss.zul.Image) WEditorPopupMenu(org.adempiere.webui.editor.WEditorPopupMenu)

Example 2 with Image

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);
            }
        }
    }
//
}
Also used : DropEvent(org.zkoss.zk.ui.event.DropEvent) Treeitem(org.zkoss.zul.Treeitem) Button(org.adempiere.webui.component.Button) Panelchildren(org.zkoss.zul.Panelchildren) Component(org.zkoss.zk.ui.Component) Image(org.zkoss.zul.Image) Treerow(org.zkoss.zul.Treerow)

Example 3 with Image

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);
            }
        }
    }
}
Also used : Button(org.adempiere.webui.component.Button) HtmlBasedComponent(org.zkoss.zk.ui.HtmlBasedComponent) Image(org.zkoss.zul.Image)

Example 4 with Image

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);
            }
        }
    });
}
Also used : Table(org.zkoss.zhtml.Table) Label(org.adempiere.webui.component.Label) MSession(org.compiere.model.MSession) Image(org.zkoss.zul.Image) WrongValueException(org.zkoss.zk.ui.WrongValueException) ApplicationException(org.adempiere.webui.exception.ApplicationException) Div(org.zkoss.zhtml.Div) Td(org.zkoss.zhtml.Td) ConfirmPanel(org.adempiere.webui.component.ConfirmPanel) Event(org.zkoss.zk.ui.event.Event) TokenEvent(org.adempiere.webui.event.TokenEvent) MUser(org.compiere.model.MUser) Tr(org.zkoss.zhtml.Tr)

Example 5 with Image

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");
}
Also used : Image(org.zkoss.zul.Image)

Aggregations

Image (org.zkoss.zul.Image)14 AImage (org.zkoss.image.AImage)5 BufferedImage (java.awt.image.BufferedImage)3 Label (org.adempiere.webui.component.Label)3 Borderlayout (org.adempiere.webui.component.Borderlayout)2 Button (org.adempiere.webui.component.Button)2 ConfirmPanel (org.adempiere.webui.component.ConfirmPanel)2 ParseException (org.json.simple.parser.ParseException)2 Table (org.zkoss.zhtml.Table)2 Td (org.zkoss.zhtml.Td)2 Tr (org.zkoss.zhtml.Tr)2 Component (org.zkoss.zk.ui.Component)2 Event (org.zkoss.zk.ui.event.Event)2 BoundingBox (au.org.emii.portal.value.BoundingBox)1 Color (java.awt.Color)1 HashMap (java.util.HashMap)1 List (java.util.List)1 ProductInfo (org.adempiere.pos.service.ProductInfo)1 Panel (org.adempiere.webui.component.Panel)1 Tabpanel (org.adempiere.webui.component.Tabpanel)1