当前位置: 首页>>代码示例>>Java>>正文


Java ActionEvent.isConsumed方法代码示例

本文整理汇总了Java中com.codename1.ui.events.ActionEvent.isConsumed方法的典型用法代码示例。如果您正苦于以下问题:Java ActionEvent.isConsumed方法的具体用法?Java ActionEvent.isConsumed怎么用?Java ActionEvent.isConsumed使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.codename1.ui.events.ActionEvent的用法示例。


在下文中一共展示了ActionEvent.isConsumed方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: actionCommandImplNoRecurseComponent

import com.codename1.ui.events.ActionEvent; //导入方法依赖的package包/类
/**
 * Invoked to allow subclasses of form to handle a command from one point
 * rather than implementing many command instances
 */
void actionCommandImplNoRecurseComponent(Command cmd, ActionEvent ev) {
    if (cmd == null) {
        return;
    }

    if (comboLock) {
        if (cmd == menuBar.getCancelMenuItem()) {
            actionCommand(cmd);
            return;
        }
        return;
    }
    if (cmd != menuBar.getSelectCommand()) {
        if (commandListener != null) {
            commandListener.fireActionEvent(ev);
            if (ev.isConsumed()) {
                return;
            }
        }
        actionCommand(cmd);
    } 
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:27,代码来源:Form.java

示例2: fireActionEvent

import com.codename1.ui.events.ActionEvent; //导入方法依赖的package包/类
/**
 * Allows subclasses to override action event behavior 
 * {@inheritDoc}
 * 
 * @param x the x position of the click if applicable (can be 0 or -1 otherwise)
 * @param y the y position of the click if applicable (can be 0 or -1 otherwise)
 */
protected void fireActionEvent(int x, int y){
    super.fireActionEvent();
    if(cmd != null) {
        ActionEvent ev = new ActionEvent(cmd, this, x, y);
        dispatcher.fireActionEvent(ev);
        if(!ev.isConsumed()) {
            Form f = getComponentForm();
            if(f != null) {
                f.actionCommandImplNoRecurseComponent(cmd, ev);
            }
        }
    } else {
        dispatcher.fireActionEvent(new ActionEvent(this, ActionEvent.Type.PointerPressed,x, y));
    }
    Display d = Display.getInstance();
    if(d.isBuiltinSoundsEnabled()) {
        d.playBuiltinSound(Display.SOUND_TYPE_BUTTON_PRESS);
    }
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:27,代码来源:Button.java

示例3: pointerReleased

import com.codename1.ui.events.ActionEvent; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
public void pointerReleased(int x, int y) {
    if (pointerReleasedListeners != null && pointerReleasedListeners.hasListeners()) {
        ActionEvent ev = new ActionEvent(this, ActionEvent.Type.PointerReleased, x, y);
        pointerReleasedListeners.fireActionEvent(ev);
        if(ev.isConsumed()) {
            return;
        }
    }
    Form f = getComponentForm();
    // might happen when programmatically triggering press
    if(f != null) {
        if(f.buttonsAwatingRelease != null) {
            f.buttonsAwatingRelease.remove(this);
        }
    }

    // button shouldn't fire an event when a pointer is dragged into it
    if(state == STATE_PRESSED) {
        released(x, y);
     }
    if(restoreDragPercentage > -1) {
        Display.getInstance().setDragStartPercentage(restoreDragPercentage);
    }
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:28,代码来源:Button.java

示例4: fireActionEvent

import com.codename1.ui.events.ActionEvent; //导入方法依赖的package包/类
/**
 * Triggers the event to the listeners
 * @param evt the event to fire
 */ 
protected void fireActionEvent(ActionEvent a) {
    if(isEnabled() && !Display.getInstance().hasDragOccured()){
        if(disposeDialogOnSelection) {
            ((Dialog)getComponentForm()).dispose();
        }
        super.fireActionEvent();
        dispatcher.fireActionEvent(a);
        if(isCommandList() && !a.isConsumed()) {
            T i = getSelectedItem();
            if(i != null && i instanceof Command && ((Command)i).isEnabled()) {
                ((Command)i).actionPerformed(a);
                if(!a.isConsumed()) {
                    Form f = getComponentForm();
                    if(f != null) {
                        f.actionCommandImpl((Command)i);
                    }
                }
            }
        }
        Display d = Display.getInstance();
        if(d.isBuiltinSoundsEnabled()) {
            d.playBuiltinSound(Display.SOUND_TYPE_BUTTON_PRESS);
        }
    }
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:30,代码来源:List.java

示例5: processCommandImpl

import com.codename1.ui.events.ActionEvent; //导入方法依赖的package包/类
private void processCommandImpl(ActionEvent ev, Command cmd) {
    processCommand(ev, cmd);
    if(ev.isConsumed()) {
        return;
    }
    if(globalCommandListeners != null) {
        globalCommandListeners.fireActionEvent(ev);
        if(ev.isConsumed()) {
            return;
        }
    }

    if(localCommandListeners != null) {
        Form f = Display.getInstance().getCurrent();
        EventDispatcher e = (EventDispatcher)localCommandListeners.get(f.getName());
        if(e != null) {
            e.fireActionEvent(ev);
        }
    }
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:21,代码来源:UIBuilder.java

示例6: dispatchCommand

import com.codename1.ui.events.ActionEvent; //导入方法依赖的package包/类
/**
 * Dispatches a command via the standard form mechanism of firing a command event
 * 
 * @param cmd The command to dispatch
 * @param ev the event to dispatch 
 */
public void dispatchCommand(Command cmd, ActionEvent ev) {
    cmd.actionPerformed(ev);
    if (!ev.isConsumed()) {
        actionCommandImpl(cmd, ev);
    }
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:13,代码来源:Form.java

示例7: fireKeyEvent

import com.codename1.ui.events.ActionEvent; //导入方法依赖的package包/类
private void fireKeyEvent(HashMap<Integer, ArrayList<ActionListener>> keyListeners, int keyCode) {
    if (keyListeners != null) {
        ArrayList<ActionListener> listeners = keyListeners.get(new Integer(keyCode));
        if (listeners != null) {
            ActionEvent evt = new ActionEvent(this, keyCode);
            for (int iter = 0; iter < listeners.size(); iter++) {
                listeners.get(iter).actionPerformed(evt);
                if (evt.isConsumed()) {
                    return;
                }
            }
        }
    }
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:15,代码来源:Form.java

示例8: pointerReleased

import com.codename1.ui.events.ActionEvent; //导入方法依赖的package包/类
/**
 * If this Component is focused, the pointer released event
 * will call this method
 * 
 * @param x the pointer x coordinate
 * @param y the pointer y coordinate
 */
public void pointerReleased(int x, int y) {
    if (pointerReleasedListeners != null && pointerReleasedListeners.hasListeners()) {
        ActionEvent ev = new ActionEvent(this, ActionEvent.Type.PointerReleased, x, y);
        pointerReleasedListeners.fireActionEvent(ev);
        if(ev.isConsumed()) {
            return;
        }
    }
    pointerReleaseImpl(x, y);
    scrollOpacity = 0xff;
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:19,代码来源:Component.java

示例9: handleException

import com.codename1.ui.events.ActionEvent; //导入方法依赖的package包/类
private boolean handleException(ConnectionRequest r, Exception o) {
    if(errorListeners != null) {
        ActionEvent ev = new NetworkEvent(r, o);
        errorListeners.fireActionEvent(ev);
        return ev.isConsumed();
    }
    return false;
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:9,代码来源:NetworkManager.java

示例10: keyReleased

import com.codename1.ui.events.ActionEvent; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
public void keyReleased(int keyCode) {
    int commandBehavior = getCommandBehavior();
    if (commandBehavior >= Display.COMMAND_BEHAVIOR_BUTTON_BAR && keyCode != backSK && keyCode != clearSK && keyCode != backspaceSK) {
        return;
    }
    if (getCommandCount() > 0) {
        int softkeyCount = Display.getInstance().getImplementation().getSoftkeyCount();
        if (softkeyCount < 2 && keyCode == leftSK) {
            if (commandList != null) {
                Container parent = commandList.getParent();
                while (parent != null) {
                    if (parent instanceof Dialog && ((Dialog) parent).isMenu()) {
                        return;
                    }
                    parent = parent.getParent();
                }
            }
            showMenu();
            return;
        } else {
            if (keyCode == leftSK) {
                if (left != null) {
                    left.released();
                }
                return;
            } else {
                // it might be a back command...
                if ((keyCode == rightSK || keyCode == rightSK2)) {
                    if (right != null) {
                        right.released();
                    }
                    return;
                } else {
                    if (Display.getInstance().getGameAction(keyCode) == Display.GAME_FIRE) {
                        main.released();
                        return;
                    }
                }
            }
        }
    }

    // allows a back/clear command to occur regardless of whether the
    // command was added to the form
    Command c = null;
    if (keyCode == backSK) {
        // the back command should be invoked
        c = parent.getBackCommand();
        if(c == null && minimizeOnBack) {
            Display.getInstance().minimizeApplication();
            return;
        }
    } else {
        if (keyCode == clearSK || keyCode == backspaceSK) {
            c = getClearCommand();
        }
    }
    if (c != null) {
        ActionEvent ev = new ActionEvent(c, keyCode);
        c.actionPerformed(ev);
        if (!ev.isConsumed()) {
            parent.actionCommandImpl(c);
        }
    }
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:69,代码来源:MenuBar.java


注:本文中的com.codename1.ui.events.ActionEvent.isConsumed方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。