Search in sources :

Example 1 with VButton

use of org.compiere.grid.ed.VButton in project adempiere by adempiere.

the class AProcess method startProcess.

private void startProcess(I_AD_Process process) {
    final I_AD_Process processTrl = POWrapper.translate(process, I_AD_Process.class);
    final VButton button = new VButton(// columnName,
    "StartProcess", // mandatory,
    false, // isReadOnly,
    false, // isUpdateable,
    true, processTrl.getName(), processTrl.getDescription(), processTrl.getHelp(), process.getAD_Process_ID());
    parent.actionButton(button);
}
Also used : I_AD_Process(org.compiere.model.I_AD_Process) VButton(org.compiere.grid.ed.VButton)

Example 2 with VButton

use of org.compiere.grid.ed.VButton in project adempiere by adempiere.

the class VPanel method setMnemonic.

//	setMnemonic
/**
	 * 	Set Mnemonic for Check Box or Button
	 *	@param editor check box or button - other ignored
	 *	@param predefinedMnemonic predefined Mnemonic
	 */
private void setMnemonic(VEditor editor, char predefinedMnemonic) {
    if (editor instanceof VCheckBox) {
        VCheckBox cb = (VCheckBox) editor;
        String text = cb.getText();
        int pos = text.indexOf('&');
        if (pos != -1 && predefinedMnemonic != 0) {
            text = text.substring(0, pos) + text.substring(pos + 1);
            cb.setText(text);
            cb.setSavedMnemonic(predefinedMnemonic);
            m_fields.add(cb);
            log.finest(predefinedMnemonic + " - " + cb.getName());
        } else {
            char mnemonic = getMnemonic(text, cb);
            if (mnemonic != 0)
                cb.setSavedMnemonic(mnemonic);
        //	cb.setMnemonic(mnemonic);
        }
    } else //	Button
    if (editor instanceof VButton) {
        VButton b = (VButton) editor;
        String text = b.getText();
        int pos = text.indexOf('&');
        if (pos != -1 && predefinedMnemonic != 0) {
            text = text.substring(0, pos) + text.substring(pos + 1);
            b.setText(text);
            b.setSavedMnemonic(predefinedMnemonic);
            m_fields.add(b);
            log.finest(predefinedMnemonic + " - " + b.getName());
        } else if (b.getColumnName().equals("DocAction")) {
            b.getInputMap(WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_F4, Event.SHIFT_MASK, false), "pressed");
            b.getInputMap(WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_F4, Event.SHIFT_MASK, true), "released");
        //	Util.printActionInputMap(b);
        } else if (b.getColumnName().equals("Posted")) {
            b.getInputMap(WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_F5, Event.SHIFT_MASK, false), "pressed");
            b.getInputMap(WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_F5, Event.SHIFT_MASK, true), "released");
        //	Util.printActionInputMap(b);
        } else {
            char mnemonic = getMnemonic(text, b);
            if (mnemonic != 0)
                b.setSavedMnemonic(mnemonic);
        }
    }
}
Also used : VButton(org.compiere.grid.ed.VButton) VCheckBox(org.compiere.grid.ed.VCheckBox)

Example 3 with VButton

use of org.compiere.grid.ed.VButton in project adempiere by adempiere.

the class VPanel method setMnemonics.

/**
	 * 	Set Window level Mnemonics
	 *	@param set true if set otherwise unregister
	 */
public void setMnemonics(boolean set) {
    int size = m_fields.size();
    for (int i = 0; i < size; i++) {
        Component c = m_fields.get(i);
        if (c instanceof CLabel) {
            CLabel l = (CLabel) c;
            if (set)
                l.setDisplayedMnemonic(l.getSavedMnemonic());
            else
                l.setDisplayedMnemonic(0);
        } else if (c instanceof VCheckBox) {
            VCheckBox cb = (VCheckBox) c;
            if (set)
                cb.setMnemonic(cb.getSavedMnemonic());
            else
                cb.setMnemonic(0);
        } else if (c instanceof VButton) {
            VButton b = (VButton) c;
            if (set)
                b.setMnemonic(b.getSavedMnemonic());
            else
                b.setMnemonic(0);
        }
    }
}
Also used : CLabel(org.compiere.swing.CLabel) VButton(org.compiere.grid.ed.VButton) VCheckBox(org.compiere.grid.ed.VCheckBox) Component(java.awt.Component)

Aggregations

VButton (org.compiere.grid.ed.VButton)3 VCheckBox (org.compiere.grid.ed.VCheckBox)2 Component (java.awt.Component)1 I_AD_Process (org.compiere.model.I_AD_Process)1 CLabel (org.compiere.swing.CLabel)1