當前位置: 首頁>>代碼示例>>Java>>正文


Java Event.getTopic方法代碼示例

本文整理匯總了Java中org.osgi.service.event.Event.getTopic方法的典型用法代碼示例。如果您正苦於以下問題:Java Event.getTopic方法的具體用法?Java Event.getTopic怎麽用?Java Event.getTopic使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.osgi.service.event.Event的用法示例。


在下文中一共展示了Event.getTopic方法的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: handleEvent

import org.osgi.service.event.Event; //導入方法依賴的package包/類
@Override
public void handleEvent(Event event) {
    String topic = event.getTopic();
    Object target = event.getProperty(MafiaBossConstants.PROPERTY_KEY_TARGET);

    switch (topic) {
        case MafiaBossConstants.TOPIC_CONVINCE:
            System.out.println("Ray: I helped in punching the shit out of" + target);
            break;
        case MafiaBossConstants.TOPIC_ENCASH:
            System.out.println("Ray: I helped getting the money from " + target);
            break;
        case MafiaBossConstants.TOPIC_SOLVE:
            System.out.println("Ray: I helped killing " + target);
            break;
        default: System.out.println("Ray: I helped with whatever was requested!");
    }
}
 
開發者ID:fipro78,項目名稱:osgi-ds-getting-started-pde,代碼行數:19,代碼來源:Ray.java

示例2: handleEvent

import org.osgi.service.event.Event; //導入方法依賴的package包/類
/**
 * {@inheritDoc}
 */
public void handleEvent(Event event) {  
	String itemName = (String) event.getProperty("item");
	
	String topic = event.getTopic();
	String[] topicParts = topic.split(TOPIC_SEPERATOR);
	
	if(!(topicParts.length > 2) || !topicParts[0].equals(TOPIC_PREFIX)) {
		return; // we have received an event with an invalid topic
	}
	String operation = topicParts[1];
	
	if(operation.equals(EventType.UPDATE.toString())) {
		State newState = (State) event.getProperty("state");
		if(newState!=null) receiveUpdate(itemName, newState);
	}
	if(operation.equals(EventType.COMMAND.toString())) {
		Command command = (Command) event.getProperty("command");
		if(command!=null) receiveCommand(itemName, command);
	}
}
 
開發者ID:Neulinet,項目名稱:Zoo,代碼行數:24,代碼來源:AbstractEventSubscriber.java

示例3: handleEvent

import org.osgi.service.event.Event; //導入方法依賴的package包/類
@Override
public void handleEvent(Event event) {
	switch (event.getTopic()) {
	case "event_text_relating_objects/loaded": {
		// eventReceivedRelatingObjectsLoadedEvents(event.getProperty("org.eclipse.e4.data"));
		break;
	}
	case "ui_secondarySelection/corpusNavigator": {
		Object o = event.getProperty("org.eclipse.e4.data");
		if (o instanceof BTSObject) {
			eventReceivedSecondarySelection((BTSObject) o);
		}
		break;
	}
	}
}
 
開發者ID:cplutte,項目名稱:bts,代碼行數:17,代碼來源:SearchSelectObjectDialog.java

示例4: handleEvent

import org.osgi.service.event.Event; //導入方法依賴的package包/類
@Override
	public void handleEvent(Event event) {
		switch(event.getTopic())
		{
		case "event_text_relating_objects/loaded" :
		{
//			eventReceivedRelatingObjectsLoadedEvents(event.getProperty("org.eclipse.e4.data"));
			break;
		}
		case "event_text_relating_objects/selected" :
		{
			eventReceivedRelatingObjectsSelected(event.getProperty("org.eclipse.e4.data"));
			break;
		}
		}
	}
 
開發者ID:cplutte,項目名稱:bts,代碼行數:17,代碼來源:AnnotationsPart.java

示例5: handleEvent

import org.osgi.service.event.Event; //導入方法依賴的package包/類
/**
 * Handle event.
 *
 * @param event the event
 */
@Override
public void handleEvent(Event event) {
	// System.out.println(arg0);
	if (event.getTopic().startsWith("event_text_selection/")) {
		eventReceivedCaretEvents(event.getTopic());
		return;
	}
	switch (event.getTopic()) {
	case "event_text_relating_objects/loaded": {
		break;
	}
	case "event_relating_objects/selected": {
		eventReceivedRelatingObjectsLoadedEvents(event
				.getProperty("org.eclipse.e4.data"));
		break;
	}
	}

}
 
開發者ID:cplutte,項目名稱:bts,代碼行數:25,代碼來源:EgyTextEditorPart.java

示例6: handleEvent

import org.osgi.service.event.Event; //導入方法依賴的package包/類
@Override
public void handleEvent(Event event) {
	// System.out.println(arg0);
	if (event.getTopic().startsWith("event_text_selection/"))
	{
		eventReceivedCaretEvents(event.getTopic());
		return;
	}
	switch(event.getTopic())
	{
	case "event_text_relating_objects/loaded" :
	{
		break;
	}
	case "event_relating_objects/selected" :
	{
		eventReceivedRelatingObjectsLoadedEvents(event.getProperty("org.eclipse.e4.data"));
		break;
	}
	}
	

}
 
