本文整理了Java中org.jflux.api.core.Listener
类的一些代码示例,展示了Listener
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Listener
类的具体详情如下:
包路径:org.jflux.api.core.Listener
类名称:Listener
[英]Interface for listening for an event
[中]用于侦听事件的接口
代码示例来源:origin: org.jflux/org.jflux.api.common.rk
@Override
public void handleEvent(Msg event) {
for(Listener<Msg> l : myListeners){
l.handleEvent(event);
}
}
代码示例来源:origin: org.jflux/org.jflux.api.core
/**
* Forwards event to all Listeners
* @param e event to forward
*/
@Override
public void notifyListeners(E e){
for(Listener<E> l : myListeners){
l.handleEvent(e);
}
}
代码示例来源:origin: org.jflux/org.jflux.api.messaging.rk
/**
* Notifies listeners of a Message
* @param message
*/
protected void fireMessageEvent(Msg message){
for(Listener<Msg> listener : myListeners){
listener.handleEvent(message);
}
}
代码示例来源:origin: org.robokind/org.robokind.api.speech
/**
* Notifies listeners of a VisemeEvent.
* @param event VisemeEvent to send to listeners
*/
public void handleVisemeEvent(VisemeEvent event) {
for(Listener<VisemeEvent> l : myListeners){
l.handleEvent(event);
}
}
代码示例来源:origin: org.jflux/org.jflux.api.messaging.rk
/**
* Notifies listeners of a Message
* @param message
*/
protected void fireMessageEvent(Msg message){
for(Listener<Msg> listener : myListeners){
listener.handleEvent(message);
}
}
代码示例来源:origin: org.jflux/org.jflux.impl.services.rk
@Override
public void stop(){
if(myStopListener != null && myService != null){
myStopListener.handleEvent(myService);
}
myService = null;
}
代码示例来源:origin: org.cogchar/org.cogchar.bundle.demo.convo
@Override public void run() {
if(myInputListener == null){
return;
}
myInputListener.handleEvent(prompt);
}
}, sleep, TimeUnit.MILLISECONDS);
代码示例来源:origin: org.jflux/org.jflux.api.messaging.rk
/**
* Notifies listeners of a Message being sent.
* @param message Message being sent
*/
protected void fireMessageEvent(Msg message){
for(Listener<Msg> listener : myListeners){
listener.handleEvent(message);
}
}
代码示例来源:origin: org.robokind/org.robokind.api.speech
/**
* Notifies listeners of a SpeechEvent.
* @param ev SpeechEvent to send to listeners
*/
public void fireSpeechEvent(SpeechEventList<SpeechEvent> ev){
for(Listener<SpeechEventList<SpeechEvent>> listener: mySpeechEventListeners){
listener.handleEvent(ev);
}
}
代码示例来源:origin: org.cogchar/org.cogchar.bundle.demo.convo
public void updatetPollInterval(){
String str = txtCogbotPollInterval.getText();
try{
Long interval = Long.parseLong(str);
interval = Math.max(interval, 1);
myCogbotPollIntervalSetter.handleEvent(interval);
}catch(NumberFormatException ex){
theLogger.log(Level.WARNING,
"Invalid Poll Interval, not a number: " + str, ex);
}
}
代码示例来源:origin: org.cogchar/org.cogchar.bundle.demo.convo
public boolean connect(){
String ip = txtBrokerAddress.getText();
String dest = txtDestination.getText();
myIpSetter.handleEvent(ip);
myDestSetter.handleEvent(dest);
boolean val = myConnector.connect();
txtBrokerAddress.setEnabled(!val);
txtDestination.setEnabled(!val);
return val;
}
代码示例来源:origin: org.jflux/org.jflux.api.core
/**
* Runs data through the ListenerChain
* @param input the data
*/
@Override
public void handleEvent(A input) {
B b = myAdapter.adapt(input);
myInnerListener.handleEvent(b);
}
代码示例来源:origin: org.robokind/org.robokind.impl.motion.dynamixel
private boolean read(int i, byte packetSize,
final Listener<DynamixelPacket[]> callback){
final DynamixelPacket[] packets =
DynamixelMultiReader.readPackets(myController, i, packetSize);
if(callback != null){
callback.handleEvent(packets);
}
if(packets == null || packets.length != i){
return false;
}
return true;
}
代码示例来源:origin: org.robokind/org.robokind.impl.motion.dynamixel
private boolean read(int i, byte packetSize,
final Listener<DynamixelPacket[]> callback){
final DynamixelPacket[] packets = readPackets(myController, i, packetSize);
if(callback != null){
callback.handleEvent(packets);
}
if(packets == null || packets.length != i){
return false;
}
return true;
}
代码示例来源:origin: org.cogchar/org.cogchar.bundle.bind.robokind
private static void set(Configuration<String> conf, String key, String val){
conf.getPropertySetter(String.class, key).handleEvent(val);
}
}
代码示例来源:origin: org.cogchar/org.cogchar.bundle.bind.mechio
private static void set(Configuration<String> conf, String key, String val){
conf.getPropertySetter(String.class, key).handleEvent(val);
}
}
代码示例来源:origin: org.jflux/org.jflux.api.core
/**
* Processes input event if and only if in RUNNING state
* @param event data to process
*/
@Override
public void handleEvent(E event) {
if(myPlayable.getPlayState() == Playable.PlayState.RUNNING){
myListener.handleEvent(event);
}else{
theLogger.log(Level.INFO,
"PlayState is {0} for Playable: {1}, \nIgnoring event: {2}",
new Object[]{myPlayable.getPlayState(),
myPlayable.toString(), event});
}
}
}
代码示例来源:origin: org.rwshop/org.rwshop.swing.common
private void pushValue(String key, String val) {
Listener setter = myConfig.getPropertySetter(key);
Class cls = myConfig.getPropertyClass(key);
try {
Object parsedVal = parseValue(cls, val);
setter.handleEvent(parsedVal);
} catch(Exception e) {
String message = "Failed to set " + val + " on " + key;
String longMessage = message + ":\n\n" + e.getMessage();
theLogger.log(Level.SEVERE, "{0}.", message);
theLogger.log(Level.SEVERE, e.getMessage());
JOptionPane.showMessageDialog(
this, longMessage, "Error", JOptionPane.ERROR_MESSAGE);
}
}
代码示例来源:origin: org.cogchar/org.cogchar.bundle.bind.cogbot
public static <T> void setValue(Class<T> clazz, String key, T val){
defaultConfiguration().getPropertySetter(clazz, key).handleEvent(val);
}
代码示例来源:origin: org.jflux/org.jflux.impl.services.rk
@Override
protected void handleChange(
String name, Object dependency,
Map<String, Object> availableDependencies) {
if(myChangeListeners == null){
return;
}
Listener<DependencyChange> listener = myChangeListeners.adapt(name);
if(listener == null){
return;
}
DependencyChange change =
new DependencyChange(this, dependency, availableDependencies);
listener.handleEvent(change);
}
内容来源于网络,如有侵权,请联系作者删除!