Search in sources :

Example 11 with Menuitem

use of org.zkoss.zul.Menuitem in project adempiere by adempiere.

the class WArchive method getArchives.

/**
	 * 	Display Request Options - New/Existing.
	 * 	@param invoker button
	 */
private void getArchives(Component invoker) {
    int reportCount = 0;
    int documentCount = 0;
    m_where = new StringBuffer();
    m_where.append("(AD_Table_ID=").append(m_AD_Table_ID).append(" AND Record_ID=").append(m_Record_ID).append(")");
    //	Get all for BP
    if (m_AD_Table_ID == MBPartner.Table_ID)
        m_where.append(" OR C_BPartner_ID=").append(m_Record_ID);
    //
    StringBuffer sql = new StringBuffer("SELECT IsReport, COUNT(*) FROM AD_Archive ").append("WHERE (AD_Table_ID=? AND Record_ID=?) ");
    if (m_AD_Table_ID == MBPartner.Table_ID)
        sql.append(" OR C_BPartner_ID=?");
    sql.append(" GROUP BY IsReport");
    PreparedStatement pstmt = null;
    ResultSet rs = null;
    try {
        pstmt = DB.prepareStatement(sql.toString(), null);
        pstmt.setInt(1, m_AD_Table_ID);
        pstmt.setInt(2, m_Record_ID);
        if (m_AD_Table_ID == MBPartner.Table_ID)
            pstmt.setInt(3, m_Record_ID);
        rs = pstmt.executeQuery();
        while (rs.next()) {
            if ("Y".equals(rs.getString(1)))
                reportCount += rs.getInt(2);
            else
                documentCount += rs.getInt(2);
        }
    } catch (Exception e) {
        log.log(Level.SEVERE, sql.toString(), e);
    } finally {
        DB.close(rs, pstmt);
        rs = null;
        pstmt = null;
    }
    //
    if (documentCount > 0) {
        m_documents = new Menuitem(Msg.getMsg(Env.getCtx(), "ArchivedDocuments") + " (" + documentCount + ")");
        m_documents.addEventListener(Events.ON_CLICK, this);
        m_popup.appendChild(m_documents);
    }
    if (reportCount > 0) {
        m_reports = new Menuitem(Msg.getMsg(Env.getCtx(), "ArchivedReports") + " (" + reportCount + ")");
        m_reports.addEventListener(Events.ON_CLICK, this);
        m_popup.appendChild(m_reports);
    }
    //	All Reports
    String sql1 = "SELECT COUNT(*) FROM AD_Archive WHERE AD_Table_ID=? AND IsReport='Y'";
    int allReports = DB.getSQLValue(null, sql1, m_AD_Table_ID);
    if (allReports > 0) {
        m_reportsAll = new Menuitem(Msg.getMsg(Env.getCtx(), "ArchivedReportsAll") + " (" + reportCount + ")");
        m_reportsAll.addEventListener(Events.ON_CLICK, this);
        m_popup.appendChild(m_reportsAll);
    }
    if (documentCount == 0 && reportCount == 0 && allReports == 0)
        m_popup.appendChild(new Menuitem(Msg.getMsg(Env.getCtx(), "ArchivedNone")));
    //
    m_popup.setPage(invoker.getPage());
    m_popup.open(invoker);
}
Also used : Menuitem(org.zkoss.zul.Menuitem) ResultSet(java.sql.ResultSet) PreparedStatement(java.sql.PreparedStatement)

Example 12 with Menuitem

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

Example 13 with Menuitem

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

Example 14 with Menuitem

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

Example 15 with Menuitem

use of org.zkoss.zul.Menuitem in project adempiere by adempiere.

the class WFieldRecordInfo 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(ServletFns.resolveThemeURL("~./images/ChangeLog16.png"));
    changeLogItem.setAttribute(WEditorPopupMenu.EVENT_ATTRIBUTE, WEditorPopupMenu.CHANGE_LOG_EVENT);
    changeLogItem.addEventListener(Events.ON_CLICK, popupMenu);
    popupMenu.appendChild(changeLogItem);
}
Also used : Menuitem(org.zkoss.zul.Menuitem)

Aggregations

Menuitem (org.zkoss.zul.Menuitem)15 Event (org.zkoss.zk.ui.event.Event)3 Menupopup (org.zkoss.zul.Menupopup)3 PreparedStatement (java.sql.PreparedStatement)2 ResultSet (java.sql.ResultSet)2 KeyNamePair (org.compiere.util.KeyNamePair)2 EventListener (org.zkoss.zk.ui.event.EventListener)2 WArchiveViewer (org.adempiere.webui.apps.form.WArchiveViewer)1 Combobox (org.adempiere.webui.component.Combobox)1 Label (org.adempiere.webui.component.Label)1 ListItem (org.adempiere.webui.component.ListItem)1 Listbox (org.adempiere.webui.component.Listbox)1 Row (org.adempiere.webui.component.Row)1 Rows (org.adempiere.webui.component.Rows)1 ActionEvent (org.adempiere.webui.event.ActionEvent)1 ApplicationException (org.adempiere.webui.exception.ApplicationException)1 ADForm (org.adempiere.webui.panel.ADForm)1 ADWindow (org.adempiere.webui.window.ADWindow)1 WRecordAccessDialog (org.adempiere.webui.window.WRecordAccessDialog)1 DataStatusEvent (org.compiere.model.DataStatusEvent)1