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


Java Event.getPropertyNames方法代码示例

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


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

示例1: handleEvent

import org.osgi.service.event.Event; //导入方法依赖的package包/类
@Override
public void handleEvent(Event event) {
	String[] propertyNames = event.getPropertyNames();
	//System.out.println(event.getProperty(propertyNames[0]));
	IStyledTextGazeResponse response = (IStyledTextGazeResponse)event.getProperty(propertyNames[0]);
	Rectangle mBounds = ITrace.getDefault().getRootShell().getBounds();
       int screenX = (int) (response.getGaze().getX() * mBounds.width);
       int screenY = (int) (response.getGaze().getY() * mBounds.height);
       //Rectangle monitorBounds = ITrace.getDefault().monitorBounds;
       if(styledText.isDisposed()) return;
       Rectangle editorBounds = styledText.getBounds();
       Point screenPos = styledText.toDisplay(0, 0);
       editorBounds.x = screenPos.x - mBounds.x;
       editorBounds.y = screenPos.y - mBounds.y;
       if(editorBounds.contains(screenX, screenY)){
       	int relativeX = screenX-editorBounds.x;
       	int relativeY = screenY-editorBounds.y;
       	update(response.getLine()-1,response.getCol(), relativeX, relativeY);
       }
	
}
 
开发者ID:SERESLab,项目名称:iTrace-Archive,代码行数:22,代码来源:TokenHighlighter.java

示例2: sendEvent

import org.osgi.service.event.Event; //导入方法依赖的package包/类
private void sendEvent(Event osgiEvent) {
	boolean trace = log.isTraceEnabled();
	ServiceReference ref = bundleContext.getServiceReference(EVENT_ADMIN);
	if (ref != null) {
		EventAdmin eventAdmin = (EventAdmin) bundleContext.getService(ref);
		if (eventAdmin != null) {
			if (trace) {
				StringBuilder sb = new StringBuilder();
				String[] names = osgiEvent.getPropertyNames();
				sb.append("{");
				for (int i = 0; i < names.length; i++) {
					String name = names[i];
					sb.append(name);
					sb.append("=");
					Object value = osgiEvent.getProperty(name);
					sb.append(ObjectUtils.getDisplayString(value));
					if (i < names.length - 1)
						sb.append(",");
				}
				sb.append("}");

				log.trace("Broadcasting OSGi event " + osgiEvent + " w/ props " + sb.toString());
			}
			publisher.publish(eventAdmin, osgiEvent);
		}
	} else {
		log.trace("No event admin found for broadcasting event " + osgiEvent);
	}
}
 
开发者ID:eclipse,项目名称:gemini.blueprint,代码行数:30,代码来源:OsgiEventDispatcher.java

示例3: handleEvent

import org.osgi.service.event.Event; //导入方法依赖的package包/类
@Override
public void handleEvent(Event event) {
	if(outFile == null) this.init();
	String[] propertyNames = event.getPropertyNames();
	IGazeResponse response = (IGazeResponse)event.getProperty(propertyNames[0]);
	this.process(response);
}
 
开发者ID:SERESLab,项目名称:iTrace-Archive,代码行数:8,代码来源:JSONGazeExportSolver.java

示例4: handleEvent

import org.osgi.service.event.Event; //导入方法依赖的package包/类
@Override
public void handleEvent(Event event) {
	String[] propertyNames = event.getPropertyNames();
	Gaze gaze = (Gaze)event.getProperty(propertyNames[0]);
	Point leftEye = new Point((int)(gaze.getLeftX() * (screenSize.width/4)),(int)(gaze.getLeftY() * (screenSize.height/4)));
	Point rightEye = new Point((int)(gaze.getRightX() * (screenSize.width/4)),(int)(gaze.getRightY() * (screenSize.height/4)));
	
	drawingPanel.update(leftEye, rightEye, gaze.getLeftValidity(), gaze.getRightValidity());
}
 
