org.opennms.netmgt.xml.event.Event.getSource()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(8.6k)|赞(0)|评价(0)|浏览(180)

本文整理了Java中org.opennms.netmgt.xml.event.Event.getSource()方法的一些代码示例,展示了Event.getSource()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Event.getSource()方法的具体详情如下:
包路径:org.opennms.netmgt.xml.event.Event
类名称:Event
方法名:getSource

Event.getSource介绍

[英]Returns the value of field 'source'.
[中]返回字段“source”的值。

代码示例

代码示例来源:origin: stackoverflow.com

myButton1.addEventHandler(ActionEvent.ACTION, new MyButtonHandler());
myButton2.addEventHandler(MouseEvent.CLICKED, new MyButtonHandler());

private class MyButtonHandler implements EventHandler<Event>{
  @Override
  public void handle(Event evt) {
    if (evt.getSource().equals(myButton1)) {
     //do something
    } else if (evt.getSource().equals(myButton2)) {
     //do something
    }
  }
}

代码示例来源:origin: OpenNMS/opennms

@Override
  public String getValue(String parm, String parsedParm, Event event, EventUtil eventUtil) {
    return event.getSource();
  }
},

代码示例来源:origin: org.opennms.features.events/org.opennms.features.events.daemon

@Override
  public String getValue(String parm, String parsedParm, Event event, EventUtil eventUtil) {
    return event.getSource();
  }
},

代码示例来源:origin: OpenNMS/opennms

@Override
public String getSource() {
  return event.getSource();
}

代码示例来源:origin: stackoverflow.com

@FXML
private Button cancelButton;

close(new Event(cancelButton, stage, null));

@FXML
private void close(Event event) {
  ((Node)(event.getSource())).getScene().getWindow().hide();                      
}

代码示例来源:origin: OpenNMS/opennms

return new EventField(name) { public String get(Event event) { return event.getSource(); } };
} else if (name.equals(TAG_NODEID)) {

代码示例来源:origin: stackoverflow.com

@Override
public void handle(Event evt) {
  System.out.println(((Control)evt.getSource()).getId());
}

代码示例来源:origin: stackoverflow.com

public class Proyect extends Application implements EventHandler{

private Button btnR;

private HBox menu1() {
  Image food1 = new Image (getClass().getResourceAsStream("clipboard.png"));
  btnR = new Button ("R", new ImageView(food1));
}

@Override
public void handle(Event event) {
  if(event.getSource() == btnR) {

  }
}
}

代码示例来源:origin: stackoverflow.com

sceneRoot = (AnchorPane) loader.load();//load the tab scene root from the FXML loader
 Tab fxTab = new Tab();
 fxTab.setContent(sceneRoot);//add the tab scene root node to the tab
 fxTab.setClosable(true);//make the tab closable
 fxTab.setId(ID.toString());//set its ID.
 //add a close action to the created tab stage
 fxTab.setOnClosed(new EventHandler<Event>() {
   @Override
   public void handle(Event t) {
     Tab fxTab = (Tab) t.getSource();//get the source of the action...
     for (MyTab myTabObj: allMyTabs) {
       if (myTabObj.ID.equals(fxTab.getUserData())) {
         fxTab = myTabObj;//f so, this is the one
         break;//break the loop
       }
     }
     allMyTabs.remove(myTabObj);
     System.out.println("You closed Tab: " + fxTab.getUserData());
     System.out.println("Total number of remaining tabs is:" + allMyTabs.size());
   }
 });

代码示例来源:origin: stackoverflow.com

private void openNewWindow(Event event)
{

 Parent root;
 try {                    
  URL url = getClass().getResource("Content.fxml");
  FXMLLoader fxmlLoader = new FXMLLoader();
  fxmlLoader.setLocation(url);
  fxmlLoader.setBuilderFactory(new JavaFXBuilderFactory());
  root = (Parent)fxmlLoader.load(url.openStream());            
  Stage stage = new Stage();
  stage.setScene(new Scene(root, 1000, 800));
  stage.show();
  ((Node)(event.getSource())).getScene().getWindow().hide();

 } catch (IOException e) {
   e.printStackTrace();
 }
}

代码示例来源:origin: OpenNMS/opennms

@Override
public void process(final Exchange exchange) throws Exception {
  final String eventXml = exchange.getIn().getBody(String.class);
  final Event event = JaxbUtils.unmarshal(Event.class, eventXml);
  final String systemId = exchange.getIn().getHeader(EVENT_HEADER_SYSTEMID, String.class);
  if (event.getNodeid() > 0) {
    String foreignSource = exchange.getIn().getHeader(EVENT_HEADER_FOREIGNSOURCE, String.class);
    String foreignId = exchange.getIn().getHeader(EVENT_HEADER_FOREIGNID, String.class);
    OnmsNode node = nodeDao.findByForeignId(foreignSource, foreignId);
    if (node != null && node.getId() != null) {
      event.setNodeid(node.getId().longValue());
      event.setDistPoller(systemId);
      event.setSource("Endpoint="+systemId+":"+event.getSource());
    } else {
      LOG.warn("Could not find node {}/{} in the database, cannot update node ID to local value; discarding event", foreignSource, foreignId);
      // Halt the route if we cannot translate the node ID
      exchange.setProperty(Exchange.ROUTE_STOP, Boolean.TRUE);
    }
  }
  exchange.getIn().setBody(event, Event.class);
}

代码示例来源:origin: org.opennms.features.activemq/org.opennms.features.activemq.event-receiver

@Override
  public void process(final Exchange exchange) throws Exception {
    final Event event = exchange.getIn().getBody(Event.class);
    
    String systemId = exchange.getIn().getHeader(EVENT_HEADER_SYSTEMID, String.class);

    if (event.getNodeid() > 0) {
      String foreignSource = exchange.getIn().getHeader(EVENT_HEADER_FOREIGNSOURCE, String.class);
      String foreignId = exchange.getIn().getHeader(EVENT_HEADER_FOREIGNID, String.class);

      OnmsNode node = nodeDao.findByForeignId(foreignSource, foreignId);

      if (node != null && node.getId() != null) {
        event.setNodeid(node.getId().longValue());
        event.setDistPoller(systemId);
        event.setSource("Endpoint="+systemId+":"+event.getSource());
      } else {
        LOG.warn("Could not find node {}/{} in the database, cannot update node ID to local value; discarding event", foreignSource, foreignId);
        // Halt the route if we cannot translate the node ID
        exchange.setProperty(Exchange.ROUTE_STOP, Boolean.TRUE);
      }
    }
  }
}