開發者ID:cplutte,項目名稱:bts,代碼行數:24,代碼來源:EgyLemmaEditorPart.java

示例7: handleEvent

import org.osgi.service.event.Event; //導入方法依賴的package包/類
@Override
public void handleEvent ( final Event event )
{
    logger.debug ( "Received event - {}", event.getTopic () );

    final String topic = event.getTopic ();
    final Object op = event.getProperty ( "operation" );

    if ( topic.startsWith ( "drone/channel/" ) )
    {
        if ( "remove".equals ( op ) || "refresh".equals ( op ) )
        {
            refresh ();
        }
    }
}
 
開發者ID:eclipse,項目名稱:packagedrone,代碼行數:17,代碼來源:UpgradeTaskProvider.java

示例8: handleEvent

import org.osgi.service.event.Event; //導入方法依賴的package包/類
/**
 * {@inheritDoc}
 */
public void handleEvent(Event event) {
	String itemName = (String) event.getProperty("item");

	String topic = event.getTopic();
	String[] topicParts = topic.split(TOPIC_SEPERATOR);

	if (!(topicParts.length > 2) || !topicParts[0].equals(TOPIC_PREFIX)) {
		return; // we have received an event with an invalid topic
	}
	String operation = topicParts[1];

	if (operation.equals(EventType.COMMAND.toString())) {
		Command command = (Command) event.getProperty("command");
		if (command != null)
			receiveCommand(itemName, command);
	}
}
 
開發者ID:andrey-desman,項目名稱:openhab-hdl,代碼行數:21,代碼來源:RuleEngine.java

示例9: 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

示例10: handleEvent

import org.osgi.service.event.Event; //導入方法依賴的package包/類
@Override
public void handleEvent(Event event) {
	String topic = event.getTopic();
	if(topic.equals(EA_TOPIC_DEBUGGING_ACTION_RESUME)) {
		handleResumeEvent();
	} else if(topic.equals(EA_TOPIC_DEBUGGING_ACTION_STEP_OVER)) {
		handleStepOverEvent();
	}
}
 
開發者ID:VisuFlow,項目名稱:visuflow-plugin,代碼行數:10,代碼來源:JimpleBreakpointManager.java

示例11: handleEvent

import org.osgi.service.event.Event; //導入方法依賴的package包/類
@Override
public void handleEvent(final Event event)
{
    switch (event.getTopic())
    {
        case ControlsCallback.SPEED_SUB_TOPIC:
            controller.setSpeed(Integer.getInteger(event.getProperty("speed").toString()));
            break;
        case ControlsCallback.BLEND_SUB_TOPIC:
            controller.setEffect(ControlsCallback.EffectType.valueOf(event.getProperty("blend").toString()));
            break;
    }
}
 
開發者ID:jtkb,項目名稱:flexfx,代碼行數:14,代碼來源:AnimatedNode.java

示例12: handleEvent

import org.osgi.service.event.Event; //導入方法依賴的package包/類
@Override
public void handleEvent(Event event) {
    switch (event.getTopic()) {
        case REGENERATE_MDS_DATA_BUNDLE:
            handleMdsDataBundleRegeneration(event);
            break;
        case REGENERATE_MDS_DATA_BUNDLE_AFTER_DDE_ENHANCEMENT:
            handleMdsDataBundleRegenerationAfterDdeEnhancement(event);
            break;
        default:
            throw new IllegalStateException("Received an event with an unknown subject/topic: " + event.getTopic());
    }
}
 
開發者ID:motech,項目名稱:motech,代碼行數:14,代碼來源:MdsBundleRegenerationServiceImpl.java

示例13: handleEvent

import org.osgi.service.event.Event; //導入方法依賴的package包/類
public void handleEvent(Event event) {
	String workflowRun = event.getProperty("RUN_ID").toString();
	switch (event.getTopic()) {
	case RunService.RUN_CLOSED:
	case RunService.RUN_DELETED:
		runSelectorComponent.removeObject(workflowRun);
		monitorGraphComponent.removeWorkflowRun(workflowRun);
		tableMonitorComponent.removeWorkflowRun(workflowRun);
		resultsComponent.removeWorkflowRun(workflowRun);
		if (selectionManager.getSelectedWorkflowRun().equals(workflowRun)) {
			List<String> runs = runService.getRuns();
			if (runs.isEmpty())
				selectionManager.setSelectedWorkflowRun(null);
			else
				selectionManager.setSelectedWorkflowRun(runs.get(0));
		}
		break;
	case RunService.RUN_CREATED:
	case RunService.RUN_OPENED:
		selectionManager.setSelectedWorkflowRun(workflowRun);
		break;
	case RunService.RUN_STOPPED:
	case RunService.RUN_PAUSED:
	case RunService.RUN_STARTED:
	case RunService.RUN_RESUMED:
		Tab<String> tab = runSelectorComponent.getTab(workflowRun);
		if (tab instanceof RunTab) {
			RunTab runTab = (RunTab) tab;
			runTab.updateTabIcon();
		}
		break;
	}
}
 
開發者ID:apache,項目名稱:incubator-taverna-workbench,代碼行數:34,代碼來源:ResultsPerspectiveComponent.java


注:本文中的org.osgi.service.event.Event.getTopic方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。