开发者ID:SERESLab,项目名称:iTrace-Archive,代码行数:10,代码来源:EyeStatusWindow.java

示例5: handleEvent

import org.osgi.service.event.Event; //导入方法依赖的package包/类
@Override
public void handleEvent(Event event) {
	if(event.getTopic() == "iTrace/newgaze"){
		String[] propertyNames = event.getPropertyNames();
		Gaze g = (Gaze)event.getProperty(propertyNames[0]);
		 if (g != null) {
             if(!rootShell.isDisposed()){
            	 Rectangle monitorBounds = rootShell.getMonitor().getBounds();
            	 int screenX = (int) (g.getX() * monitorBounds.width);
	             int screenY = (int) (g.getY() * monitorBounds.height);
	             IGazeResponse response;
            	 response = handleGaze(screenX, screenY, g);
            	 
            	 if (response != null) {
	                	 if(recording){
	                		 statusLineManager
	                 			.setMessage(String.valueOf(response.getGaze().getSessionTime()));
	                 		registerTime = System.currentTimeMillis();
	                 		if(xmlOutput) eventBroker.post("iTrace/xmlOutput", response);
	                 		if(jsonOutput) eventBroker.post("iTrace/jsonOutput", response);
	                	 }
	                     
	                     if(response instanceof IStyledTextGazeResponse && response != null && showTokenHighlights){
	                     	IStyledTextGazeResponse styledTextResponse = (IStyledTextGazeResponse)response;
	                     	eventBroker.post("iTrace/newstresponse", styledTextResponse);
	                     }
	             }
	         }else{
	         	if((System.currentTimeMillis()-registerTime) > 2000){
	         		statusLineManager.setMessage("");
	         	}
	         }
         }
	}
}
 
开发者ID:SERESLab,项目名称:iTrace-Archive,代码行数:36,代码来源:ITrace.java

示例6: toMap

import org.osgi.service.event.Event; //导入方法依赖的package包/类
Map<String, ?> toMap(Event event) {
    Map<String, Object> props = new HashMap<>();
    props.put("topic", event.getTopic());
    for (String key : event.getPropertyNames()) {
        props.put(key, event.getProperty(key));
    }
    return props;

}
 
开发者ID:cschneider,项目名称:reactive-components,代码行数:10,代码来源:EventAdminSource.java

示例7: handleEvent

import org.osgi.service.event.Event; //导入方法依赖的package包/类
@Override
public void handleEvent(Event event) {
	// construct server sent event
	JsonObject data = new JsonObject();
	
	for(String key : event.getPropertyNames()){
		if(!key.equals("event.topics"))
			data.add(key, new JsonPrimitive(event.getProperty(key).toString()));
	}
	
	if(event.getTopic().contains("progress")){
		// progress
		data.add("type", new JsonPrimitive("progress"));
	} else {
		data.add("type", new JsonPrimitive("notification"));
	}
	
	StringBuilder builder = new StringBuilder();
	builder.append("data: ").append(data.toString()).append("\n\n");
	String sse = builder.toString();
	
	// send to all clients
	Iterator<Entry<String,AsyncContext>> it = clients.entrySet().iterator();
	while(it.hasNext()){
		AsyncContext client = it.next().getValue();
		try {
			PrintWriter writer = client.getResponse().getWriter();
			writer.write(sse);
			writer.flush();
		} catch(Exception e){
			it.remove();
		}
	}
}
 
开发者ID:ibcn-cloudlet,项目名称:dianne,代码行数:35,代码来源:DianneSSEServlet.java

示例8: handleEvent

import org.osgi.service.event.Event; //导入方法依赖的package包/类
@Override
public void handleEvent(Event event) {
	String[] propertyNames = event.getPropertyNames();
	String message = (String)event.getProperty(propertyNames[0]);
	displayError(message);
}
 
开发者ID:SERESLab,项目名称:iTrace-Archive,代码行数:7,代码来源:ControlView.java


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