本文整理汇总了Java中java.util.TooManyListenersException类的典型用法代码示例。如果您正苦于以下问题:Java TooManyListenersException类的具体用法?Java TooManyListenersException怎么用?Java TooManyListenersException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TooManyListenersException类属于java.util包,在下文中一共展示了TooManyListenersException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: connect
import java.util.TooManyListenersException; //导入依赖的package包/类
@PostConstruct
public void connect() throws TooManyListenersException, NoSuchPortException {
log.info("Connection PostConstruct callback: connecting ...");
serial = new NRSerialPort(serialPortProperties.getPortName(), serialPortProperties.getBaudRate());
serial.connect();
if (serial.isConnected()) {
log.info("Connection opened!");
} else {
throw new RuntimeException("Is not possible to open connection in " + serialPortProperties.getPortName() + " port");
}
serial.addEventListener(this);
serial.notifyOnDataAvailable(true);
input = new BufferedReader(new InputStreamReader(serial.getInputStream()));
}
开发者ID:diegosep,项目名称:spring-serial-port-connector,代码行数:17,代码来源:AbstractSpringSerialPortConnector.java
示例2: activate
import java.util.TooManyListenersException; //导入依赖的package包/类
/** Activates or deactivates Drag support on asociated JTree
* component
* @param active true if the support should be active, false
* otherwise
*/
public void activate(boolean active) {
if (this.active == active) {
return;
}
this.active = active;
DragGestureRecognizer dgr = getDefaultGestureRecognizer();
if (dgr == null) {
return;
}
if (active) {
dgr.setSourceActions(getAllowedDragActions());
try {
dgr.removeDragGestureListener(this);
dgr.addDragGestureListener(this);
} catch (TooManyListenersException exc) {
throw new IllegalStateException("Too many listeners for drag gesture."); // NOI18N
}
} else {
dgr.removeDragGestureListener(this);
}
}
示例3: connect
import java.util.TooManyListenersException; //导入依赖的package包/类
public void connect(CommPortIdentifier portIdentifier, int baudRate, int timeout) throws IOException {
if (portIdentifier.isCurrentlyOwned())
throw new IOException(
portIdentifier.getName() + " is currently in use (" + portIdentifier.getCurrentOwner() + ")");
if (portIdentifier.getPortType() != CommPortIdentifier.PORT_SERIAL)
throw new IOException(portIdentifier.getName() + " is not a serial port");
try {
serialPort = (SerialPort) portIdentifier.open("blackbird", timeout);
serialPort.setSerialPortParams(
baudRate,
SerialPort.DATABITS_8,
SerialPort.STOPBITS_1,
SerialPort.PARITY_NONE);
serialPort.notifyOnDataAvailable(true);
serialPort.addEventListener(this);
} catch (PortInUseException | TooManyListenersException | UnsupportedCommOperationException e) {
throw new IOException(e);
}
}
示例4: init
import java.util.TooManyListenersException; //导入依赖的package包/类
public void init() throws PeerUnavailableException, InvalidArgumentException, TransportNotSupportedException, ObjectInUseException, TooManyListenersException {
SipFactory sipFactory = null;
mSipStack = null;
sipFactory = SipFactory.getInstance();
sipFactory.setPathName("gov.nist");
Properties properties = new Properties();
properties.setProperty("javax.sip.STACK_NAME", "SIP_CLIENT");
properties.setProperty("gov.nist.javax.sip.TRACE_LEVEL", "32");
properties.setProperty("gov.nist.javax.sip.DEBUG_LOG", "sip_client/out/log/debug.txt");
properties.setProperty("gov.nist.javax.sip.SERVER_LOG", "sip_client/out/log/server.txt");
properties.setProperty("javax.sip.IP_ADDRESS",mIPAddress);
mSipStack = (SipStackExt) sipFactory.createSipStack(properties);
mHeaderFactory = sipFactory.createHeaderFactory();
mAddressFactory = sipFactory.createAddressFactory();
mMessageFactory = sipFactory.createMessageFactory();
ListeningPoint lp = mSipStack.createListeningPoint(mIPAddress, mUdpPort, "udp");
mSipProvider = mSipStack.createSipProvider(lp);
mSipProvider.addSipListener(this);
}
示例5: addEventListener
import java.util.TooManyListenersException; //导入依赖的package包/类
public void addEventListener(
SerialPortEventListener lsnr ) throws TooManyListenersException
{
/* Don't let and notification requests happen until the
Eventloop is ready
*/
if (debug)
z.reportln( "RXTXPort:addEventListener()");
if( SPEventListener != null )
{
throw new TooManyListenersException();
}
SPEventListener = lsnr;
if( !MonitorThreadAlive )
{
MonitorThreadLock = true;
monThread = new MonitorThread();
monThread.start();
waitForTheNativeCodeSilly();
MonitorThreadAlive=true;
}
if (debug)
z.reportln( "RXTXPort:Interrupt=false");
}
示例6: installDropTargetHandler
import java.util.TooManyListenersException; //导入依赖的package包/类
/**
*
*/
protected void installDropTargetHandler()
{
DropTarget dropTarget = graphComponent.getDropTarget();
try
{
if (dropTarget != null)
{
dropTarget.addDropTargetListener(this);
currentDropTarget = dropTarget;
}
}
catch (TooManyListenersException tmle)
{
// should not happen... swing drop target is multicast
}
}
示例7: EditorRuler
import java.util.TooManyListenersException; //导入依赖的package包/类
/**
* Constructs a new ruler for the specified graph and orientation.
*
* @param graph The graph to create the ruler for.
* @param orientation The orientation to use for the ruler.
*/
public EditorRuler(mxGraphComponent graphComponent, int orientation) {
this.orientation = orientation;
this.graphComponent = graphComponent;
updateIncrementAndUnits();
graphComponent.getGraph().getView().addListener(mxEvent.SCALE, repaintHandler);
graphComponent.getGraph().getView().addListener(mxEvent.TRANSLATE, repaintHandler);
graphComponent.getGraph().getView().addListener(mxEvent.SCALE_AND_TRANSLATE, repaintHandler);
graphComponent.getGraphControl().addMouseMotionListener(this);
DropTarget dropTarget = graphComponent.getDropTarget();
try {
if (dropTarget != null) {
dropTarget.addDropTargetListener(this);
}
} catch (TooManyListenersException tmle) {
// should not happen... swing drop target is multicast
}
setBorder(BorderFactory.createLineBorder(Color.black));
}
示例8: open
import java.util.TooManyListenersException; //导入依赖的package包/类
public void open() throws PortInUseException, UnsupportedCommOperationException, TooManyListenersException, IOException
{
if (open)
{
log.info(commId.getName() + " already open, skipping");
return;
}
log.info("Opening port " + commId.getName());
buffer = new ByteBuffer();
port = (SerialPort)commId.open("TimerInterface-"+commId.getName(), 30000);
port.setSerialPortParams(9600, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE);
port.setFlowControlMode(SerialPort.FLOWCONTROL_NONE);
port.addEventListener(this);
port.notifyOnDataAvailable(true);
port.enableReceiveTimeout(30);
os = port.getOutputStream();
is = port.getInputStream();
open = true;
}
示例9: TraceTabbedPane
import java.util.TooManyListenersException; //导入依赖的package包/类
public TraceTabbedPane(TracerViewerSetting tracerViewerSetting, RecentFileContainer recentFileContainer) {
super();
this.tracerViewerSetting = tracerViewerSetting;
this.recentFileContainer = recentFileContainer;
fileTabIndexMap = new LinkedHashMap<String, Integer>();
setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
normalBorder = getBorder();
try {
DropTarget dt = new DropTarget();
dt.addDropTargetListener(this);
setDropTarget(dt);
} catch (TooManyListenersException e) {
LOG.error("Error adding drag drop listener", e);
}
}
示例10: LogTabbedPane
import java.util.TooManyListenersException; //导入依赖的package包/类
public LogTabbedPane(LogViewerSetting logViewerSetting, RecentFileContainer recentFileContainer) {
super();
this.logViewerSetting = logViewerSetting;
this.recentFileContainer = recentFileContainer;
fileTabIndexMap = new LinkedHashMap<String, Integer>();
tailingFileList = new ArrayList<>();
setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
normalBorder = getBorder();
try {
DropTarget dt = new DropTarget();
dt.addDropTargetListener(this);
setDropTarget(dt);
} catch (TooManyListenersException e) {
LOG.error("Error initialising LogTabbedPane.", e);
}
}
示例11: write
import java.util.TooManyListenersException; //导入依赖的package包/类
private void write(byte[] data) {
try {
if (m_out == null) {
m_PortIdPrinter = CommPortIdentifier.getPortIdentifier(m_sPortScale); // Tomamos el puerto
m_CommPortPrinter = (SerialPort) m_PortIdPrinter.open("PORTID", 2000); // Abrimos el puerto
m_out = m_CommPortPrinter.getOutputStream(); // Tomamos el chorro de escritura
m_in = m_CommPortPrinter.getInputStream();
m_CommPortPrinter.addEventListener(this);
m_CommPortPrinter.notifyOnDataAvailable(true);
m_CommPortPrinter.setSerialPortParams(4800, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_ODD); // Configuramos el puerto
}
m_out.write(data);
} catch (NoSuchPortException | PortInUseException | UnsupportedCommOperationException | TooManyListenersException | IOException e) {
}
}
示例12: write
import java.util.TooManyListenersException; //导入依赖的package包/类
private void write(byte[] data) {
try {
if (m_out == null) {
m_PortIdPrinter = CommPortIdentifier.getPortIdentifier(m_sPortScale);
m_CommPortPrinter = (SerialPort) m_PortIdPrinter.open("PORTID", 2000);
m_out = m_CommPortPrinter.getOutputStream();
m_in = m_CommPortPrinter.getInputStream();
m_CommPortPrinter.addEventListener(this);
m_CommPortPrinter.notifyOnDataAvailable(true);
m_CommPortPrinter.setSerialPortParams(9600,
SerialPort.DATABITS_7,
SerialPort.STOPBITS_1,
SerialPort.PARITY_EVEN);
}
m_out.write(data);
} catch (NoSuchPortException | PortInUseException | UnsupportedCommOperationException | TooManyListenersException | IOException e) {
}
}
示例13: DropTarget
import java.util.TooManyListenersException; //导入依赖的package包/类
/**
* Creates a new DropTarget given the <code>Component</code>
* to associate itself with, an <code>int</code> representing
* the default acceptable action(s) to
* support, a <code>DropTargetListener</code>
* to handle event processing, a <code>boolean</code> indicating
* if the <code>DropTarget</code> is currently accepting drops, and
* a <code>FlavorMap</code> to use (or null for the default <CODE>FlavorMap</CODE>).
* <P>
* The Component will receive drops only if it is enabled.
* @param c The <code>Component</code> with which this <code>DropTarget</code> is associated
* @param ops The default acceptable actions for this <code>DropTarget</code>
* @param dtl The <code>DropTargetListener</code> for this <code>DropTarget</code>
* @param act Is the <code>DropTarget</code> accepting drops.
* @param fm The <code>FlavorMap</code> to use, or null for the default <CODE>FlavorMap</CODE>
* @exception HeadlessException if GraphicsEnvironment.isHeadless()
* returns true
* @see java.awt.GraphicsEnvironment#isHeadless
*/
public DropTarget(Component c, int ops, DropTargetListener dtl,
boolean act, FlavorMap fm)
throws HeadlessException
{
if (GraphicsEnvironment.isHeadless()) {
throw new HeadlessException();
}
component = c;
setDefaultActions(ops);
if (dtl != null) try {
addDropTargetListener(dtl);
} catch (TooManyListenersException tmle) {
// do nothing!
}
if (c != null) {
c.setDropTarget(this);
setActive(act);
}
if (fm != null) flavorMap = fm;
}
示例14: initListener
import java.util.TooManyListenersException; //导入依赖的package包/类
public void initListener() {
try
{
serialPort.addEventListener(this);
serialPort.notifyOnDataAvailable(true);
System.out.println("Listener started.");
}
catch (TooManyListenersException e)
{
logText = "Too many listeners. (" + e.toString() + ")";
if(window == null){
System.out.println(logText);
}
else{
//window.txtLog.setForeground(Color.RED);
window.txtLog.append(logText + "\n");
}
}
}
示例15: openSerial
import java.util.TooManyListenersException; //导入依赖的package包/类
public void openSerial(String serialPortName, int speed) throws PortInUseException, IOException, UnsupportedCommOperationException, TooManyListenersException {
CommPortIdentifier commPortIdentifier = findPort(serialPortName);
// initalize serial port
serialPort = (SerialPort) commPortIdentifier.open("Arduino", 2000);
inputStream = serialPort.getInputStream();
serialPort.addEventListener(this);
// activate the DATA_AVAILABLE notifier
serialPort.notifyOnDataAvailable(true);
serialPort.setSerialPortParams(speed, SerialPort.DATABITS_8,
SerialPort.STOPBITS_1, SerialPort.PARITY_NONE);
serialPort.setFlowControlMode(SerialPort.FLOWCONTROL_NONE);
}