代码示例来源:origin: org.opennms.features.amqp/org.opennms.features.amqp.event-receiver

@Override
public void process(final Exchange exchange) throws Exception {
  final String eventXml = exchange.getIn().getBody(String.class);
  final Event event = JaxbUtils.unmarshal(Event.class, eventXml);
  final String systemId = exchange.getIn().getHeader(EVENT_HEADER_SYSTEMID, String.class);
  if (event.getNodeid() > 0) {
    String foreignSource = exchange.getIn().getHeader(EVENT_HEADER_FOREIGNSOURCE, String.class);
    String foreignId = exchange.getIn().getHeader(EVENT_HEADER_FOREIGNID, String.class);
    OnmsNode node = nodeDao.findByForeignId(foreignSource, foreignId);
    if (node != null && node.getId() != null) {
      event.setNodeid(node.getId().longValue());
      event.setDistPoller(systemId);
      event.setSource("Endpoint="+systemId+":"+event.getSource());
    } else {
      LOG.warn("Could not find node {}/{} in the database, cannot update node ID to local value; discarding event", foreignSource, foreignId);
      // Halt the route if we cannot translate the node ID
      exchange.setProperty(Exchange.ROUTE_STOP, Boolean.TRUE);
    }
  }
  exchange.getIn().setBody(event, Event.class);
}

代码示例来源:origin: stackoverflow.com

private void closebackuptaskandshowmaintask(Event event) throws Exception {
  // Decalaration of Variables
  final Stage stage, stage1;
  FXMLLoader pane;
  Parent taskselectwindow;
  String eventstring;

  // Execution Block
  eventstring = event.getEventType().toString();
  if ("ACTION".equals(eventstring)) {
    stage = (Stage) BackupTaskExitButton.getScene().getWindow();
    stage.close();
  } else if ("WINDOW_CLOSE_REQUEST".equals(eventstring)) {
    event.consume();
    stage = (Stage) event.getSource();
    stage.close();            
  }
  pane = new FXMLLoader(getClass().getResource("FXMLBlahBLahUI.fxml"));
  taskselectwindow = (Parent) pane.load();
  stage1 = new Stage();
  stage1.setScene(new Scene(taskselectwindow));
  stage1.setTitle("BlahBLahUI");
  stage1.show();
}

代码示例来源:origin: OpenNMS/opennms

if (getName().equals(e.getSource())) {
  LOG.debug("onEvent: ignoring event with EventTranslator as source");
  return;

代码示例来源:origin: OpenNMS/opennms

LOG.trace("  uuid  = {}", (uuid != null && uuid.length() > 0 ? uuid : "<not-set>"));
LOG.trace("  uei   = {}", event.getUei());
LOG.trace("  src   = {}", event.getSource());
LOG.trace("  iface = {}", event.getInterface());
LOG.trace("  time  = {}", event.getTime());

代码示例来源:origin: OpenNMS/opennms

e.getSource(),
e.getUei(),
new Timestamp(e.getCreationTime().getTime()),

代码示例来源:origin: OpenNMS/opennms

private void validateTranslatedEvent(Event event) {
  assertEquals(m_translator.getName(), event.getSource());
  assertEquals(Long.valueOf(3), event.getNodeid());
  assertEquals("www.opennms.org", event.getHost());
  assertEquals("a generated event", event.getDescr());
  assertEquals("192.168.1.1", event.getInterface());
  assertEquals("Switch", EventUtils.getParm(event, "nodeLabel"));
  assertEquals("PSV", event.getService());
  assertEquals("Down", EventUtils.getParm(event, "passiveStatus"));
}

代码示例来源:origin: OpenNMS/opennms

.setId(event.getDbid())
.setUei(event.getUei())
.setSource(event.getSource())
.setSeverity(toSeverity(OnmsSeverity.get(event.getSeverity())))
.setLabel(eventConfDao.getEventLabel(event.getUei()));

代码示例来源:origin: org.opennms.features.kafka/org.opennms.features.kafka.producer

.setId(event.getDbid())
.setUei(event.getUei())
.setSource(event.getSource())
.setSeverity(toSeverity(OnmsSeverity.get(event.getSeverity())))
.setLabel(eventConfDao.getEventLabel(event.getUei()));

相关文章